aboutsummaryrefslogtreecommitdiffhomepage
path: root/ext/detours/samples
diff options
context:
space:
mode:
authorAndrzej Janik <[email protected]>2021-01-03 17:52:14 +0100
committerAndrzej Janik <[email protected]>2021-01-03 17:52:14 +0100
commit77523940b39d522adc26b18f00c3373407523c55 (patch)
tree666a5541f635b56d1f56305767a09cab2ae48d81 /ext/detours/samples
parentae950163cd05f7a2205740af0acc6e427f0ffd92 (diff)
parentdabc40cb19bf4e297c32284d26c74adbd6775e49 (diff)
downloadZLUDA-77523940b39d522adc26b18f00c3373407523c55.tar.gz
ZLUDA-77523940b39d522adc26b18f00c3373407523c55.zip
Merge commit 'dabc40cb19bf4e297c32284d26c74adbd6775e49' as 'ext/detours'
Diffstat (limited to 'ext/detours/samples')
-rw-r--r--ext/detours/samples/Makefile307
-rw-r--r--ext/detours/samples/README.TXT65
-rw-r--r--ext/detours/samples/comeasy/Makefile116
-rw-r--r--ext/detours/samples/comeasy/comeasy.cpp69
-rw-r--r--ext/detours/samples/comeasy/wrotei.cpp167
-rw-r--r--ext/detours/samples/comeasy/wrotei.rc17
-rw-r--r--ext/detours/samples/commem/Makefile48
-rw-r--r--ext/detours/samples/commem/commem.cpp114
-rw-r--r--ext/detours/samples/common.mak86
-rw-r--r--ext/detours/samples/cping/Makefile130
-rw-r--r--ext/detours/samples/cping/ReadMe.Txt47
-rw-r--r--ext/detours/samples/cping/cping.cpp2245
-rw-r--r--ext/detours/samples/cping/cping.dat0
-rw-r--r--ext/detours/samples/cping/iping.idl23
-rw-r--r--ext/detours/samples/disas/Makefile76
-rw-r--r--ext/detours/samples/disas/arm.asm232
-rw-r--r--ext/detours/samples/disas/disas.cpp702
-rw-r--r--ext/detours/samples/disas/ia64.asm1084
-rw-r--r--ext/detours/samples/disas/unk.cpp15
-rw-r--r--ext/detours/samples/disas/x64.asm520
-rw-r--r--ext/detours/samples/disas/x86.cpp184
-rw-r--r--ext/detours/samples/dtest/Makefile107
-rw-r--r--ext/detours/samples/dtest/NORMAL_IA64.TXT116
-rw-r--r--ext/detours/samples/dtest/NORMAL_X64.TXT116
-rw-r--r--ext/detours/samples/dtest/NORMAL_X86.TXT116
-rw-r--r--ext/detours/samples/dtest/dtarge.cpp306
-rw-r--r--ext/detours/samples/dtest/dtarge.h60
-rw-r--r--ext/detours/samples/dtest/dtarge.rc17
-rw-r--r--ext/detours/samples/dtest/dtest.cpp658
-rw-r--r--ext/detours/samples/dumpe/Makefile53
-rw-r--r--ext/detours/samples/dumpe/dumpe.cpp129
-rw-r--r--ext/detours/samples/dumpi/Makefile47
-rw-r--r--ext/detours/samples/dumpi/dumpi.cpp270
-rw-r--r--ext/detours/samples/dynamic_alloc/Makefile77
-rw-r--r--ext/detours/samples/dynamic_alloc/main.cpp194
-rw-r--r--ext/detours/samples/dynamic_alloc/x64.asm25
-rw-r--r--ext/detours/samples/dynamic_alloc/x86.asm31
-rw-r--r--ext/detours/samples/echo/Makefile108
-rw-r--r--ext/detours/samples/echo/echofx.cpp60
-rw-r--r--ext/detours/samples/echo/echofx.rc17
-rw-r--r--ext/detours/samples/echo/echonul.cpp18
-rw-r--r--ext/detours/samples/echo/main.cpp24
-rw-r--r--ext/detours/samples/einst/Makefile148
-rw-r--r--ext/detours/samples/einst/edll1x.cpp55
-rw-r--r--ext/detours/samples/einst/edll2x.cpp55
-rw-r--r--ext/detours/samples/einst/edll3x.cpp82
-rw-r--r--ext/detours/samples/einst/einst.cpp98
-rw-r--r--ext/detours/samples/excep/Makefile47
-rw-r--r--ext/detours/samples/excep/excep.cpp125
-rw-r--r--ext/detours/samples/excep/firstexc.cpp191
-rw-r--r--ext/detours/samples/excep/firstexc.h21
-rw-r--r--ext/detours/samples/findfunc/Makefile178
-rw-r--r--ext/detours/samples/findfunc/extend.cpp152
-rw-r--r--ext/detours/samples/findfunc/extend.rc17
-rw-r--r--ext/detours/samples/findfunc/findfunc.cpp35
-rw-r--r--ext/detours/samples/findfunc/symtest.cpp385
-rw-r--r--ext/detours/samples/findfunc/target.cpp41
-rw-r--r--ext/detours/samples/findfunc/target.h14
-rw-r--r--ext/detours/samples/findfunc/target.rc17
-rw-r--r--ext/detours/samples/impmunge/Makefile56
-rw-r--r--ext/detours/samples/impmunge/impmunge.cpp464
-rw-r--r--ext/detours/samples/member/Makefile48
-rw-r--r--ext/detours/samples/member/member.cpp116
-rw-r--r--ext/detours/samples/opengl/Makefile112
-rw-r--r--ext/detours/samples/opengl/ogldet.cpp74
-rw-r--r--ext/detours/samples/opengl/ogldet.rc17
-rw-r--r--ext/detours/samples/opengl/testogl.cpp24
-rw-r--r--ext/detours/samples/region/Makefile48
-rw-r--r--ext/detours/samples/region/region.cpp104
-rw-r--r--ext/detours/samples/setdll/Makefile62
-rw-r--r--ext/detours/samples/setdll/setdll.cpp332
-rw-r--r--ext/detours/samples/simple/Makefile120
-rw-r--r--ext/detours/samples/simple/simple.cpp76
-rw-r--r--ext/detours/samples/simple/simple.rc17
-rw-r--r--ext/detours/samples/simple/sleep5.cpp29
-rw-r--r--ext/detours/samples/slept/Makefile194
-rw-r--r--ext/detours/samples/slept/NORMAL_IA64.TXT202
-rw-r--r--ext/detours/samples/slept/NORMAL_X64.TXT202
-rw-r--r--ext/detours/samples/slept/NORMAL_X86.TXT202
-rw-r--r--ext/detours/samples/slept/dslept.cpp141
-rw-r--r--ext/detours/samples/slept/dslept.rc17
-rw-r--r--ext/detours/samples/slept/sleepbed.cpp103
-rw-r--r--ext/detours/samples/slept/sleepnew.cpp76
-rw-r--r--ext/detours/samples/slept/sleepold.cpp69
-rw-r--r--ext/detours/samples/slept/slept.cpp130
-rw-r--r--ext/detours/samples/slept/slept.h18
-rw-r--r--ext/detours/samples/slept/slept.rc17
-rw-r--r--ext/detours/samples/slept/verify.cpp74
-rw-r--r--ext/detours/samples/syelog/Makefile101
-rw-r--r--ext/detours/samples/syelog/sltest.cpp145
-rw-r--r--ext/detours/samples/syelog/sltestp.cpp104
-rw-r--r--ext/detours/samples/syelog/syelog.cpp847
-rw-r--r--ext/detours/samples/syelog/syelog.h89
-rw-r--r--ext/detours/samples/syelog/syelogd.cpp556
-rw-r--r--ext/detours/samples/talloc/Makefile332
-rw-r--r--ext/detours/samples/talloc/NORMAL_IA64.TXT70
-rw-r--r--ext/detours/samples/talloc/NORMAL_X64.TXT66
-rw-r--r--ext/detours/samples/talloc/talloc.cpp541
-rw-r--r--ext/detours/samples/talloc/tdll1x.cpp17
-rw-r--r--ext/detours/samples/talloc/tdll2x.cpp17
-rw-r--r--ext/detours/samples/talloc/tdll3x.cpp17
-rw-r--r--ext/detours/samples/talloc/tdll4x.cpp17
-rw-r--r--ext/detours/samples/talloc/tdll5x.cpp17
-rw-r--r--ext/detours/samples/talloc/tdll6x.cpp17
-rw-r--r--ext/detours/samples/talloc/tdll7x.cpp17
-rw-r--r--ext/detours/samples/talloc/tdll8x.cpp17
-rw-r--r--ext/detours/samples/talloc/tdll9x.cpp17
-rw-r--r--ext/detours/samples/traceapi/Makefile153
-rw-r--r--ext/detours/samples/traceapi/_win32.cpp37069
-rw-r--r--ext/detours/samples/traceapi/testapi.cpp94
-rw-r--r--ext/detours/samples/traceapi/trcapi.cpp473
-rw-r--r--ext/detours/samples/traceapi/trcapi.rc17
-rw-r--r--ext/detours/samples/tracebld/Makefile157
-rw-r--r--ext/detours/samples/tracebld/tracebld.cpp569
-rw-r--r--ext/detours/samples/tracebld/tracebld.h59
-rw-r--r--ext/detours/samples/tracebld/trcbld.cpp4573
-rw-r--r--ext/detours/samples/tracebld/trcbld.rc17
-rw-r--r--ext/detours/samples/tracelnk/Makefile103
-rw-r--r--ext/detours/samples/tracelnk/trclnk.cpp685
-rw-r--r--ext/detours/samples/tracelnk/trclnk.rc17
-rw-r--r--ext/detours/samples/tracemem/Makefile82
-rw-r--r--ext/detours/samples/tracemem/trcmem.cpp521
-rw-r--r--ext/detours/samples/tracemem/trcmem.rc17
-rw-r--r--ext/detours/samples/tracereg/Makefile82
-rw-r--r--ext/detours/samples/tracereg/trcreg.cpp1577
-rw-r--r--ext/detours/samples/tracereg/trcreg.rc17
-rw-r--r--ext/detours/samples/traceser/Makefile82
-rw-r--r--ext/detours/samples/traceser/trcser.cpp1180
-rw-r--r--ext/detours/samples/traceser/trcser.rc17
-rw-r--r--ext/detours/samples/tracessl/Makefile94
-rw-r--r--ext/detours/samples/tracessl/trcssl.cpp1782
-rw-r--r--ext/detours/samples/tracessl/trcssl.rc17
-rw-r--r--ext/detours/samples/tracetcp/Makefile98
-rw-r--r--ext/detours/samples/tracetcp/trctcp.cpp1894
-rw-r--r--ext/detours/samples/tracetcp/trctcp.rc17
-rw-r--r--ext/detours/samples/tryman/Makefile248
-rw-r--r--ext/detours/samples/tryman/managed.cs48
-rw-r--r--ext/detours/samples/tryman/size.cpp94
-rw-r--r--ext/detours/samples/tryman/tryman.cpp23
-rw-r--r--ext/detours/samples/tryman/tstman.cpp334
-rw-r--r--ext/detours/samples/tryman/tstman.rc17
-rw-r--r--ext/detours/samples/withdll/Makefile60
-rw-r--r--ext/detours/samples/withdll/withdll.cpp540
143 files changed, 69432 insertions, 0 deletions
diff --git a/ext/detours/samples/Makefile b/ext/detours/samples/Makefile
new file mode 100644
index 0000000..7952095
--- /dev/null
+++ b/ext/detours/samples/Makefile
@@ -0,0 +1,307 @@
+##############################################################################
+##
+## Makefile for Detours Test Programs.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+## Note:
+## syelog, setdll, and withdll must be built first because a number of the
+## other samples depend on them.
+##
+
+ROOT=..
+!include .\common.mak
+
+##############################################################################
+
+all:
+ cd "$(MAKEDIR)\syelog"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+ cd "$(MAKEDIR)\simple"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+ cd "$(MAKEDIR)\slept"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+ cd "$(MAKEDIR)\setdll"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+ cd "$(MAKEDIR)\withdll"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+ cd "$(MAKEDIR)\cping"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+ cd "$(MAKEDIR)\disas"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+ cd "$(MAKEDIR)\dtest"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+ cd "$(MAKEDIR)\dumpe"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+ cd "$(MAKEDIR)\dumpi"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+ cd "$(MAKEDIR)\echo"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+!IF "$(DETOURS_TARGET_PROCESSOR)" != "ARM64"
+ cd "$(MAKEDIR)\einst"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+!ENDIF
+!IF "$(DETOURS_TARGET_PROCESSOR)" == "X86"
+ cd "$(MAKEDIR)\excep"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+!ENDIF
+ cd "$(MAKEDIR)\comeasy"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+ cd "$(MAKEDIR)\commem"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+!IF "$(DETOURS_TARGET_PROCESSOR)" != "ARM64"
+ cd "$(MAKEDIR)\findfunc"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+!ENDIF
+!IF "$(DETOURS_TARGET_PROCESSOR)" != "ARM" && "$(DETOURS_TARGET_PROCESSOR)" != "ARM64"
+ cd "$(MAKEDIR)\member"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+!ENDIF
+ cd "$(MAKEDIR)\region"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+!IF "$(DETOURS_TARGET_PROCESSOR)" == "X64" || "$(DETOURS_TARGET_PROCESSOR)" == "IA64"
+ cd "$(MAKEDIR)\talloc"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+!ENDIF
+ cd "$(MAKEDIR)\traceapi"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+ cd "$(MAKEDIR)\tracebld"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+ cd "$(MAKEDIR)\tracemem"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+ cd "$(MAKEDIR)\tracereg"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+ cd "$(MAKEDIR)\traceser"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+ cd "$(MAKEDIR)\tracessl"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+ cd "$(MAKEDIR)\tracetcp"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+ cd "$(MAKEDIR)\tracelnk"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+!IF "$(DETOURS_TARGET_PROCESSOR)" != "ARM" && "$(DETOURS_TARGET_PROCESSOR)" != "ARM64"
+ cd "$(MAKEDIR)\tryman"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+!ENDIF
+ cd "$(MAKEDIR)\impmunge"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+ cd "$(MAKEDIR)\dynamic_alloc"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS)
+ cd "$(MAKEDIR)"
+
+clean:
+ cd "$(MAKEDIR)\syelog"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\simple"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\slept"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\setdll"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\withdll"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\cping"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\disas"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\dtest"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\dumpe"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\dumpi"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\echo"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\einst"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\excep"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\comeasy"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\commem"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\findfunc"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\member"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\region"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\talloc"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\traceapi"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\tracebld"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\tracemem"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\tracereg"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\traceser"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\tracessl"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\tracetcp"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\tracelnk"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\tryman"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\impmunge"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)\dynamic_alloc"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) clean
+ cd "$(MAKEDIR)"
+ -rmdir lib32 2>nul
+ -rmdir lib64 2>nul
+ -rmdir include 2>nul
+
+realclean:
+ cd "$(MAKEDIR)\syelog"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\simple"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\slept"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\setdll"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\withdll"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\cping"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\disas"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\dtest"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\dumpe"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\dumpi"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\echo"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\einst"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\excep"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\comeasy"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\commem"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\findfunc"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\member"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\region"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\talloc"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\traceapi"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\tracebld"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\tracemem"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\tracereg"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\traceser"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\tracessl"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\tracetcp"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\tracelnk"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\tryman"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\impmunge"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)\dynamic_alloc"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) realclean
+ cd "$(MAKEDIR)"
+ -rmdir lib32 2>nul
+ -rmdir lib64 2>nul
+ -rmdir include 2>nul
+
+test:
+ cd "$(MAKEDIR)\syelog"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+ cd "$(MAKEDIR)\simple"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+!IF "$(DETOURS_TARGET_PROCESSOR)" != "ARM64"
+ cd "$(MAKEDIR)\slept"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+ cd "$(MAKEDIR)\setdll"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+ cd "$(MAKEDIR)\withdll"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+!ENDIF
+!IF "$(DETOURS_TARGET_PROCESSOR)" == "X86"
+ cd "$(MAKEDIR)\cping"
+# @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+!ENDIF
+ cd "$(MAKEDIR)\disas"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+!IF "$(DETOURS_TARGET_PROCESSOR)" != "ARM64"
+ cd "$(MAKEDIR)\dtest"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+!ENDIF
+ cd "$(MAKEDIR)\dumpe"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+ cd "$(MAKEDIR)\dumpi"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+ cd "$(MAKEDIR)\echo"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+!IF "$(DETOURS_TARGET_PROCESSOR)" != "ARM64"
+ cd "$(MAKEDIR)\einst"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+!ENDIF
+!IF "$(DETOURS_TARGET_PROCESSOR)" == "X86"
+ cd "$(MAKEDIR)\excep"
+# @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+!ENDIF
+!IF "$(DETOURS_TARGET_PROCESSOR)" != "ARM64"
+ cd "$(MAKEDIR)\comeasy"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+
+ cd "$(MAKEDIR)\commem"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+ cd "$(MAKEDIR)\findfunc"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+ cd "$(MAKEDIR)\member"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+ cd "$(MAKEDIR)\region"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+!ENDIF
+!IF "$(DETOURS_TARGET_PROCESSOR)" == "X64" || "$(DETOURS_TARGET_PROCESSOR)" == "IA64"
+ cd "$(MAKEDIR)\talloc"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+!ENDIF
+!IF "$(DETOURS_TARGET_PROCESSOR)" != "ARM64"
+ cd "$(MAKEDIR)\traceapi"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+ cd "$(MAKEDIR)\tracebld"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+ cd "$(MAKEDIR)\tracemem"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+ cd "$(MAKEDIR)\tracereg"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+ cd "$(MAKEDIR)\traceser"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+!ENDIF
+# cd "$(MAKEDIR)\tracessl"
+# @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+# cd "$(MAKEDIR)\tracetcp"
+# @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+!IF "$(DETOURS_TARGET_PROCESSOR)" != "ARM64"
+ cd "$(MAKEDIR)\tracelnk"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+!ENDIF
+ cd "$(MAKEDIR)\impmunge"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+ cd "$(MAKEDIR)\dynamic_alloc"
+ @$(MAKE) /NOLOGO /$(MAKEFLAGS) test
+ cd "$(MAKEDIR)"
+
+##
+################################################################# End of File.
diff --git a/ext/detours/samples/README.TXT b/ext/detours/samples/README.TXT
new file mode 100644
index 0000000..11b8817
--- /dev/null
+++ b/ext/detours/samples/README.TXT
@@ -0,0 +1,65 @@
+##############################################################################
+##
+## Samples README File
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+This README file describes how to set up your build environment, build
+samples, and run tests.
+
+BUILD ENVIRONMENT:
+==================
+We assume that you have a version of the Visual Studio IDE installed. You can
+download a free copy of the Visual Studio IDE from
+https://visualstudio.microsoft.com. During Visual Studio installation, make
+sure that C/C++ tools are installed and that the Windows SDK is installed.
+
+Clone the Detours git repo to a directory on your machine. Choose a directory
+that does not have spaces in the full path name.
+
+BUILDING:
+=========
+Open a Developer Command Prompt for VS. Note there are several different
+flavors of the command prompt for different target architectures. The
+default Visual Studio Command prompt targets x86. To target x64, choose
+the "X64 Native Tools Command Prompt for VS"
+
+Change directory to the samples directory for your git repo. To build the
+samples, type "nmake".
+
+Note that you must build setdll and syslog in order to use many of the
+other sample programs.
+
+INSTALLING AND BUILDING VIA VCPKG:
+==================================
+You can download and install detours using the vcpkg(https://github.com/Microsoft/vcpkg) dependency manager:
+
+ git clone https://github.com/Microsoft/vcpkg.git
+ cd vcpkg
+ ./bootstrap-vcpkg.sh
+ ./vcpkg integrate install
+ vcpkg install detours
+
+The detours port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request(https://github.com/Microsoft/vcpkg) on the vcpkg repository.
+
+TESTING:
+========
+Each of the sample directories has a test, which can be invoked by typing
+"nmake test", to demonstrate the usage of the sample. With very few
+exceptions, all of the executables also accept a "/?" command to display a
+usage message.
+
+To run all sample tests, change directory to the samples directory and type
+"nmake test". Note that some samples are architecture-specific. Tests for
+those samples be run only on supported architectures and will be skipped on
+other architectures.
+
+COMMENTS:
+=========
+The trace* samples log their output through the syelogd.exe daemon and hook
+CreateProcessW to load themselves into any child processes. For example,
+typing "withdll -d:traceapi.dll cmd.exe" will create a command shell under
+which all processes log their API calls through traceapi.dll.
diff --git a/ext/detours/samples/comeasy/Makefile b/ext/detours/samples/comeasy/Makefile
new file mode 100644
index 0000000..0c3a057
--- /dev/null
+++ b/ext/detours/samples/comeasy/Makefile
@@ -0,0 +1,116 @@
+##############################################################################
+##
+## API Extension to Measure time slept.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+LIBS=$(LIBS) kernel32.lib
+
+##############################################################################
+
+all: dirs \
+ $(BIND)\wrotei$(DETOURS_BITS).dll \
+ $(BIND)\comeasy.exe \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\wrotei$(DETOURS_BITS).bsc \
+ $(OBJD)\comeasy.bsc \
+!ENDIF
+ option
+
+##############################################################################
+
+clean:
+ -del $(BIND)\wrotei*.* 2>nul
+ -del $(BIND)\comeasy.* 2>nul
+ -del $(BIND)\wrotei.* *~ 2>nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+##############################################################################
+
+$(OBJD)\wrotei.obj : wrotei.cpp
+
+$(OBJD)\wrotei.res : wrotei.rc
+
+$(BIND)\wrotei$(DETOURS_BITS).dll $(BIND)\wrotei$(DETOURS_BITS).lib: \
+ $(OBJD)\wrotei.obj $(OBJD)\wrotei.res $(DEPS)
+ cl /LD $(CFLAGS) /Fe$(@R).dll /Fd$(@R).pdb \
+ $(OBJD)\wrotei.obj $(OBJD)\wrotei.res \
+ /link $(LINKFLAGS) /subsystem:console \
+ /export:DetourFinishHelperProcess,@1,NONAME \
+ $(LIBS) ole32.lib
+
+$(OBJD)\wrotei$(DETOURS_BITS).bsc : $(OBJD)\wrotei.obj
+ bscmake /v /n /o $@ $(OBJD)\wrotei.sbr
+
+$(OBJD)\comeasy.obj : comeasy.cpp
+
+$(BIND)\comeasy.exe : $(OBJD)\comeasy.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb \
+ $(OBJD)\comeasy.obj \
+ /link $(LINKFLAGS) $(LIBS) ole32.lib \
+ /subsystem:console /fixed:no
+
+$(OBJD)\comeasy.bsc : $(OBJD)\comeasy.obj
+ bscmake /v /n /o $@ $(OBJD)\comeasy.sbr
+
+############################################### Install non-bit-size binaries.
+
+!IF "$(DETOURS_OPTION_PROCESSOR)" != ""
+
+$(OPTD)\wrotei$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\wrotei$(DETOURS_OPTION_BITS).pdb:
+
+$(BIND)\wrotei$(DETOURS_OPTION_BITS).dll : $(OPTD)\wrotei$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\wrotei$(DETOURS_OPTION_BITS).pdb : $(OPTD)\wrotei$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+
+option: \
+ $(BIND)\wrotei$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\wrotei$(DETOURS_OPTION_BITS).pdb \
+
+!ELSE
+
+option:
+
+!ENDIF
+
+##############################################################################
+
+test: all
+ @echo -------- Reseting test binaries to initial state. -----------------------
+ $(BIND)\setdll.exe -r $(BIND)\comeasy.exe
+ @echo.
+ @echo -------- Should not load slept$(DETOURS_BITS).dll --------------------------------------
+ $(BIND)\comeasy.exe
+ @echo.
+ @echo -------- Adding wrotei$(DETOURS_BITS).dll to comeasy.exe ------------------------------
+ $(BIND)\setdll.exe -d:$(BIND)\wrotei$(DETOURS_BITS).dll $(BIND)\comeasy.exe
+ @echo.
+ @echo -------- Should load wrotei$(DETOURS_BITS).dll ----------------------------------------
+ $(BIND)\comeasy.exe
+ @echo.
+ @echo -------- Removing wrotei$(DETOURS_BITS).dll from comeasy.exe --------------------------
+ $(BIND)\setdll.exe -r $(BIND)\comeasy.exe
+ @echo.
+ @echo -------- Should not load wrotei$(DETOURS_BITS).dll ------------------------------------
+ $(BIND)\comeasy.exe
+ @echo.
+ @echo -------- Should load wrotei$(DETOURS_BITS).dll dynamically using withdll.exe ----------
+ $(BIND)\withdll.exe -d:$(BIND)\wrotei$(DETOURS_BITS).dll $(BIND)\comeasy.exe
+ @echo.
+ @echo -------- Test completed. ------------------------------------------------
+
+################################################################# End of File.
diff --git a/ext/detours/samples/comeasy/comeasy.cpp b/ext/detours/samples/comeasy/comeasy.cpp
new file mode 100644
index 0000000..e5c66e8
--- /dev/null
+++ b/ext/detours/samples/comeasy/comeasy.cpp
@@ -0,0 +1,69 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detour Test Program (comeasy.cpp of comeasy.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include <ole2.h>
+#include <windows.h>
+#include <stdio.h>
+
+//////////////////////////////////////////////////////////////////////////////
+//
+int __cdecl main(int argc, char **argv)
+{
+ HRESULT hr;
+
+ (void)argc;
+ (void)argv;
+
+ LPSTREAM pStream = NULL;
+ ULARGE_INTEGER ul;
+ LARGE_INTEGER li;
+
+ printf("comeasy.exe: Starting (at %p).\n", main);
+
+ CoInitialize(NULL);
+
+ hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
+
+ ul.QuadPart = 512;
+ hr = pStream->SetSize(ul);
+
+ li.QuadPart = 0;
+ hr = pStream->Seek(li, STREAM_SEEK_SET, NULL);
+
+ printf("comeasy.exe: First write.\n");
+ fflush(stdout);
+
+ li.QuadPart = 0;
+ hr = pStream->Write(&ul, sizeof(ul), NULL);
+
+ printf("comeasy.exe: Second write.\n");
+ fflush(stdout);
+
+ li.QuadPart = 1;
+ hr = pStream->Write(&li, sizeof(li), NULL);
+
+ printf("comeasy.exe: Third write.\n");
+ fflush(stdout);
+
+ li.QuadPart = 2;
+ hr = pStream->Write(&li, sizeof(li), NULL);
+
+ pStream->Release();
+ pStream = NULL;
+
+ CoUninitialize();
+
+ printf("comeasy.exe: Exiting.\n\n");
+ fflush(stdout);
+
+ return 0;
+}
+
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/comeasy/wrotei.cpp b/ext/detours/samples/comeasy/wrotei.cpp
new file mode 100644
index 0000000..7bd925d
--- /dev/null
+++ b/ext/detours/samples/comeasy/wrotei.cpp
@@ -0,0 +1,167 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detour Test Program (wrotei.cpp of wrotei.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+// An example dynamically detouring a function.
+//
+#include <stdio.h>
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// WARNING:
+//
+// CINTERFACE must be defined so that the lpVtbl pointer is visible
+// on COM interfaces. However, once we've defined it, we must use
+// coding conventions when accessing interface members, for example:
+// i->lpVtbl->Write
+// instead of the C++ syntax:
+// i->Write.
+// We must also pass the implicit "this" parameter explicitly:
+// i->lpVtbl->Write(i, pb, 0, NULL)
+// instead of the C++ syntax:
+// i->Write(pb, 0, NULL)
+//
+#define CINTERFACE
+#include <ole2.h>
+#include <windows.h>
+#include <detours.h>
+
+//////////////////////////////////////////////////////////////////////////////
+//
+LONG dwWrote = 0;
+
+static int (WINAPI * TrueEntryPoint)(VOID) = NULL;
+static int (WINAPI * RawEntryPoint)(VOID) = NULL;
+
+//////////////////////////////////////////////////////////////////////////////
+//
+HRESULT (STDMETHODCALLTYPE *RealIStreamWrite)(IStream * This,
+ const void *pv,
+ ULONG cb,
+ ULONG *pcbWritten) = NULL;
+
+HRESULT STDMETHODCALLTYPE MineIStreamWrite(IStream * This,
+ const void *pv,
+ ULONG cb,
+ ULONG *pcbWritten)
+{
+ HRESULT hr;
+ ULONG cbWritten = 0;
+ if (pcbWritten == NULL) {
+ pcbWritten = &cbWritten;
+ }
+
+ hr = RealIStreamWrite(This, pv, cb, pcbWritten);
+
+ for (;;) {
+ LONG dwOld = dwWrote;
+ LONG dwNew = dwOld + *pcbWritten;
+
+ if (InterlockedCompareExchange(&dwWrote, dwNew, dwOld) == dwOld) {
+ break;
+ }
+ }
+
+ return hr;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+int WINAPI TimedEntryPoint(VOID)
+{
+ // We couldn't call CoInitializeEx in DllMain,
+ // so we detour the vtable entries here...
+ LONG error;
+ LPSTREAM pStream = NULL;
+
+ // Create a temporary object so we can get a vtable.
+ CreateStreamOnHGlobal(NULL, TRUE, &pStream);
+
+ // Apply the detour to the vtable.
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ if (pStream != NULL) {
+ RealIStreamWrite = pStream->lpVtbl->Write;
+ DetourAttach(&(PVOID&)RealIStreamWrite, MineIStreamWrite);
+ }
+ error = DetourTransactionCommit();
+
+ if (pStream != NULL) {
+ pStream->lpVtbl->Release(pStream);
+ pStream = NULL;
+ }
+
+ if (error == NO_ERROR) {
+ printf("wrotei" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
+ " Detoured IStream::Wrote() from OnHGlobal.\n");
+ }
+ else {
+ printf("wrotei" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
+ " Error detouring IStram::Wrote(): %ld\n", error);
+ }
+
+ printf("wrotei" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
+ " Calling EntryPoint\n\n");
+ fflush(stdout);
+
+ return TrueEntryPoint();
+}
+
+BOOL WINAPI DllMain(HINSTANCE hinst, DWORD dwReason, LPVOID reserved)
+{
+ LONG error;
+ (void)hinst;
+ (void)reserved;
+
+ if (DetourIsHelperProcess()) {
+ return TRUE;
+ }
+
+ if (dwReason == DLL_PROCESS_ATTACH) {
+ DetourRestoreAfterWith();
+
+ printf("wrotei" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
+ " Starting.\n");
+ fflush(stdout);
+
+ // NB: DllMain can't call LoadLibrary, so we hook the app entry point.
+ TrueEntryPoint = (int (WINAPI *)(VOID))DetourGetEntryPoint(NULL);
+ RawEntryPoint = TrueEntryPoint;
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)TrueEntryPoint, TimedEntryPoint);
+ error = DetourTransactionCommit();
+
+ if (error == NO_ERROR) {
+ printf("wrotei" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
+ " Detoured EntryPoint().\n");
+ }
+ else {
+ printf("wrotei" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
+ " Error detouring EntryPoint(): %ld\n", error);
+ }
+ }
+ else if (dwReason == DLL_PROCESS_DETACH) {
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ if (RealIStreamWrite != NULL) {
+ DetourDetach(&(PVOID&)RealIStreamWrite, (PVOID)MineIStreamWrite);
+ }
+ DetourDetach(&(PVOID&)TrueEntryPoint, TimedEntryPoint);
+ error = DetourTransactionCommit();
+
+ printf("wrotei" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
+ " Removed IStream::Wrote() detours (%ld), wrote %ld bytes.\n",
+ error, dwWrote);
+
+ fflush(stdout);
+ }
+ return TRUE;
+}
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/comeasy/wrotei.rc b/ext/detours/samples/comeasy/wrotei.rc
new file mode 100644
index 0000000..6a51c98
--- /dev/null
+++ b/ext/detours/samples/comeasy/wrotei.rc
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Version information for wrotei.rc.
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include "detver.h"
+
+#define VER_INTERNALNAME_STR "wrotei" DETOURS_STRINGIFY(DETOURS_BITS)
+#define VER_ORIGINALFILENAME_STR "wrotei" DETOURS_STRINGIFY(DETOURS_BITS) ".dll"
+#define VER_FILEDESCRIPTION_STR "Detours COM Easy Sample"
+#define VER_COMPANYNAME_STR "Microsoft Corporation"
+
+#include "common.ver"
diff --git a/ext/detours/samples/commem/Makefile b/ext/detours/samples/commem/Makefile
new file mode 100644
index 0000000..70cdd59
--- /dev/null
+++ b/ext/detours/samples/commem/Makefile
@@ -0,0 +1,48 @@
+##############################################################################
+##
+## Makefile for Detours Test Programs.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+LIBS=$(LIBS) kernel32.lib
+
+all: dirs \
+ $(BIND)\commem.exe \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\commem.bsc
+!ENDIF
+
+clean:
+ -del *~ *.obj *.sbr 2> nul
+ -del $(BIND)\commem.* 2> nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+$(BIND)\commem.obj : commem.cpp
+
+$(BIND)\commem.exe : $(OBJD)\commem.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb $(OBJD)\commem.obj \
+ /link $(LINKFLAGS) $(LIBS) ole32.lib /subsystem:console
+
+$(OBJD)\commem.bsc : $(OBJD)\commem.obj
+ bscmake /v /n /o $@ $(OBJD)\commem.sbr
+
+##############################################################################
+
+test: $(BIND)\commem.exe
+ @echo.
+ $(BIND)\commem.exe
+ @echo.
+
+################################################################# End of File.
diff --git a/ext/detours/samples/commem/commem.cpp b/ext/detours/samples/commem/commem.cpp
new file mode 100644
index 0000000..6779843
--- /dev/null
+++ b/ext/detours/samples/commem/commem.cpp
@@ -0,0 +1,114 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detour functions of a COM interface (commem.cpp of commem.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+//
+//
+#include <stdio.h>
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// WARNING:
+//
+// CINTERFACE must be defined so that the lpVtbl pointer is visible
+// on COM interfaces. However, once we've defined it, we must use
+// coding conventions when accessing interface members, for example:
+// i->lpVtbl->Write
+// instead of the C++ syntax:
+// i->Write.
+// We must also pass the implicit "this" parameter explicitly:
+// i->lpVtbl->Write(i, pb, 0, NULL)
+// instead of the C++ syntax:
+// i->Write(pb, 0, NULL)
+//
+#define CINTERFACE
+#include <ole2.h>
+#include <windows.h>
+#include <detours.h>
+
+//////////////////////////////////////////////////////////////////////////////
+//
+HRESULT (STDMETHODCALLTYPE *RealIStreamWrite)(IStream * This,
+ const void *pv,
+ ULONG cb,
+ ULONG *pcbWritten) = NULL;
+
+HRESULT STDMETHODCALLTYPE MineIStreamWrite(IStream * This,
+ const void *pv,
+ ULONG cb,
+ ULONG *pcbWritten)
+{
+ HRESULT hr;
+ ULONG cbWritten = 0;
+ if (pcbWritten == NULL) {
+ pcbWritten = &cbWritten;
+ }
+
+ printf("commem: %p->IStreamWrite(pv=%p, cb=%ld)\n", This, pv, cb);
+ hr = RealIStreamWrite(This, pv, cb, pcbWritten);
+ printf("commem: %p->IStreamWrite -> %08lx (pcbWritten=%ld)\n", This, hr, *pcbWritten);
+
+ return hr;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+int main(int argc, char **argv)
+{
+ HRESULT hr;
+
+ (void)argc;
+ (void)argv;
+
+ LPSTREAM pStream = NULL;
+ ULARGE_INTEGER ul;
+ LARGE_INTEGER li;
+
+ CoInitialize(NULL);
+
+ hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
+
+ RealIStreamWrite = pStream->lpVtbl->Write;
+
+ ul.QuadPart = 512;
+ hr = pStream->lpVtbl->SetSize(pStream, ul);
+ li.QuadPart = 0;
+ hr = pStream->lpVtbl->Seek(pStream, li, STREAM_SEEK_SET, NULL);
+
+ printf("commem: Calling Write w/o before attach.\n");
+
+ li.QuadPart = 0;
+ hr = pStream->lpVtbl->Write(pStream, &ul, sizeof(ul), NULL);
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)RealIStreamWrite, MineIStreamWrite);
+ DetourTransactionCommit();
+
+ printf("commem: Calling Write w/o after attach.\n");
+
+ li.QuadPart = 1;
+ hr = pStream->lpVtbl->Write(pStream, &li, sizeof(li), NULL);
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourDetach(&(PVOID&)RealIStreamWrite, MineIStreamWrite);
+ DetourTransactionCommit();
+
+ printf("commem: Calling Write w/o after detach.\n");
+
+ li.QuadPart = 2;
+ hr = pStream->lpVtbl->Write(pStream, &li, sizeof(li), NULL);
+
+ hr = pStream->lpVtbl->Release(pStream);
+ pStream = NULL;
+
+ CoUninitialize();
+
+ return 0;
+}
+
diff --git a/ext/detours/samples/common.mak b/ext/detours/samples/common.mak
new file mode 100644
index 0000000..aa63a15
--- /dev/null
+++ b/ext/detours/samples/common.mak
@@ -0,0 +1,86 @@
+##############################################################################
+##
+## Common makefile for Detours test programs.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!IF "$(ROOT)" == ""
+ROOT = ..\..
+!ENDIF
+!include "$(ROOT)\system.mak"
+
+!IF "$(DETOURS_SOURCE_BROWSING)" == ""
+DETOURS_SOURCE_BROWSING=0
+!ENDIF
+
+##############################################################################
+
+!IFNDEF CLIB
+CLIB=/MT
+!ENDIF
+
+AFLAGS=/nologo /Zi /c /Fl
+CFLAGS=/nologo /Zi $(CLIB) /Gm- /W4 /WX /we4777 /we4800 /Od
+
+!IF $(DETOURS_SOURCE_BROWSING)==1
+CFLAGS=$(CFLAGS) /FR
+!ELSE
+CFLAGS=$(CFLAGS) /I$(INCD)
+!ENDIF
+
+LIBFLAGS=/nologo
+LINKFLAGS=/release /incremental:no /profile /nodefaultlib:oldnames.lib
+
+!if defined(DETOURS_WIN_7) && defined(DETOURS_CL_17_OR_NEWER)
+CFLAGS=$(CFLAGS) /D_USING_V110_SDK71_
+!endif
+
+!IF "$(DETOURS_TARGET_PROCESSOR)" == "X86"
+
+ASM=ml
+
+!ELSEIF "$(DETOURS_TARGET_PROCESSOR)" == "X64"
+
+ASM=ml64
+
+!ELSEIF "$(DETOURS_TARGET_PROCESSOR)" == "IA64"
+
+ASM=ias
+AFLAGS=-F COFF32_PLUS
+CFLAGS=$(CFLAGS) /wd4163 # intrinsic rdtebex not available; using newer Windows headers with older compiler
+#CFLAGS=$(CFLAGS) /wd4996 /wd4068
+
+!ELSEIF "$(DETOURS_TARGET_PROCESSOR)" == "ARM"
+
+ASM=armasm
+AFLAGS=-coff_thumb2_only
+CFLAGS=$(CFLAGS) /D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
+
+CFLAGS=$(CFLAGS) /D_$(DETOURS_TARGET_PROCESSOR:X64=AMD64)_ # redundant with windows.h except for midl proxies
+
+!ENDIF
+
+DEPS = $(LIBD)\syelog.lib $(LIBD)\detours.lib
+LIBS = $(DEPS)
+
+##############################################################################
+##
+
+.SUFFIXES: .cpp .h .obj .rc .res
+
+!ifdef DETOURS_ANALYZE
+.cpp{$(OBJD)}.obj:
+ $(CC) $(CFLAGS) /Fd$(OBJD)\vc.pdb /Fo$(OBJD)\ /c $<
+!else
+.cpp{$(OBJD)}.obj::
+ $(CC) $(CFLAGS) /Fd$(OBJD)\vc.pdb /Fo$(OBJD)\ /c $<
+!endif
+
+.rc{$(OBJD)}.res:
+ rc /nologo /DDETOURS_BITS=$(DETOURS_BITS) /fo$(@) /i$(INCD) $(*B).rc
+
+##
+################################################################# End of File.
diff --git a/ext/detours/samples/cping/Makefile b/ext/detours/samples/cping/Makefile
new file mode 100644
index 0000000..cc99a09
--- /dev/null
+++ b/ext/detours/samples/cping/Makefile
@@ -0,0 +1,130 @@
+##############################################################################
+##
+## Makefile for Detours Test Programs.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+LIBS=$(LIBS) \
+ kernel32.lib \
+ user32.lib \
+ shell32.lib \
+ uuid.lib \
+ ole32.lib \
+ rpcrt4.lib \
+ advapi32.lib \
+ wsock32.lib \
+
+# RpcProxy.h uses #ifdef WIN32.
+
+!if "$(DETOURS_TARGET_PROCESSOR)" == "ARM"
+CFLAGS = $(CFLAGS) /D_WIN32_WINNT=0x0500
+!else
+CFLAGS = $(CFLAGS) /D_WIN32_WINNT=0x0400
+!endif
+
+CFLAGS = $(CFLAGS) /Fd$(OBJD)\vc.pdb \
+ /DCONST_VTABLE \
+ /DCOBJMACROS -DWIN32 -DNT
+
+C__FLAGS=-DENTRY_PREFIX=iping_ -DREGISTER_PROXY_DLL
+CPPFLAGS=
+
+##############################################################################
+
+.SUFFIXES: .c .cpp .h .idl .obj .res .rc
+
+{$(OBJD)}.c{$(OBJD)}.obj:
+ $(CC) $(CFLAGS:/W4=/W3) $(C__FLAGS) /I$(OBJD) /Fo$(OBJD)\ /c $<
+
+!ifdef DETOURS_ANALYZE
+.cpp{$(OBJD)}.obj:
+ $(CC) $(CFLAGS) $(CPPFLAGS) /I$(OBJD) /Fo$(OBJD)\ /c $<
+!else
+.cpp{$(OBJD)}.obj::
+ $(CC) $(CFLAGS) $(CPPFLAGS) /I$(OBJD) /Fo$(OBJD)\ /c $<
+!endif
+
+.rc{$(OBJD)}.res:
+ rc /nologo /Fo$@ .\$(*B).rc
+
+##############################################################################
+##
+C__FLAGS=-DENTRY_PREFIX=iping_ -DREGISTER_PROXY_DLL
+CPPFLAGS=
+
+
+MIDLFLAGS=/nologo /Oif /no_format_opt
+
+!IF "$(DETOURS_TARGET_PROCESSOR)" == "X86"
+MIDLFLAGS=$(MIDLFLAGS) /no_robust /win32
+!ELSEIF "$(DETOURS_TARGET_PROCESSOR)" == "IA64"
+MIDLFLAGS=$(MIDLFLAGS) /ia64
+!ELSEIF "$(DETOURS_TARGET_PROCESSOR)" == "X64"
+MIDLFLAGS=$(MIDLFLAGS) /x64
+!ELSEIF "$(DETOURS_TARGET_PROCESSOR)" == "ARM"
+MIDLFLAGS=$(MIDLFLAGS) /arm32
+!ELSEIF "$(DETOURS_TARGET_PROCESSOR)" == "ARM64"
+MIDLFLAGS=$(MIDLFLAGS) /arm64
+!ENDIF
+
+OBJS = \
+ $(OBJD)\cping.obj \
+ \
+ $(OBJD)\iping_i.obj \
+ $(OBJD)\iping_p.obj \
+ $(OBJD)\iping_d.obj \
+
+##############################################################################
+
+all: dirs \
+ $(BIND)\cping.exe \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\cping.bsc
+!ENDIF
+
+##############################################################################
+
+clean:
+ -del iping.h *.c *.obj *.sbr *~ 2>nul
+ -del $(BIND)\cping.* 2>nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+##############################################################################
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+$(OBJD)\cping.bsc : $(OBJS)
+ bscmake /v /n /o $@ $(OBJS:.obj=.sbr)
+
+$(BIND)\cping.exe : $(OBJS) $(DEPS)
+ cl $(CFLAGS) /Fe$@ $(OBJS) /link $(LINKFLAGS) \
+ /subsystem:console $(LIBS)
+
+$(OBJD)\cping.obj: cping.cpp $(OBJD)\iping.h
+
+##############################################################################
+##
+$(OBJD)\iping.h $(OBJD)\iping_d.c $(OBJD)\iping_i.c $(OBJD)\iping_p.c : iping.idl
+ midl $(MIDLFLAGS) /out $(OBJD) /prefix all iping_ /dlldata iping_d.c iping.idl
+
+$(OBJD)\iping_i.obj: $(OBJD)\iping_i.c
+$(OBJD)\iping_p.obj: $(OBJD)\iping_p.c $(OBJD)\iping.h
+$(OBJD)\iping_d.obj: $(OBJD)\iping_d.c
+
+##############################################################################
+
+test: $(BIND)\cping.exe
+ start $(BIND)\cping.exe /s
+ $(BIND)\cping.exe /p localhost
+
+################################################################# End of File.
diff --git a/ext/detours/samples/cping/ReadMe.Txt b/ext/detours/samples/cping/ReadMe.Txt
new file mode 100644
index 0000000..fea1095
--- /dev/null
+++ b/ext/detours/samples/cping/ReadMe.Txt
@@ -0,0 +1,47 @@
+Microsoft Research Detours Package
+==============================================================================
+4/2/98
+
+* Instrumentation:
+ Read Pentium cycle counter
+
+* PC configuration:
+ DCOM/TCP, Windows NT Server 4.0,
+ between two 300MHz Pentium boxes,
+ Ethernet connecction
+
+* Client test program:
+ HRESULT get(SHORT, SHORT, LONG*)
+ average over 1,000 calls
+ midl /Oicf
+
+* Results:
+ get() {
+ <-- (1)
+ IRpcChannelBuffer::SendReceive()) {
+ <-- (2)
+ I_RpcSendReceive() {
+ <-- (3)
+ send(soc, )
+ <-- (4)
+ NtWaitForSingleObject(soc, )
+ <-- (5)
+ } // end of RPC layer
+ <-- (6)
+ } // end of channel object
+ <-- (7)
+ } // end of client call
+ Average number
+ of Pentium cycles
+ (1) NDR marshaling overhead (2 SHORTs) 13 K
+ (No! of which 11K from GetBuffer,
+ of which 6.2K from I_RpcGetBuffer()!)
+ (2) Channel object one-way (send) overhead 1.0 K
+ (3) RPC layer one-way (send) overhead 5.3 K
+ (4) TCP + all server work 200 K
+ (5) RPC layer one-way (recv) overhead 5.1 K
+ (6) Channel object one-way (recv) overhead 2.2 K
+ (7) NDR unmarshaling overhead (2 LONGs) 4.2 K
+
+ (*) send() only 17 K
+ TOTAL CYCLES for client get(): 230 K
diff --git a/ext/detours/samples/cping/cping.cpp b/ext/detours/samples/cping/cping.cpp
new file mode 100644
index 0000000..4312341
--- /dev/null
+++ b/ext/detours/samples/cping/cping.cpp
@@ -0,0 +1,2245 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Module: cping.cpp (cping.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+// COM Ping text program.
+//
+#define _RPCRT4_
+#define INITGUID
+#include <winsock2.h>
+#include <objbase.h>
+#include <objidl.h>
+#include <ocidl.h>
+#include <olectl.h>
+#include <shellapi.h>
+#include <stdio.h>
+#include <stdlib.h>
+#pragma warning(push)
+#if _MSC_VER > 1400
+#pragma warning(disable:6102 6103) // /analyze warnings
+#endif
+#include <strsafe.h>
+#pragma warning(pop)
+#include <winnt.h>
+#include <rpc.h>
+#include <rpcdcep.h>
+#include <detours.h>
+#include "iping.h"
+
+// ARM64 ReadTimeStampCounter is a function.
+// ARM ReadTimeStampCounter is a declared function but not implemented.
+// old IA64: ReadTimeStampCounter nonexisant.
+// new IA64: ReadTimeStampCounter is a macro.
+// old x86; ReadTimeStampCounter is a function.
+// new x86: ReadTimeStampCounter is a macro.
+// AMD64: ReadTimeStampCounter is a macro.
+
+#if defined(_ARM64_) || defined(ReadTimeStampCounter)
+#define GetTimeStamp() ReadTimeStampCounter()
+#elif defined(_X86_) || defined(_AMD64_)
+extern "C"
+DWORD64
+__rdtsc (
+ VOID
+ );
+#pragma intrinsic(__rdtsc)
+#define GetTimeStamp() __rdtsc()
+#else
+UINT64 GetTimeStamp(void)
+{
+ LARGE_INTEGER a = { 0 };
+ QueryPerformanceCounter(&a);
+ return a.QuadPart;
+}
+#endif
+
+#define BE_VERBOSE
+////////////////////////////////////////////////////////// Assertion Handling.
+//
+#pragma warning(disable:4127) // Many of our asserts are constants.
+
+#ifndef NODEBUG
+#undef ASSERT
+VOID PingAssertMessage(CONST PCHAR szMsg, CONST PCHAR szFile, ULONG nLine);
+#define ASSERT(x) \
+do { if (!((int)(x))) { PingAssertMessage(#x, __FILE__, __LINE__); DebugBreak(); }} while (0)
+;
+#else // NODEBUG
+#undef ASSERT
+#define ASSERT(x)
+#endif // NODEBUG
+
+//////////////////////////////////////////////////////////////////////////////
+
+#define wcssize(x) ((wcslen(x) + 1) * sizeof(WCHAR))
+#define strsize(x) ((strlen(x) + 1) * sizeof(CHAR))
+
+extern "C" {
+ ULONG WINAPI iping_DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
+ HRESULT STDAPICALLTYPE iping_DllRegisterServer(void);
+ HRESULT STDAPICALLTYPE iping_DllUnregisterServer(void);
+ HRESULT STDAPICALLTYPE iping_DllGetClassObject(REFCLSID rclsid,
+ REFIID riid, PVOID *ppv);
+ HRESULT STDAPICALLTYPE iping_DllCanUnloadNow(void);
+}
+
+STDAPI PingMessage(PCSTR msg, ...);
+
+///////////////////////////////////////////////////////////////////// Globals.
+
+void * g_pBuffer = NULL;
+WCHAR g_wzServerName[128];
+WCHAR g_wzClientName[128];
+ULONG g_cbBufferMax = 262144;
+double g_dCyclesPerSecond = 0.0;
+double g_dMsPerCycle = 0.0;
+double g_dLatency = 0.0;
+BOOL g_fSummarize = TRUE;
+ULONG g_nFixedToClient = 0;
+ULONG g_nFixedToServer = 0;
+
+//////////////////////////////////////////////////////////////////////////////
+//
+static CHAR s_szMessageBuf[2048];
+
+STDAPI PingMessage(PCSTR msg, ...)
+{
+ HRESULT hr;
+ double d = 0.0; // Required for FP support
+ (void)d;
+ va_list args;
+
+ va_start(args, msg);
+ hr = StringCchVPrintfA(s_szMessageBuf, ARRAYSIZE(s_szMessageBuf), msg, args);
+ va_end(args);
+ if (FAILED(hr)) {
+ return hr;
+ }
+
+ // OutputDebugStringA(s_szMessageBuf);
+
+ printf("%s", s_szMessageBuf);
+ return S_FALSE;
+}
+
+VOID PingAssertMessage(CONST PCHAR szMsg, CONST PCHAR szFile, ULONG nLine)
+{
+ PingMessage("%08lx ASSERT(%s) failed in %s, line %d.\n",
+ GetCurrentThreadId(), szMsg, szFile, nLine);
+ printf("ASSERT(%s) failed in %s, line %ld.\n", szMsg, szFile, nLine);
+}
+
+BOOLEAN CheckResult(HRESULT hr, PCSTR pszMsg, ...)
+{
+ if (FAILED(hr)) {
+ HRESULT ihr;
+ va_list args;
+
+ va_start(args, pszMsg);
+ ihr = StringCchVPrintfA(s_szMessageBuf, ARRAYSIZE(s_szMessageBuf), pszMsg, args);
+ va_end(args);
+ if (FAILED(ihr)) {
+ return FALSE;
+ }
+
+ printf(" %-57.57s -> %08lx\n", s_szMessageBuf, hr);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+//
+#define NTSYSAPI DECLSPEC_IMPORT
+#define NTAPI __stdcall
+#define NTSTATUS LONG
+#define PIO_APC_ROUTINE PVOID
+
+typedef struct
+{
+ NTSTATUS Status;
+ LONG Information;
+} *PIO_STATUS_BLOCK;
+
+NTSTATUS (NTAPI *Real_NtWaitForSingleObject)(HANDLE Handle,
+ BOOLEAN Alertable,
+ PLARGE_INTEGER Timeout) = NULL;
+
+NTSTATUS (NTAPI *Real_NtDeviceIoControlFile)(HANDLE FileHandle,
+ HANDLE Event,
+ PIO_APC_ROUTINE ApcRoutine,
+ PVOID ApcContext,
+ PIO_STATUS_BLOCK IoStatusBlock,
+ ULONG IoControlCode,
+ PVOID InputBuffer,
+ ULONG InputBufferLength,
+ PVOID OutputBuffer,
+ ULONG OutputBufferLength) = NULL;
+
+//////////////////////////////////////////////////////////////////////////////
+//
+static LONG s_nInCall = 0;
+static ULONG s_nThread = 0;
+
+enum {
+ E_MinValue = 0,
+ E_SleepEx = 1,
+
+ E_Proxy,
+
+ E_I_RpcGetBuffer,
+ E_I_RpcSendReceive,
+ E_I_RpcFreeBuffer,
+ E_I_RpcSend,
+ E_I_RpcReceive,
+ E_I_RpcFreePipeBuffer,
+ E_I_RpcReallocPipeBuffer,
+ E_I_RpcRequestMutex,
+ E_I_RpcClearMutex,
+ E_I_RpcAllocate,
+ E_I_RpcFree,
+ E_I_RpcPauseExecution,
+ E_I_RpcMonitorAssociation,
+ E_I_RpcStopMonitorAssociation,
+
+ E_Recv,
+ E_RecvFrom,
+ E_NtWaitForSingleObject,
+ E_NtDeviceIoControlFileRecv,
+ E_NtDeviceIoControlFile,
+
+ E_Send,
+ E_SendTo,
+ E_NtDeviceIoControlFileSend,
+
+ E_DCOM,
+ E_RPC,
+ E_UDP,
+ E_NET,
+
+ E_MaxValue,
+
+ E_DcomBeg = E_Proxy,
+ E_DcomEnd = E_Proxy,
+
+ E_RpcBeg = E_I_RpcGetBuffer,
+ E_RpcEnd = E_I_RpcStopMonitorAssociation,
+
+ E_UdpBeg = E_Send,
+ E_UdpEnd = E_NtDeviceIoControlFileSend,
+
+ E_NetBeg = E_Recv,
+ E_NetEnd = E_NtDeviceIoControlFile,
+};
+
+PCHAR s_rszRouteNames[E_MaxValue] =
+{
+ "<NULL>",
+ "SleepEx",
+ "Proxy",
+ "I_RpcGetBuffer",
+ "I_RpcSendReceive",
+ "I_RpcFreeBuffer",
+ "I_RpcSend",
+ "I_RpcReceive",
+ "I_RpcFreePipeBuffer",
+ "I_RpcReallocPipeBuffer",
+ "I_RpcRequestMutex",
+ "I_RpcClearMutex",
+ "I_RpcAllocate",
+ "I_RpcFree",
+ "I_RpcPauseExecution",
+ "I_RpcMonitorAssociation",
+ "I_RpcStopMonitorAssociation",
+ "Recv",
+ "RecvFrom",
+ "NtWaitForSingleObject",
+ "NtDeviceIoControlRecv",
+ "NtDeviceIoControlFile",
+ "Send",
+ "SendTo",
+ "NtDeviceIoControlSend",
+ "DCOM",
+ "RPC",
+ "UDP/TCP (Send Only)",
+ "NET",
+};
+
+LONGLONG s_rllCycles[E_MaxValue];
+LONGLONG s_rllTotals[E_MaxValue];
+LONG s_rllCounts[E_MaxValue];
+
+class CRouteTime
+{
+ public:
+ inline CRouteTime(LONG nRoute)
+ {
+ if (s_nInCall && GetCurrentThreadId() == s_nThread) {
+ LONGLONG llBeg;
+ m_nOldRoute = s_nRoute;
+ m_llOldMinus = s_llMinus;
+
+ s_nRoute = m_nRoute = nRoute;
+
+ s_rllCounts[m_nRoute]++;
+ s_llMinus = 0;
+ ASSERT(m_nRoute != m_nOldRoute);
+
+ llBeg = GetTimeStamp();
+ m_llBeg = llBeg;
+ }
+ else {
+ m_nRoute = 0;
+ }
+ }
+
+ inline ~CRouteTime()
+ {
+ if (m_nRoute) {
+ LONGLONG llEnd = GetTimeStamp();
+ llEnd -= m_llBeg;
+ s_rllTotals[m_nRoute] += llEnd;
+ s_rllCycles[m_nRoute] += llEnd - s_llMinus;
+ s_nRoute = m_nOldRoute;
+ s_llMinus = m_llOldMinus + llEnd;
+ }
+ }
+
+ inline BOOL Routed()
+ {
+ return m_nRoute;
+ }
+
+ public:
+ ULONG m_nRoute;
+ ULONG m_nOldRoute;
+ LONGLONG m_llBeg;
+ LONGLONG m_llOldMinus;
+ static ULONG s_nRoute;
+ static LONGLONG s_llMinus;
+};
+
+ULONG CRouteTime::s_nRoute = 0;
+LONGLONG CRouteTime::s_llMinus = 0;
+
+VOID ZeroCycles(VOID)
+{
+ for (ULONG n = 0; n < E_MaxValue; n++) {
+ s_rllCycles[n] = 0;
+ s_rllTotals[n] = 0;
+ s_rllCounts[n] = 0;
+ }
+}
+
+VOID DumpCycles(LONG nRoute)
+{
+ if (s_rllCycles[nRoute] != 0 || s_rllTotals[nRoute] != 0) {
+ printf(";; %-21.21s %10I64d %8.3fms %10I64d %8.3fms :%6ld\n",
+ s_rszRouteNames[nRoute],
+ s_rllCycles[nRoute], (double)s_rllCycles[nRoute] * g_dMsPerCycle,
+ s_rllTotals[nRoute], (double)s_rllTotals[nRoute] * g_dMsPerCycle,
+ s_rllCounts[nRoute]);
+ }
+}
+
+VOID SummarizeCycles(VOID)
+{
+ ULONG n;
+ for (n = E_DCOM; n <= E_NET; n++) {
+ s_rllCycles[n] = 0;
+ s_rllTotals[n] = 0;
+ s_rllCounts[n] = 0;
+ }
+
+ for (n = E_DcomBeg; n <= E_DcomEnd; n++) {
+ s_rllCycles[E_DCOM] += s_rllCycles[n];
+ s_rllTotals[E_DCOM] += s_rllTotals[n];
+ }
+ for (n = E_RpcBeg; n <= E_RpcEnd; n++) {
+ s_rllCycles[E_RPC] += s_rllCycles[n];
+ s_rllTotals[E_RPC] += s_rllTotals[n];
+ }
+ for (n = E_UdpBeg; n <= E_UdpEnd; n++) {
+ s_rllCycles[E_UDP] += s_rllCycles[n];
+ s_rllTotals[E_UDP] += s_rllTotals[n];
+ }
+ for (n = E_NetBeg; n <= E_NetEnd; n++) {
+ s_rllCycles[E_NET] += s_rllCycles[n];
+ s_rllTotals[E_NET] += s_rllTotals[n];
+ }
+
+#ifdef BE_VERBOSE
+ printf("::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
+ "::::::::::::::::::\n");
+ printf(":: Protocol Cycles:\n");
+ DumpCycles(E_DCOM);
+ DumpCycles(E_RPC);
+ DumpCycles(E_UDP);
+ DumpCycles(E_NET);
+#endif
+
+ s_rllCycles[E_DCOM] /= s_rllCounts[E_DCOM];
+ s_rllCycles[E_RPC] /= s_rllCounts[E_DCOM];
+ s_rllCycles[E_UDP] /= s_rllCounts[E_DCOM];
+ s_rllCycles[E_NET] /= s_rllCounts[E_DCOM];
+ s_rllTotals[E_DCOM] /= s_rllCounts[E_DCOM];
+ s_rllTotals[E_RPC] /= s_rllCounts[E_DCOM];
+ s_rllTotals[E_UDP] /= s_rllCounts[E_DCOM];
+ s_rllTotals[E_NET] /= s_rllCounts[E_DCOM];
+
+#ifdef BE_VERBOSE
+ printf("::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
+ "::::::::::::::::::\n");
+ printf(":: Protocol Cycles Per DCOM Call:\n");
+ DumpCycles(E_DCOM);
+ DumpCycles(E_RPC);
+ DumpCycles(E_UDP);
+ DumpCycles(E_NET);
+#endif
+
+ for (n = 0; n < E_DCOM; n++) {
+ s_rllCycles[n] = 0;
+ s_rllTotals[n] = 0;
+ s_rllCounts[n] = 0;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+DWORD (WINAPI * Real_SleepEx)(DWORD dwMilliseconds, BOOL bAlertable)
+ = SleepEx;
+int (WSAAPI * Real_send)(SOCKET s,
+ const char * buf, int len, int flags)
+ = send;
+int (WSAAPI * Real_sendto)(SOCKET s,
+ const char * buf, int len, int flags,
+ const struct sockaddr * to, int tolen)
+ = sendto;
+int (WSAAPI * Real_recv)(SOCKET s, char * buf, int len, int flags)
+ = recv;
+int (WSAAPI * Real_recvfrom)(SOCKET s,char * buf, int len, int flags,
+ struct sockaddr * from, int * fromlen)
+ = recvfrom;
+
+RPC_STATUS (RPC_ENTRY *
+ Real_I_RpcGetBuffer)(RPC_MESSAGE * Message)
+ = I_RpcGetBuffer;
+RPC_STATUS (RPC_ENTRY *
+ Real_I_RpcSendReceive)(RPC_MESSAGE * Message)
+ = I_RpcSendReceive;
+RPC_STATUS (RPC_ENTRY *
+ Real_I_RpcFreeBuffer)(RPC_MESSAGE * Message)
+ = I_RpcFreeBuffer;
+RPC_STATUS (RPC_ENTRY *
+ Real_I_RpcSend)(PRPC_MESSAGE Message)
+ = I_RpcSend;
+RPC_STATUS (RPC_ENTRY *
+ Real_I_RpcReceive)(PRPC_MESSAGE Message,
+ unsigned int Size)
+ = I_RpcReceive;
+RPC_STATUS (RPC_ENTRY *
+ Real_I_RpcFreePipeBuffer)(RPC_MESSAGE * Message)
+ = I_RpcFreePipeBuffer;
+RPC_STATUS (RPC_ENTRY *
+ Real_I_RpcReallocPipeBuffer)(PRPC_MESSAGE Msg,
+ unsigned int Size)
+ = I_RpcReallocPipeBuffer;
+void (RPC_ENTRY *
+ Real_I_RpcRequestMutex)(I_RPC_MUTEX * Mutex)
+ = I_RpcRequestMutex;
+void (RPC_ENTRY *
+ Real_I_RpcClearMutex)(I_RPC_MUTEX Mutex)
+ = I_RpcClearMutex;
+void * (RPC_ENTRY *
+ Real_I_RpcAllocate)(unsigned int Size)
+ = I_RpcAllocate;
+void (RPC_ENTRY *
+ Real_I_RpcFree)(void * Object)
+ = I_RpcFree;
+void (RPC_ENTRY *
+ Real_I_RpcPauseExecution)(unsigned long Milliseconds)
+ = I_RpcPauseExecution;
+
+#if _MSC_VER < 1300
+RPC_STATUS (RPC_ENTRY *
+ Real_I_RpcMonitorAssociation)(RPC_BINDING_HANDLE Handle,
+ PRPC_RUNDOWN RundownRoutine,
+ void * Context)
+ = I_RpcMonitorAssociation;
+RPC_STATUS (RPC_ENTRY *
+ Real_I_RpcStopMonitorAssociation)(RPC_BINDING_HANDLE Handle)
+ = I_RpcStopMonitorAssociation;
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+//
+static DWORD WINAPI Catch_SleepEx(DWORD dwMilliseconds, BOOL bAlertable)
+{
+ CRouteTime rt(E_SleepEx);
+ return Real_SleepEx(dwMilliseconds, bAlertable);
+}
+
+static int WSAAPI Catch_send(SOCKET s, const char * buf, int len, int flags)
+{
+ CRouteTime rt(E_Send);
+ return Real_send(s, buf, len, flags);
+}
+
+static NTSTATUS NTAPI Catch_NtWaitForSingleObject(HANDLE Handle,
+ BOOLEAN Alertable,
+ PLARGE_INTEGER Timeout)
+{
+ CRouteTime rt(E_NtWaitForSingleObject);
+ if (rt.Routed()) {
+ //printf("WaitForSingle(%d, %I64d)\n", Alertable, Timeout->QuadPart);
+ }
+
+ return Real_NtWaitForSingleObject(Handle, Alertable, Timeout);
+}
+
+#define IO_CONTROL_AFD_SEND_DATAGRAM 0x12023
+#define IO_CONTROL_AFD_SEND 0x1201f
+#define IO_CONTROL_AFD_RECV_DATAGRAM 0x1201b
+#define IO_CONTROL_AFD_RECV 0x12017
+
+static NTSTATUS NTAPI Catch_NtDeviceIoControlFile(HANDLE FileHandle,
+ HANDLE Event,
+ PIO_APC_ROUTINE ApcRoutine,
+ PVOID ApcContext,
+ PIO_STATUS_BLOCK IoStatusBlock,
+ ULONG IoControlCode,
+ PVOID InputBuffer,
+ ULONG InputBufferLength,
+ PVOID OutputBuffer,
+ ULONG OutputBufferLength)
+{
+ if (IoControlCode == IO_CONTROL_AFD_SEND_DATAGRAM ||
+ IoControlCode == IO_CONTROL_AFD_SEND) {
+ CRouteTime rt(E_NtDeviceIoControlFileSend);
+ NTSTATUS NtStatus = Real_NtDeviceIoControlFile(FileHandle,
+ Event,
+ ApcRoutine,
+ ApcContext,
+ IoStatusBlock,
+ IoControlCode,
+ InputBuffer,
+ InputBufferLength,
+ OutputBuffer,
+ OutputBufferLength);
+ if (NtStatus == STATUS_PENDING) {
+ LARGE_INTEGER li;
+ li.QuadPart = INFINITE;
+ Real_NtWaitForSingleObject(Event, FALSE, &li);
+ NtStatus = IoStatusBlock->Status;
+ }
+ return NtStatus;
+ }
+ else if (IoControlCode == IO_CONTROL_AFD_RECV_DATAGRAM ||
+ IoControlCode == IO_CONTROL_AFD_RECV) {
+ CRouteTime rt(E_NtDeviceIoControlFileRecv);
+ return Real_NtDeviceIoControlFile(FileHandle,
+ Event,
+ ApcRoutine,
+ ApcContext,
+ IoStatusBlock,
+ IoControlCode,
+ InputBuffer,
+ InputBufferLength,
+ OutputBuffer,
+ OutputBufferLength);
+ }
+ else {
+ CRouteTime rt(E_NtDeviceIoControlFile);
+ if (rt.Routed()) {
+ printf("IoControlCode: %08lx\n", IoControlCode);
+ __debugbreak();
+ }
+ return Real_NtDeviceIoControlFile(FileHandle,
+ Event,
+ ApcRoutine,
+ ApcContext,
+ IoStatusBlock,
+ IoControlCode,
+ InputBuffer,
+ InputBufferLength,
+ OutputBuffer,
+ OutputBufferLength);
+ }
+}
+
+
+static RPC_STATUS RPC_ENTRY Catch_I_RpcGetBuffer(RPC_MESSAGE * Message)
+{
+ CRouteTime rt(E_I_RpcGetBuffer);
+ return Real_I_RpcGetBuffer(Message);
+}
+
+static RPC_STATUS RPC_ENTRY Catch_I_RpcSendReceive(RPC_MESSAGE * Message)
+{
+ CRouteTime rt(E_I_RpcSendReceive);
+ return Real_I_RpcSendReceive(Message);
+}
+
+static RPC_STATUS RPC_ENTRY Catch_I_RpcFreeBuffer(RPC_MESSAGE * Message)
+{
+ CRouteTime rt(E_I_RpcFreeBuffer);
+ return Real_I_RpcFreeBuffer(Message);
+}
+
+static RPC_STATUS RPC_ENTRY Catch_I_RpcSend(PRPC_MESSAGE Message)
+{
+ CRouteTime rt(E_I_RpcSend);
+ return Real_I_RpcSend(Message);
+}
+
+static RPC_STATUS RPC_ENTRY Catch_I_RpcReceive(PRPC_MESSAGE Message, unsigned int Size)
+{
+ CRouteTime rt(E_I_RpcReceive);
+ return Real_I_RpcReceive(Message, Size);
+}
+
+static RPC_STATUS RPC_ENTRY Catch_I_RpcFreePipeBuffer(RPC_MESSAGE * Message)
+{
+ CRouteTime rt(E_I_RpcFreePipeBuffer);
+ return Real_I_RpcFreePipeBuffer(Message);
+}
+
+static RPC_STATUS RPC_ENTRY Catch_I_RpcReallocPipeBuffer(PRPC_MESSAGE Message,
+ unsigned int NewSize)
+{
+ CRouteTime rt(E_I_RpcReallocPipeBuffer);
+ return Real_I_RpcReallocPipeBuffer(Message, NewSize);
+}
+
+static void RPC_ENTRY Catch_I_RpcRequestMutex(I_RPC_MUTEX * Mutex)
+{
+ CRouteTime rt(E_I_RpcRequestMutex);
+ Real_I_RpcRequestMutex(Mutex);
+}
+
+static void RPC_ENTRY Catch_I_RpcClearMutex(I_RPC_MUTEX Mutex)
+{
+ CRouteTime rt(E_I_RpcClearMutex);
+ Real_I_RpcClearMutex(Mutex);
+}
+
+static void * RPC_ENTRY Catch_I_RpcAllocate(unsigned int Size)
+{
+ CRouteTime rt(E_I_RpcAllocate);
+ return Real_I_RpcAllocate(Size);
+}
+
+static void RPC_ENTRY Catch_I_RpcFree(void * Object)
+{
+ CRouteTime rt(E_I_RpcFree);
+ Real_I_RpcFree(Object);
+}
+
+static void RPC_ENTRY Catch_I_RpcPauseExecution(unsigned long Milliseconds)
+{
+ CRouteTime rt(E_I_RpcPauseExecution);
+ Real_I_RpcPauseExecution(Milliseconds);
+}
+
+#if _MSC_VER < 1300
+static RPC_STATUS RPC_ENTRY Catch_I_RpcMonitorAssociation(RPC_BINDING_HANDLE Handle,
+ PRPC_RUNDOWN RundownRoutine,
+ void * Context)
+{
+ CRouteTime rt(E_I_RpcMonitorAssociation);
+ return Real_I_RpcMonitorAssociation(Handle, RundownRoutine, Context);
+}
+
+static RPC_STATUS RPC_ENTRY Catch_I_RpcStopMonitorAssociation(RPC_BINDING_HANDLE Handle)
+{
+ CRouteTime rt(E_I_RpcStopMonitorAssociation);
+ return Real_I_RpcStopMonitorAssociation(Handle);
+}
+#endif
+
+static STDMETHODIMP Catch_IPing_Ping(IPing *pip)
+{
+ HRESULT hr;
+ InterlockedIncrement(&s_nInCall);
+ {
+ CRouteTime rt(E_Proxy);
+ hr = pip->Ping();
+ }
+ InterlockedDecrement(&s_nInCall);
+ return hr;
+}
+
+static STDMETHODIMP Catch_IPing_PingToServer(IPing *pip, LPSTR pszString)
+{
+ HRESULT hr;
+ InterlockedIncrement(&s_nInCall);
+ {
+ CRouteTime rt(E_Proxy);
+ hr = pip->PingToServer(pszString);
+ }
+ InterlockedDecrement(&s_nInCall);
+ return hr;
+}
+
+static STDMETHODIMP Catch_IPing_PingToClient(IPing *pip, LPSTR *ppszString)
+{
+ HRESULT hr;
+ InterlockedIncrement(&s_nInCall);
+ {
+ CRouteTime rt(E_Proxy);
+ hr = pip->PingToClient(ppszString);
+ }
+ InterlockedDecrement(&s_nInCall);
+ return hr;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+LONG RerouteEntryPoints(VOID)
+{
+ Real_NtWaitForSingleObject
+ = ((NTSTATUS (NTAPI *)(HANDLE,
+ BOOLEAN,
+ PLARGE_INTEGER))
+ DetourFindFunction("ntdll.dll", "NtWaitForSingleObject"));
+
+ Real_NtDeviceIoControlFile
+ = ((NTSTATUS (NTAPI *)(HANDLE,
+ HANDLE,
+ PIO_APC_ROUTINE,
+ PVOID,
+ PIO_STATUS_BLOCK,
+ ULONG,
+ PVOID,
+ ULONG,
+ PVOID,
+ ULONG))
+ DetourFindFunction("ntdll.dll", "NtDeviceIoControlFile"));
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+
+ DetourAttach(&(PVOID&)Real_NtWaitForSingleObject,
+ Catch_NtWaitForSingleObject);
+ DetourAttach(&(PVOID&)Real_NtDeviceIoControlFile,
+ Catch_NtDeviceIoControlFile);
+
+ DetourAttach(&(PVOID&)Real_SleepEx,
+ Catch_SleepEx);
+ DetourAttach(&(PVOID&)Real_send,
+ Catch_send);
+ DetourAttach(&(PVOID&)Real_I_RpcGetBuffer,
+ Catch_I_RpcGetBuffer);
+ DetourAttach(&(PVOID&)Real_I_RpcSendReceive,
+ Catch_I_RpcSendReceive);
+ DetourAttach(&(PVOID&)Real_I_RpcFreeBuffer,
+ Catch_I_RpcFreeBuffer);
+ DetourAttach(&(PVOID&)Real_I_RpcSend,
+ Catch_I_RpcSend);
+ DetourAttach(&(PVOID&)Real_I_RpcReceive,
+ Catch_I_RpcReceive);
+ DetourAttach(&(PVOID&)Real_I_RpcFreePipeBuffer,
+ Catch_I_RpcFreePipeBuffer);
+ DetourAttach(&(PVOID&)Real_I_RpcReallocPipeBuffer,
+ Catch_I_RpcReallocPipeBuffer);
+ DetourAttach(&(PVOID&)Real_I_RpcRequestMutex,
+ Catch_I_RpcRequestMutex);
+ DetourAttach(&(PVOID&)Real_I_RpcClearMutex,
+ Catch_I_RpcClearMutex);
+ DetourAttach(&(PVOID&)Real_I_RpcAllocate,
+ Catch_I_RpcAllocate);
+ DetourAttach(&(PVOID&)Real_I_RpcFree,
+ Catch_I_RpcFree);
+ DetourAttach(&(PVOID&)Real_I_RpcPauseExecution,
+ Catch_I_RpcPauseExecution);
+#if _MSC_VER < 1300
+ DetourAttach(&(PVOID&)Real_I_RpcMonitorAssociation,
+ Catch_I_RpcMonitorAssociation);
+ DetourAttach(&(PVOID&)Real_I_RpcStopMonitorAssociation,
+ Catch_I_RpcStopMonitorAssociation);
+#endif
+
+ return DetourTransactionCommit();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////// Classes.
+
+class CNetPingFactory : public IClassFactory
+{
+ public:
+ CNetPingFactory();
+ ~CNetPingFactory();
+
+ // IUnknown
+ STDMETHODIMP QueryInterface(REFIID riid, void** ppv);
+ STDMETHODIMP_(ULONG) AddRef(void);
+ STDMETHODIMP_(ULONG) Release(void);
+
+ // IClassFactory
+ STDMETHODIMP CreateInstance(LPUNKNOWN punkOuter, REFIID iid, void **ppv);
+ STDMETHODIMP LockServer(BOOL fLock);
+
+ public:
+ static HRESULT InitSystem(VOID);
+ static HRESULT FiniSystem(VOID);
+
+ static HRESULT InitObject(VOID);
+ static HRESULT FiniObject(VOID);
+
+ static HRESULT Lock(BOOL fLock);
+
+ static HRESULT Wait(VOID);
+
+ private:
+ LONG m_cRef;
+
+ static HANDLE s_hevtDone;
+ static LONG s_nObjects;
+ static LONG s_nLocks;
+};
+
+class CNetPingObject : public IPing
+{
+ public:
+ CNetPingObject();
+ ~CNetPingObject();
+
+ // IUnknown
+ STDMETHODIMP QueryInterface(REFIID iid, void **ppv);
+ STDMETHODIMP_(ULONG) AddRef(void);
+ STDMETHODIMP_(ULONG) Release(void);
+
+ // IPing
+ STDMETHODIMP Ping();
+ STDMETHODIMP PingToServer(LPSTR pszString);
+ STDMETHODIMP PingToClient(LPSTR *ppszString);
+ STDMETHODIMP PingToClientSize(ULONG cbOut);
+
+ private:
+ LONG m_cRef;
+ ULONG m_cbLast;
+ ULONG m_cbOut;
+};
+
+/////////////////////////////////////////////////////////////////////// GUIDs.
+
+DEFINE_GUID(CLSID_NetPingObject,
+ 0xdecdbeed, 0xd1ac, 0x11d1, 0x96, 0xbc, 0x00, 0xaa, 0x00, 0x57, 0x3f, 0xb0);
+
+/////////////////////////////////////////////////////////// Initialize String.
+//
+void InitializeString(LPSTR pszString, LONG cbSize)
+{
+ ASSERT(cbSize >= 1);
+
+ while (cbSize-- > 1) {
+ *pszString++ = '+';
+ }
+ *pszString = '\0';
+}
+
+BOOL GetKeyValue(HKEY hRootKey, PWCHAR pwzKey, PWCHAR pwzValueName, PWCHAR pwzValue,
+ DWORD cbValue)
+{
+ HKEY hKey;
+ WCHAR wzKey[256];
+ HRESULT hr;
+
+ hr = StringCchCopyW(wzKey, ARRAYSIZE(wzKey), pwzKey);
+ if (FAILED(hr)) {
+ return FALSE;
+ }
+
+ if (RegOpenKeyExW(hRootKey, wzKey, 0, KEY_READ, &hKey) != NO_ERROR) {
+ abort:
+ pwzValue[0] = '\0';
+ return FALSE;
+ }
+
+ DWORD nType = 0;
+ cbValue -= sizeof(WCHAR);
+ if (RegQueryValueExW(hKey, pwzValueName, 0, &nType, (PBYTE)pwzValue, &cbValue)
+ != NO_ERROR || nType != REG_SZ) {
+
+ RegCloseKey(hKey);
+ goto abort;
+ }
+
+ RegCloseKey(hKey);
+
+ cbValue /= sizeof(WCHAR);
+ pwzValue[cbValue] = L'\0';
+
+ return TRUE;
+}
+
+static BOOLEAN SetKeyAndValue(HKEY hRootKey,
+ PWCHAR pwzKey, PWCHAR pwzSubkey,
+ PWCHAR pwzValueName, PWCHAR pwzValue)
+{
+ HKEY hKey;
+ WCHAR wzKey[256];
+ HRESULT hr;
+
+ hr = StringCchCopyW(wzKey, ARRAYSIZE(wzKey), pwzKey);
+ if (FAILED(hr)) {
+ return FALSE;
+ }
+
+ if (pwzSubkey != NULL) {
+ hr = StringCchCatW(wzKey, ARRAYSIZE(wzKey), L"\\");
+ if (FAILED(hr)) {
+ return FALSE;
+ }
+ hr = StringCchCatW(wzKey, ARRAYSIZE(wzKey), pwzSubkey);
+ if (FAILED(hr)) {
+ return FALSE;
+ }
+ }
+
+ if (RegCreateKeyExW(hRootKey, wzKey, 0, NULL, REG_OPTION_NON_VOLATILE,
+ KEY_ALL_ACCESS, NULL, &hKey, NULL) != ERROR_SUCCESS) {
+ return FALSE;
+ }
+
+ if (pwzValue != NULL) {
+ RegSetValueExW(hKey, pwzValueName, 0, REG_SZ,
+ (BYTE *)pwzValue, (DWORD)wcssize(pwzValue));
+ }
+ RegCloseKey(hKey);
+ return TRUE;
+}
+
+static BOOLEAN SetKeyAndValue(HKEY hRootKey,
+ PWCHAR pwzKey, PWCHAR pwzSubkey,
+ PWCHAR pwzValueName,
+ PBYTE pbData, ULONG cbData)
+{
+ HKEY hKey;
+ WCHAR wzKey[256];
+ HRESULT hr;
+
+ hr = StringCchCopyW(wzKey, ARRAYSIZE(wzKey), pwzKey);
+ if (FAILED(hr)) {
+ return FALSE;
+ }
+
+ if (pwzSubkey != NULL) {
+ hr = StringCchCatW(wzKey, ARRAYSIZE(wzKey), L"\\");
+ if (FAILED(hr)) {
+ return FALSE;
+ }
+ hr = StringCchCatW(wzKey, ARRAYSIZE(wzKey), pwzSubkey);
+ if (FAILED(hr)) {
+ return FALSE;
+ }
+ }
+
+ if (RegCreateKeyExW(hRootKey, wzKey, 0, NULL, REG_OPTION_NON_VOLATILE,
+ KEY_ALL_ACCESS, NULL, &hKey, NULL) != ERROR_SUCCESS) {
+ return FALSE;
+ }
+
+ if (pbData != NULL) {
+ RegSetValueExW(hKey, pwzValueName, 0, REG_BINARY, pbData, cbData);
+ }
+ RegCloseKey(hKey);
+ return TRUE;
+}
+
+static void Register(void)
+{
+
+ WCHAR wzModule[256];
+ WCHAR wzName[256];
+ WCHAR wzValue[256];
+ WCHAR wzClass[48];
+ WCHAR wzKey[256];
+ PWCHAR pwz;
+ HRESULT hr;
+
+ BYTE rgEveryone[] = {
+ 0x01,0x00,0x04,0x80,0x34,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x14,0x00,0x00,0x00,0x02,0x00,0x20,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x18,0x00,
+ 0x01,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x01,0x05,0x00,0x00,0x00,0x00,0x00,0x05,0x15,0x00,0x00,0x00,
+ 0xa0,0x65,0xcf,0x7e,0x78,0x4b,0x9b,0x5f,0xe7,0x7c,0x87,0x70,0x32,0x7f,0x00,0x00,
+ 0x01,0x05,0x00,0x00,0x00,0x00,0x00,0x05,0x15,0x00,0x00,0x00,0xa0,0x65,0xcf,0x7e,
+ 0x78,0x4b,0x9b,0x5f,0xe7,0x7c,0x87,0x70,0x32,0x7f,0x00,0x00
+ };
+
+ GetModuleFileNameW(NULL, wzModule, sizeof(wzModule)/sizeof(WCHAR));
+ if ((pwz = wcsrchr(wzModule, '\\')) != NULL) {
+ hr = StringCchCopyW(wzName, ARRAYSIZE(wzName), pwz + 1);
+ }
+ else if ((pwz = wcsrchr(wzModule, ':')) != NULL) {
+ hr = StringCchCopyW(wzName, ARRAYSIZE(wzName), pwz + 1);
+ }
+ else {
+ hr = StringCchCopyW(wzName, ARRAYSIZE(wzName), wzModule);
+ }
+ CheckResult(hr, "IPing_DllRegisterServer");
+
+ // printf("Server: %ls / %ls\n", wzModule, wzName);
+
+ StringFromGUID2(CLSID_NetPingObject, wzClass, ARRAYSIZE(wzClass));
+ // printf(" Class: %ls\n", wzClass);
+ hr = StringCchCopyW(wzKey, ARRAYSIZE(wzKey), L"CLSID\\");
+ CheckResult(hr, "IPing_DllRegisterServer");
+ hr = StringCchCatW(wzKey, ARRAYSIZE(wzKey), wzClass);
+ CheckResult(hr, "IPing_DllRegisterServer");
+
+ SetKeyAndValue(HKEY_CLASSES_ROOT, wzKey, NULL, NULL, L"COM Ping Network Server");
+ hr = StringCchPrintfW(wzValue, ARRAYSIZE(wzValue), L"%ls /s", wzModule);
+ CheckResult(hr, "IPing_DllRegisterServer");
+ SetKeyAndValue(HKEY_CLASSES_ROOT, wzKey, L"LocalServer32", NULL, wzValue);
+ SetKeyAndValue(HKEY_CLASSES_ROOT, wzKey, L"LaunchPermission", NULL, L"Y");
+ SetKeyAndValue(HKEY_CLASSES_ROOT, wzKey, NULL, L"AppID", wzClass);
+
+ hr = StringCchCopyW(wzKey, ARRAYSIZE(wzKey), L"AppID\\");
+ CheckResult(hr, "IPing_DllRegisterServer");
+ hr = StringCchCatW(wzKey, ARRAYSIZE(wzKey), wzClass);
+ CheckResult(hr, "IPing_DllRegisterServer");
+ SetKeyAndValue(HKEY_CLASSES_ROOT, wzKey, NULL, NULL, L"COM Ping Network Server");
+ SetKeyAndValue(HKEY_CLASSES_ROOT, wzKey, NULL, L"RunAs", L"Interactive User");
+ SetKeyAndValue(HKEY_CLASSES_ROOT, wzKey, NULL, L"AccessPermission",
+ rgEveryone, sizeof(rgEveryone));
+
+ hr = StringCchCopyW(wzKey, ARRAYSIZE(wzKey), L"AppID\\");
+ CheckResult(hr, "IPing_DllRegisterServer");
+ hr = StringCchCatW(wzKey, ARRAYSIZE(wzKey), wzName);
+ CheckResult(hr, "IPing_DllRegisterServer");
+
+ SetKeyAndValue(HKEY_CLASSES_ROOT, wzKey, NULL, L"AppID", wzClass);
+
+ /////////////////////////////////////////////////// Register Proxy & Stub.
+ //
+ iping_DllRegisterServer();
+ CheckResult(hr, "IPing_DllRegisterServer");
+
+ //////////////////////////////////////////////// Register Processor Speed.
+ //
+ DWORD cycles = 0;
+
+ hr = StringCchCopyW(wzKey, ARRAYSIZE(wzKey), L"Software\\Microsoft\\Detours\\ProcessorCycles");
+ CheckResult(hr, "IPing_DllRegisterServer");
+
+ if (GetKeyValue(HKEY_LOCAL_MACHINE, wzKey, NULL, wzValue, sizeof(wzValue))) {
+ cycles = _wtoi(wzValue);
+
+ printf("[Recorded Cycles/Second: %ld]\n", cycles);
+ }
+
+ if (cycles < 10000) {
+ LONGLONG llBeg;
+ LONGLONG llEnd;
+
+ printf("[Calibrating Processors...]\r");
+
+ LARGE_INTEGER liBeg;
+ LARGE_INTEGER liEnd;
+ LARGE_INTEGER liBrk;
+ LARGE_INTEGER liFrq;
+
+ QueryPerformanceFrequency(&liFrq);
+ QueryPerformanceCounter(&liBeg);
+ llBeg = GetTimeStamp();
+ liBrk.QuadPart = liBeg.QuadPart + liFrq.QuadPart * 5;
+ do {
+ QueryPerformanceCounter(&liEnd);
+ llEnd = GetTimeStamp();
+ } while (liEnd.QuadPart < liBrk.QuadPart);
+
+ double secs = (double)(liEnd.QuadPart - liBeg.QuadPart) / (double)liFrq.QuadPart;
+ double clks = (double)(llEnd - llBeg);
+ double cycs = clks / secs;
+
+ cycles = (DWORD)cycs;
+ printf("[Measured Cycles/Second: %ld] \n", cycles);
+
+ hr = StringCchPrintfW(wzValue, ARRAYSIZE(wzValue), L"%d", cycles);
+ CheckResult(hr, "IPing_DllRegisterServer");
+
+ SetKeyAndValue(HKEY_LOCAL_MACHINE, wzKey, NULL, NULL, wzValue);
+ }
+}
+
+void Unregister(void)
+{
+ ///////////////////////////////////////////////// Unregister Proxy & Stub.
+ //
+ HRESULT hr = iping_DllUnregisterServer();
+ if (FAILED(hr)) {
+ CheckResult(hr, "IPing_DllUnregisterServer");
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+HRESULT GetClockInfo(LONGLONG *pllCyclesPerSecond)
+{
+ WCHAR wzKey[512];
+ WCHAR wzValue[128];
+ LONG cbValue;
+ HRESULT hr;
+
+ ////////////////////////////////////////////////////////// Check Registry.
+
+ cbValue = sizeof(wzValue);
+ hr = StringCchCopyW(wzKey, ARRAYSIZE(wzKey), L"Software\\Microsoft\\Detours\\ProcessorCycles");
+ CheckResult(hr, "GetClockInfo");
+
+ if (RegQueryValueW(HKEY_LOCAL_MACHINE, wzKey, wzValue, &cbValue) == NO_ERROR) {
+ *pllCyclesPerSecond = _wtoi(wzValue);
+ return S_OK;
+ }
+ *pllCyclesPerSecond = 1000000;
+ return E_FAIL;
+}
+
+///////////////////////////////////////////////////////// CNetPingFactory.
+//
+LONG CNetPingFactory::s_nObjects = 0;
+LONG CNetPingFactory::s_nLocks = 0;
+HANDLE CNetPingFactory::s_hevtDone = NULL;
+
+CNetPingFactory::CNetPingFactory()
+{
+ m_cRef = 1;
+}
+
+
+CNetPingFactory::~CNetPingFactory()
+{
+ m_cRef = 0;
+}
+
+ULONG CNetPingFactory::AddRef(void)
+{
+ return InterlockedIncrement(&m_cRef);
+}
+
+ULONG CNetPingFactory::Release(void)
+{
+ if (InterlockedDecrement(&m_cRef) == 0) {
+ delete this;
+ return 0;
+ }
+ return 1;
+}
+
+HRESULT CNetPingFactory::InitSystem(VOID)
+{
+ s_nObjects = 0;
+ s_nLocks = 0;
+
+ s_hevtDone = CreateEvent(NULL, FALSE, FALSE, NULL);
+ if (s_hevtDone == NULL) {
+ HRESULT hr = HRESULT_FROM_WIN32(GetLastError());
+ CheckResult(hr, "Server: CreateEvent");
+ exit(hr);
+ }
+
+ return S_OK;
+}
+
+HRESULT CNetPingFactory::FiniSystem(VOID)
+{
+ if (s_hevtDone != NULL) {
+ CloseHandle(s_hevtDone);
+ s_hevtDone = NULL;
+ }
+ return S_OK;
+}
+
+
+HRESULT CNetPingFactory::InitObject(VOID)
+{
+ InterlockedIncrement(&s_nObjects);
+ return S_OK;
+}
+
+HRESULT CNetPingFactory::FiniObject(VOID)
+{
+ if (InterlockedDecrement(&s_nObjects) == 0 && s_nLocks == 0)
+ SetEvent(s_hevtDone);
+ return S_OK;
+}
+
+HRESULT CNetPingFactory::Lock(BOOL fLock)
+{
+ if (fLock) {
+ InterlockedIncrement(&s_nLocks);
+ }
+
+ else {
+ if (InterlockedDecrement(&s_nLocks) == 0 && s_nObjects == 0)
+ SetEvent(s_hevtDone);
+ }
+ return S_OK;
+}
+
+HRESULT CNetPingFactory::Wait(VOID)
+{
+ DWORD dwWaitResult;
+ MSG msg;
+
+ for (;;) {
+ dwWaitResult = MsgWaitForMultipleObjects(1, &s_hevtDone,
+ FALSE, INFINITE,
+ QS_ALLINPUT);
+
+ if (dwWaitResult == WAIT_OBJECT_0) {
+ ResetEvent(s_hevtDone);
+ break;
+ }
+
+ while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ }
+ return S_OK;
+}
+
+STDMETHODIMP CNetPingFactory::QueryInterface(REFIID riid, void** ppv)
+{
+ if (ppv == NULL) {
+ return E_INVALIDARG;
+ }
+ if (riid == IID_IClassFactory || riid == IID_IUnknown) {
+ *ppv = (IClassFactory *) this;
+ AddRef();
+ return S_OK;
+ }
+ *ppv = NULL;
+ return E_NOINTERFACE;
+}
+
+HRESULT CNetPingFactory::LockServer (BOOL fLock)
+{
+ return Lock(fLock);
+}
+
+STDMETHODIMP CNetPingFactory::CreateInstance(LPUNKNOWN punkOuter,
+ REFIID riid, void** ppv)
+{
+ LPUNKNOWN punk;
+ HRESULT hr;
+
+ *ppv = NULL;
+
+ if (punkOuter != NULL) {
+ return CLASS_E_NOAGGREGATION;
+ }
+
+ printf(" Server: IClassFactory:CreateInstance\n");
+
+ punk = new CNetPingObject;
+ if (punk == NULL) {
+ return E_OUTOFMEMORY;
+ }
+
+ hr = punk->QueryInterface(riid, ppv);
+ punk->Release();
+ return hr;
+}
+
+/////////////////////////////////////////////////////////////// CNetPingObject.
+//
+CNetPingObject::CNetPingObject()
+{
+ m_cRef = 1;
+ m_cbLast = ~0u;
+ m_cbOut = 2;
+ CNetPingFactory::InitObject();
+}
+
+CNetPingObject::~CNetPingObject()
+{
+ CNetPingFactory::FiniObject();
+}
+
+STDMETHODIMP CNetPingObject::QueryInterface(REFIID riid, void** ppv)
+{
+ if (ppv == NULL) {
+ return E_INVALIDARG;
+ }
+ if (riid == IID_IUnknown || riid == IID_IPing) {
+ *ppv = (IPing *) this;
+ AddRef();
+ return S_OK;
+ }
+ *ppv = NULL;
+ return E_NOINTERFACE;
+}
+
+STDMETHODIMP_(ULONG) CNetPingObject::AddRef(void)
+{
+ return InterlockedIncrement(&m_cRef);
+}
+
+STDMETHODIMP_(ULONG) CNetPingObject::Release(void)
+{
+ if (InterlockedDecrement(&m_cRef) == 0) {
+ delete this;
+ return 0;
+ }
+ return 1;
+}
+
+STDMETHODIMP CNetPingObject::Ping()
+{
+ return S_OK;
+}
+
+STDMETHODIMP CNetPingObject::PingToServer(LPSTR pszString)
+{
+ (void)pszString;
+ return S_OK;
+}
+
+STDMETHODIMP CNetPingObject::PingToClient(LPSTR *ppszString)
+{
+ LPSTR pszString = (LPSTR)CoTaskMemAlloc(m_cbOut);
+ if (pszString == NULL) {
+ return E_OUTOFMEMORY;
+ }
+
+ CopyMemory(pszString, g_pBuffer, m_cbOut);
+ *ppszString = pszString;
+
+ return S_OK;
+}
+
+STDMETHODIMP CNetPingObject::PingToClientSize(ULONG cbOut)
+{
+ if (cbOut < 1) {
+ return E_INVALIDARG;
+ }
+
+ InitializeString((LPSTR)g_pBuffer, cbOut);
+ m_cbOut = cbOut;
+ return S_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+class CSampleRecord
+{
+ public:
+ DOUBLE m_dTime;
+ FILETIME m_nWhen;
+ LONG m_cbToClient;
+ LONG m_cbToServer;
+ DOUBLE m_dDcom;
+ DOUBLE m_dRpc;
+ DOUBLE m_dUdp;
+ DOUBLE m_dNet;
+
+ protected:
+ static LONG s_cbToClient;
+ static LONG s_cbToServer;
+
+ public:
+ CSampleRecord();
+ CSampleRecord(IPing *pIPing, LONG cbToClient, LONG cbToServer);
+
+ HRESULT Measure(IPing *pIPing, LONG cbToClient, LONG cbToServer);
+ HRESULT Write();
+
+ double GetTime() { return m_dTime; }
+ FILETIME GetWhen() { return m_nWhen; }
+ LONG GetToClient() { return m_cbToClient; }
+ LONG GetToServer() { return m_cbToServer; }
+
+};
+
+//////////////////////////////////////////////////////////////////////////////
+//
+LONG CSampleRecord::s_cbToClient = 0;
+LONG CSampleRecord::s_cbToServer = 0;
+
+//////////////////////////////////////////////////////////////////////////////
+//
+CSampleRecord::CSampleRecord()
+{
+ m_dTime = 0;
+ m_dDcom = 0;
+ m_dRpc = 0;
+ m_dUdp = 0;
+ m_dNet = 0;
+}
+
+CSampleRecord::CSampleRecord(IPing *pIPing, LONG cbToClient, LONG cbToServer)
+{
+ Measure(pIPing, cbToClient, cbToServer);
+}
+
+HRESULT CSampleRecord::Measure(IPing *pIPing, LONG cbToClient, LONG cbToServer)
+{
+ HRESULT hr;
+ LONGLONG llBeg;
+ LONGLONG llEnd;
+
+ GetSystemTimeAsFileTime(&m_nWhen);
+ m_cbToClient = cbToClient;
+ m_cbToServer = cbToServer;
+
+ if (cbToClient == 0 && cbToServer == 0) {
+ llBeg = GetTimeStamp();
+ hr = Catch_IPing_Ping(pIPing);
+ llEnd = GetTimeStamp();
+ }
+ else if (cbToClient) {
+ if (s_cbToClient != cbToClient) {
+ hr = pIPing->PingToClientSize(cbToClient);
+ s_cbToClient = cbToClient;
+ }
+
+ LPSTR pszString = NULL;
+
+ llBeg = GetTimeStamp();
+ hr = Catch_IPing_PingToClient(pIPing, &pszString);
+ llEnd = GetTimeStamp();
+
+ if (pszString) {
+ LONG cb = (LONG)strlen(pszString) + 1;
+ ASSERT(cb == cbToClient);
+ CoTaskMemFree(pszString);
+ pszString = NULL;
+ }
+ }
+ else {
+ if (s_cbToServer != cbToServer) {
+ InitializeString((LPSTR)g_pBuffer, cbToServer);
+ s_cbToServer = cbToServer;
+ }
+
+ llBeg = GetTimeStamp();
+ hr = Catch_IPing_PingToServer(pIPing, (LPSTR)g_pBuffer);
+ llEnd = GetTimeStamp();
+ }
+
+ if (FAILED(hr)) {
+ printf(";; Operation failed: %08lx\n", hr);
+ exit(999);
+ }
+
+ if (g_fSummarize) {
+ SummarizeCycles();
+ m_dDcom = (double)s_rllCycles[E_DCOM] * g_dMsPerCycle;
+ m_dRpc = (double)s_rllCycles[E_RPC] * g_dMsPerCycle;
+ m_dUdp = (double)s_rllCycles[E_UDP] * g_dMsPerCycle;
+ m_dNet = (double)s_rllCycles[E_NET] * g_dMsPerCycle;
+ }
+
+ m_dTime = (double)(llEnd - llBeg) * g_dMsPerCycle;
+
+ return S_OK;
+}
+
+HRESULT CSampleRecord::Write()
+{
+ SYSTEMTIME st;
+ FILETIME ft;
+
+ FileTimeToLocalFileTime(&m_nWhen, &ft);
+ FileTimeToSystemTime(&ft, &st);
+
+ printf("%02d/%02d %2d:%02d:%02d %6ld %ld %6.3f [ %6.3f %6.3f %6.3f %6.3f ]\n",
+ st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond,
+ m_cbToClient, m_cbToServer, m_dTime,
+ m_dDcom, m_dRpc, m_dUdp, m_dNet);
+
+ return S_OK;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+double NetTest(HKEY hNetwork, IPing *pIPing,
+ BOOLEAN fToClient, LONG cbPacket, LONG nCount)
+{
+ //////////////////////////////////////////////////////////////////// ToClient.
+ //
+ HRESULT hr;
+ double msAvg = 0.0;
+ double msMin = 1.0e12;
+ double msMax = 0.0;
+ ULONG nMax = 999;
+ ULONG nMin = 999;
+
+ if (fToClient) {
+ printf(">Client %6ld %6ld ", cbPacket, nCount);
+ }
+ else {
+ printf(">Server %6ld %6ld ", cbPacket, nCount);
+ }
+
+ for (LONG n = 0; n < nCount; n++) {
+ double ms;
+
+ if (fToClient) {
+ ms = CSampleRecord(pIPing, cbPacket, 0).GetTime();
+ }
+ else {
+ ms = CSampleRecord(pIPing, 0, cbPacket).GetTime();
+ }
+
+ if (ms < 0) {
+ break;
+ }
+
+ if (msMin > ms) {
+ msMin = ms;
+ nMin = n;
+ }
+ if (msMax < ms) {
+ msMax = ms;
+ nMax = n;
+ }
+ msAvg += ms;
+ }
+
+ if (nCount) {
+ msAvg /= nCount;
+ }
+
+ if (cbPacket == 0) {
+ g_dLatency = msMin;
+ }
+
+ double mbps = (double)cbPacket / msMin;
+ mbps *= 8.0 * 1000.0 / 1024.0 / 1024.0;
+
+ double mbps2 = (double)cbPacket / (msMin - g_dLatency);
+ mbps2 *= 8.0 * 1000.0 / 1024.0 / 1024.0;
+ if (cbPacket == 0) {
+ mbps2 = 0;
+ }
+
+ if (hNetwork != NULL) {
+ WCHAR wzKey[64];
+ WCHAR wzLatency[64];
+
+ if (fToClient) {
+ hr = StringCchPrintfW(wzKey, ARRAYSIZE(wzKey), L"ToClient\\%d", cbPacket);
+ CheckResult(hr, "NetTest");
+ }
+ else {
+ hr = StringCchPrintfW(wzKey, ARRAYSIZE(wzKey), L"ToServer\\%d", cbPacket);
+ CheckResult(hr, "NetTest");
+ }
+ hr = StringCchPrintfW(wzLatency, ARRAYSIZE(wzLatency), L"%I64d", msAvg);
+ CheckResult(hr, "NetTest");
+
+ RegSetValueW(hNetwork, wzKey, REG_SZ, wzLatency, (DWORD)wcssize(wzLatency));
+ }
+
+ printf("%8.3f %8.3f %8.3f %9.4f %8.3f %9.4f%3ld\n",
+ msMin,
+ msAvg,
+ msMax,
+ mbps,
+ msMin - g_dLatency,
+ mbps2,
+ nMax);
+ return mbps;
+}
+
+//////////////////////////////////////////////////////////////////////// main.
+
+static WCHAR wzServers[32][64];
+static int nServers = 0;
+
+void Sample_Fixed(IPing *pIPing)
+{
+ CSampleRecord csrRecords[512];
+ LONG nRecords = 0;
+ HRESULT hr;
+
+ double dAvg = 0;
+ double dMin = 500000.0;
+ double dMax = 0.0;
+ double dMinDcom = dMin;
+ double dMinRpc = dMin;
+ double dMinUdp = dMin;
+ double dMinNet = dMin;
+
+ for (int i = 0; i < 512; i++) {
+ CSampleRecord& csr = csrRecords[nRecords++];
+
+ hr = csr.Measure(pIPing, g_nFixedToClient, g_nFixedToServer);
+ double d = csr.GetTime();
+ if (dMin > d) {
+ dMin = d;
+ }
+ if (dMax < d) {
+ dMax = d;
+ }
+ if (dMinDcom > csr.m_dDcom) {
+ dMinDcom = csr.m_dDcom;
+ }
+ if (dMinRpc > csr.m_dRpc) {
+ dMinRpc = csr.m_dRpc;
+ }
+ if (dMinUdp > csr.m_dUdp) {
+ dMinUdp = csr.m_dUdp;
+ }
+ if (dMinNet > csr.m_dNet) {
+ dMinNet = csr.m_dNet;
+ }
+ dAvg += d;
+ }
+
+ dAvg /= 512;
+ printf("size: %ld, min: %.3f, max: %.3f avg: %.3f [ %8.3f %8.3f %8.3f %8.3f ]\n",
+ g_nFixedToClient, dMin, dMax, dAvg, dMinDcom, dMinRpc, dMinUdp, dMinNet);
+ for (int n = 0; n < nRecords; n++) {
+ csrRecords[n].Write();
+ }
+}
+
+void Sample_Simple(IPing *pIPing)
+{
+ CSampleRecord csrRecords[512];
+ LONG nRecords = 0;
+ HRESULT hr;
+
+ for (int cb = 0; cb < 64000; cb = cb ? cb << 1 : 32) {
+ double n[5];
+ int i = 0;
+
+ for (; i < 5; i++) {
+ CSampleRecord& csr = csrRecords[nRecords++];
+
+ hr = csr.Measure(pIPing, cb, 0);
+ n[i] = csr.GetTime();
+ }
+
+ double nAvg = 0;
+ double nApx = 0;
+ double nMin = n[0];
+ double nMax = n[0];
+
+ for (i = 0; i < 5; i++) {
+ if (nMin > n[i]) {
+ nMin = n[i];
+ }
+ if (nMax < n[i]) {
+ nMax = n[i];
+ }
+ nAvg += n[i];
+ }
+ nApx = nAvg - nMax;
+ nAvg /= 5;
+ nApx /= 4;
+ printf("min: %8.3f ms (%6d) %7.3f%7.3f%7.3f%7.3f%7.3f:%8.3f%8.3f\n",
+ nMin, cb, n[0], n[1], n[2], n[3], n[4], nAvg, nApx);
+ }
+ for (int n = 0; n < nRecords; n++) {
+ csrRecords[n].Write();
+ }
+}
+
+void Sample_More(IPing *pIPing)
+{
+ CSampleRecord csrRecords[64];
+ LONG nRecords = 0;
+
+ for (int cb = 0; cb < 64000; cb = cb ? cb << 1 : 32) {
+ int i = 0;
+ for (; i < 64; i++) {
+ CSampleRecord& csr = csrRecords[nRecords++];
+
+ csr.Measure(pIPing, cb, 0);
+ }
+
+ double nAvg = 0;
+ double nMin = csrRecords[0].GetTime();
+ double nMax = csrRecords[0].GetTime();
+
+ for (i = 0; i < 64; i++) {
+ double n = csrRecords[i].GetTime();
+
+ if (nMin > n) {
+ nMin = n;
+ }
+ if (nMax < n) {
+ nMax = n;
+ }
+ nAvg += n;
+ }
+ nAvg /= i;
+ printf("min: %8.3f ms (%6d) : %8.3f %8.3f\n",
+ nMin, cb, nMax, nAvg);
+
+ for (int n = 0; n < nRecords; n++) {
+ csrRecords[n].Write();
+ }
+ nRecords = 0;
+ }
+}
+
+void Sample_Less(IPing *pIPing)
+{
+ CSampleRecord csrRecords[16];
+ LONG nRecords = 0;
+
+ for (int cb = 0; cb < 64000; cb = cb ? cb << 1 : 16) {
+ int i = 0;
+ for (; i < 16; i++) {
+ CSampleRecord& csr = csrRecords[nRecords++];
+
+ csr.Measure(pIPing, cb, 0);
+ }
+
+ double nAvg = 0;
+ double nMin = csrRecords[0].GetTime();
+ double nMax = csrRecords[0].GetTime();
+
+ for (i = 0; i < 16; i++) {
+ double n = csrRecords[i].GetTime();
+
+ if (nMin > n) {
+ nMin = n;
+ }
+ if (nMax < n) {
+ nMax = n;
+ }
+ nAvg += n;
+ }
+ nAvg /= i;
+ printf("min: %8.3f ms (%6d) : %8.3f %8.3f\n",
+ nMin, cb, nMax, nAvg);
+
+ for (int n = 0; n < nRecords; n++) {
+ csrRecords[n].Write();
+ }
+ nRecords = 0;
+ }
+}
+
+void Sample_Profile(IPing *pIPing)
+{
+ CSampleRecord csrRecords[64];
+
+ double dbZero = 0;
+
+ printf("\nPacket_Size_ Min_Latency Max_Latency Avg_Latency "
+ "Relative_Bnd ___Bandwidth\n");
+
+ for (int cb = 0; cb < 256 * 1024;) {
+ int n = 0;
+ for (; n < 64; n++) {
+ CSampleRecord& csr = csrRecords[n];
+ csr.Measure(pIPing, cb, 0);
+ }
+
+ double dbAvg = 0;
+ double dbMin = csrRecords[0].GetTime();
+ double dbMax = csrRecords[0].GetTime();
+ LONG nMin = 0;
+ LONG nMax = 0;
+
+ for (n = 0; n < 64; n++) {
+ double db = csrRecords[n].GetTime();
+
+ if (dbMin > db) {
+ dbMin = db;
+ nMin = n;
+ }
+ if (dbMax < db) {
+ dbMax = db;
+ nMax = n;
+ }
+ dbAvg += db;
+ }
+ dbAvg /= n;
+ if (cb == 0) {
+ dbZero = dbMin;
+ }
+
+ double dbBnd = 0;
+ if (dbMin > dbZero) {
+ dbBnd = ((8 * cb) * 1000.0) / (1024 * 1024);
+ dbBnd /= dbMin - dbZero;
+ }
+ double dbReal = ((8 * cb) * 1000.0) / (1024 * 1024) / dbMin;
+
+ printf("%6d bytes %9.3fms %9.3fms %9.3fms %8.3fMbps %8.3fMbps\r",
+ cb, dbMin, dbMax, dbAvg, dbBnd, dbReal);
+
+ csrRecords[nMin].Write();
+
+ if (cb < 2048) {
+ cb++;
+ }
+ else if (cb < 4096) {
+ cb += 2;
+ }
+ else if (cb < 8192) {
+ cb += 8;
+ }
+ else if (cb < 16384) {
+ cb += 32;
+ }
+ else {
+ cb += 128;
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+class CInit
+{
+ public:
+ CInit(HINSTANCE hinst)
+ {
+ m_hinst = hinst;
+
+ AllocConsole();
+
+ // initialize COM for free-threading
+ HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
+ if (FAILED(hr)) {
+ CheckResult(hr, "CoInitializeEx");
+ exit(hr);
+ }
+
+ ULONG ul = iping_DllMain(m_hinst, DLL_PROCESS_ATTACH, NULL);
+ ASSERT(ul);
+ }
+
+ ~CInit()
+ {
+ ULONG ul = iping_DllMain(m_hinst, DLL_PROCESS_DETACH, NULL);
+ ASSERT(ul);
+
+ CoUninitialize();
+ }
+
+ private:
+ HINSTANCE m_hinst;
+};
+
+class CInitStub
+{
+ public:
+ CInitStub()
+ {
+ m_dwRegister = ~0u;
+
+ IClassFactory *pClassFactory = NULL;
+ HRESULT hr = iping_DllGetClassObject(IID_IPing,
+ IID_IUnknown,
+ (void **)&pClassFactory);
+ if (FAILED(hr)) {
+ CheckResult(hr, "IPing_DllGetClassObject");
+ ASSERT(SUCCEEDED(hr));
+ }
+
+ if (pClassFactory) {
+ hr = CoRegisterClassObject(IID_IPing,
+ pClassFactory,
+ CLSCTX_SERVER,
+ REGCLS_MULTIPLEUSE,
+ &m_dwRegister);
+ if (FAILED(hr)) {
+ ASSERT(SUCCEEDED(hr));
+ CheckResult(hr, "CoRegisterClassObject(IID_IPing)\n");
+ }
+ pClassFactory->Release();
+ pClassFactory = NULL;
+ }
+ }
+
+ ~CInitStub()
+ {
+ if (m_dwRegister != ~0u) {
+ CoRevokeClassObject(m_dwRegister);
+ m_dwRegister = ~0u;
+ }
+ }
+
+ private:
+ DWORD m_dwRegister;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+//
+int __cdecl main(void)
+{
+ CInit cinit(GetModuleHandle(NULL));
+ int argc;
+ WCHAR **argv = CommandLineToArgvW(GetCommandLineW(), &argc);
+
+ HRESULT hr;
+ BOOLEAN fUnreg = FALSE;
+ BOOLEAN fNeedHelp = FALSE;
+ BOOLEAN fServer = FALSE;
+ BOOLEAN fLong = FALSE;
+ BOOLEAN fProfile = FALSE;
+ BOOLEAN fInstrument = TRUE;
+ BOOLEAN fFixed = FALSE;
+
+ s_nThread = GetCurrentThreadId();
+
+ printf("Ping Network Server: [" __DATE__ " " __TIME__ "]\n");
+ int arg = 1;
+ for (; arg < argc; arg++) {
+ if (argv[arg][0] == '-' || argv[arg][0] == '/') {
+ WCHAR *argn = argv[arg] + 1;
+ WCHAR *argp = argn;
+ while (*argp && *argp != ':') {
+ argp++;
+ }
+ if (*argp == ':') {
+ *argp++ = '\0';
+ }
+
+ switch (argn[0]) {
+
+ case 'f': // Fixed
+ case 'F':
+ fFixed = TRUE;
+ g_nFixedToClient = _wtoi(argp);
+ g_nFixedToServer = 0;
+ break;
+
+ case 'i':
+ case 'I': // Instrument
+ fInstrument = !fInstrument;
+ break;
+
+ case 'n': // Null
+ case 'N':
+ fFixed = TRUE;
+ g_nFixedToClient = g_nFixedToServer = 0;
+ break;
+
+ case 'l': // Long-term loop
+ case 'L':
+ fLong = !fLong;
+ break;
+
+ case 'p': // Profile Network
+ case 'P':
+ fProfile = !fProfile;
+ break;
+
+ case 's': // Server
+ case 'S':
+ fServer = !fServer;
+ break;
+
+ case 'u': // Unregister
+ case 'U':
+ fUnreg = !fUnreg;
+ break;
+
+ case 'x': // Xtract Data
+ case 'X':
+ g_fSummarize = !g_fSummarize;
+ break;
+
+ case '?': // Help
+ fNeedHelp = TRUE;
+ break;
+
+ case '\0': // Local Host
+ hr = StringCchCopyW(wzServers[nServers++], ARRAYSIZE(wzServers[nServers++]),
+ L"localhost");
+ if (FAILED(hr)) {
+ return 900;
+ }
+ ASSERT(nServers <= 32);
+ break;
+
+ default:
+ fNeedHelp = TRUE;
+ printf("Bad argument: %ls\n", argv[arg]);
+ break;
+ }
+ }
+ else {
+ hr = StringCchCopyW(wzServers[nServers++], ARRAYSIZE(wzServers[nServers++]), argv[arg]);
+ if (FAILED(hr)) {
+ return 900;
+ }
+ ASSERT(nServers <= 32);
+ }
+ }
+ if (argc == 1 || (nServers == 0 && !fUnreg && !fServer)) {
+ fNeedHelp = TRUE;
+ }
+
+ if (fNeedHelp) {
+ printf("Usage:\n"
+ " cping [options] [hosts] ..or.. cping [options] /s\n"
+ "Options:\n"
+ " /u : Unregister.\n"
+ " /s : Act as a server, waiting for clients.\n"
+ " /? : Display this help screen.\n"
+ "Client Options:\n"
+ " /l : Long-term loop test. (Default: %3s)\n"
+ " /p : Profile test. (Default: %3s)\n"
+ " /n : Null (0 length) test. (Default: Off)\n"
+ " /f:size : Fixed sized packets. (Default: %3s)\n"
+ " /x : Xtract detailed DCOM/RPC/NET data. (Default: %3s)\n"
+ " /i : Toggle instrumentation. (Default: %3s)\n",
+ fLong ? "On" : "Off",
+ fProfile ? "On" : "Off",
+ fFixed ? "On" : "Off",
+ g_fSummarize ? "Off" : "Off",
+ fInstrument ? "On" : "Off");
+
+ exit(1);
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ if (fUnreg) {
+ Unregister();
+ }
+ else {
+ //////////////////////////////////////////////////////////////////////////////
+ //
+ CInitStub cinitstub;
+
+ // Register in the registry.
+ Register();
+
+ if (fInstrument) {
+ RerouteEntryPoints();
+ }
+
+ LONGLONG llCycles;
+ hr = GetClockInfo(&llCycles);
+ ASSERT(SUCCEEDED(hr));
+ g_dCyclesPerSecond = (double)llCycles;
+ g_dMsPerCycle = (double)1000.0 / (double)llCycles;
+
+ g_pBuffer = CoTaskMemAlloc(g_cbBufferMax);
+ ASSERT(g_pBuffer != NULL);
+
+ if (fServer) {
+ // register the class-object with OLE
+ CNetPingFactory::InitSystem();
+
+ CNetPingFactory *pClassFactory = new CNetPingFactory;
+
+ printf("Registering.\n");
+ DWORD dwRegister;
+ hr = CoRegisterClassObject(CLSID_NetPingObject, pClassFactory,
+ CLSCTX_SERVER, REGCLS_MULTIPLEUSE, &dwRegister);
+ printf("Releasing Registered.\n");
+ pClassFactory->Release();
+ if (FAILED(hr)) {
+ CheckResult(hr, "Server: CoRegisterClassObject");
+ ASSERT(SUCCEEDED(hr));
+ }
+
+ printf(" Server: Waiting <<<Press Ctrl-C to stop.>>>\n");
+
+ while (fServer) {
+ CNetPingFactory::Wait();
+ }
+
+ hr = CoRevokeClassObject(dwRegister);
+ if (FAILED(hr)) {
+ CheckResult(hr, "Server: CoRevokeClassObject");
+ ASSERT(SUCCEEDED(hr));
+ }
+
+ CNetPingFactory::FiniSystem();
+ }
+ else if (nServers) {
+ LONGLONG llBeg;
+ LONGLONG llEnd;
+ COSERVERINFO csi;
+ MULTI_QI mq;
+
+ //////////////////////////////////////////////////////////////////
+ //
+ printf("Processor Speed: %.0f MHz\n", g_dCyclesPerSecond / 1000000.0);
+
+ DWORD dwSize = ARRAYSIZE(g_wzClientName);
+ GetComputerNameW(g_wzClientName, &dwSize);
+
+ printf(";;; %ls - %.0f MHz\n",
+ g_wzClientName,
+ g_dCyclesPerSecond / 1000000.0);
+
+ for (int n = 0; n < nServers; n++) {
+ if (g_wzServerName[0] == '\\' && g_wzServerName[1] == '\\') {
+ hr = StringCchCopyW(g_wzServerName, ARRAYSIZE(g_wzServerName), wzServers[n] + 2);
+ }
+ else {
+ hr = StringCchCopyW(g_wzServerName, ARRAYSIZE(g_wzServerName), wzServers[n]);
+ }
+ CheckResult(hr, "Main");
+
+ printf("Server: %ls->%ls\n", g_wzClientName, g_wzServerName);
+
+ printf(";; %ls %ls\n", g_wzClientName, g_wzServerName);
+
+ ZeroMemory(&csi, sizeof(csi));
+ csi.pwszName = wzServers[n];
+
+ // create a remote instance of the object on the argv[1] machine
+ mq.pIID = &IID_IPing;
+ mq.pItf = NULL;
+ mq.hr = S_OK;
+ llBeg = GetTimeStamp();
+ hr = CoCreateInstanceEx(CLSID_NetPingObject, NULL, CLSCTX_SERVER,
+ &csi, 1, &mq);
+ llEnd = GetTimeStamp();
+
+ printf(" CoCreateInstanceEx: %0.4f seconds (%lu ticks)\n",
+ (double)(llEnd - llBeg)/(double)llCycles,
+ (ULONG)(llEnd - llBeg));
+
+ CheckResult(mq.hr, "CoCreateInstanceEx [mq]");
+ CheckResult(hr, "CoCreateInstanceEx");
+
+ if (FAILED(hr)) {
+ CheckResult(hr, "CoCreateInstanceEx");
+ continue;
+ }
+
+ //////////////////////////////////////////////////////////////////
+ //
+ IPing *pIPing = (IPing *)mq.pItf;
+
+ hr = pIPing->Ping();
+ if (FAILED(hr)) {
+ CheckResult(hr, "Ping");
+ }
+ ASSERT(SUCCEEDED(hr));
+ hr = Catch_IPing_Ping(pIPing);
+ if (FAILED(hr)) {
+ CheckResult(hr, "Ping");
+ }
+ ASSERT(SUCCEEDED(hr));
+ ZeroCycles();
+
+ if (fFixed) {
+ Sample_Fixed(pIPing);
+ }
+ else if (fProfile) {
+ Sample_Profile(pIPing);
+ }
+ else {
+ Sample_Simple(pIPing);
+ if (fLong) {
+ for (;;) {
+ Sample_More(pIPing);
+
+ for (int j = 0; j < 5; j++) {
+ Sleep(20000);
+ Sample_Simple(pIPing);
+ }
+ Sleep(20000);
+
+ for (int i = 0; i < 18; i++) {
+ Sample_Less(pIPing);
+
+ for (int j = 0; j < 3; j++) {
+ Sleep(20000);
+ Sample_Simple(pIPing);
+ }
+ Sleep(20000);
+ }
+ }
+ }
+ }
+
+ pIPing->Release();
+ }
+ }
+
+ if (g_pBuffer) {
+ CoTaskMemFree(g_pBuffer);
+ g_pBuffer = NULL;
+ }
+
+ Sleep(2);
+
+ if (fInstrument && !g_fSummarize && s_rllCounts[E_Proxy]) {
+ printf("::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
+ "::::::::::::::::::\n");
+ printf(":: Instrumented Cycles: _____Function Time__ "
+ "________Total Time__ : Count\n");
+ LONG n = E_DCOM;
+ for (; n < E_MaxValue; n++) {
+ s_rllCycles[n] = 0;
+ s_rllTotals[n] = 0;
+ s_rllCounts[n] = 0;
+ }
+
+ for (n = E_MinValue + 1; n < E_MaxValue; n++) {
+ DumpCycles(n);
+ }
+
+ printf("::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
+ "::::::::::::::::::\n");
+ printf(":: Protocol Cycles:\n");
+ for (n = E_DcomBeg; n <= E_DcomEnd; n++) {
+ s_rllCycles[E_DCOM] += s_rllCycles[n];
+ s_rllTotals[E_DCOM] += s_rllTotals[n];
+ s_rllCounts[E_DCOM] += s_rllCounts[n];
+ }
+ for (n = E_RpcBeg; n <= E_RpcEnd; n++) {
+ s_rllCycles[E_RPC] += s_rllCycles[n];
+ s_rllTotals[E_RPC] += s_rllTotals[n];
+ s_rllCounts[E_RPC] += s_rllCounts[n];
+ }
+ for (n = E_UdpBeg; n <= E_UdpEnd; n++) {
+ s_rllCycles[E_UDP] += s_rllCycles[n];
+ s_rllTotals[E_UDP] += s_rllTotals[n];
+ s_rllCounts[E_UDP] += s_rllCounts[n];
+ }
+ for (n = E_NetBeg; n <= E_NetEnd; n++) {
+ s_rllTotals[E_NET] += s_rllCycles[n];
+ s_rllCycles[E_NET] += s_rllTotals[n];
+ s_rllCounts[E_NET] += s_rllCounts[n];
+ }
+ DumpCycles(E_DCOM);
+ DumpCycles(E_RPC);
+ DumpCycles(E_UDP);
+ DumpCycles(E_NET);
+
+ printf("::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
+ "::::::::::::::::::\n");
+ printf(":: Protocol Cycles Per DCOM Call:\n");
+ s_rllCycles[E_DCOM] /= s_rllCounts[E_DCOM];
+ s_rllCycles[E_RPC] /= s_rllCounts[E_DCOM];
+ s_rllCycles[E_UDP] /= s_rllCounts[E_DCOM];
+ s_rllCycles[E_NET] /= s_rllCounts[E_DCOM];
+
+ s_rllTotals[E_DCOM] /= s_rllCounts[E_DCOM];
+ s_rllTotals[E_RPC] /= s_rllCounts[E_DCOM];
+ s_rllTotals[E_UDP] /= s_rllCounts[E_DCOM];
+ s_rllTotals[E_NET] /= s_rllCounts[E_DCOM];
+
+ DumpCycles(E_DCOM);
+ DumpCycles(E_RPC);
+ DumpCycles(E_UDP);
+ DumpCycles(E_NET);
+ }
+ }
+ return 0;
+}
+
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/cping/cping.dat b/ext/detours/samples/cping/cping.dat
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/ext/detours/samples/cping/cping.dat
diff --git a/ext/detours/samples/cping/iping.idl b/ext/detours/samples/cping/iping.idl
new file mode 100644
index 0000000..6713e50
--- /dev/null
+++ b/ext/detours/samples/cping/iping.idl
@@ -0,0 +1,23 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Module: iping.idl (cping.exe - COM Ping)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+import "objidl.idl";
+import "oaidl.idl";
+import "oleidl.idl";
+
+
+[object, uuid(decdbeef-d1ac-11d1-96bc-00aa00573fb0), pointer_default(unique)]
+interface IPing : IUnknown
+{
+ HRESULT Ping(void);
+ HRESULT PingToServer([in] LPSTR pszString);
+ HRESULT PingToClient([out] LPSTR *ppszString);
+ HRESULT PingToClientSize([in] ULONG cbOut);
+};
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/disas/Makefile b/ext/detours/samples/disas/Makefile
new file mode 100644
index 0000000..ecf0f66
--- /dev/null
+++ b/ext/detours/samples/disas/Makefile
@@ -0,0 +1,76 @@
+##############################################################################
+##
+## Makefile for Detours Test Programs.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+# temporarily disable this test for ARM64
+!if "$(DETOURS_TARGET_PROCESSOR)" != "ARM64"
+
+LIBS=$(LIBS) kernel32.lib
+
+all: dirs \
+ $(BIND)\disas.exe \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\disas.bsc
+!ENDIF
+
+clean:
+ -del *~ *.obj *.sbr *.lst 2>nul
+ -del $(BIND)\disas.* 2> nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+!IF "$(DETOURS_TARGET_PROCESSOR)" == "X86"
+$(OBJD)\disasm.obj : x86.cpp
+ cl $(CFLAGS) /Fe$@ /FAcs /Fa$(OBJD)\x86.lst \
+ /Fd$(@R).pdb /Fo$(OBJD)\disasm.obj /c x86.cpp
+!ELSEIF "$(DETOURS_TARGET_PROCESSOR)" == "X64"
+$(OBJD)\disasm.obj : x64.asm
+ $(ASM) $(AFLAGS) /Fo$(OBJD)\disasm.obj /Fl$(OBJD)\x64.lst x64.asm
+!ELSEIF "$(DETOURS_TARGET_PROCESSOR)" == "IA64"
+$(OBJD)\disasm.obj : ia64.asm
+ $(ASM) $(AFLAGS) -o $(OBJD)\disasm.obj ia64.asm
+!ELSEIF "$(DETOURS_TARGET_PROCESSOR)" == "ARM"
+$(OBJD)\disasm.obj : arm.asm
+ $(ASM) $(AFLAGS) -list $(OBJD)\arm.lst -o $(OBJD)\disasm.obj arm.asm
+!ENDIF
+
+$(BIND)\disas.obj : disas.cpp
+
+$(BIND)\disas.exe : $(OBJD)\disas.obj $(OBJD)\disasm.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /FAcs /Fa$(OBJD)\disas.lst /Fd$(@R).pdb \
+ $(OBJD)\disas.obj $(OBJD)\disasm.obj \
+ /link $(LINKFLAGS) $(LIBS) /subsystem:console /entry:WinMainCRTStartup
+
+$(OBJD)\disas.bsc : $(OBJD)\disas.obj
+ bscmake /v /n /o $@ $(OBJD)\disas.sbr
+
+##############################################################################
+
+test: $(BIND)\disas.exe
+ $(BIND)\disas.exe
+
+##############################################################################
+
+!else
+
+all:
+test:
+clean:
+realclean:
+
+!endif
+
+################################################################# End of File.
diff --git a/ext/detours/samples/disas/arm.asm b/ext/detours/samples/disas/arm.asm
new file mode 100644
index 0000000..10073b7
--- /dev/null
+++ b/ext/detours/samples/disas/arm.asm
@@ -0,0 +1,232 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Detours Test Program (rlo.asm/disas.exe)
+;;
+;; Microsoft Research Detours Package
+;;
+;; Copyright (c) Microsoft Corporation. All rights reserved.
+;;
+
+ MACRO
+ BREAK
+ DCW 0xdefe
+ MEND
+
+ AREA |.text|,ALIGN=2,CODE,READONLY
+
+ AREA |.text|,CODE,READONLY
+
+ ALIGN 0x1000
+
+ EXPORT |TestCodes|
+|TestCodes|
+
+; dcw 0xf8df,0xe00e ; 94 = -16 = -12 ; 94 ; 98 + e = a6
+; BREAK ; 98 = -14 = -10 ; 98 ; 9c
+; dcw 0xf8df,0xe00a ; 9a = -12 = -8 ; 98 ; 9c + a = a6
+; BREAK ; 9e = -8 = -4 ; 9c ; a0
+; dcw 0xf8df,0xe002 ; a0 = -6 = -2 ; a0 ; a4 + 2 = a6
+; BREAK ; a4 = -2 ; a4 ; a8
+; movs r2, r0 ; a6 <===
+; movs r3, r0 ;
+; BREAK
+; BREAK
+;
+; ldr lr,=0xa98765
+; ldr pc,=0xa98765
+; ldr pc,=0xa98765
+; ldr pc,=0xa98765
+; BREAK
+; BREAK
+
+ BREAK
+ ldr lr, =0xa98765
+ BREAK
+ blx lr
+
+ BREAK
+ pop pc
+ BREAK
+ pop {r11,pc}
+ BREAK
+ pop {r10,r11,pc}
+ BREAK
+ pop {r9,r10,r11,pc}
+ BREAK
+ pop {r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,pc}
+
+ BREAK
+ ldr.w r0,=0xa98765
+ BREAK
+ nop
+ ldr.w r0,=0xa98765
+ BREAK
+ nop
+ nop
+ ldr.w r0,=0xa98765
+
+ BREAK
+ ldr r0,=0xa98765
+ BREAK
+ ldr.w r0,=0xa98765
+ BREAK
+ ldr.w r0,=0xa98765
+ BREAK
+ ldr r0,=0xa98765
+ BREAK
+ ldr.w r0,=0xa98765
+ BREAK
+ ldr.w r0,=0xa98765
+ BREAK
+ ldr r0,=0xa98765
+ BREAK
+ ldr.w r0,=0xa98765
+ BREAK
+ ldr.w r0,=0xa98765
+
+ BREAK
+ ldr r0,=0xa98765
+ BREAK
+ nop
+ ldr r0,=0xa98765
+ BREAK
+ nop
+ nop
+ ldr r0,=0xa98765
+
+ BREAK
+ nop
+ ldr r0,=0xa
+ BREAK
+ ldr r0,=0xa9
+ BREAK
+ ldr r0,=0xa98
+ BREAK
+ ldr r0,=0xa987
+ BREAK
+ ldr r0,=0xa9876
+ BREAK
+ ldr r0,=0xa98765
+ BREAK
+ ldr r0,=0xa987654
+ BREAK
+ ldr r0,=0xa9876543
+
+ ;; Simple instructions.
+ BREAK
+ adds r0,r0, #5 ; 1d40
+ BREAK
+ movs r2, #0 ; 2200
+ BREAK
+ movs r3, #0 ; 2300
+ BREAK
+ bx lr ; 4770 [FFFFFFFF]
+
+ ;; Known 16-bit instructions
+ BREAK
+ mov r11, sp ; 46eb
+ BREAK
+ movs r2, r0 ; 0002
+ BREAK
+ push r0, r1 ; b403
+ BREAK
+ str r3,[r7,#0x28] ; 62bb
+ BREAK
+ bx r5 ; 4728 [FFFFFFFF]
+ BREAK
+ blx r5 ; 47a8
+ BREAK
+ DCW 0x4878 ; ldr r0, [PC + 0x1E0] ; 4878
+ BREAK
+ str r3,[r7,#0x1C] ; 61fb
+ BREAK
+ ldr r3,[r7,#0x38] ; 6bbb
+ BREAK
+ add r3,sp,#0xCC ; ab33
+ BREAK
+ cbz r2,+0x56 ; b34a [00xx1510]
+ BREAK
+ cbnz r2,+0x56 ; bb4a [00xx1514]
+ BREAK
+ push {r0,r2,r4,r6,lr} ; b555
+ BREAK
+ nop ; bf00
+
+ ;; Placeholder for IT instruction
+ BREAK
+ bne +0x6E ; d135 [00xx1538] -??? d137
+ BREAK
+ svc #0x24 ; df24
+ BREAK
+ b +0x7FE ; e3fd [00xx1cd0] -??? e3ff
+
+ ;; 32 bit test codes
+ BREAK
+ adds r0,r7,#8 ; f1170008
+ BREAK
+ str r3,[r5,#0x677] ; f8c53677
+ BREAK
+ ldrsh r10,[r5,#0x5A5] ; f9b5a5a5
+ BREAK
+ DCW 0xf89f,0x55a5 ;ldrb r5, [+0x5A5] ; f89f55a5
+ BREAK
+ bls.w +0x86; 0xf240; 0x8043; // ; f2408041 [00xx157A]
+ BREAK
+ bl +0xFE; 0xf7ff; 0xff80; //
+ BREAK
+ bl +0xFFE; 0xf7ff; 0xff80; //
+ BREAK
+ bl +0xFFFE; 0xf7ff; 0xff80; //
+ BREAK
+ bl +0xFFFFE; 0xf7ff; 0xff80; //
+ BREAK
+ bl +0xFFFFFE; 0xf7ff; 0xff80; //
+ BREAK
+ bl +0xF0; 0xf7ff; 0xff80; //
+ BREAK
+ bl +0xFF0; 0xf7ff; 0xff80; //
+ BREAK
+ bl +0xFFF0; 0xf7ff; 0xff80; //
+ BREAK
+ bl +0xFFFF0; 0xf7ff; 0xff80; //
+ BREAK
+ bl +0xFFFFF0; 0xf7ff; 0xff80; //
+ BREAK
+ bl +0xF00; 0xf7ff; 0xff80; //
+ BREAK
+ bl +0xFF00; 0xf7ff; 0xff80; //
+ BREAK
+ bl +0xFFF00; 0xf7ff; 0xff80; //
+ BREAK
+ bl +0xFFFF00; 0xf7ff; 0xff80; //
+ BREAK
+ DCW 0xf7ff,0xff80
+ ;bl +0xFFFFFF00; 0xf7ff; 0xff80; //
+ BREAK
+ DCW 0xf7ff,0xbe02
+ ; b.w ; 0xf7ff; 0xbe02; // (10053528)
+ BREAK
+ push {r7,r11,lr}; 0xe92d; 0x4880; //
+
+ ;; 32 bit expected results
+ BREAK
+ adds r0,r7,#8 ; 0xf1170008
+ BREAK
+ str r3,[r5,#0x677] ; 0xf8c53677
+ BREAK
+ ldrsh r10,[r5,#0x5A5] ; 0xf9b5a5a5
+
+ BREAK
+ DCW 0xf6af,0xfbd2
+ ; bl (0008ef3c); ResultCode(4, 0xf6af, 0xfbd2, Target(ADDRESS(&g_pTestCodes32[i*2], 0xFFFFFF00))); // 0xf7ff, 0xff80: -> 0xf6affbd2
+ BREAK
+ bl (00090300); ResultCode(4, 0xf6af, 0xba54, Target(ADDRESS(&g_pTestCodes32[i*2], 0xFFFFFC04))); // 0xf7ff, 0xff80: -> f6afba54 bl (00090300)
+ BREAK
+ push {r7,r11,lr}; ResultCode(4, 0xe92d, 0x4880); // 0xe92d, 0x4880: //
+
+ BREAK
+ BREAK
+
+|TestCodes_end|
+
+ END
diff --git a/ext/detours/samples/disas/disas.cpp b/ext/detours/samples/disas/disas.cpp
new file mode 100644
index 0000000..db8ef6a
--- /dev/null
+++ b/ext/detours/samples/disas/disas.cpp
@@ -0,0 +1,702 @@
+/////////////////////////////////////////////////////////////////////////////
+//
+// Module: disas.cpp (disas.exe - Detours Test Program)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#define DETOURS_INTERNAL
+#include <detours.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+///////////////////////////////////////////////////////////////////////// ARM.
+//
+#ifdef DETOURS_ARM
+
+extern "C" BYTE TestCodes[];
+
+void DumpMemoryFragment(PBYTE pbData, ULONG cbData, ULONG cbSpace)
+{
+ ULONG n = 0;
+ if (cbData >= 4) {
+ printf("%04x%04x ", ((PUSHORT)pbData)[0], ((PUSHORT)pbData)[1]);
+ n += 4;
+ }
+ else if (cbData >= 2) {
+ printf("%04x ", *((PUSHORT)pbData));
+ n += 2;
+ }
+
+ for (; n < cbSpace; n++) {
+ if (n < cbData) {
+ printf("%02x", pbData[n]);
+ }
+ else {
+ printf(" ");
+ }
+ }
+ if (n < cbData) {
+ printf(".");
+ }
+ else {
+ printf(" ");
+ }
+}
+
+inline ULONG fetch_thumb_opcode(PBYTE pbCode)
+{
+ ULONG Opcode = *(UINT16 *)&pbCode[0];
+ if (Opcode >= 0xe800) {
+ Opcode = (Opcode << 16) | *(UINT16 *)&pbCode[2];
+ }
+ return Opcode;
+}
+
+BOOL IsTerminate(PBYTE pbSrc)
+{
+ ULONG opcode = fetch_thumb_opcode(pbSrc);
+
+ if ((opcode & 0xff87) == 0x4700) {
+ // bx r
+ return TRUE;
+ }
+
+#if 0
+ if ((opcode & 0xfbf08f00) == 0xf2400c00) { // movw r12,#xxxx
+ return TRUE;
+ }
+
+ if ((opcode == 0xf8dcf000) { // ldr pc,[r12]
+ ULONG Immediate = ((opcode2 << 12) & 0xf7000000) |
+ ((opcode2 << 1) & 0x08000000) |
+ ((opcode2 << 16) & 0x00ff0000) |
+ ((opcode >> 4) & 0x0000f700) |
+ ((opcode >> 15) & 0x00000800) |
+ ((opcode >> 0) & 0x000000ff);
+ PBYTE pbTarget = *(PBYTE *)Immediate;
+ if (detour_is_imported(pbCode, pbTarget)) {
+ PBYTE pbNew = *(PBYTE *)pbTarget;
+ DETOUR_TRACE(("%p->%p: skipped over import table.\n", pbCode, pbNew));
+ return pbNew;
+ }
+ }
+ }
+ }
+#endif
+
+ return FALSE;
+}
+
+#endif // DETOURS_ARM
+
+///////////////////////////////////////////////////////////////// X86 and X64.
+//
+#if defined(DETOURS_X86) || defined(DETOURS_X64)
+
+extern "C" BYTE TestCodes[];
+
+void DumpMemoryFragment(PBYTE pbData, ULONG cbData, ULONG cbSpace)
+{
+ ULONG n = 0;
+ for (; n < cbSpace; n++) {
+ if (n < cbData) {
+ printf("%02x", pbData[n]);
+ }
+ else {
+ printf(" ");
+ }
+ }
+ if (n < cbData) {
+ printf(".");
+ }
+ else {
+ printf(" ");
+ }
+}
+
+BOOL IsTerminate(PBYTE pbSrc)
+{
+ if ((0xC3 == pbSrc[0] && 0x00 == pbSrc[1]) || // bx lr
+ 0xCB == pbSrc[0] || // RETF
+ 0xC2 == pbSrc[0] || // RET dw
+ 0xCA == pbSrc[0] || // RETF dw
+ 0xEB == pbSrc[0] || // JMP ob
+ 0xE9 == pbSrc[0] || // JMP ol
+ 0xEA == pbSrc[0]) { // JMP ol
+
+ return TRUE;
+ }
+ if (0xff == pbSrc[0] && 0x25 == pbSrc[1]) // JMP [addr]
+ return TRUE;
+ return FALSE;
+}
+
+#endif // DETOURS_X86 || DETOURS_X64
+
+/////////////////////////////////////////////////////////// X86, X64, and ARM.
+//
+#if defined(DETOURS_X86) || defined(DETOURS_X64) || defined(DETOURS_ARM)
+struct BasicBlockLink
+{
+ public:
+ BasicBlockLink * m_pNext;
+ PBYTE m_pbEntry;
+ PCHAR m_pszName;
+
+ public:
+ BasicBlockLink(PBYTE pbEntry, PCHAR pszName = NULL)
+ {
+ m_pNext = NULL;
+ m_pbEntry = pbEntry;
+ m_pszName = pszName;
+
+ *s_ppTail = this;
+ s_ppTail = &m_pNext;
+ }
+
+ BasicBlockLink * Next()
+ {
+ return m_pNext;
+ }
+
+ static BasicBlockLink * GetListHead()
+ {
+ return s_pHead;
+ }
+
+ protected:
+ static BasicBlockLink * s_pHead;
+ static BasicBlockLink ** s_ppTail;
+};
+
+BasicBlockLink * BasicBlockLink::s_pHead = NULL;
+BasicBlockLink ** BasicBlockLink::s_ppTail = &BasicBlockLink::s_pHead;
+
+static PBYTE s_pbBegin = NULL;
+static PBYTE s_pbLimit = NULL;
+
+int TestDetourCopyInstruction(PBYTE pbSrcInstruction, PCHAR pszFunction)
+{
+ PBYTE pbSrc = pbSrcInstruction;
+ ULONG nIns = 0;
+
+ if (pszFunction) {
+ printf("%s:\n", pszFunction);
+ }
+ for (; nIns < 4096; nIns++) {
+ BYTE rbDst[128];
+ PVOID pbDstPool = (PVOID)(rbDst + sizeof(rbDst));
+ LONG lExtra = 0;
+ PVOID pbTarget = NULL;
+ ULONG cbStep = (ULONG)((PBYTE)DetourCopyInstruction(rbDst, &pbDstPool, pbSrc,
+ &pbTarget, &lExtra) - pbSrc);
+
+ printf(" %p:", pbSrc);
+ DumpMemoryFragment(rbDst, cbStep, 10);
+ printf(" ");
+ DumpMemoryFragment(rbDst, cbStep, 10);
+ if (pbTarget) {
+ if (pbTarget == DETOUR_INSTRUCTION_TARGET_DYNAMIC) {
+ printf(" Dynamic\n");
+ }
+ else {
+ printf(" %p%c\n", pbTarget,
+ (pbTarget >= s_pbBegin && pbTarget < s_pbLimit) ? ' ' : '!');
+ }
+ }
+ else {
+ printf("\n");
+ }
+
+ if (pbTarget && pbTarget != DETOUR_INSTRUCTION_TARGET_DYNAMIC) {
+ if (pbTarget > pbSrc &&
+ pbTarget >= s_pbBegin &&
+ pbTarget < s_pbLimit
+ ) {
+ (void) new BasicBlockLink((PBYTE)pbTarget, NULL);
+ }
+ }
+
+ if (IsTerminate(pbSrc)) {
+ break;
+ }
+
+ pbSrc += cbStep;
+ }
+ return nIns;
+}
+
+BOOL CALLBACK ExportCallback(_In_opt_ PVOID pContext,
+ _In_ ULONG nOrdinal,
+ _In_opt_ LPCSTR pszName,
+ _In_opt_ PVOID pCode)
+{
+ (void)pContext;
+ (void)nOrdinal;
+ (void)pCode;
+
+ (VOID) new BasicBlockLink((PBYTE)pCode, pszName ? pszName : "[NO NAME]");
+ return TRUE;
+}
+#endif // DETOURS_X86 || DETOURS_X64
+
+//////////////////////////////////////////////////////////////////////// IA64.
+//
+#ifdef DETOURS_IA64
+#pragma warning(disable: 4201) // ignore warning about unnamed sturcture in union.
+
+void DumpHi(PBYTE pbData, ULONG cbData, ULONG cbSpace)
+{
+ ULONG n = 0;
+ for (; n < cbSpace; n++) {
+ if (n < cbData) {
+ printf("%02x", pbData[(cbData - 1) - n]);
+ }
+ else {
+ printf(" ");
+ }
+ }
+ printf("\n");
+}
+
+struct DETOUR_IA64_BUNDLE_DISASSEMBLE : public DETOUR_IA64_BUNDLE
+{
+ public:
+ void SetBrx(UINT64 raw)
+ {
+ SetBrl();
+ SetBrlImm(raw);
+ }
+
+ void Dis()
+ {
+ const char szUnitNames[17] = "?aimbflx?AIMBFLX";
+
+ printf("%p: ", data);
+ BYTE nTemplate = GetTemplate();
+ BYTE nInst0 = GetInst0();
+ BYTE nInst1 = GetInst1();
+ BYTE nInst2 = GetInst2();
+ BYTE nUnit0 = GetUnit0();
+ BYTE nUnit1 = GetUnit1();
+ BYTE nUnit2 = GetUnit2();
+ if (nUnit1 == L_UNIT) { // MLX instruction
+ UINT64 d2 = (
+ // 0x0000000000fffff0
+ ((wide[1] & 0x00fffff000000000) >> 32) |
+ // 0x000000ffff000000
+ ((wide[0] & 0xffff000000000000) >> 24) |
+ // 0x7fffff0000000000
+ ((wide[1] & 0x00000000007fffff) << 40) |
+ // 0x8000000000000000
+ ((wide[1] & 0x0800000000000000) << 4)
+ );
+ printf("%02x %c%01x %010I64lx %c%01x %016I64lx",
+ nTemplate,
+ szUnitNames[nUnit0], nInst0, GetData0(),
+ szUnitNames[nUnit2], nInst2, d2);
+ }
+ else {
+ printf("%02x %c%01x %010I64lx %c%01x %010I64lx %c%01x %010I64lx",
+ nTemplate,
+ szUnitNames[nUnit0], nInst0, GetData0(),
+ szUnitNames[nUnit1], nInst1, GetData1(),
+ szUnitNames[nUnit2], nInst2, GetData2());
+ }
+
+ if (IsBrl()) {
+ printf(" brl %p", GetBrlTarget());
+ }
+ else if (IsMovlGp()) {
+ printf(" movl gp=%p", GetMovlGp());
+ }
+ if ((wide[0] & 0xfffffc000603ffff) == 0x002024000200100b &&
+ wide[1] == 0x0004000000203008) {
+
+ ULONG64 offset =
+ ((wide[0] & 0x0000000001fc0000) >> 18) | // imm7b
+ ((wide[0] & 0x000001ff00000000) >> 25) | // imm9d
+ ((wide[0] & 0x00000000f8000000) >> 11); // imm5c
+ if (wide[0] & 0x0000020000000000) {
+ offset |= 0xffffffffffe00000;
+ }
+ printf(" imm=%016I64lx", offset);
+ }
+ printf("\n");
+ }
+};
+
+//////////////////////////////////////////////////////////////////////////////
+//
+BOOL CALLBACK ExportCallbackIA64(_In_opt_ PVOID pContext,
+ _In_ ULONG nOrdinal,
+ _In_opt_ LPCSTR pszName,
+ _In_opt_ PVOID pCode)
+{
+ (void)pContext;
+ (void)nOrdinal;
+
+ DETOUR_IA64_BUNDLE_DISASSEMBLE *pb = *(DETOUR_IA64_BUNDLE_DISASSEMBLE **)pCode;
+ DETOUR_IA64_BUNDLE temp;
+
+ if (!pb[0].Copy(&temp)) {
+ printf("%s:\n ", pszName ? pszName : "[NO NAME]");
+ pb[0].Dis();
+ }
+ return TRUE;
+}
+
+#if 0
+void TestBoth()
+{
+ LPVOID pvBase = VirtualAlloc((PBYTE)0x800000000, 0x10000,
+ MEM_RESERVE | MEM_COMMIT,
+ PAGE_EXECUTE_READWRITE);
+
+ DETOUR_IA64_BUNDLE *pbBase = (DETOUR_IA64_BUNDLE *)pvBase;
+ DETOUR_IA64_BUNDLE *pb = pbBase;
+
+ printf("TestBoth:\n");
+ for (UINT64 i = 0x10; i < 0x8000000000000000; i <<= 1) {
+ pb->SetMovlGp(i);
+ if (pb->GetMovlGp() != i) {
+ printf("Error in MovlGp!\n");
+ return;
+ }
+ pb++;
+
+ pb->SetBrl(i);
+ if (pb->GetBrlEip() != i) {
+ printf("Error in Brl!\n");
+ return;
+ }
+ pb++;
+ }
+
+ for (UINT64 i = (UINT64)(INT64)-0x10; i > 0; i <<= 1) {
+ pb->SetMovlGp(i);
+ if (pb->GetMovlGp() != i) {
+ printf("Error in MovlGp!\n");
+ return;
+ }
+ pb++;
+
+ pb->SetBrl(i);
+ if (pb->GetBrlEip() != i) {
+ printf("Error in Brl!\n");
+ return;
+ }
+ pb++;
+ }
+
+ printf("u %p %p\n", pbBase, pb);
+}
+#endif
+#endif // DETOURS_IA64
+
+int WINAPI WinMain(HINSTANCE hinst, HINSTANCE hprev, LPSTR lpszCmdLine, int nCmdShow)
+{
+ (void)hprev;
+ (void)hinst;
+ (void)lpszCmdLine;
+ (void)nCmdShow;
+
+ // Bug report, but it works here.
+ // 07ff8`4b783054 49ba 70b3d93a d40fb998 mov r10,98B90FD43AD9B370h
+ //
+ {
+ static const UCHAR mov_r10_imm64[] = {0x49, 0xba, 1, 2, 3, 4, 5, 6, 7, 8 };
+
+ PVOID const after = DetourCopyInstructionX64(0, 0, const_cast<PUCHAR>(mov_r10_imm64), 0, 0);
+
+ if (after != &mov_r10_imm64 + 1)
+ {
+ printf("mov_r10_imm64 failed, expected:%p vs. got:%p\n", &mov_r10_imm64 + 1, after);
+ if (IsDebuggerPresent())
+ {
+ __debugbreak();
+ DetourCopyInstructionX64(0, 0, const_cast<PUCHAR>(mov_r10_imm64), 0, 0);
+ }
+ return 1;
+ }
+ }
+
+#ifdef DETOURS_IA64
+ // First we check the pre-canned TestCodes from disasm.asm
+ //
+ PBYTE pbTest = *(PBYTE*)WinMain;
+ for (;; pbTest += 16) {
+ DETOUR_IA64_BUNDLE_DISASSEMBLE *pb = (DETOUR_IA64_BUNDLE_DISASSEMBLE *)pbTest;
+
+ pb->Dis();
+ if (pbTest[0] == 0xff) {
+ break;
+ }
+ DumpHi(pbTest, 16, 16);
+ }
+
+#if 0
+ printf("\n\n");
+
+ DETOUR_IA64_BUNDLE_DISASSEMBLE *pb = (DETOUR_IA64_BUNDLE_DISASSEMBLE *)pbTest;
+ DETOUR_IA64_BUNDLE_DISASSEMBLE *pbBeg = pb;
+ DWORD dwOld;
+ VirtualProtect(pb, 0x2000, PAGE_EXECUTE_READWRITE, &dwOld);
+ printf("%p: (%d)\n", pb, sizeof(pb));
+ pb++;
+ printf("%p: (%d)\n", pb, sizeof(pb));
+ pb++; pb->SetBrx(0);
+ pb++; pb->SetBrx(0);
+ pb++; pb->SetBrx(0);
+ pb++; pb->SetBrx(0xffffffffffffffff);
+ pb++; pb->SetBrx(0x0fffffffffffffff);
+ pb++; pb->SetBrx(0x00ffffffffffffff);
+ pb++; pb->SetBrx(0x000fffffffffffff);
+ pb++; pb->SetBrx(0x0000ffffffffffff);
+ pb++; pb->SetBrx(0x00000fffffffffff);
+ pb++; pb->SetBrx(0x000000ffffffffff);
+ pb++; pb->SetBrx(0x0000000fffffffff);
+ pb++; pb->SetBrx(0x00000000ffffffff);
+ pb++; pb->SetBrx(0x000000000fffffff);
+ pb++; pb->SetBrx(0x0000000000ffffff);
+ pb++; pb->SetBrx(0x00000000000fffff);
+ pb++; pb->SetBrx(0x000000000000ffff);
+ pb++; pb->SetBrx(0x0000000000000fff);
+ pb++; pb->SetBrx(0x00000000000000ff);
+ pb++; pb->SetBrx(0x000000000000000f);
+ pb++; pb->SetBrx(0x0000000000000000);
+ pb++; pb->SetBrx(0xffffffffffffffff);
+ pb++; pb->SetBrx(0xffffffffffffffff);
+ pb->SetInst0(0xff);
+ pb->SetData0(0xffffffffffffffff);
+ printf("%p:\n", pb);
+ DETOUR_IA64_BUNDLE_DISASSEMBLE *pbEnd = pb;
+ for (pb = pbBeg; pb < pbEnd; pb++) {
+ printf(" %p: ", pb);
+ DumpHi((BYTE*)pb, 16, 16);
+ }
+#endif
+
+#if 1
+ {
+ // Then we check all of the code we can find in user32.dll
+ //
+ printf("\n");
+ HINSTANCE hInst = LoadLibraryA("user32.dll");
+ printf("Loaded: user32.dll: %p\n", hInst);
+
+ PBYTE pbEntry = (PBYTE)DetourGetEntryPoint(hInst);
+ printf("Entry: %p\n", pbEntry);
+ ExportCallbackIA64(NULL, 0, "[Entry]", pbEntry);
+ DetourEnumerateExports(hInst, NULL, ExportCallbackIA64);
+ }
+
+ {
+ // Then we check all of the code we can find in opengl32.dll
+ //
+ printf("\n");
+ HINSTANCE hInst = LoadLibraryA("opengl32.dll");
+ printf("Loaded: opengl32.dll: %p\n", hInst);
+
+ PBYTE pbEntry = (PBYTE)DetourGetEntryPoint(hInst);
+ printf("Entry: %p\n", pbEntry);
+ ExportCallbackIA64(NULL, 0, "[Entry]", pbEntry);
+ DetourEnumerateExports(hInst, NULL, ExportCallbackIA64);
+ }
+
+ printf("\n");
+ for (HINSTANCE hInst = NULL; (hInst = DetourEnumerateModules(hInst)) != NULL;) {
+ CHAR szModuleName[512];
+ GetModuleFileNameA(hInst, szModuleName,
+ sizeof(szModuleName)/sizeof(szModuleName[0]));
+ printf("%p : %s\n", hInst, szModuleName);
+ DetourEnumerateExports(hInst, NULL, ExportCallbackIA64);
+ }
+
+ printf("\n");
+#endif
+#if 0
+ TestBoth();
+#endif
+#endif // DETOURS_IA64
+
+#if defined(DETOURS_X64) || defined(DETOURS_X86)
+ // First we check the pre-canned TestCodes from disasm.asm
+ //
+ PBYTE pbBegin = (PBYTE)DetourCodeFromPointer(TestCodes, NULL);
+ printf("%p:\n", pbBegin);
+ for (PBYTE pbTest = pbBegin;;) {
+ if (pbTest[0] != 0xcc) { // int 3
+ printf("%08lx ", (ULONG)(pbTest - pbBegin));
+ DumpMemoryFragment(pbTest, 8, 8);
+ printf("\n");
+ printf("failed on last.\n");
+ return 1;
+ }
+ pbTest++;
+
+ if (pbTest[0] == 0x70 || pbTest[0] == 0x71) {
+ printf("[%p]:\n", pbTest);
+ }
+ BYTE rbDst[128];
+ PVOID pbDstPool = (PVOID)(rbDst + sizeof(rbDst));
+ LONG lExtra = 0;
+ PVOID pbTarget = NULL;
+ PBYTE pbNext = (PBYTE)DetourCopyInstruction(rbDst, &pbDstPool, pbTest,
+ &pbTarget, &lExtra);
+
+ LONG cbTest = (LONG)(pbNext - pbTest);
+
+ printf("%08lx ", (ULONG)(pbTest - pbBegin));
+ DumpMemoryFragment(pbTest, cbTest, 12);
+ printf("[%16p] ", pbTarget);
+ DumpMemoryFragment(rbDst, cbTest + lExtra, 11);
+ printf("\n");
+
+ if (pbTest[cbTest] != 0xcc) {
+ printf("failed!\n");
+ return 1;
+ }
+
+ pbTest += cbTest;
+
+ if (pbTest[0] == 0xcc && pbTest[1] == 0xcc) {
+ break;
+ }
+ }
+
+#if 0
+ // Then we check all of the code we can find in user32.dll
+ //
+ HINSTANCE hInst = LoadLibraryA("user32.dll");
+ printf("Loaded: user32.dll: %p\n", hInst);
+
+ s_pbBegin = (PBYTE)hInst;
+ s_pbLimit = s_pbBegin + DetourGetModuleSize(hInst);
+
+ PBYTE pbEntry = DetourGetEntryPoint(hInst);
+ (VOID) new BasicBlockLink(pbEntry, "user32.dll");
+
+ DetourEnumerateExports(hInst, NULL, ExportCallback);
+
+ ULONG nIns = 0;
+ for (BasicBlockLink *pLink = BasicBlockLink::GetListHead();
+ pLink; pLink = pLink->Next()) {
+
+ nIns += TestDetourCopyInstruction(pLink->m_pbEntry, pLink->m_pszName);
+ if (nIns > 100000) {
+ break;
+ }
+ }
+ printf("Disassembled %d instructions.\n", nIns);
+#endif
+#endif // DETOURS_X86 || DETOURS_X64
+
+#ifdef DETOURS_ARM
+ // Create an output buffer and fill it with debugbreaks.
+ //
+ PBYTE pbBuffer
+ = (PBYTE)VirtualAlloc(NULL, 0x400, MEM_COMMIT|MEM_RESERVE, PAGE_EXECUTE_READWRITE);
+ for (PBYTE pbOut = pbBuffer; pbOut < pbBuffer + 0x400;) {
+ *pbOut++ = 0xfe;
+ *pbOut++ = 0xde;
+ }
+ PBYTE pbDst = pbBuffer;
+ PVOID pvDstPool = (PVOID)(pbBuffer + 0x400);
+
+ // First we check the pre-canned TestCodes from disasm.asm
+ //
+ PBYTE pbBegin = (PBYTE)DetourCodeFromPointer(TestCodes, NULL);
+ printf("%p: (TestCodes %p) => %p\n", pbBegin, TestCodes, pbBuffer);
+ for (PBYTE pbSrc = pbBegin;;) {
+ if (pbSrc[0] != 0xfe && pbSrc[1] != 0xde) { // BREAK
+ printf("%08x ", pbSrc - pbBegin);
+ DumpMemoryFragment(pbSrc, 8, 8);
+ printf("\n");
+ printf("failed on last.\n");
+ return 1;
+ }
+ pbSrc += 2;
+ *pbDst++ = 0xfe;
+ *pbDst++ = 0xde;
+
+ if ((pbSrc[0] == 0x00 && pbSrc[1] == 0xbf) && // NOP
+ (pbSrc[2] != 0xfe && pbSrc[3] != 0xde)) { // BREAK
+ // Skip over a single NOP so we can test alignment.
+ pbSrc += 2;
+ }
+
+ if ((pbSrc[0] == 0x00 && pbSrc[1] == 0xbf) && // NOP
+ (pbSrc[2] != 0xfe && pbSrc[3] != 0xde)) { // BREAK
+ // If there is a second NOP, then we insert alignment.
+ pbSrc += 2;
+ *pbDst++ = 0x00;
+ *pbDst++ = 0xbf;
+ }
+
+
+ LONG lExtra = 0;
+ PVOID pbTarget = NULL;
+ PBYTE pbNext = (PBYTE)DetourCopyInstruction(pbDst, &pvDstPool, pbSrc, &pbTarget, &lExtra);
+
+ LONG cbTest = (LONG)(pbNext - pbSrc);
+
+ printf("%08x ", pbSrc - pbBegin);
+ DumpMemoryFragment(pbSrc, cbTest, 4);
+ printf("[%8p] ", pbTarget);
+ DumpMemoryFragment(pbDst, cbTest + lExtra, 16);
+ printf("\n");
+
+ if (pbSrc[cbTest] != 0xfe || pbSrc[cbTest+1] != 0xde) {
+ printf("%p: failed! (pbSrc[n]=%02x, pbSrc[n+1]=%02x\n",
+ pbSrc,
+ pbSrc[cbTest], pbSrc[cbTest+1]);
+ __debugbreak();
+ pbNext = (PBYTE)DetourCopyInstruction(pbDst, &pvDstPool, pbSrc, &pbTarget, &lExtra);
+ cbTest = (LONG)(pbNext - pbSrc);
+ return 1;
+ }
+
+ pbDst += cbTest + lExtra;
+ pbSrc += cbTest;
+
+ if (pbSrc[0] == 0xfe && pbSrc[1] == 0xde &&
+ pbSrc[2] == 0xfe && pbSrc[3] == 0xde) {
+ break;
+ }
+ }
+
+#if 0
+ // Then we check all of the code we can find in user32.dll
+ //
+ HINSTANCE hInst = LoadLibraryA("user32.dll");
+ printf("Loaded: user32.dll: %p\n", hInst);
+
+ s_pbBegin = (PBYTE)hInst;
+ s_pbLimit = s_pbBegin + DetourGetModuleSize(hInst);
+
+ PBYTE pbEntry = DetourGetEntryPoint(hInst);
+ (VOID) new BasicBlockLink(pbEntry, "user32.dll");
+
+ DetourEnumerateExports(hInst, NULL, ExportCallback);
+
+ ULONG nIns = 0;
+ for (BasicBlockLink *pLink = BasicBlockLink::GetListHead();
+ pLink; pLink = pLink->Next()) {
+
+ nIns += TestDetourCopyInstruction(pLink->m_pbEntry, pLink->m_pszName);
+ if (nIns > 100000) {
+ break;
+ }
+ }
+ printf("Disassembled %d instructions.\n", nIns);
+#endif
+#endif // DETOURS_ARM
+
+ return 0;
+}
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/disas/ia64.asm b/ext/detours/samples/disas/ia64.asm
new file mode 100644
index 0000000..189eb28
--- /dev/null
+++ b/ext/detours/samples/disas/ia64.asm
@@ -0,0 +1,1084 @@
+/////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (ia64.asm/disas.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+ .section .text
+ .proc TestCodes#
+ .global TestCodes#
+ .align 64
+
+TestCodes:
+{ .mii
+ and r21 = 7, r32
+ mux1 r25 = r33, @brcst
+ add r16 = r32, r34
+} { .mmb
+ cmp.ge p9 = 0, r34
+ mov r8 = r32
+(p9) br.ret.spnt b0
+ ;;
+}
+// align on an 8-byte boundary
+{ .mmi
+ cmp.ne p15 = 0, r21 //Low 3 bits zero?
+ cmp.gt p10 = 0x30, r34
+ cmp.eq p6, p7 = 0, r33
+} { .mmb
+ nop.m 0
+ nop.m 0
+(p15) br.cond.dpnt Align_Loop
+ ;;
+} { .mmi
+(p7) mov r27 = 0x88
+(p6) mov r27 = 0x90
+ tbit.nz p14,p13 = r32, 3 // is aligned on 8-bytes (to align on 16 before FP loop)?
+} { .mbb
+ nop.m 0
+(p10) br.cond.dpnt Aligned_Short // blocks < 48 bytes
+(p7) br.cond.dpnt Aligned_Long; // do 8-byte stores for non-zero fills, 16-byte f0 for zero-fills
+ ;;
+}
+
+// zero-fills >= 48 bytes goes through an f0 16-byte store loop
+Aligned_FP_Long:
+{ .mmi
+ add r28 = 0x80, r27
+ add r29 = 0x100, r27
+ add r30 = 0x180, r27
+} { .mmi
+(p14) add r14 = 0x88, r32
+(p14) st8 [r32] = r0, 8
+(p14) add r34 = -0x8, r34
+ ;;
+} { .mmi
+(p13) add r14 = 0x80, r32
+ cmp.ge p7 = r34, r27
+ add r27 = 0x200, r27
+} { .mmi
+ add r15 = 0x180, r32
+ add r17 = 0x200, r32
+ nop.i 0
+ ;;
+} { .mmi
+ add r26 = 0x280, r32
+ cmp.ge p8 = r34, r28
+ cmp.ge p9 = r34, r29
+} { .mmi
+ stf.spill [r32] = f0 // Line 0
+(p7) stf.spill [r14] = f0,0x80 // Line +1 0x80
+ add r28 = 0x200, r28
+ ;;
+} { .mmi
+(p8) stf.spill [r14] = f0 // Line +2 0x100
+(p9) stf.spill [r15] = f0 // Line +3 0x180
+ cmp.ge p10 = r34, r28
+} { .mmi
+ cmp.ge p11 = r34, r30
+ cmp.ge p12 = r34, r27
+ nop.i 0
+ ;;
+} { .mmi
+(p11) stf.spill [r17] = f0 // Line +4 0x200
+(p12) stf.spill [r26] = f0, 0x80 // Line +5 0x280
+ add r31 = 0x10, r32
+ ;;
+}
+
+ .align 32
+Long_FP_loop:
+{ .mmi
+(p10) stf.spill [r26] = f0, 0x80 // Line +6
+ stf.spill [r31] = f0, 0x20
+ cmp.le p15,p12 = 0x40, r34
+} { .mmb
+ add r32 = 0x20, r32
+ add r34 = -0x20, r34
+(p12) br.cond.dpnt Aligned_Short
+ ;;
+} { .mmi
+(p15) stf.spill [r32] = f0, 0x20
+(p15) stf.spill [r31] = f0, 0x20
+ cmp.le p15,p12 = 0x40, r34
+} { .mmb
+ add r21 = -0x60, r34
+ add r34 = -0x20, r34
+(p12) br.cond.dpnt Aligned_Short
+ ;;
+} { .mmi
+(p15) stf.spill [r32] = f0, 0x20
+(p15) stf.spill [r31] = f0, 0x20
+ cmp.le p15,p12 = 0x40, r34
+} { .mmb
+ cmp.ge p10 = r21, r28
+ add r34 = -0x20, r34
+(p12) br.cond.dpnt Aligned_Short
+ ;;
+} { .mmi
+(p15) stf.spill [r32] = f0, 0x20
+(p15) stf.spill [r31] = f0, 0x20
+ cmp.le p15,p12 = 0x40, r34
+} { .mbb
+ add r34 = -0x20, r34
+(p15) br.cond.sptk.many Long_FP_loop
+ br.cond.dpnt.many Aligned_Short
+ ;;
+}
+
+ .align 32
+// >= 48 bytes non-zero fills go through a 8-byte store based loop
+Aligned_Long:
+{ .mmi
+ add r28 = 0x80, r27
+ add r29 = 0x100, r27
+ add r30 = 0x180, r27
+} { .mmi
+ add r14 = 0x80, r32
+ cmp.ge p7 = r34, r27
+ nop.i 0
+ ;;
+} { .mmi
+ add r26 = 0x180, r32
+ cmp.ge p8 = r34, r28
+ add r31 = 8, r32
+} { .mmi
+ st8 [r32] = r25
+(p7) st8 [r14] = r25, 0x80
+ cmp.ge p9 = r34, r29
+ ;;
+} { .mmi
+(p8) st8 [r14] = r25
+(p9) st8 [r26] = r25, 0x80
+ cmp.ge p10 = r34, r30
+ ;;
+}
+ .align 32
+Long_loop:
+{ .mmi
+(p10) st8 [r26] = r25, 0x80
+ st8 [r31] = r25, 0x10
+ cmp.le p15,p12 = 0x20, r34
+} { .mmb
+ add r32 = 0x10, r32
+ add r34 = -0x10, r34
+(p12) br.cond.dpnt Aligned_Short
+ ;;
+} { .mmi
+(p15) st8 [r32] = r25, 0x10
+(p15) st8 [r31] = r25, 0x10
+ cmp.le p15,p12 = 0x20, r34
+} { .mmb
+ nop.m 0
+ add r34 = -0x10, r34
+(p12) br.cond.dpnt Aligned_Short
+ ;;
+} { .mmi
+(p15) st8 [r32] = r25, 0x10
+(p15) st8 [r31] = r25, 0x10
+ cmp.le p15,p12 = 0x20, r34
+} { .mmb
+ nop.m 0
+ add r34 = -0x10, r34
+(p12) br.cond.dpnt Aligned_Short
+ ;;
+} { .mmi
+(p15) st8 [r32] = r25, 0x10
+(p15) st8 [r31] = r25, 0x10
+ cmp.le p15,p12 = 0x20, r34
+} { .mmb
+ nop.m 0
+ add r34 = -0x10, r34
+(p12) br.cond.dpnt Aligned_Short
+ ;;
+} { .mmi
+(p15) st8 [r32] = r25, 0x10
+(p15) st8 [r31] = r25, 0x10
+ cmp.le p15,p12 = 0x20, r34
+} { .mmb
+ nop.m 0
+ add r34 = -0x10, r34
+(p12) br.cond.dpnt Aligned_Short
+ ;;
+} { .mmi
+(p15) st8 [r32] = r25, 0x10
+(p15) st8 [r31] = r25, 0x10
+ cmp.le p15,p12 = 0x20, r34
+} { .mmb
+ add r21 = -0x30, r34
+ add r34 = -0x10, r34
+(p12) br.cond.dpnt Aligned_Short
+ ;;
+} { .mmi
+(p15) st8 [r32] = r25, 0x10
+(p15) st8 [r31] = r25, 0x10
+ cmp.le p15,p12 = 0x20, r34
+} { .mmb
+ cmp.ge p10 = r21, r30
+ add r34 = -0x10, r34
+(p12) br.cond.dpnt Aligned_Short
+ ;;
+} { .mmi
+(p15) st8 [r32] = r25, 0x10
+(p15) st8 [r31] = r25, 0x10
+ cmp.le p15,p12 = 0x20, r34
+} { .mmb
+ add r34 = -0x10, r34
+ nop.m 0
+(p15) br.cond.sptk.many Long_loop
+ ;;
+
+}
+
+//
+// Do partial word stores
+//
+ .align 32
+Aligned_Short:
+{ .mmi
+ and r27 = 2, r34
+ add r31 = 8, r32
+ tbit.nz p6 = r34, 0 //bit 0 on?
+} { .mmb
+ cmp.le p11 = 0x10, r34
+ cmp.eq p10 = 0, r34
+(p10) br.ret.dpnt b0
+ ;;
+} { .mmi
+(p11) st8 [r32] = r25, 0x10
+(p11) st8 [r31] = r25, 0x10
+ cmp.le p12 = 0x20, r34
+} { .mmi
+ add r17 = -2, r16
+ add r18 = -4, r16
+ tbit.nz p9 = r34, 3 //odd number of st8s?
+ ;;
+} { .mmi
+(p12) st8 [r32] = r25, 0x10
+(p12) st8 [r31] = r25, 0x10
+ nop.i 0
+} { .mmi
+(p6) add r18 = -1, r18
+(p6) add r16 = -1, r16
+ cmp.ne p7 = 0, r27
+ ;;
+} { .mmi
+(p9) st8 [r32] = r25
+(p6) st1 [r16] = r25
+ tbit.nz p8 = r34, 2 //bit 2 on?
+} { .mmi
+(p7) add r18 = -2, r18
+(p6) add r17 = -1, r17
+ nop.i 0
+ ;;
+} { .mmb
+(p8) st4 [r18] = r25
+(p7) st2 [r17] = r25
+ br.ret.sptk.many b0
+ ;;
+}
+
+ .align 32
+// Align the input pointer to an 8-byte boundary
+Align_Loop:
+{ .mmi
+ st1 [r32] = r33,1
+ add r21 = 1, r21
+ cmp.eq p15 = 1, r34
+} { .mmb
+ cmp.ge p11 = 0x30, r34
+ add r34 = -1, r34
+(p15) br.ret.dpnt b0
+ ;;
+} { .mmb
+ cmp.gt p10 = 8, r21
+ cmp.eq p6, p7 = 0, r33
+(p10) br.cond.sptk Align_Loop
+ ;;
+} { .mmi
+(p7) mov r27 = 0x88
+(p6) mov r27 = 0x90
+ tbit.nz p14,p13 = r32, 3 // is aligned on 8-bytes (to align on 16 before FP loop)?
+} { .bbb
+(p11) br.cond.dpnt Aligned_Short // blocks < 48 bytes
+(p7) br.cond.dpnt Aligned_Long; // non-zero fills
+ br.cond.dptk Aligned_FP_Long; // zero fills
+ ;;
+}
+ .endp TestCodes#
+
+ .proc Again#
+Again:
+ brl TestCodes
+ brl TestCodes
+ brl TestCodes
+ brl TestCodes
+ brl TestCodes
+ brl TestCodes
+ brl TestCodes
+ brl TestCodes
+ brl TestCodes
+ brl TestCodes
+ brl Fore1
+ brl Fore2
+ brl Fore3
+ brl Fore4
+ brl Fore5
+ brl Fore6
+ brl Fore7
+ .endp Again#
+
+ data4 0xffffff00
+ data4 0xffffffff
+ data4 0xffffffff
+ data4 0xffffffff
+ .align 64
+
+ data4 0xffffff00
+ data4 0xffffffff
+ data4 0xffffffff
+ data4 0xffffffff
+
+{
+ addl r2=0xffffffffffffffff, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0xfffffffffffffff0, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0xffffffffffffff00, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0xfffffffffffff000, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0xfffffffffffff000, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0xffffffffffff0000, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0xfffffffffff00000, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0xffffffffffe00000, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0x00000000001fffff, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0x00000000000fffff, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0x000000000000ffff, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0x0000000000000fff, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0x00000000000000ff, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0x000000000000000f, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0x0000000000000000, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0x0000000000000001, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0x0000000000000002, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0x0000000000000004, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0x0000000000000008, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0x0000000000000010, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0x0000000000000020, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0x0000000000000040, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0x0000000000000080, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0x0000000000000100, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0x0000000000000200, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0x0000000000000400, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0x0000000000000800, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0x0000000000001000, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0x0000000000002000, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0x0000000000004000, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0x0000000000008000, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0x0000000000010000, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0x0000000000020000, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0x0000000000040000, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0x0000000000080000, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0x0000000000100000, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+{
+ addl r2=0xffffffffffe00000, gp ;;
+ ld8 r2=[r2]
+ nop.i 0 ;;
+}
+
+ data4 0
+ .align 64
+
+ .align 64 ;
+ .proc Fore1#
+Fore1:
+ brl Fore2
+ .endp Fore1#
+
+ data4 0
+ .align 64
+
+ .proc Fore2#
+Fore2:
+ brl Fore3
+ .endp Fore2#
+
+ data4 0
+ .align 64
+
+ .proc Fore3#
+Fore3:
+ brl Fore3
+ movl gp = 0xffffffffffffffff
+ brl Fore4
+ movl gp = 0x0000000000000000
+ movl gp = 0x0000000000000001
+ movl gp = 0x0000000000000002
+ movl gp = 0x0000000000000004
+ movl gp = 0x0000000000000008
+ movl gp = 0x0000000000000010
+ movl gp = 0x0000000000000020
+ movl gp = 0x0000000000000040
+ movl gp = 0x0000000000000080
+ movl gp = 0x0000000000000100
+ movl gp = 0x0000000000000200
+ movl gp = 0x0000000000000400
+ movl gp = 0x0000000000000800
+ movl gp = 0x0000000000001000
+ movl gp = 0x0000000000002000
+ movl gp = 0x0000000000004000
+ brl Fore4
+ movl gp = 0x0000000000000000
+ brl Fore4
+ movl gp = 0x0000000000000001
+ brl Fore4
+ movl gp = 0x0000000000000002
+ brl Fore4
+ movl gp = 0x0000000000000004
+ brl Fore4
+ movl gp = 0x0000000000000008
+ brl Fore4
+ movl gp = 0x0000000000000010
+ brl Fore4
+ movl gp = 0x0000000000000020
+ brl Fore4
+ movl gp = 0x0000000000000040
+ brl Fore4
+ movl gp = 0x0000000000000080
+ brl Fore4
+ movl gp = 0x0000000000000100
+ brl Fore4
+ movl gp = 0x0000000000000200
+ brl Fore4
+ movl gp = 0x0000000000000400
+ brl Fore4
+ movl gp = 0x0000000000000800
+ brl Fore4
+ movl gp = 0x0000000000001000
+ brl Fore4
+ movl gp = 0x0000000000002000
+ brl Fore4
+ movl gp = 0x0000000000004000
+ brl Fore4
+ movl gp = 0x0000000000008000
+ brl Fore4
+ movl gp = 0x0000000000010000
+ brl Fore4
+ movl gp = 0x0000000000020000
+ brl Fore4
+ movl gp = 0x0000000000040000
+ brl Fore4
+ movl gp = 0x0000000000080000
+ brl Fore4
+ movl gp = 0x0000000000100000
+ brl Fore4
+ movl gp = 0x0000000000200000
+ brl Fore4
+ movl gp = 0x0000000000400000
+ brl Fore4
+ movl gp = 0x0000000000800000
+ brl Fore4
+ movl gp = 0x0000000001000000
+ brl Fore4
+ movl gp = 0x0000000002000000
+ brl Fore4
+ movl gp = 0x0000000004000000
+ brl Fore4
+ movl gp = 0x0000000008000000
+ brl Fore4
+ movl gp = 0x0000000010000000
+ brl Fore4
+ movl gp = 0x0000000020000000
+ brl Fore4
+ movl gp = 0x0000000040000000
+ brl Fore4
+ movl gp = 0x0000000080000000
+ brl Fore4
+ movl gp = 0x0000000100000000
+ brl Fore4
+ movl gp = 0x0000000200000000
+ brl Fore4
+ movl gp = 0x0000000400000000
+ brl Fore4
+ movl gp = 0x0000000800000000
+ brl Fore4
+ movl gp = 0x0000001000000000
+ brl Fore4
+ movl gp = 0x0000002000000000
+ brl Fore4
+ movl gp = 0x0000004000000000
+ brl Fore4
+ movl gp = 0x0000008000000000
+ brl Fore4
+ movl gp = 0x0000010000000000
+ brl Fore4
+ movl gp = 0x0000020000000000
+ brl Fore4
+ movl gp = 0x0000040000000000
+ brl Fore4
+ movl gp = 0x0000080000000000
+ brl Fore4
+ movl gp = 0x0000100000000000
+ brl Fore4
+ movl gp = 0x0000200000000000
+ brl Fore4
+ movl gp = 0x0000400000000000
+ brl Fore4
+ movl gp = 0x0000800000000000
+ brl Fore4
+ movl gp = 0x0001000000000000
+ brl Fore4
+ movl gp = 0x0002000000000000
+ brl Fore4
+ movl gp = 0x0004000000000000
+ brl Fore4
+ movl gp = 0x0008000000000000
+ brl Fore4
+ movl gp = 0x0010000000000000
+ brl Fore4
+ movl gp = 0x0020000000000000
+ brl Fore4
+ movl gp = 0x0040000000000000
+ brl Fore4
+ movl gp = 0x0080000000000000
+ brl Fore4
+ movl gp = 0x0100000000000000
+ brl Fore4
+ movl gp = 0x0200000000000000
+ brl Fore4
+ movl gp = 0x0400000000000000
+ brl Fore4
+ movl gp = 0x0800000000000000
+ brl Fore4
+ movl gp = 0x1000000000000000
+ brl Fore4
+ movl gp = 0x2000000000000000
+ brl Fore4
+ movl gp = 0x4000000000000000
+ brl Fore4
+ movl gp = 0x8000000000000000
+ brl Fore4
+ movl gp = 0xffffffffffffffff
+ brl Fore4
+ movl gp = 0x0000000000000000
+ brl Fore4
+ movl gp = 0xfffffffffffffffe
+ brl Fore4
+ movl gp = 0xfffffffffffffffc
+ brl Fore4
+ movl gp = 0xfffffffffffffff8
+ brl Fore4
+ movl gp = 0xfffffffffffffff0
+ brl Fore4
+ movl gp = 0xffffffffffffffe0
+ brl Fore4
+ movl gp = 0xffffffffffffffc0
+ brl Fore4
+ movl gp = 0xffffffffffffff80
+ brl Fore4
+ movl gp = 0xffffffffffffff00
+ brl Fore4
+ movl gp = 0xfffffffffffffe00
+ brl Fore4
+ movl gp = 0xfffffffffffffc00
+ brl Fore4
+ movl gp = 0xfffffffffffff800
+ brl Fore4
+ movl gp = 0xfffffffffffff000
+ brl Fore4
+ movl gp = 0xffffffffffffe000
+ brl Fore4
+ movl gp = 0xffffffffffffc000
+ brl Fore4
+ movl gp = 0xffffffffffff8000
+ brl Fore4
+ movl gp = 0xffffffffffff0000
+ brl Fore4
+ movl gp = 0xfffffffffffe0000
+ brl Fore4
+ movl gp = 0xfffffffffffc0000
+ brl Fore4
+ movl gp = 0xfffffffffff80000
+ brl Fore4
+ movl gp = 0xfffffffffff00000
+ brl Fore4
+ movl gp = 0xffffffffffe00000
+ brl Fore4
+ movl gp = 0xffffffffffc00000
+ brl Fore4
+ movl gp = 0xffffffffff800000
+ brl Fore4
+ movl gp = 0xffffffffff000000
+ brl Fore4
+ movl gp = 0xfffffffffe000000
+ brl Fore4
+ movl gp = 0xfffffffffc000000
+ brl Fore4
+ movl gp = 0xfffffffff8000000
+ brl Fore4
+ movl gp = 0xfffffffff0000000
+ brl Fore4
+ movl gp = 0xffffffffe0000000
+ brl Fore4
+ movl gp = 0xffffffffc0000000
+ brl Fore4
+ movl gp = 0xffffffff80000000
+ brl Fore4
+ movl gp = 0xffffffff00000000
+ brl Fore4
+ movl gp = 0xfffffffe00000000
+ brl Fore4
+ movl gp = 0xfffffffc00000000
+ brl Fore4
+ movl gp = 0xfffffff800000000
+ brl Fore4
+ movl gp = 0xfffffff000000000
+ brl Fore4
+ movl gp = 0xffffffe000000000
+ brl Fore4
+ movl gp = 0xffffffc000000000
+ brl Fore4
+ movl gp = 0xffffff8000000000
+ brl Fore4
+ movl gp = 0xffffff0000000000
+ brl Fore4
+ movl gp = 0xfffffe0000000000
+ brl Fore4
+ movl gp = 0xfffffc0000000000
+ brl Fore4
+ movl gp = 0xfffff80000000000
+ brl Fore4
+ movl gp = 0xfffff00000000000
+ brl Fore4
+ movl gp = 0xffffe00000000000
+ brl Fore4
+ movl gp = 0xffffc00000000000
+ brl Fore4
+ movl gp = 0xffff800000000000
+ brl Fore4
+ movl gp = 0xffff000000000000
+ brl Fore4
+ movl gp = 0xfffe000000000000
+ brl Fore4
+ movl gp = 0xfffc000000000000
+ brl Fore4
+ movl gp = 0xfff8000000000000
+ brl Fore4
+ movl gp = 0xfff0000000000000
+ brl Fore4
+ movl gp = 0xffe0000000000000
+ brl Fore4
+ movl gp = 0xffc0000000000000
+ brl Fore4
+ movl gp = 0xff80000000000000
+ brl Fore4
+ movl gp = 0xff00000000000000
+ brl Fore4
+ movl gp = 0xfe00000000000000
+ brl Fore4
+ movl gp = 0xfc00000000000000
+ brl Fore4
+ movl gp = 0xf800000000000000
+ brl Fore4
+ movl gp = 0xf000000000000000
+ brl Fore4
+ movl gp = 0xe000000000000000
+ brl Fore4
+ movl gp = 0xc000000000000000
+ brl Fore4
+ movl gp = 0x8000000000000000
+ brl Fore4
+ movl gp = 0x0000000000000000
+ brl Fore4
+ movl gp = 0x0000000000000000
+ brl Fore4
+ brl.sptk.many Fore4
+ brl.sptk.many Fore4
+ brl.sptk.many Fore4
+ brl.sptk.many Fore4
+
+ movl gp = 0xf0f0f0f0f0f0f0f0
+ brl.sptk.many Fore9
+Fore9:
+ brl.sptk.few Fore8
+Fore8:
+ brl.sptk.few Fore8
+ brl.sptk.few Fore8
+ brl.sptk.few Fore8
+ data1 0x05,0x00,0x00,0x00,0x01,0x00,0xff,0xff,0xff,0xff,0x7f,0x00,0xf0,0xff,0xff,0xc8
+ data1 0x05,0x00,0x00,0x00,0x01,0x00,0xff,0xff,0xff,0xff,0x7f,0x00,0xf0,0xff,0xff,0xc0
+ data1 0x05,0x00,0x00,0x00,0x01,0x00,0xff,0xff,0xff,0xff,0x7f,0x00,0xf0,0xff,0xff,0xc8
+ data1 0x05,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x25,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x45,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x85,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x01,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x02,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x04,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x10,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x20,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x40,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x80,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x02,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x04,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x08,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x10,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x20,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x40,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x80,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x00,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x00,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x00,0x08,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x00,0x10,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x00,0x20,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x00,0x40,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x00,0x00,0x21,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x00,0x00,0x41,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x00,0x00,0x81,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x00,0x00,0x01,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x00,0x00,0x01,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x00,0x00,0x01,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x00,0x00,0x01,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x00,0x00,0x01,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x00,0x00,0x01,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data1 0x05,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0
+ data4 0xffffffff
+ data4 0xffffffff
+ data4 0xffffffff
+ data4 0xffffffff
+ movl gp = 0xf0f0f0f0f0f0f0f0
+
+{ .mii
+ nop.m 0
+ nop.i 0
+ nop.i 0
+}
+{ .mmi
+ nop.m 0
+ nop.m 0
+ nop.i 0
+}
+{ .mmb
+ nop.m 0
+ nop.m 0
+ nop.b 0
+}
+{ .mmf
+ nop.m 0
+ nop.m 0
+ nop.f 0
+}
+{ .mbb
+ nop.m 0
+ nop.b 0
+ nop.b 0
+}
+ movl gp = 0x0000000000000000
+{ .mlx
+ flushrs
+ movl gp = 0x0000000000000000
+}
+ movl gp = 0x0000000000000000
+ .endp Fore3#
+
+ data4 0
+ .align 64
+
+ .proc Fore4#
+Fore4:
+ movl gp = 0x0000000000000000
+ brl Fore5
+ .endp Fore4#
+
+ data4 0
+ .align 64
+
+ data4 0
+ .align 64
+
+ .proc Fore5#
+Fore5:
+ movl gp = 0xffffffffffffffff
+ brl Fore6
+ .endp Fore5#
+
+ data4 0
+ .align 64
+
+ .proc Fore6#
+Fore6:
+ movl gp = 0x0000000000000000
+ brl Fore7
+ .endp Fore6#
+
+ data4 0
+ .align 64
+
+ .proc Fore7#
+Fore7:
+ movl gp = 0xffffffffffffffff
+ brl Fore6
+ brl.call.dptk.many b0=Fore6
+ br.call.dptk.many b0=Fore6
+ br.ret.dpnt.many b0
+ br.ret.dptk.many b0
+ br.ret.spnt.many b0
+ br.ret.sptk.many b0
+ .endp Fore7#
+
+ data4 0
+ .align 64
+
+ .proc Call8#
+Call8:
+{
+ alloc r41=ar.pfs, 10, 0, 8, 0
+ adds r49=0, r39
+ mov r40=rp
+}
+{
+ adds r48=0, r38
+ adds r47=0, r37
+ adds r46=0, r36 ;;
+}
+{
+ adds r45=0, r35
+ adds r44=0, r34
+ adds r43=0, r33
+}
+{
+ movl gp = 0xffffffffffffffff ;;
+}
+{
+ adds r42=0, r32
+ brl.call.sptk.few rp=Call8Real ;;
+}
+Call8Real:
+{
+ movl gp = 0xffffffffffffffff ;;
+}
+{
+ nop.m 0
+ mov rp=r40, +0 ;;
+ mov.i ar.pfs=r41
+}
+{
+ nop.m 0
+ nop.m 0
+ br.ret.sptk.many rp ;;
+}
+ .endp Call8#
+
+ data4 0
+ .align 64
+
+ .proc Pass8#
+Pass8:
+{
+ alloc r41=ar.pfs, 11, 0, 8, 0
+ mov r40=rp
+}
+{
+ adds r50=0, r39
+ adds r49=0, r38
+ adds r48=0, r37 ;;
+}
+{
+ adds r47=0, r36
+ adds r46=0, r35
+ adds r45=0, r34
+}
+{
+ adds r44=0, r33
+ adds r43=0, r32
+ adds r42=0, gp ;;
+}
+{
+ movl gp = 0xffffffffffffffff ;;
+}
+{
+ brl.call.sptk.few rp=Pass8Real ;;
+}
+Pass8Real:
+{
+ adds gp=0, r42
+ mov rp=r40, +0 ;;
+ mov.i ar.pfs=r41
+}
+{
+ nop.m 0
+ nop.m 0
+ br.ret.sptk.many rp ;;
+}
+ .endp Pass8#
+
+ data4 0
+ .align 64
+
+ .proc Last#
+Last:
+ data4 0xffffffff
+ data4 0xffffffff
+ data4 0xffffffff
+ data4 0xffffffff
+ .skip 0x1000
+ data4 0xffffffff
+ data4 0xffffffff
+ data4 0xffffffff
+ data4 0xffffffff
+ .endp Last#
+
+// End
diff --git a/ext/detours/samples/disas/unk.cpp b/ext/detours/samples/disas/unk.cpp
new file mode 100644
index 0000000..ff9bfe6
--- /dev/null
+++ b/ext/detours/samples/disas/unk.cpp
@@ -0,0 +1,15 @@
+/////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (x86.asm of disas.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+static int value = 0;
+
+extern "C" void TestCodes()
+{
+ value++;
+}
diff --git a/ext/detours/samples/disas/x64.asm b/ext/detours/samples/disas/x64.asm
new file mode 100644
index 0000000..a60d4dc
--- /dev/null
+++ b/ext/detours/samples/disas/x64.asm
@@ -0,0 +1,520 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Detours Test Program (x64.asm/disas.exe)
+;;
+;; Microsoft Research Detours Package
+;;
+;; Copyright (c) Microsoft Corporation. All rights reserved.
+;;
+
+.xlist
+.list
+.code
+
+PUBLIC TestCodes
+
+_TEXT SEGMENT
+
+TestCodes PROC
+
+begin:
+faraway:
+ int 3
+ nop
+ int 3
+ db 066h,090h ; // 2-byte NOP.
+ int 3
+ db 00fh, 01fh, 000h ; // 3-byte NOP.
+ int 3
+ db 00fh, 01fh, 040h, 000h ; // 4-byte NOP.
+ int 3
+ db 00fh, 01fh, 044h, 000h, 000h ; // 5-byte NOP.
+ int 3
+ db 066h, 00fh, 01fh, 044h, 000h, 000h ; // 6-byte NOP.
+ int 3
+ db 00fh, 01fh, 080h, 000h, 000h, 000h, 000h ; // 7-byte NOP.
+ int 3
+ db 00fh, 01fh, 084h, 000h, 000h, 000h, 000h, 000h ; // 8-byte NOP.
+ int 3
+ db 066h, 00fh, 01fh, 084h, 000h, 000h, 000h, 000h, 000h ; // 9-byte NOP.
+ int 3
+ mov rax, cr8
+ int 3
+ mov rcx, cr8
+ int 3
+ mov rdx, cr8
+ int 3
+ mov rbx, cr8
+ int 3
+ mov rsp, cr8
+ int 3
+ mov rbp, cr8
+ int 3
+ mov rsi, cr8
+ int 3
+ mov rdi, cr8
+ int 3
+ mov r8, cr8
+ int 3
+ mov r9, cr8
+ int 3
+ mov r10, cr8
+ int 3
+ mov r11, cr8
+ int 3
+ mov r12, cr8
+ int 3
+ mov r13, cr8
+ int 3
+ mov r14, cr8
+ int 3
+ mov r15, cr8
+ int 3
+ mov cr8, rax
+ int 3
+ mov cr8, rcx
+ int 3
+ mov cr8, rdx
+ int 3
+ mov cr8, rbx
+ int 3
+ mov cr8, rsp
+ int 3
+ mov cr8, rbp
+ int 3
+ mov cr8, rsi
+ int 3
+ mov cr8, rdi
+ int 3
+ mov cr8, r8
+ int 3
+ mov cr8, r9
+ int 3
+ mov cr8, r10
+ int 3
+ mov cr8, r11
+ int 3
+ mov cr8, r12
+ int 3
+ mov cr8, r13
+ int 3
+ mov cr8, r14
+ int 3
+ mov cr8, r15
+ int 3
+ xor rax, rax
+ int 3
+ xor rcx, rcx
+ int 3
+ xor rdx, rdx
+ int 3
+ xor rbx, rbx
+ int 3
+ xor rsp, rsp
+ int 3
+ xor rbp, rbp
+ int 3
+ xor rsi, rsi
+ int 3
+ xor rdi, rdi
+ int 3
+ xor r8, r8
+ int 3
+ xor r9, r9
+ int 3
+ xor r10, r10
+ int 3
+ xor r11, r11
+ int 3
+ xor r12, r12
+ int 3
+ xor r13, r13
+ int 3
+ xor r14, r14
+ int 3
+ xor r15, r15
+ int 3
+ jmp rax
+ int 3
+ jmp rbx
+ int 3
+ jmp rcx
+ int 3
+ jmp rdx
+ int 3
+ push rax
+ int 3
+ push rbx
+ int 3
+ push rcx
+ int 3
+ push rdx
+ int 3
+ push 0
+ int 3
+ pop rax
+ int 3
+ pop rbx
+ int 3
+ pop rcx
+ int 3
+ pop rdx
+ int 3
+ mov rax,[value]
+ int 3
+ sub rsp,0418h
+ int 3
+ mov [rsp+0410h],rbx
+ int 3
+ mov [rsp+0408h],rsi
+ int 3
+ mov [rsp+0400h],rdi
+ int 3
+ mov [rsp+03f8h],r12
+ int 3
+ mov [rsp+03f0h],r13
+ int 3
+ mov [rsp+03e8h],r14
+ int 3
+ mov [rsp+03e0h],r15
+ int 3
+ add [rax],al ; 0000
+ int 3
+ add [rcx],al ; 0001
+ int 3
+ add [rbx],al ; 0003
+ int 3
+ add [rax+rax],al ; 000400
+ int 3
+ add [rdi],al ; 0007
+ int 3
+ add [rax],cl ; 0008
+ int 3
+ add [rdi],cl ; 000f
+ int 3
+ add [rax],dl ; 0010
+ int 3
+ add [rdi],bl ; 001f
+ int 3
+ add [rax],ah ; 0020
+ int 3
+ add [rdi],bh ; 003f
+ int 3
+ add [rax+03bh],cl ; 00483b
+ int 3
+ add [rdi],bh ; 007f00
+ int 3
+ add [rax+040000000h],al ; 008000000040
+ int 3
+ add bh,bh ; 00ff
+ int 3
+ add [rax],eax ; 0100
+ int 3
+ add al,[rax] ; 0200
+ int 3
+ add eax,06603ebc3h ; 05c3eb0366
+ int 3
+ syscall ; 0f05
+ int 3
+ prefetchw byte ptr [rcx] ; 0f0d09
+ int 3
+ prefetchnta byte ptr [rcx] ; 0f1801
+ int 3
+ prefetchnta byte ptr [rax+rdx] ; 0f180410
+ int 3
+ jb again ; 0f8247070000
+ int 3
+ jnb again ; 0f8306050000
+ int 3
+ je again ; 0f8432010000
+ int 3
+ jne again ; 0f8508010000
+ int 3
+ jnbe again ; 0f878a000000
+ int 3
+ ldmxcsr dword ptr [rcx+034h] ; 0fae5134
+ int 3
+ stmxcsr dword ptr [rcx+034h] ; 0fae5934
+ int 3
+ and ecx,[rdx+rbx*4] ; 230c9a
+ int 3
+ xor eax,eax ; 33c0
+ int 3
+ xor ecx,ecx ; 33c9
+ int 3
+ xor edx,ecx ; 33d1
+ int 3
+ xor edx,edx ; 33d2
+ int 3
+ add r10d,010001h ; 4181c201000100
+ int 3
+ and r11d,0ffffh ; 4181e3ffff0000
+ int 3
+ mov eax,r8d ; 418bc0
+ int 3
+ mov byte ptr [r11],00h ; 41c60300
+ int 3
+ call qword ptr [r9+030h] ; 41ff5130
+ int 3
+ call qword ptr [r9+r8*8] ; 43ff14c1
+ int 3
+ mov [rcx+034h],r8d ; 44894134
+ int 3
+ mov [rsp+030h],r9d ; 44894c2430
+ int 3
+ mov r8d,[rcx] ; 448b01
+ int 3
+ mov r9d,[rcx] ; 448b09
+ int 3
+ mov r8d,[rax+058h] ; 448b4058
+ int 3
+ mov r8d,[rsp+02ch] ; 448b44242c
+ int 3
+ mov r8d,eax ; 448bc0
+ int 3
+ mov r8d,edx ; 448bc2
+ int 3
+ xor r8b,r8b ; 4532c0
+ int 3
+ mov r9d,r8d ; 458bc8
+ int 3
+ lea r11d,[r9+rax] ; 458d1c01
+ int 3
+ add rdx,rcx ; 4803d1
+ int 3
+ or rsi,rdx ; 480bf2
+ int 3
+ movnti [rcx],rax ; 480fc301
+ int 3
+ and rax,0fe000000h ; 4825000000fe
+ int 3
+ sub rax,rcx ; 482bc1
+ int 3
+ sub rdx,rcx ; 482bd1
+ int 3
+ cmp rdi,rbp ; 483bfd
+ int 3
+ push rbp ; 4855
+ int 3
+ add rcx,03d0h ; 4881c1d0030000
+ int 3
+ add rsp,0c8h ; 4881c4c8000000
+ int 3
+ and rdx,0fe000000h ; 4881e2000000fe
+ int 3
+ sub rsp,0c8h ; 4881ecc8000000
+ int 3
+ sub rsp,03d0h ; 4881ecd0030000
+ int 3
+ add rax,040h ; 4883c040
+ int 3
+ add rcx,08h ; 4883c108
+ int 3
+ add rcx,040h ; 4883c140
+ int 3
+ add rsp,08h ; 4883c408
+ int 3
+ add rsi,09h ; 4883c609
+ int 3
+ add rdi,01h ; 4883c701
+ int 3
+ and rcx,0f8h ; 4883e1f8
+ int 3
+ sub rax,040h ; 4883e840
+ int 3
+ sub rdx,08h ; 4883ea08
+ int 3
+ sub rdx,040h ; 4883ea40
+ int 3
+ sub rsp,08h ; 4883ec08
+ int 3
+ sub rsi,08h ; 4883ee08
+ int 3
+ sub rdi,01h ; 4883ef01
+ int 3
+ test rax,rax ; 4885c0
+ int 3
+ test rdx,rdx ; 4885d2
+ int 3
+ mov [rsp],rax ; 48890424
+ int 3
+ mov [rsp],rbp ; 48892c24
+ int 3
+ mov [rsp],rsi ; 48893424
+ int 3
+ mov [rsp],rdi ; 48893c24
+ int 3
+ mov [rcx+08h],rax ; 48894108
+ int 3
+ mov [rcx+078h],rax ; 48894178
+ int 3
+ mov [rcx-08h],rax ; 488941f8
+ int 3
+ mov [rsp+018h],rax ; 4889442418
+ int 3
+ mov [rcx+010h],rdx ; 48895110
+ int 3
+ mov [rsp+08h],rbx ; 48895c2408
+ int 3
+ mov [rsp+018h],rsi ; 4889742418
+ int 3
+ mov [rsp+08h],rdi ; 48897c2408
+ int 3
+ mov [rsp+010h],rdi ; 48897c2410
+ int 3
+ mov [rcx+098h],rax ; 48898198000000
+ int 3
+ mov [rcx+080h],rcx ; 48898980000000
+ int 3
+ mov [rcx+088h],rdx ; 48899188000000
+ int 3
+ mov [rcx+090h],rbx ; 48899990000000
+ int 3
+ mov [rcx+0a0h],rbp ; 4889a9a0000000
+ int 3
+ mov [rcx+0a8h],rsi ; 4889b1a8000000
+ int 3
+ mov [rcx+0b0h],rdi ; 4889b9b0000000
+ int 3
+ mov rax,[rcx] ; 488b01
+ int 3
+ mov rax,[rcx+rdx] ; 488b0411
+ int 3
+ mov rax,[value] ; 488b05318c0100
+ int 3
+ mov rcx,[rsp] ; 488b0c24
+ int 3
+ mov rsi,[rsp] ; 488b3424
+ int 3
+ mov rdi,[rsp] ; 488b3c24
+ int 3
+ mov rax,[rax+018h] ; 488b4018
+ int 3
+ mov rax,[rcx+078h] ; 488b4178
+ int 3
+ mov rax,[rdx+020h] ; 488b4220
+ int 3
+ mov rax,[rsp+08h] ; 488b442408
+ int 3
+ mov rcx,[rcx+08h] ; 488b4908
+ int 3
+ mov rcx,[rsp+020h] ; 488b4c2420
+ int 3
+ mov rdx,[rsp+08h] ; 488b542408
+ int 3
+ mov rdi,[rsp+08h] ; 488b7c2408
+ int 3
+ mov rax,[rcx+098h] ; 488b8198000000
+ int 3
+ mov rax,[rcx+0f8h] ; 488b81f8000000
+ int 3
+ cmp ebx,0 ;
+ int 3
+ cmp rbx,0 ;
+ int 3
+ cmp byte ptr [value],77h ; 803d........77
+ int 3
+ cmp dword ptr [value],77h ; 833d........77
+ int 3
+ cmp qword ptr [value],77h ; 48833d........77
+ int 3
+ cmp dword ptr [value],77777777h ; 813d........77777777
+ int 3
+ cmp qword ptr [value],77777777h ; 48813d........77777777
+ int 3
+nearby:
+ jo nearby ; 70xx
+ int 3
+ jno nearby ; 71xx
+ int 3
+ jb nearby ; 72xx
+ int 3
+ jae nearby ; 73xx
+ int 3
+ je nearby ; 74xx
+ int 3
+ jne nearby ; 75xx
+ int 3
+ jbe nearby ; 76xx
+ int 3
+ ja nearby ; 77xx
+ int 3
+ js nearby ; 78xx
+ int 3
+ jns nearby ; 79xx
+ int 3
+ jp nearby ; 7axx
+ int 3
+ jnp nearby ; 7bxx
+ int 3
+ jl nearby ; 7cxx
+ int 3
+ jge nearby ; 7dxx
+ int 3
+ jle nearby ; 7exx
+ int 3
+ jg nearby ; 7fxx
+ int 3
+ jmp nearby ; ebxx
+
+ int 3
+ jo faraway ; 0f80xxxxxxxx
+ int 3
+ jno faraway ; 0f81xxxxxxxx
+ int 3
+ jb faraway ; 0f82xxxxxxxx
+ int 3
+ jae faraway ; 0f83xxxxxxxx
+ int 3
+ je faraway ; 0f84xxxxxxxx
+ int 3
+ jne faraway ; 0f85xxxxxxxx
+ int 3
+ jbe faraway ; 0f86xxxxxxxx
+ int 3
+ ja faraway ; 0f87xxxxxxxx
+ int 3
+ js faraway ; 0f88xxxxxxxx
+ int 3
+ jns faraway ; 0f89xxxxxxxx
+ int 3
+ jp faraway ; 0f8axxxxxxxx
+ int 3
+ jnp faraway ; 0f8bxxxxxxxx
+ int 3
+ jl faraway ; 0f8cxxxxxxxx
+ int 3
+ jge faraway ; 0f8dxxxxxxxx
+ int 3
+ jle faraway ; 0f8exxxxxxxx
+ int 3
+ jg faraway ; 0f8fxxxxxxxx
+ int 3
+ jmp faraway ; e9xxxxxxxx
+
+ int 3
+ lea rax,[rsp] ; 488d0424
+ int 3
+ mov rcx,0BADC0DEBA5Eh ; 48b95ebadec0ad0b0000
+ int 3
+ cmp rax,rcx ; 483bc1
+
+ int 3
+ sub rsp, 28h
+ int 3
+ add rsp,28h
+ int 3
+ ret
+ int 3
+
+
+;; The list is terminated by two "int 3" in a row.
+again:
+ int 3
+ int 3
+TestCodes ENDP
+
+value QWORD 0
+
+_TEXT ENDS
+END
diff --git a/ext/detours/samples/disas/x86.cpp b/ext/detours/samples/disas/x86.cpp
new file mode 100644
index 0000000..ac39de7
--- /dev/null
+++ b/ext/detours/samples/disas/x86.cpp
@@ -0,0 +1,184 @@
+/////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (x86.asm of disas.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+static int value = 0;
+
+extern "C" void __declspec(naked) TestCodes()
+{
+ __asm {
+// Each instruction is proceeded by an "int 3".
+ faraway:
+ int 3;
+ nop; // 1-byte NOP.
+ int 3;
+ _emit 0x66; // 2-byte NOP.
+ _emit 0x90;
+ int 3;
+ _emit 0x0f; // 3-byte NOP.
+ _emit 0x1f;
+ _emit 0x00;
+ int 3;
+ _emit 0x0f; // 4-byte NOP.
+ _emit 0x1f;
+ _emit 0x40;
+ _emit 0x00;
+ int 3;
+ _emit 0x0f; // 5-byte NOP.
+ _emit 0x1f;
+ _emit 0x44;
+ _emit 0x00;
+ _emit 0x00;
+ int 3;
+ _emit 0x66; // 6-byte NOP.
+ _emit 0x0f;
+ _emit 0x1f;
+ _emit 0x44;
+ _emit 0x00;
+ _emit 0x00;
+ int 3;
+ _emit 0x0f; // 7-byte NOP.
+ _emit 0x1f;
+ _emit 0x80;
+ _emit 0x00;
+ _emit 0x00;
+ _emit 0x00;
+ _emit 0x00;
+ int 3;
+ _emit 0x0f; // 8-byte NOP.
+ _emit 0x1f;
+ _emit 0x84;
+ _emit 0x00;
+ _emit 0x00;
+ _emit 0x00;
+ _emit 0x00;
+ _emit 0x00;
+ int 3;
+ _emit 0x66; // 9-byte NOP.
+ _emit 0x0f;
+ _emit 0x1f;
+ _emit 0x84;
+ _emit 0x00;
+ _emit 0x00;
+ _emit 0x00;
+ _emit 0x00;
+ _emit 0x00;
+ int 3;
+ mov ecx, eax;
+ int 3;
+ mov ebx, 0ffff000eh;
+ int 3;
+ call ebx;
+ int 3;
+ call dword ptr [eax];
+ int 3;
+ call dword ptr [ebx];
+ int 3;
+ call dword ptr [ecx];
+ int 3;
+ call dword ptr [edx];
+ int 3;
+ jmp dword ptr [eax];
+ int 3;
+ jmp dword ptr [ebx];
+ int 3;
+ jmp dword ptr [ecx];
+ int 3;
+ jmp dword ptr [edx];
+ int 3;
+ call ecx;
+ int 3;
+ call eax;
+ int 3;
+ mov ebx, 0ffff000eh;
+ int 3;
+ push eax;
+ int 3;
+ call ebx;
+ int 3;
+ cmp ebx, 0;
+ int 3;
+ cmp byte ptr [value], 77h;
+ int 3;
+ cmp dword ptr [value], 77h;
+ int 3;
+ cmp dword ptr [value], 77777777h;
+ nearby:
+ int 3
+ jo nearby ; 70xx
+ int 3
+ jno nearby ; 71xx
+ int 3
+ jb nearby ; 72xx
+ int 3
+ jae nearby ; 73xx
+ int 3
+ je nearby ; 74xx
+ int 3
+ jne nearby ; 75xx
+ int 3
+ jbe nearby ; 76xx
+ int 3
+ ja nearby ; 77xx
+ int 3
+ js nearby ; 78xx
+ int 3
+ jns nearby ; 79xx
+ int 3
+ jp nearby ; 7axx
+ int 3
+ jnp nearby ; 7bxx
+ int 3
+ jl nearby ; 7cxx
+ int 3
+ jge nearby ; 7dxx
+ int 3
+ jle nearby ; 7exx
+ int 3
+ jg nearby ; 7fxx
+
+ int 3
+ jo faraway ; 0f80xx
+ int 3
+ jno faraway ; 0f81xx
+ int 3
+ jb faraway ; 0f82xx
+ int 3
+ jae faraway ; 0f83xx
+ int 3
+ je faraway ; 0f84xx
+ int 3
+ jne faraway ; 0f85xx
+ int 3
+ jbe faraway ; 0f86xx
+ int 3
+ ja faraway ; 0f87xx
+ int 3
+ js faraway ; 0f88xx
+ int 3
+ jns faraway ; 0f89xx
+ int 3
+ jp faraway ; 0f8axx
+ int 3
+ jnp faraway ; 0f8bxx
+ int 3
+ jl faraway ; 0f8cxx
+ int 3
+ jge faraway ; 0f8dxx
+ int 3
+ jle faraway ; 0f8exx
+ int 3
+ jg faraway ; 0f8fxx
+
+// The list is terminated by two "int 3" in a row.
+ int 3;
+ int 3;
+ ret;
+ }
+}
+
diff --git a/ext/detours/samples/dtest/Makefile b/ext/detours/samples/dtest/Makefile
new file mode 100644
index 0000000..1179c19
--- /dev/null
+++ b/ext/detours/samples/dtest/Makefile
@@ -0,0 +1,107 @@
+##############################################################################
+##
+## Makefile for Detours Test Programs.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+LIBS=$(LIBS) kernel32.lib
+
+all: dirs \
+ $(BIND)\dtarge$(DETOURS_BITS).dll \
+ $(BIND)\dtest.exe \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\dtarge$(DETOURS_BITS).bsc \
+ $(OBJD)\dtest.bsc \
+!ENDIF
+ option
+
+clean:
+ -del *~ *.obj *.sbr 2> nul
+ -del $(BIND)\dtest.* $(BIND)\dtarge*.* 2> nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+$(OBJD)\dtarge.obj : dtarge.cpp
+
+$(OBJD)\dtarge.res : dtarge.rc
+
+$(BIND)\dtarge$(DETOURS_BITS).dll $(BIND)\dtarge$(DETOURS_BITS).lib: \
+ $(OBJD)\dtarge.obj $(OBJD)\dtarge.res $(DEPS)
+ cl /LD $(CFLAGS) \
+ /Fe$(@R).dll \
+ /Fd$(@R).pdb \
+ $(OBJD)\dtarge.obj $(OBJD)\dtarge.res \
+ /link $(LINKFLAGS) /subsystem:console \
+ /export:Target0 \
+ /export:Target1 \
+ /export:Target2 \
+ /export:Target3 \
+ /export:Target4 \
+ /export:Target5 \
+ /export:Target6 \
+ /export:Target7 \
+ /export:Target8 \
+ /export:Target9 \
+ /export:Target10 \
+ /export:Target11 \
+ /export:Target12 \
+ /export:Target13 \
+ /export:Target14 \
+ /export:Target15 \
+ /export:Target16 \
+ /export:TargetV \
+ /export:TargetR \
+ $(LIBS)
+
+$(OBJD)\dtarge$(DETOURS_BITS).bsc : $(OBJD)\dtarge.obj
+ bscmake /v /n /o $@ $(OBJD)\dtarge.sbr
+
+$(OBJD)\dtest.obj : dtest.cpp
+
+$(BIND)\dtest.exe : $(OBJD)\dtest.obj $(BIND)\dtarge$(DETOURS_BITS).lib $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb $(OBJD)\dtest.obj \
+ /link $(LINKFLAGS) $(LIBS) $(BIND)\dtarge$(DETOURS_BITS).lib \
+ /subsystem:console /entry:WinMainCRTStartup
+
+$(OBJD)\dtest.bsc : $(OBJD)\dtest.obj
+ bscmake /v /n /o $@ $(OBJD)\dtest.sbr
+
+############################################### Install non-bit-size binaries.
+
+!IF "$(DETOURS_OPTION_PROCESSOR)" != ""
+
+$(OPTD)\dtarge$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\dtarge$(DETOURS_OPTION_BITS).pdb:
+
+$(BIND)\dtarge$(DETOURS_OPTION_BITS).dll : $(OPTD)\dtarge$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\dtarge$(DETOURS_OPTION_BITS).pdb : $(OPTD)\dtarge$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+
+option: \
+ $(BIND)\dtarge$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\dtarge$(DETOURS_OPTION_BITS).pdb \
+
+!ELSE
+
+option:
+
+!ENDIF
+
+##############################################################################
+
+test: all
+ $(BIND)\dtest.exe
+
+################################################################# End of File.
diff --git a/ext/detours/samples/dtest/NORMAL_IA64.TXT b/ext/detours/samples/dtest/NORMAL_IA64.TXT
new file mode 100644
index 0000000..f87afa5
--- /dev/null
+++ b/ext/detours/samples/dtest/NORMAL_IA64.TXT
@@ -0,0 +1,116 @@
+ ..\..\bin.IA64\dtest.exe
+Calling LocalTarget1 w/o detour
+ LocalTarget1 (1)
+Calling LocalTarget1 w/ detour
+ MyLocalTarget1 (2)
+ LocalTarget1 (2)
+Calling Target0 function.
+ MyTarget0 ()
+Calling TargetN functions.
+ MyLocalTarget1 (1)
+ LocalTarget1 (1)
+ MyTarget0 ()
+ MyTarget1 (1)
+ MyTarget2 (1,2)
+ MyTarget3 (1,2,3)
+ MyTarget4 (1,2,3,4)
+ MyTarget5 (1,2,3,4,5)
+ MyTarget6 (1,2,3,4,5,6)
+ MyTarget7 (1,2,3,4,5,6,7)
+ MyTarget8 (1,2,3,4,5,6,7,8)
+ MyTarget9 (1,2,3,4,5,6,7,8,9)
+ MyTarget10(1,2,3,4,5,6,7,8,9,10)
+ MyTarget11(1,2,3,4,5,6,7,8,9,10,11)
+ MyTarget12(1,2,3,4,5,6,7,8,9,10,11,12)
+ MyTarget13(1,2,3,4,5,6,7,8,9,10,11,12,13)
+ MyTarget14(1,2,3,4,5,6,7,8,9,10,11,12,13,14)
+ MyTarget15(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)
+ MyTarget16(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
+ MyTargetV (0)
+ MyTargetV (0,1)
+ MyTargetV (0,1,2)
+ MyTargetV (0,1,2,3)
+ MyTargetV (0,1,2,3,4)
+ MyTargetV (0,1,2,3,4,5)
+ MyTargetV (0,1,2,3,4,5,6)
+ MyTargetV (0,1,2,3,4,5,6,7)
+ MyTargetV (0,1,2,3,4,5,6,7,8)
+ MyTargetV (0,1,2,3,4,5,6,7,8,9)
+ MyTargetV (0,1,2,3,4,5,6,7,8,9,10)
+ MyTargetV (0,1,2,3,4,5,6,7,8,9,10,11)
+ MyTargetV (0,1,2,3,4,5,6,7,8,9,10,11,12)
+ MyTargetV (0,1,2,3,4,5,6,7,8,9,10,11,12,13)
+ MyTargetV (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14)
+ MyTargetV (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)
+ MyTargetV (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
+ MyTargetR (0,1,2,3,4)
+ MyTargetR (0,1,2,3,3)
+ MyTargetR (0,1,2,3,2)
+ MyTargetR (0,1,2,3,1)
+.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... MyTargetR (0,1,2,3,4,5,6,7,8,9,10,4)
+ MyTargetR (0,1,2,3,4,5,6,7,8,9,10,3)
+ MyTargetR (0,1,2,3,4,5,6,7,8,9,10,2)
+ MyTargetR (0,1,2,3,4,5,6,7,8,9,10,1)
+ => 3011
+Calling Target0 again with 1 detour.
+ MyTarget0 ()
+Calling Target0 again with 2 detours.
+ Starting Target0_1.
+ MyTarget0 ()
+ End Target0_1.
+Calling Target0 again with 3 detours.
+ Starting Target0_2.
+ Starting Target0_1.
+ MyTarget0 ()
+ End Target0_1.
+ End Target0_2.
+Calling Target0 again with 4 detours.
+ Starting Target0_3.
+ Starting Target0_2.
+ Starting Target0_1.
+ MyTarget0 ()
+ End Target0_1.
+ End Target0_2.
+ End Target0_3.
+Done.
+ Target0 ()
+ Target0 ()
+ Target1 (1)
+ Target2 (1,2)
+ Target3 (1,2,3)
+ Target4 (1,2,3,4)
+ Target5 (1,2,3,4,5)
+ Target6 (1,2,3,4,5,6)
+ Target7 (1,2,3,4,5,6,7)
+ Target8 (1,2,3,4,5,6,7,8)
+ Target9 (1,2,3,4,5,6,7,8,9)
+ Target10(1,2,3,4,5,6,7,8,9,10)
+ Target11(1,2,3,4,5,6,7,8,9,10,11)
+ Target12(1,2,3,4,5,6,7,8,9,10,11,12)
+ Target13(1,2,3,4,5,6,7,8,9,10,11,12,13)
+ Target14(1,2,3,4,5,6,7,8,9,10,11,12,13,14)
+ Target15(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)
+ Target16(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
+ TargetV (0)
+ TargetV (0,1)
+ TargetV (0,1,2)
+ TargetV (0,1,2,3)
+ TargetV (0,1,2,3,4)
+ TargetV (0,1,2,3,4,5)
+ TargetV (0,1,2,3,4,5,6)
+ TargetV (0,1,2,3,4,5,6,7)
+ TargetV (0,1,2,3,4,5,6,7,8)
+ TargetV (0,1,2,3,4,5,6,7,8,9)
+ TargetV (0,1,2,3,4,5,6,7,8,9,10)
+ TargetV (0,1,2,3,4,5,6,7,8,9,10,11)
+ TargetV (0,1,2,3,4,5,6,7,8,9,10,11,12)
+ TargetV (0,1,2,3,4,5,6,7,8,9,10,11,12,13)
+ TargetV (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14)
+ TargetV (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)
+ TargetV (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
+::: TargetR (0,1,2,3,1)
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: TargetR (0,1,2,3,4,5,6,7,8,9,10,1)
+ Target0 ()
+ Target0 ()
+ Target0 ()
+ Target0 ()
diff --git a/ext/detours/samples/dtest/NORMAL_X64.TXT b/ext/detours/samples/dtest/NORMAL_X64.TXT
new file mode 100644
index 0000000..9758c03
--- /dev/null
+++ b/ext/detours/samples/dtest/NORMAL_X64.TXT
@@ -0,0 +1,116 @@
+ ..\..\bin.X64\dtest.exe
+Calling LocalTarget1 w/o detour
+ LocalTarget1 (1)
+Calling LocalTarget1 w/ detour
+ MyLocalTarget1 (2)
+ LocalTarget1 (2)
+Calling Target0 function.
+ MyTarget0 ()
+Calling TargetN functions.
+ MyLocalTarget1 (1)
+ LocalTarget1 (1)
+ MyTarget0 ()
+ MyTarget1 (1)
+ MyTarget2 (1,2)
+ MyTarget3 (1,2,3)
+ MyTarget4 (1,2,3,4)
+ MyTarget5 (1,2,3,4,5)
+ MyTarget6 (1,2,3,4,5,6)
+ MyTarget7 (1,2,3,4,5,6,7)
+ MyTarget8 (1,2,3,4,5,6,7,8)
+ MyTarget9 (1,2,3,4,5,6,7,8,9)
+ MyTarget10(1,2,3,4,5,6,7,8,9,10)
+ MyTarget11(1,2,3,4,5,6,7,8,9,10,11)
+ MyTarget12(1,2,3,4,5,6,7,8,9,10,11,12)
+ MyTarget13(1,2,3,4,5,6,7,8,9,10,11,12,13)
+ MyTarget14(1,2,3,4,5,6,7,8,9,10,11,12,13,14)
+ MyTarget15(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)
+ MyTarget16(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
+ MyTargetV (0)
+ MyTargetV (0,1)
+ MyTargetV (0,1,2)
+ MyTargetV (0,1,2,3)
+ MyTargetV (0,1,2,3,4)
+ MyTargetV (0,1,2,3,4,5)
+ MyTargetV (0,1,2,3,4,5,6)
+ MyTargetV (0,1,2,3,4,5,6,7)
+ MyTargetV (0,1,2,3,4,5,6,7,8)
+ MyTargetV (0,1,2,3,4,5,6,7,8,9)
+ MyTargetV (0,1,2,3,4,5,6,7,8,9,10)
+ MyTargetV (0,1,2,3,4,5,6,7,8,9,10,11)
+ MyTargetV (0,1,2,3,4,5,6,7,8,9,10,11,12)
+ MyTargetV (0,1,2,3,4,5,6,7,8,9,10,11,12,13)
+ MyTargetV (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14)
+ MyTargetV (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)
+ MyTargetV (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
+ MyTargetR (0,1,2,3,4)
+ MyTargetR (0,1,2,3,3)
+ MyTargetR (0,1,2,3,2)
+ MyTargetR (0,1,2,3,1)
+.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... MyTargetR (0,1,2,3,4,5,6,7,8,9,10,4)
+ MyTargetR (0,1,2,3,4,5,6,7,8,9,10,3)
+ MyTargetR (0,1,2,3,4,5,6,7,8,9,10,2)
+ MyTargetR (0,1,2,3,4,5,6,7,8,9,10,1)
+ => 3011
+Calling Target0 again with 1 detour.
+ MyTarget0 ()
+Calling Target0 again with 2 detours.
+ Starting Target0_1.
+ MyTarget0 ()
+ End Target0_1.
+Calling Target0 again with 3 detours.
+ Starting Target0_2.
+ Starting Target0_1.
+ MyTarget0 ()
+ End Target0_1.
+ End Target0_2.
+Calling Target0 again with 4 detours.
+ Starting Target0_3.
+ Starting Target0_2.
+ Starting Target0_1.
+ MyTarget0 ()
+ End Target0_1.
+ End Target0_2.
+ End Target0_3.
+Done.
+ Target0 ()
+ Target0 ()
+ Target1 (1)
+ Target2 (1,2)
+ Target3 (1,2,3)
+ Target4 (1,2,3,4)
+ Target5 (1,2,3,4,5)
+ Target6 (1,2,3,4,5,6)
+ Target7 (1,2,3,4,5,6,7)
+ Target8 (1,2,3,4,5,6,7,8)
+ Target9 (1,2,3,4,5,6,7,8,9)
+ Target10(1,2,3,4,5,6,7,8,9,10)
+ Target11(1,2,3,4,5,6,7,8,9,10,11)
+ Target12(1,2,3,4,5,6,7,8,9,10,11,12)
+ Target13(1,2,3,4,5,6,7,8,9,10,11,12,13)
+ Target14(1,2,3,4,5,6,7,8,9,10,11,12,13,14)
+ Target15(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)
+ Target16(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
+ TargetV (0)
+ TargetV (0,1)
+ TargetV (0,1,2)
+ TargetV (0,1,2,3)
+ TargetV (0,1,2,3,4)
+ TargetV (0,1,2,3,4,5)
+ TargetV (0,1,2,3,4,5,6)
+ TargetV (0,1,2,3,4,5,6,7)
+ TargetV (0,1,2,3,4,5,6,7,8)
+ TargetV (0,1,2,3,4,5,6,7,8,9)
+ TargetV (0,1,2,3,4,5,6,7,8,9,10)
+ TargetV (0,1,2,3,4,5,6,7,8,9,10,11)
+ TargetV (0,1,2,3,4,5,6,7,8,9,10,11,12)
+ TargetV (0,1,2,3,4,5,6,7,8,9,10,11,12,13)
+ TargetV (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14)
+ TargetV (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)
+ TargetV (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
+::: TargetR (0,1,2,3,1)
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: TargetR (0,1,2,3,4,5,6,7,8,9,10,1)
+ Target0 ()
+ Target0 ()
+ Target0 ()
+ Target0 ()
diff --git a/ext/detours/samples/dtest/NORMAL_X86.TXT b/ext/detours/samples/dtest/NORMAL_X86.TXT
new file mode 100644
index 0000000..90ab0c8
--- /dev/null
+++ b/ext/detours/samples/dtest/NORMAL_X86.TXT
@@ -0,0 +1,116 @@
+ ..\..\bin.X86\dtest.exe
+Calling LocalTarget1 w/o detour
+ LocalTarget1 (1)
+Calling LocalTarget1 w/ detour
+ MyLocalTarget1 (2)
+ LocalTarget1 (2)
+Calling Target0 function.
+ MyTarget0 ()
+Calling TargetN functions.
+ MyLocalTarget1 (1)
+ LocalTarget1 (1)
+ MyTarget0 ()
+ MyTarget1 (1)
+ MyTarget2 (1,2)
+ MyTarget3 (1,2,3)
+ MyTarget4 (1,2,3,4)
+ MyTarget5 (1,2,3,4,5)
+ MyTarget6 (1,2,3,4,5,6)
+ MyTarget7 (1,2,3,4,5,6,7)
+ MyTarget8 (1,2,3,4,5,6,7,8)
+ MyTarget9 (1,2,3,4,5,6,7,8,9)
+ MyTarget10(1,2,3,4,5,6,7,8,9,10)
+ MyTarget11(1,2,3,4,5,6,7,8,9,10,11)
+ MyTarget12(1,2,3,4,5,6,7,8,9,10,11,12)
+ MyTarget13(1,2,3,4,5,6,7,8,9,10,11,12,13)
+ MyTarget14(1,2,3,4,5,6,7,8,9,10,11,12,13,14)
+ MyTarget15(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)
+ MyTarget16(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
+ MyTargetV (0)
+ MyTargetV (0,1)
+ MyTargetV (0,1,2)
+ MyTargetV (0,1,2,3)
+ MyTargetV (0,1,2,3,4)
+ MyTargetV (0,1,2,3,4,5)
+ MyTargetV (0,1,2,3,4,5,6)
+ MyTargetV (0,1,2,3,4,5,6,7)
+ MyTargetV (0,1,2,3,4,5,6,7,8)
+ MyTargetV (0,1,2,3,4,5,6,7,8,9)
+ MyTargetV (0,1,2,3,4,5,6,7,8,9,10)
+ MyTargetV (0,1,2,3,4,5,6,7,8,9,10,11)
+ MyTargetV (0,1,2,3,4,5,6,7,8,9,10,11,12)
+ MyTargetV (0,1,2,3,4,5,6,7,8,9,10,11,12,13)
+ MyTargetV (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14)
+ MyTargetV (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)
+ MyTargetV (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
+ MyTargetR (0,1,2,3,4)
+ MyTargetR (0,1,2,3,3)
+ MyTargetR (0,1,2,3,2)
+ MyTargetR (0,1,2,3,1)
+.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... MyTargetR (0,1,2,3,4,5,6,7,8,9,10,4)
+ MyTargetR (0,1,2,3,4,5,6,7,8,9,10,3)
+ MyTargetR (0,1,2,3,4,5,6,7,8,9,10,2)
+ MyTargetR (0,1,2,3,4,5,6,7,8,9,10,1)
+ => 3011
+Calling Target0 again with 1 detour.
+ MyTarget0 ()
+Calling Target0 again with 2 detours.
+ Starting Target0_1.
+ MyTarget0 ()
+ End Target0_1.
+Calling Target0 again with 3 detours.
+ Starting Target0_2.
+ Starting Target0_1.
+ MyTarget0 ()
+ End Target0_1.
+ End Target0_2.
+Calling Target0 again with 4 detours.
+ Starting Target0_3.
+ Starting Target0_2.
+ Starting Target0_1.
+ MyTarget0 ()
+ End Target0_1.
+ End Target0_2.
+ End Target0_3.
+Done.
+ Target0 ()
+ Target0 ()
+ Target1 (1)
+ Target2 (1,2)
+ Target3 (1,2,3)
+ Target4 (1,2,3,4)
+ Target5 (1,2,3,4,5)
+ Target6 (1,2,3,4,5,6)
+ Target7 (1,2,3,4,5,6,7)
+ Target8 (1,2,3,4,5,6,7,8)
+ Target9 (1,2,3,4,5,6,7,8,9)
+ Target10(1,2,3,4,5,6,7,8,9,10)
+ Target11(1,2,3,4,5,6,7,8,9,10,11)
+ Target12(1,2,3,4,5,6,7,8,9,10,11,12)
+ Target13(1,2,3,4,5,6,7,8,9,10,11,12,13)
+ Target14(1,2,3,4,5,6,7,8,9,10,11,12,13,14)
+ Target15(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)
+ Target16(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
+ TargetV (0)
+ TargetV (0,1)
+ TargetV (0,1,2)
+ TargetV (0,1,2,3)
+ TargetV (0,1,2,3,4)
+ TargetV (0,1,2,3,4,5)
+ TargetV (0,1,2,3,4,5,6)
+ TargetV (0,1,2,3,4,5,6,7)
+ TargetV (0,1,2,3,4,5,6,7,8)
+ TargetV (0,1,2,3,4,5,6,7,8,9)
+ TargetV (0,1,2,3,4,5,6,7,8,9,10)
+ TargetV (0,1,2,3,4,5,6,7,8,9,10,11)
+ TargetV (0,1,2,3,4,5,6,7,8,9,10,11,12)
+ TargetV (0,1,2,3,4,5,6,7,8,9,10,11,12,13)
+ TargetV (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14)
+ TargetV (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)
+ TargetV (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
+::: TargetR (0,1,2,3,1)
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: TargetR (0,1,2,3,4,5,6,7,8,9,10,1)
+ Target0 ()
+ Target0 ()
+ Target0 ()
+ Target0 ()
diff --git a/ext/detours/samples/dtest/dtarge.cpp b/ext/detours/samples/dtest/dtarge.cpp
new file mode 100644
index 0000000..2cd4534
--- /dev/null
+++ b/ext/detours/samples/dtest/dtarge.cpp
@@ -0,0 +1,306 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (dtarge.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#include <stdio.h>
+#include <windows.h>
+#include "dtarge.h"
+
+DWORD_PTR WINAPI Target0()
+{
+ printf(" Target0 ()\n");
+ return 1000;
+}
+
+DWORD_PTR WINAPI Target1(DWORD_PTR v1)
+{
+ printf(" Target1 (%ld)\n",
+ (DWORD)v1);
+ return 1001;
+}
+
+DWORD_PTR WINAPI Target2(DWORD_PTR v1, DWORD_PTR v2)
+{
+ printf(" Target2 (%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2);
+ return 1002;
+}
+
+DWORD_PTR WINAPI Target3(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3)
+{
+ printf(" Target3 (%ld,%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2, (DWORD)v3);
+ return 1003;
+}
+
+DWORD_PTR WINAPI Target4(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4)
+{
+ printf(" Target4 (%ld,%ld,%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2, (DWORD)v3, (DWORD)v4);
+ return 1004;
+}
+
+DWORD_PTR WINAPI Target5(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5)
+{
+ printf(" Target5 (%ld,%ld,%ld,%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2, (DWORD)v3, (DWORD)v4,
+ (DWORD)v5);
+ return 1005;
+}
+
+DWORD_PTR WINAPI Target6(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6)
+{
+ printf(" Target6 (%ld,%ld,%ld,%ld,%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2, (DWORD)v3, (DWORD)v4,
+ (DWORD)v5, (DWORD)v6);
+ return 1006;
+}
+
+DWORD_PTR WINAPI Target7(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7)
+{
+ printf(" Target7 (%ld,%ld,%ld,%ld,%ld,%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2, (DWORD)v3, (DWORD)v4,
+ (DWORD)v5, (DWORD)v6, (DWORD)v7);
+ return 1007;
+}
+
+DWORD_PTR WINAPI Target8(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8)
+{
+ printf(" Target8 (%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2, (DWORD)v3, (DWORD)v4,
+ (DWORD)v5, (DWORD)v6, (DWORD)v7, (DWORD)v8);
+ return 1008;
+}
+
+DWORD_PTR WINAPI Target9(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9)
+{
+ printf(" Target9 (%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2, (DWORD)v3, (DWORD)v4,
+ (DWORD)v5, (DWORD)v6, (DWORD)v7, (DWORD)v8,
+ (DWORD)v9);
+ return 1009;
+}
+
+DWORD_PTR WINAPI Target10(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9, DWORD_PTR v10)
+{
+ printf(" Target10(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2, (DWORD)v3, (DWORD)v4,
+ (DWORD)v5, (DWORD)v6, (DWORD)v7, (DWORD)v8,
+ (DWORD)v9, (DWORD)v10);
+ return 1010;
+}
+
+DWORD_PTR WINAPI Target11(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9, DWORD_PTR v10, DWORD_PTR v11)
+{
+ printf(" Target11(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2, (DWORD)v3, (DWORD)v4,
+ (DWORD)v5, (DWORD)v6, (DWORD)v7, (DWORD)v8,
+ (DWORD)v9, (DWORD)v10, (DWORD)v11);
+ return 1011;
+}
+
+DWORD_PTR WINAPI Target12(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9, DWORD_PTR v10, DWORD_PTR v11, DWORD_PTR v12)
+{
+ printf(" Target12(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2, (DWORD)v3, (DWORD)v4,
+ (DWORD)v5, (DWORD)v6, (DWORD)v7, (DWORD)v8,
+ (DWORD)v9, (DWORD)v10, (DWORD)v11, (DWORD)v12);
+ return 1012;
+}
+
+DWORD_PTR WINAPI Target13(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9, DWORD_PTR v10, DWORD_PTR v11, DWORD_PTR v12,
+ DWORD_PTR v13)
+{
+ printf(" Target13(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2, (DWORD)v3, (DWORD)v4,
+ (DWORD)v5, (DWORD)v6, (DWORD)v7, (DWORD)v8,
+ (DWORD)v9, (DWORD)v10, (DWORD)v11, (DWORD)v12,
+ (DWORD)v13);
+ return 1013;
+}
+
+DWORD_PTR WINAPI Target14(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9, DWORD_PTR v10, DWORD_PTR v11, DWORD_PTR v12,
+ DWORD_PTR v13, DWORD_PTR v14)
+{
+ printf(" Target14(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2, (DWORD)v3, (DWORD)v4,
+ (DWORD)v5, (DWORD)v6, (DWORD)v7, (DWORD)v8,
+ (DWORD)v9, (DWORD)v10, (DWORD)v11, (DWORD)v12,
+ (DWORD)v13, (DWORD)v14);
+ return 1014;
+}
+
+DWORD_PTR WINAPI Target15(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9, DWORD_PTR v10, DWORD_PTR v11, DWORD_PTR v12,
+ DWORD_PTR v13, DWORD_PTR v14, DWORD_PTR v15)
+{
+ printf(" Target15(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2, (DWORD)v3, (DWORD)v4,
+ (DWORD)v5, (DWORD)v6, (DWORD)v7, (DWORD)v8,
+ (DWORD)v9, (DWORD)v10, (DWORD)v11, (DWORD)v12,
+ (DWORD)v13, (DWORD)v14, (DWORD)v15);
+ return 1015;
+}
+
+DWORD_PTR WINAPI Target16(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9, DWORD_PTR v10, DWORD_PTR v11, DWORD_PTR v12,
+ DWORD_PTR v13, DWORD_PTR v14, DWORD_PTR v15, DWORD_PTR v16)
+{
+ printf(" Target16(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2, (DWORD)v3, (DWORD)v4,
+ (DWORD)v5, (DWORD)v6, (DWORD)v7, (DWORD)v8,
+ (DWORD)v9, (DWORD)v10, (DWORD)v11, (DWORD)v12,
+ (DWORD)v13, (DWORD)v14, (DWORD)v15, (DWORD)v16);
+ return 1016;
+}
+
+DWORD_PTR WINAPI TargetV(DWORD_PTR v1, ...)
+{
+ DWORD_PTR args[32];
+
+ va_list va;
+ va_start(va, v1);
+
+ int argc = 0;
+ for (args[argc++] = v1; args[argc-1] != 0;) {
+ args[argc++] = va_arg(va, DWORD_PTR);
+ }
+ va_end(va);
+
+ printf(" TargetV (");
+ int i = argc - 1;
+ for (; i > 0; i--) {
+ printf("%ld,", (DWORD)args[i]);
+ }
+ printf("%ld)\n", (DWORD)args[0]);
+
+ return 1000 + argc;
+}
+
+DWORD_PTR WINAPI TargetR(DWORD_PTR v1, ...)
+{
+ DWORD_PTR args[32];
+
+ va_list va;
+ va_start(va, v1);
+
+ int argc = 0;
+ for (args[argc++] = v1; args[argc-1] != 0;) {
+ args[argc++] = va_arg(va, DWORD_PTR);
+ }
+ va_end(va);
+
+ if (v1 > 1) {
+ printf(":");
+ switch (argc) {
+ default:
+ return TargetR(0) + 1;
+ case 1:
+ return TargetR(args[0] - 1) + 1;
+ case 2:
+ return TargetR(args[0] - 1, args[1]) + 1;
+ case 3:
+ return TargetR(args[0] - 1, args[1], args[2]) + 1;
+ case 4:
+ return TargetR(args[0] - 1, args[1], args[2], args[3]) + 1;
+ case 5:
+ return TargetR(args[0] - 1, args[1], args[2], args[3],
+ args[4]) + 1;
+ case 6:
+ return TargetR(args[0] - 1, args[1], args[2], args[3],
+ args[4], args[5]) + 1;
+ case 7:
+ return TargetR(args[0] - 1, args[1], args[2], args[3],
+ args[4], args[5], args[6]) + 1;
+ case 8:
+ return TargetR(args[0] - 1, args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7]) + 1;
+ case 9:
+ return TargetR(args[0] - 1, args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8]) + 1;
+ case 10:
+ return TargetR(args[0] - 1, args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8], args[9]) + 1;
+ case 11:
+ return TargetR(args[0] - 1, args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8], args[9], args[10]) + 1;
+ case 12:
+ return TargetR(args[0] - 1, args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8], args[9], args[10], args[11]) + 1;
+ case 13:
+ return TargetR(args[0] - 1, args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8], args[9], args[10], args[11],
+ args[12]) + 1;
+ case 14:
+ return TargetR(args[0] - 1, args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8], args[9], args[10], args[11],
+ args[12], args[13]) + 1;
+ case 15:
+ return TargetR(args[0] - 1, args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8], args[9], args[10], args[11],
+ args[12], args[13], args[14]) + 1;
+ case 16:
+ return TargetR(args[0] - 1, args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8], args[9], args[10], args[11],
+ args[12], args[13], args[14], args[15]) + 1;
+ case 17:
+ return TargetR(args[0] - 1, args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8], args[9], args[10], args[11],
+ args[12], args[13], args[14], args[15],
+ args[16]) + 1;
+ }
+ }
+
+ printf(" TargetR (");
+ int i = argc - 1;
+ for (; i > 0; i--) {
+ printf("%ld,", (DWORD)args[i]);
+ }
+ printf("%ld)\n", (DWORD)args[0]);
+
+ return 2000 + argc;
+}
+
+
+BOOL WINAPI DllMain(HINSTANCE hinst, DWORD dwReason, LPVOID reserved)
+{
+ (void)hinst;
+ (void)dwReason;
+ (void)reserved;
+
+ return TRUE;
+}
+
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/dtest/dtarge.h b/ext/detours/samples/dtest/dtarge.h
new file mode 100644
index 0000000..7aa5cd6
--- /dev/null
+++ b/ext/detours/samples/dtest/dtarge.h
@@ -0,0 +1,60 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (dtarge.h of dtarge.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#pragma once
+
+#if (_MSC_VER < 1299)
+typedef DWORD DWORD_PTR;
+#endif
+
+DWORD_PTR WINAPI Target0();
+DWORD_PTR WINAPI Target1(DWORD_PTR v1);
+DWORD_PTR WINAPI Target2(DWORD_PTR v1, DWORD_PTR v2);
+DWORD_PTR WINAPI Target3(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3);
+DWORD_PTR WINAPI Target4(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4);
+DWORD_PTR WINAPI Target5(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5);
+DWORD_PTR WINAPI Target6(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6);
+DWORD_PTR WINAPI Target7(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7);
+DWORD_PTR WINAPI Target8(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8);
+DWORD_PTR WINAPI Target9(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9);
+DWORD_PTR WINAPI Target10(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9, DWORD_PTR v10);
+DWORD_PTR WINAPI Target11(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9, DWORD_PTR v10, DWORD_PTR v11);
+DWORD_PTR WINAPI Target12(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9, DWORD_PTR v10, DWORD_PTR v11, DWORD_PTR v12);
+DWORD_PTR WINAPI Target13(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9, DWORD_PTR v10, DWORD_PTR v11, DWORD_PTR v12,
+ DWORD_PTR v13);
+DWORD_PTR WINAPI Target14(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9, DWORD_PTR v10, DWORD_PTR v11, DWORD_PTR v12,
+ DWORD_PTR v13, DWORD_PTR v14);
+DWORD_PTR WINAPI Target15(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9, DWORD_PTR v10, DWORD_PTR v11, DWORD_PTR v12,
+ DWORD_PTR v13, DWORD_PTR v14, DWORD_PTR v15);
+DWORD_PTR WINAPI Target16(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9, DWORD_PTR v10, DWORD_PTR v11, DWORD_PTR v12,
+ DWORD_PTR v13, DWORD_PTR v14, DWORD_PTR v15, DWORD_PTR v16);
+DWORD_PTR WINAPI TargetV(DWORD_PTR v1, ...);
+DWORD_PTR WINAPI TargetR(DWORD_PTR v1, ...);
+
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/dtest/dtarge.rc b/ext/detours/samples/dtest/dtarge.rc
new file mode 100644
index 0000000..1a66b51
--- /dev/null
+++ b/ext/detours/samples/dtest/dtarge.rc
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Version information for dtarge.rc.
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include "detver.h"
+
+#define VER_INTERNALNAME_STR "dtarge" DETOURS_STRINGIFY(DETOURS_BITS)
+#define VER_ORIGINALFILENAME_STR "dtarge" DETOURS_STRINGIFY(DETOURS_BITS) ".dll"
+#define VER_FILEDESCRIPTION_STR "Detours Test Module"
+#define VER_COMPANYNAME_STR "Microsoft Corporation"
+
+#include "common.ver"
diff --git a/ext/detours/samples/dtest/dtest.cpp b/ext/detours/samples/dtest/dtest.cpp
new file mode 100644
index 0000000..f7de56d
--- /dev/null
+++ b/ext/detours/samples/dtest/dtest.cpp
@@ -0,0 +1,658 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (dtest.cpp of dtest.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#include <stdio.h>
+#include <stdarg.h>
+#include <windows.h>
+#pragma warning(push)
+#if _MSC_VER > 1400
+#pragma warning(disable:6102 6103) // /analyze warnings
+#endif
+#include <strsafe.h>
+#pragma warning(pop)
+#include <detours.h>
+#include "dtarge.h"
+
+DWORD_PTR WINAPI LocalTarget1(DWORD_PTR v1);
+
+////////////////////////////////////////////////////// Multi-Argument Detours.
+//
+DWORD_PTR (WINAPI * Trampoline_LocalTarget1)(DWORD_PTR v1) = LocalTarget1;
+
+DWORD_PTR (WINAPI * Trampoline_Target0)() = Target0;
+DWORD_PTR (WINAPI * Trampoline_Target1)(DWORD_PTR v1) = Target1;
+DWORD_PTR (WINAPI * Trampoline_Target2)(DWORD_PTR v1, DWORD_PTR v2) = Target2;
+DWORD_PTR (WINAPI * Trampoline_Target3)
+ (DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3) = Target3;
+DWORD_PTR (WINAPI * Trampoline_Target4)
+ (DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4) = Target4;
+DWORD_PTR (WINAPI * Trampoline_Target5)
+ (DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5) = Target5;
+DWORD_PTR (WINAPI * Trampoline_Target6)
+ (DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6) = Target6;
+DWORD_PTR (WINAPI * Trampoline_Target7)
+ (DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7) = Target7;
+DWORD_PTR (WINAPI * Trampoline_Target8)
+ (DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8) = Target8;
+DWORD_PTR (WINAPI * Trampoline_Target9)
+ (DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9) = Target9;
+DWORD_PTR (WINAPI * Trampoline_Target10)
+ (DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9, DWORD_PTR v10) = Target10;
+DWORD_PTR (WINAPI * Trampoline_Target11)
+ (DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9, DWORD_PTR v10, DWORD_PTR v11) = Target11;
+DWORD_PTR (WINAPI * Trampoline_Target12)
+ (DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9, DWORD_PTR v10, DWORD_PTR v11, DWORD_PTR v12) = Target12;
+DWORD_PTR (WINAPI * Trampoline_Target13)
+ (DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9, DWORD_PTR v10, DWORD_PTR v11, DWORD_PTR v12,
+ DWORD_PTR v13) = Target13;
+DWORD_PTR (WINAPI * Trampoline_Target14)
+ (DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9, DWORD_PTR v10, DWORD_PTR v11, DWORD_PTR v12,
+ DWORD_PTR v13, DWORD_PTR v14) = Target14;
+DWORD_PTR (WINAPI * Trampoline_Target15)
+ (DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9, DWORD_PTR v10, DWORD_PTR v11, DWORD_PTR v12,
+ DWORD_PTR v13, DWORD_PTR v14, DWORD_PTR v15) = Target15;
+DWORD_PTR (WINAPI * Trampoline_Target16)
+ (DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9, DWORD_PTR v10, DWORD_PTR v11, DWORD_PTR v12,
+ DWORD_PTR v13, DWORD_PTR v14, DWORD_PTR v15, DWORD_PTR v16) = Target16;
+DWORD_PTR (WINAPI * Trampoline_TargetV)(DWORD_PTR v1, ...) = TargetV;
+DWORD_PTR (WINAPI * Trampoline_TargetR)(DWORD_PTR v1, ...) = TargetR;
+
+//////////////////////////////////////////////////////////////////////////////
+//
+VOID dprintf(const char * fmt, ...)
+{
+ CHAR szBuf[1024];
+
+ va_list args;
+ va_start(args, fmt);
+ StringCchPrintfA(szBuf, sizeof(szBuf), fmt, args);
+ va_end(args);
+
+ OutputDebugStringA(szBuf);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+DWORD_PTR WINAPI LocalTarget1(DWORD_PTR v1)
+{
+ printf(" LocalTarget1 (%ld)\n", (DWORD)v1);
+ // dprintf("LocalTarget1\n");
+ // __debugbreak();
+ return 9000;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+DWORD_PTR WINAPI MyLocalTarget1(DWORD_PTR v1)
+{
+ printf(" MyLocalTarget1 (%ld)\n",
+ (DWORD)v1);
+ // dprintf("LocalTarget1, Trampoline_LocalTarget1=%p\n", Trampoline_LocalTarget1);
+ return Trampoline_LocalTarget1(v1);
+}
+
+DWORD_PTR WINAPI MyTarget0()
+{
+ printf(" MyTarget0 ()\n");
+ return Trampoline_Target0();
+}
+
+DWORD_PTR WINAPI MyTarget1(DWORD_PTR v1)
+{
+ printf(" MyTarget1 (%ld)\n",
+ (DWORD)v1);
+ return Trampoline_Target1(v1);
+}
+
+DWORD_PTR WINAPI MyTarget2(DWORD_PTR v1, DWORD_PTR v2)
+{
+ printf(" MyTarget2 (%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2);
+ return Trampoline_Target2(v1,v2);
+}
+
+DWORD_PTR WINAPI MyTarget3(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3)
+{
+ printf(" MyTarget3 (%ld,%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2, (DWORD)v3);
+ return Trampoline_Target3(v1,v2,v3);
+}
+
+DWORD_PTR WINAPI MyTarget4(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4)
+{
+ printf(" MyTarget4 (%ld,%ld,%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2, (DWORD)v3, (DWORD)v4);
+ return Trampoline_Target4(v1,v2,v3,v4);
+}
+
+DWORD_PTR WINAPI MyTarget5(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5)
+{
+ printf(" MyTarget5 (%ld,%ld,%ld,%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2, (DWORD)v3, (DWORD)v4,
+ (DWORD)v5);
+ return Trampoline_Target5(v1,v2,v3,v4,v5);
+}
+
+DWORD_PTR WINAPI MyTarget6(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6)
+{
+ printf(" MyTarget6 (%ld,%ld,%ld,%ld,%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2, (DWORD)v3, (DWORD)v4,
+ (DWORD)v5, (DWORD)v6);
+ return Trampoline_Target6(v1,v2,v3,v4,v5,v6);
+}
+
+DWORD_PTR WINAPI MyTarget7(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7)
+{
+ printf(" MyTarget7 (%ld,%ld,%ld,%ld,%ld,%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2, (DWORD)v3, (DWORD)v4,
+ (DWORD)v5, (DWORD)v6, (DWORD)v7);
+ return Trampoline_Target7(v1,v2,v3,v4,v5,v6,v7);
+}
+
+DWORD_PTR WINAPI MyTarget8(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8)
+{
+ printf(" MyTarget8 (%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2, (DWORD)v3, (DWORD)v4,
+ (DWORD)v5, (DWORD)v6, (DWORD)v7, (DWORD)v8);
+ return Trampoline_Target8(v1,v2,v3,v4,v5,v6,v7,v8);
+}
+
+DWORD_PTR WINAPI MyTarget9(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9)
+{
+ printf(" MyTarget9 (%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2, (DWORD)v3, (DWORD)v4,
+ (DWORD)v5, (DWORD)v6, (DWORD)v7, (DWORD)v8,
+ (DWORD)v9);
+ return Trampoline_Target9(v1,v2,v3,v4,v5,v6,v7,v8,v9);
+}
+
+DWORD_PTR WINAPI MyTarget10(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9, DWORD_PTR v10)
+{
+ printf(" MyTarget10(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2, (DWORD)v3, (DWORD)v4,
+ (DWORD)v5, (DWORD)v6, (DWORD)v7, (DWORD)v8,
+ (DWORD)v9, (DWORD)v10);
+ return Trampoline_Target10(v1,v2,v3,v4,v5,v6,v7,v8,v9,v10);
+}
+
+DWORD_PTR WINAPI MyTarget11(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9, DWORD_PTR v10, DWORD_PTR v11)
+{
+ printf(" MyTarget11(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2, (DWORD)v3, (DWORD)v4,
+ (DWORD)v5, (DWORD)v6, (DWORD)v7, (DWORD)v8,
+ (DWORD)v9, (DWORD)v10, (DWORD)v11);
+ return Trampoline_Target11(v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11);
+}
+
+DWORD_PTR WINAPI MyTarget12(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9, DWORD_PTR v10, DWORD_PTR v11, DWORD_PTR v12)
+{
+ printf(" MyTarget12(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2, (DWORD)v3, (DWORD)v4,
+ (DWORD)v5, (DWORD)v6, (DWORD)v7, (DWORD)v8,
+ (DWORD)v9, (DWORD)v10, (DWORD)v11, (DWORD)v12);
+ return Trampoline_Target12(v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,v12);
+}
+
+DWORD_PTR WINAPI MyTarget13(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9, DWORD_PTR v10, DWORD_PTR v11, DWORD_PTR v12,
+ DWORD_PTR v13)
+{
+ printf(" MyTarget13(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2, (DWORD)v3, (DWORD)v4,
+ (DWORD)v5, (DWORD)v6, (DWORD)v7, (DWORD)v8,
+ (DWORD)v9, (DWORD)v10, (DWORD)v11, (DWORD)v12,
+ (DWORD)v13);
+ return Trampoline_Target13(v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,v12,v13);
+}
+
+DWORD_PTR WINAPI MyTarget14(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9, DWORD_PTR v10, DWORD_PTR v11, DWORD_PTR v12,
+ DWORD_PTR v13, DWORD_PTR v14)
+{
+ printf(" MyTarget14(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2, (DWORD)v3, (DWORD)v4,
+ (DWORD)v5, (DWORD)v6, (DWORD)v7, (DWORD)v8,
+ (DWORD)v9, (DWORD)v10, (DWORD)v11, (DWORD)v12,
+ (DWORD)v13, (DWORD)v14);
+ return Trampoline_Target14(v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,v12,v13,v14);
+}
+
+DWORD_PTR WINAPI MyTarget15(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9, DWORD_PTR v10, DWORD_PTR v11, DWORD_PTR v12,
+ DWORD_PTR v13, DWORD_PTR v14, DWORD_PTR v15)
+{
+ printf(" MyTarget15(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2, (DWORD)v3, (DWORD)v4,
+ (DWORD)v5, (DWORD)v6, (DWORD)v7, (DWORD)v8,
+ (DWORD)v9, (DWORD)v10, (DWORD)v11, (DWORD)v12,
+ (DWORD)v13, (DWORD)v14, (DWORD)v15);
+ return Trampoline_Target15(v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,v12,v13,v14,v15);
+}
+
+DWORD_PTR WINAPI MyTarget16(DWORD_PTR v1, DWORD_PTR v2, DWORD_PTR v3, DWORD_PTR v4,
+ DWORD_PTR v5, DWORD_PTR v6, DWORD_PTR v7, DWORD_PTR v8,
+ DWORD_PTR v9, DWORD_PTR v10, DWORD_PTR v11, DWORD_PTR v12,
+ DWORD_PTR v13, DWORD_PTR v14, DWORD_PTR v15, DWORD_PTR v16)
+{
+ printf(" MyTarget16(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)\n",
+ (DWORD)v1, (DWORD)v2, (DWORD)v3, (DWORD)v4,
+ (DWORD)v5, (DWORD)v6, (DWORD)v7, (DWORD)v8,
+ (DWORD)v9, (DWORD)v10, (DWORD)v11, (DWORD)v12,
+ (DWORD)v13, (DWORD)v14, (DWORD)v15, (DWORD)v16);
+ return Trampoline_Target16(v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,v12,v13,v14,v15,v16);
+}
+
+DWORD_PTR WINAPI MyTargetV(DWORD_PTR v1, ...)
+{
+ DWORD_PTR args[32];
+
+ va_list va;
+ va_start(va, v1);
+
+ int argc = 0;
+ for (args[argc++] = v1; args[argc-1] != 0;) {
+ args[argc++] = va_arg(va, DWORD_PTR);
+ }
+ va_end(va);
+
+ printf(" MyTargetV (");
+ int i = argc - 1;
+ for (; i > 0; i--) {
+ printf("%ld,", (DWORD)args[i]);
+ }
+ printf("%ld)\n", (DWORD)args[0]);
+
+ switch (argc) {
+ default:
+ return Trampoline_TargetV(0);
+ case 1:
+ return Trampoline_TargetV(args[0]);
+ case 2:
+ return Trampoline_TargetV(args[0], args[1]);
+ case 3:
+ return Trampoline_TargetV(args[0], args[1], args[2]);
+ case 4:
+ return Trampoline_TargetV(args[0], args[1], args[2], args[3]);
+ case 5:
+ return Trampoline_TargetV(args[0], args[1], args[2], args[3],
+ args[4]);
+ case 6:
+ return Trampoline_TargetV(args[0], args[1], args[2], args[3],
+ args[4], args[5]);
+ case 7:
+ return Trampoline_TargetV(args[0], args[1], args[2], args[3],
+ args[4], args[5], args[6]);
+ case 8:
+ return Trampoline_TargetV(args[0], args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7]);
+ case 9:
+ return Trampoline_TargetV(args[0], args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8]);
+ case 10:
+ return Trampoline_TargetV(args[0], args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8], args[9]);
+ case 11:
+ return Trampoline_TargetV(args[0], args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8], args[9], args[10]);
+ case 12:
+ return Trampoline_TargetV(args[0], args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8], args[9], args[10], args[11]);
+ case 13:
+ return Trampoline_TargetV(args[0], args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8], args[9], args[10], args[11],
+ args[12]);
+ case 14:
+ return Trampoline_TargetV(args[0], args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8], args[9], args[10], args[11],
+ args[12], args[13]);
+ case 15:
+ return Trampoline_TargetV(args[0], args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8], args[9], args[10], args[11],
+ args[12], args[13], args[14]);
+ case 16:
+ return Trampoline_TargetV(args[0], args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8], args[9], args[10], args[11],
+ args[12], args[13], args[14], args[15]);
+ case 17:
+ return Trampoline_TargetV(args[0], args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8], args[9], args[10], args[11],
+ args[12], args[13], args[14], args[15],
+ args[16]);
+ }
+}
+
+DWORD_PTR WINAPI MyTargetR(DWORD_PTR v1, ...)
+{
+ DWORD_PTR args[32];
+
+ va_list va;
+ va_start(va, v1);
+
+ int argc = 0;
+ for (args[argc++] = v1; args[argc-1] != 0;) {
+ args[argc++] = va_arg(va, DWORD_PTR);
+ }
+ va_end(va);
+
+ if (v1 < 5) {
+ printf(" MyTargetR (");
+ int i = argc - 1;
+ for (; i > 0; i--) {
+ printf("%ld,", (DWORD)args[i]);
+ }
+ printf("%ld)\n", (DWORD)args[0]);
+ }
+ else {
+ printf(".");
+ }
+
+ switch (argc) {
+ default:
+ return Trampoline_TargetR(0);
+ case 1:
+ return Trampoline_TargetR(args[0]);
+ case 2:
+ return Trampoline_TargetR(args[0], args[1]);
+ case 3:
+ return Trampoline_TargetR(args[0], args[1], args[2]);
+ case 4:
+ return Trampoline_TargetR(args[0], args[1], args[2], args[3]);
+ case 5:
+ return Trampoline_TargetR(args[0], args[1], args[2], args[3],
+ args[4]);
+ case 6:
+ return Trampoline_TargetR(args[0], args[1], args[2], args[3],
+ args[4], args[5]);
+ case 7:
+ return Trampoline_TargetR(args[0], args[1], args[2], args[3],
+ args[4], args[5], args[6]);
+ case 8:
+ return Trampoline_TargetR(args[0], args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7]);
+ case 9:
+ return Trampoline_TargetR(args[0], args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8]);
+ case 10:
+ return Trampoline_TargetR(args[0], args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8], args[9]);
+ case 11:
+ return Trampoline_TargetR(args[0], args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8], args[9], args[10]);
+ case 12:
+ return Trampoline_TargetR(args[0], args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8], args[9], args[10], args[11]);
+ case 13:
+ return Trampoline_TargetR(args[0], args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8], args[9], args[10], args[11],
+ args[12]);
+ case 14:
+ return Trampoline_TargetR(args[0], args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8], args[9], args[10], args[11],
+ args[12], args[13]);
+ case 15:
+ return Trampoline_TargetR(args[0], args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8], args[9], args[10], args[11],
+ args[12], args[13], args[14]);
+ case 16:
+ return Trampoline_TargetR(args[0], args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8], args[9], args[10], args[11],
+ args[12], args[13], args[14], args[15]);
+ case 17:
+ return Trampoline_TargetR(args[0], args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8], args[9], args[10], args[11],
+ args[12], args[13], args[14], args[15],
+ args[16]);
+ }
+}
+
+/////////////////////////////////////////////////////////// Recursive Detours.
+//
+DWORD_PTR (WINAPI * Trampoline_Target0_1)() = NULL;
+DWORD_PTR (WINAPI * Trampoline_Target0_2)() = NULL;
+DWORD_PTR (WINAPI * Trampoline_Target0_3)() = NULL;
+
+static DWORD_PTR WINAPI MyTarget0_1()
+{
+ printf(" Starting Target0_1.\n");
+ DWORD_PTR rv = Trampoline_Target0_1();
+ printf(" End Target0_1.\n");
+ return rv;
+}
+
+static DWORD_PTR WINAPI MyTarget0_2()
+{
+ printf(" Starting Target0_2.\n");
+ DWORD_PTR rv = Trampoline_Target0_2();
+ printf(" End Target0_2.\n");
+ return rv;
+}
+
+static DWORD_PTR WINAPI MyTarget0_3()
+{
+ printf(" Starting Target0_3.\n");
+ DWORD_PTR rv = Trampoline_Target0_3();
+ printf(" End Target0_3.\n");
+ return rv;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+int WINAPI WinMain(HINSTANCE hinst, HINSTANCE hprev, LPSTR lpszCmdLine, int nCmdShow)
+{
+ (void)hinst;
+ (void)hprev;
+ (void)lpszCmdLine;
+ (void)nCmdShow;
+
+ printf("Calling LocalTarget1 w/o detour\n");
+ LocalTarget1(1);
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)Trampoline_LocalTarget1, MyLocalTarget1);
+ DetourTransactionCommit();
+
+ printf("Calling LocalTarget1 w/ detour\n");
+ LocalTarget1(2);
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)Trampoline_Target0, MyTarget0);
+ DetourTransactionCommit();
+
+ printf("Calling Target0 function.\n");
+ //dprintf("- Trampoline_Target0:: %p\n", Trampoline_Target0);
+ //dprintf("- Target0 :: %p\n", Target0);
+ Target0();
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)Trampoline_Target1, MyTarget1);
+ DetourAttach(&(PVOID&)Trampoline_Target2, MyTarget2);
+ DetourAttach(&(PVOID&)Trampoline_Target3, MyTarget3);
+ DetourAttach(&(PVOID&)Trampoline_Target4, MyTarget4);
+ DetourAttach(&(PVOID&)Trampoline_Target5, MyTarget5);
+ DetourAttach(&(PVOID&)Trampoline_Target6, MyTarget6);
+ DetourAttach(&(PVOID&)Trampoline_Target7, MyTarget7);
+ DetourAttach(&(PVOID&)Trampoline_Target8, MyTarget8);
+ DetourAttach(&(PVOID&)Trampoline_Target9, MyTarget9);
+ DetourAttach(&(PVOID&)Trampoline_Target10, MyTarget10);
+ DetourAttach(&(PVOID&)Trampoline_Target11, MyTarget11);
+ DetourAttach(&(PVOID&)Trampoline_Target12, MyTarget12);
+ DetourAttach(&(PVOID&)Trampoline_Target13, MyTarget13);
+ DetourAttach(&(PVOID&)Trampoline_Target14, MyTarget14);
+ DetourAttach(&(PVOID&)Trampoline_Target15, MyTarget15);
+ DetourAttach(&(PVOID&)Trampoline_Target16, MyTarget16);
+ DetourAttach(&(PVOID&)Trampoline_TargetV, MyTargetV);
+ DetourAttach(&(PVOID&)Trampoline_TargetR, MyTargetR);
+ DetourTransactionCommit();
+
+ printf("Calling TargetN functions.\n");
+ LocalTarget1(1);
+ Target0();
+ Target1(1);
+ Target2(1,2);
+ Target3(1,2,3);
+ Target4(1,2,3,4);
+ Target5(1,2,3,4,5);
+ Target6(1,2,3,4,5,6);
+ Target7(1,2,3,4,5,6,7);
+ Target8(1,2,3,4,5,6,7,8);
+ Target9(1,2,3,4,5,6,7,8,9);
+ Target10(1,2,3,4,5,6,7,8,9,10);
+ Target11(1,2,3,4,5,6,7,8,9,10,11);
+ Target12(1,2,3,4,5,6,7,8,9,10,11,12);
+ Target13(1,2,3,4,5,6,7,8,9,10,11,12,13);
+ Target14(1,2,3,4,5,6,7,8,9,10,11,12,13,14);
+ Target15(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
+ Target16(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16);
+ TargetV(0);
+ TargetV(1,0);
+ TargetV(2,1,0);
+ TargetV(3,2,1,0);
+ TargetV(4,3,2,1,0);
+ TargetV(5,4,3,2,1,0);
+ TargetV(6,5,4,3,2,1,0);
+ TargetV(7,6,5,4,3,2,1,0);
+ TargetV(8,7,6,5,4,3,2,1,0);
+ TargetV(9,8,7,6,5,4,3,2,1,0);
+ TargetV(10,9,8,7,6,5,4,3,2,1,0);
+ TargetV(11,10,9,8,7,6,5,4,3,2,1,0);
+ TargetV(12,11,10,9,8,7,6,5,4,3,2,1,0);
+ TargetV(13,12,11,10,9,8,7,6,5,4,3,2,1,0);
+ TargetV(14,13,12,11,10,9,8,7,6,5,4,3,2,1,0);
+ TargetV(15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0);
+ TargetV(16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0);
+ TargetR(4,3,2,1,0);
+ DWORD_PTR rv = TargetR(100,10,9,8,7,6,5,4,3,2,1,0);
+ printf(" => %ld\n", (DWORD)rv);
+
+ Trampoline_Target0_1 = Target0;
+ Trampoline_Target0_2 = Target0;
+ Trampoline_Target0_3 = Target0;
+
+ //dprintf("Trampoline_Target0_1 = %p\n", DetourCodeFromPointer(Trampoline_Target0_1, NULL));
+ //__debugbreak();
+
+ printf("Calling Target0 again with 1 detour.\n");
+ Target0();
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)Trampoline_Target0_1, MyTarget0_1);
+ DetourTransactionCommit();
+
+ //dprintf("Trampoline_Target0_2 = %p\n", DetourCodeFromPointer(Trampoline_Target0_2, NULL));
+ //__debugbreak();
+ printf("Calling Target0 again with 2 detours.\n");
+ Target0();
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)Trampoline_Target0_2, MyTarget0_2);
+ DetourTransactionCommit();
+
+ //dprintf("Trampoline_Target0_3 = %p\n", DetourCodeFromPointer(Trampoline_Target0_3, NULL));
+ //__debugbreak();
+ printf("Calling Target0 again with 3 detours.\n");
+ Target0();
+
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)Trampoline_Target0_3, MyTarget0_3);
+ DetourTransactionCommit();
+
+ //dprintf("Trampoline_Target0_3 = %p\n", DetourCodeFromPointer(Trampoline_Target0_3, NULL));
+ //__debugbreak();
+ printf("Calling Target0 again with 4 detours.\n");
+ Target0();
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourDetach(&(PVOID&)Trampoline_Target0, MyTarget0);
+ DetourDetach(&(PVOID&)Trampoline_Target1, MyTarget1);
+ DetourDetach(&(PVOID&)Trampoline_Target2, MyTarget2);
+ DetourDetach(&(PVOID&)Trampoline_Target3, MyTarget3);
+ DetourDetach(&(PVOID&)Trampoline_Target4, MyTarget4);
+ DetourDetach(&(PVOID&)Trampoline_Target5, MyTarget5);
+ DetourDetach(&(PVOID&)Trampoline_Target6, MyTarget6);
+ DetourDetach(&(PVOID&)Trampoline_Target7, MyTarget7);
+ DetourDetach(&(PVOID&)Trampoline_Target8, MyTarget8);
+ DetourDetach(&(PVOID&)Trampoline_Target9, MyTarget9);
+ DetourDetach(&(PVOID&)Trampoline_Target10, MyTarget10);
+ DetourDetach(&(PVOID&)Trampoline_Target11, MyTarget11);
+ DetourDetach(&(PVOID&)Trampoline_Target12, MyTarget12);
+ DetourDetach(&(PVOID&)Trampoline_Target13, MyTarget13);
+ DetourDetach(&(PVOID&)Trampoline_Target14, MyTarget14);
+ DetourDetach(&(PVOID&)Trampoline_Target15, MyTarget15);
+ DetourDetach(&(PVOID&)Trampoline_Target16, MyTarget16);
+ DetourDetach(&(PVOID&)Trampoline_TargetV, MyTargetV);
+ DetourDetach(&(PVOID&)Trampoline_TargetR, MyTargetR);
+ DetourTransactionCommit();
+
+ printf("Done.\n");
+
+ return 0;
+}
+
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/dumpe/Makefile b/ext/detours/samples/dumpe/Makefile
new file mode 100644
index 0000000..bca7481
--- /dev/null
+++ b/ext/detours/samples/dumpe/Makefile
@@ -0,0 +1,53 @@
+##############################################################################
+##
+## Makefile for Detours Test Programs.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+LIBS=$(LIBS) kernel32.lib
+
+all: dirs \
+ $(BIND)\dumpe.exe \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\dumpe.bsc
+!ENDIF
+
+clean:
+ -del *~ 2>nul
+ -del $(BIND)\dumpe.* 2>nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+$(OBJD)\dumpe.obj : dumpe.cpp
+
+$(BIND)\dumpe.exe : $(OBJD)\dumpe.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb $(OBJD)\dumpe.obj \
+ /link $(LINKFLAGS) $(LIBS) \
+ /subsystem:console
+
+$(OBJD)\dumpe.bsc : $(OBJD)\dumpe.obj
+ bscmake /v /n /o $@ $(OBJD)\dumpe.sbr
+
+##############################################################################
+
+test: $(BIND)\dumpe.exe
+ $(BIND)\dumpe.exe $(BIND)\slept.dll
+
+testx: $(BIND)\dumpe.exe
+ cd $(MAKEDIR)\..\..\src
+ nmake
+ cd $(MAKEDIR)
+ if exist $(SYSTEMROOT)\system32\browseui.dll $(BIND)\dumpe.exe browseui.dll
+
+################################################################# End of File.
diff --git a/ext/detours/samples/dumpe/dumpe.cpp b/ext/detours/samples/dumpe/dumpe.cpp
new file mode 100644
index 0000000..2eac099
--- /dev/null
+++ b/ext/detours/samples/dumpe/dumpe.cpp
@@ -0,0 +1,129 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (dumpe.cpp of dumpe.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#include <stdio.h>
+#include <stdlib.h>
+#include <windows.h>
+#include <ole2.h>
+#include <shellapi.h>
+#include "detours.h"
+
+//////////////////////////////////////////////////////////////////////////////
+//
+#ifndef NODEBUG
+#undef ASSERT
+VOID DetourAssertMessage(CONST PCHAR szMsg, CONST PCHAR szFile, DWORD nLine);
+
+#define ASSERT(x) \
+do { if (!(x)) { DetourAssertMessage(#x, __FILE__, __LINE__); DebugBreak(); }} while (0)
+ ;
+#undef ASSERTX
+#define ASSERTX(x) \
+do { if (!(x)) { DetourAssertMessage(#x, __FILE__, __LINE__); PCHAR p=(PCHAR)(x); *p = 1; }} while (0)
+ ;
+#else // NODEBUG
+#undef ASSERT
+#define ASSERT(x)
+#undef ASSERTX
+#define ASSERTX(x)
+#endif // NODEBUG
+//
+//////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////// Error Messages.
+//
+VOID DetourAssertMessage(CONST PCHAR szMsg, CONST PCHAR szFile, DWORD nLine)
+{
+ printf("ASSERT(%s) failed in %s, line %ld.", szMsg, szFile, nLine);
+}
+
+
+
+static BOOL CALLBACK ExportCallback(PVOID pContext,
+ ULONG nOrdinal,
+ LPCSTR pszSymbol,
+ PVOID pbTarget)
+{
+ (void)pContext;
+
+ printf(" %7ld %p %-30s\n",
+ (ULONG)nOrdinal,
+ pbTarget,
+ pszSymbol ? pszSymbol : "[NONAME]");
+ return TRUE;
+}
+
+BOOL DumpFile(PCHAR pszPath)
+{
+ HINSTANCE hInst = LoadLibraryA(pszPath);
+ if (hInst == NULL) {
+ printf("Unable to load %s: Error %ld\n", pszPath, GetLastError());
+ return FALSE;
+ }
+
+ printf("%s @ %p\n", pszPath, hInst);
+
+ PVOID pbEntry = DetourGetEntryPoint(hInst);
+ printf(" EntryPoint: %p\n", pbEntry);
+
+ printf(" Ordinal RVA Name\n");
+ DetourEnumerateExports(hInst, NULL, ExportCallback);
+
+ return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+void PrintUsage(void)
+{
+ printf("Usage:\n"
+ " dumpe [.dll files]\n"
+ "Misc. Options:\n"
+ " /? : Help screen.\n");
+}
+
+//////////////////////////////////////////////////////////////////////// main.
+//
+int CDECL main(int argc, char **argv)
+{
+ BOOL fNeedHelp = FALSE;
+
+ int arg = 1;
+ for (; arg < argc; arg++) {
+ if (argv[arg][0] == '-' || argv[arg][0] == '/') {
+ CHAR *argn = argv[arg] + 1;
+ CHAR *argp = argn;
+ while (*argp && *argp != ':')
+ argp++;
+ if (*argp == ':')
+ *argp++ = '\0';
+
+ switch (argn[0]) {
+
+ case '?': // Help.
+ fNeedHelp = TRUE;
+ break;
+
+ default:
+ fNeedHelp = TRUE;
+ printf("Bad argument: %s:%s\n", argn, argp);
+ break;
+ }
+ }
+ else {
+ DumpFile(argv[arg]);
+ }
+ }
+ if (fNeedHelp || argc == 1) {
+ PrintUsage();
+ return 1;
+ }
+ return 0;
+}
+
+// End of File
diff --git a/ext/detours/samples/dumpi/Makefile b/ext/detours/samples/dumpi/Makefile
new file mode 100644
index 0000000..641f86a
--- /dev/null
+++ b/ext/detours/samples/dumpi/Makefile
@@ -0,0 +1,47 @@
+##############################################################################
+##
+## Makefile for Detours Test Programs - Dump Imports
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+LIBS=$(LIBS) kernel32.lib
+
+all: dirs \
+ $(BIND)\dumpi.exe \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\dumpi.bsc \
+!ENDIF
+
+clean:
+ -del *~ 2>nul
+ -del $(BIND)\dumpi.* 2>nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+$(OBJD)\dumpi.obj : dumpi.cpp
+
+$(BIND)\dumpi.exe : $(OBJD)\dumpi.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb $(OBJD)\dumpi.obj \
+ /link $(LINKFLAGS) $(LIBS) \
+ /subsystem:console
+
+$(OBJD)\dumpi.bsc : $(OBJD)\dumpi.obj
+ bscmake /v /n /o $@ $(OBJD)\dumpi.sbr
+
+##############################################################################
+
+test: $(BIND)\dumpi.exe
+ $(BIND)\dumpi.exe $(BIND)\slept.dll $(BIND)\sleepold.exe
+
+################################################################# End of File.
diff --git a/ext/detours/samples/dumpi/dumpi.cpp b/ext/detours/samples/dumpi/dumpi.cpp
new file mode 100644
index 0000000..be63648
--- /dev/null
+++ b/ext/detours/samples/dumpi/dumpi.cpp
@@ -0,0 +1,270 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (dumpi.cpp of dumpi.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#include <stdio.h>
+#include <stdlib.h>
+#include <windows.h>
+#include <shellapi.h>
+#pragma warning(push)
+#if _MSC_VER > 1400
+#pragma warning(disable:6102 6103) // /analyze warnings
+#endif
+#include <strsafe.h>
+#pragma warning(pop)
+#include <detours.h>
+
+////////////////////////////////////////////////////////////// Error Messages.
+//
+VOID AssertMessage(PCSTR szMsg, PCSTR szFile, DWORD nLine)
+{
+ printf("ASSERT(%s) failed in %s, line %ld.", szMsg, szFile, nLine);
+}
+
+#define ASSERT(x) \
+do { if (!(x)) { AssertMessage(#x, __FILE__, __LINE__); DebugBreak(); }} while (0)
+ ;
+
+//////////////////////////////////////////////////////////////////////////////
+//
+static CHAR s_szFile[MAX_PATH] = "\0";
+
+static BOOL CALLBACK ListFileCallback(_In_opt_ PVOID pContext,
+ _In_z_ LPCSTR pszOrigFile,
+ _In_z_ LPCSTR pszFile,
+ _Outptr_result_maybenull_ LPCSTR *ppszOutFile)
+{
+ (void)pContext;
+ (void)pszFile;
+
+ *ppszOutFile = NULL;
+
+ StringCchCopyA(s_szFile, sizeof(s_szFile), pszOrigFile);
+
+ PCHAR psz;
+ if ((psz = strchr(s_szFile, '.')) != NULL) {
+ *psz = '\0';
+ }
+ return TRUE;
+}
+
+BOOL CALLBACK ListSymbolCallback(_In_opt_ PVOID pContext,
+ _In_ ULONG nOrigOrdinal,
+ _In_ ULONG nOrdinal,
+ _Out_ ULONG *pnOutOrdinal,
+ _In_opt_z_ LPCSTR pszOrigSymbol,
+ _In_opt_z_ LPCSTR pszSymbol,
+ _Outptr_result_maybenull_ LPCSTR *ppszOutSymbol)
+{
+ (void)pContext;
+ (void)nOrdinal;
+ (void)pszSymbol;
+
+ *ppszOutSymbol = NULL;
+ *pnOutOrdinal = 0;
+
+ if (nOrigOrdinal != 0) {
+ printf(" %s::#%ld\n",
+ s_szFile, nOrigOrdinal);
+ }
+ else {
+ printf(" %s::%s\n",
+ s_szFile, pszOrigSymbol);
+ }
+
+ return TRUE;
+}
+
+BOOL DimpFile(PCHAR pszPath)
+{
+ BOOL bGood = TRUE;
+ HANDLE hOld = INVALID_HANDLE_VALUE;
+ PDETOUR_BINARY pBinary = NULL;
+
+
+ hOld = CreateFileA(pszPath,
+ GENERIC_READ,
+ FILE_SHARE_READ,
+ NULL,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL);
+
+ if (hOld == INVALID_HANDLE_VALUE) {
+ printf("%s: Failed to open input file with error: %ld\n",
+ pszPath, GetLastError());
+ bGood = FALSE;
+ goto end;
+ }
+
+ if ((pBinary = DetourBinaryOpen(hOld)) == NULL) {
+ printf("%s: DetourBinaryOpen failed: %ld\n", pszPath, GetLastError());
+ goto end;
+ }
+
+ if (hOld != INVALID_HANDLE_VALUE) {
+ CloseHandle(hOld);
+ hOld = INVALID_HANDLE_VALUE;
+ }
+
+ printf("%s:\n", pszPath);
+ if (!DetourBinaryEditImports(pBinary,
+ NULL,
+ NULL,
+ ListFileCallback,
+ ListSymbolCallback,
+ NULL)) {
+
+ printf("%s: DetourBinaryEditImports failed: %ld\n", pszPath, GetLastError());
+ }
+
+ DetourBinaryClose(pBinary);
+ pBinary = NULL;
+
+ end:
+ if (pBinary) {
+ DetourBinaryClose(pBinary);
+ pBinary = NULL;
+ }
+ if (hOld != INVALID_HANDLE_VALUE) {
+ CloseHandle(hOld);
+ hOld = INVALID_HANDLE_VALUE;
+ }
+ return bGood;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+int DimpArgument(char *dir, char *argp, int fDoSubs)
+{
+ //////////////////////////////////////////////////////////////////////////
+
+ WIN32_FIND_DATAA wfd;
+ HANDLE hFind = NULL;
+ char name[1024];
+ int nFound = 0;
+
+ StringCchCopyA(name, sizeof(name), dir ? dir : "");
+ StringCchCatA(name, sizeof(name), argp);
+
+ hFind = FindFirstFileA(name, &wfd);
+ if (hFind != INVALID_HANDLE_VALUE) {
+ do {
+ if (!(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
+ StringCchCopyA(name, sizeof(name), dir ? dir : "");
+ StringCchCatA(name, sizeof(name), wfd.cFileName);
+
+ nFound += DimpFile(name);
+ }
+ } while (FindNextFileA(hFind, &wfd));
+ FindClose(hFind);
+ }
+
+ if (fDoSubs) {
+ StringCchCopyA(name, sizeof(name), dir ? dir : "");
+ StringCchCatA(name, sizeof(name), "*");
+
+ hFind = FindFirstFileA(name, &wfd);
+ if (hFind == INVALID_HANDLE_VALUE)
+ return nFound;
+
+ do {
+ if ((wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&
+ wfd.cFileName[0] != '.') {
+
+ StringCchCopyA(name, sizeof(name), dir ? dir : "");
+ StringCchCatA(name, sizeof(name), wfd.cFileName);
+ StringCchCatA(name, sizeof(name), "\\");
+
+ nFound += DimpArgument(name, argp, fDoSubs);
+ }
+ } while (FindNextFileA(hFind, &wfd));
+ FindClose(hFind);
+ }
+ return nFound;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+//
+void PrintUsage(void)
+{
+ printf("Usage:\n"
+ " dimp [options] binary_files\n"
+ "Options:\n"
+ " /s : Recurse through subdirectories.\n"
+ " /? : This help screen.\n"
+ "Examples:\n"
+ " dimp /s *.exe\n"
+ "");
+}
+
+//////////////////////////////////////////////////////////////////////// main.
+//
+int CDECL main(int argc, char **argv)
+{
+ BOOL fNeedHelp = FALSE;
+ BOOL fSubdirs = FALSE;
+
+ int arg = 1;
+ for (; arg < argc; arg++) {
+ if (argv[arg][0] == '-' || argv[arg][0] == '/') {
+ CHAR *argn = argv[arg] + 1;
+ CHAR *argp = argn;
+ while (*argp && *argp != ':')
+ argp++;
+ if (*argp == ':')
+ *argp++ = '\0';
+
+ switch (argn[0]) {
+
+ case 's': // Do Subdirectories.
+ case 'S':
+ fSubdirs = TRUE;
+ break;
+
+ case '?': // Help.
+ fNeedHelp = TRUE;
+ break;
+
+ default:
+ fNeedHelp = TRUE;
+ printf("Bad argument: %s:%s\n", argn, argp);
+ break;
+ }
+ }
+ else {
+ CHAR szDir[MAX_PATH] = "";
+ CHAR szArg[MAX_PATH] = "";
+ PCHAR pszDir;
+
+ if ((pszDir = strrchr(argv[arg], '\\')) != NULL) {
+ *pszDir++ = '\0';
+ StringCchCopyA(szArg, sizeof(szArg), pszDir);
+ StringCchCopyA(szDir, sizeof(szDir), argv[arg]);
+ StringCchCatA(szDir, sizeof(szDir), "\\");
+ }
+ else {
+ if (GetCurrentDirectoryA(sizeof(szDir), szDir) > 3) {
+ StringCchCatA(szDir, sizeof(szDir), "\\");
+ }
+ StringCchCopyA(szArg, sizeof(szArg), argv[arg]);
+ }
+
+ DimpArgument(szDir, szArg, fSubdirs);
+ }
+ }
+ if (argc == 1) {
+ fNeedHelp = TRUE;
+ }
+ if (fNeedHelp) {
+ PrintUsage();
+ return 1;
+ }
+ return 0;
+}
+
+// End of File
diff --git a/ext/detours/samples/dynamic_alloc/Makefile b/ext/detours/samples/dynamic_alloc/Makefile
new file mode 100644
index 0000000..3e22279
--- /dev/null
+++ b/ext/detours/samples/dynamic_alloc/Makefile
@@ -0,0 +1,77 @@
+##############################################################################
+##
+## Makefile for Detours Test Programs.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+# This test is x86 only
+!IF "$(DETOURS_TARGET_PROCESSOR)" == "X86" || "$(DETOURS_TARGET_PROCESSOR)" == "X64"
+
+TARGET_NAME=dalloc
+CFLAGS=\
+ $(CFLAGS)\
+ /EHsc\
+
+LIBS=$(LIBS)\
+ user32.lib\
+
+all: dirs $(BIND)\$(TARGET_NAME).exe
+
+##############################################################################
+
+clean:
+ -del $(BIND)\$(TARGET_NAME).* 2>nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+##############################################################################
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+!IF "$(DETOURS_TARGET_PROCESSOR)" == "X64"
+$(OBJD)\asm.obj : x64.asm
+ $(ASM) $(AFLAGS) /Fl$(OBJD)\x64.lst /Fo$(OBJD)\asm.obj x64.asm
+!ELSE
+$(OBJD)\asm.obj : x86.asm
+ $(ASM) $(AFLAGS) /Fl$(OBJD)\x86.lst /Fo$(OBJD)\asm.obj x86.asm
+!ENDIF
+
+$(OBJD)\main.obj : main.cpp
+
+$(BIND)\$(TARGET_NAME).exe : $(OBJD)\main.obj $(OBJD)\asm.obj $(DEPS)
+ link\
+ /SUBSYSTEM:CONSOLE\
+ $(LINKFLAGS)\
+ $(LIBS)\
+ /PDB:"$(@R).pdb"\
+ /OUT:"$@"\
+ $**\
+
+##############################################################################
+
+test: all
+ $(BIND)\$(TARGET_NAME).exe
+
+##############################################################################
+
+!ELSE
+
+all:
+ @echo The platform `$(DETOURS_TARGET_PROCESSOR)` is not supported. Skipping.
+test:
+ @echo The platform `$(DETOURS_TARGET_PROCESSOR)` is not supported. Skipping.
+clean:
+realclean:
+
+!ENDIF
+
+################################################################# End of File.
diff --git a/ext/detours/samples/dynamic_alloc/main.cpp b/ext/detours/samples/dynamic_alloc/main.cpp
new file mode 100644
index 0000000..a61232f
--- /dev/null
+++ b/ext/detours/samples/dynamic_alloc/main.cpp
@@ -0,0 +1,194 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+// This is a test program to test the DetourAllocateRegionWithinJumpBounds
+// API, that dynamically allocates an executable region adjacent to a given
+// address so that we can use the region as a detour function.
+//
+// This test program detours the function `target_function`. Instead of
+// simply specifying a code segment as a detour function, we specify a
+// dynamically-allocated region into which we copy the code, altering the
+// return value, from the assembly function `CodeTemplate` as a template.
+//
+#define _CRT_SECURE_NO_WARNINGS
+#include <iostream>
+#include <functional>
+#include <assert.h>
+#include <windows.h>
+#include <detours.h>
+
+extern "C" {
+ void *CodeTemplate();
+ void *CodeTemplate_End();
+}
+
+void Log(PCSTR format, ...) {
+ char linebuf[1024];
+ va_list v;
+ va_start(v, format);
+ wvsprintfA(linebuf, format, v);
+ va_end(v);
+ OutputDebugStringA(linebuf);
+}
+
+// This is a target function to be detoured. When detoured, it's expected to
+// return a non-nullptr value.
+void *target_function() {
+ std::cout << '+' << __FUNCTION__ << std::endl;
+ return nullptr;
+}
+
+// Helper function to sandwich a given function between `DetourTransactionBegin`
+// and `DetourTransactionCommit`/`DetourTransactionAbort`.
+bool DetourTransaction(std::function<bool()> callback) {
+ LONG status = DetourTransactionBegin();
+ if (status != NO_ERROR) {
+ Log("DetourTransactionBegin failed with %08x\n", status);
+ return status == NO_ERROR;
+ }
+
+ if (callback()) {
+ status = DetourTransactionCommit();
+ if (status != NO_ERROR) {
+ Log("DetourTransactionCommit failed with %08x\n", status);
+ }
+ }
+ else {
+ status = DetourTransactionAbort();
+ if (status == NO_ERROR) {
+ Log("Aborted transaction.\n");
+ }
+ else {
+ Log("DetourTransactionAbort failed with %08x\n", status);
+ }
+ }
+ return status == NO_ERROR;
+}
+
+// This class manages one dynamically-allocated region that is allocated by
+// the Detours API `DetourAllocateRegionWithinJumpBounds`, to which we can
+// push binary data sequentially to use it as a detour function.
+class CodeRegionFactory final {
+ template <typename T>
+ static const T *at(const void *base, uint32_t offset) {
+ return
+ reinterpret_cast<const T*>(
+ reinterpret_cast<const uint8_t*>(base) + offset);
+ }
+
+ template <typename T>
+ static T *at(void *base, uint32_t offset) {
+ return
+ reinterpret_cast<T*>(
+ reinterpret_cast<uint8_t*>(base) + offset);
+ }
+
+ void *region_ = nullptr;
+ uint8_t *current_ = nullptr,
+ *current_end_ = nullptr;
+
+public:
+ CodeRegionFactory(const void *source) {
+ DWORD new_region_size = 0;
+ auto new_region_address =
+ DetourAllocateRegionWithinJumpBounds(source, &new_region_size);
+ if (new_region_address) {
+ region_ = current_ = at<uint8_t>(new_region_address, 0);
+ current_end_ = current_ + new_region_size;
+ }
+ else {
+ Log("Cannot find a region near %p\n", source);
+ }
+ }
+
+ ~CodeRegionFactory() {
+ if (region_
+ && !VirtualFree(region_, 0, MEM_RELEASE)) {
+ Log("VirtualFree failed - %08x\n", GetLastError());
+ }
+ }
+
+ // Pushes binary data to the region if there is enough space, and returns
+ // the start address of a copy in the region if succeeded.
+ void *PushTemplate(const void *start,
+ const void *end) {
+ auto diff = at<uint8_t>(end, 0) - at<uint8_t>(start, 0);
+ if (diff < 0 || current_ + diff > current_end_)
+ return nullptr;
+ auto start_pos = current_;
+ memcpy(start_pos, start, diff);
+ current_ += diff;
+ return start_pos;
+ }
+};
+
+int main(int, char**) {
+ std::cout << "1. target_function() without Detour" << std::endl;
+ auto ret = target_function();
+ std::cout << ret << std::endl;
+ assert(!ret);
+
+ CodeRegionFactory factory(target_function);
+
+ void *detour_destination,
+ *detour_target = reinterpret_cast<void*>(target_function);
+
+ // Fill the allocated page with as many instances as possible of the code
+ // template, and pick the last instance
+ while (auto p = factory.PushTemplate(CodeTemplate,
+ CodeTemplate_End)) {
+ detour_destination = p;
+ }
+
+ bool is_detoured = false;
+ DetourTransaction([&]() {
+ PDETOUR_TRAMPOLINE trampoline = nullptr;
+ void *target = nullptr,
+ *detour = nullptr;
+ auto status = DetourAttachEx(&detour_target,
+ detour_destination,
+ &trampoline,
+ &target,
+ &detour);
+ if (status != NO_ERROR) {
+ Log("DetourAttachEx failed - %08x\n", status);
+ return false;
+ }
+ is_detoured = true;
+ std::cout
+ << "detour: " << target << " --> " << detour
+ << " (trampoline: " << trampoline << " )"
+ << std::endl;
+ return true;
+ });
+
+ // Attach failed for some reason. Bail out.
+ if (!is_detoured)
+ return 1;
+
+ std::cout << "2. target_function() with Detour" << std::endl;
+ ret = target_function();
+ std::cout << ret << std::endl;
+ assert(ret); // The return value is cracked by the detour function
+
+ DetourTransaction([&]() {
+ auto status = DetourDetach(&detour_target, detour_destination);
+ if (status != NO_ERROR) {
+ Log("DetourDetach failed - %08x\n", status);
+ return false;
+ }
+ return true;
+ });
+
+ std::cout << "3. target_function() without Detour" << std::endl;
+ ret = target_function();
+ std::cout << ret << std::endl;
+ assert(!ret);
+
+ return 0;
+} \ No newline at end of file
diff --git a/ext/detours/samples/dynamic_alloc/x64.asm b/ext/detours/samples/dynamic_alloc/x64.asm
new file mode 100644
index 0000000..d11be8a
--- /dev/null
+++ b/ext/detours/samples/dynamic_alloc/x64.asm
@@ -0,0 +1,25 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Detours Test Program
+;;
+;; Microsoft Research Detours Package
+;;
+;; Copyright (c) Microsoft Corporation. All rights reserved.
+;;
+PUBLIC CodeTemplate
+PUBLIC CodeTemplate_End
+
+_TEXT SEGMENT
+
+CodeTemplate PROC
+ nop
+ nop
+ mov rax, 0deadbeef00000000h
+ nop
+ ret
+CodeTemplate_End::
+CodeTemplate ENDP
+
+_TEXT ENDS
+
+END
diff --git a/ext/detours/samples/dynamic_alloc/x86.asm b/ext/detours/samples/dynamic_alloc/x86.asm
new file mode 100644
index 0000000..f188e8b
--- /dev/null
+++ b/ext/detours/samples/dynamic_alloc/x86.asm
@@ -0,0 +1,31 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;; Detours Test Program
+;;
+;; Microsoft Research Detours Package
+;;
+;; Copyright (c) Microsoft Corporation. All rights reserved.
+;;
+.386
+.model flat,C
+
+PUBLIC CodeTemplate
+PUBLIC CodeTemplate_End
+
+_TEXT SEGMENT
+
+CodeTemplate PROC
+ nop
+ nop
+ nop
+ mov eax, 0deadbeefh
+ nop
+ nop
+ nop
+ ret
+CodeTemplate_End::
+CodeTemplate ENDP
+
+_TEXT ENDS
+
+END
diff --git a/ext/detours/samples/echo/Makefile b/ext/detours/samples/echo/Makefile
new file mode 100644
index 0000000..366d739
--- /dev/null
+++ b/ext/detours/samples/echo/Makefile
@@ -0,0 +1,108 @@
+##############################################################################
+##
+## Detours Test Program
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+LIBS=$(LIBS) kernel32.lib
+
+##############################################################################
+
+all: dirs \
+ $(BIND)\echofx$(DETOURS_BITS).dll \
+ $(BIND)\echonul.exe \
+ \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\echofx$(DETOURS_BITS).bsc \
+ $(OBJD)\echonul.bsc \
+!ENDIF
+ option
+
+##############################################################################
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+$(OBJD)\echofx.obj : echofx.cpp
+
+$(OBJD)\echofx.res : echofx.rc
+
+$(BIND)\echofx$(DETOURS_BITS).dll $(BIND)\echofx$(DETOURS_BITS).lib: \
+ $(OBJD)\echofx.obj $(OBJD)\echofx.res $(DEPS) $(BIND)\echonul.lib
+ cl /LD $(CFLAGS) /Fe$@ /Fd$(@R).pdb \
+ $(OBJD)\echofx.obj $(OBJD)\echofx.res \
+ /link $(LINKFLAGS) /subsystem:console \
+ /export:DetourFinishHelperProcess,@1,NONAME \
+ /export:Mine_Echo \
+ $(LIBS) $(BIND)\echonul.lib
+
+$(OBJD)\echofx$(DETOURS_BITS).bsc : $(OBJD)\echofx.obj
+ bscmake /v /n /o $@ $(OBJD)\echofx.sbr
+
+$(OBJD)\echonul.obj : echonul.cpp
+$(OBJD)\main.obj : main.cpp
+
+$(BIND)\echonul.exe $(BIND)\echonul.lib: $(OBJD)\main.obj $(OBJD)\echonul.obj
+ cl $(CFLAGS) /Zl /Fe$(BIND)\echonul.exe /Fd$(@R).pdb \
+ $(OBJD)\main.obj $(OBJD)\echonul.obj \
+ /link $(LINKFLAGS) \
+ /export:Echo \
+ /subsystem:console
+
+$(OBJD)\echonul.bsc : echonul.obj
+ bscmake /v /n /o $@ echonul.sbr
+
+##############################################################################
+
+clean:
+ -del *~ 2>nul
+ -del $(BIND)\echofx*.* 2>nul
+ -del $(BIND)\echonul.* 2>nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+############################################### Install non-bit-size binaries.
+
+!IF "$(DETOURS_OPTION_PROCESSOR)" != ""
+
+$(OPTD)\echofx$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\echofx$(DETOURS_OPTION_BITS).pdb:
+
+$(BIND)\echofx$(DETOURS_OPTION_BITS).dll : $(OPTD)\echofx$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\echofx$(DETOURS_OPTION_BITS).pdb : $(OPTD)\echofx$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+
+option: \
+ $(BIND)\echofx$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\echofx$(DETOURS_OPTION_BITS).pdb \
+
+!ELSE
+
+option:
+
+!ENDIF
+
+##############################################################################
+
+test: all
+ @echo -------- Should echo nothing. --------------------------------------
+ -$(BIND)\echonul.exe
+ @echo -------- Should echo Hello World. ----------------------------------
+ -$(BIND)\withdll.exe -d:$(BIND)\echofx$(DETOURS_BITS).dll $(BIND)\echonul.exe
+ @echo.
+
+testd: all
+ @echo.
+ -windbg -o -g -G $(BIND)\withdll.exe -d:$(BIND)\echofx$(DETOURS_BITS).dll $(BIND)\echonul.exe
+ @echo.
+
+################################################################# End of File.
diff --git a/ext/detours/samples/echo/echofx.cpp b/ext/detours/samples/echo/echofx.cpp
new file mode 100644
index 0000000..73b5a7f
--- /dev/null
+++ b/ext/detours/samples/echo/echofx.cpp
@@ -0,0 +1,60 @@
+//
+//
+//
+#include <windows.h>
+#include <detours.h>
+#include <stdio.h>
+
+int WINAPI Echo(PCSTR pszMsg);
+
+static int (WINAPI * Real_Echo)(PCSTR pszMsg) = Echo;
+
+int WINAPI Mine_Echo(PCSTR pszMsg)
+{
+ printf("Echo(%s)\n", pszMsg);
+ return Real_Echo(pszMsg);
+}
+
+BOOL WINAPI DllMain(HINSTANCE hinst, DWORD dwReason, LPVOID reserved)
+{
+ LONG error;
+ (void)hinst;
+ (void)reserved;
+
+ if (DetourIsHelperProcess()) {
+ return TRUE;
+ }
+
+ if (dwReason == DLL_PROCESS_ATTACH) {
+ DetourRestoreAfterWith();
+
+ printf("echofx" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
+ " Starting.\n");
+ fflush(stdout);
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)Real_Echo, Mine_Echo);
+ error = DetourTransactionCommit();
+
+ if (error == NO_ERROR) {
+ printf("echofx" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
+ " Detoured Echo().\n");
+ }
+ else {
+ printf("echofx" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
+ " Error detouring Echo(): %ld\n", error);
+ }
+ }
+ else if (dwReason == DLL_PROCESS_DETACH) {
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourDetach(&(PVOID&)Real_Echo, Mine_Echo);
+ error = DetourTransactionCommit();
+
+ printf("echofx" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
+ " Removed Echo() (result=%ld)\n", error);
+ fflush(stdout);
+ }
+ return TRUE;
+}
diff --git a/ext/detours/samples/echo/echofx.rc b/ext/detours/samples/echo/echofx.rc
new file mode 100644
index 0000000..0afd53c
--- /dev/null
+++ b/ext/detours/samples/echo/echofx.rc
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Version information for echofx.rc.
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include "detver.h"
+
+#define VER_INTERNALNAME_STR "echofx" DETOURS_STRINGIFY(DETOURS_BITS)
+#define VER_ORIGINALFILENAME_STR "echofx" DETOURS_STRINGIFY(DETOURS_BITS) ".dll"
+#define VER_FILEDESCRIPTION_STR "Detours Echo Interception Module"
+#define VER_COMPANYNAME_STR "Microsoft Corporation"
+
+#include "common.ver"
diff --git a/ext/detours/samples/echo/echonul.cpp b/ext/detours/samples/echo/echonul.cpp
new file mode 100644
index 0000000..c05777d
--- /dev/null
+++ b/ext/detours/samples/echo/echonul.cpp
@@ -0,0 +1,18 @@
+//
+//
+//
+#include <windows.h>
+
+int WINAPI Echo(PCSTR pszMsg)
+{
+ int sum = 0;
+ while (*pszMsg) {
+ sum = sum + *pszMsg++;
+ }
+ return sum;
+}
+
+int main()
+{
+ return 0;
+}
diff --git a/ext/detours/samples/echo/main.cpp b/ext/detours/samples/echo/main.cpp
new file mode 100644
index 0000000..0216875
--- /dev/null
+++ b/ext/detours/samples/echo/main.cpp
@@ -0,0 +1,24 @@
+//
+//
+//
+#include <windows.h>
+
+int WINAPI Echo(PCSTR pszMsg);
+
+extern "C" int __stdcall mainCRTStartup(HINSTANCE hInstance,
+ HINSTANCE hPrevInstance,
+ LPSTR lpCmdLine,
+ int nCmdShow
+ )
+{
+ (void)hInstance;
+ (void)hPrevInstance;
+ (void)lpCmdLine;
+ (void)nCmdShow;
+
+ Echo("Hello World");
+ Echo("Goodbye World");
+
+ return 0x99;
+}
+
diff --git a/ext/detours/samples/einst/Makefile b/ext/detours/samples/einst/Makefile
new file mode 100644
index 0000000..ea6fea7
--- /dev/null
+++ b/ext/detours/samples/einst/Makefile
@@ -0,0 +1,148 @@
+##############################################################################
+##
+## Makefile for Detours Test Programs.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+# ARM64 does not like base addresses below 4GB.
+# Append two extra zeros for it.
+#
+!if "$(DETOURS_TARGET_PROCESSOR)" == "ARM64"
+EDLL1X_BASE=0x710000000
+EDLL2X_BASE=0x720000000
+EDLL3X_BASE=0x730000000
+!else
+EDLL1X_BASE=0x7100000
+EDLL2X_BASE=0x7200000
+EDLL3X_BASE=0x7300000
+!endif
+
+LIBS=$(LIBS) kernel32.lib user32.lib
+
+all: dirs \
+ $(BIND)\edll1x$(DETOURS_BITS).dll \
+ $(BIND)\edll2x$(DETOURS_BITS).dll \
+ $(BIND)\edll3x$(DETOURS_BITS).dll \
+ $(BIND)\einst.exe \
+ \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\edll1x$(DETOURS_BITS).bsc \
+ $(OBJD)\edll2x$(DETOURS_BITS).bsc \
+ $(OBJD)\edll3x$(DETOURS_BITS).bsc \
+ $(OBJD)\einst.bsc \
+!ENDIF
+ option
+
+clean:
+ -del *~ 2>nul
+ -del $(BIND)\edll1x*.* 2>nul
+ -del $(BIND)\edll2x*.* 2>nul
+ -del $(BIND)\edll3x*.* 2>nul
+ -del $(BIND)\einst.* 2>nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+##############################################################################
+
+$(OBJD)\einst.obj : einst.cpp
+
+$(BIND)\einst.exe : $(OBJD)\einst.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb $(OBJD)\einst.obj \
+ /link $(LINKFLAGS) $(LIBS) \
+ $(BIND)\edll1x$(DETOURS_BITS).lib $(BIND)\edll2x$(DETOURS_BITS).lib $(BIND)\edll3x$(DETOURS_BITS).lib \
+ /subsystem:console /entry:WinMainCRTStartup
+
+$(OBJD)\einst.bsc : $(OBJD)\einst.obj
+ bscmake /v /n /o $@ $(OBJD)\einst.sbr
+
+$(OBJD)\edll1x.obj : edll1x.cpp
+
+$(BIND)\edll1x$(DETOURS_BITS).dll : $(OBJD)\edll1x.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb \
+ $(OBJD)\edll1x.obj /LD \
+ /link $(LINKFLAGS) $(LIBS) \
+ /subsystem:windows \
+ /base:$(EDLL1X_BASE)
+
+$(OBJD)\edll1x$(DETOURS_BITS).bsc : $(OBJD)\edll1x.obj
+ bscmake /v /n /o $@ $(OBJD)\edll1x.sbr
+
+$(OBJD)\edll2x.obj : edll2x.cpp
+
+$(BIND)\edll2x$(DETOURS_BITS).dll : $(OBJD)\edll2x.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb \
+ $(OBJD)\edll2x.obj /LD \
+ /link $(LINKFLAGS) $(LIBS) \
+ /subsystem:console \
+ /base:$(EDLL2X_BASE)
+
+$(OBJD)\edll2x$(DETOURS_BITS).bsc : $(OBJD)\edll2x.obj
+ bscmake /v /n /o $@ $(OBJD)\edll2x.sbr
+
+$(OBJD)\edll3x.obj : edll3x.cpp
+
+$(BIND)\edll3x$(DETOURS_BITS).dll : $(OBJD)\edll3x.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb \
+ $(OBJD)\edll3x.obj /LD \
+ /link $(LINKFLAGS) $(LIBS) \
+ /subsystem:console \
+ /base:$(EDLL3X_BASE)
+
+$(OBJD)\edll3x$(DETOURS_BITS).bsc : $(OBJD)\edll3x.obj
+ bscmake /v /n /o $@ $(OBJD)\edll3x.sbr
+
+############################################### Install non-bit-size binaries.
+
+!IF "$(DETOURS_OPTION_PROCESSOR)" != ""
+
+$(OPTD)\edll1x$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\edll1x$(DETOURS_OPTION_BITS).pdb:
+$(OPTD)\edll2x$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\edll2x$(DETOURS_OPTION_BITS).pdb:
+$(OPTD)\edll3x$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\edll3x$(DETOURS_OPTION_BITS).pdb:
+
+$(BIND)\edll1x$(DETOURS_OPTION_BITS).dll : $(OPTD)\edll1x$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\edll1x$(DETOURS_OPTION_BITS).pdb : $(OPTD)\edll1x$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\edll2x$(DETOURS_OPTION_BITS).dll : $(OPTD)\edll2x$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\edll2x$(DETOURS_OPTION_BITS).pdb : $(OPTD)\edll2x$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\edll3x$(DETOURS_OPTION_BITS).dll : $(OPTD)\edll3x$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\edll3x$(DETOURS_OPTION_BITS).pdb : $(OPTD)\edll3x$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+
+option: \
+ $(BIND)\edll1x$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\edll1x$(DETOURS_OPTION_BITS).pdb \
+ $(BIND)\edll2x$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\edll2x$(DETOURS_OPTION_BITS).pdb \
+ $(BIND)\edll3x$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\edll3x$(DETOURS_OPTION_BITS).pdb \
+
+!ELSE
+
+option:
+
+!ENDIF
+
+##############################################################################
+
+test: all
+ $(BIND)\einst.exe
+
+################################################################# End of File.
diff --git a/ext/detours/samples/einst/edll1x.cpp b/ext/detours/samples/einst/edll1x.cpp
new file mode 100644
index 0000000..ee0880f
--- /dev/null
+++ b/ext/detours/samples/einst/edll1x.cpp
@@ -0,0 +1,55 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (edll1x.cpp of edll1x.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#include <stdio.h>
+#include <windows.h>
+#include <detours.h>
+
+//////////////////////////////////////////////////////////////////// DLL Stuff
+//
+struct CPrivateStuff
+{
+ DETOUR_SECTION_HEADER header;
+ DETOUR_SECTION_RECORD record;
+ CHAR szMessage[32];
+};
+
+#pragma data_seg(".detour")
+
+static CPrivateStuff private_stuff = {
+ DETOUR_SECTION_HEADER_DECLARE(sizeof(CPrivateStuff)),
+ {
+ (sizeof(CPrivateStuff) - sizeof(DETOUR_SECTION_HEADER)),
+ 0,
+ { /* d9ab8a40-f4cc-11d1-b6d7-006097b010e3 */
+ 0xd9ab8a40,
+ 0xf4cc,
+ 0x11d1,
+ {0xb6, 0xd7, 0x00, 0x60, 0x97, 0xb0, 0x10, 0xe3}
+ }
+ },
+ "The First Dll!"
+};
+#pragma data_seg()
+
+__declspec(dllexport) VOID WINAPI EDll1Function(VOID)
+{
+ return;
+}
+
+__declspec(dllexport) ULONG WINAPI
+DllMain(HINSTANCE hInstance, DWORD dwReason, PVOID lpReserved)
+{
+ (void)hInstance;
+ (void)dwReason;
+ (void)lpReserved;
+
+ return TRUE;
+}
+
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/einst/edll2x.cpp b/ext/detours/samples/einst/edll2x.cpp
new file mode 100644
index 0000000..62a5abc
--- /dev/null
+++ b/ext/detours/samples/einst/edll2x.cpp
@@ -0,0 +1,55 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (edll2x.cpp of einst.exe/edll2x.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#include <stdio.h>
+#include <windows.h>
+#include <detours.h>
+
+//////////////////////////////////////////////////////////////////// DLL Stuff
+//
+struct CPrivateStuff
+{
+ DETOUR_SECTION_HEADER header;
+ DETOUR_SECTION_RECORD record;
+ CHAR szMessage[32];
+};
+
+#pragma data_seg(".detour")
+
+static CPrivateStuff private_stuff = {
+ DETOUR_SECTION_HEADER_DECLARE(sizeof(CPrivateStuff)),
+ {
+ (sizeof(CPrivateStuff) - sizeof(DETOUR_SECTION_HEADER)),
+ 0,
+ { /* d9ab8a40-f4cc-11d1-b6d7-006097b010e3 */
+ 0xd9ab8a40,
+ 0xf4cc,
+ 0x11d1,
+ {0xb6, 0xd7, 0x00, 0x60, 0x97, 0xb0, 0x10, 0xe3}
+ }
+ },
+ "The Second Dll!"
+};
+#pragma data_seg()
+
+__declspec(dllexport) VOID WINAPI EDll2Function(VOID)
+{
+ return;
+}
+
+__declspec(dllexport) ULONG WINAPI
+DllMain(HINSTANCE hInstance, DWORD dwReason, PVOID lpReserved)
+{
+ (void)hInstance;
+ (void)dwReason;
+ (void)lpReserved;
+
+ return TRUE;
+}
+
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/einst/edll3x.cpp b/ext/detours/samples/einst/edll3x.cpp
new file mode 100644
index 0000000..2693d00
--- /dev/null
+++ b/ext/detours/samples/einst/edll3x.cpp
@@ -0,0 +1,82 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (edll3x.cpp of einst.exe/edll3x.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#include <stdio.h>
+#include <windows.h>
+#include <detours.h>
+
+//////////////////////////////////////////////////////////////////// DLL Stuff
+//
+struct CPrivateStuffPart1
+{
+ DETOUR_SECTION_RECORD header;
+ CHAR szMessage[48];
+};
+
+struct CPrivateStuffPart2
+{
+ DETOUR_SECTION_RECORD header;
+ CHAR szMessage[64];
+};
+
+struct CPrivateStuff
+{
+ DETOUR_SECTION_HEADER header;
+ CPrivateStuffPart1 record1;
+ CPrivateStuffPart2 record2;
+};
+
+#pragma data_seg(".detour")
+
+static CPrivateStuff private_stuff = {
+ DETOUR_SECTION_HEADER_DECLARE(sizeof(CPrivateStuff)),
+ {
+ {
+ sizeof(CPrivateStuffPart1),
+ 0,
+ { /* d9ab8a41-f4cc-11d1-b6d7-006097b010e3 */
+ 0xd9ab8a41,
+ 0xf4cc,
+ 0x11d1,
+ {0xb6, 0xd7, 0x00, 0x60, 0x97, 0xb0, 0x10, 0xe3}
+ }
+ },
+ "The Third DLL Part One!"
+ },
+ {
+ {
+ sizeof(CPrivateStuffPart2),
+ 0,
+ { /* d9ab8a40-f4cc-11d1-b6d7-006097b010e3 */
+ 0xd9ab8a40,
+ 0xf4cc,
+ 0x11d1,
+ {0xb6, 0xd7, 0x00, 0x60, 0x97, 0xb0, 0x10, 0xe3}
+ }
+ },
+ "The Third DLL Part Two!"
+ }
+};
+#pragma data_seg()
+
+__declspec(dllexport) VOID WINAPI EDll3Function(VOID)
+{
+ return;
+}
+
+__declspec(dllexport) ULONG WINAPI
+DllMain(HINSTANCE hInstance, DWORD dwReason, PVOID lpReserved)
+{
+ (void)hInstance;
+ (void)dwReason;
+ (void)lpReserved;
+
+ return TRUE;
+}
+
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/einst/einst.cpp b/ext/detours/samples/einst/einst.cpp
new file mode 100644
index 0000000..e732a1f
--- /dev/null
+++ b/ext/detours/samples/einst/einst.cpp
@@ -0,0 +1,98 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (einst.cpp of einst.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#include <stdio.h>
+#include <windows.h>
+#include <detours.h>
+
+struct CPrivateStuff
+{
+ DETOUR_SECTION_HEADER header;
+ DETOUR_SECTION_RECORD record;
+ CHAR szMessage[32];
+};
+
+#ifdef INCLUDE_THIS
+#pragma data_seg(".detour")
+
+static CPrivateStuff private_stuff = {
+ DETOUR_SECTION_HEADER_DECLARE(sizeof(CPrivateStuff)),
+ {
+ (sizeof(CPrivateStuff) - sizeof(DETOUR_SECTION_HEADER)),
+ 0,
+ { /* d9ab8a40-f4cc-11d1-b6d7-006097b010e3 */
+ 0xd9ab8a40,
+ 0xf4cc,
+ 0x11d1,
+ {0xb6, 0xd7, 0x00, 0x60, 0x97, 0xb0, 0x10, 0xe3}
+ }
+ },
+ "The Application!"
+};
+#pragma data_seg()
+#endif
+
+GUID my_guid =
+{ /* d9ab8a40-f4cc-11d1-b6d7-006097b010e3 */
+ 0xd9ab8a40,
+ 0xf4cc,
+ 0x11d1,
+ {0xb6, 0xd7, 0x00, 0x60, 0x97, 0xb0, 0x10, 0xe3}
+};
+
+__declspec(dllimport) VOID WINAPI EDll1Function(VOID);
+__declspec(dllimport) VOID WINAPI EDll2Function(VOID);
+__declspec(dllimport) VOID WINAPI EDll3Function(VOID);
+
+void FindPayload(HINSTANCE hinst)
+{
+ CHAR szModuleName[256];
+ GetModuleFileNameA(hinst, szModuleName, ARRAYSIZE(szModuleName));
+ printf(" %p : %s\n", hinst, szModuleName);
+
+ ULONG cbData = 0;
+ PBYTE pbData = (PBYTE)DetourFindPayload(hinst, my_guid, &cbData);
+
+ if (pbData) {
+ printf(" %08p..%08p : %50.50s\n",
+ pbData,
+ pbData + cbData,
+ pbData);
+ }
+}
+
+int WINAPI WinMain(HINSTANCE hinst, HINSTANCE hprev, LPSTR lpszCmdLine, int nCmdShow)
+{
+ (void)hinst;
+ (void)hprev;
+ (void)lpszCmdLine;
+ (void)nCmdShow;
+
+ printf("Source .EXE:\n");
+ FindPayload(NULL);
+ printf("\n");
+
+ printf("DLL and EXE binaries loaded:\n");
+
+ EDll1Function();
+ EDll2Function();
+ EDll3Function();
+
+ for (HINSTANCE hiter = NULL; (hiter = DetourEnumerateModules(hiter)) != NULL;) {
+ FindPayload(hiter);
+ }
+
+ if ((PVOID)hinst == (PVOID)lpszCmdLine) {
+ DispatchMessage(NULL); // Force load of gdi32.dll
+ }
+
+ return 0;
+}
+
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/excep/Makefile b/ext/detours/samples/excep/Makefile
new file mode 100644
index 0000000..42f7d8c
--- /dev/null
+++ b/ext/detours/samples/excep/Makefile
@@ -0,0 +1,47 @@
+##############################################################################
+##
+## Makefile for Detours Test Programs.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+LIBS=$(LIBS) kernel32.lib
+
+all: dirs \
+ $(BIND)\excep.exe \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\excep.bsc
+!ENDIF
+
+clean:
+ -del *~ 2>nul
+ -del $(BIND)\excep.* 2>nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+$(OBJD)\excep.obj : excep.cpp
+$(OBJD)\firstexc.obj : firstexc.cpp
+
+$(BIND)\excep.exe : $(OBJD)\excep.obj $(OBJD)\firstexc.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb $(OBJD)\excep.obj $(OBJD)\firstexc.obj \
+ /link $(LINKFLAGS) $(LIBS) /subsystem:console /entry:WinMainCRTStartup
+
+$(OBJD)\excep.bsc : $(OBJD)\excep.obj
+ bscmake /v /n /o $@ $(OBJD)\excep.sbr
+
+##############################################################################
+
+test: $(BIND)\excep.exe
+ $(BIND)\excep.exe
+
+################################################################# End of File.
diff --git a/ext/detours/samples/excep/excep.cpp b/ext/detours/samples/excep/excep.cpp
new file mode 100644
index 0000000..488a489
--- /dev/null
+++ b/ext/detours/samples/excep/excep.cpp
@@ -0,0 +1,125 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// First Chance Exception Handling Test Program (excep.cpp of excep.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+// For more information on exception handling, see "A Crash Course on the
+// Depths of Win32 Structured Exception Handling," by Matt Pietrek in the
+// January 1997 issue of Microsoft Systems Journal.
+//
+#include <stdio.h>
+#include <windows.h>
+#include <detours.h>
+#include "firstexc.h"
+
+//////////////////////////////////////////////////////////////////////////////
+//
+static LPVOID s_pvData = NULL;
+static DWORD s_dwDataPerm = 0;
+
+static LONG ExceptCatch(LONG nTry, DWORD dwException, LPEXCEPTION_POINTERS pinfo)
+{
+ printf(" ExceptCatch(%ld, %08lx, %08lx)\n", nTry, dwException, (ULONG)pinfo);
+#ifdef INCLUDE_THIS
+ if (nTry == 0) {
+ return EXCEPTION_CONTINUE_EXECUTION;
+ }
+#endif
+ return EXCEPTION_EXECUTE_HANDLER;
+}
+
+static int BadCode(int nTry)
+{
+ printf(" BadCode(Try:%d)\n", nTry);
+ printf(" BadCode -> %ld\n", *(PULONG)s_pvData);
+ ((PULONG)s_pvData)[0] = 0;
+ printf(" BadCode -> %ld\n", *(PULONG)s_pvData);
+ ((PULONG)s_pvData)[-1] = 0;
+ printf(" BadCode -> %ld\n", *(PULONG)s_pvData);
+
+ return 0;
+}
+
+void safe(int nTry)
+{
+ __try {
+ printf(" try(%d)\n", nTry);
+ BadCode(nTry);
+ printf(" good(%d)\n", nTry);
+ } __except(ExceptCatch(nTry,
+ GetExceptionCode(),
+ GetExceptionInformation())) {
+ DWORD dwExcept = GetExceptionCode();
+
+ printf(" handler(%d) : %08lx\n", nTry, dwExcept);
+ }
+}
+
+void raw(int nTry)
+{
+ BadCode(nTry);
+}
+
+LONG WINAPI MyVirtualFaultFilter(PEXCEPTION_POINTERS pException)
+{
+ PEXCEPTION_RECORD pExceptRec = pException->ExceptionRecord;
+
+ if (pExceptRec->ExceptionCode == 0xc0000005) {
+ printf("-- Memory access exception.\n");
+ if (pExceptRec->NumberParameters >= 2 &&
+ pExceptRec->ExceptionInformation[1] >= (ULONG)s_pvData &&
+ pExceptRec->ExceptionInformation[1] <= (ULONG)s_pvData + sizeof(ULONG)) {
+
+ VirtualProtect(s_pvData, sizeof(ULONG), PAGE_READWRITE, &s_dwDataPerm);
+ printf("-- Changed permissions.\n");
+ return EXCEPTION_CONTINUE_EXECUTION;
+ }
+ }
+ return EXCEPTION_CONTINUE_SEARCH;
+}
+
+int WINAPI WinMain(HINSTANCE hinst, HINSTANCE hprev, LPSTR lpszCmdLine, int nCmdShow)
+{
+ (void)hinst;
+ (void)hprev;
+ (void)lpszCmdLine;
+ (void)nCmdShow;
+
+ s_pvData = VirtualAlloc(NULL, sizeof(ULONG), MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE);
+ if (s_pvData == NULL) {
+ printf("VirtualAlloc failed: %ld\n", GetLastError());
+ return 0;
+ }
+ *(PULONG)s_pvData = 1;
+
+ VirtualProtect(s_pvData, sizeof(ULONG), PAGE_READONLY, &s_dwDataPerm);
+
+ DetourFirstChanceExceptionFilter(MyVirtualFaultFilter);
+
+ printf("main\n");
+ printf("--------------------------------------------------\n");
+ int nTry = 0;
+ for (; nTry < 1; nTry++) {
+ // safe(nTry);
+ }
+ printf("-- safe ------------------------------------------\n");
+ safe(nTry);
+ VirtualProtect(s_pvData, sizeof(ULONG), PAGE_READWRITE, &s_dwDataPerm);
+ *(PULONG)s_pvData = 1;
+ VirtualProtect(s_pvData, sizeof(ULONG), PAGE_READONLY, &s_dwDataPerm);
+
+ printf("-- raw -------------------------------------------\n");
+ printf("*\n");
+ printf("* NB: The second attempt to write will fail because it isn't handled.\n");
+ printf("*\n");
+ raw(nTry);
+ printf("--------------------------------------------------\n");
+ printf("exit\n");
+
+ return 0;
+}
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/excep/firstexc.cpp b/ext/detours/samples/excep/firstexc.cpp
new file mode 100644
index 0000000..4222ba8
--- /dev/null
+++ b/ext/detours/samples/excep/firstexc.cpp
@@ -0,0 +1,191 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (firstexc.cpp of firstexc.lib)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+// For more information on exception handling, see "A Crash Course on the
+// Depths of Win32 Structured Exception Handling," by Matt Pietrek in the
+// January 1997 issue of Microsoft Systems Journal.
+//
+#include <stdio.h>
+#include <windows.h>
+#include "detours.h"
+#include "firstexc.h"
+
+#if _MSC_VER > 1000
+#pragma warning(disable: 4740)
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+//
+static BOOL s_bExceptionDetourInstalled = FALSE;
+static LPTOP_LEVEL_EXCEPTION_FILTER s_pFirstChanceFilter = NULL;
+
+ULONG (NTAPI *Real_NtContinue)(IN PCONTEXT ContextRecord,
+ IN BOOLEAN TestAlerts) = NULL;
+
+VOID (NTAPI *Real_KiUserExceptionDispatcher)(IN PEXCEPTION_RECORD ExceptionRecord,
+ IN PCONTEXT ContextFrame) = NULL;
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// This function effectively removes all try..catch frames for the current
+// stack. It forces all exceptions to be treated as unhandled exceptions.
+//
+#pragma warning(push)
+#pragma warning(disable: 4733)
+static VOID WINAPI RemoveAllExceptionHandlers(VOID)
+{
+ // The basic, OS defined exception frame
+ struct EXCEPTION_REGISTRATION
+ {
+ EXCEPTION_REGISTRATION* prev;
+ FARPROC handler;
+ };
+
+ EXCEPTION_REGISTRATION * pVCExcRec = NULL;
+ EXCEPTION_REGISTRATION * pLastGood = NULL;
+
+ __asm mov eax, FS:[0];
+ __asm mov [pVCExcRec], eax;
+
+ for (pLastGood = pVCExcRec; (ULONG)pVCExcRec != ~0ul; ) {
+ if ((ULONG)pVCExcRec >= 0x30000000)
+ break;
+
+ pLastGood = pVCExcRec;
+ pVCExcRec = (EXCEPTION_REGISTRATION *)(pVCExcRec->prev);
+ }
+
+ __asm mov eax, [pLastGood];
+ __asm mov FS:[0], eax;
+}
+#pragma warning(pop)
+
+//////////////////////////////////////////////////////////////////////////////
+// Routine Description:
+//
+// This routine is entered on return from kernel mode to dispatch a user
+// mode exception. If a frame based handler handles the exception, then
+// the execution is continued. Else last chance processing is performed.
+//
+// NOTE: This procedure is not called, but rather dispatched to.
+// It depends on there not being a return address on the stack
+// (assumption w.r.t. argument offsets.)
+//
+// Arguments:
+// ExceptionRecord (esp+0) - Supplies a pointer to an exception record.
+// ContextRecord (esp+4) - Supplies a pointer to a context frame.
+//
+// Return Value:
+// None.
+//
+static VOID __declspec(naked) NTAPI
+Detour_KiUserExceptionDispatcher(PEXCEPTION_RECORD pExceptRec,
+ CONTEXT *pContext)
+{
+ __asm {
+ xor eax, eax ; // Create fake return address on stack.
+ push eax ; // (Generally, we are called by the kernel.)
+
+ push ebp ; // Prolog
+ mov ebp, esp ;
+ sub esp, __LOCAL_SIZE ;
+ }
+
+ LPTOP_LEVEL_EXCEPTION_FILTER pFirstChanceFilter;
+ EXCEPTION_POINTERS ep;
+ DWORD dwReturn;
+ DWORD dwError;
+
+ ep.ExceptionRecord = pExceptRec;
+ ep.ContextRecord = pContext;
+ pFirstChanceFilter = s_pFirstChanceFilter;
+ dwReturn = EXCEPTION_CONTINUE_SEARCH;
+ dwError = 0;
+
+ if (s_pFirstChanceFilter) {
+ dwReturn = pFirstChanceFilter(&ep);
+ }
+
+ if (dwReturn == EXCEPTION_CONTINUE_EXECUTION) {
+ dwError = Real_NtContinue(pContext, 0);
+ // This call should *NEVER* return. If it does, we want to fail to the debugger.
+ RemoveAllExceptionHandlers();
+ }
+
+ if (dwReturn == EXCEPTION_EXECUTE_HANDLER) { // Special: Call debugger.
+ RemoveAllExceptionHandlers();
+ }
+
+ __asm {
+ mov ebx, pExceptRec ;
+ mov ecx, pContext ;
+ push ecx ;
+ push ebx ;
+ mov eax, [Real_KiUserExceptionDispatcher];
+ jmp eax ;
+ ;
+ ; The above code should never return.
+ ;
+ int 3 ; // Break!
+ ;
+ mov esp, ebp ; // Epilog
+ pop ebp ;
+ ret ;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// Set the first-chance exception filter.
+//
+// Returns the pointer to the last first-chance exception filter if there
+// was one. If this is the first first-chance exception filter, installs
+// the necessary detour and acquires the appropriate function pointers.
+// If the parameter is NULL, first-chance exception filtering is disabled.
+//
+// A first-chance exception filter should always return one of three
+// possible codes:
+//
+// EXCEPTION_CONTINUE_SEARCH:
+// The exception was not handled by this filter; continue the
+// search for the appropriate exception handler.
+//
+// EXCEPTION_CONTINUE_EXECUTION:
+// The exception was handled by this filter; continue execution
+// at the point were the exception was thrown.
+//
+// EXCEPTION_EXECUTE_HANDLER:
+// Drastic failure in the exception filter. Process the
+// exception as if no exception handlers were installed.
+// (i.e. Give the user a chance to invoke the debugger.)
+//
+LPTOP_LEVEL_EXCEPTION_FILTER WINAPI
+DetourFirstChanceExceptionFilter(LPTOP_LEVEL_EXCEPTION_FILTER pNewFirstChanceFilter)
+{
+ if (!s_bExceptionDetourInstalled) {
+ s_bExceptionDetourInstalled = TRUE;
+
+ Real_NtContinue = (ULONG (NTAPI *)(IN PCONTEXT, IN BOOLEAN))
+ DetourFindFunction("ntdll.dll", "NtContinue");
+ Real_KiUserExceptionDispatcher =
+ (VOID (NTAPI *)(IN PEXCEPTION_RECORD, IN PCONTEXT))
+ DetourFindFunction("ntdll.dll", "KiUserExceptionDispatcher");
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)Real_KiUserExceptionDispatcher,
+ Detour_KiUserExceptionDispatcher);
+ DetourTransactionCommit();
+ }
+
+ LPTOP_LEVEL_EXCEPTION_FILTER pOldFirstChanceFilter = s_pFirstChanceFilter;
+ s_pFirstChanceFilter = pNewFirstChanceFilter;
+ return pOldFirstChanceFilter;
+}
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/excep/firstexc.h b/ext/detours/samples/excep/firstexc.h
new file mode 100644
index 0000000..689c1b4
--- /dev/null
+++ b/ext/detours/samples/excep/firstexc.h
@@ -0,0 +1,21 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (firstexc.h of firstexc.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#pragma once
+#ifndef _FIRSTEXC_H_
+#define _FIRSTEXC_H_
+
+/////////////////////////////////////////////// First Chance Exception Filter.
+//
+LPTOP_LEVEL_EXCEPTION_FILTER WINAPI
+DetourFirstChanceExceptionFilter(LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelFilter);
+
+#endif // _FIRSTEXC_H_
+//
+//////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/findfunc/Makefile b/ext/detours/samples/findfunc/Makefile
new file mode 100644
index 0000000..2ea19dc
--- /dev/null
+++ b/ext/detours/samples/findfunc/Makefile
@@ -0,0 +1,178 @@
+##############################################################################
+##
+## Program to test DetourFindFunction.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+# ARM64 does not like base addresses below 4GB.
+# Append two extra zeros for it.
+#
+!if "$(DETOURS_TARGET_PROCESSOR)" == "ARM64"
+TARGET_BASE=0x190000000
+EXTEND_BASE=0x1a0000000
+!else
+TARGET_BASE=0x1900000
+EXTEND_BASE=0x1a00000
+!endif
+
+LIBS=$(LIBS) kernel32.lib
+
+##############################################################################
+
+all: dirs \
+ $(BIND)\target$(DETOURS_BITS).dll \
+ $(BIND)\extend$(DETOURS_BITS).dll \
+ $(BIND)\findfunc.exe \
+ $(BIND)\symtest.exe \
+ $(BIND)\dbghelp.dll \
+ \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\target$(DETOURS_BITS).bsc \
+ $(OBJD)\extend$(DETOURS_BITS).bsc \
+ $(OBJD)\findfunc.bsc \
+ $(OBJD)\symtest.bsc \
+!ENDIF
+ option
+
+##############################################################################
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+$(OBJD)\target.obj : target.cpp
+
+$(OBJD)\target.res : target.rc
+
+$(BIND)\target$(DETOURS_BITS).dll $(BIND)\target$(DETOURS_BITS).lib: \
+ $(OBJD)\target.obj $(OBJD)\target.res $(DEPS)
+ cl /LD $(CFLAGS) /Fe$(@R).dll /Fd$(@R).pdb \
+ $(OBJD)\target.obj $(OBJD)\target.res \
+ /link $(LINKFLAGS) /subsystem:console \
+ /export:Target \
+ /base:$(TARGET_BASE) \
+ $(LIBS)
+
+$(OBJD)\target$(DETOURS_BITS).bsc : $(OBJD)\target.obj
+ bscmake /v /n /o $@ $(OBJD)\target.sbr
+
+$(OBJD)\extend.obj : extend.cpp
+
+$(OBJD)\extend.res : extend.rc
+
+$(BIND)\extend$(DETOURS_BITS).dll $(BIND)\extend$(DETOURS_BITS).lib: \
+ $(OBJD)\extend.obj $(OBJD)\extend.res $(DEPS)
+ cl /LD $(CFLAGS) /Fe$(@R).dll /Fd$(@R).pdb \
+ $(OBJD)\extend.obj $(OBJD)\extend.res \
+ /link $(LINKFLAGS) /subsystem:console \
+ /export:DetourFinishHelperProcess,@1,NONAME \
+ /base:$(EXTEND_BASE) \
+ $(LIBS)
+
+$(OBJD)\extend$(DETOURS_BITS).bsc : $(OBJD)\extend.obj
+ bscmake /v /n /o $@ $(OBJD)\extend.sbr
+
+$(OBJD)\findfunc.obj : findfunc.cpp
+
+$(BIND)\findfunc.exe : $(OBJD)\findfunc.obj $(BIND)\target$(DETOURS_BITS).lib $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb $(OBJD)\findfunc.obj \
+ /link $(LINKFLAGS) $(LIBS) \
+ /subsystem:console /fixed:no $(BIND)\target$(DETOURS_BITS).lib
+
+$(OBJD)\findfunc.bsc : $(OBJD)\findfunc.obj
+ bscmake /v /n /o $@ $(OBJD)\findfunc.sbr
+
+$(OBJD)\symtest.obj : symtest.cpp
+
+$(BIND)\symtest.exe : $(OBJD)\symtest.obj $(BIND)\target$(DETOURS_BITS).lib $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb $(OBJD)\symtest.obj \
+ /link $(LINKFLAGS) $(LIBS) \
+ /subsystem:console /fixed:no $(BIND)\target$(DETOURS_BITS).lib
+
+$(OBJD)\symtest.bsc : $(OBJD)\symtest.obj
+ bscmake /v /n /o $@ $(OBJD)\symtest.sbr
+
+# We try to get the 64-bit dbghelp first because it is a lot more useful.
+$(BIND)\dbghelp.dll : {"$(PROGRAMFILES)\Debugging Tools for Windows 64-bit";$(PATH)}dbghelp.dll
+ -copy $** $(BIND)\dbghelp.dll
+
+##############################################################################
+
+clean:
+ -del *~ 2>nul
+ -del $(BIND)\target*.* $(BIND)\extend*.* 2>nul
+ -del $(BIND)\findfunc.* $(BIND)\symtest.* $(BIND)\dbghelp.dll 2>nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+############################################### Install non-bit-size binaries.
+
+!IF "$(DETOURS_OPTION_PROCESSOR)" != ""
+
+$(OPTD)\extend$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\extend$(DETOURS_OPTION_BITS).pdb:
+$(OPTD)\target$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\target$(DETOURS_OPTION_BITS).pdb:
+
+$(BIND)\extend$(DETOURS_OPTION_BITS).dll : $(OPTD)\extend$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\extend$(DETOURS_OPTION_BITS).pdb : $(OPTD)\extend$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\target$(DETOURS_OPTION_BITS).dll : $(OPTD)\target$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\target$(DETOURS_OPTION_BITS).pdb : $(OPTD)\target$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+
+option: \
+ $(BIND)\extend$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\extend$(DETOURS_OPTION_BITS).pdb \
+ $(BIND)\target$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\target$(DETOURS_OPTION_BITS).pdb \
+
+!ELSE
+
+option:
+
+!ENDIF
+
+##############################################################################
+
+verbose: all
+ cls
+ $(BIND)\symtest.exe
+
+test: all
+ @echo -------- Reseting test binaries to initial state. -----------------------
+ $(BIND)\setdll.exe -r $(BIND)\findfunc.exe
+ @echo.
+ @echo -------- Should not load extend$(DETOURS_BITS).dll--------------------------------------
+ $(BIND)\findfunc.exe
+ @echo.
+ @echo -------- Adding extend$(DETOURS_BITS).dll to findfunc.exe ------------------------------
+ $(BIND)\setdll.exe -d:$(BIND)\extend$(DETOURS_BITS).dll $(BIND)\findfunc.exe
+ @echo.
+ @echo -------- Should load extend$(DETOURS_BITS).dll statically ------------------------------
+ $(BIND)\findfunc.exe
+ @echo.
+ @echo -------- Removing extend$(DETOURS_BITS).dll from findfunc.exe --------------------------
+ $(BIND)\setdll.exe -r $(BIND)\findfunc.exe
+ @echo.
+ @echo -------- Should not load extend$(DETOURS_BITS).dll -------------------------------------
+ $(BIND)\findfunc.exe
+ @echo.
+ @echo -------- Should load extend$(DETOURS_BITS).dll dynamically using withdll.exe -----------
+ $(BIND)\withdll.exe -d:$(BIND)\extend$(DETOURS_BITS).dll $(BIND)\findfunc.exe
+ @echo.
+ @echo -------- Should list symbols using symtest.exe -----------
+ $(BIND)\symtest.exe
+ @echo.
+ @echo -------- Test completed. ------------------------------------------------
+
+################################################################# End of File.
diff --git a/ext/detours/samples/findfunc/extend.cpp b/ext/detours/samples/findfunc/extend.cpp
new file mode 100644
index 0000000..744a3ab
--- /dev/null
+++ b/ext/detours/samples/findfunc/extend.cpp
@@ -0,0 +1,152 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detour Test Program (extend.cpp of extend.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+// An example dynamically detouring a function.
+//
+#include <stdio.h>
+#include <windows.h>
+#include "detours.h"
+
+static LONG nExtends = 0;
+static LONG nInterns = 0;
+
+static DWORD (WINAPI * TrueTarget)(DWORD dwCount) = NULL;
+static DWORD (WINAPI * TrueHidden)(DWORD dwCount) = NULL;
+static int (WINAPI * TrueEntryPoint)(VOID) = NULL;
+
+// Extend is a detour for Target.
+static DWORD WINAPI Extend(DWORD dwCount)
+{
+ InterlockedIncrement(&nExtends);
+
+ printf("extend" DETOURS_STRINGIFY(DETOURS_BITS) ".dll: Extend (%ld) -> %ld.\n", dwCount, dwCount + 1000);
+ dwCount = TrueTarget(dwCount + 1000);
+ printf("extend" DETOURS_STRINGIFY(DETOURS_BITS) ".dll: Extend (.....) -> %ld.\n", dwCount);
+ return dwCount;
+}
+
+// Intern is a detour for Hidden.
+static DWORD WINAPI Intern(DWORD dwCount)
+{
+ InterlockedIncrement(&nInterns);
+
+ printf("extend" DETOURS_STRINGIFY(DETOURS_BITS) ".dll: Intern (%ld) -> %ld.\n", dwCount, dwCount + 10);
+ dwCount = TrueHidden(dwCount + 10);
+ printf("extend" DETOURS_STRINGIFY(DETOURS_BITS) ".dll: Intern (.....) -> %ld.\n", dwCount);
+ return dwCount;
+}
+
+static int WINAPI ExtendEntryPoint()
+{
+ // We couldn't call LoadLibrary in DllMain, so our functions here.
+ LONG error;
+
+ // We separate out the functions in the export table (Target)
+ // from the ones that require debug symbols (Hidden).
+ TrueTarget =
+ (DWORD (WINAPI *)(DWORD))
+ DetourFindFunction("target" DETOURS_STRINGIFY(DETOURS_BITS) ".dll", "Target");
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)TrueTarget, Extend);
+ error = DetourTransactionCommit();
+
+ if (error == NO_ERROR) {
+ printf("extend" DETOURS_STRINGIFY(DETOURS_BITS) ".dll: Detoured Target().\n");
+ }
+ else {
+ printf("extend" DETOURS_STRINGIFY(DETOURS_BITS) ".dll: Error detouring Target(): %ld\n", error);
+ }
+
+ // Now try to detour the functions requiring debug symbols.
+ TrueHidden =
+ (DWORD (WINAPI *)(DWORD))
+ DetourFindFunction("target" DETOURS_STRINGIFY(DETOURS_BITS) ".dll", "Hidden");
+ if (TrueHidden == NULL) {
+ error = GetLastError();
+ printf("extend" DETOURS_STRINGIFY(DETOURS_BITS) ".dll: TrueHidden = %p (error = %ld)\n", TrueHidden, error);
+ }
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)TrueHidden, Intern);
+ error = DetourTransactionCommit();
+
+ if (error == NO_ERROR) {
+ printf("extend" DETOURS_STRINGIFY(DETOURS_BITS) ".dll: Detoured Hidden().\n");
+ }
+ else {
+ printf("extend" DETOURS_STRINGIFY(DETOURS_BITS) ".dll: Error detouring Hidden(): %ld\n", error);
+ }
+
+ // Now let the application start executing.
+ printf("extend" DETOURS_STRINGIFY(DETOURS_BITS) ".dll: Calling EntryPoint\n");
+ fflush(stdout);
+
+ return TrueEntryPoint();
+}
+
+BOOL WINAPI DllMain(HINSTANCE hinst, DWORD dwReason, LPVOID reserved)
+{
+ LONG error;
+ (void)hinst;
+ (void)reserved;
+
+ if (DetourIsHelperProcess()) {
+ return TRUE;
+ }
+
+ if (dwReason == DLL_PROCESS_ATTACH) {
+ DetourRestoreAfterWith();
+
+ printf("extend" DETOURS_STRINGIFY(DETOURS_BITS) ".dll: Starting.\n");
+ fflush(stdout);
+
+ // NB: DllMain can't call LoadLibrary, so we hook the app entry point.
+
+ TrueEntryPoint = (int (WINAPI *)())DetourGetEntryPoint(NULL);
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)TrueEntryPoint, ExtendEntryPoint);
+ error = DetourTransactionCommit();
+
+ if (error == NO_ERROR) {
+ printf("extend" DETOURS_STRINGIFY(DETOURS_BITS) ".dll: Detoured EntryPoint().\n");
+ }
+ else {
+ printf("extend" DETOURS_STRINGIFY(DETOURS_BITS) ".dll: Error detouring EntryPoint(): %ld\n", error);
+ }
+ }
+ else if (dwReason == DLL_PROCESS_DETACH) {
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+
+ // Detach functions found from the export table.
+ if (TrueTarget != NULL) {
+ DetourDetach(&(PVOID&)TrueTarget, (PVOID)Extend);
+ }
+
+ // Detach functions found from debug symbols.
+ if (TrueHidden != NULL) {
+ DetourDetach(&(PVOID&)TrueHidden, (PVOID)Intern);
+ }
+
+ // Detach the entry point.
+ DetourDetach(&(PVOID&)TrueEntryPoint, ExtendEntryPoint);
+ error = DetourTransactionCommit();
+
+ printf("extend" DETOURS_STRINGIFY(DETOURS_BITS) ".dll: Removed Target() detours (%ld), %ld/%ld calls.\n",
+ error, nExtends, nInterns);
+
+ fflush(stdout);
+ }
+ return TRUE;
+}
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/findfunc/extend.rc b/ext/detours/samples/findfunc/extend.rc
new file mode 100644
index 0000000..a6e3f52
--- /dev/null
+++ b/ext/detours/samples/findfunc/extend.rc
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Version information for extend.rc.
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include "detver.h"
+
+#define VER_INTERNALNAME_STR "extend" DETOURS_STRINGIFY(DETOURS_BITS)
+#define VER_ORIGINALFILENAME_STR "extend" DETOURS_STRINGIFY(DETOURS_BITS) ".dll"
+#define VER_FILEDESCRIPTION_STR "Detours Dyanmic Interception Test Module"
+#define VER_COMPANYNAME_STR "Microsoft Corporation"
+
+#include "common.ver"
diff --git a/ext/detours/samples/findfunc/findfunc.cpp b/ext/detours/samples/findfunc/findfunc.cpp
new file mode 100644
index 0000000..3c7f15b
--- /dev/null
+++ b/ext/detours/samples/findfunc/findfunc.cpp
@@ -0,0 +1,35 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detour Test Program (findfunc.cpp of findfunc.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include <windows.h>
+#include <stdio.h>
+#include <detours.h>
+#include "target.h"
+
+int __cdecl main(void)
+{
+ printf("findfunc.exe: Starting.\n");
+ fflush(stdout);
+
+ printf("DLLs:\n");
+ for (HMODULE hModule = NULL; (hModule = DetourEnumerateModules(hModule)) != NULL;) {
+ CHAR szName[MAX_PATH] = { 0 };
+ GetModuleFileNameA(hModule, szName, sizeof(szName) - 1);
+ printf(" %p: %s\n", hModule, szName);
+ }
+
+ DWORD dwCount = 10000;
+ for (int i = 0; i < 3; i++) {
+ printf("findfunc.exe: Calling (%ld).\n", dwCount);
+ dwCount = Target(dwCount) + 10000;
+ }
+ return 0;
+}
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/findfunc/symtest.cpp b/ext/detours/samples/findfunc/symtest.cpp
new file mode 100644
index 0000000..74cd539
--- /dev/null
+++ b/ext/detours/samples/findfunc/symtest.cpp
@@ -0,0 +1,385 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detour Test Program (symtest.cpp of symtest.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include <windows.h>
+#include <stdio.h>
+#pragma warning(push)
+#if _MSC_VER > 1400
+#pragma warning(disable:6102 6103) // /analyze warnings
+#endif
+#include <strsafe.h>
+#pragma warning(pop)
+#include <detours.h>
+#include "target.h"
+
+#if (_MSC_VER < 1299)
+#include <imagehlp.h>
+typedef IMAGEHLP_MODULE IMAGEHLP_MODULE64;
+typedef PIMAGEHLP_MODULE PIMAGEHLP_MODULE64;
+typedef IMAGEHLP_SYMBOL SYMBOL_INFO;
+typedef PIMAGEHLP_SYMBOL PSYMBOL_INFO;
+#else
+#pragma warning(push)
+#pragma warning(disable:4091) // empty typedef
+#include <dbghelp.h>
+#pragma warning(pop)
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+//
+typedef LPAPI_VERSION (NTAPI *PF_ImagehlpApiVersionEx)(LPAPI_VERSION AppVersion);
+
+typedef BOOL (NTAPI *PF_SymInitialize)(IN HANDLE hProcess,
+ IN LPCSTR UserSearchPath,
+ IN BOOL fInvadeProcess);
+typedef DWORD (NTAPI *PF_SymSetOptions)(IN DWORD SymOptions);
+typedef DWORD (NTAPI *PF_SymGetOptions)(VOID);
+typedef DWORD64 (NTAPI *PF_SymLoadModule64)(IN HANDLE hProcess,
+ IN HANDLE hFile,
+ IN PSTR ImageName,
+ IN PSTR ModuleName,
+ IN DWORD64 BaseOfDll,
+ IN DWORD SizeOfDll);
+typedef BOOL (NTAPI *PF_SymGetModuleInfo64)(IN HANDLE hProcess,
+ IN DWORD64 qwAddr,
+ OUT PIMAGEHLP_MODULE64 ModuleInfo);
+typedef BOOL (NTAPI *PF_SymFromName)(IN HANDLE hProcess,
+ IN LPSTR Name,
+ OUT PSYMBOL_INFO Symbol);
+#if (_MSC_VER < 1299)
+typedef BOOL (NTAPI *PF_SymRegisterCallback64)();
+typedef BOOL (NTAPI *PF_SymEnumerateModules64)();
+typedef BOOL (NTAPI *PF_SymEnumSymbols)();
+#else
+typedef BOOL (NTAPI *PF_SymRegisterCallback64)(IN HANDLE hProcess,
+ IN PSYMBOL_REGISTERED_CALLBACK64
+ CallbackFunction,
+ IN ULONG64 UserContext);
+typedef BOOL (NTAPI *PF_SymEnumerateModules64)(IN HANDLE hProcess,
+ IN PSYM_ENUMMODULES_CALLBACK64
+ EnumModulesCallback,
+ IN PVOID UserContext);
+typedef BOOL (NTAPI *PF_SymEnumSymbols)(IN HANDLE hProcess,
+ IN ULONG64 BaseOfDll,
+ IN PCSTR Mask,
+ IN PSYM_ENUMERATESYMBOLS_CALLBACK
+ EnumSymbolsCallback,
+ IN PVOID UserContext);
+#endif
+
+PF_ImagehlpApiVersionEx pfImagehlpApiVersionEx = NULL;
+PF_SymInitialize pfSymInitialize = NULL;
+PF_SymSetOptions pfSymSetOptions = NULL;
+PF_SymGetOptions pfSymGetOptions = NULL;
+PF_SymLoadModule64 pfSymLoadModule64 = NULL;
+PF_SymGetModuleInfo64 pfSymGetModuleInfo64 = NULL;
+PF_SymFromName pfSymFromName = NULL;
+PF_SymRegisterCallback64 pfSymRegisterCallback64 = NULL;
+PF_SymEnumerateModules64 pfSymEnumerateModules64 = NULL;
+PF_SymEnumSymbols pfSymEnumSymbols = NULL;
+
+//////////////////////////////////////////////////////////////////////////////
+//
+
+#if (_MSC_VER > 1299)
+static BOOL WINAPI SymEnumerateCallback(
+ PCSTR pszModule,
+ DWORD64 base,
+ PVOID pvUserContext)
+{
+ (void)pvUserContext;
+ printf(" %p: %s\n", (PVOID)base, pszModule);
+ return TRUE;
+}
+
+static int nSymbolCount = 0;
+static BOOL WINAPI SymEnumerateSymbols(PSYMBOL_INFO pSym,
+ ULONG size,
+ PVOID pvUserContext)
+{
+ (void)size;
+ (void)pvUserContext;
+ if (strstr(pSym->Name, "Target") != NULL ||
+ strstr(pSym->Name, "Hidden") != NULL) {
+ printf(" %p: %s\n", (PVOID)pSym->Address, pSym->Name);
+ nSymbolCount++;
+ }
+ else if (nSymbolCount < 5) {
+ printf(" %p: %s\n", (PVOID)pSym->Address, pSym->Name);
+ nSymbolCount++;
+ }
+ return TRUE;
+}
+
+static void truncate(PCHAR data)
+{
+ size_t len = strlen(data);
+ if (len > 0 && data[len-1] == '\r') {
+ data[--len] = '\0';
+ }
+ if (len > 0 && data[len-1] == '\n') {
+ data[--len] = '\0';
+ }
+}
+
+BOOL WINAPI CallbackFunction(HANDLE hProcess, ULONG action, ULONG64 data, ULONG64 context)
+{
+ (void)context;
+
+ switch (action) {
+ case CBA_DEBUG_INFO:
+ truncate((PCHAR)data);
+ printf("::> %s\n", (PCHAR)data);
+ return TRUE;
+
+ case CBA_DEFERRED_SYMBOL_LOAD_CANCEL:
+ printf("::> proc=%p action=%08lx data=%p\n",
+ (PVOID)hProcess,
+ action,
+ (PVOID)data);
+ {
+ PIMAGEHLP_DEFERRED_SYMBOL_LOAD64 pi = (PIMAGEHLP_DEFERRED_SYMBOL_LOAD64)data;
+ printf("pi->SizeOfStruct = %ld\n", pi->SizeOfStruct);
+ printf("pi->BaseOfImage = %p\n", (PVOID)(size_t)pi->BaseOfImage);
+ printf("pi->CheckSum = %8lx\n", pi->CheckSum);
+ printf("pi->FileName = %p [%s]\n", pi->FileName, pi->FileName);
+ printf("pi->Reparse = %d\n", pi->Reparse);
+ }
+ return FALSE;
+ default:
+ printf("::> proc=%p action=%08lx data=%p\n",
+ (PVOID)hProcess,
+ action,
+ (PVOID)data);
+ return FALSE;
+ }
+}
+#endif
+
+int __cdecl main(void)
+{
+ printf("symtest.exe: Starting.\n");
+ fflush(stdout);
+
+ //////////////////////////////////////////////////////// Get the functions.
+ //
+ HMODULE hDbgHelp = LoadLibraryA("dbghelp.dll");
+ if (hDbgHelp == NULL) {
+ printf("Couldn't load dbghelp.dll");
+ return 1;
+ }
+
+ pfImagehlpApiVersionEx
+ = (PF_ImagehlpApiVersionEx)GetProcAddress(hDbgHelp,
+ "ImagehlpApiVersionEx");
+ pfSymInitialize
+ = (PF_SymInitialize)GetProcAddress(hDbgHelp, "SymInitialize");
+ pfSymSetOptions
+ = (PF_SymSetOptions)GetProcAddress(hDbgHelp, "SymSetOptions");
+ pfSymGetOptions
+ = (PF_SymGetOptions)GetProcAddress(hDbgHelp, "SymGetOptions");
+ pfSymLoadModule64
+ = (PF_SymLoadModule64)GetProcAddress(hDbgHelp, "SymLoadModule64");
+ pfSymGetModuleInfo64
+ = (PF_SymGetModuleInfo64)GetProcAddress(hDbgHelp, "SymGetModuleInfo64");
+ pfSymFromName
+ = (PF_SymFromName)GetProcAddress(hDbgHelp, "SymFromName");
+ pfSymRegisterCallback64
+ = (PF_SymRegisterCallback64)GetProcAddress(hDbgHelp, "SymRegisterCallback64");
+ pfSymEnumerateModules64
+ = (PF_SymEnumerateModules64)GetProcAddress(hDbgHelp, "SymEnumerateModules64");
+ pfSymEnumSymbols
+ = (PF_SymEnumSymbols)GetProcAddress(hDbgHelp, "SymEnumSymbols");
+
+ //////////////////////////////////////////////////////////////////////////////
+ //
+ HANDLE hProcess = GetCurrentProcess();
+
+ API_VERSION av;
+ ZeroMemory(&av, sizeof(av));
+ av.MajorVersion = API_VERSION_NUMBER;
+
+ pfImagehlpApiVersionEx(&av);
+ printf(" Version: %d.%d (%d)\n",
+ av.MajorVersion,
+ av.MinorVersion,
+ API_VERSION_NUMBER);
+
+ if (!pfSymInitialize(hProcess, NULL, FALSE)) {
+ printf("SymInitialize failed: %ld\n", GetLastError());
+ return 1;
+ }
+
+#if (_MSC_VER > 1299)
+ pfSymRegisterCallback64(hProcess, CallbackFunction, NULL);
+#endif
+
+ DWORD dw = pfSymGetOptions();
+ printf("GetOptions = %08lx\n", dw);
+ dw &= ~(SYMOPT_CASE_INSENSITIVE |
+ SYMOPT_UNDNAME |
+ SYMOPT_DEFERRED_LOADS |
+ 0);
+ dw |= (
+#if defined(SYMOPT_EXACT_SYMBOLS)
+ SYMOPT_EXACT_SYMBOLS |
+#endif
+#if defined(SYMOPT_DEBUG)
+ SYMOPT_DEBUG |
+#endif
+#if defined(SYMOPT_NO_UNQUALIFIED_LOADS)
+ SYMOPT_NO_UNQUALIFIED_LOADS |
+#endif
+#if defined(SYMOPT_FAIL_CRITICAL_ERRORS)
+ SYMOPT_FAIL_CRITICAL_ERRORS |
+#endif
+#if defined(SYMOPT_INCLUDE_32BIT_MODULES)
+ SYMOPT_INCLUDE_32BIT_MODULES |
+#endif
+ 0);
+ printf("SetOptions = %08lx\n", dw);
+ pfSymSetOptions(dw);
+
+ /////////////////////////////////////////////// First, try GetProcAddress.
+ //
+ PCHAR pszFile = "target" DETOURS_STRINGIFY(DETOURS_BITS) ".dll";
+ HMODULE hModule = LoadLibraryA(pszFile);
+ if (hModule == NULL) {
+ printf("LoadLibraryA(%s) failed: %ld\n", pszFile, GetLastError());
+ return 2;
+ }
+
+ ////////////////////////////////////////////////////// Then try ImageHelp.
+ //
+#if (_MSC_VER > 1299)
+
+ //CHAR szFull[MAX_PATH];
+ //GetModuleFileNameA(hModule, szFull, sizeof(szFull));
+ printf("SymLoadModule64(%s) will be called.\n", pszFile /*szFull*/);
+ DWORD64 loaded = pfSymLoadModule64(hProcess, NULL,
+ (PCHAR)pszFile/*szFull*/, NULL,
+ (DWORD64)hModule, 0);
+ if (loaded == 0) {
+ printf("SymLoadModule64(%p) failed: %ld\n", hProcess, GetLastError());
+ printf("\n");
+ }
+ else {
+ printf("SymLoadModule64(%p) succeeded: 0x%p\n", hProcess, (PVOID)loaded);
+ }
+
+ CHAR szModName[512];
+
+ printf("Modules:\n");
+// The first parameter of PSYM_ENUMMODULES_CALLBACK64 changed from PSTR to PCSTR
+// between Windows 2003 and Windows 7. Cast here to work with either.
+ pfSymEnumerateModules64(hProcess, (PSYM_ENUMMODULES_CALLBACK64)SymEnumerateCallback, NULL);
+ printf("\n");
+
+ IMAGEHLP_MODULE64 modinfo;
+ ZeroMemory(&modinfo, sizeof(modinfo));
+ modinfo.SizeOfStruct = 512/*sizeof(modinfo)*/;
+ if (!pfSymGetModuleInfo64(hProcess, (DWORD64)hModule, &modinfo)) {
+ printf("SymGetModuleInfo64(%p, %p) [64] failed: %ld\n",
+ hProcess, hModule, GetLastError());
+ }
+ else {
+ printf("SymGetModuleInfo64(%p, %p) [64] succeeded: %ld\n",
+ hProcess, hModule, GetLastError());
+ StringCchCopyA(szModName, ARRAYSIZE(szModName), modinfo.ModuleName);
+ StringCchCatA(szModName, ARRAYSIZE(szModName), "!");
+
+ printf("NumSyms: %ld\n", modinfo.NumSyms);
+ printf("SymType: %d\n", modinfo.SymType);
+ printf("ModuleName: %s\n", modinfo.ModuleName);
+ printf("ImageName: %s\n", modinfo.ImageName);
+ printf("LoadedImageName: %s\n", modinfo.LoadedImageName);
+ }
+
+ printf("\n");
+ fflush(stdout);
+
+ printf("DLLs:\n");
+ for (hModule = NULL; (hModule = DetourEnumerateModules(hModule)) != NULL;) {
+ CHAR szName[MAX_PATH];
+ GetModuleFileNameA(hModule, szName, sizeof(szName));
+ printf(" %p: %s\n", hModule, szName);
+ }
+
+ if (pfSymEnumSymbols == NULL) {
+ printf("Couldn't find SymEnumSymbols.\n");
+ }
+ else {
+ printf("===Enum===\n");
+ SetLastError(0);
+ nSymbolCount = 0;
+ if (!pfSymEnumSymbols(hProcess, (DWORD64)hModule, NULL, SymEnumerateSymbols, NULL)) {
+ printf("SymEnumSymbols() failed: %ld\n",
+ GetLastError());
+ }
+ }
+
+ // Look for specific symbols.
+ struct CFullSymbol : SYMBOL_INFO {
+ CHAR szRestOfName[MAX_SYM_NAME];
+ } symbol;
+ CHAR szFullName[512];
+
+ // Look for Target
+ StringCchCopyA(szFullName, ARRAYSIZE(szFullName), szModName);
+ StringCchCatA(szFullName, ARRAYSIZE(szFullName), "Target");
+ printf("Symbol: [%s]\n", szFullName);
+
+ ZeroMemory(&symbol, sizeof(symbol));
+ symbol.SizeOfStruct = sizeof(SYMBOL_INFO);
+#ifdef DBHLPAPI
+ symbol.MaxNameLen = MAX_SYM_NAME;
+#else
+ symbol.MaxNameLength = MAX_SYM_NAME;
+#endif
+
+ SetLastError(0);
+ if (!pfSymFromName(hProcess, szFullName, &symbol)) {
+ printf("--SymFromName(%s) failed: %ld\n", szFullName, GetLastError());
+ }
+ if (symbol.Address != 0) {
+ printf("--SymFromName(%s) succeeded\n", szFullName);
+ }
+
+ printf("%s => %p\n\n", szFullName, (PBYTE)symbol.Address);
+
+ // Look for Hidden
+ StringCchCopyA(szFullName, ARRAYSIZE(szFullName), szModName);
+ StringCchCatA(szFullName, ARRAYSIZE(szFullName), "Hidden");
+ printf("Symbol: [%s]\n", szFullName);
+
+ ZeroMemory(&symbol, sizeof(symbol));
+ symbol.SizeOfStruct = sizeof(SYMBOL_INFO);
+#ifdef DBHLPAPI
+ symbol.MaxNameLen = MAX_SYM_NAME;
+#else
+ symbol.MaxNameLength = MAX_SYM_NAME;
+#endif
+
+ SetLastError(0);
+ if (!pfSymFromName(hProcess, szFullName, &symbol)) {
+ printf("--SymFromName(%s) failed: %ld\n", szFullName, GetLastError());
+ }
+ if (symbol.Address != 0) {
+ printf("--SymFromName(%s) succeeded\n", szFullName);
+ }
+
+ printf("%s => %p\n\n", szFullName, (PBYTE)symbol.Address);
+#endif
+
+ // We call Target once to insure it is loaded.
+ Target(0);
+ return 0;
+}
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/findfunc/target.cpp b/ext/detours/samples/findfunc/target.cpp
new file mode 100644
index 0000000..052e2ab
--- /dev/null
+++ b/ext/detours/samples/findfunc/target.cpp
@@ -0,0 +1,41 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detour Test Program (target.cpp of target.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include <stdio.h>
+#include <windows.h>
+#include "target.h"
+
+extern "C" DWORD WINAPI Hidden(DWORD dwCount)
+{
+ printf("target.dll: Hidden(%ld) -> %ld.\n", dwCount, dwCount + 1);
+ return dwCount + 1;
+}
+
+// We use this point to ensure Hidden isn't inlined.
+static DWORD (WINAPI * SelfHidden)(DWORD dwCount) = Hidden;
+
+DWORD WINAPI Target(DWORD dwCount)
+{
+ printf("target.dll: Target (%ld) -> %ld.\n", dwCount, dwCount + 100);
+ dwCount = SelfHidden(dwCount + 100);
+ printf("target.dll: Target (.....) -> %ld.\n", dwCount);
+ return dwCount;
+}
+
+BOOL WINAPI DllMain(HINSTANCE hinst, DWORD dwReason, LPVOID reserved)
+{
+ (void)hinst;
+ (void)dwReason;
+ (void)reserved;
+
+ return TRUE;
+}
+
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/findfunc/target.h b/ext/detours/samples/findfunc/target.h
new file mode 100644
index 0000000..076da2e
--- /dev/null
+++ b/ext/detours/samples/findfunc/target.h
@@ -0,0 +1,14 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detour Test Program (target.h of target.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#pragma once
+
+DWORD WINAPI Target(DWORD dwCount);
+
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/findfunc/target.rc b/ext/detours/samples/findfunc/target.rc
new file mode 100644
index 0000000..b75e4ec
--- /dev/null
+++ b/ext/detours/samples/findfunc/target.rc
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Version information for target.rc.
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include "detver.h"
+
+#define VER_INTERNALNAME_STR "target" DETOURS_STRINGIFY(DETOURS_BITS)
+#define VER_ORIGINALFILENAME_STR "target" DETOURS_STRINGIFY(DETOURS_BITS) ".dll"
+#define VER_FILEDESCRIPTION_STR "Detours Test Module"
+#define VER_COMPANYNAME_STR "Microsoft Corporation"
+
+#include "common.ver"
diff --git a/ext/detours/samples/impmunge/Makefile b/ext/detours/samples/impmunge/Makefile
new file mode 100644
index 0000000..e320b0c
--- /dev/null
+++ b/ext/detours/samples/impmunge/Makefile
@@ -0,0 +1,56 @@
+##############################################################################
+##
+## Makefile for Detours Test Programs.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+LIBS=$(LIBS) kernel32.lib
+
+all: dirs \
+ $(BIND)\impmunge.exe \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\impmunge.bsc
+!ENDIF
+
+##############################################################################
+
+clean:
+ -del *~ test.exe.* 2>nul
+ -del $(BIND)\impmunge.* 2>nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+##############################################################################
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+$(OBJD)\impmunge.obj : impmunge.cpp
+
+$(BIND)\impmunge.exe : $(OBJD)\impmunge.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb $(OBJD)\impmunge.obj \
+ /link $(LINKFLAGS) $(LIBS) imagehlp.lib /subsystem:console
+
+$(OBJD)\impmunge.bsc : $(OBJD)\impmunge.obj
+ bscmake /v /n /o $@ $(OBJD)\impmunge.sbr
+
+##############################################################################
+
+test: $(BIND)\impmunge.exe
+ $(BIND)\impmunge.exe /m /o:test.exe.1 $(BIND)\impmunge.exe
+ $(BIND)\impmunge.exe /m /l- /o:test.exe.2 test.exe.1
+ $(BIND)\impmunge.exe /m /l- /o:test.exe.3 test.exe.2
+ $(BIND)\impmunge.exe /m /l- /o:test.exe.4 test.exe.3
+ $(BIND)\impmunge.exe /l test.exe.4
+ $(BIND)\impmunge.exe /r /l- /o:test.exe.0 test.exe.4
+ $(BIND)\impmunge.exe /l test.exe.0
+
+################################################################# End of File.
diff --git a/ext/detours/samples/impmunge/impmunge.cpp b/ext/detours/samples/impmunge/impmunge.cpp
new file mode 100644
index 0000000..95516dc
--- /dev/null
+++ b/ext/detours/samples/impmunge/impmunge.cpp
@@ -0,0 +1,464 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (impmunge.cpp of impmunge.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#include <stdio.h>
+#include <stdlib.h>
+#include <windows.h>
+#pragma warning(push)
+#if _MSC_VER > 1400
+#pragma warning(disable:6102 6103) // /analyze warnings
+#endif
+#include <strsafe.h>
+#include <detours.h>
+#pragma warning(disable:4091) // empty typedef
+#include <imagehlp.h>
+#pragma warning(pop)
+
+////////////////////////////////////////////////////////////// Error Messages.
+//
+VOID AssertMessage(PCSTR szMsg, PCSTR szFile, DWORD nLine)
+{
+ printf("ASSERT(%s) failed in %s, line %ld.", szMsg, szFile, nLine);
+}
+
+#define ASSERT(x) \
+do { if (!(x)) { AssertMessage(#x, __FILE__, __LINE__); DebugBreak(); }} while (0)
+ ;
+
+
+//////////////////////////////////////////////////////////////////////////////
+//
+static BOOLEAN s_fRestore = FALSE;
+static BOOLEAN s_fList = TRUE;
+static BOOLEAN s_fMunge = FALSE;
+static BOOLEAN s_fToSymbols = FALSE;
+
+//////////////////////////////////////////////////////////////////////////////
+//
+static BOOL CALLBACK ListByway(_In_opt_ PVOID pContext,
+ _In_opt_ LPCSTR pszFile,
+ _Outptr_result_maybenull_ LPCSTR *ppszOutFile)
+{
+ (void)pContext;
+ (void)ppszOutFile;
+
+ printf(" byway -------------------------------- %s\n", pszFile ? pszFile : "");
+ return TRUE;
+}
+
+static BOOL CALLBACK ListFile(_In_opt_ PVOID pContext,
+ _In_ LPCSTR pszOrigFile,
+ _In_ LPCSTR pszFile,
+ _Outptr_result_maybenull_ LPCSTR *ppszOutFile)
+{
+ (void)pContext;
+ (void)ppszOutFile;
+
+ printf(" file %-32.32s %-32.32s\n",
+ pszOrigFile ? pszOrigFile : "",
+ pszFile ? pszFile : "");
+ return TRUE;
+}
+
+static BOOL CALLBACK ListSymbol(_In_opt_ PVOID pContext,
+ _In_ ULONG nOrigOrdinal,
+ _In_ ULONG nOrdinal,
+ _Out_ ULONG *pnOutOrdinal,
+ _In_opt_ LPCSTR pszOrigSymbol,
+ _In_opt_ LPCSTR pszSymbol,
+ _Outptr_result_maybenull_ LPCSTR *ppszOutSymbol)
+{
+ (void)pContext;
+ (void)pnOutOrdinal;
+ (void)ppszOutSymbol;
+
+ char szOrig[80];
+ char szLast[80];
+
+ if (pszOrigSymbol == NULL) {
+ StringCchPrintfA(szOrig, sizeof(szOrig), "#%d", nOrigOrdinal);
+ pszOrigSymbol = szOrig;
+ }
+ if (pszSymbol == NULL) {
+ StringCchPrintfA(szLast, sizeof(szLast), "#%d", nOrdinal);
+ pszSymbol = szLast;
+ }
+
+ printf(" symbol %-32.32s %-32.32s\n", pszOrigSymbol, pszSymbol);
+ return TRUE;
+}
+
+static BOOL CALLBACK ListCommit(PVOID pContext)
+{
+ (void)pContext;
+
+ printf(" commit\n");
+ return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+struct MUNGE_STATE
+{
+ BOOL fLastWasByway;
+ LONG nBywayCount;
+ CHAR szBuffer[512];
+};
+
+static BOOL CALLBACK MungeByway(_In_opt_ PVOID pContext,
+ _In_opt_ LPCSTR pszFile,
+ _Outptr_result_maybenull_ LPCSTR *ppszOutFile)
+{
+ MUNGE_STATE *pState = (MUNGE_STATE *)pContext;
+
+ printf("|");
+
+ if (pState->fLastWasByway) {
+ return TRUE;
+ }
+
+ pState->fLastWasByway = TRUE;
+
+ if (pszFile == NULL) {
+ StringCchPrintfA(pState->szBuffer, sizeof(pState->szBuffer), "mb_munge_%d.dll", pState->nBywayCount++);
+ *ppszOutFile = pState->szBuffer;
+ }
+ return TRUE;
+}
+
+static BOOL CALLBACK MungeFile(_In_opt_ PVOID pContext,
+ _In_ LPCSTR pszOrigFile,
+ _In_ LPCSTR pszFile,
+ _Outptr_result_maybenull_ LPCSTR *ppszOutFile)
+{
+ (void)pszOrigFile;
+ MUNGE_STATE *pState = (MUNGE_STATE *)pContext;
+
+ pState->fLastWasByway = FALSE;
+
+ printf("*");
+ StringCchPrintfA(pState->szBuffer, sizeof(pState->szBuffer), "mf_%s", pszFile);
+ *ppszOutFile = pState->szBuffer;
+ return TRUE;
+}
+
+static BOOL CALLBACK MungeSymbol(_In_opt_ PVOID pContext,
+ _In_ ULONG nOrigOrdinal,
+ _In_ ULONG nOrdinal,
+ _Out_ ULONG *pnOutOrdinal,
+ _In_opt_ LPCSTR pszOrigSymbol,
+ _In_opt_ LPCSTR pszSymbol,
+ _Outptr_result_maybenull_ LPCSTR *ppszOutSymbol)
+{
+ (void)nOrigOrdinal;
+ (void)pszOrigSymbol;
+ MUNGE_STATE *pState = (MUNGE_STATE *)pContext;
+
+ pState->fLastWasByway = FALSE;
+
+ printf(".");
+ if (nOrdinal != 0) {
+ if (s_fToSymbols) {
+ StringCchPrintfA(pState->szBuffer, sizeof(pState->szBuffer), "mo_%d", (int)nOrdinal);
+ *pnOutOrdinal = 0;
+ *ppszOutSymbol = pState->szBuffer;
+ }
+ else {
+ *pnOutOrdinal = 10000 + nOrdinal;
+ *ppszOutSymbol = NULL;
+ }
+ }
+ else {
+ StringCchPrintfA(pState->szBuffer, sizeof(pState->szBuffer), "ms_%s", pszSymbol);
+ *pnOutOrdinal = 0;
+ *ppszOutSymbol = pState->szBuffer;
+ }
+ return TRUE;
+}
+
+static BOOL CALLBACK MungeCommit(PVOID pContext)
+{
+ MUNGE_STATE *pState = (MUNGE_STATE *)pContext;
+
+ pState->fLastWasByway = FALSE;
+
+ printf("\n");
+ (void)pContext;
+ return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+static BOOL CALLBACK RestoreByway(_In_opt_ PVOID pContext,
+ _In_opt_ LPCSTR pszFile,
+ _Outptr_result_maybenull_ LPCSTR *ppszOutFile)
+{
+ (void)pContext;
+ (void)pszFile;
+
+ *ppszOutFile = NULL;
+ return TRUE;
+}
+
+static BOOL CALLBACK RestoreFile(_In_opt_ PVOID pContext,
+ _In_ LPCSTR pszOrigFile,
+ _In_ LPCSTR pszFile,
+ _Outptr_result_maybenull_ LPCSTR *ppszOutFile)
+{
+ (void)pContext;
+ (void)pszFile;
+
+ *ppszOutFile = pszOrigFile;
+ return TRUE;
+}
+
+static BOOL CALLBACK RestoreSymbol(_In_opt_ PVOID pContext,
+ _In_ ULONG nOrigOrdinal,
+ _In_ ULONG nOrdinal,
+ _Out_ ULONG *pnOutOrdinal,
+ _In_opt_ LPCSTR pszOrigSymbol,
+ _In_opt_ LPCSTR pszSymbol,
+ _Outptr_result_maybenull_ LPCSTR *ppszOutSymbol)
+{
+ (void)pContext;
+ (void)nOrdinal;
+ (void)pszSymbol;
+
+ *pnOutOrdinal = nOrigOrdinal;
+ *ppszOutSymbol = pszOrigSymbol;
+ return TRUE;
+}
+
+static BOOL CALLBACK RestoreCommit(PVOID pContext)
+{
+ (void)pContext;
+ return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+
+BOOL EditFile(PCHAR pszInput, PCHAR pszOutput)
+{
+ BOOL fGood = TRUE;
+
+ HANDLE hOld = INVALID_HANDLE_VALUE;
+ HANDLE hNew = INVALID_HANDLE_VALUE;
+ PDETOUR_BINARY pBinary = NULL;
+
+ if (pszOutput != NULL) {
+ printf("%s -> %s:\n", pszInput, pszOutput);
+ }
+ else {
+ printf("%s:\n", pszInput);
+ }
+
+ hOld = CreateFileA(pszInput,
+ GENERIC_READ,
+ FILE_SHARE_READ,
+ NULL,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL);
+
+ if (hOld == INVALID_HANDLE_VALUE) {
+ printf("Couldn't open input file: %s, error: %ld\n",
+ pszInput, GetLastError());
+ fGood = FALSE;
+ goto end;
+ }
+
+ if ((pBinary = DetourBinaryOpen(hOld)) == NULL) {
+ printf("DetourBinaryOpen failed: %ld\n", GetLastError());
+ goto end;
+ }
+
+ if (hOld != INVALID_HANDLE_VALUE) {
+ CloseHandle(hOld);
+ hOld = INVALID_HANDLE_VALUE;
+ }
+
+ if (s_fRestore) {
+ if (!DetourBinaryEditImports(pBinary,
+ NULL,
+ RestoreByway,
+ RestoreFile,
+ RestoreSymbol,
+ RestoreCommit)) {
+
+ printf("DetourBinaryEditImports for munge failed: %ld\n", GetLastError());
+ }
+ }
+
+ if (s_fMunge) {
+ MUNGE_STATE state;
+ state.fLastWasByway = FALSE;
+ state.nBywayCount = 1;
+
+ if (!DetourBinaryEditImports(pBinary,
+ &state,
+ MungeByway,
+ MungeFile,
+ MungeSymbol,
+ MungeCommit)) {
+
+ printf("DetourBinaryEditImports for munge failed: %ld\n", GetLastError());
+ }
+ }
+
+ if (s_fList) {
+ if (!DetourBinaryEditImports(pBinary,
+ NULL,
+ ListByway,
+ ListFile,
+ ListSymbol,
+ ListCommit)) {
+
+ printf("DetourBinaryEditImports for list failed: %ld\n", GetLastError());
+ }
+ }
+
+ if (pszOutput != NULL) {
+ hNew = CreateFileA(pszOutput,
+ GENERIC_WRITE | GENERIC_READ, 0, NULL, CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+ if (hNew == INVALID_HANDLE_VALUE) {
+ printf("Couldn't open output file: %s, error: %ld\n",
+ pszOutput, GetLastError());
+ fGood = FALSE;
+ goto end;
+ }
+
+ if (!DetourBinaryWrite(pBinary, hNew)) {
+ printf("DetourBinaryWrite failed: %ld\n", GetLastError());
+ fGood = FALSE;
+ }
+
+ CloseHandle(hNew);
+ hNew = INVALID_HANDLE_VALUE;
+ }
+
+ DetourBinaryClose(pBinary);
+ pBinary = NULL;
+
+
+ if (fGood && pszOutput != NULL) {
+ if (!BindImageEx(BIND_NO_BOUND_IMPORTS, pszOutput, ".", ".", NULL)) {
+ printf("Warning: Couldn't bind binary %s: %ld\n", pszOutput, GetLastError());
+ }
+ }
+
+ end:
+ if (pBinary) {
+ DetourBinaryClose(pBinary);
+ pBinary = NULL;
+ }
+ if (hNew != INVALID_HANDLE_VALUE) {
+ CloseHandle(hNew);
+ hNew = INVALID_HANDLE_VALUE;
+ }
+ if (hOld != INVALID_HANDLE_VALUE) {
+ CloseHandle(hOld);
+ hOld = INVALID_HANDLE_VALUE;
+ }
+ return fGood;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+void PrintUsage(void)
+{
+ printf("Usage:\n"
+ " impmunge [options] binary_files\n"
+ "Options:\n"
+ " /l : List imports.\n"
+ " /l- : Don't list imports.\n"
+ " /m : Munge imports.\n"
+ " /r : Remove import munges.\n"
+ " /o:file : Set name of output file; must be include with /m or /r.\n"
+ " /? : This help screen.\n");
+}
+
+//////////////////////////////////////////////////////////////////////// main.
+//
+int CDECL main(int argc, char **argv)
+{
+ BOOL fNeedHelp = FALSE;
+ PCHAR pszOutput = NULL;
+
+ int arg = 1;
+ for (; arg < argc && !fNeedHelp; arg++) {
+ if (argv[arg][0] == '-' || argv[arg][0] == '/') {
+ CHAR *argn = argv[arg] + 1;
+ CHAR *argp = argn;
+ while (*argp && *argp != ':')
+ argp++;
+ if (*argp == ':')
+ *argp++ = '\0';
+
+ switch (argn[0]) {
+
+ case 'l': // List contents of import table.
+ case 'L':
+ s_fList = (argn[1] != '-');
+ break;
+
+ case 'm': // Munge import table.
+ case 'M':
+ s_fMunge = (argn[1] != '-');
+ break;
+
+ case 'o': // Set output file name.
+ case 'O':
+ pszOutput = argp;
+ break;
+ case 'r': // Restore file to unmunged state.
+ case 'R':
+ s_fRestore = (argn[1] != '-');
+ break;
+
+ case 's': // Munge ordinals to symbols
+ case 'S':
+ s_fToSymbols = true;
+ break;
+
+ case '?': // Help
+ fNeedHelp = TRUE;
+ break;
+
+ default:
+ fNeedHelp = TRUE;
+ printf("Bad argument: %s:%s\n", argn, argp);
+ break;
+ }
+ }
+ else {
+ if (!s_fList && !s_fMunge && !s_fRestore) {
+ fNeedHelp = TRUE;
+ break;
+ }
+ if (pszOutput == NULL && (s_fMunge || s_fRestore)) {
+ fNeedHelp = TRUE;
+ break;
+ }
+
+ EditFile(argv[arg], pszOutput);
+ pszOutput = NULL;
+ }
+ }
+ if (argc == 1) {
+ fNeedHelp = TRUE;
+ }
+ if (fNeedHelp) {
+ PrintUsage();
+ return 1;
+ }
+ return 0;
+}
+
+// End of File
diff --git a/ext/detours/samples/member/Makefile b/ext/detours/samples/member/Makefile
new file mode 100644
index 0000000..7ecf505
--- /dev/null
+++ b/ext/detours/samples/member/Makefile
@@ -0,0 +1,48 @@
+##############################################################################
+##
+## Makefile for Detours Test Programs.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+LIBS=$(LIBS) kernel32.lib
+
+all: dirs \
+ $(BIND)\member.exe \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\member.bsc
+!ENDIF
+
+clean:
+ -del *~ 2> nul
+ -del $(BIND)\member.* 2> nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+$(OBJD)\member.obj : member.cpp
+
+$(BIND)\member.exe : $(OBJD)\member.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb $(OBJD)\member.obj \
+ /link $(LINKFLAGS) $(LIBS) /subsystem:console
+
+$(OBJD)\member.bsc : $(OBJD)\member.obj
+ bscmake /v /n /o $@ $(OBJD)\member.sbr
+
+##############################################################################
+
+test: $(BIND)\member.exe
+ @echo.
+ $(BIND)\member.exe
+ @echo.
+
+################################################################# End of File.
diff --git a/ext/detours/samples/member/member.cpp b/ext/detours/samples/member/member.cpp
new file mode 100644
index 0000000..585ef98
--- /dev/null
+++ b/ext/detours/samples/member/member.cpp
@@ -0,0 +1,116 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Test a detour of a member function (member.cpp of member.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+// By default, C++ member functions use the __thiscall calling convention.
+// In order to Detour a member function, both the trampoline and the detour
+// must have exactly the same calling convention as the target function.
+// Unfortunately, the VC compiler does not support a __thiscall, so the only
+// way to create legal detour and trampoline functions is by making them
+// class members of a "detour" class.
+//
+// In addition, C++ does not support converting a pointer to a member
+// function to an arbitrary pointer. To get a raw pointer, the address of
+// the member function must be moved into a temporary member-function
+// pointer, then passed by taking it's address, then de-referencing it.
+// Fortunately, the compiler will optimize the code to remove the extra
+// pointer operations.
+//
+// If X::Target is a virtual function, the following code will *NOT* work
+// because &X::Target is the address of a thunk that does a virtual call,
+// not the real address of the X::Target. You can get the real address
+// of X::Target by looking directly in the VTBL for class X, but there
+// is no legal way to 1) get the address of X's VTBL or 2) get the offset
+// of ::Target within that VTBL. You can of course, figure these out for
+// a particular class and function, but there is no general way to do so.
+//
+#include <stdio.h>
+
+#include <windows.h>
+#include <detours.h>
+
+#include "..\slept\verify.cpp"
+
+//////////////////////////////////////////////////////////////// Target Class.
+//
+class CMember
+{
+ public:
+ void Target(void);
+};
+
+void CMember::Target(void)
+{
+ printf(" CMember::Target! (this:%p)\n", this);
+}
+
+//////////////////////////////////////////////////////////////// Detour Class.
+//
+class CDetour /* add ": public CMember" to enable access to member variables... */
+{
+ public:
+ void Mine_Target(void);
+ static void (CDetour::* Real_Target)(void);
+
+ // Class shouldn't have any member variables or virtual functions.
+};
+
+void CDetour::Mine_Target(void)
+{
+ printf(" CDetour::Mine_Target! (this:%p)\n", this);
+ (this->*Real_Target)();
+}
+
+void (CDetour::* CDetour::Real_Target)(void) = (void (CDetour::*)(void))&CMember::Target;
+
+//////////////////////////////////////////////////////////////////////////////
+//
+int main(int argc, char **argv)
+{
+ (void)argc;
+ (void)argv;
+
+ //////////////////////////////////////////////////////////////////////////
+ //
+
+ void (CMember::* pfTarget)(void) = &CMember::Target;
+ void (CDetour::* pfMine)(void) = &CDetour::Mine_Target;
+
+ Verify("CMember::Target ", *(PBYTE*)&pfTarget);
+ Verify("*CDetour::Real_Target", *(PBYTE*)&CDetour::Real_Target);
+ Verify("CDetour::Mine_Target ", *(PBYTE*)&pfMine);
+
+ printf("\n");
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+
+ DetourAttach(&(PVOID&)CDetour::Real_Target,
+ *(PBYTE*)&pfMine);
+
+ LONG l = DetourTransactionCommit();
+ printf("DetourTransactionCommit = %ld\n", l);
+ printf("\n");
+
+ Verify("CMember::Target ", *(PBYTE*)&pfTarget);
+ Verify("*CDetour::Real_Target", *(&(PBYTE&)CDetour::Real_Target));
+ Verify("CDetour::Mine_Target ", *(PBYTE*)&pfMine);
+ printf("\n");
+
+ //////////////////////////////////////////////////////////////////////////
+ //
+ CMember target;
+
+ printf("Calling CMember (w/o Detour):\n");
+ (((CDetour*)&target)->*CDetour::Real_Target)();
+
+ printf("Calling CMember (will be detoured):\n");
+ target.Target();
+
+ return 0;
+}
+
diff --git a/ext/detours/samples/opengl/Makefile b/ext/detours/samples/opengl/Makefile
new file mode 100644
index 0000000..33d522d
--- /dev/null
+++ b/ext/detours/samples/opengl/Makefile
@@ -0,0 +1,112 @@
+######################################################################
+##
+## Hook test for glFinish
+##
+
+!include ..\common.mak
+
+LIBS=$(LIBS) kernel32.lib gdi32.lib
+
+##############################################################################
+
+all: dirs \
+ $(BIND)\ogldet$(DETOURS_BITS).dll \
+ $(BIND)\testogl.exe \
+ \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\ogldet$(DETOURS_BITS).bsc \
+ $(OBJD)\testogl.bsc \
+!ENDIF
+ option
+
+##############################################################################
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+$(OBJD)\ogldet.obj : ogldet.cpp
+
+$(OBJD)\ogldet.res : ogldet.rc
+
+$(BIND)\ogldet$(DETOURS_BITS).dll $(BIND)\ogldet$(DETOURS_BITS).lib: \
+ $(OBJD)\ogldet.obj $(OBJD)\ogldet.res $(DEPS)
+ cl /LD $(CFLAGS) /Fe$(@R).dll /Fd$(@R).pdb \
+ $(OBJD)\ogldet.obj $(OBJD)\ogldet.res \
+ /link $(LINKFLAGS) /subsystem:console \
+ /export:DetourFinishHelperProcess,@1,NONAME \
+ /export:hookedGlFinish \
+ $(LIBS) opengl32.lib
+
+$(OBJD)\ogldet$(DETOURS_BITS).bsc : $(OBJD)\ogldet.obj
+ bscmake /v /n /o $@ $(OBJD)\ogldet.sbr
+
+$(OBJD)\testogl.obj : testogl.cpp
+
+$(BIND)\testogl.exe : $(OBJD)\testogl.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb $(OBJD)\testogl.obj \
+ /link $(LINKFLAGS) $(LIBS) opengl32.lib \
+ /subsystem:console
+
+$(OBJD)\testogl.bsc : $(OBJD)\testogl.obj
+ bscmake /v /n /o $@ $(OBJD)\testogl.sbr
+
+##############################################################################
+
+clean:
+ -del *~ 2>nul
+ -del $(BIND)\ogldet*.* 2>nul
+ -del $(BIND)\testogl.* 2>nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+############################################### Install non-bit-size binaries.
+
+!IF "$(DETOURS_OPTION_PROCESSOR)" != ""
+
+$(OPTD)\olgdet$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\olgdet$(DETOURS_OPTION_BITS).pdb:
+
+$(BIND)\olgdet$(DETOURS_OPTION_BITS).dll : $(OPTD)\olgdet$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\olgdet$(DETOURS_OPTION_BITS).pdb : $(OPTD)\olgdet$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+
+option: \
+ $(BIND)\olgdet$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\olgdet$(DETOURS_OPTION_BITS).pdb \
+
+!ELSE
+
+option:
+
+!ENDIF
+
+##############################################################################
+
+test: all
+ @echo -------- Reseting test binaries to initial state. ---------------------
+ $(BIND)\setdll.exe -r $(BIND)\testogl.exe
+ @echo.
+ @echo -------- Should not load ogldet$(DETOURS_BITS).dll -----------------------------------
+ $(BIND)\testogl.exe
+ @echo.
+ @echo -------- Adding ogldet$(DETOURS_BITS).dll to testogl.exe ------------------------------
+ $(BIND)\setdll.exe -d:$(BIND)\ogldet$(DETOURS_BITS).dll $(BIND)\testogl.exe
+ @echo.
+ @echo -------- Should load ogldet$(DETOURS_BITS).dll statically ----------------------------
+ $(BIND)\testogl.exe
+ @echo.
+ @echo -------- Removing ogldet$(DETOURS_BITS).dll from testogl.exe --------------------------
+ $(BIND)\setdll.exe -r $(BIND)\testogl.exe
+ @echo.
+ @echo -------- Should not load ogldet$(DETOURS_BITS).dll -----------------------------------
+ $(BIND)\testogl.exe
+ @echo.
+ @echo -------- Should load ogldet$(DETOURS_BITS).dll dynamically using withdll.exe----------
+ $(BIND)\withdll.exe -d:$(BIND)\ogldet$(DETOURS_BITS).dll $(BIND)\testogl.exe
+ @echo.
+
+################################################################# End of File.
diff --git a/ext/detours/samples/opengl/ogldet.cpp b/ext/detours/samples/opengl/ogldet.cpp
new file mode 100644
index 0000000..b1659d9
--- /dev/null
+++ b/ext/detours/samples/opengl/ogldet.cpp
@@ -0,0 +1,74 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Module: ogldet.dll
+//
+// This DLL is based on the sample simple.dll. A detour is inserted for
+// the OpenGL glFinish function.
+//
+#include <stdio.h>
+#include <windows.h>
+#include <GL/gl.h>
+#include "detours.h"
+
+static void (WINAPI * trueGlFinish)(void) = glFinish;
+
+void WINAPI hookedGlFinish(void)
+{
+ printf("ogldet" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
+ " hookedGlFinish Starting.\n");
+ fflush(stdout);
+
+ trueGlFinish();
+
+ printf("ogldet" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
+ " hookedGlFinish done.\n");
+ fflush(stdout);
+}
+
+BOOL WINAPI DllMain(HINSTANCE hinst, DWORD dwReason, LPVOID reserved)
+{
+ LONG error;
+ (void)hinst;
+ (void)reserved;
+
+ if (DetourIsHelperProcess()) {
+ return TRUE;
+ }
+
+ if (dwReason == DLL_PROCESS_ATTACH) {
+ DetourRestoreAfterWith();
+
+ printf("ogldet" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
+ " Starting.\n");
+ fflush(stdout);
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)trueGlFinish, hookedGlFinish);
+ error = DetourTransactionCommit();
+
+ if (error == NO_ERROR) {
+ printf("ogldet" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
+ " Detoured glFinish().\n");
+ }
+ else {
+ printf("ogldet" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
+ " Error detouring glFinish(): %d\n", error);
+ }
+ }
+ else if (dwReason == DLL_PROCESS_DETACH) {
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourDetach(&(PVOID&)trueGlFinish, hookedGlFinish);
+ error = DetourTransactionCommit();
+
+ printf("ogldet" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
+ " Removed detour glFinish() (result=%d)\n", error);
+ fflush(stdout);
+ }
+
+ return TRUE;
+}
+
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/opengl/ogldet.rc b/ext/detours/samples/opengl/ogldet.rc
new file mode 100644
index 0000000..b25480d
--- /dev/null
+++ b/ext/detours/samples/opengl/ogldet.rc
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Version information for ogldet.rc.
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include "detver.h"
+
+#define VER_INTERNALNAME_STR "ogldet" DETOURS_STRINGIFY(DETOURS_BITS)
+#define VER_ORIGINALFILENAME_STR "ogldet" DETOURS_STRINGIFY(DETOURS_BITS) ".dll"
+#define VER_FILEDESCRIPTION_STR "Detours Open GL Test Module"
+#define VER_COMPANYNAME_STR "Microsoft Corporation"
+
+#include "common.ver"
diff --git a/ext/detours/samples/opengl/testogl.cpp b/ext/detours/samples/opengl/testogl.cpp
new file mode 100644
index 0000000..c48b4c1
--- /dev/null
+++ b/ext/detours/samples/opengl/testogl.cpp
@@ -0,0 +1,24 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// File: testogl.cpp
+// Module: testogl.exe (oglsimple.dll)
+//
+
+#include <windows.h>
+#include <stdio.h>
+#include <GL/gl.h>
+
+int __cdecl main()
+{
+ printf("testogl.exe: Starting\n");
+ fflush(stdout);
+
+ glFinish();
+
+ printf("testogl.exe: done\n");
+ fflush(stdout);
+
+ return 0;
+}
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/region/Makefile b/ext/detours/samples/region/Makefile
new file mode 100644
index 0000000..3d6108f
--- /dev/null
+++ b/ext/detours/samples/region/Makefile
@@ -0,0 +1,48 @@
+##############################################################################
+##
+## Makefile for Detours Test Programs.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+LIBS=$(LIBS) kernel32.lib
+
+all: dirs \
+ $(BIND)\region.exe \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\region.bsc
+!ENDIF
+
+clean:
+ -del *~ 2> nul
+ -del $(BIND)\region.* 2> nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+$(OBJD)\region.obj : region.cpp
+
+$(BIND)\region.exe : $(OBJD)\region.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb $(OBJD)\region.obj \
+ /link $(LINKFLAGS) $(LIBS) /subsystem:console
+
+$(OBJD)\region.bsc : $(OBJD)\region.obj
+ bscmake /v /n /o $@ $(OBJD)\region.sbr
+
+##############################################################################
+
+test: $(BIND)\region.exe
+ @echo.
+ $(BIND)\region.exe
+ @echo.
+
+################################################################# End of File.
diff --git a/ext/detours/samples/region/region.cpp b/ext/detours/samples/region/region.cpp
new file mode 100644
index 0000000..d23f583
--- /dev/null
+++ b/ext/detours/samples/region/region.cpp
@@ -0,0 +1,104 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Test the different system region bounds (region.cpp of region.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#include <stdio.h>
+
+#include <windows.h>
+#include <detours.h>
+
+//////////////////////////////////////////////////////////////////////////////
+//
+static DWORD (WINAPI * TrueSleepEx)(DWORD dwMilliseconds, BOOL bAlertable) = SleepEx;
+
+DWORD WINAPI LoudSleepEx(DWORD dwMilliseconds, BOOL bAlertable)
+{
+ DWORD dwBeg = GetTickCount();
+ DWORD ret = TrueSleepEx(dwMilliseconds, bAlertable);
+ DWORD dwEnd = GetTickCount();
+
+ printf("Slept %lu ticks.\n", dwEnd - dwBeg);
+ return ret;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+PVOID AttachAndDetach(DWORD dwMilliseconds)
+{
+ LONG error;
+ PVOID trampoline;
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)TrueSleepEx, LoudSleepEx);
+ error = DetourTransactionCommit();
+
+ printf("Attach: %ld, Trampoline: %p\n", error, TrueSleepEx);
+
+ trampoline = TrueSleepEx;
+
+ printf("\n");
+ printf("Sleep(%lu)\n", dwMilliseconds);
+ Sleep(dwMilliseconds);
+ printf("\n");
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourDetach(&(PVOID&)TrueSleepEx, LoudSleepEx);
+ error = DetourTransactionCommit();
+
+ return trampoline;
+}
+
+int main(int argc, char **argv)
+{
+ (void)argc;
+ (void)argv;
+
+ // First, save the default system region.
+
+ PVOID pDefaultLower = DetourSetSystemRegionLowerBound(NULL);
+ PVOID pDefaultUpper = DetourSetSystemRegionUpperBound(NULL);
+
+ // Now attach the detour with the default system region.
+
+ DetourSetSystemRegionLowerBound(pDefaultLower);
+ DetourSetSystemRegionUpperBound(pDefaultUpper);
+
+ printf("%p..%p: ", pDefaultLower, pDefaultUpper);
+ PVOID pTramp1 = AttachAndDetach(10);
+
+ printf("%p..%p: ", pDefaultLower, pDefaultUpper);
+ PVOID pTramp2 = AttachAndDetach(10);
+
+ // Now attach the detour with a smaller system region.
+
+ PVOID pSmallerLower = (PVOID)( ((ULONG_PTR)pTramp1) & ~(ULONG_PTR)0x3fffffff );
+ PVOID pSmallerUpper = (PVOID)( ((ULONG_PTR)pTramp1 + 0x3fffffff) & ~(ULONG_PTR)0x3fffffff );
+
+ DetourSetSystemRegionLowerBound(pSmallerLower);
+ DetourSetSystemRegionUpperBound(pSmallerUpper);
+
+ printf("%p..%p: ", pSmallerLower, pSmallerUpper);
+ PVOID pTramp3 = AttachAndDetach(20);
+
+ printf("Sleep(30)\n");
+ Sleep(30);
+ printf("\n");
+
+ if (pTramp1 != pTramp2) {
+ printf("!!!!!! Trampoling allocation is not deterministic. %p != %p\n", pTramp1, pTramp2);
+ return 1;
+ }
+ else if (pTramp2 == pTramp3) {
+ printf("!!!!!! Trampoling allocation doesn't skip region. %p == %p\n", pTramp2, pTramp3);
+ return 2;
+ }
+
+ return 0;
+}
+
diff --git a/ext/detours/samples/setdll/Makefile b/ext/detours/samples/setdll/Makefile
new file mode 100644
index 0000000..36ba377
--- /dev/null
+++ b/ext/detours/samples/setdll/Makefile
@@ -0,0 +1,62 @@
+##############################################################################
+##
+## Makefile for Detours Test Programs.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+LIBS=$(LIBS) kernel32.lib
+
+all: dirs \
+ $(BIND)\setdll.exe \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\setdll.bsc \
+!ENDIF
+ option
+
+##############################################################################
+
+clean:
+ -del *~ 2>nul
+ -del $(BIND)\setdll.* 2>nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+##############################################################################
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+$(OBJD)\setdll.obj : setdll.cpp
+
+$(BIND)\setdll.exe : $(OBJD)\setdll.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb $(OBJD)\setdll.obj \
+ /link $(LINKFLAGS) $(LIBS) /subsystem:console
+
+$(OBJD)\setdll.bsc : $(OBJD)\setdll.obj
+ bscmake /v /n /o $@ $(OBJD)\setdll.sbr
+
+############################################### Install non-bit-size binaries.
+
+option:
+
+##############################################################################
+
+test: all
+ @echo -------- Reseting test binaries to initial state. -----------------------
+ $(BIND)\setdll.exe -d:$(BIND)\slept$(DETOURS_BITS).dll $(BIND)\sleepold.exe
+ @echo -------- Should load slept$(DETOURS_BITS).dll statically -------------------------------
+ $(BIND)\sleepold.exe
+ @echo -------- Reseting test binaries to initial state. -----------------------
+ $(BIND)\setdll.exe -r $(BIND)\sleepold.exe
+ @echo -------- Should not load slept$(DETOURS_BITS).dll --------------------------------------
+ $(BIND)\sleepold.exe
+
+################################################################# End of File.
diff --git a/ext/detours/samples/setdll/setdll.cpp b/ext/detours/samples/setdll/setdll.cpp
new file mode 100644
index 0000000..fd39b03
--- /dev/null
+++ b/ext/detours/samples/setdll/setdll.cpp
@@ -0,0 +1,332 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (setdll.cpp of setdll.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#include <stdio.h>
+#include <stdlib.h>
+#include <windows.h>
+#include <shellapi.h>
+#include <detours.h>
+#pragma warning(push)
+#if _MSC_VER > 1400
+#pragma warning(disable:6102 6103) // /analyze warnings
+#endif
+#include <strsafe.h>
+#pragma warning(pop)
+
+////////////////////////////////////////////////////////////// Error Messages.
+//
+VOID AssertMessage(PCSTR szMsg, PCSTR szFile, DWORD nLine)
+{
+ printf("ASSERT(%s) failed in %s, line %ld.", szMsg, szFile, nLine);
+}
+
+#define ASSERT(x) \
+do { if (!(x)) { AssertMessage(#x, __FILE__, __LINE__); DebugBreak(); }} while (0)
+ ;
+
+
+//////////////////////////////////////////////////////////////////////////////
+//
+static BOOLEAN s_fRemove = FALSE;
+static CHAR s_szDllPath[MAX_PATH] = "";
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// This code verifies that the named DLL has been configured correctly
+// to be imported into the target process. DLLs must export a function with
+// ordinal #1 so that the import table touch-up magic works.
+//
+static BOOL CALLBACK ExportCallback(_In_opt_ PVOID pContext,
+ _In_ ULONG nOrdinal,
+ _In_opt_ LPCSTR pszName,
+ _In_opt_ PVOID pCode)
+{
+ (void)pContext;
+ (void)pCode;
+ (void)pszName;
+
+ if (nOrdinal == 1) {
+ *((BOOL *)pContext) = TRUE;
+ }
+ return TRUE;
+}
+
+BOOL DoesDllExportOrdinal1(PCHAR pszDllPath)
+{
+ HMODULE hDll = LoadLibraryExA(pszDllPath, NULL, DONT_RESOLVE_DLL_REFERENCES);
+ if (hDll == NULL) {
+ printf("setdll.exe: LoadLibraryEx(%s) failed with error %ld.\n",
+ pszDllPath,
+ GetLastError());
+ return FALSE;
+ }
+
+ BOOL validFlag = FALSE;
+ DetourEnumerateExports(hDll, &validFlag, ExportCallback);
+ FreeLibrary(hDll);
+ return validFlag;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+static BOOL CALLBACK ListBywayCallback(_In_opt_ PVOID pContext,
+ _In_opt_ LPCSTR pszFile,
+ _Outptr_result_maybenull_ LPCSTR *ppszOutFile)
+{
+ (void)pContext;
+
+ *ppszOutFile = pszFile;
+ if (pszFile) {
+ printf(" %s\n", pszFile);
+ }
+ return TRUE;
+}
+
+static BOOL CALLBACK ListFileCallback(_In_opt_ PVOID pContext,
+ _In_ LPCSTR pszOrigFile,
+ _In_ LPCSTR pszFile,
+ _Outptr_result_maybenull_ LPCSTR *ppszOutFile)
+{
+ (void)pContext;
+
+ *ppszOutFile = pszFile;
+ printf(" %s -> %s\n", pszOrigFile, pszFile);
+ return TRUE;
+}
+
+static BOOL CALLBACK AddBywayCallback(_In_opt_ PVOID pContext,
+ _In_opt_ LPCSTR pszFile,
+ _Outptr_result_maybenull_ LPCSTR *ppszOutFile)
+{
+ PBOOL pbAddedDll = (PBOOL)pContext;
+ if (!pszFile && !*pbAddedDll) { // Add new byway.
+ *pbAddedDll = TRUE;
+ *ppszOutFile = s_szDllPath;
+ }
+ return TRUE;
+}
+
+BOOL SetFile(PCHAR pszPath)
+{
+ BOOL bGood = TRUE;
+ HANDLE hOld = INVALID_HANDLE_VALUE;
+ HANDLE hNew = INVALID_HANDLE_VALUE;
+ PDETOUR_BINARY pBinary = NULL;
+
+ CHAR szOrg[MAX_PATH];
+ CHAR szNew[MAX_PATH];
+ CHAR szOld[MAX_PATH];
+
+ szOld[0] = '\0';
+ szNew[0] = '\0';
+
+ StringCchCopyA(szOrg, sizeof(szOrg), pszPath);
+ StringCchCopyA(szNew, sizeof(szNew), szOrg);
+ StringCchCatA(szNew, sizeof(szNew), "#");
+ StringCchCopyA(szOld, sizeof(szOld), szOrg);
+ StringCchCatA(szOld, sizeof(szOld), "~");
+ printf(" %s:\n", pszPath);
+
+ hOld = CreateFileA(szOrg,
+ GENERIC_READ,
+ FILE_SHARE_READ,
+ NULL,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL);
+
+ if (hOld == INVALID_HANDLE_VALUE) {
+ printf("Couldn't open input file: %s, error: %ld\n",
+ szOrg, GetLastError());
+ bGood = FALSE;
+ goto end;
+ }
+
+ hNew = CreateFileA(szNew,
+ GENERIC_WRITE | GENERIC_READ, 0, NULL, CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+ if (hNew == INVALID_HANDLE_VALUE) {
+ printf("Couldn't open output file: %s, error: %ld\n",
+ szNew, GetLastError());
+ bGood = FALSE;
+ goto end;
+ }
+
+ if ((pBinary = DetourBinaryOpen(hOld)) == NULL) {
+ printf("DetourBinaryOpen failed: %ld\n", GetLastError());
+ goto end;
+ }
+
+ if (hOld != INVALID_HANDLE_VALUE) {
+ CloseHandle(hOld);
+ hOld = INVALID_HANDLE_VALUE;
+ }
+
+ {
+ BOOL bAddedDll = FALSE;
+
+ DetourBinaryResetImports(pBinary);
+
+ if (!s_fRemove) {
+ if (!DetourBinaryEditImports(pBinary,
+ &bAddedDll,
+ AddBywayCallback, NULL, NULL, NULL)) {
+ printf("DetourBinaryEditImports failed: %ld\n", GetLastError());
+ }
+ }
+
+ if (!DetourBinaryEditImports(pBinary, NULL,
+ ListBywayCallback, ListFileCallback,
+ NULL, NULL)) {
+
+ printf("DetourBinaryEditImports failed: %ld\n", GetLastError());
+ }
+
+ if (!DetourBinaryWrite(pBinary, hNew)) {
+ printf("DetourBinaryWrite failed: %ld\n", GetLastError());
+ bGood = FALSE;
+ }
+
+ DetourBinaryClose(pBinary);
+ pBinary = NULL;
+
+ if (hNew != INVALID_HANDLE_VALUE) {
+ CloseHandle(hNew);
+ hNew = INVALID_HANDLE_VALUE;
+ }
+
+ if (bGood) {
+ if (!DeleteFileA(szOld)) {
+ DWORD dwError = GetLastError();
+ if (dwError != ERROR_FILE_NOT_FOUND) {
+ printf("Warning: Couldn't delete %s: %ld\n", szOld, dwError);
+ bGood = FALSE;
+ }
+ }
+ if (!MoveFileA(szOrg, szOld)) {
+ printf("Error: Couldn't back up %s to %s: %ld\n",
+ szOrg, szOld, GetLastError());
+ bGood = FALSE;
+ }
+ if (!MoveFileA(szNew, szOrg)) {
+ printf("Error: Couldn't install %s as %s: %ld\n",
+ szNew, szOrg, GetLastError());
+ bGood = FALSE;
+ }
+ }
+
+ DeleteFileA(szNew);
+ }
+
+
+ end:
+ if (pBinary) {
+ DetourBinaryClose(pBinary);
+ pBinary = NULL;
+ }
+ if (hNew != INVALID_HANDLE_VALUE) {
+ CloseHandle(hNew);
+ hNew = INVALID_HANDLE_VALUE;
+ }
+ if (hOld != INVALID_HANDLE_VALUE) {
+ CloseHandle(hOld);
+ hOld = INVALID_HANDLE_VALUE;
+ }
+ return bGood;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+void PrintUsage(void)
+{
+ printf("Usage:\n"
+ " setdll [options] binary_files\n"
+ "Options:\n"
+ " /d:file.dll : Add file.dll binary files\n"
+ " /r : Remove extra DLLs from binary files\n"
+ " /? : This help screen.\n");
+}
+
+//////////////////////////////////////////////////////////////////////// main.
+//
+int CDECL main(int argc, char **argv)
+{
+ BOOL fNeedHelp = FALSE;
+ PCHAR pszFilePart = NULL;
+
+ int arg = 1;
+ for (; arg < argc; arg++) {
+ if (argv[arg][0] == '-' || argv[arg][0] == '/') {
+ CHAR *argn = argv[arg] + 1;
+ CHAR *argp = argn;
+ while (*argp && *argp != ':' && *argp != '=')
+ argp++;
+ if (*argp == ':' || *argp == '=')
+ *argp++ = '\0';
+
+ switch (argn[0]) {
+
+ case 'd': // Set DLL
+ case 'D':
+ if ((strchr(argp, ':') != NULL || strchr(argp, '\\') != NULL) &&
+ GetFullPathNameA(argp, sizeof(s_szDllPath), s_szDllPath, &pszFilePart)) {
+ }
+ else {
+ StringCchPrintfA(s_szDllPath, sizeof(s_szDllPath), "%s", argp);
+ }
+ break;
+
+ case 'r': // Remove extra set DLLs.
+ case 'R':
+ s_fRemove = TRUE;
+ break;
+
+ case '?': // Help
+ fNeedHelp = TRUE;
+ break;
+
+ default:
+ fNeedHelp = TRUE;
+ printf("Bad argument: %s:%s\n", argn, argp);
+ break;
+ }
+ }
+ }
+ if (argc == 1) {
+ fNeedHelp = TRUE;
+ }
+ if (!s_fRemove && s_szDllPath[0] == 0) {
+ fNeedHelp = TRUE;
+ }
+ if (fNeedHelp) {
+ PrintUsage();
+ return 1;
+ }
+
+
+ if (s_fRemove) {
+ printf("Removing extra DLLs from binary files.\n");
+ }
+ else {
+ if (!DoesDllExportOrdinal1(s_szDllPath)) {
+ printf("Error: %hs does not export function with ordinal #1.\n",
+ s_szDllPath);
+ return 2;
+ }
+ printf("Adding %hs to binary files.\n", s_szDllPath);
+ }
+
+ for (arg = 1; arg < argc; arg++) {
+ if (argv[arg][0] != '-' && argv[arg][0] != '/') {
+ SetFile(argv[arg]);
+ }
+ }
+ return 0;
+}
+
+// End of File
diff --git a/ext/detours/samples/simple/Makefile b/ext/detours/samples/simple/Makefile
new file mode 100644
index 0000000..1597519
--- /dev/null
+++ b/ext/detours/samples/simple/Makefile
@@ -0,0 +1,120 @@
+##############################################################################
+##
+## API Extention to Measure time slept.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+LIBS=$(LIBS) kernel32.lib
+
+##############################################################################
+
+all: dirs \
+ $(BIND)\simple$(DETOURS_BITS).dll \
+ $(BIND)\sleep5.exe \
+ \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\simple$(DETOURS_BITS).bsc \
+ $(OBJD)\sleep5.bsc \
+!ENDIF
+ option
+
+##############################################################################
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+$(OBJD)\simple.obj : simple.cpp
+
+$(OBJD)\simple.res : simple.rc
+
+$(BIND)\simple$(DETOURS_BITS).dll $(BIND)\simple$(DETOURS_BITS).lib: \
+ $(OBJD)\simple.obj $(OBJD)\simple.res $(DEPS)
+ cl /LD $(CFLAGS) /Fe$(@R).dll /Fd$(@R).pdb \
+ $(OBJD)\simple.obj $(OBJD)\simple.res \
+ /link $(LINKFLAGS) /subsystem:console \
+ /export:DetourFinishHelperProcess,@1,NONAME \
+ /export:TimedSleepEx \
+ $(LIBS)
+
+$(OBJD)\simple$(DETOURS_BITS).bsc : $(OBJD)\simple.obj
+ bscmake /v /n /o $@ $(OBJD)\simple.sbr
+
+$(OBJD)\sleep5.obj : sleep5.cpp
+
+$(BIND)\sleep5.exe : $(OBJD)\sleep5.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb $(OBJD)\sleep5.obj \
+ /link $(LINKFLAGS) $(LIBS) \
+ /subsystem:console
+
+$(OBJD)\sleep5.bsc : $(OBJD)\sleep5.obj
+ bscmake /v /n /o $@ $(OBJD)\sleep5.sbr
+
+##############################################################################
+
+clean:
+ -del *~ 2>nul
+ -del $(BIND)\simple*.* 2>nul
+ -del $(BIND)\sleep5.* 2>nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+############################################### Install non-bit-size binaries.
+
+!IF "$(DETOURS_OPTION_PROCESSOR)" != ""
+
+$(OPTD)\simple$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\simple$(DETOURS_OPTION_BITS).pdb:
+
+$(BIND)\simple$(DETOURS_OPTION_BITS).dll : $(OPTD)\simple$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\simple$(DETOURS_OPTION_BITS).pdb : $(OPTD)\simple$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+
+option: \
+ $(BIND)\simple$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\simple$(DETOURS_OPTION_BITS).pdb \
+
+!ELSE
+
+option:
+
+!ENDIF
+
+##############################################################################
+
+test: all
+ @echo -------- Reseting test binaries to initial state. ---------------------
+ $(BIND)\setdll.exe -r $(BIND)\sleep5.exe
+ @echo.
+ @echo -------- Should not load simple$(DETOURS_BITS).dll -----------------------------------
+ $(BIND)\sleep5.exe
+ @echo.
+ @echo -------- Adding simple$(DETOURS_BITS).dll to sleep5.exe ------------------------------
+ $(BIND)\setdll.exe -d:$(BIND)\simple$(DETOURS_BITS).dll $(BIND)\sleep5.exe
+ @echo.
+ @echo -------- Should load simple$(DETOURS_BITS).dll statically ----------------------------
+ $(BIND)\sleep5.exe
+ @echo.
+ @echo -------- Removing simple$(DETOURS_BITS).dll from sleep5.exe --------------------------
+ $(BIND)\setdll.exe -r $(BIND)\sleep5.exe
+ @echo.
+ @echo -------- Should not load simple$(DETOURS_BITS).dll -----------------------------------
+ $(BIND)\sleep5.exe
+ @echo.
+ @echo -------- Should load simple$(DETOURS_BITS).dll dynamically using withdll.exe----------
+ $(BIND)\withdll.exe -d:$(BIND)\simple$(DETOURS_BITS).dll $(BIND)\sleep5.exe
+ @echo.
+
+debug: all
+ windbg -o $(BIND)\withdll.exe -d:$(BIND)\simple$(DETOURS_BITS).dll $(BIND)\sleep5.exe
+
+
+################################################################# End of File.
diff --git a/ext/detours/samples/simple/simple.cpp b/ext/detours/samples/simple/simple.cpp
new file mode 100644
index 0000000..bc902f1
--- /dev/null
+++ b/ext/detours/samples/simple/simple.cpp
@@ -0,0 +1,76 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (simple.cpp of simple.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+// This DLL will detour the Windows SleepEx API so that TimedSleep function
+// gets called instead. TimedSleepEx records the before and after times, and
+// calls the real SleepEx API through the TrueSleepEx function pointer.
+//
+#include <stdio.h>
+#include <windows.h>
+#include "detours.h"
+
+static LONG dwSlept = 0;
+static DWORD (WINAPI * TrueSleepEx)(DWORD dwMilliseconds, BOOL bAlertable) = SleepEx;
+
+DWORD WINAPI TimedSleepEx(DWORD dwMilliseconds, BOOL bAlertable)
+{
+ DWORD dwBeg = GetTickCount();
+ DWORD ret = TrueSleepEx(dwMilliseconds, bAlertable);
+ DWORD dwEnd = GetTickCount();
+
+ InterlockedExchangeAdd(&dwSlept, dwEnd - dwBeg);
+
+ return ret;
+}
+
+BOOL WINAPI DllMain(HINSTANCE hinst, DWORD dwReason, LPVOID reserved)
+{
+ LONG error;
+ (void)hinst;
+ (void)reserved;
+
+ if (DetourIsHelperProcess()) {
+ return TRUE;
+ }
+
+ if (dwReason == DLL_PROCESS_ATTACH) {
+ DetourRestoreAfterWith();
+
+ printf("simple" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
+ " Starting.\n");
+ fflush(stdout);
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)TrueSleepEx, TimedSleepEx);
+ error = DetourTransactionCommit();
+
+ if (error == NO_ERROR) {
+ printf("simple" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
+ " Detoured SleepEx().\n");
+ }
+ else {
+ printf("simple" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
+ " Error detouring SleepEx(): %ld\n", error);
+ }
+ }
+ else if (dwReason == DLL_PROCESS_DETACH) {
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourDetach(&(PVOID&)TrueSleepEx, TimedSleepEx);
+ error = DetourTransactionCommit();
+
+ printf("simple" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
+ " Removed SleepEx() (result=%ld), slept %ld ticks.\n", error, dwSlept);
+ fflush(stdout);
+ }
+ return TRUE;
+}
+
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/simple/simple.rc b/ext/detours/samples/simple/simple.rc
new file mode 100644
index 0000000..f493af4
--- /dev/null
+++ b/ext/detours/samples/simple/simple.rc
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Version information for simple.rc.
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include "detver.h"
+
+#define VER_INTERNALNAME_STR "simple" DETOURS_STRINGIFY(DETOURS_BITS)
+#define VER_ORIGINALFILENAME_STR "simple" DETOURS_STRINGIFY(DETOURS_BITS) ".dll"
+#define VER_FILEDESCRIPTION_STR "Detours Test Module"
+#define VER_COMPANYNAME_STR "Microsoft Corporation"
+
+#include "common.ver"
diff --git a/ext/detours/samples/simple/sleep5.cpp b/ext/detours/samples/simple/sleep5.cpp
new file mode 100644
index 0000000..bb28226
--- /dev/null
+++ b/ext/detours/samples/simple/sleep5.cpp
@@ -0,0 +1,29 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (sleep5.cpp of sleep5.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int __cdecl main(int argc, char ** argv)
+{
+ if (argc == 2) {
+ Sleep(atoi(argv[1]) * 1000);
+ }
+ else {
+ printf("sleep5.exe: Starting.\n");
+
+ Sleep(5000);
+
+ printf("sleep5.exe: Done sleeping.\n");
+ }
+ return 0;
+}
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/slept/Makefile b/ext/detours/samples/slept/Makefile
new file mode 100644
index 0000000..6711a87
--- /dev/null
+++ b/ext/detours/samples/slept/Makefile
@@ -0,0 +1,194 @@
+##############################################################################
+##
+## API Extension to Measure time slept.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+CFLAGS = $(CFLAGS:/Od=/O2)
+
+LIBS=$(LIBS) kernel32.lib
+
+##############################################################################
+
+all: dirs \
+ $(BIND)\slept$(DETOURS_BITS).dll \
+ $(BIND)\dslept$(DETOURS_BITS).dll \
+ $(BIND)\sleepold.exe \
+ $(BIND)\sleepnew.exe \
+ $(BIND)\sleepbed.exe \
+ \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\slept$(DETOURS_BITS).bsc \
+ $(OBJD)\dslept$(DETOURS_BITS).bsc \
+ $(OBJD)\sleepold.bsc \
+ $(OBJD)\sleepnew.bsc \
+ $(OBJD)\sleepbed.bsc \
+!ENDIF
+ option
+
+##############################################################################
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+$(OBJD)\slept.obj : slept.cpp verify.cpp
+
+$(OBJD)\slept.res : slept.rc
+
+$(BIND)\slept$(DETOURS_BITS).dll $(BIND)\slept$(DETOURS_BITS).lib: \
+ $(OBJD)\slept.obj $(OBJD)\slept.res $(DEPS)
+ cl /LD $(CFLAGS) /Fe$(@R).dll /Fd$(@R).pdb \
+ $(OBJD)\slept.obj $(OBJD)\slept.res\
+ /link $(LINKFLAGS) /subsystem:console \
+ /export:DetourFinishHelperProcess,@1,NONAME \
+ /export:TimedSleepEx \
+ /export:UntimedSleepEx \
+ /export:GetSleptTicks \
+ /export:TestTicks \
+ /export:TestTicksEx \
+ $(LIBS)
+
+$(OBJD)\slept$(DETOURS_BITS).bsc : $(OBJD)\slept.obj
+ bscmake /v /n /o $@ $(OBJD)\slept.sbr
+
+$(OBJD)\dslept.obj : dslept.cpp verify.cpp
+
+$(OBJD)\dslept.res : dslept.rc
+
+$(BIND)\dslept$(DETOURS_BITS).dll $(BIND)\dslept$(DETOURS_BITS).lib: \
+ $(OBJD)\dslept.obj $(OBJD)\dslept.res $(DEPS)
+ cl /LD $(CFLAGS) /Fe$(@R).dll /Fd$(@R).pdb \
+ $(OBJD)\dslept.obj $(OBJD)\dslept.res \
+ /link $(LINKFLAGS) /subsystem:console \
+ /export:DetourFinishHelperProcess,@1,NONAME \
+ /export:TimedSleepEx \
+ /export:UntimedSleepEx \
+ /export:GetSleptTicks \
+ $(LIBS)
+
+$(OBJD)\dslept$(DETOURS_BITS).bsc : $(OBJD)\dslept.obj
+ bscmake /v /n /o $@ $(OBJD)\dslept.sbr
+
+$(OBJD)\sleepold.obj : sleepold.cpp verify.cpp
+
+$(BIND)\sleepold.exe : $(OBJD)\sleepold.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb $(OBJD)\sleepold.obj \
+ /link $(LINKFLAGS) $(LIBS) \
+ /subsystem:console /fixed:no
+
+$(OBJD)\sleepold.bsc : $(OBJD)\sleepold.obj
+ bscmake /v /n /o $@ $(OBJD)\sleepold.sbr
+
+$(OBJD)\sleepnew.obj : sleepnew.cpp verify.cpp
+
+$(BIND)\sleepnew.exe : $(OBJD)\sleepnew.obj $(BIND)\slept$(DETOURS_BITS).lib $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb $(OBJD)\sleepnew.obj \
+ /link $(LINKFLAGS) $(LIBS) \
+ /subsystem:console /fixed:no $(BIND)\slept$(DETOURS_BITS).lib
+
+$(OBJD)\sleepnew.bsc : $(OBJD)\sleepnew.obj
+ bscmake /v /n /o $@ $(OBJD)\sleepnew.sbr
+
+$(OBJD)\sleepbed.obj : sleepbed.cpp verify.cpp
+
+$(BIND)\sleepbed.exe : $(OBJD)\sleepbed.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb $(OBJD)\sleepbed.obj \
+ /link $(LINKFLAGS) $(LIBS) \
+ /subsystem:console /fixed:no
+
+$(OBJD)\sleepbed.bsc : $(OBJD)\sleepbed.obj
+ bscmake /v /n /o $@ $(OBJD)\sleepbed.sbr
+
+##############################################################################
+
+clean:
+ -del *~ 2>nul
+ -del $(BIND)\slept*.* 2>nul
+ -del $(BIND)\dslept*.* 2>nul
+ -del $(BIND)\sleepold.* 2>nul
+ -del $(BIND)\sleepnew.* 2>nul
+ -del $(BIND)\sleepbed.* 2>nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+############################################### Install non-bit-size binaries.
+
+!IF "$(DETOURS_OPTION_PROCESSOR)" != ""
+
+$(OPTD)\slept$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\slept$(DETOURS_OPTION_BITS).pdb:
+$(OPTD)\dslept$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\dslept$(DETOURS_OPTION_BITS).pdb:
+
+$(BIND)\slept$(DETOURS_OPTION_BITS).dll: $(OPTD)\slept$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\slept$(DETOURS_OPTION_BITS).pdb: $(OPTD)\slept$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\dslept$(DETOURS_OPTION_BITS).dll: $(OPTD)\dslept$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\dslept$(DETOURS_OPTION_BITS).pdb: $(OPTD)\dslept$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+
+option: \
+ $(BIND)\slept$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\slept$(DETOURS_OPTION_BITS).pdb \
+ $(BIND)\dslept$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\dslept$(DETOURS_OPTION_BITS).pdb \
+
+!ELSE
+
+option:
+
+!ENDIF
+
+##############################################################################
+
+skype: all
+ start windbg -G -o $(BIND)\withdll.exe -d:$(BIND)\slept$(DETOURS_BITS).dll "C:\Program Files (x86)\Skype\Phone\Skype.exe"
+
+test: all
+ @echo -------- Reseting test binaries to initial state. -----------------------
+ $(BIND)\setdll.exe -r $(BIND)\sleepold.exe
+ @echo.
+ @echo -------- Should load detour self ----------------------------------------
+ $(BIND)\sleepbed.exe
+ @echo.
+ @echo -------- Should load slept$(DETOURS_BITS).dll statically -------------------------------
+ $(BIND)\sleepnew.exe
+ @echo.
+ @echo -------- Should not load slept$(DETOURS_BITS).dll --------------------------------------
+ $(BIND)\sleepold.exe
+ @echo.
+ @echo -------- Adding slept$(DETOURS_BITS).dll to sleepold.exe -------------------------------
+ $(BIND)\setdll.exe -d:$(BIND)\slept$(DETOURS_BITS).dll $(BIND)\sleepold.exe
+ @echo.
+ @echo -------- Should load slept$(DETOURS_BITS).dll statically -------------------------------
+ $(BIND)\sleepold.exe
+ @echo.
+ @echo -------- Replacing slept$(DETOURS_BITS).dll with dslept$(DETOURS_BITS).dll in sleepold.exe ------------
+ $(BIND)\setdll.exe -r $(BIND)\sleepold.exe
+ $(BIND)\setdll.exe -d:$(BIND)\dslept$(DETOURS_BITS).dll $(BIND)\sleepold.exe
+ @echo.
+ @echo -------- Should load dslept$(DETOURS_BITS).dll instead of slept$(DETOURS_BITS).dll --------------------
+ $(BIND)\sleepold.exe
+ @echo.
+ @echo -------- Removing dslept$(DETOURS_BITS).dll from sleepold.exe --------------------------
+ $(BIND)\setdll.exe -r $(BIND)\sleepold.exe
+ @echo.
+ @echo -------- Should not load dslept$(DETOURS_BITS).dll or slept$(DETOURS_BITS).dll ------------------------
+ $(BIND)\sleepold.exe
+ @echo.
+ @echo -------- Should load slept$(DETOURS_BITS).dll dynamically using withdll.exe ------------
+ $(BIND)\withdll.exe -d:$(BIND)\slept$(DETOURS_BITS).dll $(BIND)\sleepold.exe
+ @echo.
+ @echo -------- Test completed. ------------------------------------------------
+
+################################################################# End of File.
diff --git a/ext/detours/samples/slept/NORMAL_IA64.TXT b/ext/detours/samples/slept/NORMAL_IA64.TXT
new file mode 100644
index 0000000..d26c3c3
--- /dev/null
+++ b/ext/detours/samples/slept/NORMAL_IA64.TXT
@@ -0,0 +1,202 @@
+-------- Reseting test binaries to initial state. -----------------------
+ ..\..\bin.IA64\setdll.exe -r ..\..\bin.IA64\sleepold.exe
+Removing extra DLLs from binary files.
+ ..\..\bin.IA64\sleepold.exe:
+ KERNEL32.dll -> KERNEL32.dll
+
+-------- Should load detour self ----------------------------------------
+ ..\..\bin.IA64\sleepbed.exe
+sleepbed.exe: Starting.
+sleepbed.exe: ExeEntry=000000013F702DD0, DllEntry=0000000000000000
+ SleepEx = 0000000077898980 [0000000077845300]
+ 0000000077898980: 08181d0a 80054002 04004240 0400c400
+ 0000000077898990: 11300142 00215002 80004200 00000020
+ 00000000778989A0: 13000000 01000000 00001000 80a50050
+
+sleepbed.exe: Detoured SleepEx().
+sleepbed.exe: After detour.
+ SleepEx = 0000000077898980 [0000000077845300]
+ 0000000077898980: 05000000 0100bfff ffff7f00 b879ffc8 [0000000037890330]
+ 0000000077898990: 11300142 00215002 80004200 00000020
+ 00000000778989A0: 13000000 01000000 00001000 80a50050
+
+sleepbed.exe: Calling Sleep for 1 second.
+sleepbed.exe: Calling SleepEx for 1 second.
+sleepbed.exe: Calling Sleep again for 1 second.
+sleepbed.exe: Calling TimedSleepEx for 1 second.
+sleepbed.exe: Calling UntimedSleepEx for 1 second.
+sleepbed.exe: Done sleeping.
+
+sleepbed.exe: Removed SleepEx() detour (0), slept 2000 ticks.
+sleepbed.exe: GetSleptTicks() = 2000
+
+
+-------- Should load slept64.dll statically -------------------------------
+ ..\..\bin.IA64\sleepnew.exe
+slept64.dll: Starting.
+slept64.dll: ExeEntry=000000013F18CA50, DllEntry=000006FAEE9F6D80
+ SleepEx = 0000000077898980 [0000000077845300]
+ 0000000077898980: 08181d0a 80054002 04004240 0400c400
+ 0000000077898990: 11300142 00215002 80004200 00000020
+ 00000000778989A0: 13000000 01000000 00001000 80a50050
+
+sleepnew.exe: Starting.
+ SleepEx = 0000000077898980 [0000000077845300]
+ 0000000077898980: 05000000 0100bfff ffff7f00 b879ffc8 [0000000037890330]
+ 0000000077898990: 11300142 00215002 80004200 00000020
+ 00000000778989A0: 13000000 01000000 00001000 80a50050
+
+sleepnew.exe: Calling Sleep for 1 second.
+sleepnew.exe: Calling SleepEx for 1 second.
+sleepnew.exe: Calling Sleep again for 1 second.
+sleepnew.exe: Calling TimedSleep for 1 second.
+sleepnew.exe: Calling UntimedSleep for 1 second.
+sleepnew.exe: Done sleeping.
+
+sleepnew.exe: GetSleptTicks() = 2000
+
+slept64.dll: Detoured SleepEx().
+slept64.dll: Removed SleepEx() detour (0), slept 2000 ticks.
+
+-------- Should not load slept64.dll --------------------------------------
+ ..\..\bin.IA64\sleepold.exe
+sleepold.exe: Starting (at 000000013F80C288).
+ SleepEx = 0000000077898980 [0000000077845300]
+ 0000000077898980: 08181d0a 80054002 04004240 0400c400
+ 0000000077898990: 11300142 00215002 80004200 00000020
+ 00000000778989A0: 13000000 01000000 00001000 80a50050
+
+sleepold.exe: Calling Sleep for 1 second.
+sleepold.exe: Calling SleepEx for 1 second.
+sleepold.exe: Calling Sleep again for 1 second.
+sleepold.exe: Done sleeping.
+
+
+-------- Adding slept64.dll to sleepold.exe -------------------------------
+ ..\..\bin.IA64\setdll.exe -d:..\..\bin.IA64\slept64.dll ..\..\bin.IA64\sleepold.exe
+Adding c:\Code\Detours\bin.IA64\slept64.dll to binary files.
+ ..\..\bin.IA64\sleepold.exe:
+ c:\Code\Detours\bin.IA64\slept64.dll
+ KERNEL32.dll -> KERNEL32.dll
+
+-------- Should load slept64.dll statically -------------------------------
+ ..\..\bin.IA64\sleepold.exe
+slept64.dll: Starting.
+slept64.dll: ExeEntry=000000013F4FCAB0, DllEntry=000006FAEE9F6D80
+ SleepEx = 0000000077898980 [0000000077845300]
+ 0000000077898980: 08181d0a 80054002 04004240 0400c400
+ 0000000077898990: 11300142 00215002 80004200 00000020
+ 00000000778989A0: 13000000 01000000 00001000 80a50050
+
+sleepold.exe: Starting (at 000000013F4FC288).
+ SleepEx = 0000000077898980 [0000000077845300]
+ 0000000077898980: 05000000 0100bfff ffff7f00 b879ffc8 [0000000037890330]
+ 0000000077898990: 11300142 00215002 80004200 00000020
+ 00000000778989A0: 13000000 01000000 00001000 80a50050
+
+sleepold.exe: Calling Sleep for 1 second.
+sleepold.exe: Calling SleepEx for 1 second.
+sleepold.exe: Calling Sleep again for 1 second.
+sleepold.exe: Done sleeping.
+
+slept64.dll: Detoured SleepEx().
+slept64.dll: Removed SleepEx() detour (0), slept 1000 ticks.
+
+-------- Replacing slept64.dll with dslept64.dll in sleepold.exe ------------
+ ..\..\bin.IA64\setdll.exe -r ..\..\bin.IA64\sleepold.exe
+Removing extra DLLs from binary files.
+ ..\..\bin.IA64\sleepold.exe:
+ KERNEL32.dll -> KERNEL32.dll
+ ..\..\bin.IA64\setdll.exe -d:..\..\bin.IA64\dslept64.dll ..\..\bin.IA64\sleepold.exe
+Adding c:\Code\Detours\bin.IA64\dslept64.dll to binary files.
+ ..\..\bin.IA64\sleepold.exe:
+ c:\Code\Detours\bin.IA64\dslept64.dll
+ KERNEL32.dll -> KERNEL32.dll
+
+-------- Should load dslept64.dll instead of slept64.dll --------------------
+ ..\..\bin.IA64\sleepold.exe
+dslept64.dll: Starting.
+ SleepEx = 0000000077898980 [0000000077845300]
+ 0000000077898980: 08181d0a 80054002 04004240 0400c400
+ 0000000077898990: 11300142 00215002 80004200 00000020
+ 00000000778989A0: 13000000 01000000 00001000 80a50050
+
+ EntryPoint = 000000013F12D580 [000000013F16CAB0]
+ 000000013F12D580: 01080d06 80050002 00620040 04080084
+ 000000013F12D590: 13000000 01000000 00001000 90eb0050
+ 000000013F12D5A0: 13080044 00210000 00001000 c0fcff58
+ EntryPoint after attach = 000000013F12D580 [000000013F16CAB0]
+ 000000013F12D580: 05000000 0100bfff ffff7f00 b82dffc8 [00000000FF120330]
+ 000000013F12D590: 13000000 01000000 00001000 90eb0050
+ 000000013F12D5A0: 13080044 00210000 00001000 c0fcff58
+ EntryPoint trampoline = 00000000FF120300 [00000000FF1203B0]
+ 00000000FF120300: 05000000 01003f01 00000020 00f00267
+ 00000000FF120310: 01080d06 80050002 00620040 04080084
+ 00000000FF120320: 05000000 01004000 00000000 78d200c0 [000000013F12D590]
+dslept64.dll: Detoured EntryPoint().
+dslept64.dll: Detoured SleepEx().
+ SleepEx = 0000000077898980 [0000000077845300]
+ 0000000077898980: 05000000 0100bfff ffff7f00 b879ffc8 [0000000037890330]
+ 0000000077898990: 11300142 00215002 80004200 00000020
+ 00000000778989A0: 13000000 01000000 00001000 80a50050
+
+dslept64.dll: Calling EntryPoint
+sleepold.exe: Starting (at 000000013F16C288).
+ SleepEx = 0000000077898980 [0000000077845300]
+ 0000000077898980: 05000000 0100bfff ffff7f00 b879ffc8 [0000000037890330]
+ 0000000077898990: 11300142 00215002 80004200 00000020
+ 00000000778989A0: 13000000 01000000 00001000 80a50050
+
+sleepold.exe: Calling Sleep for 1 second.
+sleepold.exe: Calling SleepEx for 1 second.
+sleepold.exe: Calling Sleep again for 1 second.
+sleepold.exe: Done sleeping.
+
+dslept64.dll: Removed Sleep() detours (0), slept 1000 ticks.
+
+-------- Removing dslept64.dll from sleepold.exe --------------------------
+ ..\..\bin.IA64\setdll.exe -r ..\..\bin.IA64\sleepold.exe
+Removing extra DLLs from binary files.
+ ..\..\bin.IA64\sleepold.exe:
+ KERNEL32.dll -> KERNEL32.dll
+
+-------- Should not load dslept64.dll or slept64.dll ------------------------
+ ..\..\bin.IA64\sleepold.exe
+sleepold.exe: Starting (at 000000013FCEC288).
+ SleepEx = 0000000077898980 [0000000077845300]
+ 0000000077898980: 08181d0a 80054002 04004240 0400c400
+ 0000000077898990: 11300142 00215002 80004200 00000020
+ 00000000778989A0: 13000000 01000000 00001000 80a50050
+
+sleepold.exe: Calling Sleep for 1 second.
+sleepold.exe: Calling SleepEx for 1 second.
+sleepold.exe: Calling Sleep again for 1 second.
+sleepold.exe: Done sleeping.
+
+
+-------- Should load slept64.dll dynamically using withdll.exe ------------
+ ..\..\bin.IA64\withdll.exe -d:..\..\bin.IA64\slept64.dll ..\..\bin.IA64\sleepold.exe
+withdll.exe: Starting: `..\..\bin.IA64\sleepold.exe'
+withdll.exe: with `c:\Code\Detours\bin.IA64\slept64.dll'
+slept64.dll: Starting.
+slept64.dll: ExeEntry=000000013FBFCAB0, DllEntry=000006FAEE9F6D80
+ SleepEx = 0000000077898980 [0000000077845300]
+ 0000000077898980: 08181d0a 80054002 04004240 0400c400
+ 0000000077898990: 11300142 00215002 80004200 00000020
+ 00000000778989A0: 13000000 01000000 00001000 80a50050
+
+sleepold.exe: Starting (at 000000013FBFC288).
+ SleepEx = 0000000077898980 [0000000077845300]
+ 0000000077898980: 05000000 0100bfff ffff7f00 b879ffc8 [0000000037890330]
+ 0000000077898990: 11300142 00215002 80004200 00000020
+ 00000000778989A0: 13000000 01000000 00001000 80a50050
+
+sleepold.exe: Calling Sleep for 1 second.
+sleepold.exe: Calling SleepEx for 1 second.
+sleepold.exe: Calling Sleep again for 1 second.
+sleepold.exe: Done sleeping.
+
+slept64.dll: Detoured SleepEx().
+slept64.dll: Removed SleepEx() detour (0), slept 1030 ticks.
+
+-------- Test completed. ------------------------------------------------
diff --git a/ext/detours/samples/slept/NORMAL_X64.TXT b/ext/detours/samples/slept/NORMAL_X64.TXT
new file mode 100644
index 0000000..de33e31
--- /dev/null
+++ b/ext/detours/samples/slept/NORMAL_X64.TXT
@@ -0,0 +1,202 @@
+-------- Reseting test binaries to initial state. -----------------------
+ ..\..\bin.X64\setdll.exe -r ..\..\bin.X64\sleepold.exe
+Removing extra DLLs from binary files.
+ ..\..\bin.X64\sleepold.exe:
+ KERNEL32.dll -> KERNEL32.dll
+
+-------- Should load detour self ----------------------------------------
+ ..\..\bin.X64\sleepbed.exe
+sleepbed.exe: Starting.
+sleepbed.exe: ExeEntry=000000013FE863E0, DllEntry=000000013FE9E610
+ SleepEx = 000007FEFD541150 [0000000076912B60]
+ 000007FEFD541150: 4c8bdc
+ 000007FEFD541153: 49895b08
+ 000007FEFD541157: 89542410
+
+sleepbed.exe: Detoured SleepEx().
+sleepbed.exe: After detour.
+ SleepEx = 000007FEFD541150 [0000000076912B60]
+ 000007FEFD541150: e923f0ff bf [000007FEBD540178]
+ 000007FEFD541155: cc [FFFFFFFFFFFFFFFF]
+ 000007FEFD541156: cc [FFFFFFFFFFFFFFFF]
+
+sleepbed.exe: Calling Sleep for 1 second.
+sleepbed.exe: Calling SleepEx for 1 second.
+sleepbed.exe: Calling Sleep again for 1 second.
+sleepbed.exe: Calling TimedSleepEx for 1 second.
+sleepbed.exe: Calling UntimedSleepEx for 1 second.
+sleepbed.exe: Done sleeping.
+
+sleepbed.exe: Removed SleepEx() detour (0), slept 4056 ticks.
+sleepbed.exe: GetSleptTicks() = 4056
+
+
+-------- Should load slept64.dll statically -------------------------------
+ ..\..\bin.X64\sleepnew.exe
+slept64.dll: Starting.
+slept64.dll: ExeEntry=000000013F56484C, DllEntry=000007FEF2E78B74
+ SleepEx = 000007FEFD541150 [0000000076912B60]
+ 000007FEFD541150: 4c8bdc
+ 000007FEFD541153: 49895b08
+ 000007FEFD541157: 89542410
+
+sleepnew.exe: Starting.
+ SleepEx = 000007FEFD541150 [0000000076912B60]
+ 000007FEFD541150: e923f0ff bf [000007FEBD540178]
+ 000007FEFD541155: cc [FFFFFFFFFFFFFFFF]
+ 000007FEFD541156: cc [FFFFFFFFFFFFFFFF]
+
+sleepnew.exe: Calling Sleep for 1 second.
+sleepnew.exe: Calling SleepEx for 1 second.
+sleepnew.exe: Calling Sleep again for 1 second.
+sleepnew.exe: Calling TimedSleep for 1 second.
+sleepnew.exe: Calling UntimedSleep for 1 second.
+sleepnew.exe: Done sleeping.
+
+sleepnew.exe: GetSleptTicks() = 4056
+
+slept64.dll: Detoured SleepEx().
+slept64.dll: Removed SleepEx() detour (0), slept 4056 ticks.
+
+-------- Should not load slept64.dll --------------------------------------
+ ..\..\bin.X64\sleepold.exe
+sleepold.exe: Starting (at 000000013FEF1350).
+ SleepEx = 000007FEFD541150 [0000000076912B60]
+ 000007FEFD541150: 4c8bdc
+ 000007FEFD541153: 49895b08
+ 000007FEFD541157: 89542410
+
+sleepold.exe: Calling Sleep for 1 second.
+sleepold.exe: Calling SleepEx for 1 second.
+sleepold.exe: Calling Sleep again for 1 second.
+sleepold.exe: Done sleeping.
+
+
+-------- Adding slept64.dll to sleepold.exe -------------------------------
+ ..\..\bin.X64\setdll.exe -d:..\..\bin.X64\slept64.dll ..\..\bin.X64\sleepold.exe
+Adding c:\Code\detours\bin.X64\slept64.dll to binary files.
+ ..\..\bin.X64\sleepold.exe:
+ c:\Code\detours\bin.X64\slept64.dll
+ KERNEL32.dll -> KERNEL32.dll
+
+-------- Should load slept64.dll statically -------------------------------
+ ..\..\bin.X64\sleepold.exe
+slept64.dll: Starting.
+slept64.dll: ExeEntry=000000013F554ADC, DllEntry=000007FEF2E78B74
+ SleepEx = 000007FEFD541150 [0000000076912B60]
+ 000007FEFD541150: 4c8bdc
+ 000007FEFD541153: 49895b08
+ 000007FEFD541157: 89542410
+
+sleepold.exe: Starting (at 000000013F551350).
+ SleepEx = 000007FEFD541150 [0000000076912B60]
+ 000007FEFD541150: e923f0ff bf [000007FEBD540178]
+ 000007FEFD541155: cc [FFFFFFFFFFFFFFFF]
+ 000007FEFD541156: cc [FFFFFFFFFFFFFFFF]
+
+sleepold.exe: Calling Sleep for 1 second.
+sleepold.exe: Calling SleepEx for 1 second.
+sleepold.exe: Calling Sleep again for 1 second.
+sleepold.exe: Done sleeping.
+
+slept64.dll: Detoured SleepEx().
+slept64.dll: Removed SleepEx() detour (0), slept 3042 ticks.
+
+-------- Replacing slept64.dll with dslept64.dll in sleepold.exe ------------
+ ..\..\bin.X64\setdll.exe -r ..\..\bin.X64\sleepold.exe
+Removing extra DLLs from binary files.
+ ..\..\bin.X64\sleepold.exe:
+ KERNEL32.dll -> KERNEL32.dll
+ ..\..\bin.X64\setdll.exe -d:..\..\bin.X64\dslept64.dll ..\..\bin.X64\sleepold.exe
+Adding c:\Code\detours\bin.X64\dslept64.dll to binary files.
+ ..\..\bin.X64\sleepold.exe:
+ c:\Code\detours\bin.X64\dslept64.dll
+ KERNEL32.dll -> KERNEL32.dll
+
+-------- Should load dslept64.dll instead of slept64.dll --------------------
+ ..\..\bin.X64\sleepold.exe
+dslept64.dll: Starting.
+ SleepEx = 000007FEFD541150 [0000000076912B60]
+ 000007FEFD541150: 4c8bdc
+ 000007FEFD541153: 49895b08
+ 000007FEFD541157: 89542410
+
+ EntryPoint = 000000013FB24ADC
+ 000000013FB24ADC: 4883ec28
+ 000000013FB24AE0: e8875f00 00 [000000013FB2AA6C]
+ 000000013FB24AE5: 4883c428
+ EntryPoint after attach = 000000013FB24ADC
+ 000000013FB24ADC: e997b6ff bf [00000000FFB20178]
+ 000000013FB24AE1: cc [FFFFFFFFFFFFFFFF]
+ 000000013FB24AE2: cc [FFFFFFFFFFFFFFFF]
+ EntryPoint trampoline = 00000000FFB20120
+ 00000000FFB20120: 4883ec28
+ 00000000FFB20124: e843a900 40 [000000013FB2AA6C]
+ 00000000FFB20129: ff253900 0000
+dslept64.dll: Detoured EntryPoint().
+dslept64.dll: Detoured SleepEx().
+ SleepEx = 000007FEFD541150 [0000000076912B60]
+ 000007FEFD541150: e923f0ff bf [000007FEBD540178]
+ 000007FEFD541155: cc [FFFFFFFFFFFFFFFF]
+ 000007FEFD541156: cc [FFFFFFFFFFFFFFFF]
+
+dslept64.dll: Calling EntryPoint
+sleepold.exe: Starting (at 000000013FB21350).
+ SleepEx = 000007FEFD541150 [0000000076912B60]
+ 000007FEFD541150: e923f0ff bf [000007FEBD540178]
+ 000007FEFD541155: cc [FFFFFFFFFFFFFFFF]
+ 000007FEFD541156: cc [FFFFFFFFFFFFFFFF]
+
+sleepold.exe: Calling Sleep for 1 second.
+sleepold.exe: Calling SleepEx for 1 second.
+sleepold.exe: Calling Sleep again for 1 second.
+sleepold.exe: Done sleeping.
+
+dslept64.dll: Removed Sleep() detours (0), slept 3042 ticks.
+
+-------- Removing dslept64.dll from sleepold.exe --------------------------
+ ..\..\bin.X64\setdll.exe -r ..\..\bin.X64\sleepold.exe
+Removing extra DLLs from binary files.
+ ..\..\bin.X64\sleepold.exe:
+ KERNEL32.dll -> KERNEL32.dll
+
+-------- Should not load dslept64.dll or slept64.dll ------------------------
+ ..\..\bin.X64\sleepold.exe
+sleepold.exe: Starting (at 000000013F551350).
+ SleepEx = 000007FEFD541150 [0000000076912B60]
+ 000007FEFD541150: 4c8bdc
+ 000007FEFD541153: 49895b08
+ 000007FEFD541157: 89542410
+
+sleepold.exe: Calling Sleep for 1 second.
+sleepold.exe: Calling SleepEx for 1 second.
+sleepold.exe: Calling Sleep again for 1 second.
+sleepold.exe: Done sleeping.
+
+
+-------- Should load slept64.dll dynamically using withdll.exe ------------
+ ..\..\bin.X64\withdll.exe -d:..\..\bin.X64\slept64.dll ..\..\bin.X64\sleepold.exe
+withdll.exe: Starting: `..\..\bin.X64\sleepold.exe'
+withdll.exe: with `c:\Code\detours\bin.X64\slept64.dll'
+slept64.dll: Starting.
+slept64.dll: ExeEntry=000000013FE84ADC, DllEntry=000007FEF3108B74
+ SleepEx = 000007FEFD541150 [0000000076912B60]
+ 000007FEFD541150: 4c8bdc
+ 000007FEFD541153: 49895b08
+ 000007FEFD541157: 89542410
+
+sleepold.exe: Starting (at 000000013FE81350).
+ SleepEx = 000007FEFD541150 [0000000076912B60]
+ 000007FEFD541150: e923f0ff bf [000007FEBD540178]
+ 000007FEFD541155: cc [FFFFFFFFFFFFFFFF]
+ 000007FEFD541156: cc [FFFFFFFFFFFFFFFF]
+
+sleepold.exe: Calling Sleep for 1 second.
+sleepold.exe: Calling SleepEx for 1 second.
+sleepold.exe: Calling Sleep again for 1 second.
+sleepold.exe: Done sleeping.
+
+slept64.dll: Detoured SleepEx().
+slept64.dll: Removed SleepEx() detour (0), slept 3042 ticks.
+
+-------- Test completed. ------------------------------------------------
diff --git a/ext/detours/samples/slept/NORMAL_X86.TXT b/ext/detours/samples/slept/NORMAL_X86.TXT
new file mode 100644
index 0000000..9794e48
--- /dev/null
+++ b/ext/detours/samples/slept/NORMAL_X86.TXT
@@ -0,0 +1,202 @@
+-------- Reseting test binaries to initial state. -----------------------
+ ..\..\bin.X86\setdll.exe -r ..\..\bin.X86\sleepold.exe
+Removing extra DLLs from binary files.
+ ..\..\bin.X86\sleepold.exe:
+ KERNEL32.dll -> KERNEL32.dll
+
+-------- Should load detour self ----------------------------------------
+ ..\..\bin.X86\sleepbed.exe
+sleepbed.exe: Starting.
+sleepbed.exe: ExeEntry=00B1572E, DllEntry=00000000
+ SleepEx = 74F51215
+ 74F51215: 8bff
+ 74F51217: 55
+ 74F51218: 8bec
+
+sleepbed.exe: Detoured SleepEx().
+sleepbed.exe: After detour.
+ SleepEx = 74F51215
+ 74F51215: e95600bc 8b [00B11270]
+ 74F5121A: 5d
+ 74F5121B: ebed [74F5120A]
+
+sleepbed.exe: Calling Sleep for 1 second.
+sleepbed.exe: Calling SleepEx for 1 second.
+sleepbed.exe: Calling Sleep again for 1 second.
+sleepbed.exe: Calling TimedSleepEx for 1 second.
+sleepbed.exe: Calling UntimedSleepEx for 1 second.
+sleepbed.exe: Done sleeping.
+
+sleepbed.exe: Removed SleepEx() detour (0), slept 2028 ticks.
+sleepbed.exe: GetSleptTicks() = 2028
+
+
+-------- Should load slept32.dll statically -------------------------------
+ ..\..\bin.X86\sleepnew.exe
+slept32.dll: Starting.
+slept32.dll: ExeEntry=012D3B1A, DllEntry=7248702E
+ SleepEx = 74F51215
+ 74F51215: 8bff
+ 74F51217: 55
+ 74F51218: 8bec
+
+sleepnew.exe: Starting.
+ SleepEx = 74F51215
+ 74F51215: e9560053 fd [72481270]
+ 74F5121A: 5d
+ 74F5121B: ebed [74F5120A]
+
+sleepnew.exe: Calling Sleep for 1 second.
+sleepnew.exe: Calling SleepEx for 1 second.
+sleepnew.exe: Calling Sleep again for 1 second.
+sleepnew.exe: Calling TimedSleep for 1 second.
+sleepnew.exe: Calling UntimedSleep for 1 second.
+sleepnew.exe: Done sleeping.
+
+sleepnew.exe: GetSleptTicks() = 2028
+
+slept32.dll: Detoured SleepEx().
+slept32.dll: Removed SleepEx() detour (0), slept 2028 ticks.
+
+-------- Should not load slept32.dll --------------------------------------
+ ..\..\bin.X86\sleepold.exe
+sleepold.exe: Starting (at 00971260).
+ SleepEx = 74F51215
+ 74F51215: 8bff
+ 74F51217: 55
+ 74F51218: 8bec
+
+sleepold.exe: Calling Sleep for 1 second.
+sleepold.exe: Calling SleepEx for 1 second.
+sleepold.exe: Calling Sleep again for 1 second.
+sleepold.exe: Done sleeping.
+
+
+-------- Adding slept32.dll to sleepold.exe -------------------------------
+ ..\..\bin.X86\setdll.exe -d:..\..\bin.X86\slept32.dll ..\..\bin.X86\sleepold.exe
+Adding c:\Code\detours\bin.X86\slept32.dll to binary files.
+ ..\..\bin.X86\sleepold.exe:
+ c:\Code\detours\bin.X86\slept32.dll
+ KERNEL32.dll -> KERNEL32.dll
+
+-------- Should load slept32.dll statically -------------------------------
+ ..\..\bin.X86\sleepold.exe
+slept32.dll: Starting.
+slept32.dll: ExeEntry=00AF3D4C, DllEntry=7248702E
+ SleepEx = 74F51215
+ 74F51215: 8bff
+ 74F51217: 55
+ 74F51218: 8bec
+
+sleepold.exe: Starting (at 00AF1260).
+ SleepEx = 74F51215
+ 74F51215: e9560053 fd [72481270]
+ 74F5121A: 5d
+ 74F5121B: ebed [74F5120A]
+
+sleepold.exe: Calling Sleep for 1 second.
+sleepold.exe: Calling SleepEx for 1 second.
+sleepold.exe: Calling Sleep again for 1 second.
+sleepold.exe: Done sleeping.
+
+slept32.dll: Detoured SleepEx().
+slept32.dll: Removed SleepEx() detour (0), slept 1014 ticks.
+
+-------- Replacing slept32.dll with dslept32.dll in sleepold.exe ------------
+ ..\..\bin.X86\setdll.exe -r ..\..\bin.X86\sleepold.exe
+Removing extra DLLs from binary files.
+ ..\..\bin.X86\sleepold.exe:
+ KERNEL32.dll -> KERNEL32.dll
+ ..\..\bin.X86\setdll.exe -d:..\..\bin.X86\dslept32.dll ..\..\bin.X86\sleepold.exe
+Adding c:\Code\detours\bin.X86\dslept32.dll to binary files.
+ ..\..\bin.X86\sleepold.exe:
+ c:\Code\detours\bin.X86\dslept32.dll
+ KERNEL32.dll -> KERNEL32.dll
+
+-------- Should load dslept32.dll instead of slept32.dll --------------------
+ ..\..\bin.X86\sleepold.exe
+dslept32.dll: Starting.
+ SleepEx = 74F51215
+ 74F51215: 8bff
+ 74F51217: 55
+ 74F51218: 8bec
+
+ EntryPoint = 00263D4C
+ 00263D4C: e8d75400 00 [00269228]
+ 00263D51: e995feff ff [00263BEB]
+ 00263D56: 3b0d8412 2800
+ EntryPoint after attach = 00263D4C
+ 00263D4C: e96fd502 72 [722912C0]
+ 00263D51: e995feff ff [00263BEB]
+ 00263D56: 3b0d8412 2800
+ EntryPoint trampoline = 402500D8
+ 402500D8: e84b9101 c0 [00269228]
+ 402500DD: e96f3c01 c0 [00263D51]
+ 402500E2: cc [FFFFFFFF]
+dslept32.dll: Detoured EntryPoint().
+dslept32.dll: Detoured SleepEx().
+ SleepEx = 74F51215
+ 74F51215: e9560034 fd [72291270]
+ 74F5121A: 5d
+ 74F5121B: ebed [74F5120A]
+
+dslept32.dll: Calling EntryPoint
+sleepold.exe: Starting (at 00261260).
+ SleepEx = 74F51215
+ 74F51215: e9560034 fd [72291270]
+ 74F5121A: 5d
+ 74F5121B: ebed [74F5120A]
+
+sleepold.exe: Calling Sleep for 1 second.
+sleepold.exe: Calling SleepEx for 1 second.
+sleepold.exe: Calling Sleep again for 1 second.
+sleepold.exe: Done sleeping.
+
+dslept32.dll: Removed Sleep() detours (0), slept 1014 ticks.
+
+-------- Removing dslept32.dll from sleepold.exe --------------------------
+ ..\..\bin.X86\setdll.exe -r ..\..\bin.X86\sleepold.exe
+Removing extra DLLs from binary files.
+ ..\..\bin.X86\sleepold.exe:
+ KERNEL32.dll -> KERNEL32.dll
+
+-------- Should not load dslept32.dll or slept32.dll ------------------------
+ ..\..\bin.X86\sleepold.exe
+sleepold.exe: Starting (at 00E01260).
+ SleepEx = 74F51215
+ 74F51215: 8bff
+ 74F51217: 55
+ 74F51218: 8bec
+
+sleepold.exe: Calling Sleep for 1 second.
+sleepold.exe: Calling SleepEx for 1 second.
+sleepold.exe: Calling Sleep again for 1 second.
+sleepold.exe: Done sleeping.
+
+
+-------- Should load slept32.dll dynamically using withdll.exe ------------
+ ..\..\bin.X86\withdll.exe -d:..\..\bin.X86\slept32.dll ..\..\bin.X86\sleepold.exe
+withdll.exe: Starting: `..\..\bin.X86\sleepold.exe'
+withdll.exe: with `c:\Code\detours\bin.X86\slept32.dll'
+slept32.dll: Starting.
+slept32.dll: ExeEntry=011A3D4C, DllEntry=7248702E
+ SleepEx = 74F51215
+ 74F51215: 8bff
+ 74F51217: 55
+ 74F51218: 8bec
+
+sleepold.exe: Starting (at 011A1260).
+ SleepEx = 74F51215
+ 74F51215: e9560053 fd [72481270]
+ 74F5121A: 5d
+ 74F5121B: ebed [74F5120A]
+
+sleepold.exe: Calling Sleep for 1 second.
+sleepold.exe: Calling SleepEx for 1 second.
+sleepold.exe: Calling Sleep again for 1 second.
+sleepold.exe: Done sleeping.
+
+slept32.dll: Detoured SleepEx().
+slept32.dll: Removed SleepEx() detour (0), slept 1014 ticks.
+
+-------- Test completed. ------------------------------------------------
diff --git a/ext/detours/samples/slept/dslept.cpp b/ext/detours/samples/slept/dslept.cpp
new file mode 100644
index 0000000..3929820
--- /dev/null
+++ b/ext/detours/samples/slept/dslept.cpp
@@ -0,0 +1,141 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detour Test Program (dslept.cpp of dslept.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+// An example dynamically detouring a function.
+//
+#include <stdio.h>
+#include <windows.h>
+#include "detours.h"
+#include "slept.h"
+
+#include "verify.cpp"
+
+LONG dwSlept = 0;
+
+static DWORD (WINAPI * TrueSleepEx)(DWORD dwMilliseconds, BOOL bAlertable) = NULL;
+static int (WINAPI * TrueEntryPoint)(VOID) = NULL;
+static int (WINAPI * RawEntryPoint)(VOID) = NULL;
+
+DWORD WINAPI UntimedSleepEx(DWORD dwMilliseconds, BOOL bAlertable)
+{
+ if (TrueSleepEx != NULL) {
+ return TrueSleepEx(dwMilliseconds, bAlertable);
+ }
+ return 0;
+}
+
+DWORD WINAPI TimedSleepEx(DWORD dwMilliseconds, BOOL bAlertable)
+{
+ DWORD dwBeg = GetTickCount();
+ DWORD ret = TrueSleepEx(dwMilliseconds, bAlertable);
+ DWORD dwEnd = GetTickCount();
+
+ InterlockedExchangeAdd(&dwSlept, dwEnd - dwBeg);
+ return ret;
+}
+
+DWORD WINAPI GetSleptTicks(VOID)
+{
+ return dwSlept;
+}
+
+int WINAPI TimedEntryPoint(VOID)
+{
+ // We couldn't call LoadLibrary in DllMain,
+ // so we detour SleepEx here...
+ LONG error;
+
+ TrueSleepEx = (DWORD (WINAPI *)(DWORD, BOOL))
+ DetourFindFunction("kernel32.dll", "SleepEx");
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)TrueSleepEx, TimedSleepEx);
+ error = DetourTransactionCommit();
+
+ if (error == NO_ERROR) {
+ printf("dslept" DETOURS_STRINGIFY(DETOURS_BITS) ".dll: "
+ " Detoured SleepEx().\n");
+
+ }
+ else {
+ printf("dslept" DETOURS_STRINGIFY(DETOURS_BITS) ".dll: "
+ " Error detouring SleepEx(): %ld\n", error);
+ }
+
+ Verify("SleepEx", (PVOID)SleepEx);
+ printf("\n");
+ fflush(stdout);
+
+ printf("dslept" DETOURS_STRINGIFY(DETOURS_BITS) ".dll: "
+ " Calling EntryPoint\n");
+ fflush(stdout);
+
+ return TrueEntryPoint();
+}
+
+BOOL WINAPI DllMain(HINSTANCE hinst, DWORD dwReason, LPVOID reserved)
+{
+ LONG error;
+ (void)hinst;
+ (void)reserved;
+
+ if (DetourIsHelperProcess()) {
+ return TRUE;
+ }
+
+ if (dwReason == DLL_PROCESS_ATTACH) {
+ DetourRestoreAfterWith();
+
+ printf("dslept" DETOURS_STRINGIFY(DETOURS_BITS) ".dll: "
+ " Starting.\n");
+ Verify("SleepEx", (PVOID)SleepEx);
+ printf("\n");
+ fflush(stdout);
+
+ // NB: DllMain can't call LoadLibrary, so we hook the app entry point.
+ TrueEntryPoint = (int (WINAPI *)(VOID))DetourGetEntryPoint(NULL);
+ RawEntryPoint = TrueEntryPoint;
+
+ Verify("EntryPoint", RawEntryPoint);
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)TrueEntryPoint, TimedEntryPoint);
+ error = DetourTransactionCommit();
+
+ Verify("EntryPoint after attach", RawEntryPoint);
+ Verify("EntryPoint trampoline", TrueEntryPoint);
+
+ if (error == NO_ERROR) {
+ printf("dslept" DETOURS_STRINGIFY(DETOURS_BITS) ".dll: "
+ " Detoured EntryPoint().\n");
+ }
+ else {
+ printf("dslept" DETOURS_STRINGIFY(DETOURS_BITS) ".dll: "
+ " Error detouring EntryPoint(): %ld\n", error);
+ }
+ }
+ else if (dwReason == DLL_PROCESS_DETACH) {
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ if (TrueSleepEx != NULL) {
+ DetourDetach(&(PVOID&)TrueSleepEx, (PVOID)TimedSleepEx);
+ }
+ DetourDetach(&(PVOID&)TrueEntryPoint, TimedEntryPoint);
+ error = DetourTransactionCommit();
+
+ printf("dslept" DETOURS_STRINGIFY(DETOURS_BITS) ".dll: "
+ " Removed Sleep() detours (%ld), slept %ld ticks.\n", error, dwSlept);
+
+ fflush(stdout);
+ }
+ return TRUE;
+}
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/slept/dslept.rc b/ext/detours/samples/slept/dslept.rc
new file mode 100644
index 0000000..c9bc3b7
--- /dev/null
+++ b/ext/detours/samples/slept/dslept.rc
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Version information for dslept.rc.
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include "detver.h"
+
+#define VER_INTERNALNAME_STR "dslept" DETOURS_STRINGIFY(DETOURS_BITS)
+#define VER_ORIGINALFILENAME_STR "dslept" DETOURS_STRINGIFY(DETOURS_BITS) ".dll"
+#define VER_FILEDESCRIPTION_STR "Detours Sleep Interception Module"
+#define VER_COMPANYNAME_STR "Microsoft Corporation"
+
+#include "common.ver"
diff --git a/ext/detours/samples/slept/sleepbed.cpp b/ext/detours/samples/slept/sleepbed.cpp
new file mode 100644
index 0000000..49b7934
--- /dev/null
+++ b/ext/detours/samples/slept/sleepbed.cpp
@@ -0,0 +1,103 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detour Test Program (sleepbed.cpp of sleepbed.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include <windows.h>
+#include <stdio.h>
+
+#include "verify.cpp"
+
+static BOOL fBroke = FALSE;
+static LONG dwSlept = 0;
+static DWORD (WINAPI * TrueSleepEx)(DWORD dwMilliseconds, BOOL bAlertable)
+ = SleepEx;
+
+DWORD WINAPI UntimedSleepEx(DWORD dwMilliseconds, BOOL bAlertable)
+{
+ return TrueSleepEx(dwMilliseconds, bAlertable);
+}
+
+DWORD WINAPI TimedSleepEx(DWORD dwMilliseconds, BOOL bAlertable)
+{
+ DWORD dwBeg = GetTickCount();
+ DWORD ret = TrueSleepEx(dwMilliseconds, bAlertable);
+ DWORD dwEnd = GetTickCount();
+
+ if (!fBroke) {
+ fBroke = TRUE;
+ // DebugBreak();
+ }
+
+ InterlockedExchangeAdd(&dwSlept, dwEnd - dwBeg);
+ return ret;
+}
+
+DWORD WINAPI GetSleptTicks(VOID)
+{
+ return dwSlept;
+}
+
+//
+///////////////////////////////////////////////////////////////// End of File.
+
+int __cdecl main(void)
+{
+ int error = 0;
+
+ printf("sleepbed.exe: Starting.\n");
+ PVOID pbExeEntry = DetourGetEntryPoint(NULL);
+ printf("sleepbed.exe: ExeEntry=%p\n", pbExeEntry);
+
+ Verify("SleepEx", (PVOID)SleepEx);
+ printf("\n");
+ fflush(stdout);
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)TrueSleepEx, TimedSleepEx);
+ error = DetourTransactionCommit();
+
+ if (error == NO_ERROR) {
+ printf("sleepbed.exe: Detoured SleepEx().\n");
+ }
+ else {
+ printf("sleepbed.exe: Error detouring SleepEx(): %d\n", error);
+ return error;
+ }
+ fflush(stdout);
+
+ printf("sleepbed.exe: After detour.\n");
+ Verify("SleepEx", (PBYTE)SleepEx);
+ printf("\n");
+ fflush(stdout);
+
+ printf("sleepbed.exe: Calling Sleep for 1 second.\n");
+ Sleep(1000);
+ printf("sleepbed.exe: Calling SleepEx for 1 second.\n");
+ SleepEx(1000, true);
+ printf("sleepbed.exe: Calling Sleep again for 1 second.\n");
+ Sleep(1000);
+ printf("sleepbed.exe: Calling TimedSleepEx for 1 second.\n");
+ TimedSleepEx(1000, false);
+ printf("sleepbed.exe: Calling UntimedSleepEx for 1 second.\n");
+ UntimedSleepEx(1000, false);
+ printf("sleepbed.exe: Done sleeping.\n\n");
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourDetach(&(PVOID&)TrueSleepEx, TimedSleepEx);
+ error = DetourTransactionCommit();
+ printf("sleepbed.exe: Removed SleepEx() detour (%d), slept %ld ticks.\n",
+ error, dwSlept);
+ fflush(stdout);
+
+ printf("sleepbed.exe: GetSleptTicks() = %ld\n\n", GetSleptTicks());
+ return error;
+}
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/slept/sleepnew.cpp b/ext/detours/samples/slept/sleepnew.cpp
new file mode 100644
index 0000000..a3176f2
--- /dev/null
+++ b/ext/detours/samples/slept/sleepnew.cpp
@@ -0,0 +1,76 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detour Test Program (sleepnew.cpp of sleepnew.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include <windows.h>
+#include <stdio.h>
+#include "slept.h"
+
+#include "verify.cpp"
+
+int __cdecl main(void)
+{
+ printf("sleepnew.exe: Starting.\n");
+ Verify("SleepEx", (PBYTE)SleepEx);
+ printf("\n");
+ fflush(stdout);
+
+ printf("sleepnew.exe: Calling Sleep for 1 second.\n");
+ Sleep(1000);
+ printf("sleepnew.exe: Calling SleepEx for 1 second.\n");
+ SleepEx(1000, true);
+ printf("sleepnew.exe: Calling Sleep again for 1 second.\n");
+ Sleep(1000);
+ printf("sleepnew.exe: Calling TimedSleep for 1 second.\n");
+ TimedSleepEx(1000, FALSE);
+ printf("sleepnew.exe: Calling UntimedSleep for 1 second.\n");
+ UntimedSleepEx(1000, FALSE);
+ printf("sleepnew.exe: Done sleeping.\n\n");
+
+#if 0
+ // This code enumerates the virtual address space and attempts to reserve
+ // all unused space below 8GB.
+ //
+ for (PBYTE pbTry = (PBYTE)0x10000; pbTry < (PBYTE)0x200000000;) {
+ MEMORY_BASIC_INFORMATION mbi;
+
+ if (!VirtualQuery(pbTry, &mbi, sizeof(mbi))) {
+ break;
+ }
+
+ if (mbi.State == MEM_FREE && mbi.RegionSize > 0x10000) {
+ PBYTE pbBase = (PBYTE)((((ULONG_PTR)pbTry) + 0xffff) & 0xffffffffffff0000);
+ SIZE_T cbTry = mbi.RegionSize & 0xffffffffffff0000;
+ if (cbTry > 0x40000000) {
+ cbTry = 0x40000000;
+ }
+ PVOID pvRegion = VirtualAlloc(pbBase, cbTry,
+ MEM_RESERVE,
+ PAGE_NOACCESS);
+ if (pvRegion == NULL) {
+ printf("---%p..%p failed.\n", pbBase, mbi.RegionSize - 0x10000);
+ }
+ else {
+ continue;
+ }
+ }
+
+ printf(" %p..%p %6x [%p]\n",
+ mbi.BaseAddress, (PBYTE)mbi.BaseAddress + mbi.RegionSize - 1,
+ mbi.State,
+ pbTry);
+
+ pbTry = (PBYTE)mbi.BaseAddress + mbi.RegionSize;
+ }
+#endif
+
+ printf("sleepnew.exe: GetSleptTicks() = %ld\n\n", GetSleptTicks());
+ return 0;
+}
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/slept/sleepold.cpp b/ext/detours/samples/slept/sleepold.cpp
new file mode 100644
index 0000000..fb3abdd
--- /dev/null
+++ b/ext/detours/samples/slept/sleepold.cpp
@@ -0,0 +1,69 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detour Test Program (sleepold.cpp of sleepold.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include <windows.h>
+#include <stdio.h>
+
+#include "verify.cpp"
+
+int __cdecl main(int argc, char **argv)
+{
+ BOOL fQuiet = FALSE;
+
+ if (argc == 2 && _stricmp(argv[1], "-quiet") == 0) {
+ fQuiet = TRUE;
+ }
+
+ //
+ // Verify what the code looks like.
+ //
+ printf("sleepold.exe: Starting (at %p).\n", main);
+ if (!fQuiet) {
+ Verify("SleepEx", (PBYTE)SleepEx);
+ printf("\n");
+ }
+ fflush(stdout);
+
+ //
+ // See if another process wants us to wait on a shared event.
+ // This helps in testing loading a DLL into a new process.
+
+ if (argc == 2 && _stricmp(argv[1], "-wait") == 0) {
+ HANDLE hEvent = OpenEventA(SYNCHRONIZE, FALSE, "detours_load_test_event");
+ if (hEvent) {
+ printf("sleepold.exe: Waiting for detours_load_test_event to be set.\n");
+ fflush(stdout);
+ WaitForSingleObject(hEvent, INFINITE);
+ }
+ else {
+ printf("sleepold.exe: Couldn't open detours_load_test_event.\n");
+ }
+ }
+
+ //
+ // Try out sleep (which may be detours).
+ //
+ printf("sleepold.exe: Calling Sleep for 1 second.\n");
+ Sleep(1000);
+
+ printf("sleepold.exe: Calling SleepEx for 1 second.\n");
+ SleepEx(1000, false);
+
+ printf("sleepold.exe: Calling Sleep again for 1 second.\n");
+ Sleep(1000);
+
+ // DebugBreak();
+
+ printf("sleepold.exe: Done sleeping.\n\n");
+ fflush(stdout);
+
+ return 0;
+}
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/slept/slept.cpp b/ext/detours/samples/slept/slept.cpp
new file mode 100644
index 0000000..5903295
--- /dev/null
+++ b/ext/detours/samples/slept/slept.cpp
@@ -0,0 +1,130 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detour Test Program (slept.cpp of slept.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#include <stdio.h>
+#include <windows.h>
+#include "detours.h"
+#include "slept.h"
+
+#include "verify.cpp"
+
+static BOOL fBroke = FALSE;
+static LONG dwSlept = 0;
+static DWORD (WINAPI * TrueSleepEx)(DWORD dwMilliseconds, BOOL bAlertable) = SleepEx;
+
+DWORD WINAPI UntimedSleepEx(DWORD dwMilliseconds, BOOL bAlertable)
+{
+ return TrueSleepEx(dwMilliseconds, bAlertable);
+}
+
+DWORD WINAPI TimedSleepEx(DWORD dwMilliseconds, BOOL bAlertable)
+{
+ DWORD dwBeg = GetTickCount();
+ DWORD ret = TrueSleepEx(dwMilliseconds, bAlertable);
+ DWORD dwEnd = GetTickCount();
+
+ if (!fBroke) {
+ fBroke = TRUE;
+ // DebugBreak();
+ }
+
+ InterlockedExchangeAdd(&dwSlept, dwEnd - dwBeg);
+ return ret;
+}
+
+DWORD WINAPI GetSleptTicks(VOID)
+{
+ return dwSlept;
+}
+
+DWORD WINAPI TestTicks(VOID)
+{
+ return TestTicksEx(0);
+}
+
+DWORD WINAPI TestTicksEx(DWORD Add)
+{
+ PDWORD pdw = new DWORD [Add + 1];
+
+ if (pdw != NULL) {
+ pdw[0] = dwSlept;
+ for (DWORD n = 1; n < Add + 1; n++) {
+ pdw[n] = pdw[n-1] + 1;
+ }
+
+ for (DWORD n = 1; n < Add + 1; n++) {
+ pdw[n-1] = pdw[n-1] - 1;
+ }
+
+ for (DWORD n = 1; n < Add + 1; n++) {
+ pdw[n] = pdw[n-1] + 1;
+ }
+
+ Add = pdw[Add] - Add;
+
+ delete [] pdw;
+ }
+ else {
+ Add = dwSlept + Add;
+ }
+
+ return Add;
+}
+
+BOOL WINAPI DllMain(HINSTANCE hinst, DWORD dwReason, LPVOID reserved)
+{
+ LONG error;
+ (void)hinst;
+ (void)reserved;
+
+ if (DetourIsHelperProcess()) {
+ return TRUE;
+ }
+
+ if (dwReason == DLL_PROCESS_ATTACH) {
+ DetourRestoreAfterWith();
+
+ printf("slept" DETOURS_STRINGIFY(DETOURS_BITS) ".dll: "
+ " Starting.\n");
+ PVOID pbExeEntry = DetourGetEntryPoint(NULL);
+ PVOID pbDllEntry = DetourGetEntryPoint(hinst);
+ printf("slept" DETOURS_STRINGIFY(DETOURS_BITS) ".dll: "
+ " ExeEntry=%p, DllEntry=%p\n", pbExeEntry, pbDllEntry);
+
+ Verify("SleepEx", (PVOID)SleepEx);
+ printf("\n");
+ fflush(stdout);
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)TrueSleepEx, TimedSleepEx);
+ error = DetourTransactionCommit();
+
+ if (error == NO_ERROR) {
+ printf("slept" DETOURS_STRINGIFY(DETOURS_BITS) ".dll: "
+ " Detoured SleepEx() @ %p.\n", TrueSleepEx);
+ }
+ else {
+ printf("slept" DETOURS_STRINGIFY(DETOURS_BITS) ".dll: "
+ " Error detouring SleepEx(): %ld\n", error);
+ }
+ }
+ else if (dwReason == DLL_PROCESS_DETACH) {
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourDetach(&(PVOID&)TrueSleepEx, TimedSleepEx);
+ error = DetourTransactionCommit();
+ printf("slept" DETOURS_STRINGIFY(DETOURS_BITS) ".dll: "
+ " Removed SleepEx() detour (%ld), slept %ld ticks.\n", error, dwSlept);
+ fflush(stdout);
+ }
+ return TRUE;
+}
+
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/slept/slept.h b/ext/detours/samples/slept/slept.h
new file mode 100644
index 0000000..9cc71d8
--- /dev/null
+++ b/ext/detours/samples/slept/slept.h
@@ -0,0 +1,18 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detour Test Program (slept.h of slept.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#pragma once
+
+DWORD WINAPI UntimedSleepEx(DWORD dwMilliseconds, BOOL bAlertable);
+DWORD WINAPI TimedSleepEx(DWORD dwMilliseconds, BOOL bAlertable);
+DWORD WINAPI GetSleptTicks(VOID);
+DWORD WINAPI TestTicks(VOID);
+DWORD WINAPI TestTicksEx(DWORD Add);
+
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/slept/slept.rc b/ext/detours/samples/slept/slept.rc
new file mode 100644
index 0000000..1e5e3a8
--- /dev/null
+++ b/ext/detours/samples/slept/slept.rc
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Version information for sleep.rc.
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include "detver.h"
+
+#define VER_INTERNALNAME_STR "sleep" DETOURS_STRINGIFY(DETOURS_BITS)
+#define VER_ORIGINALFILENAME_STR "sleep" DETOURS_STRINGIFY(DETOURS_BITS) ".dll"
+#define VER_FILEDESCRIPTION_STR "Detours Sleep Test Module"
+#define VER_COMPANYNAME_STR "Microsoft Corporation"
+
+#include "common.ver"
diff --git a/ext/detours/samples/slept/verify.cpp b/ext/detours/samples/slept/verify.cpp
new file mode 100644
index 0000000..d7a38fd
--- /dev/null
+++ b/ext/detours/samples/slept/verify.cpp
@@ -0,0 +1,74 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detour Test Program (verify.cpp)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include <detours.h>
+
+static VOID Dump(PBYTE pbBytes, LONG nBytes, PBYTE pbTarget)
+{
+ for (LONG n = 0; n < nBytes; n += 16) {
+ printf(" %p: ", pbBytes + n);
+ for (LONG m = n; m < n + 16; m++) {
+ if (m >= nBytes) {
+ printf(" ");
+ }
+ else {
+ printf("%02x", pbBytes[m]);
+ }
+ if (m % 4 == 3) {
+ printf(" ");
+ }
+ }
+ if (n == 0 && pbTarget != DETOUR_INSTRUCTION_TARGET_NONE) {
+ printf(" [%p]", pbTarget);
+ }
+ printf("\n");
+ }
+}
+
+static VOID Decode(PCSTR pszDesc, PBYTE pbCode, PBYTE pbOther, PBYTE pbPointer, LONG nInst)
+{
+ if (pbCode != pbPointer) {
+ printf(" %s = %p [%p]\n", pszDesc, pbCode, pbPointer);
+ }
+ else {
+ printf(" %s = %p\n", pszDesc, pbCode);
+ }
+
+ if (pbCode == pbOther) {
+ printf(" ... unchanged ...\n");
+ return;
+ }
+
+ PBYTE pbSrc = pbCode;
+ PBYTE pbEnd;
+ PVOID pbTarget;
+ for (LONG n = 0; n < nInst; n++) {
+ pbEnd = (PBYTE)DetourCopyInstruction(NULL, NULL, pbSrc, &pbTarget, NULL);
+ Dump(pbSrc, (int)(pbEnd - pbSrc), (PBYTE)pbTarget);
+ pbSrc = pbEnd;
+ }
+}
+
+
+VOID WINAPI Verify(PCHAR pszFunc, PVOID pvPointer)
+{
+ PVOID pvCode = DetourCodeFromPointer(pvPointer, NULL);
+
+ Decode(pszFunc, (PBYTE)pvCode, NULL, (PBYTE)pvPointer, 3);
+}
+
+VOID WINAPI VerifyEx(PCHAR pszFunc, PVOID pvPointer, LONG nInst)
+{
+ PVOID pvCode = DetourCodeFromPointer(pvPointer, NULL);
+
+ Decode(pszFunc, (PBYTE)pvCode, NULL, (PBYTE)pvPointer, nInst);
+}
+
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/syelog/Makefile b/ext/detours/samples/syelog/Makefile
new file mode 100644
index 0000000..89e7967
--- /dev/null
+++ b/ext/detours/samples/syelog/Makefile
@@ -0,0 +1,101 @@
+##############################################################################
+##
+## Makefile for Detours.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+##############################################################################
+
+TARGETOS=WINNT
+!include ..\common.mak
+
+LIBS=$(LIBS) kernel32.lib
+
+##############################################################################
+
+all: dirs \
+ $(INCD)\syelog.h \
+ $(LIBD)\syelog.lib \
+ $(BIND)\syelogd.exe \
+ \
+ $(BIND)\sltest.exe \
+ $(BIND)\sltestp.exe \
+ \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\syelogd.bsc \
+ $(OBJD)\sltest.bsc \
+ $(OBJD)\sltestp.bsc \
+!ENDIF
+
+##############################################################################
+##
+clean:
+ -del *~ test.txt 2> nul
+ -del $(INCD)\syelog.* 2>nul
+ -del $(LIBD)\syelog.* 2>nul
+ -del $(BIND)\syelogd.* 2>nul
+ -del $(BIND)\sltest.* 2>nul
+ -del $(BIND)\sltestp.* 2>nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+##############################################################################
+
+dirs:
+ @if not exist $(INCD) mkdir $(INCD) && echo. Created $(INCD)
+ @if not exist $(LIBD) mkdir $(LIBD) && echo. Created $(LIBD)
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+$(OBJD)\syelog.obj : syelog.cpp syelog.h
+$(OBJD)\syelogd.obj: syelogd.cpp syelog.h
+$(OBJD)\sltest.obj: sltest.cpp syelog.h
+$(OBJD)\sltestp.obj: sltestp.cpp syelog.h
+
+$(INCD)\syelog.h : syelog.h
+ copy syelog.h $@
+
+$(LIBD)\syelog.lib : $(OBJD)\syelog.obj
+ link /lib $(LIBFLAGS) /out:$@ $(OBJD)\syelog.obj
+
+$(BIND)\sltest.exe: $(OBJD)\sltest.obj $(OBJD)\syelog.obj $(DEPS)
+ $(CC) $(CFLAGS) /Fe$@ /Fd$(@R).pdb $(OBJD)\sltest.obj \
+ /link $(LINKFLAGS) $(LIBS)
+
+$(OBJD)\sltest.bsc : $(OBJD)\sltest.obj
+ bscmake /v /n /o $@ $(OBJD)\sltest.sbr
+
+$(BIND)\sltestp.exe: $(OBJD)\sltestp.obj $(DEPS)
+ $(CC) $(CFLAGS) /Fe$@ /Fd$(@R).pdb $(OBJD)\sltestp.obj \
+ /link $(LINKFLAGS) $(LIBS)
+
+$(OBJD)\sltestp.bsc : $(OBJD)\sltestp.obj
+ bscmake /v /n /o $@ $(OBJD)\sltestp.sbr
+
+$(LIBD)\detours.lib:
+ cd $(ROOT)\src
+ nmake /nologo
+ cd $(MAKEDIR)
+
+$(BIND)\syelogd.exe: $(OBJD)\syelogd.obj $(DEPS)
+ $(CC) $(CFLAGS) /Fe$@ /Fd$(@R).pdb $(OBJD)\syelogd.obj \
+ /link $(LINKFLAGS) ws2_32.lib mswsock.lib advapi32.lib
+
+$(OBJD)\syelogd.bsc : $(OBJD)\syelogd.obj
+ bscmake /v /n /o $@ $(OBJD)\syelogd.sbr
+
+##############################################################################
+
+test: $(BIND)\syelogd.exe $(BIND)\sltest.exe $(BIND)\sltestp.exe
+ @echo -------- Logging output to test.txt ------------
+ start $(BIND)\syelogd.exe test.txt
+ $(BIND)\sleep5.exe 1
+ $(BIND)\sltestp.exe
+ $(BIND)\sltest.exe /x
+ type test.txt
+
+################################################################# End of File.
diff --git a/ext/detours/samples/syelog/sltest.cpp b/ext/detours/samples/syelog/sltest.cpp
new file mode 100644
index 0000000..8377872
--- /dev/null
+++ b/ext/detours/samples/syelog/sltest.cpp
@@ -0,0 +1,145 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (sltest.cpp of sltest.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+// Test the named-pipe-based connection with syelog.lib to the syelog
+// system-event logger.
+//
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#pragma warning(push)
+#if _MSC_VER > 1400
+#pragma warning(disable:6102 6103) // /analyze warnings
+#endif
+#include <strsafe.h>
+#pragma warning(pop)
+#include "syelog.h"
+#include "detours.h"
+
+extern "C" {
+
+ HANDLE ( WINAPI *
+ Real_CreateFileW)(LPCWSTR a0,
+ DWORD a1,
+ DWORD a2,
+ LPSECURITY_ATTRIBUTES a3,
+ DWORD a4,
+ DWORD a5,
+ HANDLE a6)
+ = CreateFileW;
+
+ BOOL ( WINAPI *
+ Real_WriteFile)(HANDLE hFile,
+ LPCVOID lpBuffer,
+ DWORD nNumberOfBytesToWrite,
+ LPDWORD lpNumberOfBytesWritten,
+ LPOVERLAPPED lpOverlapped)
+ = WriteFile;
+ BOOL ( WINAPI *
+ Real_FlushFileBuffers)(HANDLE hFile)
+ = FlushFileBuffers;
+ BOOL ( WINAPI *
+ Real_CloseHandle)(HANDLE hObject)
+ = CloseHandle;
+
+ BOOL ( WINAPI *
+ Real_WaitNamedPipeW)(LPCWSTR lpNamedPipeName, DWORD nTimeOut)
+ = WaitNamedPipeW;
+ BOOL ( WINAPI *
+ Real_SetNamedPipeHandleState)(HANDLE hNamedPipe,
+ LPDWORD lpMode,
+ LPDWORD lpMaxCollectionCount,
+ LPDWORD lpCollectDataTimeout)
+ = SetNamedPipeHandleState;
+
+ DWORD ( WINAPI *
+ Real_GetCurrentProcessId)(VOID)
+ = GetCurrentProcessId;
+ VOID ( WINAPI *
+ Real_GetSystemTimeAsFileTime)(LPFILETIME lpSystemTimeAsFileTime)
+ = GetSystemTimeAsFileTime;
+
+ VOID ( WINAPI *
+ Real_InitializeCriticalSection)(LPCRITICAL_SECTION lpSection)
+ = InitializeCriticalSection;
+ VOID ( WINAPI *
+ Real_EnterCriticalSection)(LPCRITICAL_SECTION lpSection)
+ = EnterCriticalSection;
+ VOID ( WINAPI *
+ Real_LeaveCriticalSection)(LPCRITICAL_SECTION lpSection)
+ = LeaveCriticalSection;
+}
+
+int main(int argc, char **argv)
+{
+ BOOL fNeedHelp = FALSE;
+ BOOL fRequestExitOnClose = FALSE;
+
+ int arg = 1;
+ for (; arg < argc && (argv[arg][0] == '-' || argv[arg][0] == '/'); arg++) {
+ CHAR *argn = argv[arg] + 1;
+ CHAR *argp = argn;
+ while (*argp && *argp != ':') {
+ argp++;
+ }
+ if (*argp == ':') {
+ *argp++ = '\0';
+ }
+
+ switch (argn[0]) {
+
+ case 'x': // Request exit on close.
+ case 'X':
+ fRequestExitOnClose = TRUE;
+ break;
+
+ case '?': // Help.
+ fNeedHelp = TRUE;
+ break;
+
+ default:
+ fNeedHelp = TRUE;
+ printf("SLTEST: Bad argument: %s:%s\n", argn, argp);
+ break;
+ }
+ }
+
+ if (fNeedHelp) {
+ printf("Usage:\n"
+ " sltest.exe [options] message\n"
+ "Options:\n"
+ " /x Ask syelogd.exe to terminate when this connect closes.\n"
+ " /? Display this help message.\n"
+ "\n");
+ exit(1);
+ }
+
+ SyelogOpen("sltest", SYELOG_FACILITY_APPLICATION);
+ if (arg >= argc) {
+ Syelog(SYELOG_SEVERITY_INFORMATION, "Hello World! [1 of 4]");
+ Syelog(SYELOG_SEVERITY_INFORMATION, "Hello World! [2 of 4]");
+ Syelog(SYELOG_SEVERITY_INFORMATION, "Hello World! [3 of 4]");
+ Syelog(SYELOG_SEVERITY_INFORMATION, "Hello World! [4 of 4]");
+ }
+ else {
+ CHAR Buffer[1024] = "";
+
+ for (; arg < argc; arg++) {
+ StringCchCatA(Buffer, ARRAYSIZE(Buffer), argv[arg]);
+ if (arg + 1 < argc) {
+ StringCchCatA(Buffer, ARRAYSIZE(Buffer), " ");
+ }
+ }
+ Syelog(SYELOG_SEVERITY_INFORMATION, Buffer);
+ }
+
+ SyelogClose(fRequestExitOnClose);
+
+ return 0;
+}
diff --git a/ext/detours/samples/syelog/sltestp.cpp b/ext/detours/samples/syelog/sltestp.cpp
new file mode 100644
index 0000000..50856ac
--- /dev/null
+++ b/ext/detours/samples/syelog/sltestp.cpp
@@ -0,0 +1,104 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (sltestp.cpp of sltestp.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+// Test the named-pipe-based connection to the syelog system-event logger.
+//
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#pragma warning(push)
+#if _MSC_VER > 1400
+#pragma warning(disable:6102 6103) // /analyze warnings
+#endif
+#include <strsafe.h>
+#pragma warning(pop)
+#include "syelog.h"
+
+VOID MyErrExit(PCSTR pszMsg)
+{
+ fprintf(stderr, "Error %s: %ld\n", pszMsg, GetLastError());
+ exit(1);
+}
+
+DWORD main(int argc, char *argv[])
+{
+ HANDLE hPipe;
+ SYELOG_MESSAGE Message;
+ BOOL fSuccess;
+ DWORD cbWritten, dwMode;
+
+ // Try to open a named pipe; wait for it, if necessary.
+
+ TIME_ZONE_INFORMATION tzi;
+ GetTimeZoneInformation(&tzi);
+
+ for (;;) {
+ hPipe = CreateFileW(SYELOG_PIPE_NAMEW, // pipe name
+ GENERIC_WRITE, // write access only
+ 0, // no sharing
+ NULL, // no security attributes
+ OPEN_EXISTING, // opens existing pipe
+ 0, // default attributes
+ NULL); // no template file
+
+ // Break if the pipe handle is valid.
+ if (hPipe != INVALID_HANDLE_VALUE)
+ break;
+
+ // Exit if an error other than ERROR_PIPE_BUSY occurs.
+
+ if (GetLastError() != ERROR_PIPE_BUSY)
+ MyErrExit("Could not open pipe");
+
+ // All pipe instances are busy, so wait for 1 seconds.
+
+ if (!WaitNamedPipeW(SYELOG_PIPE_NAMEW, 1000))
+ MyErrExit("Could not open pipe");
+ }
+
+ // The pipe connected; change to message-read mode.
+ dwMode = PIPE_READMODE_MESSAGE;
+ fSuccess = SetNamedPipeHandleState(hPipe, // pipe handle
+ &dwMode, // new pipe mode
+ NULL, // don't set maximum bytes
+ NULL); // don't set maximum time
+ if (!fSuccess)
+ MyErrExit("SetNamedPipeHandleState");
+
+ // Send a message to the pipe server.
+
+ memset(&Message, 0, sizeof(Message));
+
+ StringCchCopyA(Message.szMessage, ARRAYSIZE(Message.szMessage),
+ (argc > 1) ? argv[1] : "sltestp: hello world!");
+
+ Message.nFacility = SYELOG_FACILITY_APPLICATION;
+ Message.nSeverity = SYELOG_SEVERITY_INFORMATION;
+ Message.nProcessId = GetCurrentProcessId();
+ GetSystemTimeAsFileTime(&Message.ftOccurance);
+ PCSTR pszEnd = Message.szMessage;
+ for (; *pszEnd; pszEnd++) {
+ // no internal contents.
+ }
+ Message.nBytes = (USHORT)(pszEnd - ((PCSTR)&Message) + 1);
+
+ fSuccess = WriteFile(hPipe, // pipe handle
+ &Message, // message
+ Message.nBytes, // message length
+ &cbWritten, // bytes written
+ NULL); // not overlapped
+ if (! fSuccess)
+ MyErrExit("WriteFile");
+
+ CloseHandle(hPipe);
+
+ GetTimeZoneInformation(&tzi);
+
+ return 0;
+}
diff --git a/ext/detours/samples/syelog/syelog.cpp b/ext/detours/samples/syelog/syelog.cpp
new file mode 100644
index 0000000..72e02e5
--- /dev/null
+++ b/ext/detours/samples/syelog/syelog.cpp
@@ -0,0 +1,847 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (syelog.cpp of syelog.lib)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#include <windows.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include "detours.h"
+#include "syelog.h"
+
+#include <stdio.h>
+
+//////////////////////////////////////////////////////////////////////////////
+extern "C" {
+ extern HANDLE ( WINAPI * Real_CreateFileW)(LPCWSTR a0,
+ DWORD a1,
+ DWORD a2,
+ LPSECURITY_ATTRIBUTES a3,
+ DWORD a4,
+ DWORD a5,
+ HANDLE a6);
+ extern BOOL ( WINAPI * Real_WriteFile)(HANDLE hFile,
+ LPCVOID lpBuffer,
+ DWORD nNumberOfBytesToWrite,
+ LPDWORD lpNumberOfBytesWritten,
+ LPOVERLAPPED lpOverlapped);
+ extern BOOL ( WINAPI * Real_FlushFileBuffers)(HANDLE hFile);
+ extern BOOL ( WINAPI * Real_CloseHandle)(HANDLE hObject);
+
+ extern BOOL ( WINAPI * Real_WaitNamedPipeW)(LPCWSTR lpNamedPipeName, DWORD nTimeOut);
+ extern BOOL ( WINAPI * Real_SetNamedPipeHandleState)(HANDLE hNamedPipe,
+ LPDWORD lpMode,
+ LPDWORD lpMaxCollectionCount,
+ LPDWORD lpCollectDataTimeout);
+
+ extern DWORD ( WINAPI * Real_GetCurrentProcessId)(VOID);
+ extern VOID ( WINAPI * Real_GetSystemTimeAsFileTime)(LPFILETIME lpSystemTimeAsFileTime);
+
+ extern VOID ( WINAPI * Real_InitializeCriticalSection)(LPCRITICAL_SECTION lpSection);
+ extern VOID ( WINAPI * Real_EnterCriticalSection)(LPCRITICAL_SECTION lpSection);
+ extern VOID ( WINAPI * Real_LeaveCriticalSection)(LPCRITICAL_SECTION lpSection);
+}
+
+///////////////////////////////////////////////////////////////////// VPrintf.
+//
+// Completely side-effect free printf replacement (but no FP numbers).
+//
+static PCHAR do_base(PCHAR pszOut, UINT64 nValue, UINT nBase, PCSTR pszDigits)
+{
+ CHAR szTmp[96];
+ int nDigit = sizeof(szTmp)-2;
+ for (; nDigit >= 0; nDigit--) {
+ szTmp[nDigit] = pszDigits[nValue % nBase];
+ nValue /= nBase;
+ }
+ for (nDigit = 0; nDigit < sizeof(szTmp) - 2 && szTmp[nDigit] == '0'; nDigit++) {
+ // skip leading zeros.
+ }
+ for (; nDigit < sizeof(szTmp) - 1; nDigit++) {
+ *pszOut++ = szTmp[nDigit];
+ }
+ *pszOut = '\0';
+ return pszOut;
+}
+
+static PCHAR do_str(PCHAR pszOut, PCHAR pszEnd, PCSTR pszIn)
+{
+ while (*pszIn && pszOut < pszEnd) {
+ *pszOut++ = *pszIn++;
+ }
+ *pszOut = '\0';
+ return pszOut;
+}
+
+static PCHAR do_wstr(PCHAR pszOut, PCHAR pszEnd, PCWSTR pszIn)
+{
+ while (*pszIn && pszOut < pszEnd) {
+ *pszOut++ = (CHAR)*pszIn++;
+ }
+ *pszOut = '\0';
+ return pszOut;
+}
+
+static PCHAR do_estr(PCHAR pszOut, PCHAR pszEnd, PCSTR pszIn)
+{
+ while (*pszIn && pszOut < pszEnd) {
+ if (*pszIn == '<') {
+ if (pszOut + 4 > pszEnd) {
+ break;
+ }
+ pszIn++;
+ *pszOut++ = '&';
+ *pszOut++ = 'l';
+ *pszOut++ = 't';
+ *pszOut++ = ';';
+ }
+ else if (*pszIn == '>') {
+ if (pszOut + 4 > pszEnd) {
+ break;
+ }
+ pszIn++;
+ *pszOut++ = '&';
+ *pszOut++ = 'g';
+ *pszOut++ = 't';
+ *pszOut++ = ';';
+ }
+ else if (*pszIn == '&') {
+ if (pszOut + 5 > pszEnd) {
+ break;
+ }
+ pszIn++;
+ *pszOut++ = '&';
+ *pszOut++ = 'a';
+ *pszOut++ = 'm';
+ *pszOut++ = 'p';
+ *pszOut++ = ';';
+ }
+ else if (*pszIn == '\"') {
+ if (pszOut + 6 > pszEnd) {
+ break;
+ }
+ pszIn++;
+ *pszOut++ = '&';
+ *pszOut++ = 'q';
+ *pszOut++ = 'u';
+ *pszOut++ = 'o';
+ *pszOut++ = 't';
+ *pszOut++ = ';';
+ }
+ else if (*pszIn == '\'') {
+ if (pszOut + 6 > pszEnd) {
+ break;
+ }
+ pszIn++;
+ *pszOut++ = '&';
+ *pszOut++ = 'a';
+ *pszOut++ = 'p';
+ *pszOut++ = 'o';
+ *pszOut++ = 's';
+ *pszOut++ = ';';
+ }
+ else if (*pszIn < ' ') {
+ BYTE c = (BYTE)(*pszIn++);
+ if (c < 10 && pszOut + 4 <= pszEnd) {
+ *pszOut++ = '&';
+ *pszOut++ = '#';
+ *pszOut++ = '0' + (c % 10);
+ *pszOut++ = ';';
+ }
+ else if (c < 100 && pszOut + 5 <= pszEnd) {
+ *pszOut++ = '&';
+ *pszOut++ = '#';
+ *pszOut++ = '0' + ((c / 10) % 10);
+ *pszOut++ = '0' + (c % 10);
+ *pszOut++ = ';';
+ }
+ else if (c < 1000 && pszOut + 6 <= pszEnd) {
+ *pszOut++ = '&';
+ *pszOut++ = '#';
+ *pszOut++ = '0' + ((c / 100) % 10);
+ *pszOut++ = '0' + ((c / 10) % 10);
+ *pszOut++ = '0' + (c % 10);
+ *pszOut++ = ';';
+ }
+ else {
+ break;
+ }
+ }
+ else {
+ *pszOut++ = *pszIn++;
+ }
+ }
+ *pszOut = '\0';
+ return pszOut;
+}
+
+static PCHAR do_ewstr(PCHAR pszOut, PCHAR pszEnd, PCWSTR pszIn)
+{
+ while (*pszIn && pszOut < pszEnd) {
+ if (*pszIn == '<') {
+ if (pszOut + 4 > pszEnd) {
+ break;
+ }
+ pszIn++;
+ *pszOut++ = '&';
+ *pszOut++ = 'l';
+ *pszOut++ = 't';
+ *pszOut++ = ';';
+ }
+ else if (*pszIn == '>') {
+ if (pszOut + 4 > pszEnd) {
+ break;
+ }
+ pszIn++;
+ *pszOut++ = '&';
+ *pszOut++ = 'g';
+ *pszOut++ = 't';
+ *pszOut++ = ';';
+ }
+ else if (*pszIn == '&') {
+ if (pszOut + 5 > pszEnd) {
+ break;
+ }
+ pszIn++;
+ *pszOut++ = '&';
+ *pszOut++ = 'a';
+ *pszOut++ = 'm';
+ *pszOut++ = 'p';
+ *pszOut++ = ';';
+ }
+ else if (*pszIn == '\"') {
+ if (pszOut + 6 > pszEnd) {
+ break;
+ }
+ pszIn++;
+ *pszOut++ = '&';
+ *pszOut++ = 'q';
+ *pszOut++ = 'u';
+ *pszOut++ = 'o';
+ *pszOut++ = 't';
+ *pszOut++ = ';';
+ }
+ else if (*pszIn == '\'') {
+ if (pszOut + 6 > pszEnd) {
+ break;
+ }
+ pszIn++;
+ *pszOut++ = '&';
+ *pszOut++ = 'a';
+ *pszOut++ = 'p';
+ *pszOut++ = 'o';
+ *pszOut++ = 's';
+ *pszOut++ = ';';
+ }
+ else if (*pszIn < ' ' || *pszIn > 127) {
+ WCHAR c = *pszIn++;
+ if (c < 10 && pszOut + 4 <= pszEnd) {
+ *pszOut++ = '&';
+ *pszOut++ = '#';
+ *pszOut++ = '0' + (CHAR)(c % 10);
+ *pszOut++ = ';';
+ }
+ else if (c < 100 && pszOut + 5 <= pszEnd) {
+ *pszOut++ = '&';
+ *pszOut++ = '#';
+ *pszOut++ = '0' + (CHAR)((c / 10) % 10);
+ *pszOut++ = '0' + (CHAR)(c % 10);
+ *pszOut++ = ';';
+ }
+ else if (c < 1000 && pszOut + 6 <= pszEnd) {
+ *pszOut++ = '&';
+ *pszOut++ = '#';
+ *pszOut++ = '0' + (CHAR)((c / 100) % 10);
+ *pszOut++ = '0' + (CHAR)((c / 10) % 10);
+ *pszOut++ = '0' + (CHAR)(c % 10);
+ *pszOut++ = ';';
+ }
+ else {
+ break;
+ }
+ }
+ else {
+ *pszOut++ = (CHAR)*pszIn++;
+ }
+ }
+ *pszOut = '\0';
+ return pszOut;
+}
+
+#if _MSC_VER >= 1900
+#pragma warning(push)
+#pragma warning(disable:4456) // declaration hides previous local declaration
+#endif
+
+VOID VSafePrintf(PCSTR pszMsg, va_list args, PCHAR pszBuffer, LONG cbBuffer)
+{
+ PCHAR pszOut = pszBuffer;
+ PCHAR pszEnd = pszBuffer + cbBuffer - 1;
+ pszBuffer[0] = '\0';
+
+ __try {
+ while (*pszMsg && pszOut < pszEnd) {
+ if (*pszMsg == '%') {
+ CHAR szHead[4] = "";
+ INT nLen;
+ INT nWidth = 0;
+ INT nPrecision = 0;
+ BOOL fLeft = FALSE;
+ BOOL fPositive = FALSE;
+ BOOL fPound = FALSE;
+ BOOL fBlank = FALSE;
+ BOOL fZero = FALSE;
+ BOOL fDigit = FALSE;
+ BOOL fSmall = FALSE;
+ BOOL fLarge = FALSE;
+ BOOL f64Bit = FALSE;
+ PCSTR pszArg = pszMsg;
+
+ pszMsg++;
+
+ for (; (*pszMsg == '-' ||
+ *pszMsg == '+' ||
+ *pszMsg == '#' ||
+ *pszMsg == ' ' ||
+ *pszMsg == '0'); pszMsg++) {
+ switch (*pszMsg) {
+ case '-': fLeft = TRUE; break;
+ case '+': fPositive = TRUE; break;
+ case '#': fPound = TRUE; break;
+ case ' ': fBlank = TRUE; break;
+ case '0': fZero = TRUE; break;
+ }
+ }
+
+ if (*pszMsg == '*') {
+ nWidth = va_arg(args, INT);
+ pszMsg++;
+ }
+ else {
+ while (*pszMsg >= '0' && *pszMsg <= '9') {
+ nWidth = nWidth * 10 + (*pszMsg++ - '0');
+ }
+ }
+ if (*pszMsg == '.') {
+ pszMsg++;
+ fDigit = TRUE;
+ if (*pszMsg == '*') {
+ nPrecision = va_arg(args, INT);
+ pszMsg++;
+ }
+ else {
+ while (*pszMsg >= '0' && *pszMsg <= '9') {
+ nPrecision = nPrecision * 10 + (*pszMsg++ - '0');
+ }
+ }
+ }
+
+ if (*pszMsg == 'h') {
+ fSmall = TRUE;
+ pszMsg++;
+ }
+ else if (*pszMsg == 'l') {
+ fLarge = TRUE;
+ pszMsg++;
+ }
+ else if (*pszMsg == 'I' && pszMsg[1] == '6' && pszMsg[2] == '4') {
+ f64Bit = TRUE;
+ pszMsg += 3;
+ }
+
+ if (*pszMsg == 's' || *pszMsg == 'e' || *pszMsg == 'c') {
+ // We ignore the length, precision, and alignment
+ // to avoid using a temporary buffer.
+
+ if (*pszMsg == 's') { // [GalenH] need to not use temp.
+ PVOID pvData = va_arg(args, PVOID);
+
+ pszMsg++;
+
+ if (fSmall) {
+ fLarge = FALSE;
+ }
+
+ __try {
+ if (pvData == NULL) {
+ pszOut = do_str(pszOut, pszEnd, "<NULL>");
+ }
+ else if (pvData < (PVOID)0x10000) {
+ pszOut = do_str(pszOut, pszEnd, "#");
+ pszOut = do_base(pszOut, (UINT64)pvData, 16,
+ "0123456789ABCDEF");
+ pszOut = do_str(pszOut, pszEnd, "#");
+ }
+ else if (fLarge) {
+ pszOut = do_wstr(pszOut, pszEnd, (PWCHAR)pvData);
+ }
+ else {
+ pszOut = do_str(pszOut, pszEnd, (PCHAR)pvData);
+ }
+ } __except(EXCEPTION_EXECUTE_HANDLER) {
+ pszOut = do_str(pszOut, pszEnd, "-");
+ pszOut = do_base(pszOut, (UINT64)pvData, 16,
+ "0123456789ABCDEF");
+ pszOut = do_str(pszOut, pszEnd, "-");
+ }
+ }
+ else if (*pszMsg == 'e') { // Escape the string.
+ PVOID pvData = va_arg(args, PVOID);
+
+ pszMsg++;
+
+ if (fSmall) {
+ fLarge = FALSE;
+ }
+
+ __try {
+ if (pvData == NULL) {
+ pszOut = do_str(pszOut, pszEnd, "<NULL>");
+ }
+ else if (pvData < (PVOID)0x10000) {
+ pszOut = do_str(pszOut, pszEnd, ">");
+ pszOut = do_base(pszOut, (UINT64)pvData, 16,
+ "0123456789ABCDEF");
+ pszOut = do_str(pszOut, pszEnd, ">");
+ }
+ else if (fLarge) {
+ pszOut = do_ewstr(pszOut, pszEnd, (PWCHAR)pvData);
+ }
+ else {
+ pszOut = do_estr(pszOut, pszEnd, (PCHAR)pvData);
+ }
+ } __except(EXCEPTION_EXECUTE_HANDLER) {
+ pszOut = do_str(pszOut, pszEnd, "-");
+ pszOut = do_base(pszOut, (UINT64)pvData, 16,
+ "0123456789ABCDEF");
+ pszOut = do_str(pszOut, pszEnd, "-");
+ }
+ }
+ else {
+ CHAR szTemp[2];
+ pszMsg++;
+
+ szTemp[0] = (CHAR)va_arg(args, INT);
+ szTemp[1] = '\0';
+ pszOut = do_str(pszOut, pszEnd, szTemp);
+ }
+ }
+ else if (*pszMsg == 'd' || *pszMsg == 'i' || *pszMsg == 'o' ||
+ *pszMsg == 'x' || *pszMsg == 'X' || *pszMsg == 'b' ||
+ *pszMsg == 'u') {
+ CHAR szTemp[128];
+ UINT64 value;
+ if (f64Bit) {
+ value = va_arg(args, UINT64);
+ }
+ else {
+ value = va_arg(args, UINT);
+ }
+
+ if (*pszMsg == 'x') {
+ pszMsg++;
+ nLen = (int)(do_base(szTemp, value, 16, "0123456789abcdef") - szTemp);
+ if (fPound && value) {
+ do_str(szHead, szHead + sizeof(szHead) - 1, "0x");
+ }
+ }
+ else if (*pszMsg == 'X') {
+ pszMsg++;
+ nLen = (int)(do_base(szTemp, value, 16, "0123456789ABCDEF") - szTemp);
+ if (fPound && value) {
+ do_str(szHead, szHead + sizeof(szHead) - 1, "0X");
+ }
+ }
+ else if (*pszMsg == 'd') {
+ pszMsg++;
+ if ((INT64)value < 0) {
+ value = -(INT64)value;
+ do_str(szHead, szHead + sizeof(szHead) - 1, "-");
+ }
+ else if (fPositive) {
+ if (value > 0) {
+ do_str(szHead, szHead + sizeof(szHead) - 1, "+");
+ }
+ }
+ else if (fBlank) {
+ if (value > 0) {
+ do_str(szHead, szHead + sizeof(szHead) - 1, " ");
+ }
+ }
+ nLen = (int)(do_base(szTemp, value, 10, "0123456789") - szTemp);
+ nPrecision = 0;
+ }
+ else if (*pszMsg == 'u') {
+ pszMsg++;
+ nLen = (int)(do_base(szTemp, value, 10, "0123456789") - szTemp);
+ nPrecision = 0;
+ }
+ else if (*pszMsg == 'o') {
+ pszMsg++;
+ nLen = (int)(do_base(szTemp, value, 8, "01234567") - szTemp);
+ nPrecision = 0;
+
+ if (fPound && value) {
+ do_str(szHead, szHead + sizeof(szHead) - 1, "0");
+ }
+ }
+ else if (*pszMsg == 'b') {
+ pszMsg++;
+ nLen = (int)(do_base(szTemp, value, 2, "01") - szTemp);
+ nPrecision = 0;
+
+ if (fPound && value) {
+ do_str(szHead, szHead + sizeof(szHead) - 1, "0b");
+ }
+ }
+ else {
+ pszMsg++;
+ if ((INT64)value < 0) {
+ value = -(INT64)value;
+ do_str(szHead, szHead + sizeof(szHead) - 1, "-");
+ }
+ else if (fPositive) {
+ if (value > 0) {
+ do_str(szHead, szHead + sizeof(szHead) - 1, "+");
+ }
+ }
+ else if (fBlank) {
+ if (value > 0) {
+ do_str(szHead, szHead + sizeof(szHead) - 1, " ");
+ }
+ }
+ nLen = (int)(do_base(szTemp, value, 10, "0123456789") - szTemp);
+ nPrecision = 0;
+ }
+
+ INT nHead = 0;
+ for (; szHead[nHead]; nHead++) {
+ // Count characters in head string.
+ }
+
+ if (fLeft) {
+ if (nHead) {
+ pszOut = do_str(pszOut, pszEnd, szHead);
+ nLen += nHead;
+ }
+ pszOut = do_str(pszOut, pszEnd, szTemp);
+ for (; nLen < nWidth && pszOut < pszEnd; nLen++) {
+ *pszOut++ = ' ';
+ }
+ }
+ else if (fZero) {
+ if (nHead) {
+ pszOut = do_str(pszOut, pszEnd, szHead);
+ nLen += nHead;
+ }
+ for (; nLen < nWidth && pszOut < pszEnd; nLen++) {
+ *pszOut++ = '0';
+ }
+ pszOut = do_str(pszOut, pszEnd, szTemp);
+ }
+ else {
+ if (nHead) {
+ nLen += nHead;
+ }
+ for (; nLen < nWidth && pszOut < pszEnd; nLen++) {
+ *pszOut++ = ' ';
+ }
+ if (nHead) {
+ pszOut = do_str(pszOut, pszEnd, szHead);
+ }
+ pszOut = do_str(pszOut, pszEnd, szTemp);
+ }
+ }
+ else if (*pszMsg == 'p') {
+ CHAR szTemp[64];
+ ULONG_PTR value;
+ value = va_arg(args, ULONG_PTR);
+
+ if ((INT64)value == (INT64)-1 ||
+ (INT64)value == (INT64)-2) {
+ if (*pszMsg == 'p') {
+ pszMsg++;
+ }
+ szTemp[0] = '-';
+ szTemp[1] = ((INT64)value == (INT64)-1) ? '1' : '2';
+ szTemp[2] = '\0';
+ nLen = 2;
+ }
+ else {
+ if (*pszMsg == 'p') {
+ pszMsg++;
+ nLen = (int)(do_base(szTemp, (UINT64)value, 16, "0123456789abcdef") - szTemp);
+ if (fPound && value) {
+ do_str(szHead, szHead + sizeof(szHead) - 1, "0x");
+ }
+ }
+ else {
+ pszMsg++;
+ nLen = (int)(do_base(szTemp, (UINT64)value, 16, "0123456789ABCDEF") - szTemp);
+ if (fPound && value) {
+ do_str(szHead, szHead + sizeof(szHead) - 1, "0x");
+ }
+ }
+ }
+
+ INT nHead = 0;
+ for (; szHead[nHead]; nHead++) {
+ // Count characters in head string.
+ }
+
+ if (nHead) {
+ pszOut = do_str(pszOut, pszEnd, szHead);
+ nLen += nHead;
+ }
+ for (; nLen < nWidth && pszOut < pszEnd; nLen++) {
+ *pszOut++ = '0';
+ }
+ pszOut = do_str(pszOut, pszEnd, szTemp);
+ }
+ else {
+ pszMsg++;
+ while (pszArg < pszMsg && pszOut < pszEnd) {
+ *pszOut++ = *pszArg++;
+ }
+ }
+ }
+ else {
+ if (pszOut < pszEnd) {
+ *pszOut++ = *pszMsg++;
+ }
+ }
+ }
+ *pszOut = '\0';
+ pszBuffer[cbBuffer - 1] = '\0';
+ } __except(EXCEPTION_EXECUTE_HANDLER) {
+ PCHAR pszOut = pszBuffer;
+ *pszOut = '\0';
+ pszOut = do_str(pszOut, pszEnd, "-exception:");
+ pszOut = do_base(pszOut, (UINT64)GetExceptionCode(), 10, "0123456789");
+ pszOut = do_str(pszOut, pszEnd, "-");
+ }
+}
+
+#if _MSC_VER >= 1900
+#pragma warning(pop)
+#endif
+
+PCHAR SafePrintf(PCHAR pszBuffer, LONG cbBuffer, PCSTR pszMsg, ...)
+{
+ va_list args;
+ va_start(args, pszMsg);
+ VSafePrintf(pszMsg, args, pszBuffer, cbBuffer);
+ va_end(args);
+
+ while (*pszBuffer) {
+ pszBuffer++;
+ }
+ return pszBuffer;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+static CRITICAL_SECTION s_csPipe; // Guards access to hPipe.
+static HANDLE s_hPipe = INVALID_HANDLE_VALUE;
+static DWORD s_nPipeError = 0;
+static FILETIME s_ftRetry = {0,0};
+static BYTE s_nFacility = SYELOG_FACILITY_APPLICATION;
+static CHAR s_szIdent[256] = "";
+static DWORD s_nProcessId = 0;
+
+static inline INT syelogCompareTimes(CONST PFILETIME pft1, CONST PFILETIME pft2)
+{
+ INT64 ut1 = *(PINT64)pft1;
+ INT64 ut2 = *(PINT64)pft2;
+
+ if (ut1 < ut2) {
+ return -1;
+ }
+ else if (ut1 > ut2) {
+ return 1;
+ }
+ else {
+ return 0;
+ }
+}
+
+static inline VOID syelogAddMilliseconds(PFILETIME pft, DWORD nMilliseconds)
+{
+ *(PINT64&)pft += ((INT64)nMilliseconds * 10000);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// Tries to insure that a named-pipe connection to the system log is open
+// If the pipe closes, the next call will immediately try to re-open the pipe.
+// If the pipe doesn't open again, we wait 5 minutes before trying again.
+// We wait 5 minutes, because each attempt may take up to a full second to
+// time out.
+//
+static BOOL syelogIsOpen(PFILETIME pftLog)
+{
+ if (s_hPipe != INVALID_HANDLE_VALUE) {
+ return TRUE;
+ }
+
+ if (syelogCompareTimes(pftLog, &s_ftRetry) < 0) {
+ return FALSE;
+ }
+
+ s_hPipe = Real_CreateFileW(SYELOG_PIPE_NAMEW,
+ GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
+ SECURITY_ANONYMOUS, NULL);
+ if (s_hPipe != INVALID_HANDLE_VALUE) {
+ DWORD dwMode = PIPE_READMODE_MESSAGE;
+ if (Real_SetNamedPipeHandleState(s_hPipe, &dwMode, NULL, NULL)) {
+ return TRUE;
+ }
+ }
+
+ if (Real_WaitNamedPipeW(SYELOG_PIPE_NAMEW, 2000)) { // Wait 2 seconds.
+ // Pipe connected, change to message-read mode.
+ //
+ s_hPipe = Real_CreateFileW(SYELOG_PIPE_NAMEW,
+ GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
+ SECURITY_ANONYMOUS, NULL);
+ if (s_hPipe != INVALID_HANDLE_VALUE) {
+ DWORD dwMode = PIPE_READMODE_MESSAGE;
+ if (Real_SetNamedPipeHandleState(s_hPipe, &dwMode, NULL, NULL)) {
+ return TRUE;
+ }
+ }
+ }
+
+ // Couldn't open pipe.
+ s_ftRetry = *pftLog;
+ syelogAddMilliseconds(&s_ftRetry, 300000); // Wait 5 minute before retry.
+
+ return FALSE;
+}
+
+VOID SyelogOpen(PCSTR pszIdentifier, BYTE nFacility)
+{
+ Real_InitializeCriticalSection(&s_csPipe);
+
+ if (pszIdentifier) {
+ PCHAR pszOut = s_szIdent;
+ PCHAR pszEnd = s_szIdent + ARRAYSIZE(s_szIdent) - 1;
+ pszOut = do_str(pszOut, pszEnd, pszIdentifier);
+ pszOut = do_str(pszOut, pszEnd, ": ");
+ *pszEnd = '\0';
+ }
+ else {
+ s_szIdent[0] = '\0';
+ }
+
+ s_nFacility = nFacility;
+ s_nProcessId = Real_GetCurrentProcessId();
+}
+
+VOID SyelogExV(BOOL fTerminate, BYTE nSeverity, PCSTR pszMsgf, va_list args)
+{
+ SYELOG_MESSAGE Message;
+ DWORD cbWritten = 0;
+
+ Real_GetSystemTimeAsFileTime(&Message.ftOccurance);
+ Message.fTerminate = fTerminate;
+ Message.nFacility = s_nFacility;
+ Message.nSeverity = nSeverity;
+ Message.nProcessId = s_nProcessId;
+ PCHAR pszBuf = Message.szMessage;
+ PCHAR pszEnd = Message.szMessage + ARRAYSIZE(Message.szMessage) - 1;
+ if (s_szIdent[0]) {
+ pszBuf = do_str(pszBuf, pszEnd, s_szIdent);
+ }
+ *pszEnd = '\0';
+ VSafePrintf(pszMsgf, args,
+ pszBuf, (int)(Message.szMessage + sizeof(Message.szMessage) - 1 - pszBuf));
+
+ pszEnd = Message.szMessage;
+ for (; *pszEnd; pszEnd++) {
+ // no internal contents.
+ }
+
+ // Insure that the message always ends with a '\n'
+ //
+ if (pszEnd > Message.szMessage) {
+ if (pszEnd[-1] != '\n') {
+ *pszEnd++ = '\n';
+ *pszEnd++ = '\0';
+ }
+ else {
+ *pszEnd++ = '\0';
+ }
+ }
+ else {
+ *pszEnd++ = '\n';
+ *pszEnd++ = '\0';
+ }
+ Message.nBytes = (USHORT)(pszEnd - ((PCSTR)&Message));
+
+ Real_EnterCriticalSection(&s_csPipe);
+
+ if (syelogIsOpen(&Message.ftOccurance)) {
+ if (!Real_WriteFile(s_hPipe, &Message, Message.nBytes, &cbWritten, NULL)) {
+ s_nPipeError = GetLastError();
+ if (s_nPipeError == ERROR_BAD_IMPERSONATION_LEVEL) {
+ // Don't close the file just for a temporary impersonation level.
+ }
+ else {
+ if (s_hPipe != INVALID_HANDLE_VALUE) {
+ Real_CloseHandle(s_hPipe);
+ s_hPipe = INVALID_HANDLE_VALUE;
+ }
+ if (syelogIsOpen(&Message.ftOccurance)) {
+ Real_WriteFile(s_hPipe, &Message, Message.nBytes, &cbWritten, NULL);
+ }
+ }
+ }
+ }
+
+ Real_LeaveCriticalSection(&s_csPipe);
+}
+
+VOID SyelogV(BYTE nSeverity, PCSTR pszMsgf, va_list args)
+{
+ SyelogExV(FALSE, nSeverity, pszMsgf, args);
+}
+
+VOID Syelog(BYTE nSeverity, PCSTR pszMsgf, ...)
+{
+ va_list args;
+ va_start(args, pszMsgf);
+ SyelogExV(FALSE, nSeverity, pszMsgf, args);
+ va_end(args);
+}
+
+VOID SyelogEx(BOOL fTerminate, BYTE nSeverity, PCSTR pszMsgf, ...)
+{
+ va_list args;
+ va_start(args, pszMsgf);
+ SyelogExV(fTerminate, nSeverity, pszMsgf, args);
+ va_end(args);
+}
+
+VOID SyelogClose(BOOL fTerminate)
+{
+ if (fTerminate) {
+ SyelogEx(TRUE, SYELOG_SEVERITY_NOTICE, "Requesting exit on close.\n");
+ }
+
+ Real_EnterCriticalSection(&s_csPipe);
+
+ if (s_hPipe != INVALID_HANDLE_VALUE) {
+ Real_FlushFileBuffers(s_hPipe);
+ Real_CloseHandle(s_hPipe);
+ s_hPipe = INVALID_HANDLE_VALUE;
+ }
+
+ Real_LeaveCriticalSection(&s_csPipe);
+}
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/syelog/syelog.h b/ext/detours/samples/syelog/syelog.h
new file mode 100644
index 0000000..7cfa9f3
--- /dev/null
+++ b/ext/detours/samples/syelog/syelog.h
@@ -0,0 +1,89 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (syelog.h of syelog.lib)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#pragma once
+#ifndef _SYELOGD_H_
+#define _SYELOGD_H_
+#include <stdarg.h>
+
+#pragma pack(push, 1)
+#pragma warning(push)
+#pragma warning(disable: 4200)
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//
+#define SYELOG_PIPE_NAMEA "\\\\.\\pipe\\syelog"
+#define SYELOG_PIPE_NAMEW L"\\\\.\\pipe\\syelog"
+#ifdef UNICODE
+#define SYELOG_PIPE_NAME SYELOG_PIPE_NAMEW
+#else
+#define SYELOG_PIPE_NAME SYELOG_PIPE_NAMEA
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+//
+#define SYELOG_MAXIMUM_MESSAGE 4086 // 4096 - sizeof(header stuff)
+
+typedef struct _SYELOG_MESSAGE
+{
+ USHORT nBytes;
+ BYTE nFacility;
+ BYTE nSeverity;
+ DWORD nProcessId;
+ FILETIME ftOccurance;
+ BOOL fTerminate;
+ CHAR szMessage[SYELOG_MAXIMUM_MESSAGE];
+} SYELOG_MESSAGE, *PSYELOG_MESSAGE;
+
+
+// Facility Codes.
+//
+#define SYELOG_FACILITY_KERNEL 0x10 // OS Kernel
+#define SYELOG_FACILITY_SECURITY 0x20 // OS Security
+#define SYELOG_FACILITY_LOGGING 0x30 // OS Logging-internal
+#define SYELOG_FACILITY_SERVICE 0x40 // User-mode system daemon
+#define SYELOG_FACILITY_APPLICATION 0x50 // User-mode application
+#define SYELOG_FACILITY_USER 0x60 // User self-generated.
+#define SYELOG_FACILITY_LOCAL0 0x70 // Locally defined.
+#define SYELOG_FACILITY_LOCAL1 0x71 // Locally defined.
+#define SYELOG_FACILITY_LOCAL2 0x72 // Locally defined.
+#define SYELOG_FACILITY_LOCAL3 0x73 // Locally defined.
+#define SYELOG_FACILITY_LOCAL4 0x74 // Locally defined.
+#define SYELOG_FACILITY_LOCAL5 0x75 // Locally defined.
+#define SYELOG_FACILITY_LOCAL6 0x76 // Locally defined.
+#define SYELOG_FACILITY_LOCAL7 0x77 // Locally defined.
+#define SYELOG_FACILITY_LOCAL8 0x78 // Locally defined.
+#define SYELOG_FACILITY_LOCAL9 0x79 // Locally defined.
+
+// Severity Codes.
+//
+#define SYELOG_SEVERITY_FATAL 0x00 // System is dead.
+#define SYELOG_SEVERITY_ALERT 0x10 // Take action immediately.
+#define SYELOG_SEVERITY_CRITICAL 0x20 // Critical condition.
+#define SYELOG_SEVERITY_ERROR 0x30 // Error
+#define SYELOG_SEVERITY_WARNING 0x40 // Warning
+#define SYELOG_SEVERITY_NOTICE 0x50 // Significant condition.
+#define SYELOG_SEVERITY_INFORMATION 0x60 // Informational
+#define SYELOG_SEVERITY_AUDIT_FAIL 0x66 // Audit Failed
+#define SYELOG_SEVERITY_AUDIT_PASS 0x67 // Audit Succeeeded
+#define SYELOG_SEVERITY_DEBUG 0x70 // Debugging
+
+// Logging Functions.
+//
+VOID SyelogOpen(PCSTR pszIdentifier, BYTE nFacility);
+VOID Syelog(BYTE nSeverity, PCSTR pszMsgf, ...);
+VOID SyelogV(BYTE nSeverity, PCSTR pszMsgf, va_list args);
+VOID SyelogClose(BOOL fTerminate);
+
+#pragma warning(pop)
+#pragma pack(pop)
+
+#endif // _SYELOGD_H_
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/syelog/syelogd.cpp b/ext/detours/samples/syelog/syelogd.cpp
new file mode 100644
index 0000000..c3db446
--- /dev/null
+++ b/ext/detours/samples/syelog/syelogd.cpp
@@ -0,0 +1,556 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (syelogd.cpp of syelogd.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#pragma warning(push)
+#if _MSC_VER > 1400
+#pragma warning(disable:6102 6103) // /analyze warnings
+#endif
+#include <strsafe.h>
+#pragma warning(pop)
+#include "syelog.h"
+
+#if (_MSC_VER < 1299)
+typedef ULONG * PULONG_PTR;
+typedef ULONG ULONG_PTR;
+typedef LONG * PLONG_PTR;
+typedef LONG LONG_PTR;
+#endif
+
+enum {
+ CLIENT_AWAITING_PIPE_ACCEPT = 0x21,
+ CLIENT_AWAITING_PIPE_DATA = 0x22,
+};
+
+typedef struct _CLIENT : OVERLAPPED
+{
+ HANDLE hPipe;
+ BOOL fAwaitingAccept;
+ PVOID Zero;
+ SYELOG_MESSAGE Message;
+} CLIENT, *PCLIENT;
+
+//////////////////////////////////////////////////////////////////////////////
+//
+BOOL s_fLogToScreen = TRUE; // Log output to screen.
+BOOL s_fExitAfterOne = FALSE;
+BOOL s_fDeltaTime = FALSE;
+HANDLE s_hOutFile = INVALID_HANDLE_VALUE;
+
+LONG s_nActiveClients = 0;
+LONGLONG s_llStartTime = 0;
+LONGLONG s_llLastTime = 0;
+
+BOOL LogMessageV(BYTE nSeverity, PCHAR pszMsg, ...);
+
+//////////////////////////////////////////////////////////////////////////////
+//
+VOID MyErrExit(PCSTR pszMsg)
+{
+ DWORD error = GetLastError();
+
+ LogMessageV(SYELOG_SEVERITY_FATAL, "Error %d in %s.", error, pszMsg);
+ fprintf(stderr, "SYELOGD: Error %ld in %s.\n", error, pszMsg);
+ fflush(stderr);
+ exit(1);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+static PCSTR FileTimeToString(PCHAR pszBuffer, DWORD cbBuffer, FILETIME ftTime)
+{
+ (void)cbBuffer;
+
+ static BOOL bGotTzi = FALSE;
+ static DWORD dwTzi = TIME_ZONE_ID_UNKNOWN;
+ static TIME_ZONE_INFORMATION tzi;
+ if (!bGotTzi) {
+ dwTzi = GetTimeZoneInformation(&tzi);
+ if (dwTzi == TIME_ZONE_ID_UNKNOWN) {
+ ZeroMemory(&tzi, sizeof(tzi));
+ }
+ bGotTzi = TRUE;
+ }
+ SYSTEMTIME stUtc;
+ SYSTEMTIME stLocal;
+
+ pszBuffer[0] = '\0';
+
+ if (s_fDeltaTime) {
+ if (s_llLastTime == 0) {
+ s_llLastTime = s_llStartTime;
+ }
+
+ ULARGE_INTEGER ul;
+ ul.LowPart = ftTime.dwLowDateTime;
+ ul.HighPart = ftTime.dwHighDateTime;
+
+ LONG64 delta = ul.QuadPart - s_llLastTime;
+ s_llLastTime = ul.QuadPart;
+ delta /= 10000;
+
+ StringCchPrintfA(pszBuffer, cbBuffer, "%7I64d", delta);
+ }
+ else {
+ if (!FileTimeToSystemTime(&ftTime, &stUtc)) {
+ StringCchPrintfA(pszBuffer, cbBuffer, "ft:%16I64d", *(LONGLONG *)&ftTime);
+ return pszBuffer;
+ }
+ else if (!SystemTimeToTzSpecificLocalTime(&tzi, &stUtc, &stLocal)) {
+ CopyMemory(&stLocal, &stUtc, sizeof(stLocal));
+ }
+
+ StringCchPrintfA(pszBuffer, cbBuffer, "%4d%02d%02d%02d%02d%02d%03d",
+ stLocal.wYear,
+ stLocal.wMonth,
+ stLocal.wDay,
+ stLocal.wHour,
+ stLocal.wMinute,
+ stLocal.wSecond,
+ stLocal.wMilliseconds);
+ }
+ return pszBuffer;
+}
+
+BOOL CloseConnection(PCLIENT pClient)
+{
+ LogMessageV(SYELOG_SEVERITY_INFORMATION, "Client closed pipe.");
+
+ InterlockedDecrement(&s_nActiveClients);
+ if (pClient != NULL) {
+ if (pClient->hPipe != INVALID_HANDLE_VALUE) {
+ FlushFileBuffers(pClient->hPipe);
+ if (!DisconnectNamedPipe(pClient->hPipe)) {
+ MyErrExit("DisconnectNamedPipe");
+ }
+ CloseHandle(pClient->hPipe);
+ pClient->hPipe = INVALID_HANDLE_VALUE;
+ }
+ GlobalFree(pClient);
+ pClient = NULL;
+ }
+
+ if (s_fExitAfterOne) {
+ ExitProcess(0);
+ }
+ return TRUE;
+}
+
+// Creates a pipe instance and initiate an accept request.
+//
+PCLIENT CreatePipeConnection(HANDLE hCompletionPort)
+{
+ HANDLE hPipe = CreateNamedPipe(SYELOG_PIPE_NAME, // pipe name
+ PIPE_ACCESS_INBOUND | // read-only access
+ FILE_FLAG_OVERLAPPED, // overlapped mode
+ PIPE_TYPE_MESSAGE | // message-type pipe
+ PIPE_READMODE_MESSAGE | // message read mode
+ PIPE_WAIT, // blocking mode
+ PIPE_UNLIMITED_INSTANCES, // unlimited instances
+ 0, // output buffer size
+ 0, // input buffer size
+ 20000, // client time-out
+ NULL); // no security attributes
+ if (hPipe == INVALID_HANDLE_VALUE) {
+ MyErrExit("CreatePipe");
+ }
+
+ // Allocate the client data structure.
+ //
+ PCLIENT pClient = (PCLIENT) GlobalAlloc(GPTR, sizeof(CLIENT));
+ if (pClient == NULL) {
+ MyErrExit("GlobalAlloc pClient");
+ }
+
+ ZeroMemory(pClient, sizeof(*pClient));
+ pClient->hPipe = hPipe;
+ pClient->fAwaitingAccept = TRUE;
+
+ // Associate file with our complietion port.
+ //
+ if (!CreateIoCompletionPort(pClient->hPipe, hCompletionPort, (ULONG_PTR)pClient, 0)) {
+ MyErrExit("CreateIoComplietionPort pClient");
+ }
+
+ if (!ConnectNamedPipe(hPipe, pClient)) {
+ if (GetLastError() != ERROR_IO_PENDING &&
+ GetLastError() != ERROR_PIPE_LISTENING) {
+ MyErrExit("ConnectNamedPipe");
+ }
+ }
+ else {
+ LogMessageV(SYELOG_SEVERITY_INFORMATION,
+ "ConnectNamedPipe accepted immediately.");
+ }
+ return pClient;
+}
+
+BOOL LogMessageV(BYTE nSeverity, PCHAR pszMsg, ...)
+{
+ FILETIME ftOccurance;
+ CHAR szTime[64];
+ GetSystemTimeAsFileTime(&ftOccurance);
+ FileTimeToString(szTime, sizeof(szTime), ftOccurance);
+
+ if (s_fLogToScreen) {
+ printf(s_fDeltaTime
+ ? "%-7.7s ---- --.%02x: "
+ : "%-17.17s ---- --.%02x: "
+ , szTime, nSeverity);
+ va_list args;
+ va_start(args, pszMsg);
+ vprintf(pszMsg, args);
+ va_end(args);
+ printf("\n");
+ }
+ if (s_hOutFile != INVALID_HANDLE_VALUE) {
+ DWORD cbWritten = 0;
+ CHAR szBuf[4096] = "";
+ PCHAR pcchEnd = szBuf + ARRAYSIZE(szBuf) - 2;
+ PCHAR pcchCur = szBuf;
+ HRESULT hr;
+
+ hr = StringCchPrintfExA(pcchCur, pcchEnd - pcchCur,
+ &pcchCur, NULL, STRSAFE_NULL_ON_FAILURE,
+ s_fDeltaTime
+ ? "%-7.7s ---- --.%02x: "
+ : "%-17.17s ---- --.%02x: "
+ , szTime, nSeverity);
+ if (FAILED(hr)) {
+ goto Cleanup;
+ }
+
+ va_list args;
+ va_start(args, pszMsg);
+ hr = StringCchPrintfExA(pcchCur, pcchEnd - pcchCur,
+ &pcchCur, NULL, STRSAFE_NULL_ON_FAILURE,
+ pszMsg, args);
+ va_end(args);
+ if (FAILED(hr)) {
+ goto Cleanup;
+ }
+
+ hr = StringCchPrintfExA(pcchCur, (szBuf + ARRAYSIZE(szBuf)) - pcchCur,
+ &pcchCur, NULL, STRSAFE_NULL_ON_FAILURE,
+ "\n");
+ if (FAILED(hr)) {
+ goto Cleanup;
+ }
+
+ Cleanup:
+ WriteFile(s_hOutFile, szBuf, (DWORD)(pcchCur - szBuf), &cbWritten, NULL);
+ }
+ return TRUE;
+}
+
+BOOL LogMessage(PSYELOG_MESSAGE pMessage, DWORD nBytes)
+{
+ // Sanity check the size of the message.
+ //
+ if (nBytes > pMessage->nBytes) {
+ nBytes = pMessage->nBytes;
+ }
+ if (nBytes >= sizeof(*pMessage)) {
+ nBytes = sizeof(*pMessage) - 1;
+ }
+
+ // Don't log message if there isn't and message text.
+ //
+ if (nBytes <= offsetof(SYELOG_MESSAGE, szMessage)) {
+ return FALSE;
+ }
+
+ CHAR szTime[64];
+ FileTimeToString(szTime, sizeof(szTime), pMessage->ftOccurance);
+
+ PCHAR pszMsg = pMessage->szMessage;
+ while (*pszMsg) {
+ pszMsg++;
+ }
+ while (pszMsg > pMessage->szMessage && isspace(pszMsg[-1])) {
+ *--pszMsg = '\0';
+ }
+
+ if (s_fLogToScreen) {
+ printf(s_fDeltaTime
+ ? "%-7.7s %4d %02x.%02x: %s\n"
+ : "%-17.17s %4d %02x.%02x: %s\n",
+ szTime,
+ pMessage->nProcessId,
+ pMessage->nFacility,
+ pMessage->nSeverity,
+ pMessage->szMessage);
+ }
+ if (s_hOutFile != INVALID_HANDLE_VALUE) {
+ DWORD cbWritten = 0;
+ CHAR szBuf[4096];
+ PCHAR pcchEnd = szBuf + ARRAYSIZE(szBuf);
+ PCHAR pcchCur = szBuf;
+ HRESULT hr;
+
+ hr = StringCchPrintfExA(pcchCur, pcchEnd - pcchCur,
+ &pcchCur, NULL, STRSAFE_NULL_ON_FAILURE,
+ s_fDeltaTime
+ ? "%-7.7s %4d %02x.%02x: %s\n"
+ : "%-17.17s %4d %02x.%02x: %s\n",
+ szTime,
+ pMessage->nProcessId,
+ pMessage->nFacility,
+ pMessage->nSeverity,
+ pMessage->szMessage);
+ if (FAILED(hr)) {
+ goto Cleanup;
+ }
+
+ Cleanup:
+ WriteFile(s_hOutFile, szBuf, (DWORD)(pcchCur - szBuf), &cbWritten, NULL);
+ }
+ return TRUE;
+}
+
+DWORD WINAPI WorkerThread(LPVOID pvVoid)
+{
+ PCLIENT pClient;
+ BOOL b;
+ LPOVERLAPPED lpo;
+ DWORD nBytes;
+ HANDLE hCompletionPort = (HANDLE)pvVoid;
+
+ for (BOOL fKeepLooping = TRUE; fKeepLooping;) {
+ pClient = NULL;
+ lpo = NULL;
+ nBytes = 0;
+ b = GetQueuedCompletionStatus(hCompletionPort,
+ &nBytes, (PULONG_PTR)&pClient, &lpo, INFINITE);
+
+ if (!b || lpo == NULL) {
+ fKeepLooping = FALSE;
+ MyErrExit("GetQueuedCompletionState");
+ break;
+ }
+ else if (!b) {
+ if (pClient) {
+ if (GetLastError() == ERROR_BROKEN_PIPE) {
+ LogMessageV(SYELOG_SEVERITY_INFORMATION, "Client closed pipe.");
+ }
+ else {
+ LogMessageV(SYELOG_SEVERITY_ERROR,
+ "GetQueuedCompletionStatus failed %d [%p]",
+ GetLastError(), pClient);
+ }
+ CloseConnection(pClient);
+ }
+ continue;
+ }
+
+ if (pClient->fAwaitingAccept) {
+ InterlockedIncrement(&s_nActiveClients);
+ pClient->fAwaitingAccept = FALSE;
+ b = ReadFile(pClient->hPipe,
+ &pClient->Message,
+ sizeof(pClient->Message),
+ &nBytes,
+ pClient);
+ if (!b) {
+ if (GetLastError() != ERROR_IO_PENDING) {
+ LogMessageV(SYELOG_SEVERITY_ERROR,
+ "ReadFile failed %d.", GetLastError());
+ continue;
+ }
+ }
+
+ CreatePipeConnection(hCompletionPort);
+ }
+ else {
+ if (nBytes < offsetof(SYELOG_MESSAGE, szMessage)) {
+ CloseConnection(pClient);
+ }
+
+ if (pClient->Message.fTerminate) {
+ LogMessageV(SYELOG_SEVERITY_NOTICE,
+ "Client requested terminate on next connection close.");
+ s_fExitAfterOne = TRUE;
+ }
+
+ LogMessage(&pClient->Message, nBytes);
+
+ b = ReadFile(pClient->hPipe,
+ &pClient->Message,
+ sizeof(pClient->Message),
+ &nBytes,
+ pClient);
+ if (!b && GetLastError() == ERROR_BROKEN_PIPE) {
+ CloseConnection(pClient);
+ }
+ }
+ }
+ return 0;
+}
+
+BOOL CreateWorkers(HANDLE hCompletionPort)
+{
+ DWORD dwThread;
+ HANDLE hThread;
+ DWORD i;
+ SYSTEM_INFO SystemInfo;
+
+ GetSystemInfo(&SystemInfo);
+
+ for (i = 0; i < 2 * SystemInfo.dwNumberOfProcessors; i++) {
+ hThread = CreateThread(NULL, 0, WorkerThread, hCompletionPort, 0, &dwThread);
+ if (!hThread) {
+ MyErrExit("CreateThread WorkerThread");
+ // Unreachable: return FALSE;
+ }
+ CloseHandle(hThread);
+ }
+ return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+BOOL WINAPI ControlHandler(DWORD dwCtrlType)
+{
+ switch (dwCtrlType) {
+ case CTRL_C_EVENT:
+ case CTRL_BREAK_EVENT:
+ case CTRL_CLOSE_EVENT:
+ case CTRL_LOGOFF_EVENT:
+ case CTRL_SHUTDOWN_EVENT:
+ LogMessageV(SYELOG_SEVERITY_INFORMATION, "User requested stop.");
+ printf("\nSYELOGD: Closing connections.\n");
+ if (s_hOutFile != INVALID_HANDLE_VALUE) {
+ printf("Closing file.\n");
+ FlushFileBuffers(s_hOutFile);
+ CloseHandle(s_hOutFile);
+ s_hOutFile = INVALID_HANDLE_VALUE;
+ }
+ ExitProcess(0);
+ }
+ return FALSE;
+}
+
+DWORD main(int argc, char **argv)
+{
+ HANDLE hCompletionPort;
+ BOOL fNeedHelp = FALSE;
+
+ GetSystemTimeAsFileTime((FILETIME *)&s_llStartTime);
+ SetConsoleCtrlHandler(ControlHandler, TRUE);
+
+ int arg = 1;
+ for (; arg < argc; arg++) {
+ if (argv[arg][0] == '-' || argv[arg][0] == '/') {
+ CHAR *argn = argv[arg] + 1;
+ CHAR *argp = argn;
+ while (*argp && *argp != ':') {
+ argp++;
+ }
+ if (*argp == ':') {
+ *argp++ = '\0';
+ }
+
+ switch (argn[0]) {
+
+ case 'd': // Delta time.
+ case 'D':
+ s_fDeltaTime = TRUE;
+ break;
+
+ case 'o': // Only one.
+ case 'O':
+ s_fExitAfterOne = TRUE;
+ break;
+
+ case 'q': // Quiet.
+ case 'Q':
+ s_fLogToScreen = FALSE;
+ break;
+
+ case '?': // Help.
+ fNeedHelp = TRUE;
+ break;
+
+ default:
+ fNeedHelp = TRUE;
+ printf("SYELOGD: Bad argument: %s:%s\n", argn, argp);
+ break;
+ }
+ }
+ else {
+ if (s_hOutFile != INVALID_HANDLE_VALUE) {
+ printf("SYELOGD: Error, more than one output file specified.\n\n");
+ fNeedHelp = TRUE;
+ break;
+ }
+
+ s_hOutFile = CreateFileA(argv[arg],
+ GENERIC_WRITE,
+ FILE_SHARE_READ,
+ NULL,
+ CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL |
+ FILE_FLAG_SEQUENTIAL_SCAN,
+ NULL);
+ if (s_hOutFile == INVALID_HANDLE_VALUE) {
+ printf("SYELOGD: Error opening output file: %s: %ld\n\n",
+ argv[arg], GetLastError());
+ fNeedHelp = TRUE;
+ break;
+ }
+ else {
+ printf("SYELOGD: Logging to %s.\n", argv[arg]);
+ }
+ }
+ }
+ if (fNeedHelp) {
+ printf("Usage:\n"
+ " syelogd [options] {output_file}\n"
+ "Options:\n"
+ " /d List delta time in ms from previous event (not absolute time).\n"
+ " /o Exit after one client disconnects.\n"
+ " /q Disable event logging to screen (quiet mode).\n"
+ " /? Display this help message.\n"
+ "Summary:\n"
+ " If given, all events will be logged to the output file.\n"
+ "\n");
+ exit(1);
+ }
+
+
+ // Create the completion port.
+ hCompletionPort = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, NULL, 0);
+ if (hCompletionPort == NULL) {
+ MyErrExit("CreateIoCompletionPort");
+ }
+
+ // Create completion port worker threads.
+ //
+ CreateWorkers(hCompletionPort);
+ CreatePipeConnection(hCompletionPort);
+
+ printf("SYELOGD: Ready for clients. Press Ctrl-C to stop.\n");
+ while (argc) {
+ Sleep(10000);
+ }
+
+ SetConsoleCtrlHandler(ControlHandler, FALSE);
+
+ if (s_hOutFile != INVALID_HANDLE_VALUE) {
+ FlushFileBuffers(s_hOutFile);
+ CloseHandle(s_hOutFile);
+ s_hOutFile = INVALID_HANDLE_VALUE;
+ }
+
+ return 0;
+}
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/ext/detours/samples/talloc/Makefile b/ext/detours/samples/talloc/Makefile
new file mode 100644
index 0000000..9e561c4
--- /dev/null
+++ b/ext/detours/samples/talloc/Makefile
@@ -0,0 +1,332 @@
+##############################################################################
+##
+## Makefile for Detours Test Programs.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+# This test tests the allocation algorithm. .dlls are carefully placed
+# immediately adjacent to each other to force the algorithm to look more places.
+
+# /noentry keeps the .dlls small, so they all fit at their bases
+
+!if "$(DETOURS_TARGET_PROCESSOR:64=)" == "$(DETOURS_TARGET_PROCESSOR)"
+# 32bit bases
+DETOURS_TALLOC1=0x28000000
+DETOURS_TALLOC2=0x38000000
+DETOURS_TALLOC3=0x48050000
+DETOURS_TALLOC4=0x58000000
+DETOURS_TALLOC5=0x68000000
+DETOURS_TALLOC6=0x68010000
+DETOURS_TALLOC7=0x68020000
+DETOURS_TALLOC8=0x68030000
+DETOURS_TALLOC9=0x68040000
+!else
+# 64bit bases
+DETOURS_TALLOC1=0x280000000
+DETOURS_TALLOC2=0x380000000
+DETOURS_TALLOC3=0x480050000
+DETOURS_TALLOC4=0x580000000
+DETOURS_TALLOC5=0x680000000
+DETOURS_TALLOC6=0x680010000
+DETOURS_TALLOC7=0x680020000
+DETOURS_TALLOC8=0x680030000
+DETOURS_TALLOC9=0x680040000
+!endif
+
+LIBS=$(LIBS) kernel32.lib psapi.lib
+
+all: dirs \
+ $(BIND)\tdll1x$(DETOURS_BITS).dll \
+ $(BIND)\tdll2x$(DETOURS_BITS).dll \
+ $(BIND)\tdll3x$(DETOURS_BITS).dll \
+ $(BIND)\tdll4x$(DETOURS_BITS).dll \
+ $(BIND)\tdll5x$(DETOURS_BITS).dll \
+ $(BIND)\tdll6x$(DETOURS_BITS).dll \
+ $(BIND)\tdll7x$(DETOURS_BITS).dll \
+ $(BIND)\tdll8x$(DETOURS_BITS).dll \
+ $(BIND)\tdll9x$(DETOURS_BITS).dll \
+ $(BIND)\talloc.exe \
+ \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\tdll1x$(DETOURS_BITS).bsc \
+ $(OBJD)\tdll2x$(DETOURS_BITS).bsc \
+ $(OBJD)\tdll3x$(DETOURS_BITS).bsc \
+ $(OBJD)\tdll4x$(DETOURS_BITS).bsc \
+ $(OBJD)\tdll5x$(DETOURS_BITS).bsc \
+ $(OBJD)\tdll6x$(DETOURS_BITS).bsc \
+ $(OBJD)\tdll7x$(DETOURS_BITS).bsc \
+ $(OBJD)\tdll8x$(DETOURS_BITS).bsc \
+ $(OBJD)\tdll9x$(DETOURS_BITS).bsc \
+ $(OBJD)\talloc.bsc \
+!ENDIF
+ option
+
+clean:
+ -del *~ 2>nul
+ -del $(BIND)\tdll1x* 2>nul
+ -del $(BIND)\tdll2x* 2>nul
+ -del $(BIND)\tdll3x* 2>nul
+ -del $(BIND)\tdll4x* 2>nul
+ -del $(BIND)\tdll5x* 2>nul
+ -del $(BIND)\tdll6x* 2>nul
+ -del $(BIND)\tdll7x* 2>nul
+ -del $(BIND)\tdll8x* 2>nul
+ -del $(BIND)\tdll9x* 2>nul
+ -del $(BIND)\talloc* 2>nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+##############################################################################
+
+$(OBJD)\talloc.obj : talloc.cpp
+
+$(BIND)\talloc.exe : $(OBJD)\talloc.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb $(OBJD)\talloc.obj \
+ /link $(LINKFLAGS) $(LIBS) \
+ $(BIND)\tdll1x$(DETOURS_BITS).lib \
+ $(BIND)\tdll2x$(DETOURS_BITS).lib \
+ $(BIND)\tdll3x$(DETOURS_BITS).lib \
+ $(BIND)\tdll4x$(DETOURS_BITS).lib \
+ $(BIND)\tdll5x$(DETOURS_BITS).lib \
+ $(BIND)\tdll6x$(DETOURS_BITS).lib \
+ $(BIND)\tdll7x$(DETOURS_BITS).lib \
+ $(BIND)\tdll8x$(DETOURS_BITS).lib \
+ $(BIND)\tdll9x$(DETOURS_BITS).lib \
+ /subsystem:console /entry:WinMainCRTStartup
+
+$(OBJD)\talloc.bsc : $(OBJD)\talloc.obj
+ bscmake /v /n /o $@ $(OBJD)\talloc.sbr
+
+$(OBJD)\tdll1x.obj : tdll1x.cpp
+
+# /noentry keeps the .dlls small, so they all fit at their bases
+$(BIND)\tdll1x$(DETOURS_BITS).dll : $(OBJD)\tdll1x.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb \
+ $(OBJD)\tdll1x.obj /LD \
+ /link $(LINKFLAGS:/profile=/fixed) $(LIBS) \
+ /subsystem:windows \
+ /noentry \
+ /base:$(DETOURS_TALLOC1)
+
+$(OBJD)\tdll1x$(DETOURS_BITS).bsc : $(OBJD)\tdll1x.obj
+ bscmake /v /n /o $@ $(OBJD)\tdll1x.sbr
+
+$(OBJD)\tdll2x.obj : tdll2x.cpp
+
+# /noentry keeps the .dlls small, so they all fit at their bases
+$(BIND)\tdll2x$(DETOURS_BITS).dll : $(OBJD)\tdll2x.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb \
+ $(OBJD)\tdll2x.obj /LD \
+ /link $(LINKFLAGS:/profile=/fixed) $(LIBS) \
+ /subsystem:console \
+ /noentry \
+ /base:$(DETOURS_TALLOC2)
+
+$(OBJD)\tdll2x$(DETOURS_BITS).bsc : $(OBJD)\tdll2x.obj
+ bscmake /v /n /o $@ $(OBJD)\tdll2x.sbr
+
+$(OBJD)\tdll3x.obj : tdll3x.cpp
+
+# /noentry keeps the .dlls small, so they all fit at their bases
+$(BIND)\tdll3x$(DETOURS_BITS).dll : $(OBJD)\tdll3x.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb \
+ $(OBJD)\tdll3x.obj /LD \
+ /link $(LINKFLAGS:/profile=/fixed) $(LIBS) \
+ /subsystem:console \
+ /noentry \
+ /base:$(DETOURS_TALLOC3)
+
+$(OBJD)\tdll3x$(DETOURS_BITS).bsc : $(OBJD)\tdll3x.obj
+ bscmake /v /n /o $@ $(OBJD)\tdll3x.sbr
+
+$(OBJD)\tdll4x.obj : tdll4x.cpp
+
+# /noentry keeps the .dlls small, so they all fit at their bases
+$(BIND)\tdll4x$(DETOURS_BITS).dll : $(OBJD)\tdll4x.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb \
+ $(OBJD)\tdll4x.obj /LD \
+ /link $(LINKFLAGS:/profile=/fixed) $(LIBS) \
+ /subsystem:console \
+ /noentry \
+ /base:$(DETOURS_TALLOC4)
+
+$(OBJD)\tdll4x$(DETOURS_BITS).bsc : $(OBJD)\tdll4x.obj
+ bscmake /v /n /o $@ $(OBJD)\tdll4x.sbr
+
+
+$(OBJD)\tdll5x.obj : tdll5x.cpp
+
+# /noentry keeps the .dlls small, so they all fit at their bases
+$(BIND)\tdll5x$(DETOURS_BITS).dll : $(OBJD)\tdll5x.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb \
+ $(OBJD)\tdll5x.obj /LD \
+ /link $(LINKFLAGS:/profile=/fixed) $(LIBS) \
+ /subsystem:console \
+ /noentry \
+ /base:$(DETOURS_TALLOC5)
+
+$(OBJD)\tdll5x$(DETOURS_BITS).bsc : $(OBJD)\tdll5x.obj
+ bscmake /v /n /o $@ $(OBJD)\tdll5x.sbr
+
+$(OBJD)\tdll6x.obj : tdll6x.cpp
+
+# /noentry keeps the .dlls small, so they all fit at their bases
+$(BIND)\tdll6x$(DETOURS_BITS).dll : $(OBJD)\tdll6x.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb \
+ $(OBJD)\tdll6x.obj /LD \
+ /link $(LINKFLAGS:/profile=/fixed) $(LIBS) \
+ /subsystem:console \
+ /noentry \
+ /base:$(DETOURS_TALLOC6)
+
+$(OBJD)\tdll6x$(DETOURS_BITS).bsc : $(OBJD)\tdll6x.obj
+ bscmake /v /n /o $@ $(OBJD)\tdll6x.sbr
+
+
+$(OBJD)\tdll7x.obj : tdll7x.cpp
+
+# /noentry keeps the .dlls small, so they all fit at their bases
+$(BIND)\tdll7x$(DETOURS_BITS).dll : $(OBJD)\tdll7x.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb \
+ $(OBJD)\tdll7x.obj /LD \
+ /link $(LINKFLAGS:/profile=/fixed) $(LIBS) \
+ /subsystem:console \
+ /noentry \
+ /base:$(DETOURS_TALLOC7)
+
+$(OBJD)\tdll7x$(DETOURS_BITS).bsc : $(OBJD)\tdll7x.obj
+ bscmake /v /n /o $@ $(OBJD)\tdll7x.sbr
+
+
+$(OBJD)\tdll8x.obj : tdll8x.cpp
+
+# /noentry keeps the .dlls small, so they all fit at their bases
+$(BIND)\tdll8x$(DETOURS_BITS).dll : $(OBJD)\tdll8x.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb \
+ $(OBJD)\tdll8x.obj /LD \
+ /link $(LINKFLAGS:/profile=/fixed) $(LIBS) \
+ /subsystem:console \
+ /noentry \
+ /base:$(DETOURS_TALLOC8)
+
+$(OBJD)\tdll8x$(DETOURS_BITS).bsc : $(OBJD)\tdll8x.obj
+ bscmake /v /n /o $@ $(OBJD)\tdll8x.sbr
+
+
+$(OBJD)\tdll9x.obj : tdll9x.cpp
+
+# /noentry keeps the .dlls small, so they all fit at their bases
+$(BIND)\tdll9x$(DETOURS_BITS).dll : $(OBJD)\tdll9x.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb \
+ $(OBJD)\tdll9x.obj /LD \
+ /link $(LINKFLAGS:/profile=/fixed) $(LIBS) \
+ /subsystem:console \
+ /noentry \
+ /base:$(DETOURS_TALLOC9)
+
+$(OBJD)\tdll9x$(DETOURS_BITS).bsc : $(OBJD)\tdll9x.obj
+ bscmake /v /n /o $@ $(OBJD)\tdll9x.sbr
+
+############################################### Install non-bit-size binaries.
+
+!IF "$(DETOURS_OPTION_PROCESSOR)" != ""
+
+$(OPTD)\tdll1x$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\tdll1x$(DETOURS_OPTION_BITS).pdb:
+$(OPTD)\tdll2x$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\tdll2x$(DETOURS_OPTION_BITS).pdb:
+$(OPTD)\tdll3x$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\tdll3x$(DETOURS_OPTION_BITS).pdb:
+$(OPTD)\tdll4x$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\tdll4x$(DETOURS_OPTION_BITS).pdb:
+$(OPTD)\tdll5x$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\tdll5x$(DETOURS_OPTION_BITS).pdb:
+$(OPTD)\tdll6x$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\tdll6x$(DETOURS_OPTION_BITS).pdb:
+$(OPTD)\tdll7x$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\tdll7x$(DETOURS_OPTION_BITS).pdb:
+$(OPTD)\tdll8x$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\tdll8x$(DETOURS_OPTION_BITS).pdb:
+$(OPTD)\tdll9x$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\tdll9x$(DETOURS_OPTION_BITS).pdb:
+
+$(BIND)\tdll1x$(DETOURS_OPTION_BITS).dll : $(OPTD)\tdll1x$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\tdll1x$(DETOURS_OPTION_BITS).pdb : $(OPTD)\tdll1x$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\tdll2x$(DETOURS_OPTION_BITS).dll : $(OPTD)\tdll2x$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\tdll2x$(DETOURS_OPTION_BITS).pdb : $(OPTD)\tdll2x$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\tdll3x$(DETOURS_OPTION_BITS).dll : $(OPTD)\tdll3x$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\tdll3x$(DETOURS_OPTION_BITS).pdb : $(OPTD)\tdll3x$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\tdll4x$(DETOURS_OPTION_BITS).dll : $(OPTD)\tdll4x$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\tdll4x$(DETOURS_OPTION_BITS).pdb : $(OPTD)\tdll4x$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\tdll5x$(DETOURS_OPTION_BITS).dll : $(OPTD)\tdll5x$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\tdll5x$(DETOURS_OPTION_BITS).pdb : $(OPTD)\tdll5x$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\tdll6x$(DETOURS_OPTION_BITS).dll : $(OPTD)\tdll6x$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\tdll6x$(DETOURS_OPTION_BITS).pdb : $(OPTD)\tdll6x$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\tdll7x$(DETOURS_OPTION_BITS).dll : $(OPTD)\tdll7x$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\tdll7x$(DETOURS_OPTION_BITS).pdb : $(OPTD)\tdll7x$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\tdll8x$(DETOURS_OPTION_BITS).dll : $(OPTD)\tdll8x$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\tdll8x$(DETOURS_OPTION_BITS).pdb : $(OPTD)\tdll8x$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\tdll9x$(DETOURS_OPTION_BITS).dll : $(OPTD)\tdll9x$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\tdll9x$(DETOURS_OPTION_BITS).pdb : $(OPTD)\tdll9x$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+
+option: \
+ $(BIND)\tdll1x$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\tdll1x$(DETOURS_OPTION_BITS).pdb \
+ $(BIND)\tdll2x$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\tdll2x$(DETOURS_OPTION_BITS).pdb \
+ $(BIND)\tdll3x$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\tdll3x$(DETOURS_OPTION_BITS).pdb \
+ $(BIND)\tdll4x$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\tdll4x$(DETOURS_OPTION_BITS).pdb \
+ $(BIND)\tdll5x$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\tdll5x$(DETOURS_OPTION_BITS).pdb \
+ $(BIND)\tdll6x$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\tdll6x$(DETOURS_OPTION_BITS).pdb \
+ $(BIND)\tdll7x$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\tdll7x$(DETOURS_OPTION_BITS).pdb \
+ $(BIND)\tdll8x$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\tdll8x$(DETOURS_OPTION_BITS).pdb \
+ $(BIND)\tdll9x$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\tdll9x$(DETOURS_OPTION_BITS).pdb \
+
+!ELSE
+
+option:
+
+!ENDIF
+
+##############################################################################
+
+test: all
+ $(BIND)\talloc.exe
+
+################################################################# End of File.
diff --git a/ext/detours/samples/talloc/NORMAL_IA64.TXT b/ext/detours/samples/talloc/NORMAL_IA64.TXT
new file mode 100644
index 0000000..e04a1c9
--- /dev/null
+++ b/ext/detours/samples/talloc/NORMAL_IA64.TXT
@@ -0,0 +1,70 @@
+talloc.exe: Detoured functions.
+
+ Address Size: Typ Sta Prot Ini : Contents
+ ------------ ------------: --- --- ---- --- : -----------------
+Exe: 13f660000
+ 100000000 3f660000: fre --- :
+ 13f660000 2000: img com r-- rcx : TALLOC.EXE
+ 13f6ce000 100802000: fre --- :
+Dll1: 280000000
+ 200000000 3fed0000: fre --- :
+ 23fed0000 10000: pri com r-x rwx :
+ 23fee0000 2000: pri res --- :
+ 23fee2000 e000: fre --- :
+ 23fef0000 10000: pri res --- :
+ 23ff00000 100000: pri res --- :
+ 240000000 40000000: pri res --- :
+ 280000000 2000: img com r-- rcx : TDLL1X64.DLL
+ 280028000 8000: fre --- :
+ 280030000 7ffd0000: pri res --- :
+Dll2: 380000000
+ 300000000 80000000: pri res --- :
+ 380000000 2000: img com r-- rcx : TDLL2X64.DLL
+ 380028000 8000: fre --- :
+ 380030000 40000000: pri res --- :
+ 3c0030000 100000: pri res --- :
+ 3c0130000 10000: pri res --- :
+ 3c0140000 2000: pri res --- :
+ 3c0142000 e000: fre --- :
+ 3c0150000 10000: pri com r-x rwx :
+ 3c0160000 3fea0000: fre --- :
+Dll3: 480000000
+ 400000000 40000000: pri res --- :
+ 440000000 100000: pri res --- :
+ 440100000 10000: pri res --- :
+ 440110000 2000: pri res --- :
+ 440112000 e000: fre --- :
+ 440120000 10000: pri com r-x rwx :
+ 440130000 3fed0000: fre --- :
+ 480000000 2000: img com r-- rcx : TDLL3X64.DLL
+ 480028000 8000: fre --- :
+ 480030000 7ffd0000: pri res --- :
+Dll4: 580000000
+ 500000000 80000000: pri res --- :
+ 580000000 2000: img com r-- rcx : TDLL4X64.DLL
+ 580028000 3fea8000: fre --- :
+ 5bfed0000 10000: pri com r-x rwx :
+ 5bfee0000 2000: pri res --- :
+ 5bfee2000 e000: fre --- :
+ 5bfef0000 10000: pri res --- :
+ 5bff00000 100000: pri res --- :
+ 5c0000000 40000000: pri res --- :
+Dll5: 680000000
+ 600000000 f0000: fre --- :
+ 6000f0000 10000: pri com r-x rwx :
+ 600100000 7ff00000: pri res --- :
+ 680000000 2000: img com r-- rcx : TDLL5X64.DLL
+ 680028000 18000: fre --- :
+ 680040000 2000: img com r-- rcx : TDLL6X64.DLL
+ 680068000 18000: fre --- :
+ 680080000 2000: img com r-- rcx : TDLL7X64.DLL
+ 6800a8000 18000: fre --- :
+ 6800c0000 2000: img com r-- rcx : TDLL8X64.DLL
+ 6800e8000 18000: fre --- :
+ 680100000 2000: img com r-- rcx : TDLL9X64.DLL
+ 680128000 8000: fre --- :
+ 680130000 7fe00000: pri res --- :
+ 6fff30000 10000: pri com r-x rwx :
+ 6fff40000 6f3fbdd0000: fre --- :
+
+talloc.exe: 1 calls to Dll1Function
diff --git a/ext/detours/samples/talloc/NORMAL_X64.TXT b/ext/detours/samples/talloc/NORMAL_X64.TXT
new file mode 100644
index 0000000..650d09a
--- /dev/null
+++ b/ext/detours/samples/talloc/NORMAL_X64.TXT
@@ -0,0 +1,66 @@
+talloc.exe: Detoured functions.
+
+ Address Size: Typ Sta Prot Ini : Contents
+ ------------ ------------: --- --- ---- --- : -----------------
+Exe: 13f7f0000
+ 100000000 3f7f0000: fre --- :
+ 13f7f0000 1000: img com r-- rcx : TALLOC.EXE
+ 13f81e000 1006b2000: fre --- :
+Dll1: 280000000
+ 200000000 3fed0000: fre --- :
+ 23fed0000 10000: pri com r-x rwx :
+ 23fee0000 1000: pri res --- :
+ 23fee1000 f000: fre --- :
+ 23fef0000 10000: pri res --- :
+ 23ff00000 100000: pri res --- :
+ 240000000 40000000: pri res --- :
+ 280000000 1000: img com r-- rcx : TDLL1X64.DLL
+ 280010000 7fff0000: pri res --- :
+Dll2: 380000000
+ 300000000 80000000: pri res --- :
+ 380000000 1000: img com r-- rcx : TDLL2X64.DLL
+ 380010000 40000000: pri res --- :
+ 3c0010000 100000: pri res --- :
+ 3c0110000 10000: pri res --- :
+ 3c0120000 1000: pri res --- :
+ 3c0121000 f000: fre --- :
+ 3c0130000 10000: pri com r-x rwx :
+ 3c0140000 3fec0000: fre --- :
+Dll3: 480000000
+ 400000000 40000000: pri res --- :
+ 440000000 100000: pri res --- :
+ 440100000 10000: pri res --- :
+ 440110000 1000: pri res --- :
+ 440111000 f000: fre --- :
+ 440120000 10000: pri com r-x rwx :
+ 440130000 3fed0000: fre --- :
+ 480000000 1000: img com r-- rcx : TDLL3X64.DLL
+ 480010000 7fff0000: pri res --- :
+Dll4: 580000000
+ 500000000 80000000: pri res --- :
+ 580000000 1000: img com r-- rcx : TDLL4X64.DLL
+ 580010000 3fec0000: fre --- :
+ 5bfed0000 10000: pri com r-x rwx :
+ 5bfee0000 1000: pri res --- :
+ 5bfee1000 f000: fre --- :
+ 5bfef0000 10000: pri res --- :
+ 5bff00000 100000: pri res --- :
+ 5c0000000 40000000: pri res --- :
+Dll5: 680000000
+ 600000000 f0000: fre --- :
+ 6000f0000 10000: pri com r-x rwx :
+ 600100000 7ff00000: pri res --- :
+ 680000000 1000: img com r-- rcx : TDLL5X64.DLL
+ 680010000 30000: fre --- :
+ 680040000 1000: img com r-- rcx : TDLL6X64.DLL
+ 680050000 30000: fre --- :
+ 680080000 1000: img com r-- rcx : TDLL7X64.DLL
+ 680090000 30000: fre --- :
+ 6800c0000 1000: img com r-- rcx : TDLL8X64.DLL
+ 6800d0000 30000: fre --- :
+ 680100000 1000: img com r-- rcx : TDLL9X64.DLL
+ 680110000 7fe00000: pri res --- :
+ 6fff10000 10000: pri com r-x rwx :
+ 6fff20000 7f7fdf70000: fre --- :
+
+talloc.exe: 1 calls to Dll1Function
diff --git a/ext/detours/samples/talloc/talloc.cpp b/ext/detours/samples/talloc/talloc.cpp
new file mode 100644
index 0000000..85eb6b3
--- /dev/null
+++ b/ext/detours/samples/talloc/talloc.cpp
@@ -0,0 +1,541 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (talloc.cpp of talloc.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#define PSAPI_VERSION 2
+#include <stdio.h>
+#include <stdlib.h>
+#include <windows.h>
+#pragma warning(push)
+#if _MSC_VER > 1400
+#pragma warning(disable:6102 6103) // /analyze warnings
+#endif
+#include <strsafe.h>
+#pragma warning(pop)
+#include <psapi.h>
+#include <detours.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+void TypeToString(DWORD Type, char *pszBuffer, size_t cBuffer)
+{
+ if (Type == MEM_IMAGE) {
+ StringCchPrintfA(pszBuffer, cBuffer, "img");
+ }
+ else if (Type == MEM_MAPPED) {
+ StringCchPrintfA(pszBuffer, cBuffer, "map");
+ }
+ else if (Type == MEM_PRIVATE) {
+ StringCchPrintfA(pszBuffer, cBuffer, "pri");
+ }
+ else if (Type == 0) {
+ StringCchPrintfA(pszBuffer, cBuffer, " ");
+ }
+ else {
+ StringCchPrintfA(pszBuffer, cBuffer, "%x", Type);
+ }
+}
+
+void StateToString(DWORD State, char *pszBuffer, size_t cBuffer)
+{
+ if (State == MEM_COMMIT) {
+ StringCchPrintfA(pszBuffer, cBuffer, "com");
+ }
+ else if (State == MEM_FREE) {
+ StringCchPrintfA(pszBuffer, cBuffer, "fre");
+ }
+ else if (State == MEM_RESERVE) {
+ StringCchPrintfA(pszBuffer, cBuffer, "res");
+ }
+ else {
+ StringCchPrintfA(pszBuffer, cBuffer, "%x", State);
+ }
+}
+
+void ProtectToString(DWORD Protect, char *pszBuffer, size_t cBuffer)
+{
+ if (Protect == 0) {
+ StringCchPrintfA(pszBuffer, cBuffer, "");
+ }
+ else if (Protect == PAGE_EXECUTE) {
+ StringCchPrintfA(pszBuffer, cBuffer, "--x");
+ }
+ else if (Protect == PAGE_EXECUTE_READ) {
+ StringCchPrintfA(pszBuffer, cBuffer, "r-x");
+ }
+ else if (Protect == PAGE_EXECUTE_READWRITE) {
+ StringCchPrintfA(pszBuffer, cBuffer, "rwx");
+ }
+ else if (Protect == PAGE_EXECUTE_WRITECOPY) {
+ StringCchPrintfA(pszBuffer, cBuffer, "rcx");
+ }
+ else if (Protect == PAGE_NOACCESS) {
+ StringCchPrintfA(pszBuffer, cBuffer, "---");
+ }
+ else if (Protect == PAGE_READONLY) {
+ StringCchPrintfA(pszBuffer, cBuffer, "r--");
+ }
+ else if (Protect == PAGE_READWRITE) {
+ StringCchPrintfA(pszBuffer, cBuffer, "rw-");
+ }
+ else if (Protect == PAGE_WRITECOPY) {
+ StringCchPrintfA(pszBuffer, cBuffer, "rc-");
+ }
+ else if (Protect == (PAGE_GUARD | PAGE_EXECUTE)) {
+ StringCchPrintfA(pszBuffer, cBuffer, "g--x");
+ }
+ else if (Protect == (PAGE_GUARD | PAGE_EXECUTE_READ)) {
+ StringCchPrintfA(pszBuffer, cBuffer, "gr-x");
+ }
+ else if (Protect == (PAGE_GUARD | PAGE_EXECUTE_READWRITE)) {
+ StringCchPrintfA(pszBuffer, cBuffer, "grwx");
+ }
+ else if (Protect == (PAGE_GUARD | PAGE_EXECUTE_WRITECOPY)) {
+ StringCchPrintfA(pszBuffer, cBuffer, "grcx");
+ }
+ else if (Protect == (PAGE_GUARD | PAGE_NOACCESS)) {
+ StringCchPrintfA(pszBuffer, cBuffer, "g---");
+ }
+ else if (Protect == (PAGE_GUARD | PAGE_READONLY)) {
+ StringCchPrintfA(pszBuffer, cBuffer, "gr--");
+ }
+ else if (Protect == (PAGE_GUARD | PAGE_READWRITE)) {
+ StringCchPrintfA(pszBuffer, cBuffer, "grw-");
+ }
+ else if (Protect == (PAGE_GUARD | PAGE_WRITECOPY)) {
+ StringCchPrintfA(pszBuffer, cBuffer, "grc-");
+ }
+ else {
+ StringCchPrintfA(pszBuffer, cBuffer, "%x", Protect);
+ }
+}
+
+ULONG PadToPage(ULONG Size)
+{
+ return (Size & 0xfff)
+ ? Size + 0x1000 - (Size & 0xfff)
+ : Size;
+}
+
+size_t NextAt(size_t start)
+{
+ size_t next = start;
+
+ for (;;) {
+ MEMORY_BASIC_INFORMATION mbi;
+
+ ZeroMemory(&mbi, sizeof(mbi));
+ if (VirtualQuery((PVOID)next, &mbi, sizeof(mbi)) == 0) {
+ break;
+ }
+ if ((mbi.RegionSize & 0xfff) == 0xfff) {
+ break;
+ }
+
+ if ((size_t)mbi.AllocationBase != start) {
+ break;
+ }
+
+ next = (size_t)mbi.BaseAddress + mbi.RegionSize;
+ }
+ return next;
+}
+
+size_t RoundUpRegion(size_t value)
+{
+ size_t diff = value & 0xffff;
+ return (diff != 0) ? value + 0x10000 - diff : value;
+}
+
+VOID DumpProcessHeaders()
+{
+ printf(" %12s %12s: %3s %3s %4s %3s : %8s\n",
+ "Address", "Size", "Typ", "Sta", "Prot", "Ini", "Contents");
+ printf(" %12s %12s: %3s %3s %4s %3s : %8s\n",
+ "------------", "------------", "---", "---", "----", "---", "-----------------");
+}
+
+BOOL DumpProcess(UINT64 lo64, UINT64 hi64)
+{
+#ifdef _WIN64
+ ULONG_PTR lo = lo64;
+ ULONG_PTR hi = hi64;
+#else
+ ULONG_PTR lo = (size_t)(lo64 >> 4);
+ ULONG_PTR hi = (size_t)(hi64 >> 4);
+#endif
+
+ size_t base;
+ size_t next;
+
+ MEMORY_BASIC_INFORMATION mbi;
+
+ for (next = lo; next < hi;) {
+ base = next;
+ ZeroMemory(&mbi, sizeof(mbi));
+ if (VirtualQuery((PVOID)base, &mbi, sizeof(mbi)) == 0) {
+ break;
+ }
+ if ((mbi.RegionSize & 0xfff) == 0xfff) {
+ break;
+ }
+
+ if ((size_t)mbi.BaseAddress < lo) {
+ base = (size_t)mbi.BaseAddress;
+ }
+
+ size_t size = ((size_t)mbi.BaseAddress + mbi.RegionSize) - base;
+ next = (size_t)mbi.BaseAddress + mbi.RegionSize;
+
+ CHAR szType[16];
+ TypeToString(mbi.Type, szType, ARRAYSIZE(szType));
+ CHAR szState[16];
+ StateToString(mbi.State, szState, ARRAYSIZE(szState));
+ CHAR szProtect[16];
+ ProtectToString(mbi.Protect, szProtect, ARRAYSIZE(szProtect));
+ CHAR szAllocProtect[16];
+ ProtectToString(mbi.AllocationProtect, szAllocProtect, ARRAYSIZE(szAllocProtect));
+
+ CHAR szFile[MAX_PATH];
+ szFile[0] = '\0';
+ DWORD cb = 0;
+ PCHAR pszFile = szFile;
+
+ if (base == (size_t)mbi.AllocationBase) {
+ next = NextAt(base);
+
+ cb = GetMappedFileNameA(GetCurrentProcess(),
+ mbi.AllocationBase, szFile, ARRAYSIZE(szFile));
+ if (cb > 0) {
+ for (DWORD c = 0; c < cb; c++) {
+ szFile[c] = (char)toupper(szFile[c]);
+ }
+ szFile[cb] = '\0';
+ }
+ else {
+ szFile[0] = '\0';
+ }
+ if ((pszFile = strrchr(szFile, '\\')) == NULL) {
+ pszFile = szFile;
+ }
+ else {
+ pszFile++;
+ }
+ }
+
+ printf("%c %12zx %12zx: %3s %3s %4s %3s : %s\n",
+ " *"[base == (size_t)mbi.AllocationBase],
+ base,
+ size,
+ szType,
+ szState,
+ szProtect,
+ szAllocProtect,
+ pszFile);
+ }
+ return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+__declspec(dllimport) DWORD WINAPI Dll1Function(DWORD Value);
+__declspec(dllimport) DWORD WINAPI Dll2Function(DWORD Value);
+__declspec(dllimport) DWORD WINAPI Dll3Function(DWORD Value);
+__declspec(dllimport) DWORD WINAPI Dll4Function(DWORD Value);
+__declspec(dllimport) DWORD WINAPI Dll5Function(DWORD Value);
+__declspec(dllimport) DWORD WINAPI Dll6Function(DWORD Value);
+__declspec(dllimport) DWORD WINAPI Dll7Function(DWORD Value);
+__declspec(dllimport) DWORD WINAPI Dll8Function(DWORD Value);
+__declspec(dllimport) DWORD WINAPI Dll9Function(DWORD Value);
+
+static LONG dwCountDll1 = 0;
+static LONG dwCountDll2 = 0;
+static LONG dwCountDll3 = 0;
+static LONG dwCountDll4 = 0;
+static LONG dwCountDll5 = 0;
+static LONG dwCountDll6 = 0;
+static LONG dwCountDll7 = 0;
+static LONG dwCountDll8 = 0;
+static LONG dwCountDll9 = 0;
+
+static DWORD (WINAPI * TrueDll1Function)(DWORD Value) = Dll1Function;
+static DWORD (WINAPI * TrueDll2Function)(DWORD Value) = Dll2Function;
+static DWORD (WINAPI * TrueDll3Function)(DWORD Value) = Dll3Function;
+static DWORD (WINAPI * TrueDll4Function)(DWORD Value) = Dll4Function;
+static DWORD (WINAPI * TrueDll5Function)(DWORD Value) = Dll5Function;
+static DWORD (WINAPI * TrueDll6Function)(DWORD Value) = Dll6Function;
+static DWORD (WINAPI * TrueDll7Function)(DWORD Value) = Dll7Function;
+static DWORD (WINAPI * TrueDll8Function)(DWORD Value) = Dll8Function;
+static DWORD (WINAPI * TrueDll9Function)(DWORD Value) = Dll9Function;
+
+DWORD WINAPI MineDll1Function(DWORD Value)
+{
+ Value = TrueDll1Function(Value);
+ InterlockedIncrement(&dwCountDll1);
+
+ return Value;
+}
+
+DWORD WINAPI MineDll2Function(DWORD Value)
+{
+ Value = TrueDll2Function(Value);
+ InterlockedIncrement(&dwCountDll2);
+
+ return Value;
+}
+
+DWORD WINAPI MineDll3Function(DWORD Value)
+{
+ Value = TrueDll3Function(Value);
+ InterlockedIncrement(&dwCountDll3);
+
+ return Value;
+}
+
+DWORD WINAPI MineDll4Function(DWORD Value)
+{
+ Value = TrueDll4Function(Value);
+ InterlockedIncrement(&dwCountDll4);
+
+ return Value;
+}
+
+DWORD WINAPI MineDll5Function(DWORD Value)
+{
+ Value = TrueDll5Function(Value);
+ InterlockedIncrement(&dwCountDll5);
+
+ return Value;
+}
+
+DWORD WINAPI MineDll6Function(DWORD Value)
+{
+ Value = TrueDll6Function(Value);
+ InterlockedIncrement(&dwCountDll6);
+
+ return Value;
+}
+
+DWORD WINAPI MineDll7Function(DWORD Value)
+{
+ Value = TrueDll7Function(Value);
+ InterlockedIncrement(&dwCountDll7);
+
+ return Value;
+}
+
+DWORD WINAPI MineDll8Function(DWORD Value)
+{
+ Value = TrueDll8Function(Value);
+ InterlockedIncrement(&dwCountDll8);
+
+ return Value;
+}
+
+DWORD WINAPI MineDll9Function(DWORD Value)
+{
+ Value = TrueDll9Function(Value);
+ InterlockedIncrement(&dwCountDll9);
+
+ return Value;
+}
+
+void Reserve(ULONG_PTR addr, ULONG_PTR size)
+{
+ PVOID mem = VirtualAlloc((PVOID)addr, size, MEM_RESERVE, PAGE_NOACCESS);
+ if (mem != (PVOID)addr) {
+ printf("*** Reservation failed: %p != %p\n", mem, (PVOID)addr);
+ }
+}
+
+int WINAPI WinMain(HINSTANCE hinst, HINSTANCE hprev, LPSTR lpszCmdLine, int nCmdShow)
+{
+ (void)hinst;
+ (void)hprev;
+ (void)lpszCmdLine;
+ (void)nCmdShow;
+ DWORD error = NO_ERROR;
+
+ size_t Dll1 = (size_t)LoadLibraryA("tdll1x" DETOURS_STRINGIFY(DETOURS_BITS) ".dll");
+ size_t Dll2 = (size_t)LoadLibraryA("tdll2x" DETOURS_STRINGIFY(DETOURS_BITS) ".dll");
+ size_t Dll3 = (size_t)LoadLibraryA("tdll3x" DETOURS_STRINGIFY(DETOURS_BITS) ".dll");
+ size_t Dll4 = (size_t)LoadLibraryA("tdll4x" DETOURS_STRINGIFY(DETOURS_BITS) ".dll");
+ size_t Dll5 = (size_t)LoadLibraryA("tdll5x" DETOURS_STRINGIFY(DETOURS_BITS) ".dll");
+ size_t Dll6 = (size_t)LoadLibraryA("tdll6x" DETOURS_STRINGIFY(DETOURS_BITS) ".dll");
+ size_t Dll7 = (size_t)LoadLibraryA("tdll7x" DETOURS_STRINGIFY(DETOURS_BITS) ".dll");
+ size_t Dll8 = (size_t)LoadLibraryA("tdll8x" DETOURS_STRINGIFY(DETOURS_BITS) ".dll");
+ size_t Dll9 = (size_t)LoadLibraryA("tdll9x" DETOURS_STRINGIFY(DETOURS_BITS) ".dll");
+
+ size_t DllEnd = RoundUpRegion(NextAt(Dll1));
+ ULONG_PTR DllSize = (DllEnd - Dll1);
+
+ (void)Dll6;
+ (void)Dll7;
+ (void)Dll8;
+
+ // Force allocation below moving lower.
+ Reserve(Dll1 - 0x40000000, 0x40000000);
+ Reserve(Dll1 - 0x40100000, 0x00100000);
+ Reserve(Dll1 - 0x40110000, 0x00010000);
+ Reserve(Dll1 - 0x40120000, 0x00001000);
+ Reserve(Dll1 + DllSize, 0x80000000 - DllSize);
+
+ // Force allocation above moving higher.
+ Reserve(Dll2 - 0x80000000, 0x80000000);
+ Reserve(Dll2 + DllSize, 0x40000000);
+ Reserve(Dll2 + 0x40000000 + DllSize, 0x00100000);
+ Reserve(Dll2 + 0x40100000 + DllSize, 0x00010000);
+ Reserve(Dll2 + 0x40110000 + DllSize, 0x00001000);
+
+ // Force allocation below moving higher.
+ Reserve(Dll3 - 0x80000000, 0x40000000);
+ Reserve(Dll3 - 0x40000000, 0x00100000);
+ Reserve(Dll3 - 0x3ff00000, 0x00010000);
+ Reserve(Dll3 - 0x3fef0000, 0x00001000);
+ Reserve(Dll3 + DllSize, 0x80000000 - DllSize);
+
+ // Force allocation above moving lower.
+ Reserve(Dll4 - 0x80000000, 0x80000000);
+ Reserve(Dll4 + 0x40000000, 0x40000000);
+ Reserve(Dll4 + 0x3ff00000, 0x00100000);
+ Reserve(Dll4 + 0x3fef0000, 0x00010000);
+ Reserve(Dll4 + 0x3fee0000, 0x00001000);
+
+ // Force allocation above and below.
+ Reserve(Dll5 - 0x7ff00000, 0x7ff00000);
+ Reserve(Dll9 + DllSize, 0x7fe00000);
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)TrueDll1Function, MineDll1Function);
+ error = DetourTransactionCommit();
+ if (error != NO_ERROR) {
+ failed:
+ printf("talloc.exe: Error detouring functions: %ld\n", error);
+ exit(1);
+ }
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)TrueDll2Function, MineDll2Function);
+ error = DetourTransactionCommit();
+ if (error != NO_ERROR) {
+ goto failed;
+ }
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)TrueDll3Function, MineDll3Function);
+ error = DetourTransactionCommit();
+ if (error != NO_ERROR) {
+ goto failed;
+ }
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)TrueDll4Function, MineDll4Function);
+ error = DetourTransactionCommit();
+ if (error != NO_ERROR) {
+ goto failed;
+ }
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)TrueDll5Function, MineDll5Function);
+ error = DetourTransactionCommit();
+ if (error != NO_ERROR) {
+ goto failed;
+ }
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)TrueDll6Function, MineDll6Function);
+ error = DetourTransactionCommit();
+ if (error != NO_ERROR) {
+ goto failed;
+ }
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)TrueDll7Function, MineDll7Function);
+ error = DetourTransactionCommit();
+ if (error != NO_ERROR) {
+ goto failed;
+ }
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)TrueDll8Function, MineDll8Function);
+ error = DetourTransactionCommit();
+ if (error != NO_ERROR) {
+ goto failed;
+ }
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)TrueDll9Function, MineDll9Function);
+ error = DetourTransactionCommit();
+ if (error != NO_ERROR) {
+ goto failed;
+ }
+
+ printf("talloc.exe: Detoured functions.\n");
+ printf("\n");
+
+ DumpProcessHeaders();
+ printf("%-47s %17zx\n", "Exe:", (size_t)GetModuleHandleW(NULL));
+ DumpProcess(0x100000000, 0x200000000);
+ printf("%-47s %17zx\n", "Dll1:", Dll1);
+ DumpProcess(0x200000000, 0x300000000);
+ printf("%-47s %17zx\n", "Dll2:", Dll2);
+ DumpProcess(0x300000000, 0x400000000);
+ printf("%-47s %17zx\n", "Dll3:", Dll3);
+ DumpProcess(0x400000000, 0x500000000);
+ printf("%-47s %17zx\n", "Dll4:", Dll4);
+ DumpProcess(0x500000000, 0x600000000);
+ printf("%-47s %17zx\n", "Dll5:", Dll5);
+ DumpProcess(0x600000000, 0x700000000);
+ fflush(stdout);
+
+ Dll1Function(1);
+ Dll2Function(2);
+ Dll2Function(3);
+ Dll3Function(4);
+ Dll3Function(5);
+ Dll3Function(6);
+ Dll4Function(7);
+ Dll5Function(8);
+ Dll6Function(9);
+ Dll7Function(10);
+ Dll8Function(10);
+ Dll9Function(10);
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourDetach(&(PVOID&)TrueDll1Function, MineDll1Function);
+ DetourDetach(&(PVOID&)TrueDll2Function, MineDll2Function);
+ DetourDetach(&(PVOID&)TrueDll3Function, MineDll3Function);
+ DetourDetach(&(PVOID&)TrueDll4Function, MineDll4Function);
+ DetourDetach(&(PVOID&)TrueDll5Function, MineDll5Function);
+ DetourDetach(&(PVOID&)TrueDll6Function, MineDll6Function);
+ DetourDetach(&(PVOID&)TrueDll7Function, MineDll7Function);
+ DetourDetach(&(PVOID&)TrueDll8Function, MineDll8Function);
+ DetourDetach(&(PVOID&)TrueDll9Function, MineDll9Function);
+ error = DetourTransactionCommit();
+ if (error != NO_ERROR) {
+ goto failed;
+ }
+
+ printf("\n");
+ printf("talloc.exe: %ld calls to Dll1Function\n", dwCountDll1);
+ fflush(stdout);
+
+ return 0;
+}
+
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/talloc/tdll1x.cpp b/ext/detours/samples/talloc/tdll1x.cpp
new file mode 100644
index 0000000..8edbadc
--- /dev/null
+++ b/ext/detours/samples/talloc/tdll1x.cpp
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (tdll1x.cpp of talloc.exe/tdll1x.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+//////////////////////////////////////////////////////////////////// DLL Stuff
+//
+__declspec(dllexport) unsigned long __stdcall Dll1Function(unsigned long Value)
+{
+ return Value + 1;
+}
+
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/talloc/tdll2x.cpp b/ext/detours/samples/talloc/tdll2x.cpp
new file mode 100644
index 0000000..c7e394f
--- /dev/null
+++ b/ext/detours/samples/talloc/tdll2x.cpp
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (tdll2x.cpp of talloc.exe/tdll2x.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+//////////////////////////////////////////////////////////////////// DLL Stuff
+//
+__declspec(dllexport) unsigned long __stdcall Dll2Function(unsigned long Value)
+{
+ return Value + 1;
+}
+
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/talloc/tdll3x.cpp b/ext/detours/samples/talloc/tdll3x.cpp
new file mode 100644
index 0000000..d3610e2
--- /dev/null
+++ b/ext/detours/samples/talloc/tdll3x.cpp
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (tdll3x.cpp of talloc.exe/tdll3x.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+//////////////////////////////////////////////////////////////////// DLL Stuff
+//
+__declspec(dllexport) unsigned long __stdcall Dll3Function(unsigned long Value)
+{
+ return Value + 1;
+}
+
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/talloc/tdll4x.cpp b/ext/detours/samples/talloc/tdll4x.cpp
new file mode 100644
index 0000000..eb3ab1e
--- /dev/null
+++ b/ext/detours/samples/talloc/tdll4x.cpp
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (tdll4x.cpp of talloc.exe/tdll4x.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+//////////////////////////////////////////////////////////////////// DLL Stuff
+//
+__declspec(dllexport) unsigned long __stdcall Dll4Function(unsigned long Value)
+{
+ return Value + 1;
+}
+
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/talloc/tdll5x.cpp b/ext/detours/samples/talloc/tdll5x.cpp
new file mode 100644
index 0000000..681ce41
--- /dev/null
+++ b/ext/detours/samples/talloc/tdll5x.cpp
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (tdll5x.cpp of talloc.exe/tdll5x.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+//////////////////////////////////////////////////////////////////// DLL Stuff
+//
+__declspec(dllexport) unsigned long __stdcall Dll5Function(unsigned long Value)
+{
+ return Value + 1;
+}
+
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/talloc/tdll6x.cpp b/ext/detours/samples/talloc/tdll6x.cpp
new file mode 100644
index 0000000..da2a306
--- /dev/null
+++ b/ext/detours/samples/talloc/tdll6x.cpp
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (tdll6x.cpp of talloc.exe/tdll6x.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+//////////////////////////////////////////////////////////////////// DLL Stuff
+//
+__declspec(dllexport) unsigned long __stdcall Dll6Function(unsigned long Value)
+{
+ return Value + 1;
+}
+
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/talloc/tdll7x.cpp b/ext/detours/samples/talloc/tdll7x.cpp
new file mode 100644
index 0000000..bcc9927
--- /dev/null
+++ b/ext/detours/samples/talloc/tdll7x.cpp
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (tdll7x.cpp of talloc.exe/tdll7x.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+//////////////////////////////////////////////////////////////////// DLL Stuff
+//
+__declspec(dllexport) unsigned long __stdcall Dll7Function(unsigned long Value)
+{
+ return Value + 1;
+}
+
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/talloc/tdll8x.cpp b/ext/detours/samples/talloc/tdll8x.cpp
new file mode 100644
index 0000000..2c899e4
--- /dev/null
+++ b/ext/detours/samples/talloc/tdll8x.cpp
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (tdll8x.cpp of talloc.exe/tdll8x.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+//////////////////////////////////////////////////////////////////// DLL Stuff
+//
+__declspec(dllexport) unsigned long __stdcall Dll8Function(unsigned long Value)
+{
+ return Value + 1;
+}
+
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/talloc/tdll9x.cpp b/ext/detours/samples/talloc/tdll9x.cpp
new file mode 100644
index 0000000..b8d5c08
--- /dev/null
+++ b/ext/detours/samples/talloc/tdll9x.cpp
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (tdll9x.cpp of talloc.exe/tdll9x.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+//////////////////////////////////////////////////////////////////// DLL Stuff
+//
+__declspec(dllexport) unsigned long __stdcall Dll9Function(unsigned long Value)
+{
+ return Value + 1;
+}
+
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/traceapi/Makefile b/ext/detours/samples/traceapi/Makefile
new file mode 100644
index 0000000..61794b1
--- /dev/null
+++ b/ext/detours/samples/traceapi/Makefile
@@ -0,0 +1,153 @@
+##############################################################################
+##
+## Utility to trace Win32 APIs.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+LIBS=$(LIBS) kernel32.lib gdi32.lib user32.lib shell32.lib advapi32.lib ole32.lib ws2_32.lib
+
+##############################################################################
+
+all: dirs \
+ $(BIND)\trcapi$(DETOURS_BITS).dll \
+ $(BIND)\testapi.exe \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\trcapi$(DETOURS_BITS).bsc \
+ $(OBJD)\testapi.bsc \
+!ENDIF
+ option
+
+##############################################################################
+
+clean:
+ -del *~ test.txt 2>nul
+ -del $(BIND)\trcapi*.* $(BIND)\testapi.* 2>nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+$(OBJD)\trcapi.obj : trcapi.cpp _win32.cpp
+
+$(OBJD)\trcapi.res : trcapi.rc
+
+$(BIND)\trcapi$(DETOURS_BITS).dll: $(OBJD)\trcapi.obj $(OBJD)\trcapi.res $(DEPS)
+ cl /LD $(CFLAGS) /Fe$@ /Fd$(@R).pdb \
+ $(OBJD)\trcapi.obj $(OBJD)\trcapi.res \
+ /link $(LINKFLAGS) /release /subsystem:console \
+ /export:DetourFinishHelperProcess,@1,NONAME \
+ $(LIBS)
+
+$(OBJD)\trcapi$(DETOURS_BITS).bsc : $(OBJD)\trcapi.obj
+ bscmake /v /n /o $@ $(OBJD)\trcapi.sbr
+
+$(OBJD)\testapi.obj : testapi.cpp trcapi.cpp _win32.cpp
+
+$(BIND)\testapi.exe : $(OBJD)\testapi.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb $(OBJD)\testapi.obj \
+ /link $(LINKFLAGS) $(LIBS) \
+ /subsystem:console /fixed:no
+
+$(OBJD)\testapi.bsc : $(OBJD)\testapi.obj
+ bscmake /v /n /o $@ $(OBJD)\testapi.sbr
+
+############################################### Install non-bit-size binaries.
+
+!IF "$(DETOURS_OPTION_PROCESSOR)" != ""
+
+$(OPTD)\trcapi$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\trcapi$(DETOURS_OPTION_BITS).pdb:
+
+$(BIND)\trcapi$(DETOURS_OPTION_BITS).dll : $(OPTD)\trcapi$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\trcapi$(DETOURS_OPTION_BITS).pdb : $(OPTD)\trcapi$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+
+option: \
+ $(BIND)\trcapi$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\trcapi$(DETOURS_OPTION_BITS).pdb \
+
+!ELSE
+
+option:
+
+!ENDIF
+
+##############################################################################
+
+test: all
+ @echo -------- Logging output to test.txt ------------
+ start $(BIND)\syelogd.exe /o test.txt
+ $(BIND)\sleep5.exe 1
+ @echo -------- Should load trcapi$(DETOURS_BITS).dll dynamically using withdll.exe ------------
+ $(BIND)\withdll -d:$(BIND)\trcapi$(DETOURS_BITS).dll $(BIND)\sleepold.exe
+ @echo -------- Log from syelog -------------
+ type test.txt
+
+debug: all
+ @echo -------- Logging output to test.txt ------------
+ start $(BIND)\syelogd.exe /o test.txt
+ $(BIND)\sleep5.exe 1
+ @echo -------- Should load trcapi$(DETOURS_BITS).dll dynamically using withdll.exe ------------
+ windbg -o -g -G $(BIND)\withdll -d:$(BIND)\trcapi$(DETOURS_BITS).dll $(BIND)\sleepold.exe
+ @echo -------- Log from syelog -------------
+ type test.txt
+
+calc: all
+ @echo -------- Logging output to test.txt ------------
+ start $(BIND)\syelogd.exe /q /o test.txt
+ $(BIND)\sleep5.exe 1
+ @echo -------- Should load trcapi$(DETOURS_BITS).dll dynamically using withdll.exe ------------
+ $(BIND)\withdll -d:$(BIND)\trcapi$(DETOURS_BITS).dll $(SYSTEMROOT)\System32\calc.exe
+ @echo -------- Log from syelog -------------
+ wc test.txt
+
+explorer: all
+ @echo -------- Logging output to test.txt ------------
+ start $(BIND)\syelogd.exe /q /o test.txt
+ $(BIND)\sleep5.exe 1
+ @echo -------- Should load trcapi$(DETOURS_BITS).dll dynamically using withdll.exe ------------
+ $(BIND)\withdll -d:$(BIND)\trcapi$(DETOURS_BITS).dll $(SYSTEMROOT)\explorer.exe
+ @echo -------- Log from syelog -------------
+ wc test.txt
+
+wordpad: all
+ @echo -------- Logging output to test.txt ------------
+ start $(BIND)\syelogd.exe /q /o test.txt
+ $(BIND)\sleep5.exe 1
+ @echo -------- Should load trcapi$(DETOURS_BITS).dll dynamically using withdll.exe ------------
+ $(BIND)\withdll -d:$(BIND)\trcapi$(DETOURS_BITS).dll $(PROGRAMFILES)\Windows NT\Accessories\wordpad.exe
+ @echo -------- Log from syelog -------------
+ wc test.txt
+
+notepad: all
+ @echo -------- Logging output to test.txt ------------
+ start $(BIND)\syelogd.exe /q /o test.txt
+ $(BIND)\sleep5.exe 1
+ @echo -------- Should load trcapi$(DETOURS_BITS).dll dynamically using withdll.exe ------------
+ $(BIND)\withdll -d:$(BIND)\trcapi$(DETOURS_BITS).dll $(SYSTEMROOT)\notepad.exe
+ @echo -------- Log from syelog -------------
+ wc test.txt
+
+ie: all
+ @echo -------- Logging output to test.txt ------------
+ start $(BIND)\syelogd.exe /q /o test.txt
+ $(BIND)\sleep5.exe 1
+ @echo -------- Should load trcapi$(DETOURS_BITS).dll dynamically using withdll.exe ------------
+ windbg -g -G -o $(BIND)\withdll -d:$(BIND)\trcapi$(DETOURS_BITS).dll "$(PROGRAMFILES)\Internet Explorer\iexplore.exe"
+ @echo -------- Log from syelog -------------
+ wc test.txt
+
+ws: all
+ $(BIND)\withdll -d:$(BIND)\trcapi$(DETOURS_BITS).dll $(BIND)\WebServiceTester.exe
+
+################################################################# End of File.
diff --git a/ext/detours/samples/traceapi/_win32.cpp b/ext/detours/samples/traceapi/_win32.cpp
new file mode 100644
index 0000000..f28daf3
--- /dev/null
+++ b/ext/detours/samples/traceapi/_win32.cpp
@@ -0,0 +1,37069 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (_win32.cpp of traceapi.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+///////////////////////////////////////////////////////////////// Trampolines.
+//
+int (__stdcall * Real_AbortDoc)(HDC a0)
+ = AbortDoc;
+
+BOOL (__stdcall * Real_AbortPath)(HDC a0)
+ = AbortPath;
+
+HKL (__stdcall * Real_ActivateKeyboardLayout)(HKL a0,
+ UINT a1)
+ = ActivateKeyboardLayout;
+
+ATOM (__stdcall * Real_AddAtomA)(LPCSTR a0)
+ = AddAtomA;
+
+ATOM (__stdcall * Real_AddAtomW)(LPCWSTR a0)
+ = AddAtomW;
+
+int (__stdcall * Real_AddFontResourceA)(LPCSTR a0)
+ = AddFontResourceA;
+
+int (__stdcall * Real_AddFontResourceW)(LPCWSTR a0)
+ = AddFontResourceW;
+
+BOOL (__stdcall * Real_AdjustWindowRect)(LPRECT a0,
+ DWORD a1,
+ BOOL a2)
+ = AdjustWindowRect;
+
+BOOL (__stdcall * Real_AdjustWindowRectEx)(LPRECT a0,
+ DWORD a1,
+ BOOL a2,
+ DWORD a3)
+ = AdjustWindowRectEx;
+
+BOOL (__stdcall * Real_AllocConsole)(void)
+ = AllocConsole;
+
+BOOL (__stdcall * Real_AngleArc)(HDC a0,
+ int a1,
+ int a2,
+ DWORD a3,
+ FLOAT a4,
+ FLOAT a5)
+ = AngleArc;
+
+BOOL (__stdcall * Real_AnimatePalette)(HPALETTE a0,
+ UINT a1,
+ UINT a2,
+ CONST PALETTEENTRY* a3)
+ = AnimatePalette;
+
+BOOL (__stdcall * Real_AnyPopup)(void)
+ = AnyPopup;
+
+BOOL (__stdcall * Real_AppendMenuA)(HMENU a0,
+ UINT a1,
+ UINT_PTR a2,
+ LPCSTR a3)
+ = AppendMenuA;
+
+BOOL (__stdcall * Real_AppendMenuW)(HMENU a0,
+ UINT a1,
+ UINT_PTR a2,
+ LPCWSTR a3)
+ = AppendMenuW;
+
+BOOL (__stdcall * Real_Arc)(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ int a5,
+ int a6,
+ int a7,
+ int a8)
+ = Arc;
+
+BOOL (__stdcall * Real_ArcTo)(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ int a5,
+ int a6,
+ int a7,
+ int a8)
+ = ArcTo;
+
+BOOL (__stdcall * Real_AreFileApisANSI)(void)
+ = AreFileApisANSI;
+
+UINT (__stdcall * Real_ArrangeIconicWindows)(HWND a0)
+ = ArrangeIconicWindows;
+
+BOOL (__stdcall * Real_AttachThreadInput)(DWORD a0,
+ DWORD a1,
+ BOOL a2)
+ = AttachThreadInput;
+
+BOOL (__stdcall * Real_BackupRead)(HANDLE a0,
+ LPBYTE a1,
+ DWORD a2,
+ LPDWORD a3,
+ BOOL a4,
+ BOOL a5,
+ LPVOID* a6)
+ = BackupRead;
+
+BOOL (__stdcall * Real_BackupSeek)(HANDLE a0,
+ DWORD a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPVOID* a5)
+ = BackupSeek;
+
+BOOL (__stdcall * Real_BackupWrite)(HANDLE a0,
+ LPBYTE a1,
+ DWORD a2,
+ LPDWORD a3,
+ BOOL a4,
+ BOOL a5,
+ LPVOID* a6)
+ = BackupWrite;
+
+BOOL (__stdcall * Real_Beep)(DWORD a0,
+ DWORD a1)
+ = Beep;
+
+HDWP (__stdcall * Real_BeginDeferWindowPos)(int a0)
+ = BeginDeferWindowPos;
+
+HDC (__stdcall * Real_BeginPaint)(HWND a0,
+ LPPAINTSTRUCT a1)
+ = BeginPaint;
+
+BOOL (__stdcall * Real_BeginPath)(HDC a0)
+ = BeginPath;
+
+HANDLE (__stdcall * Real_BeginUpdateResourceA)(LPCSTR a0,
+ BOOL a1)
+ = BeginUpdateResourceA;
+
+HANDLE (__stdcall * Real_BeginUpdateResourceW)(LPCWSTR a0,
+ BOOL a1)
+ = BeginUpdateResourceW;
+
+HRESULT (__stdcall * Real_BindMoniker)(IMoniker* a0,
+ DWORD a1,
+ CONST IID& a2,
+ LPVOID* a3)
+ = BindMoniker;
+
+BOOL (__stdcall * Real_BitBlt)(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ HDC a5,
+ int a6,
+ int a7,
+ DWORD a8)
+ = BitBlt;
+
+BOOL (__stdcall * Real_BringWindowToTop)(HWND a0)
+ = BringWindowToTop;
+
+long (__stdcall * Real_BroadcastSystemMessageA)(DWORD a0,
+ LPDWORD a1,
+ UINT a2,
+ WPARAM a3,
+ LPARAM a4)
+ = BroadcastSystemMessageA;
+
+long (__stdcall * Real_BroadcastSystemMessageW)(DWORD a0,
+ LPDWORD a1,
+ UINT a2,
+ WPARAM a3,
+ LPARAM a4)
+ = BroadcastSystemMessageW;
+
+BOOL (__stdcall * Real_BuildCommDCBA)(LPCSTR a0,
+ LPDCB a1)
+ = BuildCommDCBA;
+
+BOOL (__stdcall * Real_BuildCommDCBAndTimeoutsA)(LPCSTR a0,
+ LPDCB a1,
+ LPCOMMTIMEOUTS a2)
+ = BuildCommDCBAndTimeoutsA;
+
+BOOL (__stdcall * Real_BuildCommDCBAndTimeoutsW)(LPCWSTR a0,
+ LPDCB a1,
+ LPCOMMTIMEOUTS a2)
+ = BuildCommDCBAndTimeoutsW;
+
+BOOL (__stdcall * Real_BuildCommDCBW)(LPCWSTR a0,
+ LPDCB a1)
+ = BuildCommDCBW;
+
+HRESULT (__stdcall * Real_CLSIDFromProgID)(LPCOLESTR a0,
+ LPGUID a1)
+ = CLSIDFromProgID;
+
+#ifdef _WIN32_WINNT_WIN7
+HRESULT (__stdcall * Real_CLSIDFromString)(LPCOLESTR a0,
+ LPGUID a1)
+ = CLSIDFromString;
+#else
+HRESULT (__stdcall * Real_CLSIDFromString)(LPOLESTR a0,
+ LPGUID a1)
+ = CLSIDFromString;
+#endif
+
+BOOL (__stdcall * Real_CallMsgFilterA)(LPMSG a0,
+ int a1)
+ = CallMsgFilterA;
+
+BOOL (__stdcall * Real_CallMsgFilterW)(LPMSG a0,
+ int a1)
+ = CallMsgFilterW;
+
+BOOL (__stdcall * Real_CallNamedPipeA)(LPCSTR a0,
+ LPVOID a1,
+ DWORD a2,
+ LPVOID a3,
+ DWORD a4,
+ LPDWORD a5,
+ DWORD a6)
+ = CallNamedPipeA;
+
+BOOL (__stdcall * Real_CallNamedPipeW)(LPCWSTR a0,
+ LPVOID a1,
+ DWORD a2,
+ LPVOID a3,
+ DWORD a4,
+ LPDWORD a5,
+ DWORD a6)
+ = CallNamedPipeW;
+
+LRESULT (__stdcall * Real_CallNextHookEx)(HHOOK a0,
+ int a1,
+ WPARAM a2,
+ LPARAM a3)
+ = CallNextHookEx;
+
+LRESULT (__stdcall * Real_CallWindowProcA)(WNDPROC a0,
+ HWND a1,
+ UINT a2,
+ WPARAM a3,
+ LPARAM a4)
+ = CallWindowProcA;
+
+LRESULT (__stdcall * Real_CallWindowProcW)(WNDPROC a0,
+ HWND a1,
+ UINT a2,
+ WPARAM a3,
+ LPARAM a4)
+ = CallWindowProcW;
+
+BOOL (__stdcall * Real_CancelDC)(HDC a0)
+ = CancelDC;
+
+BOOL (__stdcall * Real_CancelIo)(HANDLE a0)
+ = CancelIo;
+
+BOOL (__stdcall * Real_CancelWaitableTimer)(HANDLE a0)
+ = CancelWaitableTimer;
+
+WORD (__stdcall * Real_CascadeWindows)(HWND a0,
+ UINT a1,
+ CONST RECT* a2,
+ UINT a3,
+ CONST HWND * a4)
+ = CascadeWindows;
+
+BOOL (__stdcall * Real_ChangeClipboardChain)(HWND a0,
+ HWND a1)
+ = ChangeClipboardChain;
+
+LONG (__stdcall * Real_ChangeDisplaySettingsA)(LPDEVMODEA a0,
+ DWORD a1)
+ = ChangeDisplaySettingsA;
+
+LONG (__stdcall * Real_ChangeDisplaySettingsExA)(LPCSTR a0,
+ LPDEVMODEA a1,
+ HWND a2,
+ DWORD a3,
+ LPVOID a4)
+ = ChangeDisplaySettingsExA;
+
+LONG (__stdcall * Real_ChangeDisplaySettingsExW)(LPCWSTR a0,
+ LPDEVMODEW a1,
+ HWND a2,
+ DWORD a3,
+ LPVOID a4)
+ = ChangeDisplaySettingsExW;
+
+LONG (__stdcall * Real_ChangeDisplaySettingsW)(LPDEVMODEW a0,
+ DWORD a1)
+ = ChangeDisplaySettingsW;
+
+BOOL (__stdcall * Real_ChangeMenuA)(HMENU a0,
+ UINT a1,
+ LPCSTR a2,
+ UINT a3,
+ UINT a4)
+ = ChangeMenuA;
+
+BOOL (__stdcall * Real_ChangeMenuW)(HMENU a0,
+ UINT a1,
+ LPCWSTR a2,
+ UINT a3,
+ UINT a4)
+ = ChangeMenuW;
+
+LPSTR (__stdcall * Real_CharLowerA)(LPSTR a0)
+ = CharLowerA;
+
+DWORD (__stdcall * Real_CharLowerBuffA)(LPSTR a0,
+ DWORD a1)
+ = CharLowerBuffA;
+
+DWORD (__stdcall * Real_CharLowerBuffW)(LPWSTR a0,
+ DWORD a1)
+ = CharLowerBuffW;
+
+LPWSTR (__stdcall * Real_CharLowerW)(LPWSTR a0)
+ = CharLowerW;
+
+LPSTR (__stdcall * Real_CharNextA)(LPCSTR a0)
+ = CharNextA;
+
+LPSTR (__stdcall * Real_CharNextExA)(WORD a0,
+ LPCSTR a1,
+ DWORD a2)
+ = CharNextExA;
+
+LPWSTR (__stdcall * Real_CharNextW)(LPCWSTR a0)
+ = CharNextW;
+
+LPSTR (__stdcall * Real_CharPrevA)(LPCSTR a0,
+ LPCSTR a1)
+ = CharPrevA;
+
+LPSTR (__stdcall * Real_CharPrevExA)(WORD a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ DWORD a3)
+ = CharPrevExA;
+
+LPWSTR (__stdcall * Real_CharPrevW)(LPCWSTR a0,
+ LPCWSTR a1)
+ = CharPrevW;
+
+BOOL (__stdcall * Real_CharToOemA)(LPCSTR a0,
+ LPSTR a1)
+ = CharToOemA;
+
+BOOL (__stdcall * Real_CharToOemBuffA)(LPCSTR a0,
+ LPSTR a1,
+ DWORD a2)
+ = CharToOemBuffA;
+
+BOOL (__stdcall * Real_CharToOemBuffW)(LPCWSTR a0,
+ LPSTR a1,
+ DWORD a2)
+ = CharToOemBuffW;
+
+BOOL (__stdcall * Real_CharToOemW)(LPCWSTR a0,
+ LPSTR a1)
+ = CharToOemW;
+
+LPSTR (__stdcall * Real_CharUpperA)(LPSTR a0)
+ = CharUpperA;
+
+DWORD (__stdcall * Real_CharUpperBuffA)(LPSTR a0,
+ DWORD a1)
+ = CharUpperBuffA;
+
+DWORD (__stdcall * Real_CharUpperBuffW)(LPWSTR a0,
+ DWORD a1)
+ = CharUpperBuffW;
+
+LPWSTR (__stdcall * Real_CharUpperW)(LPWSTR a0)
+ = CharUpperW;
+
+BOOL (__stdcall * Real_CheckColorsInGamut)(
+ HDC a0,
+#ifdef GDIPLUS_TS_QUERYVER
+ LPRGBTRIPLE a1,
+#else
+ LPVOID a1,
+#endif
+ LPVOID a2,
+ DWORD a3
+ )
+ = CheckColorsInGamut;
+
+BOOL (__stdcall * Real_CheckDlgButton)(HWND a0,
+ int a1,
+ UINT a2)
+ = CheckDlgButton;
+
+DWORD (__stdcall * Real_CheckMenuItem)(HMENU a0,
+ UINT a1,
+ UINT a2)
+ = CheckMenuItem;
+
+BOOL (__stdcall * Real_CheckMenuRadioItem)(HMENU a0,
+ UINT a1,
+ UINT a2,
+ UINT a3,
+ UINT a4)
+ = CheckMenuRadioItem;
+
+BOOL (__stdcall * Real_CheckRadioButton)(HWND a0,
+ int a1,
+ int a2,
+ int a3)
+ = CheckRadioButton;
+
+HWND (__stdcall * Real_ChildWindowFromPoint)(HWND a0,
+ POINT a1)
+ = ChildWindowFromPoint;
+
+HWND (__stdcall * Real_ChildWindowFromPointEx)(HWND a0,
+ POINT a1,
+ UINT a2)
+ = ChildWindowFromPointEx;
+
+int (__stdcall * Real_ChoosePixelFormat)(HDC a0,
+ CONST PIXELFORMATDESCRIPTOR* a1)
+ = ChoosePixelFormat;
+
+BOOL (__stdcall * Real_Chord)(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ int a5,
+ int a6,
+ int a7,
+ int a8)
+ = Chord;
+
+BOOL (__stdcall * Real_ClearCommBreak)(HANDLE a0)
+ = ClearCommBreak;
+
+BOOL (__stdcall * Real_ClearCommError)(HANDLE a0,
+ LPDWORD a1,
+ LPCOMSTAT a2)
+ = ClearCommError;
+
+BOOL (__stdcall * Real_ClientToScreen)(HWND a0,
+ LPPOINT a1)
+ = ClientToScreen;
+
+BOOL (__stdcall * Real_ClipCursor)(CONST RECT* a0)
+ = ClipCursor;
+
+BOOL (__stdcall * Real_CloseClipboard)(void)
+ = CloseClipboard;
+
+BOOL (__stdcall * Real_CloseDesktop)(HDESK a0)
+ = CloseDesktop;
+
+HENHMETAFILE (__stdcall * Real_CloseEnhMetaFile)(HDC a0)
+ = CloseEnhMetaFile;
+
+BOOL (__stdcall * Real_CloseFigure)(HDC a0)
+ = CloseFigure;
+
+BOOL (__stdcall * Real_CloseHandle)(HANDLE a0)
+ = CloseHandle;
+
+HMETAFILE (__stdcall * Real_CloseMetaFile)(HDC a0)
+ = CloseMetaFile;
+
+BOOL (__stdcall * Real_CloseWindow)(HWND a0)
+ = CloseWindow;
+
+BOOL (__stdcall * Real_CloseWindowStation)(HWINSTA a0)
+ = CloseWindowStation;
+
+ULONG (__stdcall * Real_CoAddRefServerProcess)(void)
+ = CoAddRefServerProcess;
+
+DWORD (__stdcall * Real_CoBuildVersion)(void)
+ = CoBuildVersion;
+
+HRESULT (__stdcall * Real_CoCopyProxy)(IUnknown* a0,
+ IUnknown** a1)
+ = CoCopyProxy;
+
+HRESULT (__stdcall * Real_CoCreateFreeThreadedMarshaler)(LPUNKNOWN a0,
+ LPUNKNOWN* a1)
+ = CoCreateFreeThreadedMarshaler;
+
+HRESULT (__stdcall * Real_CoCreateGuid)(GUID* a0)
+ = CoCreateGuid;
+
+HRESULT (__stdcall * Real_CoCreateInstance)(CONST IID& a0,
+ LPUNKNOWN a1,
+ DWORD a2,
+ CONST IID& a3,
+ LPVOID* a4)
+ = CoCreateInstance;
+
+HRESULT (__stdcall * Real_CoCreateInstanceEx)(CONST IID& a0,
+ IUnknown* a1,
+ DWORD a2,
+ COSERVERINFO* a3,
+ DWORD a4,
+ MULTI_QI* a5)
+ = CoCreateInstanceEx;
+
+HRESULT (__stdcall * Real_CoDisconnectObject)(LPUNKNOWN a0,
+ DWORD a1)
+ = CoDisconnectObject;
+
+BOOL (__stdcall * Real_CoDosDateTimeToFileTime)(WORD a0,
+ WORD a1,
+ FILETIME* a2)
+ = CoDosDateTimeToFileTime;
+
+HRESULT (__stdcall * Real_CoFileTimeNow)(FILETIME* a0)
+ = CoFileTimeNow;
+
+BOOL (__stdcall * Real_CoFileTimeToDosDateTime)(FILETIME* a0,
+ LPWORD a1,
+ LPWORD a2)
+ = CoFileTimeToDosDateTime;
+
+void (__stdcall * Real_CoFreeAllLibraries)(void)
+ = CoFreeAllLibraries;
+
+void (__stdcall * Real_CoFreeLibrary)(HINSTANCE a0)
+ = CoFreeLibrary;
+
+void (__stdcall * Real_CoFreeUnusedLibraries)(void)
+ = CoFreeUnusedLibraries;
+
+HRESULT (__stdcall * Real_CoGetCallContext)(CONST IID& a0,
+ void** a1)
+ = CoGetCallContext;
+
+HRESULT (__stdcall * Real_CoGetClassObject)(CONST IID& a0,
+ DWORD a1,
+ LPVOID a2,
+ CONST IID& a3,
+ LPVOID* a4)
+ = CoGetClassObject;
+
+DWORD (__stdcall * Real_CoGetCurrentProcess)(void)
+ = CoGetCurrentProcess;
+
+HRESULT (__stdcall * Real_CoGetInstanceFromFile)(COSERVERINFO* a0,
+ CLSID* a1,
+ IUnknown* a2,
+ DWORD a3,
+ DWORD a4,
+ OLECHAR* a5,
+ DWORD a6,
+ MULTI_QI* a7)
+ = CoGetInstanceFromFile;
+
+HRESULT (__stdcall * Real_CoGetInstanceFromIStorage)(COSERVERINFO* a0,
+ CLSID* a1,
+ IUnknown* a2,
+ DWORD a3,
+ IStorage* a4,
+ DWORD a5,
+ MULTI_QI* a6)
+ = CoGetInstanceFromIStorage;
+
+HRESULT (__stdcall * Real_CoGetInterfaceAndReleaseStream)(LPSTREAM a0,
+ CONST IID& a1,
+ LPVOID* a2)
+ = CoGetInterfaceAndReleaseStream;
+
+HRESULT (__stdcall * Real_CoGetMalloc)(DWORD a0,
+ IMalloc** a1)
+ = CoGetMalloc;
+
+HRESULT (__stdcall * Real_CoGetMarshalSizeMax)(ULONG* a0,
+ CONST IID& a1,
+ LPUNKNOWN a2,
+ DWORD a3,
+ LPVOID a4,
+ DWORD a5)
+ = CoGetMarshalSizeMax;
+
+HRESULT (__stdcall * Real_CoGetObject)(LPCWSTR a0,
+ BIND_OPTS* a1,
+ CONST IID& a2,
+ void** a3)
+ = CoGetObject;
+
+HRESULT (__stdcall * Real_CoGetPSClsid)(CONST IID& a0,
+ CLSID* a1)
+ = CoGetPSClsid;
+
+HRESULT (__stdcall * Real_CoGetStandardMarshal)(CONST IID& a0,
+ LPUNKNOWN a1,
+ DWORD a2,
+ LPVOID a3,
+ DWORD a4,
+ IMarshal** a5)
+ = CoGetStandardMarshal;
+
+HRESULT (__stdcall * Real_CoGetStdMarshalEx)(LPUNKNOWN a0,
+ DWORD a1,
+ LPUNKNOWN* a2)
+ = CoGetStdMarshalEx;
+
+HRESULT (__stdcall * Real_CoGetTreatAsClass)(CONST IID& a0,
+ LPGUID a1)
+ = CoGetTreatAsClass;
+
+HRESULT (__stdcall * Real_CoImpersonateClient)(void)
+ = CoImpersonateClient;
+
+HRESULT (__stdcall * Real_CoInitialize)(LPVOID a0)
+ = CoInitialize;
+
+HRESULT (__stdcall * Real_CoInitializeEx)(LPVOID a0,
+ DWORD a1)
+ = CoInitializeEx;
+
+HRESULT (__stdcall * Real_CoInitializeSecurity)(PSECURITY_DESCRIPTOR a0,
+ LONG a1,
+ SOLE_AUTHENTICATION_SERVICE* a2,
+ void* a3,
+ DWORD a4,
+ DWORD a5,
+ void* a6,
+ DWORD a7,
+ void* a8)
+ = CoInitializeSecurity;
+
+BOOL (__stdcall * Real_CoIsHandlerConnected)(LPUNKNOWN a0)
+ = CoIsHandlerConnected;
+
+BOOL (__stdcall * Real_CoIsOle1Class)(CONST IID& a0)
+ = CoIsOle1Class;
+
+HINSTANCE (__stdcall * Real_CoLoadLibrary)(LPOLESTR a0,
+ BOOL a1)
+ = CoLoadLibrary;
+
+HRESULT (__stdcall * Real_CoLockObjectExternal)(LPUNKNOWN a0,
+ BOOL a1,
+ BOOL a2)
+ = CoLockObjectExternal;
+
+HRESULT (__stdcall * Real_CoMarshalHresult)(LPSTREAM a0,
+ HRESULT a1)
+ = CoMarshalHresult;
+
+HRESULT (__stdcall * Real_CoMarshalInterThreadInterfaceInStream)(CONST IID& a0,
+ LPUNKNOWN a1,
+ LPSTREAM* a2)
+ = CoMarshalInterThreadInterfaceInStream;
+
+HRESULT (__stdcall * Real_CoMarshalInterface)(LPSTREAM a0,
+ CONST IID& a1,
+ LPUNKNOWN a2,
+ DWORD a3,
+ LPVOID a4,
+ DWORD a5)
+ = CoMarshalInterface;
+
+HRESULT (__stdcall * Real_CoQueryAuthenticationServices)(DWORD* a0,
+ SOLE_AUTHENTICATION_SERVICE** a1)
+ = CoQueryAuthenticationServices;
+
+HRESULT (__stdcall * Real_CoQueryClientBlanket)(DWORD* a0,
+ DWORD* a1,
+ OLECHAR** a2,
+ DWORD* a3,
+ DWORD* a4,
+ RPC_AUTHZ_HANDLE* a5,
+ DWORD* a6)
+ = CoQueryClientBlanket;
+
+HRESULT (__stdcall * Real_CoQueryProxyBlanket)(IUnknown* a0,
+ DWORD* a1,
+ DWORD* a2,
+ OLECHAR** a3,
+ DWORD* a4,
+ DWORD* a5,
+ RPC_AUTH_IDENTITY_HANDLE* a6,
+ DWORD* a7)
+ = CoQueryProxyBlanket;
+
+HRESULT (__stdcall * Real_CoRegisterChannelHook)(CONST GUID& a0,
+ IChannelHook* a1)
+ = CoRegisterChannelHook;
+
+HRESULT (__stdcall * Real_CoRegisterClassObject)(CONST IID& a0,
+ LPUNKNOWN a1,
+ DWORD a2,
+ DWORD a3,
+ LPDWORD a4)
+ = CoRegisterClassObject;
+
+HRESULT (__stdcall * Real_CoRegisterMallocSpy)(IMallocSpy* a0)
+ = CoRegisterMallocSpy;
+
+HRESULT (__stdcall * Real_CoRegisterMessageFilter)(LPMESSAGEFILTER a0,
+ LPMESSAGEFILTER* a1)
+ = CoRegisterMessageFilter;
+
+HRESULT (__stdcall * Real_CoRegisterPSClsid)(CONST IID& a0,
+ CONST IID& a1)
+ = CoRegisterPSClsid;
+
+HRESULT (__stdcall * Real_CoRegisterSurrogate)(LPSURROGATE a0)
+ = CoRegisterSurrogate;
+
+HRESULT (__stdcall * Real_CoReleaseMarshalData)(LPSTREAM a0)
+ = CoReleaseMarshalData;
+
+ULONG (__stdcall * Real_CoReleaseServerProcess)(void)
+ = CoReleaseServerProcess;
+
+HRESULT (__stdcall * Real_CoResumeClassObjects)(void)
+ = CoResumeClassObjects;
+
+HRESULT (__stdcall * Real_CoRevertToSelf)(void)
+ = CoRevertToSelf;
+
+HRESULT (__stdcall * Real_CoRevokeClassObject)(DWORD a0)
+ = CoRevokeClassObject;
+
+HRESULT (__stdcall * Real_CoRevokeMallocSpy)(void)
+ = CoRevokeMallocSpy;
+
+HRESULT (__stdcall * Real_CoSetProxyBlanket)(IUnknown* a0,
+ DWORD a1,
+ DWORD a2,
+ OLECHAR* a3,
+ DWORD a4,
+ DWORD a5,
+ RPC_AUTH_IDENTITY_HANDLE a6,
+ DWORD a7)
+ = CoSetProxyBlanket;
+
+HRESULT (__stdcall * Real_CoSuspendClassObjects)(void)
+ = CoSuspendClassObjects;
+
+HRESULT (__stdcall * Real_CoSwitchCallContext)(IUnknown* a0,
+ IUnknown** a1)
+ = CoSwitchCallContext;
+
+LPVOID (__stdcall * Real_CoTaskMemAlloc)(SIZE_T a0)
+ = CoTaskMemAlloc;
+
+void (__stdcall * Real_CoTaskMemFree)(LPVOID a0)
+ = CoTaskMemFree;
+
+LPVOID (__stdcall * Real_CoTaskMemRealloc)(LPVOID a0,
+ SIZE_T a1)
+ = CoTaskMemRealloc;
+
+HRESULT (__stdcall * Real_CoTreatAsClass)(CONST IID& a0,
+ CONST IID& a1)
+ = CoTreatAsClass;
+
+void (__stdcall * Real_CoUninitialize)(void)
+ = CoUninitialize;
+
+HRESULT (__stdcall * Real_CoUnmarshalHresult)(LPSTREAM a0,
+ HRESULT* a1)
+ = CoUnmarshalHresult;
+
+HRESULT (__stdcall * Real_CoUnmarshalInterface)(LPSTREAM a0,
+ CONST IID& a1,
+ LPVOID* a2)
+ = CoUnmarshalInterface;
+
+BOOL (__stdcall * Real_ColorMatchToTarget)(HDC a0,
+ HDC a1,
+ DWORD a2)
+ = ColorMatchToTarget;
+
+int (__stdcall * Real_CombineRgn)(HRGN a0,
+ HRGN a1,
+ HRGN a2,
+ int a3)
+ = CombineRgn;
+
+BOOL (__stdcall * Real_CombineTransform)(LPXFORM a0,
+ CONST XFORM* a1,
+ CONST XFORM* a2)
+ = CombineTransform;
+
+BOOL (__stdcall * Real_CommConfigDialogA)(LPCSTR a0,
+ HWND a1,
+ LPCOMMCONFIG a2)
+ = CommConfigDialogA;
+
+BOOL (__stdcall * Real_CommConfigDialogW)(LPCWSTR a0,
+ HWND a1,
+ LPCOMMCONFIG a2)
+ = CommConfigDialogW;
+
+LONG (__stdcall * Real_CompareFileTime)(CONST FILETIME* a0,
+ CONST FILETIME* a1)
+ = CompareFileTime;
+
+int (__stdcall * Real_CompareStringA)(LCID a0,
+ DWORD a1,
+ LPCSTR a2,
+ int a3,
+ LPCSTR a4,
+ int a5)
+ = CompareStringA;
+
+int (__stdcall * Real_CompareStringW)(LCID a0,
+ DWORD a1,
+ LPCWSTR a2,
+ int a3,
+ LPCWSTR a4,
+ int a5)
+ = CompareStringW;
+
+BOOL (__stdcall * Real_ConnectNamedPipe)(HANDLE a0,
+ LPOVERLAPPED a1)
+ = ConnectNamedPipe;
+
+#if !defined(DETOURS_ARM)
+BOOL (__stdcall * Real_ContinueDebugEvent)(DWORD a0,
+ DWORD a1,
+ DWORD a2)
+ = ContinueDebugEvent;
+#endif // !DETOURS_ARM
+
+LCID (__stdcall * Real_ConvertDefaultLocale)(LCID a0)
+ = ConvertDefaultLocale;
+
+LPVOID (__stdcall * Real_ConvertThreadToFiber)(LPVOID a0)
+ = ConvertThreadToFiber;
+
+int (__stdcall * Real_CopyAcceleratorTableA)(HACCEL a0,
+ LPACCEL a1,
+ int a2)
+ = CopyAcceleratorTableA;
+
+int (__stdcall * Real_CopyAcceleratorTableW)(HACCEL a0,
+ LPACCEL a1,
+ int a2)
+ = CopyAcceleratorTableW;
+
+HENHMETAFILE (__stdcall * Real_CopyEnhMetaFileA)(HENHMETAFILE a0,
+ LPCSTR a1)
+ = CopyEnhMetaFileA;
+
+HENHMETAFILE (__stdcall * Real_CopyEnhMetaFileW)(HENHMETAFILE a0,
+ LPCWSTR a1)
+ = CopyEnhMetaFileW;
+
+BOOL (__stdcall * Real_CopyFileA)(LPCSTR a0,
+ LPCSTR a1,
+ BOOL a2)
+ = CopyFileA;
+
+BOOL (__stdcall * Real_CopyFileExA)(LPCSTR a0,
+ LPCSTR a1,
+ LPPROGRESS_ROUTINE a2,
+ LPVOID a3,
+ LPBOOL a4,
+ DWORD a5)
+ = CopyFileExA;
+
+BOOL (__stdcall * Real_CopyFileExW)(LPCWSTR a0,
+ LPCWSTR a1,
+ LPPROGRESS_ROUTINE a2,
+ LPVOID a3,
+ LPBOOL a4,
+ DWORD a5)
+ = CopyFileExW;
+
+BOOL (__stdcall * Real_CopyFileW)(LPCWSTR a0,
+ LPCWSTR a1,
+ BOOL a2)
+ = CopyFileW;
+
+HICON (__stdcall * Real_CopyIcon)(HICON a0)
+ = CopyIcon;
+
+HANDLE (__stdcall * Real_CopyImage)(HANDLE a0,
+ UINT a1,
+ int a2,
+ int a3,
+ UINT a4)
+ = CopyImage;
+
+HMETAFILE (__stdcall * Real_CopyMetaFileA)(HMETAFILE a0,
+ LPCSTR a1)
+ = CopyMetaFileA;
+
+HMETAFILE (__stdcall * Real_CopyMetaFileW)(HMETAFILE a0,
+ LPCWSTR a1)
+ = CopyMetaFileW;
+
+BOOL (__stdcall * Real_CopyRect)(LPRECT a0,
+ CONST RECT* a1)
+ = CopyRect;
+
+int (__stdcall * Real_CountClipboardFormats)(void)
+ = CountClipboardFormats;
+
+HACCEL (__stdcall * Real_CreateAcceleratorTableA)(LPACCEL a0,
+ int a1)
+ = CreateAcceleratorTableA;
+
+HACCEL (__stdcall * Real_CreateAcceleratorTableW)(LPACCEL a0,
+ int a1)
+ = CreateAcceleratorTableW;
+
+HRESULT (__stdcall * Real_CreateAntiMoniker)(IMoniker** a0)
+ = CreateAntiMoniker;
+
+HRESULT (__stdcall * Real_CreateBindCtx)(DWORD a0,
+ IBindCtx** a1)
+ = CreateBindCtx;
+
+HBITMAP (__stdcall * Real_CreateBitmap)(int a0,
+ int a1,
+ UINT a2,
+ UINT a3,
+ CONST void* a4)
+ = CreateBitmap;
+
+HBITMAP (__stdcall * Real_CreateBitmapIndirect)(CONST BITMAP* a0)
+ = CreateBitmapIndirect;
+
+HBRUSH (__stdcall * Real_CreateBrushIndirect)(CONST LOGBRUSH* a0)
+ = CreateBrushIndirect;
+
+BOOL (__stdcall * Real_CreateCaret)(HWND a0,
+ HBITMAP a1,
+ int a2,
+ int a3)
+ = CreateCaret;
+
+HRESULT (__stdcall * Real_CreateClassMoniker)(CONST IID& a0,
+ IMoniker** a1)
+ = CreateClassMoniker;
+
+HCOLORSPACE (__stdcall * Real_CreateColorSpaceA)(LPLOGCOLORSPACEA a0)
+ = CreateColorSpaceA;
+
+HCOLORSPACE (__stdcall * Real_CreateColorSpaceW)(LPLOGCOLORSPACEW a0)
+ = CreateColorSpaceW;
+
+HBITMAP (__stdcall * Real_CreateCompatibleBitmap)(HDC a0,
+ int a1,
+ int a2)
+ = CreateCompatibleBitmap;
+
+HDC (__stdcall * Real_CreateCompatibleDC)(HDC a0)
+ = CreateCompatibleDC;
+
+HANDLE (__stdcall * Real_CreateConsoleScreenBuffer)(DWORD a0,
+ DWORD a1,
+ CONST SECURITY_ATTRIBUTES* a2,
+ DWORD a3,
+ LPVOID a4)
+ = CreateConsoleScreenBuffer;
+
+HCURSOR (__stdcall * Real_CreateCursor)(HINSTANCE a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ CONST void* a5,
+ CONST void* a6)
+ = CreateCursor;
+
+HDC (__stdcall * Real_CreateDCA)(LPCSTR a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ CONST DEVMODEA * a3)
+ = CreateDCA;
+
+HDC (__stdcall * Real_CreateDCW)(LPCWSTR a0,
+ LPCWSTR a1,
+ LPCWSTR a2,
+ CONST DEVMODEW * a3)
+ = CreateDCW;
+
+HBRUSH (__stdcall * Real_CreateDIBPatternBrush)(HGLOBAL a0,
+ UINT a1)
+ = CreateDIBPatternBrush;
+
+HBRUSH (__stdcall * Real_CreateDIBPatternBrushPt)(CONST void* a0,
+ UINT a1)
+ = CreateDIBPatternBrushPt;
+
+HBITMAP (__stdcall * Real_CreateDIBSection)(HDC a0,
+ CONST BITMAPINFO* a1,
+ UINT a2,
+ void** a3,
+ HANDLE a4,
+ DWORD a5)
+ = CreateDIBSection;
+
+HBITMAP (__stdcall * Real_CreateDIBitmap)(HDC a0,
+ CONST BITMAPINFOHEADER* a1,
+ DWORD a2,
+ CONST void* a3,
+ CONST BITMAPINFO* a4,
+ UINT a5)
+ = CreateDIBitmap;
+
+HRESULT (__stdcall * Real_CreateDataAdviseHolder)(LPDATAADVISEHOLDER* a0)
+ = CreateDataAdviseHolder;
+
+HRESULT (__stdcall * Real_CreateDataCache)(LPUNKNOWN a0,
+ CONST IID& a1,
+ CONST IID& a2,
+ LPVOID* a3)
+ = CreateDataCache;
+
+#if _MSC_VER < 1300
+HDESK (__stdcall * Real_CreateDesktopA)(LPSTR a0,
+ LPSTR a1,
+ LPDEVMODEA a2,
+ DWORD a3,
+ ACCESS_MASK a4,
+ LPSECURITY_ATTRIBUTES a5)
+ = CreateDesktopA;
+#else
+HDESK (__stdcall * Real_CreateDesktopA)(LPCSTR a0,
+ LPCSTR a1,
+ LPDEVMODEA a2,
+ DWORD a3,
+ ACCESS_MASK a4,
+ LPSECURITY_ATTRIBUTES a5)
+ = CreateDesktopA;
+
+#endif
+
+#if _MSC_VER < 1300
+HDESK (__stdcall * Real_CreateDesktopW)(LPWSTR a0,
+ LPWSTR a1,
+ LPDEVMODEW a2,
+ DWORD a3,
+ ACCESS_MASK a4,
+ LPSECURITY_ATTRIBUTES a5)
+ = CreateDesktopW;
+#else
+HDESK (__stdcall * Real_CreateDesktopW)(LPCWSTR a0,
+ LPCWSTR a1,
+ LPDEVMODEW a2,
+ DWORD a3,
+ ACCESS_MASK a4,
+ LPSECURITY_ATTRIBUTES a5)
+ = CreateDesktopW;
+#endif
+
+HWND (__stdcall * Real_CreateDialogIndirectParamA)(HINSTANCE a0,
+ LPCDLGTEMPLATEA a1,
+ HWND a2,
+ DLGPROC a3,
+ LPARAM a4)
+ = CreateDialogIndirectParamA;
+
+HWND (__stdcall * Real_CreateDialogIndirectParamW)(HINSTANCE a0,
+ LPCDLGTEMPLATEW a1,
+ HWND a2,
+ DLGPROC a3,
+ LPARAM a4)
+ = CreateDialogIndirectParamW;
+
+HWND (__stdcall * Real_CreateDialogParamA)(HINSTANCE a0,
+ LPCSTR a1,
+ HWND a2,
+ DLGPROC a3,
+ LPARAM a4)
+ = CreateDialogParamA;
+
+HWND (__stdcall * Real_CreateDialogParamW)(HINSTANCE a0,
+ LPCWSTR a1,
+ HWND a2,
+ DLGPROC a3,
+ LPARAM a4)
+ = CreateDialogParamW;
+
+BOOL (__stdcall * Real_CreateDirectoryA)(LPCSTR a0,
+ LPSECURITY_ATTRIBUTES a1)
+ = CreateDirectoryA;
+
+BOOL (__stdcall * Real_CreateDirectoryExA)(LPCSTR a0,
+ LPCSTR a1,
+ LPSECURITY_ATTRIBUTES a2)
+ = CreateDirectoryExA;
+
+BOOL (__stdcall * Real_CreateDirectoryExW)(LPCWSTR a0,
+ LPCWSTR a1,
+ LPSECURITY_ATTRIBUTES a2)
+ = CreateDirectoryExW;
+
+BOOL (__stdcall * Real_CreateDirectoryW)(LPCWSTR a0,
+ LPSECURITY_ATTRIBUTES a1)
+ = CreateDirectoryW;
+
+HBITMAP (__stdcall * Real_CreateDiscardableBitmap)(HDC a0,
+ int a1,
+ int a2)
+ = CreateDiscardableBitmap;
+
+HRGN (__stdcall * Real_CreateEllipticRgn)(int a0,
+ int a1,
+ int a2,
+ int a3)
+ = CreateEllipticRgn;
+
+HRGN (__stdcall * Real_CreateEllipticRgnIndirect)(CONST RECT* a0)
+ = CreateEllipticRgnIndirect;
+
+HDC (__stdcall * Real_CreateEnhMetaFileA)(HDC a0,
+ LPCSTR a1,
+ CONST RECT* a2,
+ LPCSTR a3)
+ = CreateEnhMetaFileA;
+
+HDC (__stdcall * Real_CreateEnhMetaFileW)(HDC a0,
+ LPCWSTR a1,
+ CONST RECT* a2,
+ LPCWSTR a3)
+ = CreateEnhMetaFileW;
+
+HANDLE (__stdcall * Real_CreateEventA)(LPSECURITY_ATTRIBUTES a0,
+ BOOL a1,
+ BOOL a2,
+ LPCSTR a3)
+ = CreateEventA;
+
+HANDLE (__stdcall * Real_CreateEventW)(LPSECURITY_ATTRIBUTES a0,
+ BOOL a1,
+ BOOL a2,
+ LPCWSTR a3)
+ = CreateEventW;
+
+LPVOID (__stdcall * Real_CreateFiber)(ULONG_PTR a0,
+ LPFIBER_START_ROUTINE a1,
+ LPVOID a2)
+ = CreateFiber;
+
+HANDLE (__stdcall * Real_CreateFileA)(LPCSTR a0,
+ DWORD a1,
+ DWORD a2,
+ LPSECURITY_ATTRIBUTES a3,
+ DWORD a4,
+ DWORD a5,
+ HANDLE a6)
+ = CreateFileA;
+
+HANDLE (__stdcall * Real_CreateFileMappingA)(HANDLE a0,
+ LPSECURITY_ATTRIBUTES a1,
+ DWORD a2,
+ DWORD a3,
+ DWORD a4,
+ LPCSTR a5)
+ = CreateFileMappingA;
+
+HANDLE (__stdcall * Real_CreateFileMappingW)(HANDLE a0,
+ LPSECURITY_ATTRIBUTES a1,
+ DWORD a2,
+ DWORD a3,
+ DWORD a4,
+ LPCWSTR a5)
+ = CreateFileMappingW;
+
+HRESULT (__stdcall * Real_CreateFileMoniker)(LPCOLESTR a0,
+ IMoniker** a1)
+ = CreateFileMoniker;
+
+HANDLE (__stdcall * Real_CreateFileW)(LPCWSTR a0,
+ DWORD a1,
+ DWORD a2,
+ LPSECURITY_ATTRIBUTES a3,
+ DWORD a4,
+ DWORD a5,
+ HANDLE a6)
+ = CreateFileW;
+
+HFONT (__stdcall * Real_CreateFontA)(int a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ DWORD a5,
+ DWORD a6,
+ DWORD a7,
+ DWORD a8,
+ DWORD a9,
+ DWORD a10,
+ DWORD a11,
+ DWORD a12,
+ LPCSTR a13)
+ = CreateFontA;
+
+HFONT (__stdcall * Real_CreateFontIndirectA)(CONST LOGFONTA* a0)
+ = CreateFontIndirectA;
+
+HFONT (__stdcall * Real_CreateFontIndirectW)(CONST LOGFONTW* a0)
+ = CreateFontIndirectW;
+
+HFONT (__stdcall * Real_CreateFontW)(int a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ DWORD a5,
+ DWORD a6,
+ DWORD a7,
+ DWORD a8,
+ DWORD a9,
+ DWORD a10,
+ DWORD a11,
+ DWORD a12,
+ LPCWSTR a13)
+ = CreateFontW;
+
+HRESULT (__stdcall * Real_CreateGenericComposite)(IMoniker* a0,
+ IMoniker* a1,
+ IMoniker** a2)
+ = CreateGenericComposite;
+
+HPALETTE (__stdcall * Real_CreateHalftonePalette)(HDC a0)
+ = CreateHalftonePalette;
+
+HBRUSH (__stdcall * Real_CreateHatchBrush)(int a0,
+ COLORREF a1)
+ = CreateHatchBrush;
+
+HDC (__stdcall * Real_CreateICA)(LPCSTR a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ CONST DEVMODEA* a3)
+ = CreateICA;
+
+HDC (__stdcall * Real_CreateICW)(LPCWSTR a0,
+ LPCWSTR a1,
+ LPCWSTR a2,
+ CONST DEVMODEW* a3)
+ = CreateICW;
+
+HRESULT (__stdcall * Real_CreateILockBytesOnHGlobal)(HGLOBAL a0,
+ BOOL a1,
+ ILockBytes** a2)
+ = CreateILockBytesOnHGlobal;
+
+HICON (__stdcall * Real_CreateIcon)(HINSTANCE a0,
+ int a1,
+ int a2,
+ BYTE a3,
+ BYTE a4,
+ CONST BYTE* a5,
+ CONST BYTE* a6)
+ = CreateIcon;
+
+HICON (__stdcall * Real_CreateIconFromResource)(PBYTE a0,
+ DWORD a1,
+ BOOL a2,
+ DWORD a3)
+ = CreateIconFromResource;
+
+HICON (__stdcall * Real_CreateIconFromResourceEx)(PBYTE a0,
+ DWORD a1,
+ BOOL a2,
+ DWORD a3,
+ int a4,
+ int a5,
+ UINT a6)
+ = CreateIconFromResourceEx;
+
+HICON (__stdcall * Real_CreateIconIndirect)(PICONINFO a0)
+ = CreateIconIndirect;
+
+HANDLE (__stdcall * Real_CreateIoCompletionPort)(HANDLE a0,
+ HANDLE a1,
+ ULONG_PTR a2,
+ DWORD a3)
+ = CreateIoCompletionPort;
+
+HRESULT (__stdcall * Real_CreateItemMoniker)(LPCOLESTR a0,
+ LPCOLESTR a1,
+ IMoniker** a2)
+ = CreateItemMoniker;
+
+#if _MSC_VER < 1300
+HWND (__stdcall * Real_CreateMDIWindowA)(LPSTR a0,
+ LPSTR a1,
+ DWORD a2,
+ int a3,
+ int a4,
+ int a5,
+ int a6,
+ HWND a7,
+ HINSTANCE a8,
+ LPARAM a9)
+ = CreateMDIWindowA;
+#else
+HWND (__stdcall * Real_CreateMDIWindowA)(LPCSTR a0,
+ LPCSTR a1,
+ DWORD a2,
+ int a3,
+ int a4,
+ int a5,
+ int a6,
+ HWND a7,
+ HINSTANCE a8,
+ LPARAM a9)
+ = CreateMDIWindowA;
+#endif
+
+#if _MSC_VER < 1300
+HWND (__stdcall * Real_CreateMDIWindowW)(LPWSTR a0,
+ LPWSTR a1,
+ DWORD a2,
+ int a3,
+ int a4,
+ int a5,
+ int a6,
+ HWND a7,
+ HINSTANCE a8,
+ LPARAM a9)
+ = CreateMDIWindowW;
+#else
+HWND (__stdcall * Real_CreateMDIWindowW)(LPCWSTR a0,
+ LPCWSTR a1,
+ DWORD a2,
+ int a3,
+ int a4,
+ int a5,
+ int a6,
+ HWND a7,
+ HINSTANCE a8,
+ LPARAM a9)
+ = CreateMDIWindowW;
+#endif
+
+HANDLE (__stdcall * Real_CreateMailslotA)(LPCSTR a0,
+ DWORD a1,
+ DWORD a2,
+ LPSECURITY_ATTRIBUTES a3)
+ = CreateMailslotA;
+
+HANDLE (__stdcall * Real_CreateMailslotW)(LPCWSTR a0,
+ DWORD a1,
+ DWORD a2,
+ LPSECURITY_ATTRIBUTES a3)
+ = CreateMailslotW;
+
+HMENU (__stdcall * Real_CreateMenu)(void)
+ = CreateMenu;
+
+HDC (__stdcall * Real_CreateMetaFileA)(LPCSTR a0)
+ = CreateMetaFileA;
+
+HDC (__stdcall * Real_CreateMetaFileW)(LPCWSTR a0)
+ = CreateMetaFileW;
+
+HANDLE (__stdcall * Real_CreateMutexA)(LPSECURITY_ATTRIBUTES a0,
+ BOOL a1,
+ LPCSTR a2)
+ = CreateMutexA;
+
+HANDLE (__stdcall * Real_CreateMutexW)(LPSECURITY_ATTRIBUTES a0,
+ BOOL a1,
+ LPCWSTR a2)
+ = CreateMutexW;
+
+HANDLE (__stdcall * Real_CreateNamedPipeA)(LPCSTR a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3,
+ DWORD a4,
+ DWORD a5,
+ DWORD a6,
+ LPSECURITY_ATTRIBUTES a7)
+ = CreateNamedPipeA;
+
+HANDLE (__stdcall * Real_CreateNamedPipeW)(LPCWSTR a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3,
+ DWORD a4,
+ DWORD a5,
+ DWORD a6,
+ LPSECURITY_ATTRIBUTES a7)
+ = CreateNamedPipeW;
+
+HRESULT (__stdcall * Real_CreateOleAdviseHolder)(LPOLEADVISEHOLDER* a0)
+ = CreateOleAdviseHolder;
+
+HPALETTE (__stdcall * Real_CreatePalette)(CONST LOGPALETTE* a0)
+ = CreatePalette;
+
+HBRUSH (__stdcall * Real_CreatePatternBrush)(HBITMAP a0)
+ = CreatePatternBrush;
+
+HPEN (__stdcall * Real_CreatePen)(int a0,
+ int a1,
+ COLORREF a2)
+ = CreatePen;
+
+HPEN (__stdcall * Real_CreatePenIndirect)(CONST LOGPEN* a0)
+ = CreatePenIndirect;
+
+BOOL (__stdcall * Real_CreatePipe)(PHANDLE a0,
+ PHANDLE a1,
+ LPSECURITY_ATTRIBUTES a2,
+ DWORD a3)
+ = CreatePipe;
+
+HRESULT (__stdcall * Real_CreatePointerMoniker)(LPUNKNOWN a0,
+ IMoniker** a1)
+ = CreatePointerMoniker;
+
+HRGN (__stdcall * Real_CreatePolyPolygonRgn)(CONST POINT* a0,
+ CONST INT* a1,
+ int a2,
+ int a3)
+ = CreatePolyPolygonRgn;
+
+HRGN (__stdcall * Real_CreatePolygonRgn)(CONST POINT* a0,
+ int a1,
+ int a2)
+ = CreatePolygonRgn;
+
+HMENU (__stdcall * Real_CreatePopupMenu)(void)
+ = CreatePopupMenu;
+
+BOOL (__stdcall * Real_CreateProcessA)(LPCSTR a0,
+ LPSTR a1,
+ LPSECURITY_ATTRIBUTES a2,
+ LPSECURITY_ATTRIBUTES a3,
+ BOOL a4,
+ DWORD a5,
+ LPVOID a6,
+ LPCSTR a7,
+ LPSTARTUPINFOA a8,
+ LPPROCESS_INFORMATION a9)
+ = CreateProcessA;
+
+BOOL (__stdcall * Real_CreateProcessW)(LPCWSTR a0,
+ LPWSTR a1,
+ LPSECURITY_ATTRIBUTES a2,
+ LPSECURITY_ATTRIBUTES a3,
+ BOOL a4,
+ DWORD a5,
+ LPVOID a6,
+ LPCWSTR a7,
+ LPSTARTUPINFOW a8,
+ LPPROCESS_INFORMATION a9)
+ = CreateProcessW;
+
+BOOL (__stdcall * Real_CreateProcessAsUserA)(
+ __in_opt HANDLE hToken,
+ __in_opt LPCSTR lpApplicationName,
+ __inout_opt LPSTR lpCommandLine,
+ __in_opt LPSECURITY_ATTRIBUTES lpProcessAttributes,
+ __in_opt LPSECURITY_ATTRIBUTES lpThreadAttributes,
+ __in BOOL bInheritHandles,
+ __in DWORD dwCreationFlags,
+ __in_opt LPVOID lpEnvironment,
+ __in_opt LPCSTR lpCurrentDirectory,
+ __in LPSTARTUPINFOA lpStartupInfo,
+ __out LPPROCESS_INFORMATION lpProcessInformation
+ ) = CreateProcessAsUserA;
+
+BOOL (__stdcall * Real_CreateProcessAsUserW)(
+ __in_opt HANDLE hToken,
+ __in_opt LPCWSTR lpApplicationName,
+ __inout_opt LPWSTR lpCommandLine,
+ __in_opt LPSECURITY_ATTRIBUTES lpProcessAttributes,
+ __in_opt LPSECURITY_ATTRIBUTES lpThreadAttributes,
+ __in BOOL bInheritHandles,
+ __in DWORD dwCreationFlags,
+ __in_opt LPVOID lpEnvironment,
+ __in_opt LPCWSTR lpCurrentDirectory,
+ __in LPSTARTUPINFOW lpStartupInfo,
+ __out LPPROCESS_INFORMATION lpProcessInformation
+) = CreateProcessAsUserW;
+
+#if(_WIN32_WINNT >= 0x0500)
+
+BOOL (WINAPI * Real_CreateProcessWithLogonW)(
+ __in LPCWSTR lpUsername,
+ __in_opt LPCWSTR lpDomain,
+ __in LPCWSTR lpPassword,
+ __in DWORD dwLogonFlags,
+ __in_opt LPCWSTR lpApplicationName,
+ __inout_opt LPWSTR lpCommandLine,
+ __in DWORD dwCreationFlags,
+ __in_opt LPVOID lpEnvironment,
+ __in_opt LPCWSTR lpCurrentDirectory,
+ __in LPSTARTUPINFOW lpStartupInfo,
+ __out LPPROCESS_INFORMATION lpProcessInfo
+) = CreateProcessWithLogonW;
+
+BOOL (WINAPI * Real_CreateProcessWithTokenW)(
+ __in HANDLE hToken,
+ __in DWORD dwLogonFlags,
+ __in_opt LPCWSTR lpApplicationName,
+ __inout_opt LPWSTR lpCommandLine,
+ __in DWORD dwCreationFlags,
+ __in_opt LPVOID lpEnvironment,
+ __in_opt LPCWSTR lpCurrentDirectory,
+ __in LPSTARTUPINFOW lpStartupInfo,
+ __out LPPROCESS_INFORMATION lpProcessInfo
+) = CreateProcessWithTokenW;
+#endif
+
+HRGN (__stdcall * Real_CreateRectRgn)(int a0,
+ int a1,
+ int a2,
+ int a3)
+ = CreateRectRgn;
+
+HRGN (__stdcall * Real_CreateRectRgnIndirect)(CONST RECT* a0)
+ = CreateRectRgnIndirect;
+
+HANDLE (__stdcall * Real_CreateRemoteThread)(HANDLE a0,
+ LPSECURITY_ATTRIBUTES a1,
+ ULONG_PTR a2,
+ LPTHREAD_START_ROUTINE a3,
+ LPVOID a4,
+ DWORD a5,
+ LPDWORD a6)
+ = CreateRemoteThread;
+
+HRGN (__stdcall * Real_CreateRoundRectRgn)(int a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ int a5)
+ = CreateRoundRectRgn;
+
+BOOL (__stdcall * Real_CreateScalableFontResourceA)(DWORD a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ LPCSTR a3)
+ = CreateScalableFontResourceA;
+
+BOOL (__stdcall * Real_CreateScalableFontResourceW)(DWORD a0,
+ LPCWSTR a1,
+ LPCWSTR a2,
+ LPCWSTR a3)
+ = CreateScalableFontResourceW;
+
+HANDLE (__stdcall * Real_CreateSemaphoreA)(LPSECURITY_ATTRIBUTES a0,
+ LONG a1,
+ LONG a2,
+ LPCSTR a3)
+ = CreateSemaphoreA;
+
+HANDLE (__stdcall * Real_CreateSemaphoreW)(LPSECURITY_ATTRIBUTES a0,
+ LONG a1,
+ LONG a2,
+ LPCWSTR a3)
+ = CreateSemaphoreW;
+
+HBRUSH (__stdcall * Real_CreateSolidBrush)(COLORREF a0)
+ = CreateSolidBrush;
+
+HRESULT (__stdcall * Real_CreateStdProgressIndicator)(HWND a0,
+ LPCOLESTR a1,
+ IBindStatusCallback* a2,
+ IBindStatusCallback** a3)
+ = CreateStdProgressIndicator;
+
+HRESULT (__stdcall * Real_CreateStreamOnHGlobal)(HGLOBAL a0,
+ BOOL a1,
+ LPSTREAM* a2)
+ = CreateStreamOnHGlobal;
+
+DWORD (__stdcall * Real_CreateTapePartition)(HANDLE a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3)
+ = CreateTapePartition;
+
+HANDLE (__stdcall * Real_CreateThread)(LPSECURITY_ATTRIBUTES a0,
+ ULONG_PTR a1,
+ LPTHREAD_START_ROUTINE a2,
+ LPVOID a3,
+ DWORD a4,
+ LPDWORD a5)
+ = CreateThread;
+
+HANDLE (__stdcall * Real_CreateWaitableTimerA)(LPSECURITY_ATTRIBUTES a0,
+ BOOL a1,
+ LPCSTR a2)
+ = CreateWaitableTimerA;
+
+HANDLE (__stdcall * Real_CreateWaitableTimerW)(LPSECURITY_ATTRIBUTES a0,
+ BOOL a1,
+ LPCWSTR a2)
+ = CreateWaitableTimerW;
+
+HWND (__stdcall * Real_CreateWindowExA)(DWORD a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ DWORD a3,
+ int a4,
+ int a5,
+ int a6,
+ int a7,
+ HWND a8,
+ HMENU a9,
+ HINSTANCE a10,
+ LPVOID a11)
+ = CreateWindowExA;
+
+HWND (__stdcall * Real_CreateWindowExW)(DWORD a0,
+ LPCWSTR a1,
+ LPCWSTR a2,
+ DWORD a3,
+ int a4,
+ int a5,
+ int a6,
+ int a7,
+ HWND a8,
+ HMENU a9,
+ HINSTANCE a10,
+ LPVOID a11)
+ = CreateWindowExW;
+
+#if _MSC_VER < 1300
+HWINSTA (__stdcall * Real_CreateWindowStationA)(LPSTR a0,
+ DWORD a1,
+ ACCESS_MASK a2,
+ LPSECURITY_ATTRIBUTES a3)
+ = CreateWindowStationA;
+#else
+HWINSTA (__stdcall * Real_CreateWindowStationA)(LPCSTR a0,
+ DWORD a1,
+ ACCESS_MASK a2,
+ LPSECURITY_ATTRIBUTES a3)
+ = CreateWindowStationA;
+#endif
+
+#if _MSC_VER < 1300
+HWINSTA (__stdcall * Real_CreateWindowStationW)(LPWSTR a0,
+ DWORD a1,
+ ACCESS_MASK a2,
+ LPSECURITY_ATTRIBUTES a3)
+ = CreateWindowStationW;
+#else
+HWINSTA (__stdcall * Real_CreateWindowStationW)(LPCWSTR a0,
+ DWORD a1,
+ ACCESS_MASK a2,
+ LPSECURITY_ATTRIBUTES a3)
+ = CreateWindowStationW;
+#endif
+
+BOOL (__stdcall * Real_DPtoLP)(HDC a0,
+ POINT* a1,
+ int a2)
+ = DPtoLP;
+
+BOOL (__stdcall * Real_DdeAbandonTransaction)(DWORD a0,
+ HCONV a1,
+ DWORD a2)
+ = DdeAbandonTransaction;
+
+LPBYTE (__stdcall * Real_DdeAccessData)(HDDEDATA a0,
+ LPDWORD a1)
+ = DdeAccessData;
+
+HDDEDATA (__stdcall * Real_DdeAddData)(HDDEDATA a0,
+ LPBYTE a1,
+ DWORD a2,
+ DWORD a3)
+ = DdeAddData;
+
+HDDEDATA (__stdcall * Real_DdeClientTransaction)(LPBYTE a0,
+ DWORD a1,
+ HCONV a2,
+ HSZ a3,
+ UINT a4,
+ UINT a5,
+ DWORD a6,
+ LPDWORD a7)
+ = DdeClientTransaction;
+
+int (__stdcall * Real_DdeCmpStringHandles)(HSZ a0,
+ HSZ a1)
+ = DdeCmpStringHandles;
+
+HCONV (__stdcall * Real_DdeConnect)(DWORD a0,
+ HSZ a1,
+ HSZ a2,
+ PCONVCONTEXT a3)
+ = DdeConnect;
+
+HCONVLIST (__stdcall * Real_DdeConnectList)(DWORD a0,
+ HSZ a1,
+ HSZ a2,
+ HCONVLIST a3,
+ PCONVCONTEXT a4)
+ = DdeConnectList;
+
+HDDEDATA (__stdcall * Real_DdeCreateDataHandle)(DWORD a0,
+ LPBYTE a1,
+ DWORD a2,
+ DWORD a3,
+ HSZ a4,
+ UINT a5,
+ UINT a6)
+ = DdeCreateDataHandle;
+
+HSZ (__stdcall * Real_DdeCreateStringHandleA)(DWORD a0,
+ LPCSTR a1,
+ int a2)
+ = DdeCreateStringHandleA;
+
+HSZ (__stdcall * Real_DdeCreateStringHandleW)(DWORD a0,
+ LPCWSTR a1,
+ int a2)
+ = DdeCreateStringHandleW;
+
+BOOL (__stdcall * Real_DdeDisconnect)(HCONV a0)
+ = DdeDisconnect;
+
+BOOL (__stdcall * Real_DdeDisconnectList)(HCONVLIST a0)
+ = DdeDisconnectList;
+
+BOOL (__stdcall * Real_DdeEnableCallback)(DWORD a0,
+ HCONV a1,
+ UINT a2)
+ = DdeEnableCallback;
+
+BOOL (__stdcall * Real_DdeFreeDataHandle)(HDDEDATA a0)
+ = DdeFreeDataHandle;
+
+BOOL (__stdcall * Real_DdeFreeStringHandle)(DWORD a0,
+ HSZ a1)
+ = DdeFreeStringHandle;
+
+DWORD (__stdcall * Real_DdeGetData)(HDDEDATA a0,
+ LPBYTE a1,
+ DWORD a2,
+ DWORD a3)
+ = DdeGetData;
+
+UINT (__stdcall * Real_DdeGetLastError)(DWORD a0)
+ = DdeGetLastError;
+
+BOOL (__stdcall * Real_DdeImpersonateClient)(HCONV a0)
+ = DdeImpersonateClient;
+
+BOOL (__stdcall * Real_DdeKeepStringHandle)(DWORD a0,
+ HSZ a1)
+ = DdeKeepStringHandle;
+
+HDDEDATA (__stdcall * Real_DdeNameService)(DWORD a0,
+ HSZ a1,
+ HSZ a2,
+ UINT a3)
+ = DdeNameService;
+
+BOOL (__stdcall * Real_DdePostAdvise)(DWORD a0,
+ HSZ a1,
+ HSZ a2)
+ = DdePostAdvise;
+
+UINT (__stdcall * Real_DdeQueryConvInfo)(HCONV a0,
+ DWORD a1,
+ CONVINFO* a2)
+ = DdeQueryConvInfo;
+
+HCONV (__stdcall * Real_DdeQueryNextServer)(HCONVLIST a0,
+ HCONV a1)
+ = DdeQueryNextServer;
+
+DWORD (__stdcall * Real_DdeQueryStringA)(DWORD a0,
+ HSZ a1,
+ LPSTR a2,
+ DWORD a3,
+ int a4)
+ = DdeQueryStringA;
+
+DWORD (__stdcall * Real_DdeQueryStringW)(DWORD a0,
+ HSZ a1,
+ LPWSTR a2,
+ DWORD a3,
+ int a4)
+ = DdeQueryStringW;
+
+HCONV (__stdcall * Real_DdeReconnect)(HCONV a0)
+ = DdeReconnect;
+
+BOOL (__stdcall * Real_DdeSetQualityOfService)(HWND a0,
+ CONST SECURITY_QUALITY_OF_SERVICE* a1,
+ PSECURITY_QUALITY_OF_SERVICE a2)
+ = DdeSetQualityOfService;
+
+BOOL (__stdcall * Real_DdeSetUserHandle)(HCONV a0,
+ DWORD a1,
+ ULONG_PTR a2)
+ = DdeSetUserHandle;
+
+BOOL (__stdcall * Real_DdeUnaccessData)(HDDEDATA a0)
+ = DdeUnaccessData;
+
+BOOL (__stdcall * Real_DdeUninitialize)(DWORD a0)
+ = DdeUninitialize;
+
+BOOL (__stdcall * Real_DebugActiveProcess)(DWORD a0)
+ = DebugActiveProcess;
+
+BOOL (__stdcall * Real_DebugActiveProcessStop)(DWORD a0)
+ = DebugActiveProcessStop;
+
+void (__stdcall * Real_DebugBreak)(void)
+ = DebugBreak;
+
+LRESULT (__stdcall * Real_DefDlgProcA)(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3)
+ = DefDlgProcA;
+
+LRESULT (__stdcall * Real_DefDlgProcW)(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3)
+ = DefDlgProcW;
+
+LRESULT (__stdcall * Real_DefFrameProcA)(HWND a0,
+ HWND a1,
+ UINT a2,
+ WPARAM a3,
+ LPARAM a4)
+ = DefFrameProcA;
+
+LRESULT (__stdcall * Real_DefFrameProcW)(HWND a0,
+ HWND a1,
+ UINT a2,
+ WPARAM a3,
+ LPARAM a4)
+ = DefFrameProcW;
+
+LRESULT (__stdcall * Real_DefMDIChildProcA)(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3)
+ = DefMDIChildProcA;
+
+LRESULT (__stdcall * Real_DefMDIChildProcW)(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3)
+ = DefMDIChildProcW;
+
+LRESULT (__stdcall * Real_DefWindowProcA)(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3)
+ = DefWindowProcA;
+
+LRESULT (__stdcall * Real_DefWindowProcW)(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3)
+ = DefWindowProcW;
+
+HDWP (__stdcall * Real_DeferWindowPos)(HDWP a0,
+ HWND a1,
+ HWND a2,
+ int a3,
+ int a4,
+ int a5,
+ int a6,
+ UINT a7)
+ = DeferWindowPos;
+
+BOOL (__stdcall * Real_DefineDosDeviceA)(DWORD a0,
+ LPCSTR a1,
+ LPCSTR a2)
+ = DefineDosDeviceA;
+
+BOOL (__stdcall * Real_DefineDosDeviceW)(DWORD a0,
+ LPCWSTR a1,
+ LPCWSTR a2)
+ = DefineDosDeviceW;
+
+ATOM (__stdcall * Real_DeleteAtom)(ATOM a0)
+ = DeleteAtom;
+
+BOOL (__stdcall * Real_DeleteColorSpace)(HCOLORSPACE a0)
+ = DeleteColorSpace;
+
+BOOL (__stdcall * Real_DeleteDC)(HDC a0)
+ = DeleteDC;
+
+BOOL (__stdcall * Real_DeleteEnhMetaFile)(HENHMETAFILE a0)
+ = DeleteEnhMetaFile;
+
+void (__stdcall * Real_DeleteFiber)(LPVOID a0)
+ = DeleteFiber;
+
+BOOL (__stdcall * Real_DeleteFileA)(LPCSTR a0)
+ = DeleteFileA;
+
+BOOL (__stdcall * Real_DeleteFileW)(LPCWSTR a0)
+ = DeleteFileW;
+
+BOOL (__stdcall * Real_DeleteMenu)(HMENU a0,
+ UINT a1,
+ UINT a2)
+ = DeleteMenu;
+
+BOOL (__stdcall * Real_DeleteMetaFile)(HMETAFILE a0)
+ = DeleteMetaFile;
+
+BOOL (__stdcall * Real_DeleteObject)(HGDIOBJ a0)
+ = DeleteObject;
+
+int (__stdcall * Real_DescribePixelFormat)(HDC a0,
+ int a1,
+ UINT a2,
+ PIXELFORMATDESCRIPTOR* a3)
+ = DescribePixelFormat;
+
+BOOL (__stdcall * Real_DestroyAcceleratorTable)(HACCEL a0)
+ = DestroyAcceleratorTable;
+
+BOOL (__stdcall * Real_DestroyCaret)(void)
+ = DestroyCaret;
+
+BOOL (__stdcall * Real_DestroyCursor)(HCURSOR a0)
+ = DestroyCursor;
+
+BOOL (__stdcall * Real_DestroyIcon)(HICON a0)
+ = DestroyIcon;
+
+BOOL (__stdcall * Real_DestroyMenu)(HMENU a0)
+ = DestroyMenu;
+
+BOOL (__stdcall * Real_DestroyWindow)(HWND a0)
+ = DestroyWindow;
+
+BOOL (__stdcall * Real_DeviceIoControl)(HANDLE a0,
+ DWORD a1,
+ LPVOID a2,
+ DWORD a3,
+ LPVOID a4,
+ DWORD a5,
+ LPDWORD a6,
+ LPOVERLAPPED a7)
+ = DeviceIoControl;
+
+INT_PTR (__stdcall * Real_DialogBoxIndirectParamA)(HINSTANCE a0,
+ LPCDLGTEMPLATEA a1,
+ HWND a2,
+ DLGPROC a3,
+ LPARAM a4)
+ = DialogBoxIndirectParamA;
+
+INT_PTR (__stdcall * Real_DialogBoxIndirectParamW)(HINSTANCE a0,
+ LPCDLGTEMPLATEW a1,
+ HWND a2,
+ DLGPROC a3,
+ LPARAM a4)
+ = DialogBoxIndirectParamW;
+
+INT_PTR (__stdcall * Real_DialogBoxParamA)(HINSTANCE a0,
+ LPCSTR a1,
+ HWND a2,
+ DLGPROC a3,
+ LPARAM a4)
+ = DialogBoxParamA;
+
+INT_PTR (__stdcall * Real_DialogBoxParamW)(HINSTANCE a0,
+ LPCWSTR a1,
+ HWND a2,
+ DLGPROC a3,
+ LPARAM a4)
+ = DialogBoxParamW;
+
+BOOL (__stdcall * Real_DisableThreadLibraryCalls)(HMODULE a0)
+ = DisableThreadLibraryCalls;
+
+BOOL (__stdcall * Real_DisconnectNamedPipe)(HANDLE a0)
+ = DisconnectNamedPipe;
+
+LRESULT (__stdcall * Real_DispatchMessageA)(CONST MSG* a0)
+ = DispatchMessageA;
+
+LRESULT (__stdcall * Real_DispatchMessageW)(CONST MSG* a0)
+ = DispatchMessageW;
+
+int (__stdcall * Real_DlgDirListA)(HWND a0,
+ LPSTR a1,
+ int a2,
+ int a3,
+ UINT a4)
+ = DlgDirListA;
+
+int (__stdcall * Real_DlgDirListComboBoxA)(HWND a0,
+ LPSTR a1,
+ int a2,
+ int a3,
+ UINT a4)
+ = DlgDirListComboBoxA;
+
+int (__stdcall * Real_DlgDirListComboBoxW)(HWND a0,
+ LPWSTR a1,
+ int a2,
+ int a3,
+ UINT a4)
+ = DlgDirListComboBoxW;
+
+int (__stdcall * Real_DlgDirListW)(HWND a0,
+ LPWSTR a1,
+ int a2,
+ int a3,
+ UINT a4)
+ = DlgDirListW;
+
+BOOL (__stdcall * Real_DlgDirSelectComboBoxExA)(HWND a0,
+ LPSTR a1,
+ int a2,
+ int a3)
+ = DlgDirSelectComboBoxExA;
+
+BOOL (__stdcall * Real_DlgDirSelectComboBoxExW)(HWND a0,
+ LPWSTR a1,
+ int a2,
+ int a3)
+ = DlgDirSelectComboBoxExW;
+
+BOOL (__stdcall * Real_DlgDirSelectExA)(HWND a0,
+ LPSTR a1,
+ int a2,
+ int a3)
+ = DlgDirSelectExA;
+
+BOOL (__stdcall * Real_DlgDirSelectExW)(HWND a0,
+ LPWSTR a1,
+ int a2,
+ int a3)
+ = DlgDirSelectExW;
+
+HRESULT (__stdcall * Real_DoDragDrop)(IDataObject* a0,
+ IDropSource* a1,
+ DWORD a2,
+ LPDWORD a3)
+ = DoDragDrop;
+
+BOOL (__stdcall * Real_DosDateTimeToFileTime)(WORD a0,
+ WORD a1,
+ LPFILETIME a2)
+ = DosDateTimeToFileTime;
+
+BOOL (__stdcall * Real_DragDetect)(HWND a0,
+ POINT a1)
+ = DragDetect;
+
+DWORD (__stdcall * Real_DragObject)(HWND a0,
+ HWND a1,
+ UINT a2,
+ ULONG_PTR a3,
+ HCURSOR a4)
+ = DragObject;
+
+BOOL (__stdcall * Real_DrawAnimatedRects)(HWND a0,
+ int a1,
+ CONST RECT* a2,
+ CONST RECT* a3)
+ = DrawAnimatedRects;
+
+BOOL (__stdcall * Real_DrawCaption)(HWND a0,
+ HDC a1,
+ CONST RECT* a2,
+ UINT a3)
+ = DrawCaption;
+
+BOOL (__stdcall * Real_DrawEdge)(HDC a0,
+ LPRECT a1,
+ UINT a2,
+ UINT a3)
+ = DrawEdge;
+
+int (__stdcall * Real_DrawEscape)(HDC a0,
+ int a1,
+ int a2,
+ LPCSTR a3)
+ = DrawEscape;
+
+BOOL (__stdcall * Real_DrawFocusRect)(HDC a0,
+ CONST RECT* a1)
+ = DrawFocusRect;
+
+BOOL (__stdcall * Real_DrawFrameControl)(HDC a0,
+ LPRECT a1,
+ UINT a2,
+ UINT a3)
+ = DrawFrameControl;
+
+BOOL (__stdcall * Real_DrawIcon)(HDC a0,
+ int a1,
+ int a2,
+ HICON a3)
+ = DrawIcon;
+
+BOOL (__stdcall * Real_DrawIconEx)(HDC a0,
+ int a1,
+ int a2,
+ HICON a3,
+ int a4,
+ int a5,
+ UINT a6,
+ HBRUSH a7,
+ UINT a8)
+ = DrawIconEx;
+
+BOOL (__stdcall * Real_DrawMenuBar)(HWND a0)
+ = DrawMenuBar;
+
+BOOL (__stdcall * Real_DrawStateA)(HDC a0,
+ HBRUSH a1,
+ DRAWSTATEPROC a2,
+ LPARAM a3,
+ WPARAM a4,
+ int a5,
+ int a6,
+ int a7,
+ int a8,
+ UINT a9)
+ = DrawStateA;
+
+BOOL (__stdcall * Real_DrawStateW)(HDC a0,
+ HBRUSH a1,
+ DRAWSTATEPROC a2,
+ LPARAM a3,
+ WPARAM a4,
+ int a5,
+ int a6,
+ int a7,
+ int a8,
+ UINT a9)
+ = DrawStateW;
+
+int (__stdcall * Real_DrawTextA)(HDC a0,
+ LPCSTR a1,
+ int a2,
+ LPRECT a3,
+ UINT a4)
+ = DrawTextA;
+
+int (__stdcall * Real_DrawTextExA)(HDC a0,
+ LPSTR a1,
+ int a2,
+ LPRECT a3,
+ UINT a4,
+ LPDRAWTEXTPARAMS a5)
+ = DrawTextExA;
+
+int (__stdcall * Real_DrawTextExW)(HDC a0,
+ LPWSTR a1,
+ int a2,
+ LPRECT a3,
+ UINT a4,
+ LPDRAWTEXTPARAMS a5)
+ = DrawTextExW;
+
+int (__stdcall * Real_DrawTextW)(HDC a0,
+ LPCWSTR a1,
+ int a2,
+ LPRECT a3,
+ UINT a4)
+ = DrawTextW;
+
+BOOL (__stdcall * Real_DuplicateHandle)(HANDLE a0,
+ HANDLE a1,
+ HANDLE a2,
+ LPHANDLE a3,
+ DWORD a4,
+ BOOL a5,
+ DWORD a6)
+ = DuplicateHandle;
+
+BOOL (__stdcall * Real_Ellipse)(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4)
+ = Ellipse;
+
+BOOL (__stdcall * Real_EmptyClipboard)(void)
+ = EmptyClipboard;
+
+BOOL (__stdcall * Real_EnableMenuItem)(HMENU a0,
+ UINT a1,
+ UINT a2)
+ = EnableMenuItem;
+
+BOOL (__stdcall * Real_EnableScrollBar)(HWND a0,
+ UINT a1,
+ UINT a2)
+ = EnableScrollBar;
+
+BOOL (__stdcall * Real_EnableWindow)(HWND a0,
+ BOOL a1)
+ = EnableWindow;
+
+BOOL (__stdcall * Real_EndDeferWindowPos)(HDWP a0)
+ = EndDeferWindowPos;
+
+BOOL (__stdcall * Real_EndDialog)(HWND a0,
+ INT_PTR a1)
+ = EndDialog;
+
+int (__stdcall * Real_EndDoc)(HDC a0)
+ = EndDoc;
+
+int (__stdcall * Real_EndPage)(HDC a0)
+ = EndPage;
+
+BOOL (__stdcall * Real_EndPaint)(HWND a0,
+ CONST PAINTSTRUCT* a1)
+ = EndPaint;
+
+BOOL (__stdcall * Real_EndPath)(HDC a0)
+ = EndPath;
+
+BOOL (__stdcall * Real_EndUpdateResourceA)(HANDLE a0,
+ BOOL a1)
+ = EndUpdateResourceA;
+
+BOOL (__stdcall * Real_EndUpdateResourceW)(HANDLE a0,
+ BOOL a1)
+ = EndUpdateResourceW;
+
+BOOL (__stdcall * Real_EnumCalendarInfoA)(CALINFO_ENUMPROCA a0,
+ LCID a1,
+ CALID a2,
+ CALTYPE a3)
+ = EnumCalendarInfoA;
+
+BOOL (__stdcall * Real_EnumCalendarInfoW)(CALINFO_ENUMPROCW a0,
+ LCID a1,
+ CALID a2,
+ CALTYPE a3)
+ = EnumCalendarInfoW;
+
+BOOL (__stdcall * Real_EnumChildWindows)(HWND a0,
+ WNDENUMPROC a1,
+ LPARAM a2)
+ = EnumChildWindows;
+
+UINT (__stdcall * Real_EnumClipboardFormats)(UINT a0)
+ = EnumClipboardFormats;
+
+BOOL (__stdcall * Real_EnumDateFormatsA)(DATEFMT_ENUMPROCA a0,
+ LCID a1,
+ DWORD a2)
+ = EnumDateFormatsA;
+
+BOOL (__stdcall * Real_EnumDateFormatsW)(DATEFMT_ENUMPROCW a0,
+ LCID a1,
+ DWORD a2)
+ = EnumDateFormatsW;
+
+BOOL (__stdcall * Real_EnumDesktopWindows)(HDESK a0,
+ WNDENUMPROC a1,
+ LPARAM a2)
+ = EnumDesktopWindows;
+
+BOOL (__stdcall * Real_EnumDesktopsA)(HWINSTA a0,
+ DESKTOPENUMPROCA a1,
+ LPARAM a2)
+ = EnumDesktopsA;
+
+BOOL (__stdcall * Real_EnumDesktopsW)(HWINSTA a0,
+ DESKTOPENUMPROCW a1,
+ LPARAM a2)
+ = EnumDesktopsW;
+
+BOOL (__stdcall * Real_EnumDisplaySettingsA)(LPCSTR a0,
+ DWORD a1,
+ LPDEVMODEA a2)
+ = EnumDisplaySettingsA;
+
+BOOL (__stdcall * Real_EnumDisplaySettingsW)(LPCWSTR a0,
+ DWORD a1,
+ LPDEVMODEW a2)
+ = EnumDisplaySettingsW;
+
+BOOL (__stdcall * Real_EnumEnhMetaFile)(HDC a0,
+ HENHMETAFILE a1,
+ ENHMFENUMPROC a2,
+ LPVOID a3,
+ CONST RECT* a4)
+ = EnumEnhMetaFile;
+
+int (__stdcall * Real_EnumFontFamiliesA)(HDC a0,
+ LPCSTR a1,
+ FONTENUMPROCA a2,
+ LPARAM a3)
+ = EnumFontFamiliesA;
+
+int (__stdcall * Real_EnumFontFamiliesExA)(HDC a0,
+ LPLOGFONTA a1,
+ FONTENUMPROCA a2,
+ LPARAM a3,
+ DWORD a4)
+ = EnumFontFamiliesExA;
+
+int (__stdcall * Real_EnumFontFamiliesExW)(HDC a0,
+ LPLOGFONTW a1,
+ FONTENUMPROCW a2,
+ LPARAM a3,
+ DWORD a4)
+ = EnumFontFamiliesExW;
+
+int (__stdcall * Real_EnumFontFamiliesW)(HDC a0,
+ LPCWSTR a1,
+ FONTENUMPROCW a2,
+ LPARAM a3)
+ = EnumFontFamiliesW;
+
+int (__stdcall * Real_EnumFontsA)(HDC a0,
+ LPCSTR a1,
+ FONTENUMPROCA a2,
+ LPARAM a3)
+ = EnumFontsA;
+
+int (__stdcall * Real_EnumFontsW)(HDC a0,
+ LPCWSTR a1,
+ FONTENUMPROCW a2,
+ LPARAM a3)
+ = EnumFontsW;
+
+int (__stdcall * Real_EnumICMProfilesA)(HDC a0,
+ ICMENUMPROCA a1,
+ LPARAM a2)
+ = EnumICMProfilesA;
+
+int (__stdcall * Real_EnumICMProfilesW)(HDC a0,
+ ICMENUMPROCW a1,
+ LPARAM a2)
+ = EnumICMProfilesW;
+
+BOOL (__stdcall * Real_EnumMetaFile)(HDC a0,
+ HMETAFILE a1,
+ MFENUMPROC a2,
+ LPARAM a3)
+ = EnumMetaFile;
+
+int (__stdcall * Real_EnumObjects)(HDC a0,
+ int a1,
+ GOBJENUMPROC a2,
+ LPARAM a3)
+ = EnumObjects;
+
+int (__stdcall * Real_EnumPropsA)(HWND a0,
+ PROPENUMPROCA a1)
+ = EnumPropsA;
+
+int (__stdcall * Real_EnumPropsExA)(HWND a0,
+ PROPENUMPROCEXA a1,
+ LPARAM a2)
+ = EnumPropsExA;
+
+int (__stdcall * Real_EnumPropsExW)(HWND a0,
+ PROPENUMPROCEXW a1,
+ LPARAM a2)
+ = EnumPropsExW;
+
+int (__stdcall * Real_EnumPropsW)(HWND a0,
+ PROPENUMPROCW a1)
+ = EnumPropsW;
+
+#if _MSC_VER < 1300
+BOOL (__stdcall * Real_EnumResourceLanguagesA)(HMODULE a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ ENUMRESLANGPROC a3,
+ LONG a4)
+ = EnumResourceLanguagesA;
+#else
+BOOL (__stdcall * Real_EnumResourceLanguagesA)(HMODULE a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ ENUMRESLANGPROCA a3,
+ LONG_PTR a4)
+ = EnumResourceLanguagesA;
+#endif
+
+#if _MSC_VER < 1300
+BOOL (__stdcall * Real_EnumResourceLanguagesW)(HMODULE a0,
+ LPCWSTR a1,
+ LPCWSTR a2,
+ ENUMRESLANGPROC a3,
+ LONG a4)
+ = EnumResourceLanguagesW;
+#else
+BOOL (__stdcall * Real_EnumResourceLanguagesW)(HMODULE a0,
+ LPCWSTR a1,
+ LPCWSTR a2,
+ ENUMRESLANGPROCW a3,
+ LONG_PTR a4)
+ = EnumResourceLanguagesW;
+#endif
+
+#if _MSC_VER < 1300
+BOOL (__stdcall * Real_EnumResourceNamesA)(HMODULE a0,
+ LPCSTR a1,
+ ENUMRESNAMEPROC a2,
+ LONG a3)
+ = EnumResourceNamesA;
+#else
+BOOL (__stdcall * Real_EnumResourceNamesA)(HMODULE a0,
+ LPCSTR a1,
+ ENUMRESNAMEPROCA a2,
+ LONG_PTR a3)
+ = EnumResourceNamesA;
+#endif
+
+#if _MSC_VER < 1300
+BOOL (__stdcall * Real_EnumResourceNamesW)(HMODULE a0,
+ LPCWSTR a1,
+ ENUMRESNAMEPROC a2,
+ LONG a3)
+ = EnumResourceNamesW;
+#else
+BOOL (__stdcall * Real_EnumResourceNamesW)(HMODULE a0,
+ LPCWSTR a1,
+ ENUMRESNAMEPROCW a2,
+ LONG_PTR a3)
+ = EnumResourceNamesW;
+#endif
+
+#if _MSC_VER < 1300
+BOOL (__stdcall * Real_EnumResourceTypesA)(HMODULE a0,
+ ENUMRESTYPEPROC a1,
+ LONG a2)
+ = EnumResourceTypesA;
+#else
+BOOL (__stdcall * Real_EnumResourceTypesA)(HMODULE a0,
+ ENUMRESTYPEPROCA a1,
+ LONG_PTR a2)
+ = EnumResourceTypesA;
+#endif
+
+#if _MSC_VER < 1300
+BOOL (__stdcall * Real_EnumResourceTypesW)(HMODULE a0,
+ ENUMRESTYPEPROC a1,
+ LONG a2)
+ = EnumResourceTypesW;
+#else
+BOOL (__stdcall * Real_EnumResourceTypesW)(HMODULE a0,
+ ENUMRESTYPEPROCW a1,
+ LONG_PTR a2)
+ = EnumResourceTypesW;
+#endif
+
+BOOL (__stdcall * Real_EnumSystemCodePagesA)(CODEPAGE_ENUMPROCA a0,
+ DWORD a1)
+ = EnumSystemCodePagesA;
+
+BOOL (__stdcall * Real_EnumSystemCodePagesW)(CODEPAGE_ENUMPROCW a0,
+ DWORD a1)
+ = EnumSystemCodePagesW;
+
+#if(WINVER >= 0x0500)
+BOOL (__stdcall * Real_EnumSystemLocalesA)(LOCALE_ENUMPROCA a0,
+ DWORD a1)
+ = EnumSystemLocalesA;
+
+BOOL (__stdcall * Real_EnumSystemLocalesW)(LOCALE_ENUMPROCW a0,
+ DWORD a1)
+ = EnumSystemLocalesW;
+#endif // (WINVER >= 0x0500)
+
+BOOL (__stdcall * Real_EnumThreadWindows)(DWORD a0,
+ WNDENUMPROC a1,
+ LPARAM a2)
+ = EnumThreadWindows;
+
+BOOL (__stdcall * Real_EnumTimeFormatsA)(TIMEFMT_ENUMPROCA a0,
+ LCID a1,
+ DWORD a2)
+ = EnumTimeFormatsA;
+
+BOOL (__stdcall * Real_EnumTimeFormatsW)(TIMEFMT_ENUMPROCW a0,
+ LCID a1,
+ DWORD a2)
+ = EnumTimeFormatsW;
+
+BOOL (__stdcall * Real_EnumWindowStationsA)(WINSTAENUMPROCA a0,
+ LPARAM a1)
+ = EnumWindowStationsA;
+
+BOOL (__stdcall * Real_EnumWindowStationsW)(WINSTAENUMPROCW a0,
+ LPARAM a1)
+ = EnumWindowStationsW;
+
+BOOL (__stdcall * Real_EnumWindows)(WNDENUMPROC a0,
+ LPARAM a1)
+ = EnumWindows;
+
+BOOL (__stdcall * Real_EqualRect)(CONST RECT* a0,
+ CONST RECT* a1)
+ = EqualRect;
+
+BOOL (__stdcall * Real_EqualRgn)(HRGN a0,
+ HRGN a1)
+ = EqualRgn;
+
+DWORD (__stdcall * Real_EraseTape)(HANDLE a0,
+ DWORD a1,
+ BOOL a2)
+ = EraseTape;
+
+int (__stdcall * Real_Escape)(HDC a0,
+ int a1,
+ int a2,
+ LPCSTR a3,
+ LPVOID a4)
+ = Escape;
+
+BOOL (__stdcall * Real_EscapeCommFunction)(HANDLE a0,
+ DWORD a1)
+ = EscapeCommFunction;
+
+int (__stdcall * Real_ExcludeClipRect)(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4)
+ = ExcludeClipRect;
+
+int (__stdcall * Real_ExcludeUpdateRgn)(HDC a0,
+ HWND a1)
+ = ExcludeUpdateRgn;
+
+void (__stdcall * Real_ExitProcess)(UINT a0)
+ = ExitProcess;
+
+void (__stdcall * Real_ExitThread)(DWORD a0)
+ = ExitThread;
+
+BOOL (__stdcall * Real_ExitWindowsEx)(UINT a0,
+ DWORD a1)
+ = ExitWindowsEx;
+
+DWORD (__stdcall * Real_ExpandEnvironmentStringsA)(LPCSTR a0,
+ LPSTR a1,
+ DWORD a2)
+ = ExpandEnvironmentStringsA;
+
+DWORD (__stdcall * Real_ExpandEnvironmentStringsW)(LPCWSTR a0,
+ LPWSTR a1,
+ DWORD a2)
+ = ExpandEnvironmentStringsW;
+
+HPEN (__stdcall * Real_ExtCreatePen)(DWORD a0,
+ DWORD a1,
+ CONST LOGBRUSH* a2,
+ DWORD a3,
+ CONST DWORD* a4)
+ = ExtCreatePen;
+
+HRGN (__stdcall * Real_ExtCreateRegion)(CONST XFORM* a0,
+ DWORD a1,
+ CONST RGNDATA* a2)
+ = ExtCreateRegion;
+
+int (__stdcall * Real_ExtEscape)(HDC a0,
+ int a1,
+ int a2,
+ LPCSTR a3,
+ int a4,
+ LPSTR a5)
+ = ExtEscape;
+
+BOOL (__stdcall * Real_ExtFloodFill)(HDC a0,
+ int a1,
+ int a2,
+ COLORREF a3,
+ UINT a4)
+ = ExtFloodFill;
+
+int (__stdcall * Real_ExtSelectClipRgn)(HDC a0,
+ HRGN a1,
+ int a2)
+ = ExtSelectClipRgn;
+
+BOOL (__stdcall * Real_ExtTextOutA)(HDC a0,
+ int a1,
+ int a2,
+ UINT a3,
+ CONST RECT* a4,
+ LPCSTR a5,
+ UINT a6,
+ CONST INT* a7)
+ = ExtTextOutA;
+
+BOOL (__stdcall * Real_ExtTextOutW)(HDC a0,
+ int a1,
+ int a2,
+ UINT a3,
+ CONST RECT* a4,
+ LPCWSTR a5,
+ UINT a6,
+ CONST INT* a7)
+ = ExtTextOutW;
+
+void (__stdcall * Real_FatalAppExitA)(UINT a0,
+ LPCSTR a1)
+ = FatalAppExitA;
+
+void (__stdcall * Real_FatalAppExitW)(UINT a0,
+ LPCWSTR a1)
+ = FatalAppExitW;
+
+void (__stdcall * Real_FatalExit)(int a0)
+ = FatalExit;
+
+BOOL (__stdcall * Real_FileTimeToDosDateTime)(CONST FILETIME* a0,
+ LPWORD a1,
+ LPWORD a2)
+ = FileTimeToDosDateTime;
+
+BOOL (__stdcall * Real_FileTimeToLocalFileTime)(CONST FILETIME* a0,
+ LPFILETIME a1)
+ = FileTimeToLocalFileTime;
+
+BOOL (__stdcall * Real_FileTimeToSystemTime)(CONST FILETIME* a0,
+ LPSYSTEMTIME a1)
+ = FileTimeToSystemTime;
+
+BOOL (__stdcall * Real_FillConsoleOutputAttribute)(HANDLE a0,
+ WORD a1,
+ DWORD a2,
+ COORD a3,
+ LPDWORD a4)
+ = FillConsoleOutputAttribute;
+
+BOOL (__stdcall * Real_FillConsoleOutputCharacterA)(HANDLE a0,
+ CHAR a1,
+ DWORD a2,
+ COORD a3,
+ LPDWORD a4)
+ = FillConsoleOutputCharacterA;
+
+BOOL (__stdcall * Real_FillConsoleOutputCharacterW)(HANDLE a0,
+ WCHAR a1,
+ DWORD a2,
+ COORD a3,
+ LPDWORD a4)
+ = FillConsoleOutputCharacterW;
+
+BOOL (__stdcall * Real_FillPath)(HDC a0)
+ = FillPath;
+
+int (__stdcall * Real_FillRect)(HDC a0,
+ CONST RECT* a1,
+ HBRUSH a2)
+ = FillRect;
+
+BOOL (__stdcall * Real_FillRgn)(HDC a0,
+ HRGN a1,
+ HBRUSH a2)
+ = FillRgn;
+
+ATOM (__stdcall * Real_FindAtomA)(LPCSTR a0)
+ = FindAtomA;
+
+ATOM (__stdcall * Real_FindAtomW)(LPCWSTR a0)
+ = FindAtomW;
+
+BOOL (__stdcall * Real_FindClose)(HANDLE a0)
+ = FindClose;
+
+BOOL (__stdcall * Real_FindCloseChangeNotification)(HANDLE a0)
+ = FindCloseChangeNotification;
+
+HANDLE (__stdcall * Real_FindFirstChangeNotificationA)(LPCSTR a0,
+ BOOL a1,
+ DWORD a2)
+ = FindFirstChangeNotificationA;
+
+HANDLE (__stdcall * Real_FindFirstChangeNotificationW)(LPCWSTR a0,
+ BOOL a1,
+ DWORD a2)
+ = FindFirstChangeNotificationW;
+
+HANDLE (__stdcall * Real_FindFirstFileA)(LPCSTR a0,
+ LPWIN32_FIND_DATAA a1)
+ = FindFirstFileA;
+
+HANDLE (__stdcall * Real_FindFirstFileExA)(LPCSTR a0,
+ FINDEX_INFO_LEVELS a1,
+ LPVOID a2,
+ FINDEX_SEARCH_OPS a3,
+ LPVOID a4,
+ DWORD a5)
+ = FindFirstFileExA;
+
+HANDLE (__stdcall * Real_FindFirstFileExW)(LPCWSTR a0,
+ FINDEX_INFO_LEVELS a1,
+ LPVOID a2,
+ FINDEX_SEARCH_OPS a3,
+ LPVOID a4,
+ DWORD a5)
+ = FindFirstFileExW;
+
+HANDLE (__stdcall * Real_FindFirstFileW)(LPCWSTR a0,
+ LPWIN32_FIND_DATAW a1)
+ = FindFirstFileW;
+
+BOOL (__stdcall * Real_FindNextChangeNotification)(HANDLE a0)
+ = FindNextChangeNotification;
+
+BOOL (__stdcall * Real_FindNextFileA)(HANDLE a0,
+ LPWIN32_FIND_DATAA a1)
+ = FindNextFileA;
+
+BOOL (__stdcall * Real_FindNextFileW)(HANDLE a0,
+ LPWIN32_FIND_DATAW a1)
+ = FindNextFileW;
+
+HRSRC (__stdcall * Real_FindResourceA)(HMODULE a0,
+ LPCSTR a1,
+ LPCSTR a2)
+ = FindResourceA;
+
+HRSRC (__stdcall * Real_FindResourceExA)(HMODULE a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ WORD a3)
+ = FindResourceExA;
+
+HRSRC (__stdcall * Real_FindResourceExW)(HMODULE a0,
+ LPCWSTR a1,
+ LPCWSTR a2,
+ WORD a3)
+ = FindResourceExW;
+
+HRSRC (__stdcall * Real_FindResourceW)(HMODULE a0,
+ LPCWSTR a1,
+ LPCWSTR a2)
+ = FindResourceW;
+
+HWND (__stdcall * Real_FindWindowA)(LPCSTR a0,
+ LPCSTR a1)
+ = FindWindowA;
+
+HWND (__stdcall * Real_FindWindowExA)(HWND a0,
+ HWND a1,
+ LPCSTR a2,
+ LPCSTR a3)
+ = FindWindowExA;
+
+HWND (__stdcall * Real_FindWindowExW)(HWND a0,
+ HWND a1,
+ LPCWSTR a2,
+ LPCWSTR a3)
+ = FindWindowExW;
+
+HWND (__stdcall * Real_FindWindowW)(LPCWSTR a0,
+ LPCWSTR a1)
+ = FindWindowW;
+
+BOOL (__stdcall * Real_FixBrushOrgEx)(HDC a0,
+ int a1,
+ int a2,
+ POINT* a3)
+ = FixBrushOrgEx;
+
+BOOL (__stdcall * Real_FlashWindow)(HWND a0,
+ BOOL a1)
+ = FlashWindow;
+
+BOOL (__stdcall * Real_FlattenPath)(HDC a0)
+ = FlattenPath;
+
+BOOL (__stdcall * Real_FloodFill)(HDC a0,
+ int a1,
+ int a2,
+ COLORREF a3)
+ = FloodFill;
+
+BOOL (__stdcall * Real_FlushConsoleInputBuffer)(HANDLE a0)
+ = FlushConsoleInputBuffer;
+
+BOOL (__stdcall * Real_FlushFileBuffers)(HANDLE a0)
+ = FlushFileBuffers;
+
+BOOL (__stdcall * Real_FlushViewOfFile)(LPCVOID a0,
+ SIZE_T a1)
+ = FlushViewOfFile;
+
+HRESULT (__stdcall * Real_FmtIdToPropStgName)(CONST FMTID* a0,
+ LPOLESTR a1)
+ = FmtIdToPropStgName;
+
+int (__stdcall * Real_FoldStringA)(DWORD a0,
+ LPCSTR a1,
+ int a2,
+ LPSTR a3,
+ int a4)
+ = FoldStringA;
+
+int (__stdcall * Real_FoldStringW)(DWORD a0,
+ LPCWSTR a1,
+ int a2,
+ LPWSTR a3,
+ int a4)
+ = FoldStringW;
+
+DWORD (__stdcall * Real_FormatMessageA)(DWORD a0,
+ LPCVOID a1,
+ DWORD a2,
+ DWORD a3,
+ LPSTR a4,
+ DWORD a5,
+ va_list* a6)
+ = FormatMessageA;
+
+DWORD (__stdcall * Real_FormatMessageW)(DWORD a0,
+ LPCVOID a1,
+ DWORD a2,
+ DWORD a3,
+ LPWSTR a4,
+ DWORD a5,
+ va_list* a6)
+ = FormatMessageW;
+
+int (__stdcall * Real_FrameRect)(HDC a0,
+ CONST RECT* a1,
+ HBRUSH a2)
+ = FrameRect;
+
+BOOL (__stdcall * Real_FrameRgn)(HDC a0,
+ HRGN a1,
+ HBRUSH a2,
+ int a3,
+ int a4)
+ = FrameRgn;
+
+BOOL (__stdcall * Real_FreeConsole)(void)
+ = FreeConsole;
+
+BOOL (__stdcall * Real_FreeDDElParam)(UINT a0,
+ LPARAM a1)
+ = FreeDDElParam;
+
+BOOL (__stdcall * Real_FreeEnvironmentStringsA)(LPSTR a0)
+ = FreeEnvironmentStringsA;
+
+BOOL (__stdcall * Real_FreeEnvironmentStringsW)(LPWSTR a0)
+ = FreeEnvironmentStringsW;
+
+BOOL (__stdcall * Real_FreeLibrary)(HMODULE a0)
+ = FreeLibrary;
+
+void (__stdcall * Real_FreeLibraryAndExitThread)(HMODULE a0,
+ DWORD a1)
+ = FreeLibraryAndExitThread;
+
+HRESULT (__stdcall * Real_FreePropVariantArray)(ULONG a0,
+ PROPVARIANT* a1)
+ = FreePropVariantArray;
+
+BOOL (__stdcall * Real_FreeResource)(HGLOBAL a0)
+ = FreeResource;
+
+BOOL (__stdcall * Real_GdiComment)(HDC a0,
+ UINT a1,
+ CONST BYTE* a2)
+ = GdiComment;
+
+BOOL (__stdcall * Real_GdiFlush)(void)
+ = GdiFlush;
+
+DWORD (__stdcall * Real_GdiGetBatchLimit)(void)
+ = GdiGetBatchLimit;
+
+DWORD (__stdcall * Real_GdiSetBatchLimit)(DWORD a0)
+ = GdiSetBatchLimit;
+
+BOOL (__stdcall * Real_GenerateConsoleCtrlEvent)(DWORD a0,
+ DWORD a1)
+ = GenerateConsoleCtrlEvent;
+
+UINT (__stdcall * Real_GetACP)(void)
+ = GetACP;
+
+HWND (__stdcall * Real_GetActiveWindow)(void)
+ = GetActiveWindow;
+
+int (__stdcall * Real_GetArcDirection)(HDC a0)
+ = GetArcDirection;
+
+BOOL (__stdcall * Real_GetAspectRatioFilterEx)(HDC a0,
+ SIZE* a1)
+ = GetAspectRatioFilterEx;
+
+SHORT (__stdcall * Real_GetAsyncKeyState)(int a0)
+ = GetAsyncKeyState;
+
+UINT (__stdcall * Real_GetAtomNameA)(ATOM a0,
+ LPSTR a1,
+ int a2)
+ = GetAtomNameA;
+
+UINT (__stdcall * Real_GetAtomNameW)(ATOM a0,
+ LPWSTR a1,
+ int a2)
+ = GetAtomNameW;
+
+BOOL (__stdcall * Real_GetBinaryTypeA)(LPCSTR a0,
+ LPDWORD a1)
+ = GetBinaryTypeA;
+
+BOOL (__stdcall * Real_GetBinaryTypeW)(LPCWSTR a0,
+ LPDWORD a1)
+ = GetBinaryTypeW;
+
+LONG (__stdcall * Real_GetBitmapBits)(HBITMAP a0,
+ LONG a1,
+ LPVOID a2)
+ = GetBitmapBits;
+
+BOOL (__stdcall * Real_GetBitmapDimensionEx)(HBITMAP a0,
+ SIZE* a1)
+ = GetBitmapDimensionEx;
+
+COLORREF (__stdcall * Real_GetBkColor)(HDC a0)
+ = GetBkColor;
+
+int (__stdcall * Real_GetBkMode)(HDC a0)
+ = GetBkMode;
+
+UINT (__stdcall * Real_GetBoundsRect)(HDC a0,
+ LPRECT a1,
+ UINT a2)
+ = GetBoundsRect;
+
+BOOL (__stdcall * Real_GetBrushOrgEx)(HDC a0,
+ POINT* a1)
+ = GetBrushOrgEx;
+
+BOOL (__stdcall * Real_GetCPInfo)(UINT a0,
+ LPCPINFO a1)
+ = GetCPInfo;
+
+HWND (__stdcall * Real_GetCapture)(void)
+ = GetCapture;
+
+UINT (__stdcall * Real_GetCaretBlinkTime)(void)
+ = GetCaretBlinkTime;
+
+BOOL (__stdcall * Real_GetCaretPos)(POINT* a0)
+ = GetCaretPos;
+
+BOOL (__stdcall * Real_GetCharABCWidthsA)(HDC a0,
+ UINT a1,
+ UINT a2,
+ LPABC a3)
+ = GetCharABCWidthsA;
+
+BOOL (__stdcall * Real_GetCharABCWidthsFloatA)(HDC a0,
+ UINT a1,
+ UINT a2,
+ LPABCFLOAT a3)
+ = GetCharABCWidthsFloatA;
+
+BOOL (__stdcall * Real_GetCharABCWidthsFloatW)(HDC a0,
+ UINT a1,
+ UINT a2,
+ LPABCFLOAT a3)
+ = GetCharABCWidthsFloatW;
+
+BOOL (__stdcall * Real_GetCharABCWidthsW)(HDC a0,
+ UINT a1,
+ UINT a2,
+ LPABC a3)
+ = GetCharABCWidthsW;
+
+BOOL (__stdcall * Real_GetCharWidth32A)(HDC a0,
+ UINT a1,
+ UINT a2,
+ LPINT a3)
+ = GetCharWidth32A;
+
+BOOL (__stdcall * Real_GetCharWidth32W)(HDC a0,
+ UINT a1,
+ UINT a2,
+ LPINT a3)
+ = GetCharWidth32W;
+
+BOOL (__stdcall * Real_GetCharWidthA)(HDC a0,
+ UINT a1,
+ UINT a2,
+ LPINT a3)
+ = GetCharWidthA;
+
+BOOL (__stdcall * Real_GetCharWidthFloatA)(HDC a0,
+ UINT a1,
+ UINT a2,
+ PFLOAT a3)
+ = GetCharWidthFloatA;
+
+BOOL (__stdcall * Real_GetCharWidthFloatW)(HDC a0,
+ UINT a1,
+ UINT a2,
+ PFLOAT a3)
+ = GetCharWidthFloatW;
+
+BOOL (__stdcall * Real_GetCharWidthW)(HDC a0,
+ UINT a1,
+ UINT a2,
+ LPINT a3)
+ = GetCharWidthW;
+
+DWORD (__stdcall * Real_GetCharacterPlacementA)(HDC a0,
+ LPCSTR a1,
+ int a2,
+ int a3,
+ LPGCP_RESULTSA a4,
+ DWORD a5)
+ = GetCharacterPlacementA;
+
+DWORD (__stdcall * Real_GetCharacterPlacementW)(HDC a0,
+ LPCWSTR a1,
+ int a2,
+ int a3,
+ LPGCP_RESULTSW a4,
+ DWORD a5)
+ = GetCharacterPlacementW;
+
+HRESULT (__stdcall * Real_GetClassFile)(LPCOLESTR a0,
+ CLSID* a1)
+ = GetClassFile;
+
+BOOL (__stdcall * Real_GetClassInfoA)(HINSTANCE a0,
+ LPCSTR a1,
+ LPWNDCLASSA a2)
+ = GetClassInfoA;
+
+BOOL (__stdcall * Real_GetClassInfoExA)(HINSTANCE a0,
+ LPCSTR a1,
+ LPWNDCLASSEXA a2)
+ = GetClassInfoExA;
+
+BOOL (__stdcall * Real_GetClassInfoExW)(HINSTANCE a0,
+ LPCWSTR a1,
+ LPWNDCLASSEXW a2)
+ = GetClassInfoExW;
+
+BOOL (__stdcall * Real_GetClassInfoW)(HINSTANCE a0,
+ LPCWSTR a1,
+ LPWNDCLASSW a2)
+ = GetClassInfoW;
+
+DWORD (__stdcall * Real_GetClassLongA)(HWND a0,
+ int a1)
+ = GetClassLongA;
+
+DWORD (__stdcall * Real_GetClassLongW)(HWND a0,
+ int a1)
+ = GetClassLongW;
+
+int (__stdcall * Real_GetClassNameA)(HWND a0,
+ LPSTR a1,
+ int a2)
+ = GetClassNameA;
+
+int (__stdcall * Real_GetClassNameW)(HWND a0,
+ LPWSTR a1,
+ int a2)
+ = GetClassNameW;
+
+WORD (__stdcall * Real_GetClassWord)(HWND a0,
+ int a1)
+ = GetClassWord;
+
+BOOL (__stdcall * Real_GetClientRect)(HWND a0,
+ LPRECT a1)
+ = GetClientRect;
+
+int (__stdcall * Real_GetClipBox)(HDC a0,
+ LPRECT a1)
+ = GetClipBox;
+
+BOOL (__stdcall * Real_GetClipCursor)(LPRECT a0)
+ = GetClipCursor;
+
+int (__stdcall * Real_GetClipRgn)(HDC a0,
+ HRGN a1)
+ = GetClipRgn;
+
+HANDLE (__stdcall * Real_GetClipboardData)(UINT a0)
+ = GetClipboardData;
+
+int (__stdcall * Real_GetClipboardFormatNameA)(UINT a0,
+ LPSTR a1,
+ int a2)
+ = GetClipboardFormatNameA;
+
+int (__stdcall * Real_GetClipboardFormatNameW)(UINT a0,
+ LPWSTR a1,
+ int a2)
+ = GetClipboardFormatNameW;
+
+HWND (__stdcall * Real_GetClipboardOwner)(void)
+ = GetClipboardOwner;
+
+HWND (__stdcall * Real_GetClipboardViewer)(void)
+ = GetClipboardViewer;
+
+BOOL (__stdcall * Real_GetColorAdjustment)(HDC a0,
+ LPCOLORADJUSTMENT a1)
+ = GetColorAdjustment;
+
+HCOLORSPACE (__stdcall * Real_GetColorSpace)(HDC a0)
+ = GetColorSpace;
+
+BOOL (__stdcall * Real_GetCommConfig)(HANDLE a0,
+ LPCOMMCONFIG a1,
+ LPDWORD a2)
+ = GetCommConfig;
+
+BOOL (__stdcall * Real_GetCommMask)(HANDLE a0,
+ LPDWORD a1)
+ = GetCommMask;
+
+BOOL (__stdcall * Real_GetCommModemStatus)(HANDLE a0,
+ LPDWORD a1)
+ = GetCommModemStatus;
+
+BOOL (__stdcall * Real_GetCommProperties)(HANDLE a0,
+ LPCOMMPROP a1)
+ = GetCommProperties;
+
+BOOL (__stdcall * Real_GetCommState)(HANDLE a0,
+ LPDCB a1)
+ = GetCommState;
+
+BOOL (__stdcall * Real_GetCommTimeouts)(HANDLE a0,
+ LPCOMMTIMEOUTS a1)
+ = GetCommTimeouts;
+
+LPSTR (__stdcall * Real_GetCommandLineA)(void)
+ = GetCommandLineA;
+
+LPWSTR (__stdcall * Real_GetCommandLineW)(void)
+ = GetCommandLineW;
+
+BOOL (__stdcall * Real_GetComputerNameA)(LPSTR a0,
+ LPDWORD a1)
+ = GetComputerNameA;
+
+BOOL (__stdcall * Real_GetComputerNameW)(LPWSTR a0,
+ LPDWORD a1)
+ = GetComputerNameW;
+
+UINT (__stdcall * Real_GetConsoleCP)(void)
+ = GetConsoleCP;
+
+BOOL (__stdcall * Real_GetConsoleCursorInfo)(HANDLE a0,
+ PCONSOLE_CURSOR_INFO a1)
+ = GetConsoleCursorInfo;
+
+BOOL (__stdcall * Real_GetConsoleMode)(HANDLE a0,
+ LPDWORD a1)
+ = GetConsoleMode;
+
+UINT (__stdcall * Real_GetConsoleOutputCP)(void)
+ = GetConsoleOutputCP;
+
+BOOL (__stdcall * Real_GetConsoleScreenBufferInfo)(HANDLE a0,
+ PCONSOLE_SCREEN_BUFFER_INFO a1)
+ = GetConsoleScreenBufferInfo;
+
+DWORD (__stdcall * Real_GetConsoleTitleA)(LPSTR a0,
+ DWORD a1)
+ = GetConsoleTitleA;
+
+DWORD (__stdcall * Real_GetConsoleTitleW)(LPWSTR a0,
+ DWORD a1)
+ = GetConsoleTitleW;
+
+HRESULT (__stdcall * Real_GetConvertStg)(IStorage* a0)
+ = GetConvertStg;
+
+int (__stdcall * Real_GetCurrencyFormatA)(LCID a0,
+ DWORD a1,
+ LPCSTR a2,
+ CONST CURRENCYFMTA* a3,
+ LPSTR a4,
+ int a5)
+ = GetCurrencyFormatA;
+
+int (__stdcall * Real_GetCurrencyFormatW)(LCID a0,
+ DWORD a1,
+ LPCWSTR a2,
+ CONST CURRENCYFMTW* a3,
+ LPWSTR a4,
+ int a5)
+ = GetCurrencyFormatW;
+
+DWORD (__stdcall * Real_GetCurrentDirectoryA)(DWORD a0,
+ LPSTR a1)
+ = GetCurrentDirectoryA;
+
+DWORD (__stdcall * Real_GetCurrentDirectoryW)(DWORD a0,
+ LPWSTR a1)
+ = GetCurrentDirectoryW;
+
+HGDIOBJ (__stdcall * Real_GetCurrentObject)(HDC a0,
+ UINT a1)
+ = GetCurrentObject;
+
+BOOL (__stdcall * Real_GetCurrentPositionEx)(HDC a0,
+ POINT* a1)
+ = GetCurrentPositionEx;
+
+HANDLE (__stdcall * Real_GetCurrentProcess)(void)
+ = GetCurrentProcess;
+
+DWORD (__stdcall * Real_GetCurrentProcessId)(void)
+ = GetCurrentProcessId;
+
+DWORD (__stdcall * Real_GetCurrentThreadId)(void)
+ = GetCurrentThreadId;
+
+HCURSOR (__stdcall * Real_GetCursor)(void)
+ = GetCursor;
+
+BOOL (__stdcall * Real_GetCursorPos)(POINT* a0)
+ = GetCursorPos;
+
+HDC (__stdcall * Real_GetDC)(HWND a0)
+ = GetDC;
+
+HDC (__stdcall * Real_GetDCEx)(HWND a0,
+ HRGN a1,
+ DWORD a2)
+ = GetDCEx;
+
+BOOL (__stdcall * Real_GetDCOrgEx)(HDC a0,
+ POINT* a1)
+ = GetDCOrgEx;
+
+UINT (__stdcall * Real_GetDIBColorTable)(HDC a0,
+ UINT a1,
+ UINT a2,
+ RGBQUAD* a3)
+ = GetDIBColorTable;
+
+int (__stdcall * Real_GetDIBits)(HDC a0,
+ HBITMAP a1,
+ UINT a2,
+ UINT a3,
+ LPVOID a4,
+ LPBITMAPINFO a5,
+ UINT a6)
+ = GetDIBits;
+
+int (__stdcall * Real_GetDateFormatA)(LCID a0,
+ DWORD a1,
+ CONST SYSTEMTIME* a2,
+ LPCSTR a3,
+ LPSTR a4,
+ int a5)
+ = GetDateFormatA;
+
+int (__stdcall * Real_GetDateFormatW)(LCID a0,
+ DWORD a1,
+ CONST SYSTEMTIME* a2,
+ LPCWSTR a3,
+ LPWSTR a4,
+ int a5)
+ = GetDateFormatW;
+
+BOOL (__stdcall * Real_GetDefaultCommConfigA)(LPCSTR a0,
+ LPCOMMCONFIG a1,
+ LPDWORD a2)
+ = GetDefaultCommConfigA;
+
+BOOL (__stdcall * Real_GetDefaultCommConfigW)(LPCWSTR a0,
+ LPCOMMCONFIG a1,
+ LPDWORD a2)
+ = GetDefaultCommConfigW;
+
+HWND (__stdcall * Real_GetDesktopWindow)(void)
+ = GetDesktopWindow;
+
+int (__stdcall * Real_GetDeviceCaps)(HDC a0,
+ int a1)
+ = GetDeviceCaps;
+
+BOOL (__stdcall * Real_GetDeviceGammaRamp)(HDC a0,
+ LPVOID a1)
+ = GetDeviceGammaRamp;
+
+long (__stdcall * Real_GetDialogBaseUnits)(void)
+ = GetDialogBaseUnits;
+
+BOOL (__stdcall * Real_GetDiskFreeSpaceA)(LPCSTR a0,
+ LPDWORD a1,
+ LPDWORD a2,
+ LPDWORD a3,
+ LPDWORD a4)
+ = GetDiskFreeSpaceA;
+
+BOOL (__stdcall * Real_GetDiskFreeSpaceExA)(LPCSTR a0,
+ union _ULARGE_INTEGER* a1,
+ union _ULARGE_INTEGER* a2,
+ union _ULARGE_INTEGER* a3)
+ = GetDiskFreeSpaceExA;
+
+BOOL (__stdcall * Real_GetDiskFreeSpaceExW)(LPCWSTR a0,
+ union _ULARGE_INTEGER* a1,
+ union _ULARGE_INTEGER* a2,
+ union _ULARGE_INTEGER* a3)
+ = GetDiskFreeSpaceExW;
+
+BOOL (__stdcall * Real_GetDiskFreeSpaceW)(LPCWSTR a0,
+ LPDWORD a1,
+ LPDWORD a2,
+ LPDWORD a3,
+ LPDWORD a4)
+ = GetDiskFreeSpaceW;
+
+int (__stdcall * Real_GetDlgCtrlID)(HWND a0)
+ = GetDlgCtrlID;
+
+HWND (__stdcall * Real_GetDlgItem)(HWND a0,
+ int a1)
+ = GetDlgItem;
+
+UINT (__stdcall * Real_GetDlgItemInt)(HWND a0,
+ int a1,
+ BOOL* a2,
+ BOOL a3)
+ = GetDlgItemInt;
+
+UINT (__stdcall * Real_GetDlgItemTextA)(HWND a0,
+ int a1,
+ LPSTR a2,
+ int a3)
+ = GetDlgItemTextA;
+
+UINT (__stdcall * Real_GetDlgItemTextW)(HWND a0,
+ int a1,
+ LPWSTR a2,
+ int a3)
+ = GetDlgItemTextW;
+
+UINT (__stdcall * Real_GetDoubleClickTime)(void)
+ = GetDoubleClickTime;
+
+UINT (__stdcall * Real_GetDriveTypeA)(LPCSTR a0)
+ = GetDriveTypeA;
+
+UINT (__stdcall * Real_GetDriveTypeW)(LPCWSTR a0)
+ = GetDriveTypeW;
+
+HENHMETAFILE (__stdcall * Real_GetEnhMetaFileA)(LPCSTR a0)
+ = GetEnhMetaFileA;
+
+UINT (__stdcall * Real_GetEnhMetaFileBits)(HENHMETAFILE a0,
+ UINT a1,
+ LPBYTE a2)
+ = GetEnhMetaFileBits;
+
+UINT (__stdcall * Real_GetEnhMetaFileDescriptionA)(HENHMETAFILE a0,
+ UINT a1,
+ LPSTR a2)
+ = GetEnhMetaFileDescriptionA;
+
+UINT (__stdcall * Real_GetEnhMetaFileDescriptionW)(HENHMETAFILE a0,
+ UINT a1,
+ LPWSTR a2)
+ = GetEnhMetaFileDescriptionW;
+
+UINT (__stdcall * Real_GetEnhMetaFileHeader)(HENHMETAFILE a0,
+ UINT a1,
+ ENHMETAHEADER* a2)
+ = GetEnhMetaFileHeader;
+
+UINT (__stdcall * Real_GetEnhMetaFilePaletteEntries)(HENHMETAFILE a0,
+ UINT a1,
+ PALETTEENTRY* a2)
+ = GetEnhMetaFilePaletteEntries;
+
+UINT (__stdcall * Real_GetEnhMetaFilePixelFormat)(HENHMETAFILE a0,
+ UINT a1,
+ PIXELFORMATDESCRIPTOR* a2)
+ = GetEnhMetaFilePixelFormat;
+
+HENHMETAFILE (__stdcall * Real_GetEnhMetaFileW)(LPCWSTR a0)
+ = GetEnhMetaFileW;
+
+#undef GetEnvironmentStrings
+
+LPSTR (__stdcall * Real_GetEnvironmentStrings)(void)
+ = GetEnvironmentStrings;
+
+LPWSTR (__stdcall * Real_GetEnvironmentStringsW)(void)
+ = GetEnvironmentStringsW;
+
+DWORD (__stdcall * Real_GetEnvironmentVariableA)(LPCSTR a0,
+ LPSTR a1,
+ DWORD a2)
+ = GetEnvironmentVariableA;
+
+DWORD (__stdcall * Real_GetEnvironmentVariableW)(LPCWSTR a0,
+ LPWSTR a1,
+ DWORD a2)
+ = GetEnvironmentVariableW;
+
+BOOL (__stdcall * Real_GetExitCodeProcess)(HANDLE a0,
+ LPDWORD a1)
+ = GetExitCodeProcess;
+
+BOOL (__stdcall * Real_GetExitCodeThread)(HANDLE a0,
+ LPDWORD a1)
+ = GetExitCodeThread;
+
+DWORD (__stdcall * Real_GetFileAttributesA)(LPCSTR a0)
+ = GetFileAttributesA;
+
+BOOL (__stdcall * Real_GetFileAttributesExA)(LPCSTR a0,
+ enum _GET_FILEEX_INFO_LEVELS a1,
+ LPVOID a2)
+ = GetFileAttributesExA;
+
+BOOL (__stdcall * Real_GetFileAttributesExW)(LPCWSTR a0,
+ enum _GET_FILEEX_INFO_LEVELS a1,
+ LPVOID a2)
+ = GetFileAttributesExW;
+
+DWORD (__stdcall * Real_GetFileAttributesW)(LPCWSTR a0)
+ = GetFileAttributesW;
+
+BOOL (__stdcall * Real_GetFileInformationByHandle)(HANDLE a0,
+ LPBY_HANDLE_FILE_INFORMATION a1)
+ = GetFileInformationByHandle;
+
+DWORD (__stdcall * Real_GetFileSize)(HANDLE a0,
+ LPDWORD a1)
+ = GetFileSize;
+
+BOOL (__stdcall * Real_GetFileTime)(HANDLE a0,
+ LPFILETIME a1,
+ LPFILETIME a2,
+ LPFILETIME a3)
+ = GetFileTime;
+
+DWORD (__stdcall * Real_GetFileType)(HANDLE a0)
+ = GetFileType;
+
+HWND (__stdcall * Real_GetFocus)(void)
+ = GetFocus;
+
+DWORD (__stdcall * Real_GetFontData)(HDC a0,
+ DWORD a1,
+ DWORD a2,
+ LPVOID a3,
+ DWORD a4)
+ = GetFontData;
+
+DWORD (__stdcall * Real_GetFontLanguageInfo)(HDC a0)
+ = GetFontLanguageInfo;
+
+HWND (__stdcall * Real_GetForegroundWindow)(void)
+ = GetForegroundWindow;
+
+DWORD (__stdcall * Real_GetFullPathNameA)(LPCSTR a0,
+ DWORD a1,
+ LPSTR a2,
+ LPSTR* a3)
+ = GetFullPathNameA;
+
+DWORD (__stdcall * Real_GetFullPathNameW)(LPCWSTR a0,
+ DWORD a1,
+ LPWSTR a2,
+ LPWSTR* a3)
+ = GetFullPathNameW;
+
+DWORD (__stdcall * Real_GetGlyphOutlineA)(HDC a0,
+ UINT a1,
+ UINT a2,
+ LPGLYPHMETRICS a3,
+ DWORD a4,
+ LPVOID a5,
+ CONST MAT2* a6)
+ = GetGlyphOutlineA;
+
+DWORD (__stdcall * Real_GetGlyphOutlineW)(HDC a0,
+ UINT a1,
+ UINT a2,
+ LPGLYPHMETRICS a3,
+ DWORD a4,
+ LPVOID a5,
+ CONST MAT2* a6)
+ = GetGlyphOutlineW;
+
+int (__stdcall * Real_GetGraphicsMode)(HDC a0)
+ = GetGraphicsMode;
+
+HRESULT (__stdcall * Real_GetHGlobalFromILockBytes)(ILockBytes* a0,
+ HGLOBAL* a1)
+ = GetHGlobalFromILockBytes;
+
+HRESULT (__stdcall * Real_GetHGlobalFromStream)(LPSTREAM a0,
+ HGLOBAL* a1)
+ = GetHGlobalFromStream;
+
+BOOL (__stdcall * Real_GetHandleInformation)(HANDLE a0,
+ LPDWORD a1)
+ = GetHandleInformation;
+
+BOOL (__stdcall * Real_GetICMProfileA)(HDC a0,
+ LPDWORD a1,
+ LPSTR a2)
+ = GetICMProfileA;
+
+BOOL (__stdcall * Real_GetICMProfileW)(HDC a0,
+ LPDWORD a1,
+ LPWSTR a2)
+ = GetICMProfileW;
+
+BOOL (__stdcall * Real_GetIconInfo)(HICON a0,
+ PICONINFO a1)
+ = GetIconInfo;
+
+BOOL (__stdcall * Real_GetInputState)(void)
+ = GetInputState;
+
+UINT (__stdcall * Real_GetKBCodePage)(void)
+ = GetKBCodePage;
+
+DWORD (__stdcall * Real_GetKerningPairsA)(HDC a0,
+ DWORD a1,
+ KERNINGPAIR* a2)
+ = GetKerningPairsA;
+
+DWORD (__stdcall * Real_GetKerningPairsW)(HDC a0,
+ DWORD a1,
+ KERNINGPAIR* a2)
+ = GetKerningPairsW;
+
+int (__stdcall * Real_GetKeyNameTextA)(LONG a0,
+ LPSTR a1,
+ int a2)
+ = GetKeyNameTextA;
+
+int (__stdcall * Real_GetKeyNameTextW)(LONG a0,
+ LPWSTR a1,
+ int a2)
+ = GetKeyNameTextW;
+
+SHORT (__stdcall * Real_GetKeyState)(int a0)
+ = GetKeyState;
+
+HKL (__stdcall * Real_GetKeyboardLayout)(DWORD a0)
+ = GetKeyboardLayout;
+
+int (__stdcall * Real_GetKeyboardLayoutList)(int a0,
+ HKL* a1)
+ = GetKeyboardLayoutList;
+
+BOOL (__stdcall * Real_GetKeyboardLayoutNameA)(LPSTR a0)
+ = GetKeyboardLayoutNameA;
+
+BOOL (__stdcall * Real_GetKeyboardLayoutNameW)(LPWSTR a0)
+ = GetKeyboardLayoutNameW;
+
+BOOL (__stdcall * Real_GetKeyboardState)(PBYTE a0)
+ = GetKeyboardState;
+
+int (__stdcall * Real_GetKeyboardType)(int a0)
+ = GetKeyboardType;
+
+HWND (__stdcall * Real_GetLastActivePopup)(HWND a0)
+ = GetLastActivePopup;
+
+void (__stdcall * Real_GetLocalTime)(LPSYSTEMTIME a0)
+ = GetLocalTime;
+
+int (__stdcall * Real_GetLocaleInfoA)(LCID a0,
+ LCTYPE a1,
+ LPSTR a2,
+ int a3)
+ = GetLocaleInfoA;
+
+int (__stdcall * Real_GetLocaleInfoW)(LCID a0,
+ LCTYPE a1,
+ LPWSTR a2,
+ int a3)
+ = GetLocaleInfoW;
+
+BOOL (__stdcall * Real_GetLogColorSpaceA)(HCOLORSPACE a0,
+ LOGCOLORSPACEA* a1,
+ DWORD a2)
+ = GetLogColorSpaceA;
+
+BOOL (__stdcall * Real_GetLogColorSpaceW)(HCOLORSPACE a0,
+ LOGCOLORSPACEW* a1,
+ DWORD a2)
+ = GetLogColorSpaceW;
+
+DWORD (__stdcall * Real_GetLogicalDriveStringsA)(DWORD a0,
+ LPSTR a1)
+ = GetLogicalDriveStringsA;
+
+DWORD (__stdcall * Real_GetLogicalDriveStringsW)(DWORD a0,
+ LPWSTR a1)
+ = GetLogicalDriveStringsW;
+
+DWORD (__stdcall * Real_GetLogicalDrives)(void)
+ = GetLogicalDrives;
+
+BOOL (__stdcall * Real_GetMailslotInfo)(HANDLE a0,
+ LPDWORD a1,
+ LPDWORD a2,
+ LPDWORD a3,
+ LPDWORD a4)
+ = GetMailslotInfo;
+
+int (__stdcall * Real_GetMapMode)(HDC a0)
+ = GetMapMode;
+
+HMENU (__stdcall * Real_GetMenu)(HWND a0)
+ = GetMenu;
+
+LONG (__stdcall * Real_GetMenuCheckMarkDimensions)(void)
+ = GetMenuCheckMarkDimensions;
+
+DWORD (__stdcall * Real_GetMenuContextHelpId)(HMENU a0)
+ = GetMenuContextHelpId;
+
+UINT (__stdcall * Real_GetMenuDefaultItem)(HMENU a0,
+ UINT a1,
+ UINT a2)
+ = GetMenuDefaultItem;
+
+int (__stdcall * Real_GetMenuItemCount)(HMENU a0)
+ = GetMenuItemCount;
+
+UINT (__stdcall * Real_GetMenuItemID)(HMENU a0,
+ int a1)
+ = GetMenuItemID;
+
+BOOL (__stdcall * Real_GetMenuItemInfoA)(HMENU a0,
+ UINT a1,
+ BOOL a2,
+ LPMENUITEMINFOA a3)
+ = GetMenuItemInfoA;
+
+BOOL (__stdcall * Real_GetMenuItemInfoW)(HMENU a0,
+ UINT a1,
+ BOOL a2,
+ LPMENUITEMINFOW a3)
+ = GetMenuItemInfoW;
+
+BOOL (__stdcall * Real_GetMenuItemRect)(HWND a0,
+ HMENU a1,
+ UINT a2,
+ LPRECT a3)
+ = GetMenuItemRect;
+
+UINT (__stdcall * Real_GetMenuState)(HMENU a0,
+ UINT a1,
+ UINT a2)
+ = GetMenuState;
+
+int (__stdcall * Real_GetMenuStringA)(HMENU a0,
+ UINT a1,
+ LPSTR a2,
+ int a3,
+ UINT a4)
+ = GetMenuStringA;
+
+int (__stdcall * Real_GetMenuStringW)(HMENU a0,
+ UINT a1,
+ LPWSTR a2,
+ int a3,
+ UINT a4)
+ = GetMenuStringW;
+
+BOOL (__stdcall * Real_GetMessageA)(LPMSG a0,
+ HWND a1,
+ UINT a2,
+ UINT a3)
+ = GetMessageA;
+
+LPARAM (__stdcall * Real_GetMessageExtraInfo)(void)
+ = GetMessageExtraInfo;
+
+DWORD (__stdcall * Real_GetMessagePos)(void)
+ = GetMessagePos;
+
+LONG (__stdcall * Real_GetMessageTime)(void)
+ = GetMessageTime;
+
+BOOL (__stdcall * Real_GetMessageW)(LPMSG a0,
+ HWND a1,
+ UINT a2,
+ UINT a3)
+ = GetMessageW;
+
+HMETAFILE (__stdcall * Real_GetMetaFileA)(LPCSTR a0)
+ = GetMetaFileA;
+
+UINT (__stdcall * Real_GetMetaFileBitsEx)(HMETAFILE a0,
+ UINT a1,
+ LPVOID a2)
+ = GetMetaFileBitsEx;
+
+HMETAFILE (__stdcall * Real_GetMetaFileW)(LPCWSTR a0)
+ = GetMetaFileW;
+
+int (__stdcall * Real_GetMetaRgn)(HDC a0,
+ HRGN a1)
+ = GetMetaRgn;
+
+BOOL (__stdcall * Real_GetMiterLimit)(HDC a0,
+ PFLOAT a1)
+ = GetMiterLimit;
+
+DWORD (__stdcall * Real_GetModuleFileNameA)(HMODULE a0,
+ LPSTR a1,
+ DWORD a2)
+ = GetModuleFileNameA;
+
+DWORD (__stdcall * Real_GetModuleFileNameW)(HMODULE a0,
+ LPWSTR a1,
+ DWORD a2)
+ = GetModuleFileNameW;
+
+HMODULE (__stdcall * Real_GetModuleHandleA)(LPCSTR a0)
+ = GetModuleHandleA;
+
+HMODULE (__stdcall * Real_GetModuleHandleW)(LPCWSTR a0)
+ = GetModuleHandleW;
+
+BOOL (__stdcall * Real_GetNamedPipeHandleStateA)(HANDLE a0,
+ LPDWORD a1,
+ LPDWORD a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPSTR a5,
+ DWORD a6)
+ = GetNamedPipeHandleStateA;
+
+BOOL (__stdcall * Real_GetNamedPipeHandleStateW)(HANDLE a0,
+ LPDWORD a1,
+ LPDWORD a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPWSTR a5,
+ DWORD a6)
+ = GetNamedPipeHandleStateW;
+
+BOOL (__stdcall * Real_GetNamedPipeInfo)(HANDLE a0,
+ LPDWORD a1,
+ LPDWORD a2,
+ LPDWORD a3,
+ LPDWORD a4)
+ = GetNamedPipeInfo;
+
+COLORREF (__stdcall * Real_GetNearestColor)(HDC a0,
+ COLORREF a1)
+ = GetNearestColor;
+
+UINT (__stdcall * Real_GetNearestPaletteIndex)(HPALETTE a0,
+ COLORREF a1)
+ = GetNearestPaletteIndex;
+
+HWND (__stdcall * Real_GetNextDlgGroupItem)(HWND a0,
+ HWND a1,
+ BOOL a2)
+ = GetNextDlgGroupItem;
+
+HWND (__stdcall * Real_GetNextDlgTabItem)(HWND a0,
+ HWND a1,
+ BOOL a2)
+ = GetNextDlgTabItem;
+
+int (__stdcall * Real_GetNumberFormatA)(LCID a0,
+ DWORD a1,
+ LPCSTR a2,
+ CONST NUMBERFMTA* a3,
+ LPSTR a4,
+ int a5)
+ = GetNumberFormatA;
+
+int (__stdcall * Real_GetNumberFormatW)(LCID a0,
+ DWORD a1,
+ LPCWSTR a2,
+ CONST NUMBERFMTW* a3,
+ LPWSTR a4,
+ int a5)
+ = GetNumberFormatW;
+
+BOOL (__stdcall * Real_GetNumberOfConsoleInputEvents)(HANDLE a0,
+ LPDWORD a1)
+ = GetNumberOfConsoleInputEvents;
+
+BOOL (__stdcall * Real_GetNumberOfConsoleMouseButtons)(LPDWORD a0)
+ = GetNumberOfConsoleMouseButtons;
+
+UINT (__stdcall * Real_GetOEMCP)(void)
+ = GetOEMCP;
+
+int (__stdcall * Real_GetObjectA)(HGDIOBJ a0,
+ int a1,
+ LPVOID a2)
+ = GetObjectA;
+
+DWORD (__stdcall * Real_GetObjectType)(HGDIOBJ a0)
+ = GetObjectType;
+
+int (__stdcall * Real_GetObjectW)(HGDIOBJ a0,
+ int a1,
+ LPVOID a2)
+ = GetObjectW;
+
+HWND (__stdcall * Real_GetOpenClipboardWindow)(void)
+ = GetOpenClipboardWindow;
+
+UINT (__stdcall * Real_GetOutlineTextMetricsA)(HDC a0,
+ UINT a1,
+ LPOUTLINETEXTMETRICA a2)
+ = GetOutlineTextMetricsA;
+
+UINT (__stdcall * Real_GetOutlineTextMetricsW)(HDC a0,
+ UINT a1,
+ LPOUTLINETEXTMETRICW a2)
+ = GetOutlineTextMetricsW;
+
+BOOL (__stdcall * Real_GetOverlappedResult)(HANDLE a0,
+ LPOVERLAPPED a1,
+ LPDWORD a2,
+ BOOL a3)
+ = GetOverlappedResult;
+
+UINT (__stdcall * Real_GetPaletteEntries)(HPALETTE a0,
+ UINT a1,
+ UINT a2,
+ PALETTEENTRY* a3)
+ = GetPaletteEntries;
+
+HWND (__stdcall * Real_GetParent)(HWND a0)
+ = GetParent;
+
+int (__stdcall * Real_GetPath)(HDC a0,
+ POINT* a1,
+ LPBYTE a2,
+ int a3)
+ = GetPath;
+
+COLORREF (__stdcall * Real_GetPixel)(HDC a0,
+ int a1,
+ int a2)
+ = GetPixel;
+
+int (__stdcall * Real_GetPixelFormat)(HDC a0)
+ = GetPixelFormat;
+
+int (__stdcall * Real_GetPolyFillMode)(HDC a0)
+ = GetPolyFillMode;
+
+DWORD (__stdcall * Real_GetPriorityClass)(HANDLE a0)
+ = GetPriorityClass;
+
+int (__stdcall * Real_GetPriorityClipboardFormat)(UINT* a0,
+ int a1)
+ = GetPriorityClipboardFormat;
+
+UINT (__stdcall * Real_GetPrivateProfileIntA)(LPCSTR a0,
+ LPCSTR a1,
+ INT a2,
+ LPCSTR a3)
+ = GetPrivateProfileIntA;
+
+UINT (__stdcall * Real_GetPrivateProfileIntW)(LPCWSTR a0,
+ LPCWSTR a1,
+ INT a2,
+ LPCWSTR a3)
+ = GetPrivateProfileIntW;
+
+DWORD (__stdcall * Real_GetPrivateProfileSectionA)(LPCSTR a0,
+ LPSTR a1,
+ DWORD a2,
+ LPCSTR a3)
+ = GetPrivateProfileSectionA;
+
+DWORD (__stdcall * Real_GetPrivateProfileSectionNamesA)(LPSTR a0,
+ DWORD a1,
+ LPCSTR a2)
+ = GetPrivateProfileSectionNamesA;
+
+DWORD (__stdcall * Real_GetPrivateProfileSectionNamesW)(LPWSTR a0,
+ DWORD a1,
+ LPCWSTR a2)
+ = GetPrivateProfileSectionNamesW;
+
+DWORD (__stdcall * Real_GetPrivateProfileSectionW)(LPCWSTR a0,
+ LPWSTR a1,
+ DWORD a2,
+ LPCWSTR a3)
+ = GetPrivateProfileSectionW;
+
+DWORD (__stdcall * Real_GetPrivateProfileStringA)(LPCSTR a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ LPSTR a3,
+ DWORD a4,
+ LPCSTR a5)
+ = GetPrivateProfileStringA;
+
+DWORD (__stdcall * Real_GetPrivateProfileStringW)(LPCWSTR a0,
+ LPCWSTR a1,
+ LPCWSTR a2,
+ LPWSTR a3,
+ DWORD a4,
+ LPCWSTR a5)
+ = GetPrivateProfileStringW;
+
+BOOL (__stdcall * Real_GetPrivateProfileStructA)(LPCSTR a0,
+ LPCSTR a1,
+ LPVOID a2,
+ UINT a3,
+ LPCSTR a4)
+ = GetPrivateProfileStructA;
+
+BOOL (__stdcall * Real_GetPrivateProfileStructW)(LPCWSTR a0,
+ LPCWSTR a1,
+ LPVOID a2,
+ UINT a3,
+ LPCWSTR a4)
+ = GetPrivateProfileStructW;
+
+FARPROC (__stdcall * Real_GetProcAddress)(HMODULE a0,
+ LPCSTR a1)
+ = GetProcAddress;
+
+BOOL (__stdcall * Real_GetProcessAffinityMask)(HANDLE a0,
+ PDWORD_PTR a1,
+ PDWORD_PTR a2)
+ = GetProcessAffinityMask;
+
+DWORD (__stdcall * Real_GetProcessHeaps)(DWORD a0,
+ PHANDLE a1)
+ = GetProcessHeaps;
+
+BOOL (__stdcall * Real_GetProcessShutdownParameters)(LPDWORD a0,
+ LPDWORD a1)
+ = GetProcessShutdownParameters;
+
+BOOL (__stdcall * Real_GetProcessTimes)(HANDLE a0,
+ LPFILETIME a1,
+ LPFILETIME a2,
+ LPFILETIME a3,
+ LPFILETIME a4)
+ = GetProcessTimes;
+
+DWORD (__stdcall * Real_GetProcessVersion)(DWORD a0)
+ = GetProcessVersion;
+
+HWINSTA (__stdcall * Real_GetProcessWindowStation)(void)
+ = GetProcessWindowStation;
+
+BOOL (__stdcall * Real_GetProcessWorkingSetSize)(HANDLE a0,
+ PSIZE_T a1,
+ PSIZE_T a2)
+ = GetProcessWorkingSetSize;
+
+UINT (__stdcall * Real_GetProfileIntA)(LPCSTR a0,
+ LPCSTR a1,
+ INT a2)
+ = GetProfileIntA;
+
+UINT (__stdcall * Real_GetProfileIntW)(LPCWSTR a0,
+ LPCWSTR a1,
+ INT a2)
+ = GetProfileIntW;
+
+DWORD (__stdcall * Real_GetProfileSectionA)(LPCSTR a0,
+ LPSTR a1,
+ DWORD a2)
+ = GetProfileSectionA;
+
+DWORD (__stdcall * Real_GetProfileSectionW)(LPCWSTR a0,
+ LPWSTR a1,
+ DWORD a2)
+ = GetProfileSectionW;
+
+DWORD (__stdcall * Real_GetProfileStringA)(LPCSTR a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ LPSTR a3,
+ DWORD a4)
+ = GetProfileStringA;
+
+DWORD (__stdcall * Real_GetProfileStringW)(LPCWSTR a0,
+ LPCWSTR a1,
+ LPCWSTR a2,
+ LPWSTR a3,
+ DWORD a4)
+ = GetProfileStringW;
+
+HANDLE (__stdcall * Real_GetPropA)(HWND a0,
+ LPCSTR a1)
+ = GetPropA;
+
+HANDLE (__stdcall * Real_GetPropW)(HWND a0,
+ LPCWSTR a1)
+ = GetPropW;
+
+DWORD (__stdcall * Real_GetQueueStatus)(UINT a0)
+ = GetQueueStatus;
+
+BOOL (__stdcall * Real_GetQueuedCompletionStatus)(HANDLE a0,
+ LPDWORD a1,
+ PULONG_PTR a2,
+ LPOVERLAPPED* a3,
+ DWORD a4)
+ = GetQueuedCompletionStatus;
+
+int (__stdcall * Real_GetROP2)(HDC a0)
+ = GetROP2;
+
+BOOL (__stdcall * Real_GetRasterizerCaps)(LPRASTERIZER_STATUS a0,
+ UINT a1)
+ = GetRasterizerCaps;
+
+DWORD (__stdcall * Real_GetRegionData)(HRGN a0,
+ DWORD a1,
+ LPRGNDATA a2)
+ = GetRegionData;
+
+int (__stdcall * Real_GetRgnBox)(HRGN a0,
+ LPRECT a1)
+ = GetRgnBox;
+
+HRESULT (__stdcall * Real_GetRunningObjectTable)(DWORD a0,
+ LPRUNNINGOBJECTTABLE* a1)
+ = GetRunningObjectTable;
+
+BOOL (__stdcall * Real_GetScrollInfo)(HWND a0,
+ int a1,
+ LPSCROLLINFO a2)
+ = GetScrollInfo;
+
+int (__stdcall * Real_GetScrollPos)(HWND a0,
+ int a1)
+ = GetScrollPos;
+
+BOOL (__stdcall * Real_GetScrollRange)(HWND a0,
+ int a1,
+ LPINT a2,
+ LPINT a3)
+ = GetScrollRange;
+
+DWORD (__stdcall * Real_GetShortPathNameA)(LPCSTR a0,
+ LPSTR a1,
+ DWORD a2)
+ = GetShortPathNameA;
+
+DWORD (__stdcall * Real_GetShortPathNameW)(LPCWSTR a0,
+ LPWSTR a1,
+ DWORD a2)
+ = GetShortPathNameW;
+
+void (__stdcall * Real_GetStartupInfoA)(LPSTARTUPINFOA a0)
+ = GetStartupInfoA;
+
+void (__stdcall * Real_GetStartupInfoW)(LPSTARTUPINFOW a0)
+ = GetStartupInfoW;
+
+HANDLE (__stdcall * Real_GetStdHandle)(DWORD a0)
+ = GetStdHandle;
+
+HGDIOBJ (__stdcall * Real_GetStockObject)(int a0)
+ = GetStockObject;
+
+int (__stdcall * Real_GetStretchBltMode)(HDC a0)
+ = GetStretchBltMode;
+
+HMENU (__stdcall * Real_GetSubMenu)(HMENU a0,
+ int a1)
+ = GetSubMenu;
+
+DWORD (__stdcall * Real_GetSysColor)(int a0)
+ = GetSysColor;
+
+HBRUSH (__stdcall * Real_GetSysColorBrush)(int a0)
+ = GetSysColorBrush;
+
+LCID (__stdcall * Real_GetSystemDefaultLCID)(void)
+ = GetSystemDefaultLCID;
+
+LANGID (__stdcall * Real_GetSystemDefaultLangID)(void)
+ = GetSystemDefaultLangID;
+
+UINT (__stdcall * Real_GetSystemDirectoryA)(LPSTR a0,
+ UINT a1)
+ = GetSystemDirectoryA;
+
+UINT (__stdcall * Real_GetSystemDirectoryW)(LPWSTR a0,
+ UINT a1)
+ = GetSystemDirectoryW;
+
+void (__stdcall * Real_GetSystemInfo)(LPSYSTEM_INFO a0)
+ = GetSystemInfo;
+
+HMENU (__stdcall * Real_GetSystemMenu)(HWND a0,
+ BOOL a1)
+ = GetSystemMenu;
+
+int (__stdcall * Real_GetSystemMetrics)(int a0)
+ = GetSystemMetrics;
+
+UINT (__stdcall * Real_GetSystemPaletteEntries)(HDC a0,
+ UINT a1,
+ UINT a2,
+ PALETTEENTRY* a3)
+ = GetSystemPaletteEntries;
+
+UINT (__stdcall * Real_GetSystemPaletteUse)(HDC a0)
+ = GetSystemPaletteUse;
+
+BOOL (__stdcall * Real_GetSystemPowerStatus)(LPSYSTEM_POWER_STATUS a0)
+ = GetSystemPowerStatus;
+
+void (__stdcall * Real_GetSystemTime)(LPSYSTEMTIME a0)
+ = GetSystemTime;
+
+BOOL (__stdcall * Real_GetSystemTimeAdjustment)(PDWORD a0,
+ PDWORD a1,
+ PBOOL a2)
+ = GetSystemTimeAdjustment;
+
+void (__stdcall * Real_GetSystemTimeAsFileTime)(LPFILETIME a0)
+ = GetSystemTimeAsFileTime;
+
+#if _MSC_VER < 1300
+DWORD (__stdcall * Real_GetTabbedTextExtentA)(HDC a0,
+ LPCSTR a1,
+ int a2,
+ int a3,
+ INT* a4)
+ = GetTabbedTextExtentA;
+#else
+DWORD (__stdcall * Real_GetTabbedTextExtentA)(HDC a0,
+ LPCSTR a1,
+ int a2,
+ int a3,
+ CONST INT* a4)
+ = GetTabbedTextExtentA;
+#endif
+
+#if _MSC_VER < 1300
+DWORD (__stdcall * Real_GetTabbedTextExtentW)(HDC a0,
+ LPCWSTR a1,
+ int a2,
+ int a3,
+ INT* a4)
+ = GetTabbedTextExtentW;
+#else
+DWORD (__stdcall * Real_GetTabbedTextExtentW)(HDC a0,
+ LPCWSTR a1,
+ int a2,
+ int a3,
+ CONST INT* a4)
+ = GetTabbedTextExtentW;
+#endif
+
+DWORD (__stdcall * Real_GetTapeParameters)(HANDLE a0,
+ DWORD a1,
+ LPDWORD a2,
+ LPVOID a3)
+ = GetTapeParameters;
+
+DWORD (__stdcall * Real_GetTapePosition)(HANDLE a0,
+ DWORD a1,
+ LPDWORD a2,
+ LPDWORD a3,
+ LPDWORD a4)
+ = GetTapePosition;
+
+DWORD (__stdcall * Real_GetTapeStatus)(HANDLE a0)
+ = GetTapeStatus;
+
+UINT (__stdcall * Real_GetTempFileNameA)(LPCSTR a0,
+ LPCSTR a1,
+ UINT a2,
+ LPSTR a3)
+ = GetTempFileNameA;
+
+UINT (__stdcall * Real_GetTempFileNameW)(LPCWSTR a0,
+ LPCWSTR a1,
+ UINT a2,
+ LPWSTR a3)
+ = GetTempFileNameW;
+
+DWORD (__stdcall * Real_GetTempPathA)(DWORD a0,
+ LPSTR a1)
+ = GetTempPathA;
+
+DWORD (__stdcall * Real_GetTempPathW)(DWORD a0,
+ LPWSTR a1)
+ = GetTempPathW;
+
+UINT (__stdcall * Real_GetTextAlign)(HDC a0)
+ = GetTextAlign;
+
+int (__stdcall * Real_GetTextCharacterExtra)(HDC a0)
+ = GetTextCharacterExtra;
+
+int (__stdcall * Real_GetTextCharset)(HDC a0)
+ = GetTextCharset;
+
+int (__stdcall * Real_GetTextCharsetInfo)(HDC a0,
+ LPFONTSIGNATURE a1,
+ DWORD a2)
+ = GetTextCharsetInfo;
+
+COLORREF (__stdcall * Real_GetTextColor)(HDC a0)
+ = GetTextColor;
+
+BOOL (__stdcall * Real_GetTextExtentExPointA)(HDC a0,
+ LPCSTR a1,
+ int a2,
+ int a3,
+ LPINT a4,
+ LPINT a5,
+ SIZE* a6)
+ = GetTextExtentExPointA;
+
+BOOL (__stdcall * Real_GetTextExtentExPointW)(HDC a0,
+ LPCWSTR a1,
+ int a2,
+ int a3,
+ LPINT a4,
+ LPINT a5,
+ SIZE* a6)
+ = GetTextExtentExPointW;
+
+BOOL (__stdcall * Real_GetTextExtentPoint32A)(HDC a0,
+ LPCSTR a1,
+ int a2,
+ SIZE* a3)
+ = GetTextExtentPoint32A;
+
+BOOL (__stdcall * Real_GetTextExtentPoint32W)(HDC a0,
+ LPCWSTR a1,
+ int a2,
+ SIZE* a3)
+ = GetTextExtentPoint32W;
+
+BOOL (__stdcall * Real_GetTextExtentPointA)(HDC a0,
+ LPCSTR a1,
+ int a2,
+ SIZE* a3)
+ = GetTextExtentPointA;
+
+BOOL (__stdcall * Real_GetTextExtentPointW)(HDC a0,
+ LPCWSTR a1,
+ int a2,
+ SIZE* a3)
+ = GetTextExtentPointW;
+
+int (__stdcall * Real_GetTextFaceA)(HDC a0,
+ int a1,
+ LPSTR a2)
+ = GetTextFaceA;
+
+int (__stdcall * Real_GetTextFaceW)(HDC a0,
+ int a1,
+ LPWSTR a2)
+ = GetTextFaceW;
+
+BOOL (__stdcall * Real_GetTextMetricsA)(HDC a0,
+ LPTEXTMETRICA a1)
+ = GetTextMetricsA;
+
+BOOL (__stdcall * Real_GetTextMetricsW)(HDC a0,
+ LPTEXTMETRICW a1)
+ = GetTextMetricsW;
+
+BOOL (__stdcall * Real_GetThreadContext)(HANDLE a0,
+ LPCONTEXT a1)
+ = GetThreadContext;
+
+HDESK (__stdcall * Real_GetThreadDesktop)(DWORD a0)
+ = GetThreadDesktop;
+
+#if(WINVER >= 0x0500)
+LCID (__stdcall * Real_GetThreadLocale)(void)
+ = GetThreadLocale;
+#endif // (WINVER >= 0x0500)
+
+int (__stdcall * Real_GetThreadPriority)(HANDLE a0)
+ = GetThreadPriority;
+
+BOOL (__stdcall * Real_GetThreadPriorityBoost)(HANDLE a0,
+ PBOOL a1)
+ = GetThreadPriorityBoost;
+
+BOOL (__stdcall * Real_GetThreadSelectorEntry)(HANDLE a0,
+ DWORD a1,
+ LPLDT_ENTRY a2)
+ = GetThreadSelectorEntry;
+
+BOOL (__stdcall * Real_GetThreadTimes)(HANDLE a0,
+ LPFILETIME a1,
+ LPFILETIME a2,
+ LPFILETIME a3,
+ LPFILETIME a4)
+ = GetThreadTimes;
+
+DWORD (__stdcall * Real_GetTickCount)(void)
+ = GetTickCount;
+
+int (__stdcall * Real_GetTimeFormatA)(LCID a0,
+ DWORD a1,
+ CONST SYSTEMTIME* a2,
+ LPCSTR a3,
+ LPSTR a4,
+ int a5)
+ = GetTimeFormatA;
+
+int (__stdcall * Real_GetTimeFormatW)(LCID a0,
+ DWORD a1,
+ CONST SYSTEMTIME* a2,
+ LPCWSTR a3,
+ LPWSTR a4,
+ int a5)
+ = GetTimeFormatW;
+
+DWORD (__stdcall * Real_GetTimeZoneInformation)(LPTIME_ZONE_INFORMATION a0)
+ = GetTimeZoneInformation;
+
+HWND (__stdcall * Real_GetTopWindow)(HWND a0)
+ = GetTopWindow;
+
+BOOL (__stdcall * Real_GetUpdateRect)(HWND a0,
+ LPRECT a1,
+ BOOL a2)
+ = GetUpdateRect;
+
+int (__stdcall * Real_GetUpdateRgn)(HWND a0,
+ HRGN a1,
+ BOOL a2)
+ = GetUpdateRgn;
+
+LCID (__stdcall * Real_GetUserDefaultLCID)(void)
+ = GetUserDefaultLCID;
+
+LANGID (__stdcall * Real_GetUserDefaultLangID)(void)
+ = GetUserDefaultLangID;
+
+BOOL (__stdcall * Real_GetUserObjectInformationA)(HANDLE a0,
+ int a1,
+ PVOID a2,
+ DWORD a3,
+ LPDWORD a4)
+ = GetUserObjectInformationA;
+
+BOOL (__stdcall * Real_GetUserObjectInformationW)(HANDLE a0,
+ int a1,
+ PVOID a2,
+ DWORD a3,
+ LPDWORD a4)
+ = GetUserObjectInformationW;
+
+BOOL (__stdcall * Real_GetUserObjectSecurity)(HANDLE a0,
+ PSECURITY_INFORMATION a1,
+ PSECURITY_DESCRIPTOR a2,
+ DWORD a3,
+ LPDWORD a4)
+ = GetUserObjectSecurity;
+
+DWORD (__stdcall * Real_GetVersion)(void)
+ = GetVersion;
+
+BOOL (__stdcall * Real_GetVersionExA)(LPOSVERSIONINFOA a0)
+ = GetVersionExA;
+
+BOOL (__stdcall * Real_GetVersionExW)(LPOSVERSIONINFOW a0)
+ = GetVersionExW;
+
+BOOL (__stdcall * Real_GetViewportExtEx)(HDC a0,
+ SIZE* a1)
+ = GetViewportExtEx;
+
+BOOL (__stdcall * Real_GetViewportOrgEx)(HDC a0,
+ POINT* a1)
+ = GetViewportOrgEx;
+
+BOOL (__stdcall * Real_GetVolumeInformationA)(LPCSTR a0,
+ LPSTR a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPDWORD a5,
+ LPSTR a6,
+ DWORD a7)
+ = GetVolumeInformationA;
+
+BOOL (__stdcall * Real_GetVolumeInformationW)(LPCWSTR a0,
+ LPWSTR a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPDWORD a5,
+ LPWSTR a6,
+ DWORD a7)
+ = GetVolumeInformationW;
+
+UINT (__stdcall * Real_GetWinMetaFileBits)(HENHMETAFILE a0,
+ UINT a1,
+ LPBYTE a2,
+ INT a3,
+ HDC a4)
+ = GetWinMetaFileBits;
+
+HWND (__stdcall * Real_GetWindow)(HWND a0,
+ UINT a1)
+ = GetWindow;
+
+DWORD (__stdcall * Real_GetWindowContextHelpId)(HWND a0)
+ = GetWindowContextHelpId;
+
+HDC (__stdcall * Real_GetWindowDC)(HWND a0)
+ = GetWindowDC;
+
+BOOL (__stdcall * Real_GetWindowExtEx)(HDC a0,
+ SIZE* a1)
+ = GetWindowExtEx;
+
+LONG (__stdcall * Real_GetWindowLongA)(HWND a0,
+ int a1)
+ = GetWindowLongA;
+
+LONG (__stdcall * Real_GetWindowLongW)(HWND a0,
+ int a1)
+ = GetWindowLongW;
+
+BOOL (__stdcall * Real_GetWindowOrgEx)(HDC a0,
+ POINT* a1)
+ = GetWindowOrgEx;
+
+BOOL (__stdcall * Real_GetWindowPlacement)(HWND a0,
+ WINDOWPLACEMENT* a1)
+ = GetWindowPlacement;
+
+BOOL (__stdcall * Real_GetWindowRect)(HWND a0,
+ LPRECT a1)
+ = GetWindowRect;
+
+int (__stdcall * Real_GetWindowRgn)(HWND a0,
+ HRGN a1)
+ = GetWindowRgn;
+
+int (__stdcall * Real_GetWindowTextA)(HWND a0,
+ LPSTR a1,
+ int a2)
+ = GetWindowTextA;
+
+int (__stdcall * Real_GetWindowTextLengthA)(HWND a0)
+ = GetWindowTextLengthA;
+
+int (__stdcall * Real_GetWindowTextLengthW)(HWND a0)
+ = GetWindowTextLengthW;
+
+int (__stdcall * Real_GetWindowTextW)(HWND a0,
+ LPWSTR a1,
+ int a2)
+ = GetWindowTextW;
+
+DWORD (__stdcall * Real_GetWindowThreadProcessId)(HWND a0,
+ LPDWORD a1)
+ = GetWindowThreadProcessId;
+
+WORD (__stdcall * Real_GetWindowWord)(HWND a0,
+ int a1)
+ = GetWindowWord;
+
+UINT (__stdcall * Real_GetWindowsDirectoryA)(LPSTR a0,
+ UINT a1)
+ = GetWindowsDirectoryA;
+
+UINT (__stdcall * Real_GetWindowsDirectoryW)(LPWSTR a0,
+ UINT a1)
+ = GetWindowsDirectoryW;
+
+BOOL (__stdcall * Real_GetWorldTransform)(HDC a0,
+ XFORM* a1)
+ = GetWorldTransform;
+
+ATOM (__stdcall * Real_GlobalAddAtomA)(LPCSTR a0)
+ = GlobalAddAtomA;
+
+ATOM (__stdcall * Real_GlobalAddAtomW)(LPCWSTR a0)
+ = GlobalAddAtomW;
+
+HGLOBAL (__stdcall * Real_GlobalAlloc)(UINT a0,
+ SIZE_T a1)
+ = GlobalAlloc;
+
+#if _MSC_VER < 1300
+UINT (__stdcall * Real_GlobalCompact)(DWORD a0)
+ = GlobalCompact;
+#else
+SIZE_T (__stdcall * Real_GlobalCompact)(DWORD a0)
+ = GlobalCompact;
+#endif
+
+ATOM (__stdcall * Real_GlobalDeleteAtom)(ATOM a0)
+ = GlobalDeleteAtom;
+
+ATOM (__stdcall * Real_GlobalFindAtomA)(LPCSTR a0)
+ = GlobalFindAtomA;
+
+ATOM (__stdcall * Real_GlobalFindAtomW)(LPCWSTR a0)
+ = GlobalFindAtomW;
+
+void (__stdcall * Real_GlobalFix)(HGLOBAL a0)
+ = GlobalFix;
+
+UINT (__stdcall * Real_GlobalFlags)(HGLOBAL a0)
+ = GlobalFlags;
+
+HGLOBAL (__stdcall * Real_GlobalFree)(HGLOBAL a0)
+ = GlobalFree;
+
+UINT (__stdcall * Real_GlobalGetAtomNameA)(ATOM a0,
+ LPSTR a1,
+ int a2)
+ = GlobalGetAtomNameA;
+
+UINT (__stdcall * Real_GlobalGetAtomNameW)(ATOM a0,
+ LPWSTR a1,
+ int a2)
+ = GlobalGetAtomNameW;
+
+HGLOBAL (__stdcall * Real_GlobalHandle)(LPCVOID a0)
+ = GlobalHandle;
+
+LPVOID (__stdcall * Real_GlobalLock)(HGLOBAL a0)
+ = GlobalLock;
+
+void (__stdcall * Real_GlobalMemoryStatus)(LPMEMORYSTATUS a0)
+ = GlobalMemoryStatus;
+
+HGLOBAL (__stdcall * Real_GlobalReAlloc)(HGLOBAL a0,
+ SIZE_T a1,
+ UINT a2)
+ = GlobalReAlloc;
+
+SIZE_T (__stdcall * Real_GlobalSize)(HGLOBAL a0)
+ = GlobalSize;
+
+BOOL (__stdcall * Real_GlobalUnWire)(HGLOBAL a0)
+ = GlobalUnWire;
+
+void (__stdcall * Real_GlobalUnfix)(HGLOBAL a0)
+ = GlobalUnfix;
+
+BOOL (__stdcall * Real_GlobalUnlock)(HGLOBAL a0)
+ = GlobalUnlock;
+
+LPVOID (__stdcall * Real_GlobalWire)(HGLOBAL a0)
+ = GlobalWire;
+
+BOOL (__stdcall * Real_GrayStringA)(HDC a0,
+ HBRUSH a1,
+ GRAYSTRINGPROC a2,
+ LPARAM a3,
+ int a4,
+ int a5,
+ int a6,
+ int a7,
+ int a8)
+ = GrayStringA;
+
+BOOL (__stdcall * Real_GrayStringW)(HDC a0,
+ HBRUSH a1,
+ GRAYSTRINGPROC a2,
+ LPARAM a3,
+ int a4,
+ int a5,
+ int a6,
+ int a7,
+ int a8)
+ = GrayStringW;
+
+BOOL (__stdcall * Real_HeapLock)(HANDLE a0)
+ = HeapLock;
+
+BOOL (__stdcall * Real_HeapUnlock)(HANDLE a0)
+ = HeapUnlock;
+
+BOOL (__stdcall * Real_HideCaret)(HWND a0)
+ = HideCaret;
+
+BOOL (__stdcall * Real_HiliteMenuItem)(HWND a0,
+ HMENU a1,
+ UINT a2,
+ UINT a3)
+ = HiliteMenuItem;
+
+#ifdef _WIN32_WINNT_WIN7
+HRESULT (__stdcall * Real_IIDFromString)(LPCOLESTR a0,
+ LPGUID a1)
+ = IIDFromString;
+#else
+HRESULT (__stdcall * Real_IIDFromString)(LPOLESTR a0,
+ LPGUID a1)
+ = IIDFromString;
+#endif
+
+BOOL (__stdcall * Real_ImpersonateDdeClientWindow)(HWND a0,
+ HWND a1)
+ = ImpersonateDdeClientWindow;
+
+BOOL (__stdcall * Real_InSendMessage)(void)
+ = InSendMessage;
+
+BOOL (__stdcall * Real_InflateRect)(LPRECT a0,
+ int a1,
+ int a2)
+ = InflateRect;
+
+BOOL (__stdcall * Real_InitAtomTable)(DWORD a0)
+ = InitAtomTable;
+
+BOOL (__stdcall * Real_InsertMenuA)(HMENU a0,
+ UINT a1,
+ UINT a2,
+ UINT_PTR a3,
+ LPCSTR a4)
+ = InsertMenuA;
+
+BOOL (__stdcall * Real_InsertMenuW)(HMENU a0,
+ UINT a1,
+ UINT a2,
+ UINT_PTR a3,
+ LPCWSTR a4)
+ = InsertMenuW;
+
+BOOL (__stdcall * Real_InsertMenuItemA)(HMENU a0,
+ UINT a1,
+ BOOL a2,
+ LPCMENUITEMINFOA a3)
+ = InsertMenuItemA;
+
+BOOL (__stdcall * Real_InsertMenuItemW)(HMENU a0,
+ UINT a1,
+ BOOL a2,
+ LPCMENUITEMINFOW a3)
+ = InsertMenuItemW;
+
+int (__stdcall * Real_IntersectClipRect)(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4)
+ = IntersectClipRect;
+
+BOOL (__stdcall * Real_IntersectRect)(LPRECT a0,
+ CONST RECT* a1,
+ CONST RECT* a2)
+ = IntersectRect;
+
+BOOL (__stdcall * Real_InvalidateRect)(HWND a0,
+ CONST RECT* a1,
+ BOOL a2)
+ = InvalidateRect;
+
+BOOL (__stdcall * Real_InvalidateRgn)(HWND a0,
+ HRGN a1,
+ BOOL a2)
+ = InvalidateRgn;
+
+BOOL (__stdcall * Real_InvertRect)(HDC a0,
+ CONST RECT* a1)
+ = InvertRect;
+
+BOOL (__stdcall * Real_InvertRgn)(HDC a0,
+ HRGN a1)
+ = InvertRgn;
+
+BOOL (__stdcall * Real_IsAccelerator)(HACCEL a0,
+ int a1,
+ LPMSG a2,
+ WORD* a3)
+ = IsAccelerator;
+
+BOOL (__stdcall * Real_IsBadCodePtr)(FARPROC a0)
+ = IsBadCodePtr;
+
+BOOL (__stdcall * Real_IsBadHugeReadPtr)(CONST void* a0,
+ UINT_PTR a1)
+ = IsBadHugeReadPtr;
+
+BOOL (__stdcall * Real_IsBadHugeWritePtr)(LPVOID a0,
+ UINT_PTR a1)
+ = IsBadHugeWritePtr;
+
+BOOL (__stdcall * Real_IsBadReadPtr)(CONST void* a0,
+ UINT_PTR a1)
+ = IsBadReadPtr;
+
+BOOL (__stdcall * Real_IsBadStringPtrA)(LPCSTR a0,
+ UINT_PTR a1)
+ = IsBadStringPtrA;
+
+BOOL (__stdcall * Real_IsBadStringPtrW)(LPCWSTR a0,
+ UINT_PTR a1)
+ = IsBadStringPtrW;
+
+BOOL (__stdcall * Real_IsBadWritePtr)(LPVOID a0,
+ UINT_PTR a1)
+ = IsBadWritePtr;
+
+BOOL (__stdcall * Real_IsCharAlphaA)(CHAR a0)
+ = IsCharAlphaA;
+
+BOOL (__stdcall * Real_IsCharAlphaNumericA)(CHAR a0)
+ = IsCharAlphaNumericA;
+
+BOOL (__stdcall * Real_IsCharAlphaNumericW)(WCHAR a0)
+ = IsCharAlphaNumericW;
+
+BOOL (__stdcall * Real_IsCharAlphaW)(WCHAR a0)
+ = IsCharAlphaW;
+
+BOOL (__stdcall * Real_IsCharLowerA)(CHAR a0)
+ = IsCharLowerA;
+
+BOOL (__stdcall * Real_IsCharLowerW)(WCHAR a0)
+ = IsCharLowerW;
+
+BOOL (__stdcall * Real_IsCharUpperA)(CHAR a0)
+ = IsCharUpperA;
+
+BOOL (__stdcall * Real_IsCharUpperW)(WCHAR a0)
+ = IsCharUpperW;
+
+BOOL (__stdcall * Real_IsChild)(HWND a0,
+ HWND a1)
+ = IsChild;
+
+BOOL (__stdcall * Real_IsClipboardFormatAvailable)(UINT a0)
+ = IsClipboardFormatAvailable;
+
+BOOL (__stdcall * Real_IsDBCSLeadByte)(BYTE a0)
+ = IsDBCSLeadByte;
+
+BOOL (__stdcall * Real_IsDBCSLeadByteEx)(UINT a0,
+ BYTE a1)
+ = IsDBCSLeadByteEx;
+
+BOOL (__stdcall * Real_IsDebuggerPresent)(void)
+ = IsDebuggerPresent;
+
+BOOL (__stdcall * Real_IsDialogMessageA)(HWND a0,
+ LPMSG a1)
+ = IsDialogMessageA;
+
+BOOL (__stdcall * Real_IsDialogMessageW)(HWND a0,
+ LPMSG a1)
+ = IsDialogMessageW;
+
+UINT (__stdcall * Real_IsDlgButtonChecked)(HWND a0,
+ int a1)
+ = IsDlgButtonChecked;
+
+BOOL (__stdcall * Real_IsIconic)(HWND a0)
+ = IsIconic;
+
+BOOL (__stdcall * Real_IsMenu)(HMENU a0)
+ = IsMenu;
+
+#if !defined(DETOURS_ARM)
+BOOL (__stdcall * Real_IsProcessorFeaturePresent)(DWORD a0)
+ = IsProcessorFeaturePresent;
+#endif // !DETOURS_ARM
+
+BOOL (__stdcall * Real_IsRectEmpty)(CONST RECT* a0)
+ = IsRectEmpty;
+
+BOOL (__stdcall * Real_IsValidCodePage)(UINT a0)
+ = IsValidCodePage;
+
+BOOL (__stdcall * Real_IsValidLocale)(LCID a0,
+ DWORD a1)
+ = IsValidLocale;
+
+BOOL (__stdcall * Real_IsWindow)(HWND a0)
+ = IsWindow;
+
+BOOL (__stdcall * Real_IsWindowEnabled)(HWND a0)
+ = IsWindowEnabled;
+
+BOOL (__stdcall * Real_IsWindowUnicode)(HWND a0)
+ = IsWindowUnicode;
+
+BOOL (__stdcall * Real_IsWindowVisible)(HWND a0)
+ = IsWindowVisible;
+
+BOOL (__stdcall * Real_IsZoomed)(HWND a0)
+ = IsZoomed;
+
+BOOL (__stdcall * Real_KillTimer)(HWND a0,
+ UINT_PTR a1)
+ = KillTimer;
+
+BOOL (__stdcall * Real_LPtoDP)(HDC a0,
+ POINT* a1,
+ int a2)
+ = LPtoDP;
+
+BOOL (__stdcall * Real_LineDDA)(int a0,
+ int a1,
+ int a2,
+ int a3,
+ LINEDDAPROC a4,
+ LPARAM a5)
+ = LineDDA;
+
+BOOL (__stdcall * Real_LineTo)(HDC a0,
+ int a1,
+ int a2)
+ = LineTo;
+
+HACCEL (__stdcall * Real_LoadAcceleratorsA)(HINSTANCE a0,
+ LPCSTR a1)
+ = LoadAcceleratorsA;
+
+HACCEL (__stdcall * Real_LoadAcceleratorsW)(HINSTANCE a0,
+ LPCWSTR a1)
+ = LoadAcceleratorsW;
+
+HBITMAP (__stdcall * Real_LoadBitmapA)(HINSTANCE a0,
+ LPCSTR a1)
+ = LoadBitmapA;
+
+HBITMAP (__stdcall * Real_LoadBitmapW)(HINSTANCE a0,
+ LPCWSTR a1)
+ = LoadBitmapW;
+
+HCURSOR (__stdcall * Real_LoadCursorA)(HINSTANCE a0,
+ LPCSTR a1)
+ = LoadCursorA;
+
+HCURSOR (__stdcall * Real_LoadCursorFromFileA)(LPCSTR a0)
+ = LoadCursorFromFileA;
+
+HCURSOR (__stdcall * Real_LoadCursorFromFileW)(LPCWSTR a0)
+ = LoadCursorFromFileW;
+
+HCURSOR (__stdcall * Real_LoadCursorW)(HINSTANCE a0,
+ LPCWSTR a1)
+ = LoadCursorW;
+
+HICON (__stdcall * Real_LoadIconA)(HINSTANCE a0,
+ LPCSTR a1)
+ = LoadIconA;
+
+HICON (__stdcall * Real_LoadIconW)(HINSTANCE a0,
+ LPCWSTR a1)
+ = LoadIconW;
+
+HANDLE (__stdcall * Real_LoadImageA)(HINSTANCE a0,
+ LPCSTR a1,
+ UINT a2,
+ int a3,
+ int a4,
+ UINT a5)
+ = LoadImageA;
+
+HANDLE (__stdcall * Real_LoadImageW)(HINSTANCE a0,
+ LPCWSTR a1,
+ UINT a2,
+ int a3,
+ int a4,
+ UINT a5)
+ = LoadImageW;
+
+HKL (__stdcall * Real_LoadKeyboardLayoutA)(LPCSTR a0,
+ UINT a1)
+ = LoadKeyboardLayoutA;
+
+HKL (__stdcall * Real_LoadKeyboardLayoutW)(LPCWSTR a0,
+ UINT a1)
+ = LoadKeyboardLayoutW;
+
+HMODULE (__stdcall * Real_LoadLibraryA)(LPCSTR a0)
+ = LoadLibraryA;
+
+HMODULE (__stdcall * Real_LoadLibraryExA)(LPCSTR a0,
+ HANDLE a1,
+ DWORD a2)
+ = LoadLibraryExA;
+
+HMODULE (__stdcall * Real_LoadLibraryExW)(LPCWSTR a0,
+ HANDLE a1,
+ DWORD a2)
+ = LoadLibraryExW;
+
+HMODULE (__stdcall * Real_LoadLibraryW)(LPCWSTR a0)
+ = LoadLibraryW;
+
+HMENU (__stdcall * Real_LoadMenuA)(HINSTANCE a0,
+ LPCSTR a1)
+ = LoadMenuA;
+
+HMENU (__stdcall * Real_LoadMenuIndirectA)(CONST MENUTEMPLATEA* a0)
+ = LoadMenuIndirectA;
+
+HMENU (__stdcall * Real_LoadMenuIndirectW)(CONST MENUTEMPLATEW* a0)
+ = LoadMenuIndirectW;
+
+HMENU (__stdcall * Real_LoadMenuW)(HINSTANCE a0,
+ LPCWSTR a1)
+ = LoadMenuW;
+
+DWORD (__stdcall * Real_LoadModule)(LPCSTR a0,
+ LPVOID a1)
+ = LoadModule;
+
+HGLOBAL (__stdcall * Real_LoadResource)(HMODULE a0,
+ HRSRC a1)
+ = LoadResource;
+
+int (__stdcall * Real_LoadStringA)(HINSTANCE a0,
+ UINT a1,
+ LPSTR a2,
+ int a3)
+ = LoadStringA;
+
+int (__stdcall * Real_LoadStringW)(HINSTANCE a0,
+ UINT a1,
+ LPWSTR a2,
+ int a3)
+ = LoadStringW;
+
+#if _MSC_VER < 1300
+HLOCAL (__stdcall * Real_LocalAlloc)(UINT a0,
+ UINT a1)
+ = LocalAlloc;
+#else
+HLOCAL (__stdcall * Real_LocalAlloc)(UINT a0,
+ SIZE_T a1)
+ = LocalAlloc;
+#endif
+
+#if _MSC_VER < 1300
+UINT (__stdcall * Real_LocalCompact)(UINT a0)
+ = LocalCompact;
+#else
+SIZE_T (__stdcall * Real_LocalCompact)(UINT a0)
+ = LocalCompact;
+#endif
+
+BOOL (__stdcall * Real_LocalFileTimeToFileTime)(CONST FILETIME* a0,
+ LPFILETIME a1)
+ = LocalFileTimeToFileTime;
+
+UINT (__stdcall * Real_LocalFlags)(HLOCAL a0)
+ = LocalFlags;
+
+HLOCAL (__stdcall * Real_LocalFree)(HLOCAL a0)
+ = LocalFree;
+
+HLOCAL (__stdcall * Real_LocalHandle)(LPCVOID a0)
+ = LocalHandle;
+
+LPVOID (__stdcall * Real_LocalLock)(HLOCAL a0)
+ = LocalLock;
+
+#if _MSC_VER < 1300
+HLOCAL (__stdcall * Real_LocalReAlloc)(HLOCAL a0,
+ UINT a1,
+ UINT a2)
+ = LocalReAlloc;
+#else
+HLOCAL (__stdcall * Real_LocalReAlloc)(HLOCAL a0,
+ SIZE_T a1,
+ UINT a2)
+ = LocalReAlloc;
+#endif
+
+#if _MSC_VER < 1300
+UINT (__stdcall * Real_LocalShrink)(HLOCAL a0,
+ UINT a1)
+ = LocalShrink;
+#else
+SIZE_T (__stdcall * Real_LocalShrink)(HLOCAL a0,
+ UINT a1)
+ = LocalShrink;
+#endif
+
+#if _MSC_VER < 1300
+UINT (__stdcall * Real_LocalSize)(HLOCAL a0)
+ = LocalSize;
+#else
+SIZE_T (__stdcall * Real_LocalSize)(HLOCAL a0)
+ = LocalSize;
+#endif
+
+BOOL (__stdcall * Real_LocalUnlock)(HLOCAL a0)
+ = LocalUnlock;
+
+BOOL (__stdcall * Real_LockFile)(HANDLE a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3,
+ DWORD a4)
+ = LockFile;
+
+BOOL (__stdcall * Real_LockFileEx)(HANDLE a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3,
+ DWORD a4,
+ LPOVERLAPPED a5)
+ = LockFileEx;
+
+LPVOID (__stdcall * Real_LockResource)(HGLOBAL a0)
+ = LockResource;
+
+BOOL (__stdcall * Real_LockWindowUpdate)(HWND a0)
+ = LockWindowUpdate;
+
+int (__stdcall * Real_LookupIconIdFromDirectory)(PBYTE a0,
+ BOOL a1)
+ = LookupIconIdFromDirectory;
+
+int (__stdcall * Real_LookupIconIdFromDirectoryEx)(PBYTE a0,
+ BOOL a1,
+ int a2,
+ int a3,
+ UINT a4)
+ = LookupIconIdFromDirectoryEx;
+
+BOOL (__stdcall * Real_MapDialogRect)(HWND a0,
+ LPRECT a1)
+ = MapDialogRect;
+
+LPVOID (__stdcall * Real_MapViewOfFile)(HANDLE a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3,
+ SIZE_T a4)
+ = MapViewOfFile;
+
+LPVOID (__stdcall * Real_MapViewOfFileEx)(HANDLE a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3,
+ SIZE_T a4,
+ LPVOID a5)
+ = MapViewOfFileEx;
+
+UINT (__stdcall * Real_MapVirtualKeyA)(UINT a0,
+ UINT a1)
+ = MapVirtualKeyA;
+
+UINT (__stdcall * Real_MapVirtualKeyExA)(UINT a0,
+ UINT a1,
+ HKL a2)
+ = MapVirtualKeyExA;
+
+UINT (__stdcall * Real_MapVirtualKeyExW)(UINT a0,
+ UINT a1,
+ HKL a2)
+ = MapVirtualKeyExW;
+
+UINT (__stdcall * Real_MapVirtualKeyW)(UINT a0,
+ UINT a1)
+ = MapVirtualKeyW;
+
+int (__stdcall * Real_MapWindowPoints)(HWND a0,
+ HWND a1,
+ POINT* a2,
+ UINT a3)
+ = MapWindowPoints;
+
+BOOL (__stdcall * Real_MaskBlt)(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ HDC a5,
+ int a6,
+ int a7,
+ HBITMAP a8,
+ int a9,
+ int a10,
+ DWORD a11)
+ = MaskBlt;
+
+int (__stdcall * Real_MenuItemFromPoint)(HWND a0,
+ HMENU a1,
+ POINT a2)
+ = MenuItemFromPoint;
+
+BOOL (__stdcall * Real_MessageBeep)(UINT a0)
+ = MessageBeep;
+
+int (__stdcall * Real_MessageBoxA)(HWND a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ UINT a3)
+ = MessageBoxA;
+
+int (__stdcall * Real_MessageBoxExA)(HWND a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ UINT a3,
+ WORD a4)
+ = MessageBoxExA;
+
+int (__stdcall * Real_MessageBoxExW)(HWND a0,
+ LPCWSTR a1,
+ LPCWSTR a2,
+ UINT a3,
+ WORD a4)
+ = MessageBoxExW;
+
+#if _MSC_VER < 1300
+int (__stdcall * Real_MessageBoxIndirectA)(MSGBOXPARAMSA* a0)
+ = MessageBoxIndirectA;
+#else
+int (__stdcall * Real_MessageBoxIndirectA)(CONST MSGBOXPARAMSA* a0)
+ = MessageBoxIndirectA;
+#endif
+
+#if _MSC_VER < 1300
+int (__stdcall * Real_MessageBoxIndirectW)(MSGBOXPARAMSW* a0)
+ = MessageBoxIndirectW;
+#else
+int (__stdcall * Real_MessageBoxIndirectW)(CONST MSGBOXPARAMSW* a0)
+ = MessageBoxIndirectW;
+#endif
+
+int (__stdcall * Real_MessageBoxW)(HWND a0,
+ LPCWSTR a1,
+ LPCWSTR a2,
+ UINT a3)
+ = MessageBoxW;
+
+HRESULT (__stdcall * Real_MkParseDisplayName)(IBindCtx* a0,
+ LPCOLESTR a1,
+ ULONG* a2,
+ IMoniker** a3)
+ = MkParseDisplayName;
+
+BOOL (__stdcall * Real_ModifyMenuA)(HMENU a0,
+ UINT a1,
+ UINT a2,
+ UINT_PTR a3,
+ LPCSTR a4)
+ = ModifyMenuA;
+
+BOOL (__stdcall * Real_ModifyMenuW)(HMENU a0,
+ UINT a1,
+ UINT a2,
+ UINT_PTR a3,
+ LPCWSTR a4)
+ = ModifyMenuW;
+
+BOOL (__stdcall * Real_ModifyWorldTransform)(HDC a0,
+ CONST XFORM* a1,
+ DWORD a2)
+ = ModifyWorldTransform;
+
+HRESULT (__stdcall * Real_MonikerCommonPrefixWith)(IMoniker* a0,
+ IMoniker* a1,
+ IMoniker** a2)
+ = MonikerCommonPrefixWith;
+
+HRESULT (__stdcall * Real_MonikerRelativePathTo)(IMoniker* a0,
+ IMoniker* a1,
+ IMoniker** a2,
+ BOOL a3)
+ = MonikerRelativePathTo;
+
+BOOL (__stdcall * Real_MoveFileA)(LPCSTR a0,
+ LPCSTR a1)
+ = MoveFileA;
+
+BOOL (__stdcall * Real_MoveFileExA)(LPCSTR a0,
+ LPCSTR a1,
+ DWORD a2)
+ = MoveFileExA;
+
+BOOL (__stdcall * Real_MoveFileExW)(LPCWSTR a0,
+ LPCWSTR a1,
+ DWORD a2)
+ = MoveFileExW;
+
+BOOL (__stdcall * Real_MoveFileW)(LPCWSTR a0,
+ LPCWSTR a1)
+ = MoveFileW;
+
+BOOL (__stdcall * Real_MoveToEx)(HDC a0,
+ int a1,
+ int a2,
+ POINT* a3)
+ = MoveToEx;
+
+BOOL (__stdcall * Real_MoveWindow)(HWND a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ BOOL a5)
+ = MoveWindow;
+
+#if _MSC_VER < 1300
+DWORD (__stdcall * Real_MsgWaitForMultipleObjects)(DWORD a0,
+ HANDLE * a1,
+ BOOL a2,
+ DWORD a3,
+ DWORD a4)
+ = MsgWaitForMultipleObjects;
+#else
+DWORD (__stdcall * Real_MsgWaitForMultipleObjects)(DWORD a0,
+ CONST HANDLE * a1,
+ BOOL a2,
+ DWORD a3,
+ DWORD a4)
+ = MsgWaitForMultipleObjects;
+#endif
+
+#if _MSC_VER < 1300
+DWORD (__stdcall * Real_MsgWaitForMultipleObjectsEx)(DWORD a0,
+ HANDLE * a1,
+ DWORD a2,
+ DWORD a3,
+ DWORD a4)
+ = MsgWaitForMultipleObjectsEx;
+#else
+DWORD (__stdcall * Real_MsgWaitForMultipleObjectsEx)(DWORD a0,
+ CONST HANDLE * a1,
+ DWORD a2,
+ DWORD a3,
+ DWORD a4)
+ = MsgWaitForMultipleObjectsEx;
+#endif
+
+int (__stdcall * Real_MulDiv)(int a0,
+ int a1,
+ int a2)
+ = MulDiv;
+
+DWORD (__stdcall * Real_OemKeyScan)(WORD a0)
+ = OemKeyScan;
+
+BOOL (__stdcall * Real_OemToCharA)(LPCSTR a0,
+ LPSTR a1)
+ = OemToCharA;
+
+BOOL (__stdcall * Real_OemToCharBuffA)(LPCSTR a0,
+ LPSTR a1,
+ DWORD a2)
+ = OemToCharBuffA;
+
+BOOL (__stdcall * Real_OemToCharBuffW)(LPCSTR a0,
+ LPWSTR a1,
+ DWORD a2)
+ = OemToCharBuffW;
+
+BOOL (__stdcall * Real_OemToCharW)(LPCSTR a0,
+ LPWSTR a1)
+ = OemToCharW;
+
+int (__stdcall * Real_OffsetClipRgn)(HDC a0,
+ int a1,
+ int a2)
+ = OffsetClipRgn;
+
+BOOL (__stdcall * Real_OffsetRect)(LPRECT a0,
+ int a1,
+ int a2)
+ = OffsetRect;
+
+int (__stdcall * Real_OffsetRgn)(HRGN a0,
+ int a1,
+ int a2)
+ = OffsetRgn;
+
+BOOL (__stdcall * Real_OffsetViewportOrgEx)(HDC a0,
+ int a1,
+ int a2,
+ POINT* a3)
+ = OffsetViewportOrgEx;
+
+BOOL (__stdcall * Real_OffsetWindowOrgEx)(HDC a0,
+ int a1,
+ int a2,
+ POINT* a3)
+ = OffsetWindowOrgEx;
+
+DWORD (__stdcall * Real_OleBuildVersion)(void)
+ = OleBuildVersion;
+
+HRESULT (__stdcall * Real_OleConvertIStorageToOLESTREAM)(IStorage* a0,
+ LPOLESTREAM a1)
+ = OleConvertIStorageToOLESTREAM;
+
+HRESULT (__stdcall * Real_OleConvertIStorageToOLESTREAMEx)(IStorage* a0,
+ CLIPFORMAT a1,
+ LONG a2,
+ LONG a3,
+ DWORD a4,
+ LPSTGMEDIUM a5,
+ LPOLESTREAM a6)
+ = OleConvertIStorageToOLESTREAMEx;
+
+HRESULT (__stdcall * Real_OleConvertOLESTREAMToIStorage)(LPOLESTREAM a0,
+ LPSTORAGE a1,
+ CONST DVTARGETDEVICE* a2)
+ = OleConvertOLESTREAMToIStorage;
+
+HRESULT (__stdcall * Real_OleConvertOLESTREAMToIStorageEx)(LPOLESTREAM a0,
+ LPSTORAGE a1,
+ CLIPFORMAT* a2,
+ LONG* a3,
+ LONG* a4,
+ DWORD* a5,
+ LPSTGMEDIUM a6)
+ = OleConvertOLESTREAMToIStorageEx;
+
+HRESULT (__stdcall * Real_OleCreate)(CONST IID& a0,
+ CONST IID& a1,
+ DWORD a2,
+ LPFORMATETC a3,
+ LPOLECLIENTSITE a4,
+ LPSTORAGE a5,
+ LPVOID* a6)
+ = OleCreate;
+
+HRESULT (__stdcall * Real_OleCreateDefaultHandler)(CONST IID& a0,
+ LPUNKNOWN a1,
+ CONST IID& a2,
+ LPVOID* a3)
+ = OleCreateDefaultHandler;
+
+HRESULT (__stdcall * Real_OleCreateEmbeddingHelper)(CONST IID& a0,
+ LPUNKNOWN a1,
+ DWORD a2,
+ LPCLASSFACTORY a3,
+ CONST IID& a4,
+ LPVOID* a5)
+ = OleCreateEmbeddingHelper;
+
+HRESULT (__stdcall * Real_OleCreateEx)(CONST IID& a0,
+ CONST IID& a1,
+ DWORD a2,
+ DWORD a3,
+ ULONG a4,
+ DWORD* a5,
+ LPFORMATETC a6,
+ IAdviseSink* a7,
+ DWORD* a8,
+ LPOLECLIENTSITE a9,
+ LPSTORAGE a10,
+ LPVOID* a11)
+ = OleCreateEx;
+
+HRESULT (__stdcall * Real_OleCreateFromData)(IDataObject* a0,
+ CONST IID& a1,
+ DWORD a2,
+ LPFORMATETC a3,
+ LPOLECLIENTSITE a4,
+ LPSTORAGE a5,
+ LPVOID* a6)
+ = OleCreateFromData;
+
+HRESULT (__stdcall * Real_OleCreateFromDataEx)(IDataObject* a0,
+ CONST IID& a1,
+ DWORD a2,
+ DWORD a3,
+ ULONG a4,
+ DWORD* a5,
+ LPFORMATETC a6,
+ IAdviseSink* a7,
+ DWORD* a8,
+ LPOLECLIENTSITE a9,
+ LPSTORAGE a10,
+ LPVOID* a11)
+ = OleCreateFromDataEx;
+
+HRESULT (__stdcall * Real_OleCreateFromFile)(CONST IID& a0,
+ LPCOLESTR a1,
+ CONST IID& a2,
+ DWORD a3,
+ LPFORMATETC a4,
+ LPOLECLIENTSITE a5,
+ LPSTORAGE a6,
+ LPVOID* a7)
+ = OleCreateFromFile;
+
+HRESULT (__stdcall * Real_OleCreateFromFileEx)(CONST IID& a0,
+ LPCOLESTR a1,
+ CONST IID& a2,
+ DWORD a3,
+ DWORD a4,
+ ULONG a5,
+ DWORD* a6,
+ LPFORMATETC a7,
+ IAdviseSink* a8,
+ DWORD* a9,
+ LPOLECLIENTSITE a10,
+ LPSTORAGE a11,
+ LPVOID* a12)
+ = OleCreateFromFileEx;
+
+HRESULT (__stdcall * Real_OleCreateLink)(IMoniker* a0,
+ CONST IID& a1,
+ DWORD a2,
+ LPFORMATETC a3,
+ LPOLECLIENTSITE a4,
+ LPSTORAGE a5,
+ LPVOID* a6)
+ = OleCreateLink;
+
+HRESULT (__stdcall * Real_OleCreateLinkEx)(IMoniker* a0,
+ CONST IID& a1,
+ DWORD a2,
+ DWORD a3,
+ ULONG a4,
+ DWORD* a5,
+ LPFORMATETC a6,
+ IAdviseSink* a7,
+ DWORD* a8,
+ LPOLECLIENTSITE a9,
+ LPSTORAGE a10,
+ LPVOID* a11)
+ = OleCreateLinkEx;
+
+HRESULT (__stdcall * Real_OleCreateLinkFromData)(IDataObject* a0,
+ CONST IID& a1,
+ DWORD a2,
+ LPFORMATETC a3,
+ LPOLECLIENTSITE a4,
+ LPSTORAGE a5,
+ LPVOID* a6)
+ = OleCreateLinkFromData;
+
+HRESULT (__stdcall * Real_OleCreateLinkFromDataEx)(IDataObject* a0,
+ CONST IID& a1,
+ DWORD a2,
+ DWORD a3,
+ ULONG a4,
+ DWORD* a5,
+ LPFORMATETC a6,
+ IAdviseSink* a7,
+ DWORD* a8,
+ LPOLECLIENTSITE a9,
+ LPSTORAGE a10,
+ LPVOID* a11)
+ = OleCreateLinkFromDataEx;
+
+HRESULT (__stdcall * Real_OleCreateLinkToFile)(LPCOLESTR a0,
+ CONST IID& a1,
+ DWORD a2,
+ LPFORMATETC a3,
+ LPOLECLIENTSITE a4,
+ LPSTORAGE a5,
+ LPVOID* a6)
+ = OleCreateLinkToFile;
+
+HRESULT (__stdcall * Real_OleCreateLinkToFileEx)(LPCOLESTR a0,
+ CONST IID& a1,
+ DWORD a2,
+ DWORD a3,
+ ULONG a4,
+ DWORD* a5,
+ LPFORMATETC a6,
+ IAdviseSink* a7,
+ DWORD* a8,
+ LPOLECLIENTSITE a9,
+ LPSTORAGE a10,
+ LPVOID* a11)
+ = OleCreateLinkToFileEx;
+
+HOLEMENU (__stdcall * Real_OleCreateMenuDescriptor)(HMENU a0,
+ LPOLEMENUGROUPWIDTHS a1)
+ = OleCreateMenuDescriptor;
+
+HRESULT (__stdcall * Real_OleCreateStaticFromData)(IDataObject* a0,
+ CONST IID& a1,
+ DWORD a2,
+ LPFORMATETC a3,
+ LPOLECLIENTSITE a4,
+ LPSTORAGE a5,
+ LPVOID* a6)
+ = OleCreateStaticFromData;
+
+HRESULT (__stdcall * Real_OleDestroyMenuDescriptor)(HOLEMENU a0)
+ = OleDestroyMenuDescriptor;
+
+HRESULT (__stdcall * Real_OleDoAutoConvert)(LPSTORAGE a0,
+ LPGUID a1)
+ = OleDoAutoConvert;
+
+HRESULT (__stdcall * Real_OleDraw)(LPUNKNOWN a0,
+ DWORD a1,
+ HDC a2,
+ LPCRECT a3)
+ = OleDraw;
+
+HANDLE (__stdcall * Real_OleDuplicateData)(HANDLE a0,
+ CLIPFORMAT a1,
+ UINT a2)
+ = OleDuplicateData;
+
+HRESULT (__stdcall * Real_OleFlushClipboard)(void)
+ = OleFlushClipboard;
+
+HRESULT (__stdcall * Real_OleGetAutoConvert)(CONST IID& a0,
+ LPGUID a1)
+ = OleGetAutoConvert;
+
+HRESULT (__stdcall * Real_OleGetClipboard)(IDataObject** a0)
+ = OleGetClipboard;
+
+HGLOBAL (__stdcall * Real_OleGetIconOfClass)(CONST IID& a0,
+ LPOLESTR a1,
+ BOOL a2)
+ = OleGetIconOfClass;
+
+HGLOBAL (__stdcall * Real_OleGetIconOfFile)(LPOLESTR a0,
+ BOOL a1)
+ = OleGetIconOfFile;
+
+HRESULT (__stdcall * Real_OleInitialize)(LPVOID a0)
+ = OleInitialize;
+
+HRESULT (__stdcall * Real_OleIsCurrentClipboard)(IDataObject* a0)
+ = OleIsCurrentClipboard;
+
+BOOL (__stdcall * Real_OleIsRunning)(IOleObject* a0)
+ = OleIsRunning;
+
+HRESULT (__stdcall * Real_OleLoad)(LPSTORAGE a0,
+ CONST IID& a1,
+ LPOLECLIENTSITE a2,
+ LPVOID* a3)
+ = OleLoad;
+
+HRESULT (__stdcall * Real_OleLoadFromStream)(LPSTREAM a0,
+ CONST IID& a1,
+ LPVOID* a2)
+ = OleLoadFromStream;
+
+HRESULT (__stdcall * Real_OleLockRunning)(LPUNKNOWN a0,
+ BOOL a1,
+ BOOL a2)
+ = OleLockRunning;
+
+HGLOBAL (__stdcall * Real_OleMetafilePictFromIconAndLabel)(HICON a0,
+ LPOLESTR a1,
+ LPOLESTR a2,
+ UINT a3)
+ = OleMetafilePictFromIconAndLabel;
+
+HRESULT (__stdcall * Real_OleNoteObjectVisible)(LPUNKNOWN a0,
+ BOOL a1)
+ = OleNoteObjectVisible;
+
+HRESULT (__stdcall * Real_OleQueryCreateFromData)(IDataObject* a0)
+ = OleQueryCreateFromData;
+
+HRESULT (__stdcall * Real_OleQueryLinkFromData)(IDataObject* a0)
+ = OleQueryLinkFromData;
+
+HRESULT (__stdcall * Real_OleRegEnumFormatEtc)(CONST IID& a0,
+ DWORD a1,
+ IEnumFORMATETC** a2)
+ = OleRegEnumFormatEtc;
+
+HRESULT (__stdcall * Real_OleRegEnumVerbs)(CONST IID& a0,
+ IEnumOLEVERB** a1)
+ = OleRegEnumVerbs;
+
+HRESULT (__stdcall * Real_OleRegGetMiscStatus)(CONST IID& a0,
+ DWORD a1,
+ DWORD* a2)
+ = OleRegGetMiscStatus;
+
+HRESULT (__stdcall * Real_OleRegGetUserType)(CONST IID& a0,
+ DWORD a1,
+ LPOLESTR* a2)
+ = OleRegGetUserType;
+
+HRESULT (__stdcall * Real_OleRun)(LPUNKNOWN a0)
+ = OleRun;
+
+HRESULT (__stdcall * Real_OleSave)(LPPERSISTSTORAGE a0,
+ LPSTORAGE a1,
+ BOOL a2)
+ = OleSave;
+
+HRESULT (__stdcall * Real_OleSaveToStream)(IPersistStream* a0,
+ LPSTREAM a1)
+ = OleSaveToStream;
+
+HRESULT (__stdcall * Real_OleSetAutoConvert)(CONST IID& a0,
+ CONST IID& a1)
+ = OleSetAutoConvert;
+
+HRESULT (__stdcall * Real_OleSetClipboard)(IDataObject* a0)
+ = OleSetClipboard;
+
+HRESULT (__stdcall * Real_OleSetContainedObject)(LPUNKNOWN a0,
+ BOOL a1)
+ = OleSetContainedObject;
+
+HRESULT (__stdcall * Real_OleSetMenuDescriptor)(HOLEMENU a0,
+ HWND a1,
+ HWND a2,
+ LPOLEINPLACEFRAME a3,
+ LPOLEINPLACEACTIVEOBJECT a4)
+ = OleSetMenuDescriptor;
+
+HRESULT (__stdcall * Real_OleTranslateAccelerator)(LPOLEINPLACEFRAME a0,
+ LPOLEINPLACEFRAMEINFO a1,
+ LPMSG a2)
+ = OleTranslateAccelerator;
+
+void (__stdcall * Real_OleUninitialize)(void)
+ = OleUninitialize;
+
+BOOL (__stdcall * Real_OpenClipboard)(HWND a0)
+ = OpenClipboard;
+
+#if _MSC_VER < 1300
+HDESK (__stdcall * Real_OpenDesktopA)(LPSTR a0,
+ DWORD a1,
+ BOOL a2,
+ ACCESS_MASK a3)
+ = OpenDesktopA;
+#else
+HDESK (__stdcall * Real_OpenDesktopA)(LPCSTR a0,
+ DWORD a1,
+ BOOL a2,
+ ACCESS_MASK a3)
+ = OpenDesktopA;
+#endif
+
+#if _MSC_VER < 1300
+HDESK (__stdcall * Real_OpenDesktopW)(LPWSTR a0,
+ DWORD a1,
+ BOOL a2,
+ ACCESS_MASK a3)
+ = OpenDesktopW;
+#else
+HDESK (__stdcall * Real_OpenDesktopW)(LPCWSTR a0,
+ DWORD a1,
+ BOOL a2,
+ ACCESS_MASK a3)
+ = OpenDesktopW;
+#endif
+
+HANDLE (__stdcall * Real_OpenEventA)(DWORD a0,
+ BOOL a1,
+ LPCSTR a2)
+ = OpenEventA;
+
+HANDLE (__stdcall * Real_OpenEventW)(DWORD a0,
+ BOOL a1,
+ LPCWSTR a2)
+ = OpenEventW;
+
+HFILE (__stdcall * Real_OpenFile)(LPCSTR a0,
+ LPOFSTRUCT a1,
+ UINT a2)
+ = OpenFile;
+
+HANDLE (__stdcall * Real_OpenFileMappingA)(DWORD a0,
+ BOOL a1,
+ LPCSTR a2)
+ = OpenFileMappingA;
+
+HANDLE (__stdcall * Real_OpenFileMappingW)(DWORD a0,
+ BOOL a1,
+ LPCWSTR a2)
+ = OpenFileMappingW;
+
+BOOL (__stdcall * Real_OpenIcon)(HWND a0)
+ = OpenIcon;
+
+HDESK (__stdcall * Real_OpenInputDesktop)(DWORD a0,
+ BOOL a1,
+ ACCESS_MASK a2)
+ = OpenInputDesktop;
+
+HANDLE (__stdcall * Real_OpenMutexA)(DWORD a0,
+ BOOL a1,
+ LPCSTR a2)
+ = OpenMutexA;
+
+HANDLE (__stdcall * Real_OpenMutexW)(DWORD a0,
+ BOOL a1,
+ LPCWSTR a2)
+ = OpenMutexW;
+
+HANDLE (__stdcall * Real_OpenProcess)(DWORD a0,
+ BOOL a1,
+ DWORD pid)
+ = OpenProcess;
+
+BOOL (__stdcall * Real_OpenProcessToken)(__in HANDLE ProcessHandle,
+ __in DWORD DesiredAccess,
+ __out PHANDLE TokenHandle
+ )
+ = OpenProcessToken;
+
+HANDLE (__stdcall * Real_OpenSemaphoreA)(DWORD a0,
+ BOOL a1,
+ LPCSTR a2)
+ = OpenSemaphoreA;
+
+HANDLE (__stdcall * Real_OpenSemaphoreW)(DWORD a0,
+ BOOL a1,
+ LPCWSTR a2)
+ = OpenSemaphoreW;
+
+HANDLE (__stdcall * Real_OpenWaitableTimerA)(DWORD a0,
+ BOOL a1,
+ LPCSTR a2)
+ = OpenWaitableTimerA;
+
+HANDLE (__stdcall * Real_OpenWaitableTimerW)(DWORD a0,
+ BOOL a1,
+ LPCWSTR a2)
+ = OpenWaitableTimerW;
+
+#if _MSC_VER < 1300
+HWINSTA (__stdcall * Real_OpenWindowStationA)(LPSTR a0,
+ BOOL a1,
+ ACCESS_MASK a2)
+ = OpenWindowStationA;
+#else
+HWINSTA (__stdcall * Real_OpenWindowStationA)(LPCSTR a0,
+ BOOL a1,
+ ACCESS_MASK a2)
+ = OpenWindowStationA;
+#endif
+
+#if _MSC_VER < 1300
+HWINSTA (__stdcall * Real_OpenWindowStationW)(LPWSTR a0,
+ BOOL a1,
+ ACCESS_MASK a2)
+ = OpenWindowStationW;
+#else
+HWINSTA (__stdcall * Real_OpenWindowStationW)(LPCWSTR a0,
+ BOOL a1,
+ ACCESS_MASK a2)
+ = OpenWindowStationW;
+#endif
+
+void (__stdcall * Real_OutputDebugStringA)(LPCSTR a0)
+ = OutputDebugStringA;
+
+void (__stdcall * Real_OutputDebugStringW)(LPCWSTR a0)
+ = OutputDebugStringW;
+
+LPARAM (__stdcall * Real_PackDDElParam)(UINT a0,
+ UINT_PTR a1,
+ UINT_PTR a2)
+ = PackDDElParam;
+
+BOOL (__stdcall * Real_PaintDesktop)(HDC a0)
+ = PaintDesktop;
+
+BOOL (__stdcall * Real_PaintRgn)(HDC a0,
+ HRGN a1)
+ = PaintRgn;
+
+BOOL (__stdcall * Real_PatBlt)(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ DWORD a5)
+ = PatBlt;
+
+HRGN (__stdcall * Real_PathToRegion)(HDC a0)
+ = PathToRegion;
+
+BOOL (__stdcall * Real_PeekConsoleInputA)(HANDLE a0,
+ PINPUT_RECORD a1,
+ DWORD a2,
+ LPDWORD a3)
+ = PeekConsoleInputA;
+
+BOOL (__stdcall * Real_PeekConsoleInputW)(HANDLE a0,
+ PINPUT_RECORD a1,
+ DWORD a2,
+ LPDWORD a3)
+ = PeekConsoleInputW;
+
+BOOL (__stdcall * Real_PeekMessageA)(LPMSG a0,
+ HWND a1,
+ UINT a2,
+ UINT a3,
+ UINT a4)
+ = PeekMessageA;
+
+BOOL (__stdcall * Real_PeekMessageW)(LPMSG a0,
+ HWND a1,
+ UINT a2,
+ UINT a3,
+ UINT a4)
+ = PeekMessageW;
+
+BOOL (__stdcall * Real_PeekNamedPipe)(HANDLE a0,
+ LPVOID a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPDWORD a5)
+ = PeekNamedPipe;
+
+BOOL (__stdcall * Real_Pie)(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ int a5,
+ int a6,
+ int a7,
+ int a8)
+ = Pie;
+
+BOOL (__stdcall * Real_PlayEnhMetaFile)(HDC a0,
+ HENHMETAFILE a1,
+ CONST RECT* a2)
+ = PlayEnhMetaFile;
+
+BOOL (__stdcall * Real_PlayEnhMetaFileRecord)(HDC a0,
+ LPHANDLETABLE a1,
+ CONST ENHMETARECORD* a2,
+ UINT a3)
+ = PlayEnhMetaFileRecord;
+
+BOOL (__stdcall * Real_PlayMetaFile)(HDC a0,
+ HMETAFILE a1)
+ = PlayMetaFile;
+
+BOOL (__stdcall * Real_PlayMetaFileRecord)(HDC a0,
+ LPHANDLETABLE a1,
+ LPMETARECORD a2,
+ UINT a3)
+ = PlayMetaFileRecord;
+
+BOOL (__stdcall * Real_PlgBlt)(HDC a0,
+ CONST POINT* a1,
+ HDC a2,
+ int a3,
+ int a4,
+ int a5,
+ int a6,
+ HBITMAP a7,
+ int a8,
+ int a9)
+ = PlgBlt;
+
+BOOL (__stdcall * Real_PolyBezier)(HDC a0,
+ CONST POINT* a1,
+ DWORD a2)
+ = PolyBezier;
+
+BOOL (__stdcall * Real_PolyBezierTo)(HDC a0,
+ CONST POINT* a1,
+ DWORD a2)
+ = PolyBezierTo;
+
+BOOL (__stdcall * Real_PolyDraw)(HDC a0,
+ CONST POINT* a1,
+ CONST BYTE* a2,
+ int a3)
+ = PolyDraw;
+
+BOOL (__stdcall * Real_PolyPolygon)(HDC a0,
+ CONST POINT* a1,
+ CONST INT* a2,
+ int a3)
+ = PolyPolygon;
+
+BOOL (__stdcall * Real_PolyPolyline)(HDC a0,
+ CONST POINT* a1,
+ CONST DWORD* a2,
+ DWORD a3)
+ = PolyPolyline;
+
+BOOL (__stdcall * Real_PolyTextOutA)(HDC a0,
+ CONST POLYTEXTA* a1,
+ int a2)
+ = PolyTextOutA;
+
+BOOL (__stdcall * Real_PolyTextOutW)(HDC a0,
+ CONST POLYTEXTW* a1,
+ int a2)
+ = PolyTextOutW;
+
+BOOL (__stdcall * Real_Polygon)(HDC a0,
+ CONST POINT* a1,
+ int a2)
+ = Polygon;
+
+BOOL (__stdcall * Real_Polyline)(HDC a0,
+ CONST POINT* a1,
+ int a2)
+ = Polyline;
+
+BOOL (__stdcall * Real_PolylineTo)(HDC a0,
+ CONST POINT* a1,
+ DWORD a2)
+ = PolylineTo;
+
+BOOL (__stdcall * Real_PostMessageA)(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3)
+ = PostMessageA;
+
+BOOL (__stdcall * Real_PostMessageW)(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3)
+ = PostMessageW;
+
+BOOL (__stdcall * Real_PostQueuedCompletionStatus)(HANDLE a0,
+ DWORD a1,
+ ULONG_PTR a2,
+ LPOVERLAPPED a3)
+ = PostQueuedCompletionStatus;
+
+void (__stdcall * Real_PostQuitMessage)(int a0)
+ = PostQuitMessage;
+
+BOOL (__stdcall * Real_PostThreadMessageA)(DWORD a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3)
+ = PostThreadMessageA;
+
+BOOL (__stdcall * Real_PostThreadMessageW)(DWORD a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3)
+ = PostThreadMessageW;
+
+DWORD (__stdcall * Real_PrepareTape)(HANDLE a0,
+ DWORD a1,
+ BOOL a2)
+ = PrepareTape;
+
+HRESULT (__stdcall * Real_ProgIDFromCLSID)(CONST IID& a0,
+ LPOLESTR* a1)
+ = ProgIDFromCLSID;
+
+HRESULT (__stdcall * Real_PropVariantClear)(PROPVARIANT* a0)
+ = PropVariantClear;
+
+HRESULT (__stdcall * Real_PropVariantCopy)(PROPVARIANT* a0,
+ CONST PROPVARIANT* a1)
+ = PropVariantCopy;
+
+BOOL (__stdcall * Real_PtInRect)(CONST RECT* a0,
+ POINT a1)
+ = PtInRect;
+
+BOOL (__stdcall * Real_PtInRegion)(HRGN a0,
+ int a1,
+ int a2)
+ = PtInRegion;
+
+BOOL (__stdcall * Real_PtVisible)(HDC a0,
+ int a1,
+ int a2)
+ = PtVisible;
+
+BOOL (__stdcall * Real_PulseEvent)(HANDLE a0)
+ = PulseEvent;
+
+BOOL (__stdcall * Real_PurgeComm)(HANDLE a0,
+ DWORD a1)
+ = PurgeComm;
+
+DWORD (__stdcall * Real_QueryDosDeviceA)(LPCSTR a0,
+ LPSTR a1,
+ DWORD a2)
+ = QueryDosDeviceA;
+
+DWORD (__stdcall * Real_QueryDosDeviceW)(LPCWSTR a0,
+ LPWSTR a1,
+ DWORD a2)
+ = QueryDosDeviceW;
+
+BOOL (__stdcall * Real_QueryPerformanceCounter)(LARGE_INTEGER* a0)
+ = QueryPerformanceCounter;
+
+BOOL (__stdcall * Real_QueryPerformanceFrequency)(LARGE_INTEGER* a0)
+ = QueryPerformanceFrequency;
+
+DWORD (__stdcall * Real_QueueUserAPC)(PAPCFUNC a0,
+ HANDLE a1,
+ ULONG_PTR a2)
+ = QueueUserAPC;
+
+void (__stdcall * Real_RaiseException)(DWORD a0,
+ DWORD a1,
+ DWORD a2,
+ CONST ULONG_PTR* a3)
+ = RaiseException;
+
+HRESULT (__stdcall * Real_ReadClassStg)(LPSTORAGE a0,
+ CLSID* a1)
+ = ReadClassStg;
+
+HRESULT (__stdcall * Real_ReadClassStm)(LPSTREAM a0,
+ CLSID* a1)
+ = ReadClassStm;
+
+BOOL (__stdcall * Real_ReadConsoleA)(
+ HANDLE a0,
+ LPVOID a1,
+ DWORD a2,
+ LPDWORD a3,
+#ifdef ENABLE_INSERT_MODE
+ PCONSOLE_READCONSOLE_CONTROL a4
+#else
+ LPVOID a4
+#endif
+ )
+ = ReadConsoleA;
+
+BOOL (__stdcall * Real_ReadConsoleInputA)(HANDLE a0,
+ PINPUT_RECORD a1,
+ DWORD a2,
+ LPDWORD a3)
+ = ReadConsoleInputA;
+
+BOOL (__stdcall * Real_ReadConsoleInputW)(HANDLE a0,
+ PINPUT_RECORD a1,
+ DWORD a2,
+ LPDWORD a3)
+ = ReadConsoleInputW;
+
+BOOL (__stdcall * Real_ReadConsoleOutputA)(HANDLE a0,
+ PCHAR_INFO a1,
+ COORD a2,
+ COORD a3,
+ PSMALL_RECT a4)
+ = ReadConsoleOutputA;
+
+BOOL (__stdcall * Real_ReadConsoleOutputAttribute)(HANDLE a0,
+ LPWORD a1,
+ DWORD a2,
+ COORD a3,
+ LPDWORD a4)
+ = ReadConsoleOutputAttribute;
+
+BOOL (__stdcall * Real_ReadConsoleOutputCharacterA)(HANDLE a0,
+ LPSTR a1,
+ DWORD a2,
+ COORD a3,
+ LPDWORD a4)
+ = ReadConsoleOutputCharacterA;
+
+BOOL (__stdcall * Real_ReadConsoleOutputCharacterW)(HANDLE a0,
+ LPWSTR a1,
+ DWORD a2,
+ COORD a3,
+ LPDWORD a4)
+ = ReadConsoleOutputCharacterW;
+
+BOOL (__stdcall * Real_ReadConsoleOutputW)(HANDLE a0,
+ PCHAR_INFO a1,
+ COORD a2,
+ COORD a3,
+ PSMALL_RECT a4)
+ = ReadConsoleOutputW;
+
+BOOL (__stdcall * Real_ReadConsoleW)(
+ HANDLE a0,
+ LPVOID a1,
+ DWORD a2,
+ LPDWORD a3,
+#ifdef ENABLE_INSERT_MODE
+ PCONSOLE_READCONSOLE_CONTROL a4
+#else
+ LPVOID a4
+#endif
+ )
+ = ReadConsoleW;
+
+BOOL (__stdcall * Real_ReadDirectoryChangesW)(HANDLE a0,
+ LPVOID a1,
+ DWORD a2,
+ BOOL a3,
+ DWORD a4,
+ LPDWORD a5,
+ LPOVERLAPPED a6,
+ LPOVERLAPPED_COMPLETION_ROUTINE a7)
+ = ReadDirectoryChangesW;
+
+BOOL (__stdcall * Real_ReadFile)(HANDLE a0,
+ LPVOID a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPOVERLAPPED a4)
+ = ReadFile;
+
+BOOL (__stdcall * Real_ReadFileEx)(HANDLE a0,
+ LPVOID a1,
+ DWORD a2,
+ LPOVERLAPPED a3,
+ LPOVERLAPPED_COMPLETION_ROUTINE a4)
+ = ReadFileEx;
+
+HRESULT (__stdcall * Real_ReadFmtUserTypeStg)(LPSTORAGE a0,
+ CLIPFORMAT* a1,
+ LPOLESTR* a2)
+ = ReadFmtUserTypeStg;
+
+BOOL (__stdcall * Real_ReadProcessMemory)(HANDLE a0,
+ LPCVOID a1,
+ LPVOID a2,
+ DWORD_PTR a3,
+ PDWORD_PTR a4)
+ = ReadProcessMemory;
+
+UINT (__stdcall * Real_RealizePalette)(HDC a0)
+ = RealizePalette;
+
+BOOL (__stdcall * Real_RectInRegion)(HRGN a0,
+ CONST RECT* a1)
+ = RectInRegion;
+
+BOOL (__stdcall * Real_RectVisible)(HDC a0,
+ CONST RECT* a1)
+ = RectVisible;
+
+BOOL (__stdcall * Real_Rectangle)(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4)
+ = Rectangle;
+
+BOOL (__stdcall * Real_RedrawWindow)(HWND a0,
+ CONST RECT* a1,
+ HRGN a2,
+ UINT a3)
+ = RedrawWindow;
+
+ATOM (__stdcall * Real_RegisterClassA)(CONST WNDCLASSA* a0)
+ = RegisterClassA;
+
+ATOM (__stdcall * Real_RegisterClassExA)(CONST WNDCLASSEXA* a0)
+ = RegisterClassExA;
+
+ATOM (__stdcall * Real_RegisterClassExW)(CONST WNDCLASSEXW* a0)
+ = RegisterClassExW;
+
+ATOM (__stdcall * Real_RegisterClassW)(CONST WNDCLASSW* a0)
+ = RegisterClassW;
+
+UINT (__stdcall * Real_RegisterClipboardFormatA)(LPCSTR a0)
+ = RegisterClipboardFormatA;
+
+UINT (__stdcall * Real_RegisterClipboardFormatW)(LPCWSTR a0)
+ = RegisterClipboardFormatW;
+
+HRESULT (__stdcall * Real_RegisterDragDrop)(HWND a0,
+ IDropTarget* a1)
+ = RegisterDragDrop;
+
+BOOL (__stdcall * Real_RegisterHotKey)(HWND a0,
+ int a1,
+ UINT a2,
+ UINT a3)
+ = RegisterHotKey;
+
+UINT (__stdcall * Real_RegisterWindowMessageA)(LPCSTR a0)
+ = RegisterWindowMessageA;
+
+UINT (__stdcall * Real_RegisterWindowMessageW)(LPCWSTR a0)
+ = RegisterWindowMessageW;
+
+BOOL (__stdcall * Real_ReleaseCapture)(void)
+ = ReleaseCapture;
+
+int (__stdcall * Real_ReleaseDC)(HWND a0,
+ HDC a1)
+ = ReleaseDC;
+
+BOOL (__stdcall * Real_ReleaseMutex)(HANDLE a0)
+ = ReleaseMutex;
+
+BOOL (__stdcall * Real_ReleaseSemaphore)(HANDLE a0,
+ LONG a1,
+ LPLONG a2)
+ = ReleaseSemaphore;
+
+void (__stdcall * Real_ReleaseStgMedium)(LPSTGMEDIUM a0)
+ = ReleaseStgMedium;
+
+BOOL (__stdcall * Real_RemoveDirectoryA)(LPCSTR a0)
+ = RemoveDirectoryA;
+
+BOOL (__stdcall * Real_RemoveDirectoryW)(LPCWSTR a0)
+ = RemoveDirectoryW;
+
+BOOL (__stdcall * Real_RemoveFontResourceA)(LPCSTR a0)
+ = RemoveFontResourceA;
+
+BOOL (__stdcall * Real_RemoveFontResourceW)(LPCWSTR a0)
+ = RemoveFontResourceW;
+
+BOOL (__stdcall * Real_RemoveMenu)(HMENU a0,
+ UINT a1,
+ UINT a2)
+ = RemoveMenu;
+
+HANDLE (__stdcall * Real_RemovePropA)(HWND a0,
+ LPCSTR a1)
+ = RemovePropA;
+
+HANDLE (__stdcall * Real_RemovePropW)(HWND a0,
+ LPCWSTR a1)
+ = RemovePropW;
+
+BOOL (__stdcall * Real_ReplyMessage)(LRESULT a0)
+ = ReplyMessage;
+
+HDC (__stdcall * Real_ResetDCA)(HDC a0,
+ CONST DEVMODEA* a1)
+ = ResetDCA;
+
+HDC (__stdcall * Real_ResetDCW)(HDC a0,
+ CONST DEVMODEW* a1)
+ = ResetDCW;
+
+BOOL (__stdcall * Real_ResetEvent)(HANDLE a0)
+ = ResetEvent;
+
+BOOL (__stdcall * Real_ResizePalette)(HPALETTE a0,
+ UINT a1)
+ = ResizePalette;
+
+BOOL (__stdcall * Real_RestoreDC)(HDC a0,
+ int a1)
+ = RestoreDC;
+
+DWORD (__stdcall * Real_ResumeThread)(HANDLE a0)
+ = ResumeThread;
+
+LPARAM (__stdcall * Real_ReuseDDElParam)(LPARAM a0,
+ UINT a1,
+ UINT a2,
+ UINT_PTR a3,
+ UINT_PTR a4)
+ = ReuseDDElParam;
+
+HRESULT (__stdcall * Real_RevokeDragDrop)(HWND a0)
+ = RevokeDragDrop;
+
+BOOL (__stdcall * Real_RoundRect)(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ int a5,
+ int a6)
+ = RoundRect;
+
+int (__stdcall * Real_SaveDC)(HDC a0)
+ = SaveDC;
+
+BOOL (__stdcall * Real_ScaleViewportExtEx)(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ SIZE* a5)
+ = ScaleViewportExtEx;
+
+BOOL (__stdcall * Real_ScaleWindowExtEx)(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ SIZE* a5)
+ = ScaleWindowExtEx;
+
+BOOL (__stdcall * Real_ScreenToClient)(HWND a0,
+ POINT* a1)
+ = ScreenToClient;
+
+BOOL (__stdcall * Real_ScrollConsoleScreenBufferA)(HANDLE a0,
+ CONST SMALL_RECT* a1,
+ CONST SMALL_RECT* a2,
+ COORD a3,
+ CONST CHAR_INFO* a4)
+ = ScrollConsoleScreenBufferA;
+
+BOOL (__stdcall * Real_ScrollConsoleScreenBufferW)(HANDLE a0,
+ CONST SMALL_RECT* a1,
+ CONST SMALL_RECT* a2,
+ COORD a3,
+ CONST CHAR_INFO* a4)
+ = ScrollConsoleScreenBufferW;
+
+BOOL (__stdcall * Real_ScrollDC)(HDC a0,
+ int a1,
+ int a2,
+ CONST RECT* a3,
+ CONST RECT* a4,
+ HRGN a5,
+ LPRECT a6)
+ = ScrollDC;
+
+BOOL (__stdcall * Real_ScrollWindow)(HWND a0,
+ int a1,
+ int a2,
+ CONST RECT* a3,
+ CONST RECT* a4)
+ = ScrollWindow;
+
+int (__stdcall * Real_ScrollWindowEx)(HWND a0,
+ int a1,
+ int a2,
+ CONST RECT* a3,
+ CONST RECT* a4,
+ HRGN a5,
+ LPRECT a6,
+ UINT a7)
+ = ScrollWindowEx;
+
+DWORD (__stdcall * Real_SearchPathA)(LPCSTR a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ DWORD a3,
+ LPSTR a4,
+ LPSTR* a5)
+ = SearchPathA;
+
+DWORD (__stdcall * Real_SearchPathW)(LPCWSTR a0,
+ LPCWSTR a1,
+ LPCWSTR a2,
+ DWORD a3,
+ LPWSTR a4,
+ LPWSTR* a5)
+ = SearchPathW;
+
+BOOL (__stdcall * Real_SelectClipPath)(HDC a0,
+ int a1)
+ = SelectClipPath;
+
+int (__stdcall * Real_SelectClipRgn)(HDC a0,
+ HRGN a1)
+ = SelectClipRgn;
+
+HGDIOBJ (__stdcall * Real_SelectObject)(HDC a0,
+ HGDIOBJ a1)
+ = SelectObject;
+
+HPALETTE (__stdcall * Real_SelectPalette)(HDC a0,
+ HPALETTE a1,
+ BOOL a2)
+ = SelectPalette;
+
+LRESULT (__stdcall * Real_SendDlgItemMessageA)(HWND a0,
+ int a1,
+ UINT a2,
+ WPARAM a3,
+ LPARAM a4)
+ = SendDlgItemMessageA;
+
+LRESULT (__stdcall * Real_SendDlgItemMessageW)(HWND a0,
+ int a1,
+ UINT a2,
+ WPARAM a3,
+ LPARAM a4)
+ = SendDlgItemMessageW;
+
+LRESULT (__stdcall * Real_SendMessageA)(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3)
+ = SendMessageA;
+
+BOOL (__stdcall * Real_SendMessageCallbackA)(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3,
+ SENDASYNCPROC a4,
+ ULONG_PTR a5)
+ = SendMessageCallbackA;
+
+BOOL (__stdcall * Real_SendMessageCallbackW)(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3,
+ SENDASYNCPROC a4,
+ ULONG_PTR a5)
+ = SendMessageCallbackW;
+
+LRESULT (__stdcall * Real_SendMessageTimeoutA)(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3,
+ UINT a4,
+ UINT a5,
+ PULONG_PTR a6)
+ = SendMessageTimeoutA;
+
+LRESULT (__stdcall * Real_SendMessageTimeoutW)(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3,
+ UINT a4,
+ UINT a5,
+ PULONG_PTR a6)
+ = SendMessageTimeoutW;
+
+LRESULT (__stdcall * Real_SendMessageW)(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3)
+ = SendMessageW;
+
+BOOL (__stdcall * Real_SendNotifyMessageA)(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3)
+ = SendNotifyMessageA;
+
+BOOL (__stdcall * Real_SendNotifyMessageW)(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3)
+ = SendNotifyMessageW;
+
+int (__stdcall * Real_SetAbortProc)(HDC a0,
+ ABORTPROC a1)
+ = SetAbortProc;
+
+HWND (__stdcall * Real_SetActiveWindow)(HWND a0)
+ = SetActiveWindow;
+
+int (__stdcall * Real_SetArcDirection)(HDC a0,
+ int a1)
+ = SetArcDirection;
+
+LONG (__stdcall * Real_SetBitmapBits)(HBITMAP a0,
+ DWORD a1,
+ CONST void* a2)
+ = SetBitmapBits;
+
+BOOL (__stdcall * Real_SetBitmapDimensionEx)(HBITMAP a0,
+ int a1,
+ int a2,
+ SIZE* a3)
+ = SetBitmapDimensionEx;
+
+COLORREF (__stdcall * Real_SetBkColor)(HDC a0,
+ COLORREF a1)
+ = SetBkColor;
+
+int (__stdcall * Real_SetBkMode)(HDC a0,
+ int a1)
+ = SetBkMode;
+
+UINT (__stdcall * Real_SetBoundsRect)(HDC a0,
+ CONST RECT* a1,
+ UINT a2)
+ = SetBoundsRect;
+
+BOOL (__stdcall * Real_SetBrushOrgEx)(HDC a0,
+ int a1,
+ int a2,
+ POINT* a3)
+ = SetBrushOrgEx;
+
+HWND (__stdcall * Real_SetCapture)(HWND a0)
+ = SetCapture;
+
+BOOL (__stdcall * Real_SetCaretBlinkTime)(UINT a0)
+ = SetCaretBlinkTime;
+
+BOOL (__stdcall * Real_SetCaretPos)(int a0,
+ int a1)
+ = SetCaretPos;
+
+DWORD (__stdcall * Real_SetClassLongA)(HWND a0,
+ int a1,
+ LONG a2)
+ = SetClassLongA;
+
+DWORD (__stdcall * Real_SetClassLongW)(HWND a0,
+ int a1,
+ LONG a2)
+ = SetClassLongW;
+
+WORD (__stdcall * Real_SetClassWord)(HWND a0,
+ int a1,
+ WORD a2)
+ = SetClassWord;
+
+HANDLE (__stdcall * Real_SetClipboardData)(UINT a0,
+ HANDLE a1)
+ = SetClipboardData;
+
+HWND (__stdcall * Real_SetClipboardViewer)(HWND a0)
+ = SetClipboardViewer;
+
+BOOL (__stdcall * Real_SetColorAdjustment)(HDC a0,
+ CONST COLORADJUSTMENT* a1)
+ = SetColorAdjustment;
+
+HCOLORSPACE (__stdcall * Real_SetColorSpace)(HDC a0,
+ HCOLORSPACE a1)
+ = SetColorSpace;
+
+BOOL (__stdcall * Real_SetCommBreak)(HANDLE a0)
+ = SetCommBreak;
+
+BOOL (__stdcall * Real_SetCommConfig)(HANDLE a0,
+ LPCOMMCONFIG a1,
+ DWORD a2)
+ = SetCommConfig;
+
+BOOL (__stdcall * Real_SetCommMask)(HANDLE a0,
+ DWORD a1)
+ = SetCommMask;
+
+BOOL (__stdcall * Real_SetCommState)(HANDLE a0,
+ LPDCB a1)
+ = SetCommState;
+
+BOOL (__stdcall * Real_SetCommTimeouts)(HANDLE a0,
+ LPCOMMTIMEOUTS a1)
+ = SetCommTimeouts;
+
+BOOL (__stdcall * Real_SetComputerNameA)(LPCSTR a0)
+ = SetComputerNameA;
+
+BOOL (__stdcall * Real_SetComputerNameW)(LPCWSTR a0)
+ = SetComputerNameW;
+
+BOOL (__stdcall * Real_SetConsoleActiveScreenBuffer)(HANDLE a0)
+ = SetConsoleActiveScreenBuffer;
+
+BOOL (__stdcall * Real_SetConsoleCP)(UINT a0)
+ = SetConsoleCP;
+
+BOOL (__stdcall * Real_SetConsoleCtrlHandler)(PHANDLER_ROUTINE a0,
+ BOOL a1)
+ = SetConsoleCtrlHandler;
+
+BOOL (__stdcall * Real_SetConsoleCursorInfo)(HANDLE a0,
+ CONST CONSOLE_CURSOR_INFO* a1)
+ = SetConsoleCursorInfo;
+
+BOOL (__stdcall * Real_SetConsoleCursorPosition)(HANDLE a0,
+ COORD a1)
+ = SetConsoleCursorPosition;
+
+BOOL (__stdcall * Real_SetConsoleMode)(HANDLE a0,
+ DWORD a1)
+ = SetConsoleMode;
+
+BOOL (__stdcall * Real_SetConsoleOutputCP)(UINT a0)
+ = SetConsoleOutputCP;
+
+BOOL (__stdcall * Real_SetConsoleScreenBufferSize)(HANDLE a0,
+ COORD a1)
+ = SetConsoleScreenBufferSize;
+
+BOOL (__stdcall * Real_SetConsoleTextAttribute)(HANDLE a0,
+ WORD a1)
+ = SetConsoleTextAttribute;
+
+BOOL (__stdcall * Real_SetConsoleTitleA)(LPCSTR a0)
+ = SetConsoleTitleA;
+
+BOOL (__stdcall * Real_SetConsoleTitleW)(LPCWSTR a0)
+ = SetConsoleTitleW;
+
+BOOL (__stdcall * Real_SetConsoleWindowInfo)(HANDLE a0,
+ BOOL a1,
+ CONST SMALL_RECT* a2)
+ = SetConsoleWindowInfo;
+
+HRESULT (__stdcall * Real_SetConvertStg)(LPSTORAGE a0,
+ BOOL a1)
+ = SetConvertStg;
+
+BOOL (__stdcall * Real_SetCurrentDirectoryA)(LPCSTR a0)
+ = SetCurrentDirectoryA;
+
+BOOL (__stdcall * Real_SetCurrentDirectoryW)(LPCWSTR a0)
+ = SetCurrentDirectoryW;
+
+HCURSOR (__stdcall * Real_SetCursor)(HCURSOR a0)
+ = SetCursor;
+
+BOOL (__stdcall * Real_SetCursorPos)(int a0,
+ int a1)
+ = SetCursorPos;
+
+UINT (__stdcall * Real_SetDIBColorTable)(HDC a0,
+ UINT a1,
+ UINT a2,
+ CONST RGBQUAD* a3)
+ = SetDIBColorTable;
+
+int (__stdcall * Real_SetDIBits)(HDC a0,
+ HBITMAP a1,
+ UINT a2,
+ UINT a3,
+ CONST void* a4,
+ CONST BITMAPINFO* a5,
+ UINT a6)
+ = SetDIBits;
+
+int (__stdcall * Real_SetDIBitsToDevice)(HDC a0,
+ int a1,
+ int a2,
+ DWORD a3,
+ DWORD a4,
+ int a5,
+ int a6,
+ UINT a7,
+ UINT a8,
+ CONST void* a9,
+ CONST BITMAPINFO* a10,
+ UINT a11)
+ = SetDIBitsToDevice;
+
+BOOL (__stdcall * Real_SetDefaultCommConfigA)(LPCSTR a0,
+ LPCOMMCONFIG a1,
+ DWORD a2)
+ = SetDefaultCommConfigA;
+
+BOOL (__stdcall * Real_SetDefaultCommConfigW)(LPCWSTR a0,
+ LPCOMMCONFIG a1,
+ DWORD a2)
+ = SetDefaultCommConfigW;
+
+BOOL (__stdcall * Real_SetDeviceGammaRamp)(HDC a0,
+ LPVOID a1)
+ = SetDeviceGammaRamp;
+
+BOOL (__stdcall * Real_SetDlgItemInt)(HWND a0,
+ int a1,
+ UINT a2,
+ BOOL a3)
+ = SetDlgItemInt;
+
+BOOL (__stdcall * Real_SetDlgItemTextA)(HWND a0,
+ int a1,
+ LPCSTR a2)
+ = SetDlgItemTextA;
+
+BOOL (__stdcall * Real_SetDlgItemTextW)(HWND a0,
+ int a1,
+ LPCWSTR a2)
+ = SetDlgItemTextW;
+
+BOOL (__stdcall * Real_SetDoubleClickTime)(UINT a0)
+ = SetDoubleClickTime;
+
+BOOL (__stdcall * Real_SetEndOfFile)(HANDLE a0)
+ = SetEndOfFile;
+
+HENHMETAFILE (__stdcall * Real_SetEnhMetaFileBits)(UINT a0,
+ CONST BYTE* a1)
+ = SetEnhMetaFileBits;
+
+BOOL (__stdcall * Real_SetEnvironmentVariableA)(LPCSTR a0,
+ LPCSTR a1)
+ = SetEnvironmentVariableA;
+
+BOOL (__stdcall * Real_SetEnvironmentVariableW)(LPCWSTR a0,
+ LPCWSTR a1)
+ = SetEnvironmentVariableW;
+
+UINT (__stdcall * Real_SetErrorMode)(UINT a0)
+ = SetErrorMode;
+
+BOOL (__stdcall * Real_SetEvent)(HANDLE a0)
+ = SetEvent;
+
+void (__stdcall * Real_SetFileApisToANSI)(void)
+ = SetFileApisToANSI;
+
+void (__stdcall * Real_SetFileApisToOEM)(void)
+ = SetFileApisToOEM;
+
+BOOL (__stdcall * Real_SetFileAttributesA)(LPCSTR a0,
+ DWORD a1)
+ = SetFileAttributesA;
+
+BOOL (__stdcall * Real_SetFileAttributesW)(LPCWSTR a0,
+ DWORD a1)
+ = SetFileAttributesW;
+
+DWORD (__stdcall * Real_SetFilePointer)(HANDLE a0,
+ LONG a1,
+ PLONG a2,
+ DWORD a3)
+ = SetFilePointer;
+
+BOOL (__stdcall * Real_SetFileTime)(HANDLE a0,
+ CONST FILETIME* a1,
+ CONST FILETIME* a2,
+ CONST FILETIME* a3)
+ = SetFileTime;
+
+HWND (__stdcall * Real_SetFocus)(HWND a0)
+ = SetFocus;
+
+BOOL (__stdcall * Real_SetForegroundWindow)(HWND a0)
+ = SetForegroundWindow;
+
+int (__stdcall * Real_SetGraphicsMode)(HDC a0,
+ int a1)
+ = SetGraphicsMode;
+
+UINT (__stdcall * Real_SetHandleCount)(UINT a0)
+ = SetHandleCount;
+
+BOOL (__stdcall * Real_SetHandleInformation)(HANDLE a0,
+ DWORD a1,
+ DWORD a2)
+ = SetHandleInformation;
+
+int (__stdcall * Real_SetICMMode)(HDC a0,
+ int a1)
+ = SetICMMode;
+
+BOOL (__stdcall * Real_SetICMProfileA)(HDC a0,
+ LPSTR a1)
+ = SetICMProfileA;
+
+BOOL (__stdcall * Real_SetICMProfileW)(HDC a0,
+ LPWSTR a1)
+ = SetICMProfileW;
+
+BOOL (__stdcall * Real_SetKeyboardState)(LPBYTE a0)
+ = SetKeyboardState;
+
+BOOL (__stdcall * Real_SetLocalTime)(CONST SYSTEMTIME* a0)
+ = SetLocalTime;
+
+BOOL (__stdcall * Real_SetLocaleInfoA)(LCID a0,
+ LCTYPE a1,
+ LPCSTR a2)
+ = SetLocaleInfoA;
+
+BOOL (__stdcall * Real_SetLocaleInfoW)(LCID a0,
+ LCTYPE a1,
+ LPCWSTR a2)
+ = SetLocaleInfoW;
+
+BOOL (__stdcall * Real_SetMailslotInfo)(HANDLE a0,
+ DWORD a1)
+ = SetMailslotInfo;
+
+int (__stdcall * Real_SetMapMode)(HDC a0,
+ int a1)
+ = SetMapMode;
+
+DWORD (__stdcall * Real_SetMapperFlags)(HDC a0,
+ DWORD a1)
+ = SetMapperFlags;
+
+BOOL (__stdcall * Real_SetMenu)(HWND a0,
+ HMENU a1)
+ = SetMenu;
+
+BOOL (__stdcall * Real_SetMenuContextHelpId)(HMENU a0,
+ DWORD a1)
+ = SetMenuContextHelpId;
+
+BOOL (__stdcall * Real_SetMenuDefaultItem)(HMENU a0,
+ UINT a1,
+ UINT a2)
+ = SetMenuDefaultItem;
+
+BOOL (__stdcall * Real_SetMenuItemBitmaps)(HMENU a0,
+ UINT a1,
+ UINT a2,
+ HBITMAP a3,
+ HBITMAP a4)
+ = SetMenuItemBitmaps;
+
+BOOL (__stdcall * Real_SetMenuItemInfoA)(HMENU a0,
+ UINT a1,
+ BOOL a2,
+ CONST MENUITEMINFOA* a3)
+ = SetMenuItemInfoA;
+
+BOOL (__stdcall * Real_SetMenuItemInfoW)(HMENU a0,
+ UINT a1,
+ BOOL a2,
+ CONST MENUITEMINFOW* a3)
+ = SetMenuItemInfoW;
+
+LPARAM (__stdcall * Real_SetMessageExtraInfo)(LPARAM a0)
+ = SetMessageExtraInfo;
+
+BOOL (__stdcall * Real_SetMessageQueue)(int a0)
+ = SetMessageQueue;
+
+HMETAFILE (__stdcall * Real_SetMetaFileBitsEx)(UINT a0,
+ CONST BYTE* a1)
+ = SetMetaFileBitsEx;
+
+int (__stdcall * Real_SetMetaRgn)(HDC a0)
+ = SetMetaRgn;
+
+BOOL (__stdcall * Real_SetMiterLimit)(HDC a0,
+ FLOAT a1,
+ PFLOAT a2)
+ = SetMiterLimit;
+
+BOOL (__stdcall * Real_SetNamedPipeHandleState)(HANDLE a0,
+ LPDWORD a1,
+ LPDWORD a2,
+ LPDWORD a3)
+ = SetNamedPipeHandleState;
+
+UINT (__stdcall * Real_SetPaletteEntries)(HPALETTE a0,
+ UINT a1,
+ UINT a2,
+ CONST PALETTEENTRY* a3)
+ = SetPaletteEntries;
+
+HWND (__stdcall * Real_SetParent)(HWND a0,
+ HWND a1)
+ = SetParent;
+
+COLORREF (__stdcall * Real_SetPixel)(HDC a0,
+ int a1,
+ int a2,
+ COLORREF a3)
+ = SetPixel;
+
+BOOL (__stdcall * Real_SetPixelFormat)(HDC a0,
+ int a1,
+ CONST PIXELFORMATDESCRIPTOR* a2)
+ = SetPixelFormat;
+
+BOOL (__stdcall * Real_SetPixelV)(HDC a0,
+ int a1,
+ int a2,
+ COLORREF a3)
+ = SetPixelV;
+
+int (__stdcall * Real_SetPolyFillMode)(HDC a0,
+ int a1)
+ = SetPolyFillMode;
+
+BOOL (__stdcall * Real_SetPriorityClass)(HANDLE a0,
+ DWORD a1)
+ = SetPriorityClass;
+
+BOOL (__stdcall * Real_SetProcessAffinityMask)(HANDLE a0,
+ DWORD_PTR a1)
+ = SetProcessAffinityMask;
+
+BOOL (__stdcall * Real_SetProcessShutdownParameters)(DWORD a0,
+ DWORD a1)
+ = SetProcessShutdownParameters;
+
+BOOL (__stdcall * Real_SetProcessWindowStation)(HWINSTA a0)
+ = SetProcessWindowStation;
+
+BOOL (__stdcall * Real_SetProcessWorkingSetSize)(HANDLE a0,
+ SIZE_T a1,
+ SIZE_T a2)
+ = SetProcessWorkingSetSize;
+
+BOOL (__stdcall * Real_SetPropA)(HWND a0,
+ LPCSTR a1,
+ HANDLE a2)
+ = SetPropA;
+
+BOOL (__stdcall * Real_SetPropW)(HWND a0,
+ LPCWSTR a1,
+ HANDLE a2)
+ = SetPropW;
+
+int (__stdcall * Real_SetROP2)(HDC a0,
+ int a1)
+ = SetROP2;
+
+BOOL (__stdcall * Real_SetRect)(LPRECT a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4)
+ = SetRect;
+
+BOOL (__stdcall * Real_SetRectEmpty)(LPRECT a0)
+ = SetRectEmpty;
+
+BOOL (__stdcall * Real_SetRectRgn)(HRGN a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4)
+ = SetRectRgn;
+
+int (__stdcall * Real_SetScrollInfo)(HWND a0,
+ int a1,
+ LPCSCROLLINFO a2,
+ BOOL a3)
+ = SetScrollInfo;
+
+int (__stdcall * Real_SetScrollPos)(HWND a0,
+ int a1,
+ int a2,
+ BOOL a3)
+ = SetScrollPos;
+
+BOOL (__stdcall * Real_SetScrollRange)(HWND a0,
+ int a1,
+ int a2,
+ int a3,
+ BOOL a4)
+ = SetScrollRange;
+
+BOOL (__stdcall * Real_SetStdHandle)(DWORD a0,
+ HANDLE a1)
+ = SetStdHandle;
+
+int (__stdcall * Real_SetStretchBltMode)(HDC a0,
+ int a1)
+ = SetStretchBltMode;
+
+BOOL (__stdcall * Real_SetSysColors)(int a0,
+ CONST INT* a1,
+ CONST COLORREF* a2)
+ = SetSysColors;
+
+BOOL (__stdcall * Real_SetSystemCursor)(HCURSOR a0,
+ DWORD a1)
+ = SetSystemCursor;
+
+UINT (__stdcall * Real_SetSystemPaletteUse)(HDC a0,
+ UINT a1)
+ = SetSystemPaletteUse;
+
+BOOL (__stdcall * Real_SetSystemPowerState)(BOOL a0,
+ BOOL a1)
+ = SetSystemPowerState;
+
+BOOL (__stdcall * Real_SetSystemTime)(CONST SYSTEMTIME* a0)
+ = SetSystemTime;
+
+BOOL (__stdcall * Real_SetSystemTimeAdjustment)(DWORD a0,
+ BOOL a1)
+ = SetSystemTimeAdjustment;
+
+DWORD (__stdcall * Real_SetTapeParameters)(HANDLE a0,
+ DWORD a1,
+ LPVOID a2)
+ = SetTapeParameters;
+
+DWORD (__stdcall * Real_SetTapePosition)(HANDLE a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3,
+ DWORD a4,
+ BOOL a5)
+ = SetTapePosition;
+
+UINT (__stdcall * Real_SetTextAlign)(HDC a0,
+ UINT a1)
+ = SetTextAlign;
+
+int (__stdcall * Real_SetTextCharacterExtra)(HDC a0,
+ int a1)
+ = SetTextCharacterExtra;
+
+COLORREF (__stdcall * Real_SetTextColor)(HDC a0,
+ COLORREF a1)
+ = SetTextColor;
+
+BOOL (__stdcall * Real_SetTextJustification)(HDC a0,
+ int a1,
+ int a2)
+ = SetTextJustification;
+
+DWORD_PTR (__stdcall * Real_SetThreadAffinityMask)(HANDLE a0,
+ DWORD_PTR a1)
+ = SetThreadAffinityMask;
+
+BOOL (__stdcall * Real_SetThreadContext)(HANDLE a0,
+ CONST CONTEXT* a1)
+ = SetThreadContext;
+
+BOOL (__stdcall * Real_SetThreadDesktop)(HDESK a0)
+ = SetThreadDesktop;
+
+DWORD (__stdcall * Real_SetThreadIdealProcessor)(HANDLE a0,
+ DWORD a1)
+ = SetThreadIdealProcessor;
+
+#if(WINVER >= 0x0500)
+BOOL (__stdcall * Real_SetThreadLocale)(LCID a0)
+ = SetThreadLocale;
+#endif // (WINVER >= 0x0500)
+
+BOOL (__stdcall * Real_SetThreadPriority)(HANDLE a0,
+ int a1)
+ = SetThreadPriority;
+
+BOOL (__stdcall * Real_SetThreadPriorityBoost)(HANDLE a0,
+ BOOL a1)
+ = SetThreadPriorityBoost;
+
+BOOL (__stdcall * Real_SetTimeZoneInformation)(CONST TIME_ZONE_INFORMATION* a0)
+ = SetTimeZoneInformation;
+
+UINT_PTR (__stdcall * Real_SetTimer)(HWND a0,
+ UINT_PTR a1,
+ UINT a2,
+ TIMERPROC a3)
+ = SetTimer;
+
+LPTOP_LEVEL_EXCEPTION_FILTER (__stdcall * Real_SetUnhandledExceptionFilter)(LPTOP_LEVEL_EXCEPTION_FILTER a0)
+ = SetUnhandledExceptionFilter;
+
+BOOL (__stdcall * Real_SetUserObjectInformationA)(HANDLE a0,
+ int a1,
+ PVOID a2,
+ DWORD a3)
+ = SetUserObjectInformationA;
+
+BOOL (__stdcall * Real_SetUserObjectInformationW)(HANDLE a0,
+ int a1,
+ PVOID a2,
+ DWORD a3)
+ = SetUserObjectInformationW;
+
+BOOL (__stdcall * Real_SetUserObjectSecurity)(HANDLE a0,
+ PSECURITY_INFORMATION a1,
+ PSECURITY_DESCRIPTOR a2)
+ = SetUserObjectSecurity;
+
+BOOL (__stdcall * Real_SetViewportExtEx)(HDC a0,
+ int a1,
+ int a2,
+ SIZE* a3)
+ = SetViewportExtEx;
+
+BOOL (__stdcall * Real_SetViewportOrgEx)(HDC a0,
+ int a1,
+ int a2,
+ POINT* a3)
+ = SetViewportOrgEx;
+
+BOOL (__stdcall * Real_SetVolumeLabelA)(LPCSTR a0,
+ LPCSTR a1)
+ = SetVolumeLabelA;
+
+BOOL (__stdcall * Real_SetVolumeLabelW)(LPCWSTR a0,
+ LPCWSTR a1)
+ = SetVolumeLabelW;
+
+BOOL (__stdcall * Real_SetWaitableTimer)(HANDLE a0,
+ CONST LARGE_INTEGER* a1,
+ LONG a2,
+ PTIMERAPCROUTINE a3,
+ LPVOID a4,
+ BOOL a5)
+ = SetWaitableTimer;
+
+HENHMETAFILE (__stdcall * Real_SetWinMetaFileBits)(UINT a0,
+ CONST BYTE* a1,
+ HDC a2,
+ CONST METAFILEPICT* a3)
+ = SetWinMetaFileBits;
+
+BOOL (__stdcall * Real_SetWindowContextHelpId)(HWND a0,
+ DWORD a1)
+ = SetWindowContextHelpId;
+
+BOOL (__stdcall * Real_SetWindowExtEx)(HDC a0,
+ int a1,
+ int a2,
+ SIZE* a3)
+ = SetWindowExtEx;
+
+LONG (__stdcall * Real_SetWindowLongA)(HWND a0,
+ int a1,
+ LONG a2)
+ = SetWindowLongA;
+
+LONG (__stdcall * Real_SetWindowLongW)(HWND a0,
+ int a1,
+ LONG a2)
+ = SetWindowLongW;
+
+BOOL (__stdcall * Real_SetWindowOrgEx)(HDC a0,
+ int a1,
+ int a2,
+ POINT* a3)
+ = SetWindowOrgEx;
+
+BOOL (__stdcall * Real_SetWindowPlacement)(HWND a0,
+ CONST WINDOWPLACEMENT* a1)
+ = SetWindowPlacement;
+
+BOOL (__stdcall * Real_SetWindowPos)(HWND a0,
+ HWND a1,
+ int a2,
+ int a3,
+ int a4,
+ int a5,
+ UINT a6)
+ = SetWindowPos;
+
+int (__stdcall * Real_SetWindowRgn)(HWND a0,
+ HRGN a1,
+ BOOL a2)
+ = SetWindowRgn;
+
+BOOL (__stdcall * Real_SetWindowTextA)(HWND a0,
+ LPCSTR a1)
+ = SetWindowTextA;
+
+BOOL (__stdcall * Real_SetWindowTextW)(HWND a0,
+ LPCWSTR a1)
+ = SetWindowTextW;
+
+WORD (__stdcall * Real_SetWindowWord)(HWND a0,
+ int a1,
+ WORD a2)
+ = SetWindowWord;
+
+HHOOK (__stdcall * Real_SetWindowsHookA)(int a0,
+ HOOKPROC a1)
+ = SetWindowsHookA;
+
+HHOOK (__stdcall * Real_SetWindowsHookExA)(int a0,
+ HOOKPROC a1,
+ HINSTANCE a2,
+ DWORD a3)
+ = SetWindowsHookExA;
+
+HHOOK (__stdcall * Real_SetWindowsHookExW)(int a0,
+ HOOKPROC a1,
+ HINSTANCE a2,
+ DWORD a3)
+ = SetWindowsHookExW;
+
+HHOOK (__stdcall * Real_SetWindowsHookW)(int a0,
+ HOOKPROC a1)
+ = SetWindowsHookW;
+
+BOOL (__stdcall * Real_SetWorldTransform)(HDC a0,
+ CONST XFORM* a1)
+ = SetWorldTransform;
+
+BOOL (__stdcall * Real_SetupComm)(HANDLE a0,
+ DWORD a1,
+ DWORD a2)
+ = SetupComm;
+
+BOOL (__stdcall * Real_ShowCaret)(HWND a0)
+ = ShowCaret;
+
+int (__stdcall * Real_ShowCursor)(BOOL a0)
+ = ShowCursor;
+
+BOOL (__stdcall * Real_ShowOwnedPopups)(HWND a0,
+ BOOL a1)
+ = ShowOwnedPopups;
+
+BOOL (__stdcall * Real_ShowScrollBar)(HWND a0,
+ int a1,
+ BOOL a2)
+ = ShowScrollBar;
+
+BOOL (__stdcall * Real_ShowWindow)(HWND a0,
+ int a1)
+ = ShowWindow;
+
+BOOL (__stdcall * Real_ShowWindowAsync)(HWND a0,
+ int a1)
+ = ShowWindowAsync;
+
+DWORD (__stdcall * Real_SignalObjectAndWait)(HANDLE a0,
+ HANDLE a1,
+ DWORD a2,
+ BOOL a3)
+ = SignalObjectAndWait;
+
+DWORD (__stdcall * Real_SizeofResource)(HMODULE a0,
+ HRSRC a1)
+ = SizeofResource;
+
+DWORD (__stdcall * Real_SleepEx)(DWORD a0,
+ BOOL a1)
+ = SleepEx;
+
+int (__stdcall * Real_StartDocA)(HDC a0,
+ CONST DOCINFOA* a1)
+ = StartDocA;
+
+int (__stdcall * Real_StartDocW)(HDC a0,
+ CONST DOCINFOW* a1)
+ = StartDocW;
+
+int (__stdcall * Real_StartPage)(HDC a0)
+ = StartPage;
+
+HRESULT (__stdcall * Real_StgCreateDocfile)(CONST OLECHAR* a0,
+ DWORD a1,
+ DWORD a2,
+ IStorage** a3)
+ = StgCreateDocfile;
+
+HRESULT (__stdcall * Real_StgCreateDocfileOnILockBytes)(ILockBytes* a0,
+ DWORD a1,
+ DWORD a2,
+ IStorage** a3)
+ = StgCreateDocfileOnILockBytes;
+
+HRESULT (__stdcall * Real_StgCreatePropSetStg)(IStorage* a0,
+ DWORD a1,
+ IPropertySetStorage** a2)
+ = StgCreatePropSetStg;
+
+HRESULT (__stdcall * Real_StgCreatePropStg)(IUnknown* a0,
+ CONST IID& a1,
+ CONST CLSID* a2,
+ DWORD a3,
+ DWORD a4,
+ IPropertyStorage** a5)
+ = StgCreatePropStg;
+
+#if _MSC_VER < 1300
+HRESULT (__stdcall * Real_StgCreateStorageEx)(CONST WCHAR* a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3,
+ void* a4,
+ void* a5,
+ CONST IID& a6,
+ void** a7)
+ = StgCreateStorageEx;
+#else
+HRESULT (__stdcall * Real_StgCreateStorageEx)(CONST WCHAR* a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3,
+ STGOPTIONS* a4,
+ void* a5,
+ CONST IID& a6,
+ void** a7)
+ = StgCreateStorageEx;
+#endif
+
+HRESULT (__stdcall * Real_StgGetIFillLockBytesOnFile)(CONST OLECHAR* a0,
+ IFillLockBytes** a1)
+ = StgGetIFillLockBytesOnFile;
+
+HRESULT (__stdcall * Real_StgGetIFillLockBytesOnILockBytes)(ILockBytes* a0,
+ IFillLockBytes** a1)
+ = StgGetIFillLockBytesOnILockBytes;
+
+HRESULT (__stdcall * Real_StgIsStorageFile)(CONST OLECHAR* a0)
+ = StgIsStorageFile;
+
+HRESULT (__stdcall * Real_StgIsStorageILockBytes)(ILockBytes* a0)
+ = StgIsStorageILockBytes;
+
+HRESULT (__stdcall * Real_StgOpenAsyncDocfileOnIFillLockBytes)(IFillLockBytes* a0,
+ DWORD a1,
+ DWORD a2,
+ IStorage** a3)
+ = StgOpenAsyncDocfileOnIFillLockBytes;
+
+HRESULT (__stdcall * Real_StgOpenPropStg)(IUnknown* a0,
+ CONST IID& a1,
+ DWORD a2,
+ DWORD a3,
+ IPropertyStorage** a4)
+ = StgOpenPropStg;
+
+HRESULT (__stdcall * Real_StgOpenStorage)(CONST OLECHAR* a0,
+ IStorage* a1,
+ DWORD a2,
+ SNB a3,
+ DWORD a4,
+ IStorage** a5)
+ = StgOpenStorage;
+
+#if _MSC_VER < 1300
+HRESULT (__stdcall * Real_StgOpenStorageEx)(CONST WCHAR* a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3,
+ void* a4,
+ void* a5,
+ CONST IID& a6,
+ void** a7)
+ = StgOpenStorageEx;
+#else
+HRESULT (__stdcall * Real_StgOpenStorageEx)(CONST WCHAR* a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3,
+ STGOPTIONS* a4,
+ void* a5,
+ CONST IID& a6,
+ void** a7)
+ = StgOpenStorageEx;
+#endif
+
+HRESULT (__stdcall * Real_StgOpenStorageOnILockBytes)(ILockBytes* a0,
+ IStorage* a1,
+ DWORD a2,
+ SNB a3,
+ DWORD a4,
+ IStorage** a5)
+ = StgOpenStorageOnILockBytes;
+
+HRESULT (__stdcall * Real_StgSetTimes)(CONST OLECHAR* a0,
+ CONST FILETIME* a1,
+ CONST FILETIME* a2,
+ CONST FILETIME* a3)
+ = StgSetTimes;
+
+BOOL (__stdcall * Real_StretchBlt)(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ HDC a5,
+ int a6,
+ int a7,
+ int a8,
+ int a9,
+ DWORD a10)
+ = StretchBlt;
+
+int (__stdcall * Real_StretchDIBits)(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ int a5,
+ int a6,
+ int a7,
+ int a8,
+ CONST void* a9,
+ CONST BITMAPINFO* a10,
+ UINT a11,
+ DWORD a12)
+ = StretchDIBits;
+
+HRESULT (__stdcall * Real_StringFromCLSID)(CONST IID& a0,
+ LPOLESTR* a1)
+ = StringFromCLSID;
+
+int (__stdcall * Real_StringFromGUID2)(CONST GUID& a0,
+ LPOLESTR a1,
+ int a2)
+ = StringFromGUID2;
+
+HRESULT (__stdcall * Real_StringFromIID)(CONST IID& a0,
+ LPOLESTR* a1)
+ = StringFromIID;
+
+BOOL (__stdcall * Real_StrokeAndFillPath)(HDC a0)
+ = StrokeAndFillPath;
+
+BOOL (__stdcall * Real_StrokePath)(HDC a0)
+ = StrokePath;
+
+BOOL (__stdcall * Real_SubtractRect)(LPRECT a0,
+ CONST RECT* a1,
+ CONST RECT* a2)
+ = SubtractRect;
+
+DWORD (__stdcall * Real_SuspendThread)(HANDLE a0)
+ = SuspendThread;
+
+BOOL (__stdcall * Real_SwapBuffers)(HDC a0)
+ = SwapBuffers;
+
+BOOL (__stdcall * Real_SwapMouseButton)(BOOL a0)
+ = SwapMouseButton;
+
+BOOL (__stdcall * Real_SwitchDesktop)(HDESK a0)
+ = SwitchDesktop;
+
+void (__stdcall * Real_SwitchToFiber)(LPVOID a0)
+ = SwitchToFiber;
+
+BOOL (__stdcall * Real_SwitchToThread)(void)
+ = SwitchToThread;
+
+BOOL (__stdcall * Real_SystemParametersInfoA)(UINT a0,
+ UINT a1,
+ PVOID a2,
+ UINT a3)
+ = SystemParametersInfoA;
+
+BOOL (__stdcall * Real_SystemParametersInfoW)(UINT a0,
+ UINT a1,
+ PVOID a2,
+ UINT a3)
+ = SystemParametersInfoW;
+
+BOOL (__stdcall * Real_SystemTimeToFileTime)(CONST SYSTEMTIME* a0,
+ LPFILETIME a1)
+ = SystemTimeToFileTime;
+
+BOOL (__stdcall * Real_SystemTimeToTzSpecificLocalTime)(
+#ifdef PIPE_ACCEPT_REMOTE_CLIENTS
+ const TIME_ZONE_INFORMATION *a0,
+ const SYSTEMTIME *a1,
+#else
+ LPTIME_ZONE_INFORMATION a0,
+ LPSYSTEMTIME a1,
+#endif
+ LPSYSTEMTIME a2
+ )
+ = SystemTimeToTzSpecificLocalTime;
+
+#if _MSC_VER < 1300
+LONG (__stdcall * Real_TabbedTextOutA)(HDC a0,
+ int a1,
+ int a2,
+ LPCSTR a3,
+ int a4,
+ int a5,
+ INT* a6,
+ int a7)
+ = TabbedTextOutA;
+#else
+LONG (__stdcall * Real_TabbedTextOutA)(HDC a0,
+ int a1,
+ int a2,
+ LPCSTR a3,
+ int a4,
+ int a5,
+ CONST INT* a6,
+ int a7)
+ = TabbedTextOutA;
+#endif
+
+#if _MSC_VER < 1300
+LONG (__stdcall * Real_TabbedTextOutW)(HDC a0,
+ int a1,
+ int a2,
+ LPCWSTR a3,
+ int a4,
+ int a5,
+ INT* a6,
+ int a7)
+ = TabbedTextOutW;
+#else
+LONG (__stdcall * Real_TabbedTextOutW)(HDC a0,
+ int a1,
+ int a2,
+ LPCWSTR a3,
+ int a4,
+ int a5,
+ CONST INT* a6,
+ int a7)
+ = TabbedTextOutW;
+#endif
+
+BOOL (__stdcall * Real_TerminateProcess)(HANDLE a0,
+ UINT a1)
+ = TerminateProcess;
+
+BOOL (__stdcall * Real_TerminateThread)(HANDLE a0,
+ DWORD a1)
+ = TerminateThread;
+
+BOOL (__stdcall * Real_TextOutA)(HDC a0,
+ int a1,
+ int a2,
+ LPCSTR a3,
+ int a4)
+ = TextOutA;
+
+BOOL (__stdcall * Real_TextOutW)(HDC a0,
+ int a1,
+ int a2,
+ LPCWSTR a3,
+ int a4)
+ = TextOutW;
+
+WORD (__stdcall * Real_TileWindows)(HWND a0,
+ UINT a1,
+ CONST RECT* a2,
+ UINT a3,
+ CONST HWND * a4)
+ = TileWindows;
+
+#if _MSC_VER < 1300
+int (__stdcall * Real_ToAscii)(UINT a0,
+ UINT a1,
+ BYTE* a2,
+ LPWORD a3,
+ UINT a4)
+ = ToAscii;
+#else
+int (__stdcall * Real_ToAscii)(UINT a0,
+ UINT a1,
+ CONST BYTE* a2,
+ LPWORD a3,
+ UINT a4)
+ = ToAscii;
+#endif
+
+#if _MSC_VER < 1300
+int (__stdcall * Real_ToAsciiEx)(UINT a0,
+ UINT a1,
+ BYTE* a2,
+ LPWORD a3,
+ UINT a4,
+ HKL a5)
+ = ToAsciiEx;
+#else
+int (__stdcall * Real_ToAsciiEx)(UINT a0,
+ UINT a1,
+ CONST BYTE* a2,
+ LPWORD a3,
+ UINT a4,
+ HKL a5)
+ = ToAsciiEx;
+#endif
+
+#if _MSC_VER < 1300
+int (__stdcall * Real_ToUnicode)(UINT a0,
+ UINT a1,
+ BYTE* a2,
+ LPWSTR a3,
+ int a4,
+ UINT a5)
+ = ToUnicode;
+#else
+int (__stdcall * Real_ToUnicode)(UINT a0,
+ UINT a1,
+ CONST BYTE* a2,
+ LPWSTR a3,
+ int a4,
+ UINT a5)
+ = ToUnicode;
+#endif
+
+#if _MSC_VER < 1300
+int (__stdcall * Real_ToUnicodeEx)(UINT a0,
+ UINT a1,
+ BYTE* a2,
+ LPWSTR a3,
+ int a4,
+ UINT a5,
+ HKL a6)
+ = ToUnicodeEx;
+#else
+int (__stdcall * Real_ToUnicodeEx)(UINT a0,
+ UINT a1,
+ CONST BYTE* a2,
+ LPWSTR a3,
+ int a4,
+ UINT a5,
+ HKL a6)
+ = ToUnicodeEx;
+#endif
+
+BOOL (__stdcall * Real_TrackMouseEvent)(TRACKMOUSEEVENT* a0)
+ = TrackMouseEvent;
+
+BOOL (__stdcall * Real_TrackPopupMenu)(HMENU a0,
+ UINT a1,
+ int a2,
+ int a3,
+ int a4,
+ HWND a5,
+ CONST RECT* a6)
+ = TrackPopupMenu;
+
+BOOL (__stdcall * Real_TrackPopupMenuEx)(HMENU a0,
+ UINT a1,
+ int a2,
+ int a3,
+ HWND a4,
+ LPTPMPARAMS a5)
+ = TrackPopupMenuEx;
+
+BOOL (__stdcall * Real_TransactNamedPipe)(HANDLE a0,
+ LPVOID a1,
+ DWORD a2,
+ LPVOID a3,
+ DWORD a4,
+ LPDWORD a5,
+ LPOVERLAPPED a6)
+ = TransactNamedPipe;
+
+int (__stdcall * Real_TranslateAcceleratorA)(HWND a0,
+ HACCEL a1,
+ LPMSG a2)
+ = TranslateAcceleratorA;
+
+int (__stdcall * Real_TranslateAcceleratorW)(HWND a0,
+ HACCEL a1,
+ LPMSG a2)
+ = TranslateAcceleratorW;
+
+BOOL (__stdcall * Real_TranslateCharsetInfo)(DWORD* a0,
+ CHARSETINFO* a1,
+ DWORD a2)
+ = TranslateCharsetInfo;
+
+BOOL (__stdcall * Real_TranslateMDISysAccel)(HWND a0,
+ LPMSG a1)
+ = TranslateMDISysAccel;
+
+BOOL (__stdcall * Real_TranslateMessage)(CONST MSG* a0)
+ = TranslateMessage;
+
+BOOL (__stdcall * Real_TransmitCommChar)(HANDLE a0,
+ char a1)
+ = TransmitCommChar;
+
+#if DETOUR_TryEnterCriticalSection_EVEN_IF_IT_EXERCISES_A_BUG_IN_RtlLookupFunctionTable
+BOOL (__stdcall * Real_TryEnterCriticalSection)(LPCRITICAL_SECTION a0)
+ = TryEnterCriticalSection;
+#endif
+
+BOOL (__stdcall * Real_UnhookWindowsHook)(int a0,
+ HOOKPROC a1)
+ = UnhookWindowsHook;
+
+BOOL (__stdcall * Real_UnhookWindowsHookEx)(HHOOK a0)
+ = UnhookWindowsHookEx;
+
+BOOL (__stdcall * Real_UnionRect)(LPRECT a0,
+ CONST RECT* a1,
+ CONST RECT* a2)
+ = UnionRect;
+
+BOOL (__stdcall * Real_UnloadKeyboardLayout)(HKL a0)
+ = UnloadKeyboardLayout;
+
+BOOL (__stdcall * Real_UnlockFile)(HANDLE a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3,
+ DWORD a4)
+ = UnlockFile;
+
+BOOL (__stdcall * Real_UnlockFileEx)(HANDLE a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3,
+ LPOVERLAPPED a4)
+ = UnlockFileEx;
+
+BOOL (__stdcall * Real_UnmapViewOfFile)(LPCVOID a0)
+ = UnmapViewOfFile;
+
+BOOL (__stdcall * Real_UnpackDDElParam)(UINT a0,
+ LPARAM a1,
+ PUINT_PTR a2,
+ PUINT_PTR a3)
+ = UnpackDDElParam;
+
+BOOL (__stdcall * Real_UnrealizeObject)(HGDIOBJ a0)
+ = UnrealizeObject;
+
+BOOL (__stdcall * Real_UnregisterClassA)(LPCSTR a0,
+ HINSTANCE a1)
+ = UnregisterClassA;
+
+BOOL (__stdcall * Real_UnregisterClassW)(LPCWSTR a0,
+ HINSTANCE a1)
+ = UnregisterClassW;
+
+BOOL (__stdcall * Real_UnregisterHotKey)(HWND a0,
+ int a1)
+ = UnregisterHotKey;
+
+BOOL (__stdcall * Real_UpdateColors)(HDC a0)
+ = UpdateColors;
+
+BOOL (__stdcall * Real_UpdateResourceA)(HANDLE a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ WORD a3,
+ LPVOID a4,
+ DWORD a5)
+ = UpdateResourceA;
+
+BOOL (__stdcall * Real_UpdateResourceW)(HANDLE a0,
+ LPCWSTR a1,
+ LPCWSTR a2,
+ WORD a3,
+ LPVOID a4,
+ DWORD a5)
+ = UpdateResourceW;
+
+BOOL (__stdcall * Real_UpdateWindow)(HWND a0)
+ = UpdateWindow;
+
+BOOL (__stdcall * Real_ValidateRect)(HWND a0,
+ CONST RECT* a1)
+ = ValidateRect;
+
+BOOL (__stdcall * Real_ValidateRgn)(HWND a0,
+ HRGN a1)
+ = ValidateRgn;
+
+DWORD (__stdcall * Real_VerLanguageNameA)(DWORD a0,
+ LPSTR a1,
+ DWORD a2)
+ = VerLanguageNameA;
+
+DWORD (__stdcall * Real_VerLanguageNameW)(DWORD a0,
+ LPWSTR a1,
+ DWORD a2)
+ = VerLanguageNameW;
+
+LPVOID (__stdcall * Real_VirtualAllocEx)(HANDLE a0,
+ LPVOID a1,
+ SIZE_T a2,
+ DWORD a3,
+ DWORD a4)
+ = VirtualAllocEx;
+
+BOOL (__stdcall * Real_VirtualFreeEx)(HANDLE a0,
+ LPVOID a1,
+ SIZE_T a2,
+ DWORD a3)
+ = VirtualFreeEx;
+
+BOOL (__stdcall * Real_VirtualProtectEx)(HANDLE a0,
+ LPVOID a1,
+ SIZE_T a2,
+ DWORD a3,
+ PDWORD a4)
+ = VirtualProtectEx;
+
+DWORD_PTR (__stdcall * Real_VirtualQueryEx)(HANDLE a0,
+ LPCVOID a1,
+ PMEMORY_BASIC_INFORMATION a2,
+ DWORD_PTR a3)
+ = VirtualQueryEx;
+
+SHORT (__stdcall * Real_VkKeyScanA)(CHAR a0)
+ = VkKeyScanA;
+
+SHORT (__stdcall * Real_VkKeyScanExA)(CHAR a0,
+ HKL a1)
+ = VkKeyScanExA;
+
+SHORT (__stdcall * Real_VkKeyScanExW)(WCHAR a0,
+ HKL a1)
+ = VkKeyScanExW;
+
+SHORT (__stdcall * Real_VkKeyScanW)(WCHAR a0)
+ = VkKeyScanW;
+
+SOCKET (__stdcall * Real_WSAAccept)(SOCKET a0,
+ sockaddr* a1,
+ LPINT a2,
+ LPCONDITIONPROC a3,
+ DWORD_PTR a4)
+ = WSAAccept;
+
+INT (__stdcall * Real_WSAAddressToStringA)(LPSOCKADDR a0,
+ DWORD a1,
+ LPWSAPROTOCOL_INFOA a2,
+ LPSTR a3,
+ LPDWORD a4)
+ = WSAAddressToStringA;
+
+INT (__stdcall * Real_WSAAddressToStringW)(LPSOCKADDR a0,
+ DWORD a1,
+ LPWSAPROTOCOL_INFOW a2,
+ LPWSTR a3,
+ LPDWORD a4)
+ = WSAAddressToStringW;
+
+HANDLE (__stdcall * Real_WSAAsyncGetHostByAddr)(HWND a0,
+ u_int a1,
+ CONST char* a2,
+ int a3,
+ int a4,
+ char* a5,
+ int a6)
+ = WSAAsyncGetHostByAddr;
+
+HANDLE (__stdcall * Real_WSAAsyncGetHostByName)(HWND a0,
+ u_int a1,
+ CONST char* a2,
+ char* a3,
+ int a4)
+ = WSAAsyncGetHostByName;
+
+HANDLE (__stdcall * Real_WSAAsyncGetProtoByName)(HWND a0,
+ u_int a1,
+ CONST char* a2,
+ char* a3,
+ int a4)
+ = WSAAsyncGetProtoByName;
+
+HANDLE (__stdcall * Real_WSAAsyncGetProtoByNumber)(HWND a0,
+ u_int a1,
+ int a2,
+ char* a3,
+ int a4)
+ = WSAAsyncGetProtoByNumber;
+
+HANDLE (__stdcall * Real_WSAAsyncGetServByName)(HWND a0,
+ u_int a1,
+ CONST char* a2,
+ CONST char* a3,
+ char* a4,
+ int a5)
+ = WSAAsyncGetServByName;
+
+HANDLE (__stdcall * Real_WSAAsyncGetServByPort)(HWND a0,
+ u_int a1,
+ int a2,
+ CONST char* a3,
+ char* a4,
+ int a5)
+ = WSAAsyncGetServByPort;
+
+int (__stdcall * Real_WSAAsyncSelect)(SOCKET a0,
+ HWND a1,
+ u_int a2,
+ long a3)
+ = WSAAsyncSelect;
+
+int (__stdcall * Real_WSACancelAsyncRequest)(HANDLE a0)
+ = WSACancelAsyncRequest;
+
+int (__stdcall * Real_WSACancelBlockingCall)(void)
+ = WSACancelBlockingCall;
+
+int (__stdcall * Real_WSACleanup)(void)
+ = WSACleanup;
+
+BOOL (__stdcall * Real_WSACloseEvent)(HANDLE a0)
+ = WSACloseEvent;
+
+int (__stdcall * Real_WSAConnect)(SOCKET a0,
+ CONST sockaddr* a1,
+ int a2,
+ LPWSABUF a3,
+ LPWSABUF a4,
+ LPQOS a5,
+ LPQOS a6)
+ = WSAConnect;
+
+HANDLE (__stdcall * Real_WSACreateEvent)(void)
+ = WSACreateEvent;
+
+int (__stdcall * Real_WSADuplicateSocketA)(SOCKET a0,
+ DWORD a1,
+ LPWSAPROTOCOL_INFOA a2)
+ = WSADuplicateSocketA;
+
+int (__stdcall * Real_WSADuplicateSocketW)(SOCKET a0,
+ DWORD a1,
+ LPWSAPROTOCOL_INFOW a2)
+ = WSADuplicateSocketW;
+
+INT (__stdcall * Real_WSAEnumNameSpaceProvidersA)(LPDWORD a0,
+ LPWSANAMESPACE_INFOA a1)
+ = WSAEnumNameSpaceProvidersA;
+
+INT (__stdcall * Real_WSAEnumNameSpaceProvidersW)(LPDWORD a0,
+ LPWSANAMESPACE_INFOW a1)
+ = WSAEnumNameSpaceProvidersW;
+
+int (__stdcall * Real_WSAEnumNetworkEvents)(SOCKET a0,
+ HANDLE a1,
+ LPWSANETWORKEVENTS a2)
+ = WSAEnumNetworkEvents;
+
+int (__stdcall * Real_WSAEnumProtocolsA)(LPINT a0,
+ LPWSAPROTOCOL_INFOA a1,
+ LPDWORD a2)
+ = WSAEnumProtocolsA;
+
+int (__stdcall * Real_WSAEnumProtocolsW)(LPINT a0,
+ LPWSAPROTOCOL_INFOW a1,
+ LPDWORD a2)
+ = WSAEnumProtocolsW;
+
+int (__stdcall * Real_WSAEventSelect)(SOCKET a0,
+ HANDLE a1,
+ long a2)
+ = WSAEventSelect;
+
+BOOL (__stdcall * Real_WSAGetOverlappedResult)(SOCKET a0,
+ LPWSAOVERLAPPED a1,
+ LPDWORD a2,
+ BOOL a3,
+ LPDWORD a4)
+ = WSAGetOverlappedResult;
+
+BOOL (__stdcall * Real_WSAGetQOSByName)(SOCKET a0,
+ LPWSABUF a1,
+ LPQOS a2)
+ = WSAGetQOSByName;
+
+INT (__stdcall * Real_WSAGetServiceClassInfoA)(LPGUID a0,
+ LPGUID a1,
+ LPDWORD a2,
+ LPWSASERVICECLASSINFOA a3)
+ = WSAGetServiceClassInfoA;
+
+INT (__stdcall * Real_WSAGetServiceClassInfoW)(LPGUID a0,
+ LPGUID a1,
+ LPDWORD a2,
+ LPWSASERVICECLASSINFOW a3)
+ = WSAGetServiceClassInfoW;
+
+INT (__stdcall * Real_WSAGetServiceClassNameByClassIdA)(LPGUID a0,
+ LPSTR a1,
+ LPDWORD a2)
+ = WSAGetServiceClassNameByClassIdA;
+
+INT (__stdcall * Real_WSAGetServiceClassNameByClassIdW)(LPGUID a0,
+ LPWSTR a1,
+ LPDWORD a2)
+ = WSAGetServiceClassNameByClassIdW;
+
+int (__stdcall * Real_WSAHtonl)(SOCKET a0,
+ u_long a1,
+ u_long* a2)
+ = WSAHtonl;
+
+int (__stdcall * Real_WSAHtons)(SOCKET a0,
+ u_short a1,
+ u_short* a2)
+ = WSAHtons;
+
+INT (__stdcall * Real_WSAInstallServiceClassA)(LPWSASERVICECLASSINFOA a0)
+ = WSAInstallServiceClassA;
+
+INT (__stdcall * Real_WSAInstallServiceClassW)(LPWSASERVICECLASSINFOW a0)
+ = WSAInstallServiceClassW;
+
+int (__stdcall * Real_WSAIoctl)(SOCKET a0,
+ DWORD a1,
+ LPVOID a2,
+ DWORD a3,
+ LPVOID a4,
+ DWORD a5,
+ LPDWORD a6,
+ LPWSAOVERLAPPED a7,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a8)
+ = WSAIoctl;
+
+BOOL (__stdcall * Real_WSAIsBlocking)(void)
+ = WSAIsBlocking;
+
+SOCKET (__stdcall * Real_WSAJoinLeaf)(SOCKET a0,
+ CONST sockaddr* a1,
+ int a2,
+ LPWSABUF a3,
+ LPWSABUF a4,
+ LPQOS a5,
+ LPQOS a6,
+ DWORD a7)
+ = WSAJoinLeaf;
+
+INT (__stdcall * Real_WSALookupServiceBeginA)(LPWSAQUERYSETA a0,
+ DWORD a1,
+ LPHANDLE a2)
+ = WSALookupServiceBeginA;
+
+INT (__stdcall * Real_WSALookupServiceBeginW)(LPWSAQUERYSETW a0,
+ DWORD a1,
+ LPHANDLE a2)
+ = WSALookupServiceBeginW;
+
+INT (__stdcall * Real_WSALookupServiceEnd)(HANDLE a0)
+ = WSALookupServiceEnd;
+
+INT (__stdcall * Real_WSALookupServiceNextA)(HANDLE a0,
+ DWORD a1,
+ LPDWORD a2,
+ LPWSAQUERYSETA a3)
+ = WSALookupServiceNextA;
+
+INT (__stdcall * Real_WSALookupServiceNextW)(HANDLE a0,
+ DWORD a1,
+ LPDWORD a2,
+ LPWSAQUERYSETW a3)
+ = WSALookupServiceNextW;
+
+int (__stdcall * Real_WSANtohl)(SOCKET a0,
+ u_long a1,
+ u_long* a2)
+ = WSANtohl;
+
+int (__stdcall * Real_WSANtohs)(SOCKET a0,
+ u_short a1,
+ u_short* a2)
+ = WSANtohs;
+
+INT (__stdcall * Real_WSAProviderConfigChange)(LPHANDLE a0,
+ LPWSAOVERLAPPED a1,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a2)
+ = WSAProviderConfigChange;
+
+int (__stdcall * Real_WSARecv)(SOCKET a0,
+ LPWSABUF a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPWSAOVERLAPPED a5,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a6)
+ = WSARecv;
+
+int (__stdcall * Real_WSARecvDisconnect)(SOCKET a0,
+ LPWSABUF a1)
+ = WSARecvDisconnect;
+
+int (__stdcall * Real_WSARecvFrom)(SOCKET a0,
+ LPWSABUF a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ sockaddr* a5,
+ LPINT a6,
+ LPWSAOVERLAPPED a7,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a8)
+ = WSARecvFrom;
+
+INT (__stdcall * Real_WSARemoveServiceClass)(LPGUID a0)
+ = WSARemoveServiceClass;
+
+BOOL (__stdcall * Real_WSAResetEvent)(HANDLE a0)
+ = WSAResetEvent;
+
+int (__stdcall * Real_WSASend)(SOCKET a0,
+ LPWSABUF a1,
+ DWORD a2,
+ LPDWORD a3,
+ DWORD a4,
+ LPWSAOVERLAPPED a5,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a6)
+ = WSASend;
+
+int (__stdcall * Real_WSASendDisconnect)(SOCKET a0,
+ LPWSABUF a1)
+ = WSASendDisconnect;
+
+int (__stdcall * Real_WSASendTo)(SOCKET a0,
+ LPWSABUF a1,
+ DWORD a2,
+ LPDWORD a3,
+ DWORD a4,
+ CONST sockaddr* a5,
+ int a6,
+ LPWSAOVERLAPPED a7,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a8)
+ = WSASendTo;
+
+FARPROC (__stdcall * Real_WSASetBlockingHook)(FARPROC a0)
+ = WSASetBlockingHook;
+
+BOOL (__stdcall * Real_WSASetEvent)(HANDLE a0)
+ = WSASetEvent;
+
+INT (__stdcall * Real_WSASetServiceA)(LPWSAQUERYSETA a0,
+ WSAESETSERVICEOP a1,
+ DWORD a2)
+ = WSASetServiceA;
+
+INT (__stdcall * Real_WSASetServiceW)(LPWSAQUERYSETW a0,
+ WSAESETSERVICEOP a1,
+ DWORD a2)
+ = WSASetServiceW;
+
+SOCKET (__stdcall * Real_WSASocketA)(int a0,
+ int a1,
+ int a2,
+ LPWSAPROTOCOL_INFOA a3,
+ GROUP a4,
+ DWORD a5)
+ = WSASocketA;
+
+SOCKET (__stdcall * Real_WSASocketW)(int a0,
+ int a1,
+ int a2,
+ LPWSAPROTOCOL_INFOW a3,
+ GROUP a4,
+ DWORD a5)
+ = WSASocketW;
+
+int (__stdcall * Real_WSAStartup)(WORD a0,
+ LPWSADATA a1)
+ = WSAStartup;
+
+INT (__stdcall * Real_WSAStringToAddressA)(LPSTR a0,
+ INT a1,
+ LPWSAPROTOCOL_INFOA a2,
+ LPSOCKADDR a3,
+ LPINT a4)
+ = WSAStringToAddressA;
+
+INT (__stdcall * Real_WSAStringToAddressW)(LPWSTR a0,
+ INT a1,
+ LPWSAPROTOCOL_INFOW a2,
+ LPSOCKADDR a3,
+ LPINT a4)
+ = WSAStringToAddressW;
+
+int (__stdcall * Real_WSAUnhookBlockingHook)(void)
+ = WSAUnhookBlockingHook;
+
+DWORD (__stdcall * Real_WSAWaitForMultipleEvents)(DWORD a0,
+ CONST HANDLE * a1,
+ BOOL a2,
+ DWORD a3,
+ BOOL a4)
+ = WSAWaitForMultipleEvents;
+
+BOOL (__stdcall * Real_WaitCommEvent)(HANDLE a0,
+ LPDWORD a1,
+ LPOVERLAPPED a2)
+ = WaitCommEvent;
+
+#if !defined(DETOURS_ARM)
+BOOL (__stdcall * Real_WaitForDebugEvent)(LPDEBUG_EVENT a0,
+ DWORD a1)
+ = WaitForDebugEvent;
+#endif // !DETOUR_ARM
+
+DWORD (__stdcall * Real_WaitForInputIdle)(HANDLE a0,
+ DWORD a1)
+ = WaitForInputIdle;
+
+DWORD (__stdcall * Real_WaitForMultipleObjects)(DWORD a0,
+ CONST HANDLE * a1,
+ BOOL a2,
+ DWORD a3)
+ = WaitForMultipleObjects;
+
+DWORD (__stdcall * Real_WaitForMultipleObjectsEx)(DWORD a0,
+ CONST HANDLE * a1,
+ BOOL a2,
+ DWORD a3,
+ BOOL a4)
+ = WaitForMultipleObjectsEx;
+
+DWORD (__stdcall * Real_WaitForSingleObject)(HANDLE a0,
+ DWORD a1)
+ = WaitForSingleObject;
+
+DWORD (__stdcall * Real_WaitForSingleObjectEx)(HANDLE a0,
+ DWORD a1,
+ BOOL a2)
+ = WaitForSingleObjectEx;
+
+BOOL (__stdcall * Real_WaitMessage)(void)
+ = WaitMessage;
+
+BOOL (__stdcall * Real_WaitNamedPipeA)(LPCSTR a0,
+ DWORD a1)
+ = WaitNamedPipeA;
+
+BOOL (__stdcall * Real_WaitNamedPipeW)(LPCWSTR a0,
+ DWORD a1)
+ = WaitNamedPipeW;
+
+BOOL (__stdcall * Real_WidenPath)(HDC a0)
+ = WidenPath;
+
+UINT (__stdcall * Real_WinExec)(LPCSTR a0,
+ UINT a1)
+ = WinExec;
+
+BOOL (__stdcall * Real_WinHelpA)(HWND a0,
+ LPCSTR a1,
+ UINT a2,
+ ULONG_PTR a3)
+ = WinHelpA;
+
+BOOL (__stdcall * Real_WinHelpW)(HWND a0,
+ LPCWSTR a1,
+ UINT a2,
+ ULONG_PTR a3)
+ = WinHelpW;
+
+HWND (__stdcall * Real_WindowFromDC)(HDC a0)
+ = WindowFromDC;
+
+HWND (__stdcall * Real_WindowFromPoint)(POINT a0)
+ = WindowFromPoint;
+
+HRESULT (__stdcall * Real_WriteClassStg)(LPSTORAGE a0,
+ CONST IID& a1)
+ = WriteClassStg;
+
+HRESULT (__stdcall * Real_WriteClassStm)(LPSTREAM a0,
+ CONST IID& a1)
+ = WriteClassStm;
+
+BOOL (__stdcall * Real_WriteConsoleA)(HANDLE a0,
+ CONST void* a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPVOID a4)
+ = WriteConsoleA;
+
+BOOL (__stdcall * Real_WriteConsoleInputA)(HANDLE a0,
+ CONST INPUT_RECORD* a1,
+ DWORD a2,
+ LPDWORD a3)
+ = WriteConsoleInputA;
+
+BOOL (__stdcall * Real_WriteConsoleInputW)(HANDLE a0,
+ CONST INPUT_RECORD* a1,
+ DWORD a2,
+ LPDWORD a3)
+ = WriteConsoleInputW;
+
+BOOL (__stdcall * Real_WriteConsoleOutputA)(HANDLE a0,
+ CONST CHAR_INFO* a1,
+ COORD a2,
+ COORD a3,
+ PSMALL_RECT a4)
+ = WriteConsoleOutputA;
+
+BOOL (__stdcall * Real_WriteConsoleOutputAttribute)(HANDLE a0,
+ CONST WORD* a1,
+ DWORD a2,
+ COORD a3,
+ LPDWORD a4)
+ = WriteConsoleOutputAttribute;
+
+BOOL (__stdcall * Real_WriteConsoleOutputCharacterA)(HANDLE a0,
+ LPCSTR a1,
+ DWORD a2,
+ COORD a3,
+ LPDWORD a4)
+ = WriteConsoleOutputCharacterA;
+
+BOOL (__stdcall * Real_WriteConsoleOutputCharacterW)(HANDLE a0,
+ LPCWSTR a1,
+ DWORD a2,
+ COORD a3,
+ LPDWORD a4)
+ = WriteConsoleOutputCharacterW;
+
+BOOL (__stdcall * Real_WriteConsoleOutputW)(HANDLE a0,
+ CONST CHAR_INFO* a1,
+ COORD a2,
+ COORD a3,
+ PSMALL_RECT a4)
+ = WriteConsoleOutputW;
+
+BOOL (__stdcall * Real_WriteConsoleW)(HANDLE a0,
+ CONST void* a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPVOID a4)
+ = WriteConsoleW;
+
+BOOL (__stdcall * Real_WriteFile)(HANDLE a0,
+ LPCVOID a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPOVERLAPPED a4)
+ = WriteFile;
+
+BOOL (__stdcall * Real_WriteFileEx)(HANDLE a0,
+ LPCVOID a1,
+ DWORD a2,
+ LPOVERLAPPED a3,
+ LPOVERLAPPED_COMPLETION_ROUTINE a4)
+ = WriteFileEx;
+
+HRESULT (__stdcall * Real_WriteFmtUserTypeStg)(LPSTORAGE a0,
+ CLIPFORMAT a1,
+ LPOLESTR a2)
+ = WriteFmtUserTypeStg;
+
+BOOL (__stdcall * Real_WritePrivateProfileSectionA)(LPCSTR a0,
+ LPCSTR a1,
+ LPCSTR a2)
+ = WritePrivateProfileSectionA;
+
+BOOL (__stdcall * Real_WritePrivateProfileSectionW)(LPCWSTR a0,
+ LPCWSTR a1,
+ LPCWSTR a2)
+ = WritePrivateProfileSectionW;
+
+BOOL (__stdcall * Real_WritePrivateProfileStringA)(LPCSTR a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ LPCSTR a3)
+ = WritePrivateProfileStringA;
+
+BOOL (__stdcall * Real_WritePrivateProfileStringW)(LPCWSTR a0,
+ LPCWSTR a1,
+ LPCWSTR a2,
+ LPCWSTR a3)
+ = WritePrivateProfileStringW;
+
+BOOL (__stdcall * Real_WritePrivateProfileStructA)(LPCSTR a0,
+ LPCSTR a1,
+ LPVOID a2,
+ UINT a3,
+ LPCSTR a4)
+ = WritePrivateProfileStructA;
+
+BOOL (__stdcall * Real_WritePrivateProfileStructW)(LPCWSTR a0,
+ LPCWSTR a1,
+ LPVOID a2,
+ UINT a3,
+ LPCWSTR a4)
+ = WritePrivateProfileStructW;
+
+#if _MSC_VER < 1300
+BOOL (__stdcall * Real_WriteProcessMemory)(HANDLE a0,
+ LPVOID a1,
+ LPVOID a2,
+ DWORD_PTR a3,
+ PDWORD_PTR a4)
+ = WriteProcessMemory;
+#else
+BOOL (__stdcall * Real_WriteProcessMemory)(HANDLE a0,
+ LPVOID a1,
+ LPCVOID a2,
+ DWORD_PTR a3,
+ PDWORD_PTR a4)
+ = WriteProcessMemory;
+#endif
+
+BOOL (__stdcall * Real_WriteProfileSectionA)(LPCSTR a0,
+ LPCSTR a1)
+ = WriteProfileSectionA;
+
+BOOL (__stdcall * Real_WriteProfileSectionW)(LPCWSTR a0,
+ LPCWSTR a1)
+ = WriteProfileSectionW;
+
+BOOL (__stdcall * Real_WriteProfileStringA)(LPCSTR a0,
+ LPCSTR a1,
+ LPCSTR a2)
+ = WriteProfileStringA;
+
+BOOL (__stdcall * Real_WriteProfileStringW)(LPCWSTR a0,
+ LPCWSTR a1,
+ LPCWSTR a2)
+ = WriteProfileStringW;
+
+DWORD (__stdcall * Real_WriteTapemark)(HANDLE a0,
+ DWORD a1,
+ DWORD a2,
+ BOOL a3)
+ = WriteTapemark;
+
+int (__stdcall * Real___WSAFDIsSet)(SOCKET a0,
+ fd_set* a1)
+ = __WSAFDIsSet;
+
+long (__stdcall * Real__hread)(HFILE a0,
+ LPVOID a1,
+ long a2)
+ = _hread;
+
+long (__stdcall * Real__hwrite)(HFILE a0,
+ LPCSTR a1,
+ long a2)
+ = _hwrite;
+
+HFILE (__stdcall * Real__lclose)(HFILE a0)
+ = _lclose;
+
+HFILE (__stdcall * Real__lcreat)(LPCSTR a0,
+ int a1)
+ = _lcreat;
+
+LONG (__stdcall * Real__llseek)(HFILE a0,
+ LONG a1,
+ int a2)
+ = _llseek;
+
+HFILE (__stdcall * Real__lopen)(LPCSTR a0,
+ int a1)
+ = _lopen;
+
+UINT (__stdcall * Real__lread)(HFILE a0,
+ LPVOID a1,
+ UINT a2)
+ = _lread;
+
+UINT (__stdcall * Real__lwrite)(HFILE a0,
+ LPCSTR a1,
+ UINT a2)
+ = _lwrite;
+
+SOCKET (__stdcall * Real_accept)(SOCKET a0,
+ sockaddr* a1,
+ int* a2)
+ = accept;
+
+int (__stdcall * Real_bind)(SOCKET a0,
+ CONST sockaddr* a1,
+ int a2)
+ = bind;
+
+int (__stdcall * Real_closesocket)(SOCKET a0)
+ = closesocket;
+
+int (__stdcall * Real_connect)(SOCKET a0,
+ CONST sockaddr* a1,
+ int a2)
+ = connect;
+
+hostent * (__stdcall * Real_gethostbyaddr)(CONST char* a0,
+ int a1,
+ int a2)
+ = gethostbyaddr;
+
+hostent * (__stdcall * Real_gethostbyname)(CONST char* a0)
+ = gethostbyname;
+
+int (__stdcall * Real_gethostname)(char* a0,
+ int a1)
+ = gethostname;
+
+int (__stdcall * Real_getpeername)(SOCKET a0,
+ sockaddr* a1,
+ int* a2)
+ = getpeername;
+
+protoent * (__stdcall * Real_getprotobyname)(CONST char* a0)
+ = getprotobyname;
+
+protoent * (__stdcall * Real_getprotobynumber)(int a0)
+ = getprotobynumber;
+
+servent * (__stdcall * Real_getservbyname)(CONST char* a0,
+ CONST char* a1)
+ = getservbyname;
+
+servent * (__stdcall * Real_getservbyport)(int a0,
+ CONST char* a1)
+ = getservbyport;
+
+int (__stdcall * Real_getsockname)(SOCKET a0,
+ sockaddr* a1,
+ int* a2)
+ = getsockname;
+
+int (__stdcall * Real_getsockopt)(SOCKET a0,
+ int a1,
+ int a2,
+ char* a3,
+ int* a4)
+ = getsockopt;
+
+u_long (__stdcall * Real_htonl)(u_long a0)
+ = htonl;
+
+u_short (__stdcall * Real_htons)(u_short a0)
+ = htons;
+
+unsigned long (__stdcall * Real_inet_addr)(CONST char* a0)
+ = inet_addr;
+
+char * (__stdcall * Real_inet_ntoa)(in_addr a0)
+ = inet_ntoa;
+
+int (__stdcall * Real_ioctlsocket)(SOCKET a0,
+ long a1,
+ u_long* a2)
+ = ioctlsocket;
+
+void (__stdcall * Real_keybd_event)(BYTE a0,
+ BYTE a1,
+ DWORD a2,
+ ULONG_PTR a3)
+ = keybd_event;
+
+int (__stdcall * Real_listen)(SOCKET a0,
+ int a1)
+ = listen;
+
+void (__stdcall * Real_mouse_event)(DWORD a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3,
+ ULONG_PTR a4)
+ = mouse_event;
+
+u_long (__stdcall * Real_ntohl)(u_long a0)
+ = ntohl;
+
+u_short (__stdcall * Real_ntohs)(u_short a0)
+ = ntohs;
+
+int (__stdcall * Real_recv)(SOCKET a0,
+ char* a1,
+ int a2,
+ int a3)
+ = recv;
+
+int (__stdcall * Real_recvfrom)(SOCKET a0,
+ char* a1,
+ int a2,
+ int a3,
+ sockaddr* a4,
+ int* a5)
+ = recvfrom;
+
+int (__stdcall * Real_select)(int a0,
+ fd_set* a1,
+ fd_set* a2,
+ fd_set* a3,
+ CONST timeval* a4)
+ = select;
+
+int (__stdcall * Real_send)(SOCKET a0,
+ CONST char* a1,
+ int a2,
+ int a3)
+ = send;
+
+int (__stdcall * Real_sendto)(SOCKET a0,
+ CONST char* a1,
+ int a2,
+ int a3,
+ CONST sockaddr* a4,
+ int a5)
+ = sendto;
+
+int (__stdcall * Real_setsockopt)(SOCKET a0,
+ int a1,
+ int a2,
+ CONST char* a3,
+ int a4)
+ = setsockopt;
+
+int (__stdcall * Real_shutdown)(SOCKET a0,
+ int a1)
+ = shutdown;
+
+SOCKET (__stdcall * Real_socket)(int a0,
+ int a1,
+ int a2)
+ = socket;
+
+///////////////////////////////////////////////////////////////////// Detours.
+//
+
+int __stdcall Mine_AbortDoc(HDC a0)
+{
+ _PrintEnter("AbortDoc(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_AbortDoc(a0);
+ } __finally {
+ _PrintExit("AbortDoc() -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_AbortPath(HDC a0)
+{
+ _PrintEnter("AbortPath(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_AbortPath(a0);
+ } __finally {
+ _PrintExit("AbortPath() -> %x\n", rv);
+ };
+ return rv;
+}
+
+HKL __stdcall Mine_ActivateKeyboardLayout(HKL a0,
+ UINT a1)
+{
+ _PrintEnter("ActivateKeyboardLayout(%p,%p)\n", a0, a1);
+
+ HKL rv = 0;
+ __try {
+ rv = Real_ActivateKeyboardLayout(a0, a1);
+ } __finally {
+ _PrintExit("ActivateKeyboardLayout(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+ATOM __stdcall Mine_AddAtomA(LPCSTR a0)
+{
+ _PrintEnter("AddAtomA(%hs)\n", a0);
+
+ ATOM rv = 0;
+ __try {
+ rv = Real_AddAtomA(a0);
+ } __finally {
+ _PrintExit("AddAtomA() -> %x\n", rv);
+ };
+ return rv;
+}
+
+ATOM __stdcall Mine_AddAtomW(LPCWSTR a0)
+{
+ _PrintEnter("AddAtomW(%ls)\n", a0);
+
+ ATOM rv = 0;
+ __try {
+ rv = Real_AddAtomW(a0);
+ } __finally {
+ _PrintExit("AddAtomW() -> %x\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_AddFontResourceA(LPCSTR a0)
+{
+ _PrintEnter("AddFontResourceA(%hs)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_AddFontResourceA(a0);
+ } __finally {
+ _PrintExit("AddFontResourceA() -> %x\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_AddFontResourceW(LPCWSTR a0)
+{
+ _PrintEnter("AddFontResourceW(%ls)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_AddFontResourceW(a0);
+ } __finally {
+ _PrintExit("AddFontResourceW() -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_AdjustWindowRect(LPRECT a0,
+ DWORD a1,
+ BOOL a2)
+{
+ _PrintEnter("AdjustWindowRect(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_AdjustWindowRect(a0, a1, a2);
+ } __finally {
+ _PrintExit("AdjustWindowRect(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_AdjustWindowRectEx(LPRECT a0,
+ DWORD a1,
+ BOOL a2,
+ DWORD a3)
+{
+ _PrintEnter("AdjustWindowRectEx(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_AdjustWindowRectEx(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("AdjustWindowRectEx(,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_AllocConsole(void)
+{
+ _PrintEnter("AllocConsole()\n");
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_AllocConsole();
+ } __finally {
+ _PrintExit("AllocConsole() -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_AngleArc(HDC a0,
+ int a1,
+ int a2,
+ DWORD a3,
+ FLOAT a4,
+ FLOAT a5)
+{
+ _PrintEnter("AngleArc(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_AngleArc(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("AngleArc(,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_AnimatePalette(HPALETTE a0,
+ UINT a1,
+ UINT a2,
+ PALETTEENTRY* a3)
+{
+ _PrintEnter("AnimatePalette(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_AnimatePalette(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("AnimatePalette(,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_AnyPopup(void)
+{
+ _PrintEnter("AnyPopup()\n");
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_AnyPopup();
+ } __finally {
+ _PrintExit("AnyPopup() -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_AppendMenuA(HMENU a0,
+ UINT a1,
+ UINT_PTR a2,
+ LPCSTR a3)
+{
+ _PrintEnter("AppendMenuA(%p,%p,%p,%hs)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_AppendMenuA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("AppendMenuA(,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_AppendMenuW(HMENU a0,
+ UINT a1,
+ UINT_PTR a2,
+ LPCWSTR a3)
+{
+ _PrintEnter("AppendMenuW(%p,%p,%p,%ls)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_AppendMenuW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("AppendMenuW(,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_Arc(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ int a5,
+ int a6,
+ int a7,
+ int a8)
+{
+ _PrintEnter("Arc(%p,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_Arc(a0, a1, a2, a3, a4, a5, a6, a7, a8);
+ } __finally {
+ _PrintExit("Arc(,,,,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ArcTo(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ int a5,
+ int a6,
+ int a7,
+ int a8)
+{
+ _PrintEnter("ArcTo(%p,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ArcTo(a0, a1, a2, a3, a4, a5, a6, a7, a8);
+ } __finally {
+ _PrintExit("ArcTo(,,,,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_AreFileApisANSI(void)
+{
+ _PrintEnter("AreFileApisANSI()\n");
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_AreFileApisANSI();
+ } __finally {
+ _PrintExit("AreFileApisANSI() -> %x\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_ArrangeIconicWindows(HWND a0)
+{
+ _PrintEnter("ArrangeIconicWindows(%p)\n", a0);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_ArrangeIconicWindows(a0);
+ } __finally {
+ _PrintExit("ArrangeIconicWindows() -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_AttachThreadInput(DWORD a0,
+ DWORD a1,
+ BOOL a2)
+{
+ _PrintEnter("AttachThreadInput(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_AttachThreadInput(a0, a1, a2);
+ } __finally {
+ _PrintExit("AttachThreadInput(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_BackupRead(HANDLE a0,
+ LPBYTE a1,
+ DWORD a2,
+ LPDWORD a3,
+ BOOL a4,
+ BOOL a5,
+ LPVOID* a6)
+{
+ _PrintEnter("BackupRead(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_BackupRead(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("BackupRead(,,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_BackupSeek(HANDLE a0,
+ DWORD a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPVOID* a5)
+{
+ _PrintEnter("BackupSeek(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_BackupSeek(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("BackupSeek(,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_BackupWrite(HANDLE a0,
+ LPBYTE a1,
+ DWORD a2,
+ LPDWORD a3,
+ BOOL a4,
+ BOOL a5,
+ LPVOID* a6)
+{
+ _PrintEnter("BackupWrite(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_BackupWrite(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("BackupWrite(,,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_Beep(DWORD a0,
+ DWORD a1)
+{
+ _PrintEnter("Beep(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_Beep(a0, a1);
+ } __finally {
+ _PrintExit("Beep(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HDWP __stdcall Mine_BeginDeferWindowPos(int a0)
+{
+ _PrintEnter("BeginDeferWindowPos(%p)\n", a0);
+
+ HDWP rv = 0;
+ __try {
+ rv = Real_BeginDeferWindowPos(a0);
+ } __finally {
+ _PrintExit("BeginDeferWindowPos() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HDC __stdcall Mine_BeginPaint(HWND a0,
+ LPPAINTSTRUCT a1)
+{
+ _PrintEnter("BeginPaint(%p,%p)\n", a0, a1);
+
+ HDC rv = 0;
+ __try {
+ rv = Real_BeginPaint(a0, a1);
+ } __finally {
+ _PrintExit("BeginPaint(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_BeginPath(HDC a0)
+{
+ _PrintEnter("BeginPath(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_BeginPath(a0);
+ } __finally {
+ _PrintExit("BeginPath() -> %x\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_BeginUpdateResourceA(LPCSTR a0,
+ BOOL a1)
+{
+ _PrintEnter("BeginUpdateResourceA(%hs,%p)\n", a0, a1);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_BeginUpdateResourceA(a0, a1);
+ } __finally {
+ _PrintExit("BeginUpdateResourceA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_BeginUpdateResourceW(LPCWSTR a0,
+ BOOL a1)
+{
+ _PrintEnter("BeginUpdateResourceW(%ls,%p)\n", a0, a1);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_BeginUpdateResourceW(a0, a1);
+ } __finally {
+ _PrintExit("BeginUpdateResourceW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_BindMoniker(IMoniker* a0,
+ DWORD a1,
+ CONST IID& a2,
+ LPVOID* a3)
+{
+ _PrintEnter("BindMoniker(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_BindMoniker(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("BindMoniker(,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_BitBlt(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ HDC a5,
+ int a6,
+ int a7,
+ DWORD a8)
+{
+ _PrintEnter("BitBlt(%p,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_BitBlt(a0, a1, a2, a3, a4, a5, a6, a7, a8);
+ } __finally {
+ _PrintExit("BitBlt(,,,,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_BringWindowToTop(HWND a0)
+{
+ _PrintEnter("BringWindowToTop(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_BringWindowToTop(a0);
+ } __finally {
+ _PrintExit("BringWindowToTop() -> %x\n", rv);
+ };
+ return rv;
+}
+
+long __stdcall Mine_BroadcastSystemMessageA(DWORD a0,
+ LPDWORD a1,
+ UINT a2,
+ WPARAM a3,
+ LPARAM a4)
+{
+ _PrintEnter("BroadcastSystemMessageA(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ long rv = 0;
+ __try {
+ rv = Real_BroadcastSystemMessageA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("BroadcastSystemMessageA(,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+long __stdcall Mine_BroadcastSystemMessageW(DWORD a0,
+ LPDWORD a1,
+ UINT a2,
+ WPARAM a3,
+ LPARAM a4)
+{
+ _PrintEnter("BroadcastSystemMessageW(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ long rv = 0;
+ __try {
+ rv = Real_BroadcastSystemMessageW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("BroadcastSystemMessageW(,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_BuildCommDCBA(LPCSTR a0,
+ LPDCB a1)
+{
+ _PrintEnter("BuildCommDCBA(%hs,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_BuildCommDCBA(a0, a1);
+ } __finally {
+ _PrintExit("BuildCommDCBA(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_BuildCommDCBAndTimeoutsA(LPCSTR a0,
+ LPDCB a1,
+ LPCOMMTIMEOUTS a2)
+{
+ _PrintEnter("BuildCommDCBAndTimeoutsA(%hs,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_BuildCommDCBAndTimeoutsA(a0, a1, a2);
+ } __finally {
+ _PrintExit("BuildCommDCBAndTimeoutsA(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_BuildCommDCBAndTimeoutsW(LPCWSTR a0,
+ LPDCB a1,
+ LPCOMMTIMEOUTS a2)
+{
+ _PrintEnter("BuildCommDCBAndTimeoutsW(%ls,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_BuildCommDCBAndTimeoutsW(a0, a1, a2);
+ } __finally {
+ _PrintExit("BuildCommDCBAndTimeoutsW(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_BuildCommDCBW(LPCWSTR a0,
+ LPDCB a1)
+{
+ _PrintEnter("BuildCommDCBW(%ls,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_BuildCommDCBW(a0, a1);
+ } __finally {
+ _PrintExit("BuildCommDCBW(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CLSIDFromProgID(LPCOLESTR a0,
+ LPGUID a1)
+{
+ _PrintEnter("CLSIDFromProgID(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CLSIDFromProgID(a0, a1);
+ } __finally {
+ _PrintExit("CLSIDFromProgID(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CLSIDFromString(LPOLESTR a0,
+ LPGUID a1)
+{
+ _PrintEnter("CLSIDFromString(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CLSIDFromString(a0, a1);
+ } __finally {
+ _PrintExit("CLSIDFromString(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CallMsgFilterA(LPMSG a0,
+ int a1)
+{
+ _PrintEnter("CallMsgFilterA(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CallMsgFilterA(a0, a1);
+ } __finally {
+ _PrintExit("CallMsgFilterA(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CallMsgFilterW(LPMSG a0,
+ int a1)
+{
+ _PrintEnter("CallMsgFilterW(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CallMsgFilterW(a0, a1);
+ } __finally {
+ _PrintExit("CallMsgFilterW(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CallNamedPipeA(LPCSTR a0,
+ LPVOID a1,
+ DWORD a2,
+ LPVOID a3,
+ DWORD a4,
+ LPDWORD a5,
+ DWORD a6)
+{
+ _PrintEnter("CallNamedPipeA(%hs,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CallNamedPipeA(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("CallNamedPipeA(,,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CallNamedPipeW(LPCWSTR a0,
+ LPVOID a1,
+ DWORD a2,
+ LPVOID a3,
+ DWORD a4,
+ LPDWORD a5,
+ DWORD a6)
+{
+ _PrintEnter("CallNamedPipeW(%ls,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CallNamedPipeW(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("CallNamedPipeW(,,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+LRESULT __stdcall Mine_CallNextHookEx(HHOOK a0,
+ int a1,
+ WPARAM a2,
+ LPARAM a3)
+{
+ _PrintEnter("CallNextHookEx(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ LRESULT rv = 0;
+ __try {
+ rv = Real_CallNextHookEx(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CallNextHookEx(,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+LRESULT __stdcall Mine_CallWindowProcA(WNDPROC a0,
+ HWND a1,
+ UINT a2,
+ WPARAM a3,
+ LPARAM a4)
+{
+ _PrintEnter("CallWindowProcA(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ LRESULT rv = 0;
+ __try {
+ rv = Real_CallWindowProcA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("CallWindowProcA(,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+LRESULT __stdcall Mine_CallWindowProcW(WNDPROC a0,
+ HWND a1,
+ UINT a2,
+ WPARAM a3,
+ LPARAM a4)
+{
+ _PrintEnter("CallWindowProcW(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ LRESULT rv = 0;
+ __try {
+ rv = Real_CallWindowProcW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("CallWindowProcW(,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CancelDC(HDC a0)
+{
+ _PrintEnter("CancelDC(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CancelDC(a0);
+ } __finally {
+ _PrintExit("CancelDC() -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CancelIo(HANDLE a0)
+{
+ _PrintEnter("CancelIo(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CancelIo(a0);
+ } __finally {
+ _PrintExit("CancelIo() -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CancelWaitableTimer(HANDLE a0)
+{
+ _PrintEnter("CancelWaitableTimer(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CancelWaitableTimer(a0);
+ } __finally {
+ _PrintExit("CancelWaitableTimer() -> %x\n", rv);
+ };
+ return rv;
+}
+
+WORD __stdcall Mine_CascadeWindows(HWND a0,
+ UINT a1,
+ RECT* a2,
+ UINT a3,
+ struct HWND__** a4)
+{
+ _PrintEnter("CascadeWindows(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ WORD rv = 0;
+ __try {
+ rv = Real_CascadeWindows(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("CascadeWindows(,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ChangeClipboardChain(HWND a0,
+ HWND a1)
+{
+ _PrintEnter("ChangeClipboardChain(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ChangeClipboardChain(a0, a1);
+ } __finally {
+ _PrintExit("ChangeClipboardChain(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+LONG __stdcall Mine_ChangeDisplaySettingsA(LPDEVMODEA a0,
+ DWORD a1)
+{
+ _PrintEnter("ChangeDisplaySettingsA(%p,%p)\n", a0, a1);
+
+ LONG rv = 0;
+ __try {
+ rv = Real_ChangeDisplaySettingsA(a0, a1);
+ } __finally {
+ _PrintExit("ChangeDisplaySettingsA(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+LONG __stdcall Mine_ChangeDisplaySettingsExA(LPCSTR a0,
+ LPDEVMODEA a1,
+ HWND a2,
+ DWORD a3,
+ LPVOID a4)
+{
+ _PrintEnter("ChangeDisplaySettingsExA(%hs,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ LONG rv = 0;
+ __try {
+ rv = Real_ChangeDisplaySettingsExA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("ChangeDisplaySettingsExA(,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+LONG __stdcall Mine_ChangeDisplaySettingsExW(LPCWSTR a0,
+ LPDEVMODEW a1,
+ HWND a2,
+ DWORD a3,
+ LPVOID a4)
+{
+ _PrintEnter("ChangeDisplaySettingsExW(%ls,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ LONG rv = 0;
+ __try {
+ rv = Real_ChangeDisplaySettingsExW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("ChangeDisplaySettingsExW(,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+LONG __stdcall Mine_ChangeDisplaySettingsW(LPDEVMODEW a0,
+ DWORD a1)
+{
+ _PrintEnter("ChangeDisplaySettingsW(%p,%p)\n", a0, a1);
+
+ LONG rv = 0;
+ __try {
+ rv = Real_ChangeDisplaySettingsW(a0, a1);
+ } __finally {
+ _PrintExit("ChangeDisplaySettingsW(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ChangeMenuA(HMENU a0,
+ UINT a1,
+ LPCSTR a2,
+ UINT a3,
+ UINT a4)
+{
+ _PrintEnter("ChangeMenuA(%p,%p,%hs,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ChangeMenuA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("ChangeMenuA(,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ChangeMenuW(HMENU a0,
+ UINT a1,
+ LPCWSTR a2,
+ UINT a3,
+ UINT a4)
+{
+ _PrintEnter("ChangeMenuW(%p,%p,%ls,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ChangeMenuW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("ChangeMenuW(,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+LPSTR __stdcall Mine_CharLowerA(LPSTR a0)
+{
+ _PrintEnter("CharLowerA(%hs)\n", a0);
+
+ LPSTR rv = 0;
+ __try {
+ rv = Real_CharLowerA(a0);
+ } __finally {
+ _PrintExit("CharLowerA(%hs) -> %hs\n", a0, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_CharLowerBuffA(LPSTR a0,
+ DWORD a1)
+{
+ _PrintEnter("CharLowerBuffA(%hs,%p)\n", a0, a1);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_CharLowerBuffA(a0, a1);
+ } __finally {
+ _PrintExit("CharLowerBuffA(%hs,) -> %x\n", a0, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_CharLowerBuffW(LPWSTR a0,
+ DWORD a1)
+{
+ _PrintEnter("CharLowerBuffW(%ls,%p)\n", a0, a1);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_CharLowerBuffW(a0, a1);
+ } __finally {
+ _PrintExit("CharLowerBuffW(%ls,) -> %x\n", a0, rv);
+ };
+ return rv;
+}
+
+LPWSTR __stdcall Mine_CharLowerW(LPWSTR a0)
+{
+ _PrintEnter("CharLowerW(%ls)\n", a0);
+
+ LPWSTR rv = 0;
+ __try {
+ rv = Real_CharLowerW(a0);
+ } __finally {
+ _PrintExit("CharLowerW(%ls) -> %ls\n", a0, rv);
+ };
+ return rv;
+}
+
+LPSTR __stdcall Mine_CharNextA(LPCSTR a0)
+{
+ _PrintEnter("CharNextA(%hs)\n", a0);
+
+ LPSTR rv = 0;
+ __try {
+ rv = Real_CharNextA(a0);
+ } __finally {
+ _PrintExit("CharNextA() -> %hs\n", rv);
+ };
+ return rv;
+}
+
+LPSTR __stdcall Mine_CharNextExA(WORD a0,
+ LPCSTR a1,
+ DWORD a2)
+{
+ _PrintEnter("CharNextExA(%p,%hs,%p)\n", a0, a1, a2);
+
+ LPSTR rv = 0;
+ __try {
+ rv = Real_CharNextExA(a0, a1, a2);
+ } __finally {
+ _PrintExit("CharNextExA(,,) -> %hs\n", rv);
+ };
+ return rv;
+}
+
+LPWSTR __stdcall Mine_CharNextW(LPCWSTR a0)
+{
+ _PrintEnter("CharNextW(%ls)\n", a0);
+
+ LPWSTR rv = 0;
+ __try {
+ rv = Real_CharNextW(a0);
+ } __finally {
+ _PrintExit("CharNextW() -> %ls\n", rv);
+ };
+ return rv;
+}
+
+LPSTR __stdcall Mine_CharPrevA(LPCSTR a0,
+ LPCSTR a1)
+{
+ _PrintEnter("CharPrevA(%hs,%hs)\n", a0, a1);
+
+ LPSTR rv = 0;
+ __try {
+ rv = Real_CharPrevA(a0, a1);
+ } __finally {
+ _PrintExit("CharPrevA(,) -> %hs\n", rv);
+ };
+ return rv;
+}
+
+LPSTR __stdcall Mine_CharPrevExA(WORD a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ DWORD a3)
+{
+ _PrintEnter("CharPrevExA(%p,%hs,%hs,%p)\n", a0, a1, a2, a3);
+
+ LPSTR rv = 0;
+ __try {
+ rv = Real_CharPrevExA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CharPrevExA(,,,) -> %hs\n", rv);
+ };
+ return rv;
+}
+
+LPWSTR __stdcall Mine_CharPrevW(LPCWSTR a0,
+ LPCWSTR a1)
+{
+ _PrintEnter("CharPrevW(%ls,%ls)\n", a0, a1);
+
+ LPWSTR rv = 0;
+ __try {
+ rv = Real_CharPrevW(a0, a1);
+ } __finally {
+ _PrintExit("CharPrevW(,) -> %ls\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CharToOemA(LPCSTR a0,
+ LPSTR a1)
+{
+ _PrintEnter("CharToOemA(%hs,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CharToOemA(a0, a1);
+ } __finally {
+ _PrintExit("CharToOemA(,%hs) -> %x\n", a1, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CharToOemBuffA(LPCSTR a0,
+ LPSTR a1,
+ DWORD a2)
+{
+ _PrintEnter("CharToOemBuffA(%hs,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CharToOemBuffA(a0, a1, a2);
+ } __finally {
+ _PrintExit("CharToOemBuffA(,%hs,) -> %x\n", a1, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CharToOemBuffW(LPCWSTR a0,
+ LPSTR a1,
+ DWORD a2)
+{
+ _PrintEnter("CharToOemBuffW(%ls,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CharToOemBuffW(a0, a1, a2);
+ } __finally {
+ _PrintExit("CharToOemBuffW(,%hs,) -> %x\n", a1, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CharToOemW(LPCWSTR a0,
+ LPSTR a1)
+{
+ _PrintEnter("CharToOemW(%ls,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CharToOemW(a0, a1);
+ } __finally {
+ _PrintExit("CharToOemW(,%hs) -> %x\n", a1, rv);
+ };
+ return rv;
+}
+
+LPSTR __stdcall Mine_CharUpperA(LPSTR a0)
+{
+ _PrintEnter("CharUpperA(%hs)\n", a0);
+
+ LPSTR rv = 0;
+ __try {
+ rv = Real_CharUpperA(a0);
+ } __finally {
+ _PrintExit("CharUpperA(%hs) -> %hs\n", a0, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_CharUpperBuffA(LPSTR a0,
+ DWORD a1)
+{
+ _PrintEnter("CharUpperBuffA(%hs,%p)\n", a0, a1);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_CharUpperBuffA(a0, a1);
+ } __finally {
+ _PrintExit("CharUpperBuffA(%hs,) -> %x\n", a0, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_CharUpperBuffW(LPWSTR a0,
+ DWORD a1)
+{
+ _PrintEnter("CharUpperBuffW(%ls,%p)\n", a0, a1);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_CharUpperBuffW(a0, a1);
+ } __finally {
+ _PrintExit("CharUpperBuffW(%ls,) -> %x\n", a0, rv);
+ };
+ return rv;
+}
+
+LPWSTR __stdcall Mine_CharUpperW(LPWSTR a0)
+{
+ _PrintEnter("CharUpperW(%ls)\n", a0);
+
+ LPWSTR rv = 0;
+ __try {
+ rv = Real_CharUpperW(a0);
+ } __finally {
+ _PrintExit("CharUpperW(%ls) -> %ls\n", a0, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CheckColorsInGamut(
+ HDC a0,
+#ifdef GDIPLUS_TS_QUERYVER
+ LPRGBTRIPLE a1,
+#else
+ LPVOID a1,
+#endif
+ LPVOID a2,
+ DWORD a3
+ )
+{
+ _PrintEnter("CheckColorsInGamut(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CheckColorsInGamut(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CheckColorsInGamut(,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CheckDlgButton(HWND a0,
+ int a1,
+ UINT a2)
+{
+ _PrintEnter("CheckDlgButton(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CheckDlgButton(a0, a1, a2);
+ } __finally {
+ _PrintExit("CheckDlgButton(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_CheckMenuItem(HMENU a0,
+ UINT a1,
+ UINT a2)
+{
+ _PrintEnter("CheckMenuItem(%p,%p,%p)\n", a0, a1, a2);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_CheckMenuItem(a0, a1, a2);
+ } __finally {
+ _PrintExit("CheckMenuItem(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CheckMenuRadioItem(HMENU a0,
+ UINT a1,
+ UINT a2,
+ UINT a3,
+ UINT a4)
+{
+ _PrintEnter("CheckMenuRadioItem(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CheckMenuRadioItem(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("CheckMenuRadioItem(,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CheckRadioButton(HWND a0,
+ int a1,
+ int a2,
+ int a3)
+{
+ _PrintEnter("CheckRadioButton(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CheckRadioButton(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CheckRadioButton(,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_ChildWindowFromPoint(HWND a0,
+ POINT a1)
+{
+ _PrintEnter("ChildWindowFromPoint(%p,%p)\n", a0, a1);
+
+ HWND rv = 0;
+ __try {
+ rv = Real_ChildWindowFromPoint(a0, a1);
+ } __finally {
+ _PrintExit("ChildWindowFromPoint(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_ChildWindowFromPointEx(HWND a0,
+ POINT a1,
+ UINT a2)
+{
+ _PrintEnter("ChildWindowFromPointEx(%p,%p,%p)\n", a0, a1, a2);
+
+ HWND rv = 0;
+ __try {
+ rv = Real_ChildWindowFromPointEx(a0, a1, a2);
+ } __finally {
+ _PrintExit("ChildWindowFromPointEx(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_ChoosePixelFormat(HDC a0,
+ PIXELFORMATDESCRIPTOR* a1)
+{
+ _PrintEnter("ChoosePixelFormat(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_ChoosePixelFormat(a0, a1);
+ } __finally {
+ _PrintExit("ChoosePixelFormat(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_Chord(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ int a5,
+ int a6,
+ int a7,
+ int a8)
+{
+ _PrintEnter("Chord(%p,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_Chord(a0, a1, a2, a3, a4, a5, a6, a7, a8);
+ } __finally {
+ _PrintExit("Chord(,,,,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ClearCommBreak(HANDLE a0)
+{
+ _PrintEnter("ClearCommBreak(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ClearCommBreak(a0);
+ } __finally {
+ _PrintExit("ClearCommBreak() -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ClearCommError(HANDLE a0,
+ LPDWORD a1,
+ LPCOMSTAT a2)
+{
+ _PrintEnter("ClearCommError(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ClearCommError(a0, a1, a2);
+ } __finally {
+ _PrintExit("ClearCommError(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ClientToScreen(HWND a0,
+ POINT* a1)
+{
+ _PrintEnter("ClientToScreen(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ClientToScreen(a0, a1);
+ } __finally {
+ _PrintExit("ClientToScreen(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ClipCursor(RECT* a0)
+{
+ _PrintEnter("ClipCursor(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ClipCursor(a0);
+ } __finally {
+ _PrintExit("ClipCursor() -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CloseClipboard(void)
+{
+ _PrintEnter("CloseClipboard()\n");
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CloseClipboard();
+ } __finally {
+ _PrintExit("CloseClipboard() -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CloseDesktop(HDESK a0)
+{
+ _PrintEnter("CloseDesktop(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CloseDesktop(a0);
+ } __finally {
+ _PrintExit("CloseDesktop() -> %x\n", rv);
+ };
+ return rv;
+}
+
+HENHMETAFILE __stdcall Mine_CloseEnhMetaFile(HDC a0)
+{
+ _PrintEnter("CloseEnhMetaFile(%p)\n", a0);
+
+ HENHMETAFILE rv = 0;
+ __try {
+ rv = Real_CloseEnhMetaFile(a0);
+ } __finally {
+ _PrintExit("CloseEnhMetaFile() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CloseFigure(HDC a0)
+{
+ _PrintEnter("CloseFigure(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CloseFigure(a0);
+ } __finally {
+ _PrintExit("CloseFigure() -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CloseHandle(HANDLE a0)
+{
+ _PrintEnter("CloseHandle(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CloseHandle(a0);
+ } __finally {
+ _PrintExit("CloseHandle() -> %x\n", rv);
+ };
+ return rv;
+}
+
+HMETAFILE __stdcall Mine_CloseMetaFile(HDC a0)
+{
+ _PrintEnter("CloseMetaFile(%p)\n", a0);
+
+ HMETAFILE rv = 0;
+ __try {
+ rv = Real_CloseMetaFile(a0);
+ } __finally {
+ _PrintExit("CloseMetaFile() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CloseWindow(HWND a0)
+{
+ _PrintEnter("CloseWindow(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CloseWindow(a0);
+ } __finally {
+ _PrintExit("CloseWindow() -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CloseWindowStation(HWINSTA a0)
+{
+ _PrintEnter("CloseWindowStation(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CloseWindowStation(a0);
+ } __finally {
+ _PrintExit("CloseWindowStation() -> %x\n", rv);
+ };
+ return rv;
+}
+
+ULONG __stdcall Mine_CoAddRefServerProcess(void)
+{
+ _PrintEnter("CoAddRefServerProcess()\n");
+
+ ULONG rv = 0;
+ __try {
+ rv = Real_CoAddRefServerProcess();
+ } __finally {
+ _PrintExit("CoAddRefServerProcess() -> %x\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_CoBuildVersion(void)
+{
+ _PrintEnter("CoBuildVersion()\n");
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_CoBuildVersion();
+ } __finally {
+ _PrintExit("CoBuildVersion() -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoCopyProxy(IUnknown* a0,
+ IUnknown** a1)
+{
+ _PrintEnter("CoCopyProxy(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoCopyProxy(a0, a1);
+ } __finally {
+ _PrintExit("CoCopyProxy(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoCreateFreeThreadedMarshaler(LPUNKNOWN a0,
+ LPUNKNOWN* a1)
+{
+ _PrintEnter("CoCreateFreeThreadedMarshaler(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoCreateFreeThreadedMarshaler(a0, a1);
+ } __finally {
+ _PrintExit("CoCreateFreeThreadedMarshaler(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoCreateGuid(GUID* a0)
+{
+ _PrintEnter("CoCreateGuid(%p)\n", a0);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoCreateGuid(a0);
+ } __finally {
+ _PrintExit("CoCreateGuid() -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoCreateInstance(CONST IID& a0,
+ LPUNKNOWN a1,
+ DWORD a2,
+ CONST IID& a3,
+ LPVOID* a4)
+{
+ _PrintEnter("CoCreateInstance(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoCreateInstance(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("CoCreateInstance(,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoCreateInstanceEx(CONST IID& a0,
+ IUnknown* a1,
+ DWORD a2,
+ COSERVERINFO* a3,
+ DWORD a4,
+ MULTI_QI* a5)
+{
+ _PrintEnter("CoCreateInstanceEx(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoCreateInstanceEx(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("CoCreateInstanceEx(,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoDisconnectObject(LPUNKNOWN a0,
+ DWORD a1)
+{
+ _PrintEnter("CoDisconnectObject(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoDisconnectObject(a0, a1);
+ } __finally {
+ _PrintExit("CoDisconnectObject(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CoDosDateTimeToFileTime(WORD a0,
+ WORD a1,
+ FILETIME* a2)
+{
+ _PrintEnter("CoDosDateTimeToFileTime(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CoDosDateTimeToFileTime(a0, a1, a2);
+ } __finally {
+ _PrintExit("CoDosDateTimeToFileTime(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoFileTimeNow(FILETIME* a0)
+{
+ _PrintEnter("CoFileTimeNow(%p)\n", a0);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoFileTimeNow(a0);
+ } __finally {
+ _PrintExit("CoFileTimeNow() -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CoFileTimeToDosDateTime(FILETIME* a0,
+ LPWORD a1,
+ LPWORD a2)
+{
+ _PrintEnter("CoFileTimeToDosDateTime(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CoFileTimeToDosDateTime(a0, a1, a2);
+ } __finally {
+ _PrintExit("CoFileTimeToDosDateTime(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+void __stdcall Mine_CoFreeAllLibraries(void)
+{
+ _PrintEnter("CoFreeAllLibraries()\n");
+
+ __try {
+ Real_CoFreeAllLibraries();
+ } __finally {
+ _PrintExit("CoFreeAllLibraries() ->\n");
+ };
+}
+
+void __stdcall Mine_CoFreeLibrary(HINSTANCE a0)
+{
+ _PrintEnter("CoFreeLibrary(%p)\n", a0);
+
+ __try {
+ Real_CoFreeLibrary(a0);
+ } __finally {
+ _PrintExit("CoFreeLibrary() ->\n");
+ };
+}
+
+void __stdcall Mine_CoFreeUnusedLibraries(void)
+{
+ _PrintEnter("CoFreeUnusedLibraries()\n");
+
+ __try {
+ Real_CoFreeUnusedLibraries();
+ } __finally {
+ _PrintExit("CoFreeUnusedLibraries() ->\n");
+ };
+}
+
+HRESULT __stdcall Mine_CoGetCallContext(CONST IID& a0,
+ void** a1)
+{
+ _PrintEnter("CoGetCallContext(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoGetCallContext(a0, a1);
+ } __finally {
+ _PrintExit("CoGetCallContext(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoGetClassObject(CONST IID& a0,
+ DWORD a1,
+ LPVOID a2,
+ CONST IID& a3,
+ LPVOID* a4)
+{
+ _PrintEnter("CoGetClassObject(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoGetClassObject(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("CoGetClassObject(,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_CoGetCurrentProcess(void)
+{
+ _PrintEnter("CoGetCurrentProcess()\n");
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_CoGetCurrentProcess();
+ } __finally {
+ _PrintExit("CoGetCurrentProcess() -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoGetInstanceFromFile(COSERVERINFO* a0,
+ CLSID* a1,
+ IUnknown* a2,
+ DWORD a3,
+ DWORD a4,
+ OLECHAR* a5,
+ DWORD a6,
+ MULTI_QI* a7)
+{
+ _PrintEnter("CoGetInstanceFromFile(%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoGetInstanceFromFile(a0, a1, a2, a3, a4, a5, a6, a7);
+ } __finally {
+ _PrintExit("CoGetInstanceFromFile(,,,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoGetInstanceFromIStorage(COSERVERINFO* a0,
+ CLSID* a1,
+ IUnknown* a2,
+ DWORD a3,
+ IStorage* a4,
+ DWORD a5,
+ MULTI_QI* a6)
+{
+ _PrintEnter("CoGetInstanceFromIStorage(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoGetInstanceFromIStorage(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("CoGetInstanceFromIStorage(,,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoGetInterfaceAndReleaseStream(LPSTREAM a0,
+ CONST IID& a1,
+ LPVOID* a2)
+{
+ _PrintEnter("CoGetInterfaceAndReleaseStream(%p,%p,%p)\n", a0, a1, a2);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoGetInterfaceAndReleaseStream(a0, a1, a2);
+ } __finally {
+ _PrintExit("CoGetInterfaceAndReleaseStream(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoGetMalloc(DWORD a0,
+ IMalloc** a1)
+{
+ _PrintEnter("CoGetMalloc(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoGetMalloc(a0, a1);
+ } __finally {
+ _PrintExit("CoGetMalloc(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoGetMarshalSizeMax(ULONG* a0,
+ CONST IID& a1,
+ LPUNKNOWN a2,
+ DWORD a3,
+ LPVOID a4,
+ DWORD a5)
+{
+ _PrintEnter("CoGetMarshalSizeMax(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoGetMarshalSizeMax(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("CoGetMarshalSizeMax(,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoGetObject(LPCWSTR a0,
+ BIND_OPTS* a1,
+ CONST IID& a2,
+ void** a3)
+{
+ _PrintEnter("CoGetObject(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoGetObject(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CoGetObject(,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoGetPSClsid(CONST IID& a0,
+ CLSID* a1)
+{
+ _PrintEnter("CoGetPSClsid(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoGetPSClsid(a0, a1);
+ } __finally {
+ _PrintExit("CoGetPSClsid(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoGetStandardMarshal(CONST IID& a0,
+ LPUNKNOWN a1,
+ DWORD a2,
+ LPVOID a3,
+ DWORD a4,
+ IMarshal** a5)
+{
+ _PrintEnter("CoGetStandardMarshal(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoGetStandardMarshal(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("CoGetStandardMarshal(,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoGetStdMarshalEx(LPUNKNOWN a0,
+ DWORD a1,
+ LPUNKNOWN* a2)
+{
+ _PrintEnter("CoGetStdMarshalEx(%p,%p,%p)\n", a0, a1, a2);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoGetStdMarshalEx(a0, a1, a2);
+ } __finally {
+ _PrintExit("CoGetStdMarshalEx(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoGetTreatAsClass(CONST IID& a0,
+ LPGUID a1)
+{
+ _PrintEnter("CoGetTreatAsClass(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoGetTreatAsClass(a0, a1);
+ } __finally {
+ _PrintExit("CoGetTreatAsClass(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoImpersonateClient(void)
+{
+ _PrintEnter("CoImpersonateClient()\n");
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoImpersonateClient();
+ } __finally {
+ _PrintExit("CoImpersonateClient() -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoInitialize(LPVOID a0)
+{
+ _PrintEnter("CoInitialize(%p)\n", a0);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoInitialize(a0);
+ } __finally {
+ _PrintExit("CoInitialize() -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoInitializeEx(LPVOID a0,
+ DWORD a1)
+{
+ _PrintEnter("CoInitializeEx(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoInitializeEx(a0, a1);
+ } __finally {
+ _PrintExit("CoInitializeEx(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoInitializeSecurity(PSECURITY_DESCRIPTOR a0,
+ LONG a1,
+ SOLE_AUTHENTICATION_SERVICE* a2,
+ void* a3,
+ DWORD a4,
+ DWORD a5,
+ void* a6,
+ DWORD a7,
+ void* a8)
+{
+ _PrintEnter("CoInitializeSecurity(%p,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoInitializeSecurity(a0, a1, a2, a3, a4, a5, a6, a7, a8);
+ } __finally {
+ _PrintExit("CoInitializeSecurity(,,,,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CoIsHandlerConnected(LPUNKNOWN a0)
+{
+ _PrintEnter("CoIsHandlerConnected(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CoIsHandlerConnected(a0);
+ } __finally {
+ _PrintExit("CoIsHandlerConnected() -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CoIsOle1Class(CONST IID& a0)
+{
+ _PrintEnter("CoIsOle1Class(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CoIsOle1Class(a0);
+ } __finally {
+ _PrintExit("CoIsOle1Class() -> %x\n", rv);
+ };
+ return rv;
+}
+
+HINSTANCE __stdcall Mine_CoLoadLibrary(LPOLESTR a0,
+ BOOL a1)
+{
+ _PrintEnter("CoLoadLibrary(%p,%p)\n", a0, a1);
+
+ HINSTANCE rv = 0;
+ __try {
+ rv = Real_CoLoadLibrary(a0, a1);
+ } __finally {
+ _PrintExit("CoLoadLibrary(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoLockObjectExternal(LPUNKNOWN a0,
+ BOOL a1,
+ BOOL a2)
+{
+ _PrintEnter("CoLockObjectExternal(%p,%p,%p)\n", a0, a1, a2);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoLockObjectExternal(a0, a1, a2);
+ } __finally {
+ _PrintExit("CoLockObjectExternal(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoMarshalHresult(LPSTREAM a0,
+ HRESULT a1)
+{
+ _PrintEnter("CoMarshalHresult(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoMarshalHresult(a0, a1);
+ } __finally {
+ _PrintExit("CoMarshalHresult(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoMarshalInterThreadInterfaceInStream(CONST IID& a0,
+ LPUNKNOWN a1,
+ LPSTREAM* a2)
+{
+ _PrintEnter("CoMarshalInterThreadInterfaceInStream(%p,%p,%p)\n", a0, a1, a2);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoMarshalInterThreadInterfaceInStream(a0, a1, a2);
+ } __finally {
+ _PrintExit("CoMarshalInterThreadInterfaceInStream(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoMarshalInterface(LPSTREAM a0,
+ CONST IID& a1,
+ LPUNKNOWN a2,
+ DWORD a3,
+ LPVOID a4,
+ DWORD a5)
+{
+ _PrintEnter("CoMarshalInterface(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoMarshalInterface(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("CoMarshalInterface(,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoQueryAuthenticationServices(DWORD* a0,
+ SOLE_AUTHENTICATION_SERVICE** a1)
+{
+ _PrintEnter("CoQueryAuthenticationServices(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoQueryAuthenticationServices(a0, a1);
+ } __finally {
+ _PrintExit("CoQueryAuthenticationServices(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoQueryClientBlanket(DWORD* a0,
+ DWORD* a1,
+ OLECHAR** a2,
+ DWORD* a3,
+ DWORD* a4,
+ RPC_AUTHZ_HANDLE* a5,
+ DWORD* a6)
+{
+ _PrintEnter("CoQueryClientBlanket(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoQueryClientBlanket(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("CoQueryClientBlanket(,,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoQueryProxyBlanket(IUnknown* a0,
+ DWORD* a1,
+ DWORD* a2,
+ OLECHAR** a3,
+ DWORD* a4,
+ DWORD* a5,
+ RPC_AUTH_IDENTITY_HANDLE* a6,
+ DWORD* a7)
+{
+ _PrintEnter("CoQueryProxyBlanket(%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoQueryProxyBlanket(a0, a1, a2, a3, a4, a5, a6, a7);
+ } __finally {
+ _PrintExit("CoQueryProxyBlanket(,,,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoRegisterChannelHook(CONST GUID& a0,
+ IChannelHook* a1)
+{
+ _PrintEnter("CoRegisterChannelHook(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoRegisterChannelHook(a0, a1);
+ } __finally {
+ _PrintExit("CoRegisterChannelHook(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoRegisterClassObject(CONST IID& a0,
+ LPUNKNOWN a1,
+ DWORD a2,
+ DWORD a3,
+ LPDWORD a4)
+{
+ _PrintEnter("CoRegisterClassObject(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoRegisterClassObject(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("CoRegisterClassObject(,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoRegisterMallocSpy(IMallocSpy* a0)
+{
+ _PrintEnter("CoRegisterMallocSpy(%p)\n", a0);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoRegisterMallocSpy(a0);
+ } __finally {
+ _PrintExit("CoRegisterMallocSpy() -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoRegisterMessageFilter(LPMESSAGEFILTER a0,
+ LPMESSAGEFILTER* a1)
+{
+ _PrintEnter("CoRegisterMessageFilter(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoRegisterMessageFilter(a0, a1);
+ } __finally {
+ _PrintExit("CoRegisterMessageFilter(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoRegisterPSClsid(CONST IID& a0,
+ CONST IID& a1)
+{
+ _PrintEnter("CoRegisterPSClsid(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoRegisterPSClsid(a0, a1);
+ } __finally {
+ _PrintExit("CoRegisterPSClsid(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoRegisterSurrogate(LPSURROGATE a0)
+{
+ _PrintEnter("CoRegisterSurrogate(%p)\n", a0);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoRegisterSurrogate(a0);
+ } __finally {
+ _PrintExit("CoRegisterSurrogate() -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoReleaseMarshalData(LPSTREAM a0)
+{
+ _PrintEnter("CoReleaseMarshalData(%p)\n", a0);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoReleaseMarshalData(a0);
+ } __finally {
+ _PrintExit("CoReleaseMarshalData() -> %x\n", rv);
+ };
+ return rv;
+}
+
+ULONG __stdcall Mine_CoReleaseServerProcess(void)
+{
+ _PrintEnter("CoReleaseServerProcess()\n");
+
+ ULONG rv = 0;
+ __try {
+ rv = Real_CoReleaseServerProcess();
+ } __finally {
+ _PrintExit("CoReleaseServerProcess() -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoResumeClassObjects(void)
+{
+ _PrintEnter("CoResumeClassObjects()\n");
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoResumeClassObjects();
+ } __finally {
+ _PrintExit("CoResumeClassObjects() -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoRevertToSelf(void)
+{
+ _PrintEnter("CoRevertToSelf()\n");
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoRevertToSelf();
+ } __finally {
+ _PrintExit("CoRevertToSelf() -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoRevokeClassObject(DWORD a0)
+{
+ _PrintEnter("CoRevokeClassObject(%p)\n", a0);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoRevokeClassObject(a0);
+ } __finally {
+ _PrintExit("CoRevokeClassObject() -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoRevokeMallocSpy(void)
+{
+ _PrintEnter("CoRevokeMallocSpy()\n");
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoRevokeMallocSpy();
+ } __finally {
+ _PrintExit("CoRevokeMallocSpy() -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoSetProxyBlanket(IUnknown* a0,
+ DWORD a1,
+ DWORD a2,
+ OLECHAR* a3,
+ DWORD a4,
+ DWORD a5,
+ RPC_AUTH_IDENTITY_HANDLE a6,
+ DWORD a7)
+{
+ _PrintEnter("CoSetProxyBlanket(%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoSetProxyBlanket(a0, a1, a2, a3, a4, a5, a6, a7);
+ } __finally {
+ _PrintExit("CoSetProxyBlanket(,,,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoSuspendClassObjects(void)
+{
+ _PrintEnter("CoSuspendClassObjects()\n");
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoSuspendClassObjects();
+ } __finally {
+ _PrintExit("CoSuspendClassObjects() -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoSwitchCallContext(IUnknown* a0,
+ IUnknown** a1)
+{
+ _PrintEnter("CoSwitchCallContext(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoSwitchCallContext(a0, a1);
+ } __finally {
+ _PrintExit("CoSwitchCallContext(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+LPVOID __stdcall Mine_CoTaskMemAlloc(SIZE_T a0)
+{
+ _PrintEnter("CoTaskMemAlloc(%p)\n", a0);
+
+ LPVOID rv = 0;
+ __try {
+ rv = Real_CoTaskMemAlloc(a0);
+ } __finally {
+ _PrintExit("CoTaskMemAlloc() -> %p\n", rv);
+ };
+ return rv;
+}
+
+void __stdcall Mine_CoTaskMemFree(LPVOID a0)
+{
+ _PrintEnter("CoTaskMemFree(%p)\n", a0);
+
+ __try {
+ Real_CoTaskMemFree(a0);
+ } __finally {
+ _PrintExit("CoTaskMemFree() ->\n");
+ };
+}
+
+LPVOID __stdcall Mine_CoTaskMemRealloc(LPVOID a0,
+ SIZE_T a1)
+{
+ _PrintEnter("CoTaskMemRealloc(%p,%p)\n", a0, a1);
+
+ LPVOID rv = 0;
+ __try {
+ rv = Real_CoTaskMemRealloc(a0, a1);
+ } __finally {
+ _PrintExit("CoTaskMemRealloc(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoTreatAsClass(CONST IID& a0,
+ CONST IID& a1)
+{
+ _PrintEnter("CoTreatAsClass(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoTreatAsClass(a0, a1);
+ } __finally {
+ _PrintExit("CoTreatAsClass(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+void __stdcall Mine_CoUninitialize(void)
+{
+ _PrintEnter("CoUninitialize()\n");
+
+ __try {
+ Real_CoUninitialize();
+ } __finally {
+ _PrintExit("CoUninitialize() ->\n");
+ };
+}
+
+HRESULT __stdcall Mine_CoUnmarshalHresult(LPSTREAM a0,
+ HRESULT* a1)
+{
+ _PrintEnter("CoUnmarshalHresult(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoUnmarshalHresult(a0, a1);
+ } __finally {
+ _PrintExit("CoUnmarshalHresult(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CoUnmarshalInterface(LPSTREAM a0,
+ CONST IID& a1,
+ LPVOID* a2)
+{
+ _PrintEnter("CoUnmarshalInterface(%p,%p,%p)\n", a0, a1, a2);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CoUnmarshalInterface(a0, a1, a2);
+ } __finally {
+ _PrintExit("CoUnmarshalInterface(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ColorMatchToTarget(HDC a0,
+ HDC a1,
+ DWORD a2)
+{
+ _PrintEnter("ColorMatchToTarget(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ColorMatchToTarget(a0, a1, a2);
+ } __finally {
+ _PrintExit("ColorMatchToTarget(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_CombineRgn(HRGN a0,
+ HRGN a1,
+ HRGN a2,
+ int a3)
+{
+ _PrintEnter("CombineRgn(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ int rv = 0;
+ __try {
+ rv = Real_CombineRgn(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CombineRgn(,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CombineTransform(XFORM* a0,
+ XFORM* a1,
+ XFORM* a2)
+{
+ _PrintEnter("CombineTransform(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CombineTransform(a0, a1, a2);
+ } __finally {
+ _PrintExit("CombineTransform(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CommConfigDialogA(LPCSTR a0,
+ HWND a1,
+ LPCOMMCONFIG a2)
+{
+ _PrintEnter("CommConfigDialogA(%hs,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CommConfigDialogA(a0, a1, a2);
+ } __finally {
+ _PrintExit("CommConfigDialogA(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CommConfigDialogW(LPCWSTR a0,
+ HWND a1,
+ LPCOMMCONFIG a2)
+{
+ _PrintEnter("CommConfigDialogW(%ls,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CommConfigDialogW(a0, a1, a2);
+ } __finally {
+ _PrintExit("CommConfigDialogW(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+LONG __stdcall Mine_CompareFileTime(FILETIME* a0,
+ FILETIME* a1)
+{
+ _PrintEnter("CompareFileTime(%p,%p)\n", a0, a1);
+
+ LONG rv = 0;
+ __try {
+ rv = Real_CompareFileTime(a0, a1);
+ } __finally {
+ _PrintExit("CompareFileTime(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_CompareStringA(LCID a0,
+ DWORD a1,
+ LPCSTR a2,
+ int a3,
+ LPCSTR a4,
+ int a5)
+{
+ _PrintEnter("CompareStringA(%p,%p,%hs,%p,%hs,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ int rv = 0;
+ __try {
+ rv = Real_CompareStringA(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("CompareStringA(,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_CompareStringW(LCID a0,
+ DWORD a1,
+ LPCWSTR a2,
+ int a3,
+ LPCWSTR a4,
+ int a5)
+{
+ _PrintEnter("CompareStringW(%p,%p,%ls,%p,%ls,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ int rv = 0;
+ __try {
+ rv = Real_CompareStringW(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("CompareStringW(,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ConnectNamedPipe(HANDLE a0,
+ LPOVERLAPPED a1)
+{
+ _PrintEnter("ConnectNamedPipe(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ConnectNamedPipe(a0, a1);
+ } __finally {
+ _PrintExit("ConnectNamedPipe(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+#if !defined(DETOURS_ARM)
+BOOL __stdcall Mine_ContinueDebugEvent(DWORD a0,
+ DWORD a1,
+ DWORD a2)
+{
+ _PrintEnter("ContinueDebugEvent(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ContinueDebugEvent(a0, a1, a2);
+ } __finally {
+ _PrintExit("ContinueDebugEvent(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+#endif // !DETOURS_ARM
+
+LCID __stdcall Mine_ConvertDefaultLocale(LCID a0)
+{
+ _PrintEnter("ConvertDefaultLocale(%p)\n", a0);
+
+ LCID rv = 0;
+ __try {
+ rv = Real_ConvertDefaultLocale(a0);
+ } __finally {
+ _PrintExit("ConvertDefaultLocale() -> %x\n", rv);
+ };
+ return rv;
+}
+
+LPVOID __stdcall Mine_ConvertThreadToFiber(LPVOID a0)
+{
+ _PrintEnter("ConvertThreadToFiber(%p)\n", a0);
+
+ LPVOID rv = 0;
+ __try {
+ rv = Real_ConvertThreadToFiber(a0);
+ } __finally {
+ _PrintExit("ConvertThreadToFiber() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_CopyAcceleratorTableA(HACCEL a0,
+ ACCEL* a1,
+ int a2)
+{
+ _PrintEnter("CopyAcceleratorTableA(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_CopyAcceleratorTableA(a0, a1, a2);
+ } __finally {
+ _PrintExit("CopyAcceleratorTableA(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_CopyAcceleratorTableW(HACCEL a0,
+ ACCEL* a1,
+ int a2)
+{
+ _PrintEnter("CopyAcceleratorTableW(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_CopyAcceleratorTableW(a0, a1, a2);
+ } __finally {
+ _PrintExit("CopyAcceleratorTableW(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HENHMETAFILE __stdcall Mine_CopyEnhMetaFileA(HENHMETAFILE a0,
+ LPCSTR a1)
+{
+ _PrintEnter("CopyEnhMetaFileA(%p,%hs)\n", a0, a1);
+
+ HENHMETAFILE rv = 0;
+ __try {
+ rv = Real_CopyEnhMetaFileA(a0, a1);
+ } __finally {
+ _PrintExit("CopyEnhMetaFileA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HENHMETAFILE __stdcall Mine_CopyEnhMetaFileW(HENHMETAFILE a0,
+ LPCWSTR a1)
+{
+ _PrintEnter("CopyEnhMetaFileW(%p,%ls)\n", a0, a1);
+
+ HENHMETAFILE rv = 0;
+ __try {
+ rv = Real_CopyEnhMetaFileW(a0, a1);
+ } __finally {
+ _PrintExit("CopyEnhMetaFileW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CopyFileA(LPCSTR a0,
+ LPCSTR a1,
+ BOOL a2)
+{
+ _PrintEnter("CopyFileA(%hs,%hs,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CopyFileA(a0, a1, a2);
+ } __finally {
+ _PrintExit("CopyFileA(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CopyFileExA(LPCSTR a0,
+ LPCSTR a1,
+ LPPROGRESS_ROUTINE a2,
+ LPVOID a3,
+ LPBOOL a4,
+ DWORD a5)
+{
+ _PrintEnter("CopyFileExA(%hs,%hs,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CopyFileExA(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("CopyFileExA(,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CopyFileExW(LPCWSTR a0,
+ LPCWSTR a1,
+ LPPROGRESS_ROUTINE a2,
+ LPVOID a3,
+ LPBOOL a4,
+ DWORD a5)
+{
+ _PrintEnter("CopyFileExW(%ls,%ls,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CopyFileExW(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("CopyFileExW(,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CopyFileW(LPCWSTR a0,
+ LPCWSTR a1,
+ BOOL a2)
+{
+ _PrintEnter("CopyFileW(%ls,%ls,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CopyFileW(a0, a1, a2);
+ } __finally {
+ _PrintExit("CopyFileW(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HICON __stdcall Mine_CopyIcon(HICON a0)
+{
+ _PrintEnter("CopyIcon(%p)\n", a0);
+
+ HICON rv = 0;
+ __try {
+ rv = Real_CopyIcon(a0);
+ } __finally {
+ _PrintExit("CopyIcon() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_CopyImage(HANDLE a0,
+ UINT a1,
+ int a2,
+ int a3,
+ UINT a4)
+{
+ _PrintEnter("CopyImage(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_CopyImage(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("CopyImage(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HMETAFILE __stdcall Mine_CopyMetaFileA(HMETAFILE a0,
+ LPCSTR a1)
+{
+ _PrintEnter("CopyMetaFileA(%p,%hs)\n", a0, a1);
+
+ HMETAFILE rv = 0;
+ __try {
+ rv = Real_CopyMetaFileA(a0, a1);
+ } __finally {
+ _PrintExit("CopyMetaFileA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HMETAFILE __stdcall Mine_CopyMetaFileW(HMETAFILE a0,
+ LPCWSTR a1)
+{
+ _PrintEnter("CopyMetaFileW(%p,%ls)\n", a0, a1);
+
+ HMETAFILE rv = 0;
+ __try {
+ rv = Real_CopyMetaFileW(a0, a1);
+ } __finally {
+ _PrintExit("CopyMetaFileW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CopyRect(LPRECT a0,
+ RECT* a1)
+{
+ _PrintEnter("CopyRect(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CopyRect(a0, a1);
+ } __finally {
+ _PrintExit("CopyRect(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_CountClipboardFormats(void)
+{
+ _PrintEnter("CountClipboardFormats()\n");
+
+ int rv = 0;
+ __try {
+ rv = Real_CountClipboardFormats();
+ } __finally {
+ _PrintExit("CountClipboardFormats() -> %x\n", rv);
+ };
+ return rv;
+}
+
+HACCEL __stdcall Mine_CreateAcceleratorTableA(ACCEL* a0,
+ int a1)
+{
+ _PrintEnter("CreateAcceleratorTableA(%p,%p)\n", a0, a1);
+
+ HACCEL rv = 0;
+ __try {
+ rv = Real_CreateAcceleratorTableA(a0, a1);
+ } __finally {
+ _PrintExit("CreateAcceleratorTableA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HACCEL __stdcall Mine_CreateAcceleratorTableW(ACCEL* a0,
+ int a1)
+{
+ _PrintEnter("CreateAcceleratorTableW(%p,%p)\n", a0, a1);
+
+ HACCEL rv = 0;
+ __try {
+ rv = Real_CreateAcceleratorTableW(a0, a1);
+ } __finally {
+ _PrintExit("CreateAcceleratorTableW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CreateAntiMoniker(IMoniker** a0)
+{
+ _PrintEnter("CreateAntiMoniker(%p)\n", a0);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CreateAntiMoniker(a0);
+ } __finally {
+ _PrintExit("CreateAntiMoniker() -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CreateBindCtx(DWORD a0,
+ IBindCtx** a1)
+{
+ _PrintEnter("CreateBindCtx(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CreateBindCtx(a0, a1);
+ } __finally {
+ _PrintExit("CreateBindCtx(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HBITMAP __stdcall Mine_CreateBitmap(int a0,
+ int a1,
+ UINT a2,
+ UINT a3,
+ void* a4)
+{
+ _PrintEnter("CreateBitmap(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ HBITMAP rv = 0;
+ __try {
+ rv = Real_CreateBitmap(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("CreateBitmap(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HBITMAP __stdcall Mine_CreateBitmapIndirect(BITMAP* a0)
+{
+ _PrintEnter("CreateBitmapIndirect(%p)\n", a0);
+
+ HBITMAP rv = 0;
+ __try {
+ rv = Real_CreateBitmapIndirect(a0);
+ } __finally {
+ _PrintExit("CreateBitmapIndirect() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HBRUSH __stdcall Mine_CreateBrushIndirect(LOGBRUSH* a0)
+{
+ _PrintEnter("CreateBrushIndirect(%p)\n", a0);
+
+ HBRUSH rv = 0;
+ __try {
+ rv = Real_CreateBrushIndirect(a0);
+ } __finally {
+ _PrintExit("CreateBrushIndirect() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CreateCaret(HWND a0,
+ HBITMAP a1,
+ int a2,
+ int a3)
+{
+ _PrintEnter("CreateCaret(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CreateCaret(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CreateCaret(,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CreateClassMoniker(CONST IID& a0,
+ IMoniker** a1)
+{
+ _PrintEnter("CreateClassMoniker(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CreateClassMoniker(a0, a1);
+ } __finally {
+ _PrintExit("CreateClassMoniker(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HCOLORSPACE __stdcall Mine_CreateColorSpaceA(LOGCOLORSPACEA* a0)
+{
+ _PrintEnter("CreateColorSpaceA(%p)\n", a0);
+
+ HCOLORSPACE rv = 0;
+ __try {
+ rv = Real_CreateColorSpaceA(a0);
+ } __finally {
+ _PrintExit("CreateColorSpaceA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HCOLORSPACE __stdcall Mine_CreateColorSpaceW(LOGCOLORSPACEW* a0)
+{
+ _PrintEnter("CreateColorSpaceW(%p)\n", a0);
+
+ HCOLORSPACE rv = 0;
+ __try {
+ rv = Real_CreateColorSpaceW(a0);
+ } __finally {
+ _PrintExit("CreateColorSpaceW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HBITMAP __stdcall Mine_CreateCompatibleBitmap(HDC a0,
+ int a1,
+ int a2)
+{
+ _PrintEnter("CreateCompatibleBitmap(%p,%p,%p)\n", a0, a1, a2);
+
+ HBITMAP rv = 0;
+ __try {
+ rv = Real_CreateCompatibleBitmap(a0, a1, a2);
+ } __finally {
+ _PrintExit("CreateCompatibleBitmap(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HDC __stdcall Mine_CreateCompatibleDC(HDC a0)
+{
+ _PrintEnter("CreateCompatibleDC(%p)\n", a0);
+
+ HDC rv = 0;
+ __try {
+ rv = Real_CreateCompatibleDC(a0);
+ } __finally {
+ _PrintExit("CreateCompatibleDC() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_CreateConsoleScreenBuffer(DWORD a0,
+ DWORD a1,
+ SECURITY_ATTRIBUTES* a2,
+ DWORD a3,
+ LPVOID a4)
+{
+ _PrintEnter("CreateConsoleScreenBuffer(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_CreateConsoleScreenBuffer(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("CreateConsoleScreenBuffer(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HCURSOR __stdcall Mine_CreateCursor(HINSTANCE a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ void* a5,
+ void* a6)
+{
+ _PrintEnter("CreateCursor(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ HCURSOR rv = 0;
+ __try {
+ rv = Real_CreateCursor(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("CreateCursor(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HDC __stdcall Mine_CreateDCA(LPCSTR a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ CONST DEVMODEA* a3)
+{
+ _PrintEnter("CreateDCA(%hs,%hs,%hs,%p)\n", a0, a1, a2, a3);
+
+ HDC rv = 0;
+ __try {
+ rv = Real_CreateDCA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CreateDCA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HDC __stdcall Mine_CreateDCW(LPCWSTR a0,
+ LPCWSTR a1,
+ LPCWSTR a2,
+ CONST DEVMODEW* a3)
+{
+ _PrintEnter("CreateDCW(%ls,%ls,%ls,%p)\n", a0, a1, a2, a3);
+
+ HDC rv = 0;
+ __try {
+ rv = Real_CreateDCW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CreateDCW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HBRUSH __stdcall Mine_CreateDIBPatternBrush(HGLOBAL a0,
+ UINT a1)
+{
+ _PrintEnter("CreateDIBPatternBrush(%p,%p)\n", a0, a1);
+
+ HBRUSH rv = 0;
+ __try {
+ rv = Real_CreateDIBPatternBrush(a0, a1);
+ } __finally {
+ _PrintExit("CreateDIBPatternBrush(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HBRUSH __stdcall Mine_CreateDIBPatternBrushPt(void* a0,
+ UINT a1)
+{
+ _PrintEnter("CreateDIBPatternBrushPt(%p,%p)\n", a0, a1);
+
+ HBRUSH rv = 0;
+ __try {
+ rv = Real_CreateDIBPatternBrushPt(a0, a1);
+ } __finally {
+ _PrintExit("CreateDIBPatternBrushPt(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HBITMAP __stdcall Mine_CreateDIBSection(HDC a0,
+ BITMAPINFO* a1,
+ UINT a2,
+ void** a3,
+ HANDLE a4,
+ DWORD a5)
+{
+ _PrintEnter("CreateDIBSection(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ HBITMAP rv = 0;
+ __try {
+ rv = Real_CreateDIBSection(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("CreateDIBSection(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HBITMAP __stdcall Mine_CreateDIBitmap(HDC a0,
+ BITMAPINFOHEADER* a1,
+ DWORD a2,
+ void* a3,
+ BITMAPINFO* a4,
+ UINT a5)
+{
+ _PrintEnter("CreateDIBitmap(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ HBITMAP rv = 0;
+ __try {
+ rv = Real_CreateDIBitmap(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("CreateDIBitmap(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CreateDataAdviseHolder(LPDATAADVISEHOLDER* a0)
+{
+ _PrintEnter("CreateDataAdviseHolder(%p)\n", a0);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CreateDataAdviseHolder(a0);
+ } __finally {
+ _PrintExit("CreateDataAdviseHolder() -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CreateDataCache(LPUNKNOWN a0,
+ CONST IID& a1,
+ CONST IID& a2,
+ LPVOID* a3)
+{
+ _PrintEnter("CreateDataCache(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CreateDataCache(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CreateDataCache(,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+#if _MSC_VER < 1300
+HDESK __stdcall Mine_CreateDesktopA(LPSTR a0,
+ LPSTR a1,
+ LPDEVMODEA a2,
+ DWORD a3,
+ ACCESS_MASK a4,
+ LPSECURITY_ATTRIBUTES a5)
+#else
+HDESK __stdcall Mine_CreateDesktopA(LPCSTR a0,
+ LPCSTR a1,
+ LPDEVMODEA a2,
+ DWORD a3,
+ ACCESS_MASK a4,
+ LPSECURITY_ATTRIBUTES a5)
+#endif
+{
+ _PrintEnter("CreateDesktopA(%hs,%hs,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ HDESK rv = 0;
+ __try {
+ rv = Real_CreateDesktopA(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("CreateDesktopA(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+#if _MSC_VER < 1300
+HDESK __stdcall Mine_CreateDesktopW(LPWSTR a0, // NT 3.51 and older. NT4?
+ LPWSTR a1, // NT 3.51 and older. NT4?
+ LPDEVMODEW a2,
+ DWORD a3,
+ ACCESS_MASK a4,
+ LPSECURITY_ATTRIBUTES a5)
+#else
+HDESK __stdcall Mine_CreateDesktopW(LPCWSTR a0, // Windows 2000 and newer; NT4?
+ LPCWSTR a1, // Windows 2000 and newer; NT4?
+ LPDEVMODEW a2,
+ DWORD a3,
+ ACCESS_MASK a4,
+ LPSECURITY_ATTRIBUTES a5)
+#endif
+{
+ _PrintEnter("CreateDesktopW(%ls,%ls,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ HDESK rv = 0;
+ __try {
+ rv = Real_CreateDesktopW(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("CreateDesktopW(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_CreateDialogIndirectParamA(HINSTANCE a0,
+ LPCDLGTEMPLATEA a1,
+ HWND a2,
+ DLGPROC a3,
+ LPARAM a4)
+{
+ _PrintEnter("CreateDialogIndirectParamA(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ HWND rv = 0;
+ __try {
+ rv = Real_CreateDialogIndirectParamA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("CreateDialogIndirectParamA(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_CreateDialogIndirectParamW(HINSTANCE a0,
+ LPCDLGTEMPLATEW a1,
+ HWND a2,
+ DLGPROC a3,
+ LPARAM a4)
+{
+ _PrintEnter("CreateDialogIndirectParamW(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ HWND rv = 0;
+ __try {
+ rv = Real_CreateDialogIndirectParamW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("CreateDialogIndirectParamW(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_CreateDialogParamA(HINSTANCE a0,
+ LPCSTR a1,
+ HWND a2,
+ DLGPROC a3,
+ LPARAM a4)
+{
+ _PrintEnter("CreateDialogParamA(%p,%hs,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ HWND rv = 0;
+ __try {
+ rv = Real_CreateDialogParamA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("CreateDialogParamA(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_CreateDialogParamW(HINSTANCE a0,
+ LPCWSTR a1,
+ HWND a2,
+ DLGPROC a3,
+ LPARAM a4)
+{
+ _PrintEnter("CreateDialogParamW(%p,%ls,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ HWND rv = 0;
+ __try {
+ rv = Real_CreateDialogParamW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("CreateDialogParamW(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CreateDirectoryA(LPCSTR a0,
+ LPSECURITY_ATTRIBUTES a1)
+{
+ _PrintEnter("CreateDirectoryA(%hs,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CreateDirectoryA(a0, a1);
+ } __finally {
+ _PrintExit("CreateDirectoryA(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CreateDirectoryExA(LPCSTR a0,
+ LPCSTR a1,
+ LPSECURITY_ATTRIBUTES a2)
+{
+ _PrintEnter("CreateDirectoryExA(%hs,%hs,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CreateDirectoryExA(a0, a1, a2);
+ } __finally {
+ _PrintExit("CreateDirectoryExA(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CreateDirectoryExW(LPCWSTR a0,
+ LPCWSTR a1,
+ LPSECURITY_ATTRIBUTES a2)
+{
+ _PrintEnter("CreateDirectoryExW(%ls,%ls,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CreateDirectoryExW(a0, a1, a2);
+ } __finally {
+ _PrintExit("CreateDirectoryExW(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CreateDirectoryW(LPCWSTR a0,
+ LPSECURITY_ATTRIBUTES a1)
+{
+ _PrintEnter("CreateDirectoryW(%ls,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CreateDirectoryW(a0, a1);
+ } __finally {
+ _PrintExit("CreateDirectoryW(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HBITMAP __stdcall Mine_CreateDiscardableBitmap(HDC a0,
+ int a1,
+ int a2)
+{
+ _PrintEnter("CreateDiscardableBitmap(%p,%p,%p)\n", a0, a1, a2);
+
+ HBITMAP rv = 0;
+ __try {
+ rv = Real_CreateDiscardableBitmap(a0, a1, a2);
+ } __finally {
+ _PrintExit("CreateDiscardableBitmap(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRGN __stdcall Mine_CreateEllipticRgn(int a0,
+ int a1,
+ int a2,
+ int a3)
+{
+ _PrintEnter("CreateEllipticRgn(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HRGN rv = 0;
+ __try {
+ rv = Real_CreateEllipticRgn(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CreateEllipticRgn(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRGN __stdcall Mine_CreateEllipticRgnIndirect(RECT* a0)
+{
+ _PrintEnter("CreateEllipticRgnIndirect(%p)\n", a0);
+
+ HRGN rv = 0;
+ __try {
+ rv = Real_CreateEllipticRgnIndirect(a0);
+ } __finally {
+ _PrintExit("CreateEllipticRgnIndirect() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HDC __stdcall Mine_CreateEnhMetaFileA(HDC a0,
+ LPCSTR a1,
+ RECT* a2,
+ LPCSTR a3)
+{
+ _PrintEnter("CreateEnhMetaFileA(%p,%hs,%p,%hs)\n", a0, a1, a2, a3);
+
+ HDC rv = 0;
+ __try {
+ rv = Real_CreateEnhMetaFileA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CreateEnhMetaFileA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HDC __stdcall Mine_CreateEnhMetaFileW(HDC a0,
+ LPCWSTR a1,
+ RECT* a2,
+ LPCWSTR a3)
+{
+ _PrintEnter("CreateEnhMetaFileW(%p,%ls,%p,%ls)\n", a0, a1, a2, a3);
+
+ HDC rv = 0;
+ __try {
+ rv = Real_CreateEnhMetaFileW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CreateEnhMetaFileW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_CreateEventA(LPSECURITY_ATTRIBUTES a0,
+ BOOL a1,
+ BOOL a2,
+ LPCSTR a3)
+{
+ _PrintEnter("CreateEventA(%p,%p,%p,%hs)\n", a0, a1, a2, a3);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_CreateEventA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CreateEventA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_CreateEventW(LPSECURITY_ATTRIBUTES a0,
+ BOOL a1,
+ BOOL a2,
+ LPCWSTR a3)
+{
+ _PrintEnter("CreateEventW(%p,%p,%p,%ls)\n", a0, a1, a2, a3);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_CreateEventW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CreateEventW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LPVOID __stdcall Mine_CreateFiber(ULONG_PTR a0,
+ LPFIBER_START_ROUTINE a1,
+ LPVOID a2)
+{
+ _PrintEnter("CreateFiber(%p,%p,%p)\n", a0, a1, a2);
+
+ LPVOID rv = 0;
+ __try {
+ rv = Real_CreateFiber(a0, a1, a2);
+ } __finally {
+ _PrintExit("CreateFiber(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_CreateFileA(LPCSTR a0,
+ DWORD a1,
+ DWORD a2,
+ LPSECURITY_ATTRIBUTES a3,
+ DWORD a4,
+ DWORD a5,
+ HANDLE a6)
+{
+ _PrintEnter("CreateFileA(%hs,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_CreateFileA(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("CreateFileA(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_CreateFileMappingA(HANDLE a0,
+ LPSECURITY_ATTRIBUTES a1,
+ DWORD a2,
+ DWORD a3,
+ DWORD a4,
+ LPCSTR a5)
+{
+ _PrintEnter("CreateFileMappingA(%p,%p,%p,%p,%p,%hs)\n", a0, a1, a2, a3, a4, a5);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_CreateFileMappingA(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("CreateFileMappingA(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_CreateFileMappingW(HANDLE a0,
+ LPSECURITY_ATTRIBUTES a1,
+ DWORD a2,
+ DWORD a3,
+ DWORD a4,
+ LPCWSTR a5)
+{
+ _PrintEnter("CreateFileMappingW(%p,%p,%p,%p,%p,%ls)\n", a0, a1, a2, a3, a4, a5);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_CreateFileMappingW(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("CreateFileMappingW(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CreateFileMoniker(LPCOLESTR a0,
+ IMoniker** a1)
+{
+ _PrintEnter("CreateFileMoniker(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CreateFileMoniker(a0, a1);
+ } __finally {
+ _PrintExit("CreateFileMoniker(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_CreateFileW(LPCWSTR a0,
+ DWORD a1,
+ DWORD a2,
+ LPSECURITY_ATTRIBUTES a3,
+ DWORD a4,
+ DWORD a5,
+ HANDLE a6)
+{
+ _PrintEnter("CreateFileW(%ls,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_CreateFileW(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("CreateFileW(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HFONT __stdcall Mine_CreateFontA(int a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ DWORD a5,
+ DWORD a6,
+ DWORD a7,
+ DWORD a8,
+ DWORD a9,
+ DWORD a10,
+ DWORD a11,
+ DWORD a12,
+ LPCSTR a13)
+{
+ _PrintEnter("CreateFontA(%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%hs)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13);
+
+ HFONT rv = 0;
+ __try {
+ rv = Real_CreateFontA(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13);
+ } __finally {
+ _PrintExit("CreateFontA(,,,,,,,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HFONT __stdcall Mine_CreateFontIndirectA(LOGFONTA* a0)
+{
+ _PrintEnter("CreateFontIndirectA(%p)\n", a0);
+
+ HFONT rv = 0;
+ __try {
+ rv = Real_CreateFontIndirectA(a0);
+ } __finally {
+ _PrintExit("CreateFontIndirectA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HFONT __stdcall Mine_CreateFontIndirectW(LOGFONTW* a0)
+{
+ _PrintEnter("CreateFontIndirectW(%p)\n", a0);
+
+ HFONT rv = 0;
+ __try {
+ rv = Real_CreateFontIndirectW(a0);
+ } __finally {
+ _PrintExit("CreateFontIndirectW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HFONT __stdcall Mine_CreateFontW(int a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ DWORD a5,
+ DWORD a6,
+ DWORD a7,
+ DWORD a8,
+ DWORD a9,
+ DWORD a10,
+ DWORD a11,
+ DWORD a12,
+ LPCWSTR a13)
+{
+ _PrintEnter("CreateFontW(%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%ls)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13);
+
+ HFONT rv = 0;
+ __try {
+ rv = Real_CreateFontW(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13);
+ } __finally {
+ _PrintExit("CreateFontW(,,,,,,,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CreateGenericComposite(IMoniker* a0,
+ IMoniker* a1,
+ IMoniker** a2)
+{
+ _PrintEnter("CreateGenericComposite(%p,%p,%p)\n", a0, a1, a2);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CreateGenericComposite(a0, a1, a2);
+ } __finally {
+ _PrintExit("CreateGenericComposite(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HPALETTE __stdcall Mine_CreateHalftonePalette(HDC a0)
+{
+ _PrintEnter("CreateHalftonePalette(%p)\n", a0);
+
+ HPALETTE rv = 0;
+ __try {
+ rv = Real_CreateHalftonePalette(a0);
+ } __finally {
+ _PrintExit("CreateHalftonePalette() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HBRUSH __stdcall Mine_CreateHatchBrush(int a0,
+ COLORREF a1)
+{
+ _PrintEnter("CreateHatchBrush(%p,%p)\n", a0, a1);
+
+ HBRUSH rv = 0;
+ __try {
+ rv = Real_CreateHatchBrush(a0, a1);
+ } __finally {
+ _PrintExit("CreateHatchBrush(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HDC __stdcall Mine_CreateICA(LPCSTR a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ CONST DEVMODEA* a3)
+{
+ _PrintEnter("CreateICA(%hs,%hs,%hs,%p)\n", a0, a1, a2, a3);
+
+ HDC rv = 0;
+ __try {
+ rv = Real_CreateICA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CreateICA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HDC __stdcall Mine_CreateICW(LPCWSTR a0,
+ LPCWSTR a1,
+ LPCWSTR a2,
+ CONST DEVMODEW* a3)
+{
+ _PrintEnter("CreateICW(%ls,%ls,%ls,%p)\n", a0, a1, a2, a3);
+
+ HDC rv = 0;
+ __try {
+ rv = Real_CreateICW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CreateICW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CreateILockBytesOnHGlobal(HGLOBAL a0,
+ BOOL a1,
+ ILockBytes** a2)
+{
+ _PrintEnter("CreateILockBytesOnHGlobal(%p,%p,%p)\n", a0, a1, a2);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CreateILockBytesOnHGlobal(a0, a1, a2);
+ } __finally {
+ _PrintExit("CreateILockBytesOnHGlobal(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HICON __stdcall Mine_CreateIcon(HINSTANCE a0,
+ int a1,
+ int a2,
+ BYTE a3,
+ BYTE a4,
+ BYTE* a5,
+ BYTE* a6)
+{
+ _PrintEnter("CreateIcon(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ HICON rv = 0;
+ __try {
+ rv = Real_CreateIcon(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("CreateIcon(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HICON __stdcall Mine_CreateIconFromResource(PBYTE a0,
+ DWORD a1,
+ BOOL a2,
+ DWORD a3)
+{
+ _PrintEnter("CreateIconFromResource(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HICON rv = 0;
+ __try {
+ rv = Real_CreateIconFromResource(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CreateIconFromResource(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HICON __stdcall Mine_CreateIconFromResourceEx(PBYTE a0,
+ DWORD a1,
+ BOOL a2,
+ DWORD a3,
+ int a4,
+ int a5,
+ UINT a6)
+{
+ _PrintEnter("CreateIconFromResourceEx(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ HICON rv = 0;
+ __try {
+ rv = Real_CreateIconFromResourceEx(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("CreateIconFromResourceEx(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HICON __stdcall Mine_CreateIconIndirect(PICONINFO a0)
+{
+ _PrintEnter("CreateIconIndirect(%p)\n", a0);
+
+ HICON rv = 0;
+ __try {
+ rv = Real_CreateIconIndirect(a0);
+ } __finally {
+ _PrintExit("CreateIconIndirect() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_CreateIoCompletionPort(HANDLE a0,
+ HANDLE a1,
+ ULONG_PTR a2,
+ DWORD a3)
+{
+ _PrintEnter("CreateIoCompletionPort(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_CreateIoCompletionPort(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CreateIoCompletionPort(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CreateItemMoniker(LPCOLESTR a0,
+ LPCOLESTR a1,
+ IMoniker** a2)
+{
+ _PrintEnter("CreateItemMoniker(%p,%p,%p)\n", a0, a1, a2);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CreateItemMoniker(a0, a1, a2);
+ } __finally {
+ _PrintExit("CreateItemMoniker(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+#if _MSC_VER < 1300
+HWND __stdcall Mine_CreateMDIWindowA(LPSTR a0, // NT 3.51 and older. NT4?
+ LPSTR a1, // NT 3.51 and older. NT4?
+ DWORD a2,
+ int a3,
+ int a4,
+ int a5,
+ int a6,
+ HWND a7,
+ HINSTANCE a8,
+ LPARAM a9)
+#else
+HWND __stdcall Mine_CreateMDIWindowA(LPCSTR a0, // Windows 2000 and newer; NT4?
+ LPCSTR a1, // Windows 2000 and newer; NT4?
+ DWORD a2,
+ int a3,
+ int a4,
+ int a5,
+ int a6,
+ HWND a7,
+ HINSTANCE a8,
+ LPARAM a9)
+#endif
+{
+ _PrintEnter("CreateMDIWindowA(%hs,%hs,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
+
+ HWND rv = 0;
+ __try {
+ rv = Real_CreateMDIWindowA(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
+ } __finally {
+ _PrintExit("CreateMDIWindowA(,,,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+#if _MSC_VER < 1300
+HWND __stdcall Mine_CreateMDIWindowW(LPWSTR a0,
+ LPWSTR a1,
+ DWORD a2,
+ int a3,
+ int a4,
+ int a5,
+ int a6,
+ HWND a7,
+ HINSTANCE a8,
+ LPARAM a9)
+#else
+HWND __stdcall Mine_CreateMDIWindowW(LPCWSTR a0,
+ LPCWSTR a1,
+ DWORD a2,
+ int a3,
+ int a4,
+ int a5,
+ int a6,
+ HWND a7,
+ HINSTANCE a8,
+ LPARAM a9)
+#endif
+{
+ _PrintEnter("CreateMDIWindowW(%ls,%ls,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
+
+ HWND rv = 0;
+ __try {
+ rv = Real_CreateMDIWindowW(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
+ } __finally {
+ _PrintExit("CreateMDIWindowW(,,,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_CreateMailslotA(LPCSTR a0,
+ DWORD a1,
+ DWORD a2,
+ LPSECURITY_ATTRIBUTES a3)
+{
+ _PrintEnter("CreateMailslotA(%hs,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_CreateMailslotA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CreateMailslotA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_CreateMailslotW(LPCWSTR a0,
+ DWORD a1,
+ DWORD a2,
+ LPSECURITY_ATTRIBUTES a3)
+{
+ _PrintEnter("CreateMailslotW(%ls,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_CreateMailslotW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CreateMailslotW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HMENU __stdcall Mine_CreateMenu(void)
+{
+ _PrintEnter("CreateMenu()\n");
+
+ HMENU rv = 0;
+ __try {
+ rv = Real_CreateMenu();
+ } __finally {
+ _PrintExit("CreateMenu() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HDC __stdcall Mine_CreateMetaFileA(LPCSTR a0)
+{
+ _PrintEnter("CreateMetaFileA(%hs)\n", a0);
+
+ HDC rv = 0;
+ __try {
+ rv = Real_CreateMetaFileA(a0);
+ } __finally {
+ _PrintExit("CreateMetaFileA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HDC __stdcall Mine_CreateMetaFileW(LPCWSTR a0)
+{
+ _PrintEnter("CreateMetaFileW(%ls)\n", a0);
+
+ HDC rv = 0;
+ __try {
+ rv = Real_CreateMetaFileW(a0);
+ } __finally {
+ _PrintExit("CreateMetaFileW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_CreateMutexA(LPSECURITY_ATTRIBUTES a0,
+ BOOL a1,
+ LPCSTR a2)
+{
+ _PrintEnter("CreateMutexA(%p,%p,%hs)\n", a0, a1, a2);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_CreateMutexA(a0, a1, a2);
+ } __finally {
+ _PrintExit("CreateMutexA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_CreateMutexW(LPSECURITY_ATTRIBUTES a0,
+ BOOL a1,
+ LPCWSTR a2)
+{
+ _PrintEnter("CreateMutexW(%p,%p,%ls)\n", a0, a1, a2);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_CreateMutexW(a0, a1, a2);
+ } __finally {
+ _PrintExit("CreateMutexW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_CreateNamedPipeA(LPCSTR a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3,
+ DWORD a4,
+ DWORD a5,
+ DWORD a6,
+ LPSECURITY_ATTRIBUTES a7)
+{
+ _PrintEnter("CreateNamedPipeA(%hs,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_CreateNamedPipeA(a0, a1, a2, a3, a4, a5, a6, a7);
+ } __finally {
+ _PrintExit("CreateNamedPipeA(,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_CreateNamedPipeW(LPCWSTR a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3,
+ DWORD a4,
+ DWORD a5,
+ DWORD a6,
+ LPSECURITY_ATTRIBUTES a7)
+{
+ _PrintEnter("CreateNamedPipeW(%ls,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_CreateNamedPipeW(a0, a1, a2, a3, a4, a5, a6, a7);
+ } __finally {
+ _PrintExit("CreateNamedPipeW(,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CreateOleAdviseHolder(LPOLEADVISEHOLDER* a0)
+{
+ _PrintEnter("CreateOleAdviseHolder(%p)\n", a0);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CreateOleAdviseHolder(a0);
+ } __finally {
+ _PrintExit("CreateOleAdviseHolder() -> %x\n", rv);
+ };
+ return rv;
+}
+
+HPALETTE __stdcall Mine_CreatePalette(LOGPALETTE* a0)
+{
+ _PrintEnter("CreatePalette(%p)\n", a0);
+
+ HPALETTE rv = 0;
+ __try {
+ rv = Real_CreatePalette(a0);
+ } __finally {
+ _PrintExit("CreatePalette() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HBRUSH __stdcall Mine_CreatePatternBrush(HBITMAP a0)
+{
+ _PrintEnter("CreatePatternBrush(%p)\n", a0);
+
+ HBRUSH rv = 0;
+ __try {
+ rv = Real_CreatePatternBrush(a0);
+ } __finally {
+ _PrintExit("CreatePatternBrush() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HPEN __stdcall Mine_CreatePen(int a0,
+ int a1,
+ COLORREF a2)
+{
+ _PrintEnter("CreatePen(%p,%p,%p)\n", a0, a1, a2);
+
+ HPEN rv = 0;
+ __try {
+ rv = Real_CreatePen(a0, a1, a2);
+ } __finally {
+ _PrintExit("CreatePen(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HPEN __stdcall Mine_CreatePenIndirect(LOGPEN* a0)
+{
+ _PrintEnter("CreatePenIndirect(%p)\n", a0);
+
+ HPEN rv = 0;
+ __try {
+ rv = Real_CreatePenIndirect(a0);
+ } __finally {
+ _PrintExit("CreatePenIndirect() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CreatePipe(PHANDLE a0,
+ PHANDLE a1,
+ LPSECURITY_ATTRIBUTES a2,
+ DWORD a3)
+{
+ _PrintEnter("CreatePipe(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CreatePipe(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CreatePipe(,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CreatePointerMoniker(LPUNKNOWN a0,
+ IMoniker** a1)
+{
+ _PrintEnter("CreatePointerMoniker(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CreatePointerMoniker(a0, a1);
+ } __finally {
+ _PrintExit("CreatePointerMoniker(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HRGN __stdcall Mine_CreatePolyPolygonRgn(POINT* a0,
+ INT* a1,
+ int a2,
+ int a3)
+{
+ _PrintEnter("CreatePolyPolygonRgn(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HRGN rv = 0;
+ __try {
+ rv = Real_CreatePolyPolygonRgn(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CreatePolyPolygonRgn(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRGN __stdcall Mine_CreatePolygonRgn(POINT* a0,
+ int a1,
+ int a2)
+{
+ _PrintEnter("CreatePolygonRgn(%p,%p,%p)\n", a0, a1, a2);
+
+ HRGN rv = 0;
+ __try {
+ rv = Real_CreatePolygonRgn(a0, a1, a2);
+ } __finally {
+ _PrintExit("CreatePolygonRgn(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HMENU __stdcall Mine_CreatePopupMenu(void)
+{
+ _PrintEnter("CreatePopupMenu()\n");
+
+ HMENU rv = 0;
+ __try {
+ rv = Real_CreatePopupMenu();
+ } __finally {
+ _PrintExit("CreatePopupMenu() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CreateProcessA(LPCSTR lpApplicationName,
+ LPSTR lpCommandLine,
+ LPSECURITY_ATTRIBUTES lpProcessAttributes,
+ LPSECURITY_ATTRIBUTES lpThreadAttributes,
+ BOOL bInheritHandles,
+ DWORD dwCreationFlags,
+ LPVOID lpEnvironment,
+ LPCSTR lpCurrentDirectory,
+ LPSTARTUPINFOA lpStartupInfo,
+ LPPROCESS_INFORMATION lpProcessInformation)
+{
+ _PrintEnter("CreateProcessA(%hs,%hs,%p,%p,%p,%p,%p,%hs,%p,%p)\n",
+ lpApplicationName,
+ lpCommandLine,
+ lpProcessAttributes,
+ lpThreadAttributes,
+ bInheritHandles,
+ dwCreationFlags,
+ lpEnvironment,
+ lpCurrentDirectory,
+ lpStartupInfo,
+ lpProcessInformation);
+
+ PROCESS_INFORMATION procInfo;
+ if (lpProcessInformation == NULL) {
+ lpProcessInformation= &procInfo;
+ ZeroMemory(&procInfo, sizeof(procInfo));
+ }
+
+ BOOL rv = 0;
+ __try {
+ rv = DetourCreateProcessWithDllExA(lpApplicationName,
+ lpCommandLine,
+ lpProcessAttributes,
+ lpThreadAttributes,
+ bInheritHandles,
+ dwCreationFlags,
+ lpEnvironment,
+ lpCurrentDirectory,
+ lpStartupInfo,
+ lpProcessInformation,
+ s_szDllPath,
+ Real_CreateProcessA);
+ } __finally {
+ _PrintExit("CreateProcessA(,,,,,,,,,) -> %x (proc:%d/%p, thrd:%d/%p\n", rv,
+ lpProcessInformation->dwProcessId,
+ lpProcessInformation->hProcess,
+ lpProcessInformation->dwThreadId,
+ lpProcessInformation->hThread);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CreateProcessW(LPCWSTR lpApplicationName,
+ LPWSTR lpCommandLine,
+ LPSECURITY_ATTRIBUTES lpProcessAttributes,
+ LPSECURITY_ATTRIBUTES lpThreadAttributes,
+ BOOL bInheritHandles,
+ DWORD dwCreationFlags,
+ LPVOID lpEnvironment,
+ LPCWSTR lpCurrentDirectory,
+ LPSTARTUPINFOW lpStartupInfo,
+ LPPROCESS_INFORMATION lpProcessInformation)
+{
+ _PrintEnter("CreateProcessW(%ls,%ls,%p,%p,%p,%p,%p,%ls,%p,%p)\n",
+ lpApplicationName,
+ lpCommandLine,
+ lpProcessAttributes,
+ lpThreadAttributes,
+ bInheritHandles,
+ dwCreationFlags,
+ lpEnvironment,
+ lpCurrentDirectory,
+ lpStartupInfo,
+ lpProcessInformation);
+
+ PROCESS_INFORMATION procInfo;
+ if (lpProcessInformation == NULL) {
+ lpProcessInformation= &procInfo;
+ ZeroMemory(&procInfo, sizeof(procInfo));
+ }
+
+ BOOL rv = 0;
+ __try {
+ rv = DetourCreateProcessWithDllExW(lpApplicationName,
+ lpCommandLine,
+ lpProcessAttributes,
+ lpThreadAttributes,
+ bInheritHandles,
+ dwCreationFlags,
+ lpEnvironment,
+ lpCurrentDirectory,
+ lpStartupInfo,
+ lpProcessInformation,
+ s_szDllPath,
+ Real_CreateProcessW);
+ } __finally {
+ _PrintExit("CreateProcessW(,,,,,,,,,) -> %x (proc:%d/%p, thrd:%d/%p\n", rv,
+ lpProcessInformation->dwProcessId,
+ lpProcessInformation->hProcess,
+ lpProcessInformation->dwThreadId,
+ lpProcessInformation->hThread);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CreateProcessAsUserA(
+ __in_opt HANDLE hToken,
+ __in_opt LPCSTR lpApplicationName,
+ __inout_opt LPSTR lpCommandLine,
+ __in_opt LPSECURITY_ATTRIBUTES lpProcessAttributes,
+ __in_opt LPSECURITY_ATTRIBUTES lpThreadAttributes,
+ __in BOOL bInheritHandles,
+ __in DWORD dwCreationFlags,
+ __in_opt LPVOID lpEnvironment,
+ __in_opt LPCSTR lpCurrentDirectory,
+ __in LPSTARTUPINFOA lpStartupInfo,
+ __out LPPROCESS_INFORMATION lpProcessInformation
+ )
+{
+ _PrintEnter("CreateProcessAsUserA(%ls,%ls,%p,%p,%p,%p,%p,%ls,%p,%p)\n",
+ lpApplicationName,
+ lpCommandLine,
+ lpProcessAttributes,
+ lpThreadAttributes,
+ bInheritHandles,
+ dwCreationFlags,
+ lpEnvironment,
+ lpCurrentDirectory,
+ lpStartupInfo,
+ lpProcessInformation);
+
+ PROCESS_INFORMATION procInfo;
+ if (lpProcessInformation == NULL) {
+ lpProcessInformation= &procInfo;
+ ZeroMemory(&procInfo, sizeof(procInfo));
+ }
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CreateProcessAsUserA(hToken,
+ lpApplicationName,
+ lpCommandLine,
+ lpProcessAttributes,
+ lpThreadAttributes,
+ bInheritHandles,
+ dwCreationFlags,
+ lpEnvironment,
+ lpCurrentDirectory,
+ lpStartupInfo,
+ lpProcessInformation);
+ } __finally {
+ _PrintExit("CreateProcessAsUserAW(,,,,,,,,,) -> %x (proc:%d/%p, thrd:%d/%p\n", rv,
+ lpProcessInformation->dwProcessId,
+ lpProcessInformation->hProcess,
+ lpProcessInformation->dwThreadId,
+ lpProcessInformation->hThread);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CreateProcessAsUserW(
+ __in_opt HANDLE hToken,
+ __in_opt LPCWSTR lpApplicationName,
+ __inout_opt LPWSTR lpCommandLine,
+ __in_opt LPSECURITY_ATTRIBUTES lpProcessAttributes,
+ __in_opt LPSECURITY_ATTRIBUTES lpThreadAttributes,
+ __in BOOL bInheritHandles,
+ __in DWORD dwCreationFlags,
+ __in_opt LPVOID lpEnvironment,
+ __in_opt LPCWSTR lpCurrentDirectory,
+ __in LPSTARTUPINFOW lpStartupInfo,
+ __out LPPROCESS_INFORMATION lpProcessInformation
+ )
+{
+ _PrintEnter("CreateProcessAsUserW(%ls,%ls,%p,%p,%p,%p,%p,%ls,%p,%p)\n",
+ lpApplicationName,
+ lpCommandLine,
+ lpProcessAttributes,
+ lpThreadAttributes,
+ bInheritHandles,
+ dwCreationFlags,
+ lpEnvironment,
+ lpCurrentDirectory,
+ lpStartupInfo,
+ lpProcessInformation);
+
+ PROCESS_INFORMATION procInfo;
+ if (lpProcessInformation == NULL) {
+ lpProcessInformation= &procInfo;
+ ZeroMemory(&procInfo, sizeof(procInfo));
+ }
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CreateProcessAsUserW(hToken,
+ lpApplicationName,
+ lpCommandLine,
+ lpProcessAttributes,
+ lpThreadAttributes,
+ bInheritHandles,
+ dwCreationFlags,
+ lpEnvironment,
+ lpCurrentDirectory,
+ lpStartupInfo,
+ lpProcessInformation);
+ } __finally {
+ _PrintExit("CreateProcessAsUserW(,,,,,,,,,) -> %x (proc:%d/%p, thrd:%d/%p\n", rv,
+ lpProcessInformation->dwProcessId,
+ lpProcessInformation->hProcess,
+ lpProcessInformation->dwThreadId,
+ lpProcessInformation->hThread);
+ };
+ return rv;
+}
+
+#if(_WIN32_WINNT >= 0x0500)
+BOOL WINAPI Mine_CreateProcessWithLogonW(
+ __in LPCWSTR lpUsername,
+ __in_opt LPCWSTR lpDomain,
+ __in LPCWSTR lpPassword,
+ __in DWORD dwLogonFlags,
+ __in_opt LPCWSTR lpApplicationName,
+ __inout_opt LPWSTR lpCommandLine,
+ __in DWORD dwCreationFlags,
+ __in_opt LPVOID lpEnvironment,
+ __in_opt LPCWSTR lpCurrentDirectory,
+ __in LPSTARTUPINFOW lpStartupInfo,
+ __out LPPROCESS_INFORMATION lpProcessInfo
+ )
+{
+ _PrintEnter("CreateProcessWithLogonW(%ls,%ls,%ls,%d,%ls,%ls,%p,%p,%ls,%p,%p)\n",
+ lpUsername,
+ lpDomain,
+ lpPassword,
+ dwLogonFlags,
+ lpApplicationName,
+ lpCommandLine,
+ dwCreationFlags,
+ lpEnvironment,
+ lpCurrentDirectory,
+ lpStartupInfo,
+ lpProcessInfo);
+
+ PROCESS_INFORMATION procInfo;
+ if (lpProcessInfo == NULL) {
+ lpProcessInfo= &procInfo;
+ ZeroMemory(&procInfo, sizeof(procInfo));
+ }
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CreateProcessWithLogonW(
+ lpUsername,
+ lpDomain,
+ lpPassword,
+ dwLogonFlags,
+ lpApplicationName,
+ lpCommandLine,
+ dwCreationFlags,
+ lpEnvironment,
+ lpCurrentDirectory,
+ lpStartupInfo,
+ lpProcessInfo);
+ } __finally {
+ _PrintExit("CreateProcessWithLogonW(,,,,,,,,,) -> %x (proc:%d/%p, thrd:%d/%p\n", rv,
+ lpProcessInfo->dwProcessId,
+ lpProcessInfo->hProcess,
+ lpProcessInfo->dwThreadId,
+ lpProcessInfo->hThread);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_CreateProcessWithTokenW(
+ __in HANDLE hToken,
+ __in DWORD dwLogonFlags,
+ __in_opt LPCWSTR lpApplicationName,
+ __inout_opt LPWSTR lpCommandLine,
+ __in DWORD dwCreationFlags,
+ __in_opt LPVOID lpEnvironment,
+ __in_opt LPCWSTR lpCurrentDirectory,
+ __in LPSTARTUPINFOW lpStartupInfo,
+ __out LPPROCESS_INFORMATION lpProcessInfo
+)
+{
+ _PrintEnter("CreateProcessWithTokenW(%ls,%ls,%p,%p,%ls,%p,%p)\n",
+ lpApplicationName,
+ lpCommandLine,
+ dwCreationFlags,
+ lpEnvironment,
+ lpCurrentDirectory,
+ lpStartupInfo,
+ lpProcessInfo);
+
+ PROCESS_INFORMATION procInfo;
+ if (lpProcessInfo == NULL) {
+ lpProcessInfo= &procInfo;
+ ZeroMemory(&procInfo, sizeof(procInfo));
+ }
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CreateProcessWithTokenW(hToken,
+ dwLogonFlags,
+ lpApplicationName,
+ lpCommandLine,
+ dwCreationFlags,
+ lpEnvironment,
+ lpCurrentDirectory,
+ lpStartupInfo,
+ lpProcessInfo);
+ } __finally {
+ _PrintExit("CreateProcessWithTokenW(,,,,,,,,,) -> %x (proc:%d/%p, thrd:%d/%p\n", rv,
+ lpProcessInfo->dwProcessId,
+ lpProcessInfo->hProcess,
+ lpProcessInfo->dwThreadId,
+ lpProcessInfo->hThread);
+ };
+ return rv;
+}
+#endif // (_WIN32_WINNT >= 0x0500)
+
+HRGN __stdcall Mine_CreateRectRgn(int a0,
+ int a1,
+ int a2,
+ int a3)
+{
+ _PrintEnter("CreateRectRgn(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HRGN rv = 0;
+ __try {
+ rv = Real_CreateRectRgn(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CreateRectRgn(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRGN __stdcall Mine_CreateRectRgnIndirect(RECT* a0)
+{
+ _PrintEnter("CreateRectRgnIndirect(%p)\n", a0);
+
+ HRGN rv = 0;
+ __try {
+ rv = Real_CreateRectRgnIndirect(a0);
+ } __finally {
+ _PrintExit("CreateRectRgnIndirect() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_CreateRemoteThread(HANDLE a0,
+ LPSECURITY_ATTRIBUTES a1,
+ ULONG_PTR a2,
+ LPTHREAD_START_ROUTINE a3,
+ LPVOID a4,
+ DWORD a5,
+ LPDWORD a6)
+{
+ _PrintEnter("CreateRemoteThread(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_CreateRemoteThread(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("CreateRemoteThread(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRGN __stdcall Mine_CreateRoundRectRgn(int a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ int a5)
+{
+ _PrintEnter("CreateRoundRectRgn(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ HRGN rv = 0;
+ __try {
+ rv = Real_CreateRoundRectRgn(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("CreateRoundRectRgn(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CreateScalableFontResourceA(DWORD a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ LPCSTR a3)
+{
+ _PrintEnter("CreateScalableFontResourceA(%p,%hs,%hs,%hs)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CreateScalableFontResourceA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CreateScalableFontResourceA(,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_CreateScalableFontResourceW(DWORD a0,
+ LPCWSTR a1,
+ LPCWSTR a2,
+ LPCWSTR a3)
+{
+ _PrintEnter("CreateScalableFontResourceW(%p,%ls,%ls,%ls)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CreateScalableFontResourceW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CreateScalableFontResourceW(,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_CreateSemaphoreA(LPSECURITY_ATTRIBUTES a0,
+ LONG a1,
+ LONG a2,
+ LPCSTR a3)
+{
+ _PrintEnter("CreateSemaphoreA(%p,%p,%p,%hs)\n", a0, a1, a2, a3);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_CreateSemaphoreA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CreateSemaphoreA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_CreateSemaphoreW(LPSECURITY_ATTRIBUTES a0,
+ LONG a1,
+ LONG a2,
+ LPCWSTR a3)
+{
+ _PrintEnter("CreateSemaphoreW(%p,%p,%p,%ls)\n", a0, a1, a2, a3);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_CreateSemaphoreW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CreateSemaphoreW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HBRUSH __stdcall Mine_CreateSolidBrush(COLORREF a0)
+{
+ _PrintEnter("CreateSolidBrush(%p)\n", a0);
+
+ HBRUSH rv = 0;
+ __try {
+ rv = Real_CreateSolidBrush(a0);
+ } __finally {
+ _PrintExit("CreateSolidBrush() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CreateStdProgressIndicator(HWND a0,
+ LPCOLESTR a1,
+ IBindStatusCallback* a2,
+ IBindStatusCallback** a3)
+{
+ _PrintEnter("CreateStdProgressIndicator(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CreateStdProgressIndicator(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CreateStdProgressIndicator(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_CreateStreamOnHGlobal(HGLOBAL a0,
+ BOOL a1,
+ LPSTREAM* a2)
+{
+ _PrintEnter("CreateStreamOnHGlobal(%p,%p,%p)\n", a0, a1, a2);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_CreateStreamOnHGlobal(a0, a1, a2);
+ } __finally {
+ _PrintExit("CreateStreamOnHGlobal(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_CreateTapePartition(HANDLE a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3)
+{
+ _PrintEnter("CreateTapePartition(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_CreateTapePartition(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CreateTapePartition(,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_CreateThread(LPSECURITY_ATTRIBUTES a0,
+ ULONG_PTR a1,
+ LPTHREAD_START_ROUTINE a2,
+ LPVOID a3,
+ DWORD a4,
+ LPDWORD a5)
+{
+ _PrintEnter("CreateThread(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_CreateThread(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("CreateThread(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_CreateWaitableTimerA(LPSECURITY_ATTRIBUTES a0,
+ BOOL a1,
+ LPCSTR a2)
+{
+ _PrintEnter("CreateWaitableTimerA(%p,%p,%hs)\n", a0, a1, a2);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_CreateWaitableTimerA(a0, a1, a2);
+ } __finally {
+ _PrintExit("CreateWaitableTimerA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_CreateWaitableTimerW(LPSECURITY_ATTRIBUTES a0,
+ BOOL a1,
+ LPCWSTR a2)
+{
+ _PrintEnter("CreateWaitableTimerW(%p,%p,%ls)\n", a0, a1, a2);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_CreateWaitableTimerW(a0, a1, a2);
+ } __finally {
+ _PrintExit("CreateWaitableTimerW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_CreateWindowExA(DWORD a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ DWORD a3,
+ int a4,
+ int a5,
+ int a6,
+ int a7,
+ HWND a8,
+ HMENU a9,
+ HINSTANCE a10,
+ LPVOID a11)
+{
+ _PrintEnter("CreateWindowExA(%p,%hs,%hs,%p,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
+
+ HWND rv = 0;
+ __try {
+ rv = Real_CreateWindowExA(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
+ } __finally {
+ _PrintExit("CreateWindowExA(,,,,,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_CreateWindowExW(DWORD a0,
+ LPCWSTR a1,
+ LPCWSTR a2,
+ DWORD a3,
+ int a4,
+ int a5,
+ int a6,
+ int a7,
+ HWND a8,
+ HMENU a9,
+ HINSTANCE a10,
+ LPVOID a11)
+{
+ _PrintEnter("CreateWindowExW(%p,%ls,%ls,%p,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
+
+ HWND rv = 0;
+ __try {
+ rv = Real_CreateWindowExW(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
+ } __finally {
+ _PrintExit("CreateWindowExW(,,,,,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+#if _MSC_VER < 1300
+HWINSTA __stdcall Mine_CreateWindowStationA(LPSTR a0,
+ DWORD a1,
+ ACCESS_MASK a2,
+ LPSECURITY_ATTRIBUTES a3)
+#else
+HWINSTA __stdcall Mine_CreateWindowStationA(LPCSTR a0,
+ DWORD a1,
+ ACCESS_MASK a2,
+ LPSECURITY_ATTRIBUTES a3)
+#endif
+{
+ _PrintEnter("CreateWindowStationA(%hs,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HWINSTA rv = 0;
+ __try {
+ rv = Real_CreateWindowStationA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CreateWindowStationA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+#if _MSC_VER < 1300
+HWINSTA __stdcall Mine_CreateWindowStationW(LPWSTR a0,
+ DWORD a1,
+ ACCESS_MASK a2,
+ LPSECURITY_ATTRIBUTES a3)
+#else
+HWINSTA __stdcall Mine_CreateWindowStationW(LPCWSTR a0,
+ DWORD a1,
+ ACCESS_MASK a2,
+ LPSECURITY_ATTRIBUTES a3)
+#endif
+{
+ _PrintEnter("CreateWindowStationW(%ls,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HWINSTA rv = 0;
+ __try {
+ rv = Real_CreateWindowStationW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("CreateWindowStationW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DPtoLP(HDC a0,
+ POINT* a1,
+ int a2)
+{
+ _PrintEnter("DPtoLP(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DPtoLP(a0, a1, a2);
+ } __finally {
+ _PrintExit("DPtoLP(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DdeAbandonTransaction(DWORD a0,
+ HCONV a1,
+ DWORD a2)
+{
+ _PrintEnter("DdeAbandonTransaction(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DdeAbandonTransaction(a0, a1, a2);
+ } __finally {
+ _PrintExit("DdeAbandonTransaction(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LPBYTE __stdcall Mine_DdeAccessData(HDDEDATA a0,
+ LPDWORD a1)
+{
+ _PrintEnter("DdeAccessData(%p,%p)\n", a0, a1);
+
+ LPBYTE rv = 0;
+ __try {
+ rv = Real_DdeAccessData(a0, a1);
+ } __finally {
+ _PrintExit("DdeAccessData(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HDDEDATA __stdcall Mine_DdeAddData(HDDEDATA a0,
+ LPBYTE a1,
+ DWORD a2,
+ DWORD a3)
+{
+ _PrintEnter("DdeAddData(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HDDEDATA rv = 0;
+ __try {
+ rv = Real_DdeAddData(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("DdeAddData(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HDDEDATA __stdcall Mine_DdeClientTransaction(LPBYTE a0,
+ DWORD a1,
+ HCONV a2,
+ HSZ a3,
+ UINT a4,
+ UINT a5,
+ DWORD a6,
+ LPDWORD a7)
+{
+ _PrintEnter("DdeClientTransaction(%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7);
+
+ HDDEDATA rv = 0;
+ __try {
+ rv = Real_DdeClientTransaction(a0, a1, a2, a3, a4, a5, a6, a7);
+ } __finally {
+ _PrintExit("DdeClientTransaction(,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_DdeCmpStringHandles(HSZ a0,
+ HSZ a1)
+{
+ _PrintEnter("DdeCmpStringHandles(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_DdeCmpStringHandles(a0, a1);
+ } __finally {
+ _PrintExit("DdeCmpStringHandles(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HCONV __stdcall Mine_DdeConnect(DWORD a0,
+ HSZ a1,
+ HSZ a2,
+ PCONVCONTEXT a3)
+{
+ _PrintEnter("DdeConnect(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HCONV rv = 0;
+ __try {
+ rv = Real_DdeConnect(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("DdeConnect(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HCONVLIST __stdcall Mine_DdeConnectList(DWORD a0,
+ HSZ a1,
+ HSZ a2,
+ HCONVLIST a3,
+ PCONVCONTEXT a4)
+{
+ _PrintEnter("DdeConnectList(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ HCONVLIST rv = 0;
+ __try {
+ rv = Real_DdeConnectList(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("DdeConnectList(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HDDEDATA __stdcall Mine_DdeCreateDataHandle(DWORD a0,
+ LPBYTE a1,
+ DWORD a2,
+ DWORD a3,
+ HSZ a4,
+ UINT a5,
+ UINT a6)
+{
+ _PrintEnter("DdeCreateDataHandle(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ HDDEDATA rv = 0;
+ __try {
+ rv = Real_DdeCreateDataHandle(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("DdeCreateDataHandle(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HSZ __stdcall Mine_DdeCreateStringHandleA(DWORD a0,
+ LPCSTR a1,
+ int a2)
+{
+ _PrintEnter("DdeCreateStringHandleA(%p,%hs,%p)\n", a0, a1, a2);
+
+ HSZ rv = 0;
+ __try {
+ rv = Real_DdeCreateStringHandleA(a0, a1, a2);
+ } __finally {
+ _PrintExit("DdeCreateStringHandleA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HSZ __stdcall Mine_DdeCreateStringHandleW(DWORD a0,
+ LPCWSTR a1,
+ int a2)
+{
+ _PrintEnter("DdeCreateStringHandleW(%p,%ls,%p)\n", a0, a1, a2);
+
+ HSZ rv = 0;
+ __try {
+ rv = Real_DdeCreateStringHandleW(a0, a1, a2);
+ } __finally {
+ _PrintExit("DdeCreateStringHandleW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DdeDisconnect(HCONV a0)
+{
+ _PrintEnter("DdeDisconnect(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DdeDisconnect(a0);
+ } __finally {
+ _PrintExit("DdeDisconnect() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DdeDisconnectList(HCONVLIST a0)
+{
+ _PrintEnter("DdeDisconnectList(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DdeDisconnectList(a0);
+ } __finally {
+ _PrintExit("DdeDisconnectList() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DdeEnableCallback(DWORD a0,
+ HCONV a1,
+ UINT a2)
+{
+ _PrintEnter("DdeEnableCallback(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DdeEnableCallback(a0, a1, a2);
+ } __finally {
+ _PrintExit("DdeEnableCallback(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DdeFreeDataHandle(HDDEDATA a0)
+{
+ _PrintEnter("DdeFreeDataHandle(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DdeFreeDataHandle(a0);
+ } __finally {
+ _PrintExit("DdeFreeDataHandle() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DdeFreeStringHandle(DWORD a0,
+ HSZ a1)
+{
+ _PrintEnter("DdeFreeStringHandle(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DdeFreeStringHandle(a0, a1);
+ } __finally {
+ _PrintExit("DdeFreeStringHandle(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_DdeGetData(HDDEDATA a0,
+ LPBYTE a1,
+ DWORD a2,
+ DWORD a3)
+{
+ _PrintEnter("DdeGetData(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_DdeGetData(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("DdeGetData(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_DdeGetLastError(DWORD a0)
+{
+ _PrintEnter("DdeGetLastError(%p)\n", a0);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_DdeGetLastError(a0);
+ } __finally {
+ _PrintExit("DdeGetLastError() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DdeImpersonateClient(HCONV a0)
+{
+ _PrintEnter("DdeImpersonateClient(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DdeImpersonateClient(a0);
+ } __finally {
+ _PrintExit("DdeImpersonateClient() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DdeKeepStringHandle(DWORD a0,
+ HSZ a1)
+{
+ _PrintEnter("DdeKeepStringHandle(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DdeKeepStringHandle(a0, a1);
+ } __finally {
+ _PrintExit("DdeKeepStringHandle(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HDDEDATA __stdcall Mine_DdeNameService(DWORD a0,
+ HSZ a1,
+ HSZ a2,
+ UINT a3)
+{
+ _PrintEnter("DdeNameService(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HDDEDATA rv = 0;
+ __try {
+ rv = Real_DdeNameService(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("DdeNameService(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DdePostAdvise(DWORD a0,
+ HSZ a1,
+ HSZ a2)
+{
+ _PrintEnter("DdePostAdvise(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DdePostAdvise(a0, a1, a2);
+ } __finally {
+ _PrintExit("DdePostAdvise(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_DdeQueryConvInfo(HCONV a0,
+ DWORD a1,
+ CONVINFO* a2)
+{
+ _PrintEnter("DdeQueryConvInfo(%p,%p,%p)\n", a0, a1, a2);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_DdeQueryConvInfo(a0, a1, a2);
+ } __finally {
+ _PrintExit("DdeQueryConvInfo(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HCONV __stdcall Mine_DdeQueryNextServer(HCONVLIST a0,
+ HCONV a1)
+{
+ _PrintEnter("DdeQueryNextServer(%p,%p)\n", a0, a1);
+
+ HCONV rv = 0;
+ __try {
+ rv = Real_DdeQueryNextServer(a0, a1);
+ } __finally {
+ _PrintExit("DdeQueryNextServer(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_DdeQueryStringA(DWORD a0,
+ HSZ a1,
+ LPSTR a2,
+ DWORD a3,
+ int a4)
+{
+ _PrintEnter("DdeQueryStringA(%p,%p,%hs,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_DdeQueryStringA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("DdeQueryStringA(,,%hs,,) -> %p\n", a2, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_DdeQueryStringW(DWORD a0,
+ HSZ a1,
+ LPWSTR a2,
+ DWORD a3,
+ int a4)
+{
+ _PrintEnter("DdeQueryStringW(%p,%p,%ls,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_DdeQueryStringW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("DdeQueryStringW(,,%ls,,) -> %p\n", a2, rv);
+ };
+ return rv;
+}
+
+HCONV __stdcall Mine_DdeReconnect(HCONV a0)
+{
+ _PrintEnter("DdeReconnect(%p)\n", a0);
+
+ HCONV rv = 0;
+ __try {
+ rv = Real_DdeReconnect(a0);
+ } __finally {
+ _PrintExit("DdeReconnect() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DdeSetQualityOfService(HWND a0,
+ PSECURITY_QUALITY_OF_SERVICE a1,
+ PSECURITY_QUALITY_OF_SERVICE a2)
+{
+ _PrintEnter("DdeSetQualityOfService(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DdeSetQualityOfService(a0, a1, a2);
+ } __finally {
+ _PrintExit("DdeSetQualityOfService(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DdeSetUserHandle(HCONV a0,
+ DWORD a1,
+ ULONG_PTR a2)
+{
+ _PrintEnter("DdeSetUserHandle(%p,%x,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DdeSetUserHandle(a0, a1, a2);
+ } __finally {
+ _PrintExit("DdeSetUserHandle(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DdeUnaccessData(HDDEDATA a0)
+{
+ _PrintEnter("DdeUnaccessData(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DdeUnaccessData(a0);
+ } __finally {
+ _PrintExit("DdeUnaccessData() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DdeUninitialize(DWORD a0)
+{
+ _PrintEnter("DdeUninitialize(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DdeUninitialize(a0);
+ } __finally {
+ _PrintExit("DdeUninitialize() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DebugActiveProcess(DWORD a0)
+{
+ _PrintEnter("DebugActiveProcess(pid=%d)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DebugActiveProcess(a0);
+ } __finally {
+ _PrintExit("DebugActiveProcess() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DebugActiveProcessStop(DWORD a0)
+{
+ _PrintEnter("DebugActiveProcessStop(pid=%d)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DebugActiveProcess(a0);
+ } __finally {
+ _PrintExit("DebugActiveProcessStop() -> %p\n", rv);
+ };
+ return rv;
+}
+
+void __stdcall Mine_DebugBreak(void)
+{
+ _PrintEnter("DebugBreak()\n");
+
+ __try {
+ Real_DebugBreak();
+ } __finally {
+ _PrintExit("DebugBreak() ->\n");
+ };
+}
+
+LRESULT __stdcall Mine_DefDlgProcA(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3)
+{
+ _PrintEnter("DefDlgProcA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ LRESULT rv = 0;
+ __try {
+ rv = Real_DefDlgProcA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("DefDlgProcA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LRESULT __stdcall Mine_DefDlgProcW(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3)
+{
+ _PrintEnter("DefDlgProcW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ LRESULT rv = 0;
+ __try {
+ rv = Real_DefDlgProcW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("DefDlgProcW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LRESULT __stdcall Mine_DefFrameProcA(HWND a0,
+ HWND a1,
+ UINT a2,
+ WPARAM a3,
+ LPARAM a4)
+{
+ _PrintEnter("DefFrameProcA(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ LRESULT rv = 0;
+ __try {
+ rv = Real_DefFrameProcA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("DefFrameProcA(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LRESULT __stdcall Mine_DefFrameProcW(HWND a0,
+ HWND a1,
+ UINT a2,
+ WPARAM a3,
+ LPARAM a4)
+{
+ _PrintEnter("DefFrameProcW(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ LRESULT rv = 0;
+ __try {
+ rv = Real_DefFrameProcW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("DefFrameProcW(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LRESULT __stdcall Mine_DefMDIChildProcA(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3)
+{
+ _PrintEnter("DefMDIChildProcA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ LRESULT rv = 0;
+ __try {
+ rv = Real_DefMDIChildProcA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("DefMDIChildProcA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LRESULT __stdcall Mine_DefMDIChildProcW(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3)
+{
+ _PrintEnter("DefMDIChildProcW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ LRESULT rv = 0;
+ __try {
+ rv = Real_DefMDIChildProcW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("DefMDIChildProcW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LRESULT __stdcall Mine_DefWindowProcA(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3)
+{
+ _PrintEnter("DefWindowProcA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ LRESULT rv = 0;
+ __try {
+ rv = Real_DefWindowProcA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("DefWindowProcA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LRESULT __stdcall Mine_DefWindowProcW(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3)
+{
+ _PrintEnter("DefWindowProcW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ LRESULT rv = 0;
+ __try {
+ rv = Real_DefWindowProcW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("DefWindowProcW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HDWP __stdcall Mine_DeferWindowPos(HDWP a0,
+ HWND a1,
+ HWND a2,
+ int a3,
+ int a4,
+ int a5,
+ int a6,
+ UINT a7)
+{
+ _PrintEnter("DeferWindowPos(%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7);
+
+ HDWP rv = 0;
+ __try {
+ rv = Real_DeferWindowPos(a0, a1, a2, a3, a4, a5, a6, a7);
+ } __finally {
+ _PrintExit("DeferWindowPos(,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DefineDosDeviceA(DWORD a0,
+ LPCSTR a1,
+ LPCSTR a2)
+{
+ _PrintEnter("DefineDosDeviceA(%p,%hs,%hs)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DefineDosDeviceA(a0, a1, a2);
+ } __finally {
+ _PrintExit("DefineDosDeviceA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DefineDosDeviceW(DWORD a0,
+ LPCWSTR a1,
+ LPCWSTR a2)
+{
+ _PrintEnter("DefineDosDeviceW(%p,%ls,%ls)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DefineDosDeviceW(a0, a1, a2);
+ } __finally {
+ _PrintExit("DefineDosDeviceW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+ATOM __stdcall Mine_DeleteAtom(ATOM a0)
+{
+ _PrintEnter("DeleteAtom(%p)\n", a0);
+
+ ATOM rv = 0;
+ __try {
+ rv = Real_DeleteAtom(a0);
+ } __finally {
+ _PrintExit("DeleteAtom() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DeleteColorSpace(HCOLORSPACE a0)
+{
+ _PrintEnter("DeleteColorSpace(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DeleteColorSpace(a0);
+ } __finally {
+ _PrintExit("DeleteColorSpace() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DeleteDC(HDC a0)
+{
+ _PrintEnter("DeleteDC(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DeleteDC(a0);
+ } __finally {
+ _PrintExit("DeleteDC() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DeleteEnhMetaFile(HENHMETAFILE a0)
+{
+ _PrintEnter("DeleteEnhMetaFile(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DeleteEnhMetaFile(a0);
+ } __finally {
+ _PrintExit("DeleteEnhMetaFile() -> %p\n", rv);
+ };
+ return rv;
+}
+
+void __stdcall Mine_DeleteFiber(LPVOID a0)
+{
+ _PrintEnter("DeleteFiber(%p)\n", a0);
+
+ __try {
+ Real_DeleteFiber(a0);
+ } __finally {
+ _PrintExit("DeleteFiber() ->\n");
+ };
+}
+
+BOOL __stdcall Mine_DeleteFileA(LPCSTR a0)
+{
+ _PrintEnter("DeleteFileA(%hs)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DeleteFileA(a0);
+ } __finally {
+ _PrintExit("DeleteFileA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DeleteFileW(LPCWSTR a0)
+{
+ _PrintEnter("DeleteFileW(%ls)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DeleteFileW(a0);
+ } __finally {
+ _PrintExit("DeleteFileW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DeleteMenu(HMENU a0,
+ UINT a1,
+ UINT a2)
+{
+ _PrintEnter("DeleteMenu(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DeleteMenu(a0, a1, a2);
+ } __finally {
+ _PrintExit("DeleteMenu(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DeleteMetaFile(HMETAFILE a0)
+{
+ _PrintEnter("DeleteMetaFile(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DeleteMetaFile(a0);
+ } __finally {
+ _PrintExit("DeleteMetaFile() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DeleteObject(HGDIOBJ a0)
+{
+ _PrintEnter("DeleteObject(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DeleteObject(a0);
+ } __finally {
+ _PrintExit("DeleteObject() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_DescribePixelFormat(HDC a0,
+ int a1,
+ UINT a2,
+ PIXELFORMATDESCRIPTOR* a3)
+{
+ _PrintEnter("DescribePixelFormat(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ int rv = 0;
+ __try {
+ rv = Real_DescribePixelFormat(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("DescribePixelFormat(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DestroyAcceleratorTable(HACCEL a0)
+{
+ _PrintEnter("DestroyAcceleratorTable(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DestroyAcceleratorTable(a0);
+ } __finally {
+ _PrintExit("DestroyAcceleratorTable() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DestroyCaret(void)
+{
+ _PrintEnter("DestroyCaret()\n");
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DestroyCaret();
+ } __finally {
+ _PrintExit("DestroyCaret() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DestroyCursor(HCURSOR a0)
+{
+ _PrintEnter("DestroyCursor(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DestroyCursor(a0);
+ } __finally {
+ _PrintExit("DestroyCursor() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DestroyIcon(HICON a0)
+{
+ _PrintEnter("DestroyIcon(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DestroyIcon(a0);
+ } __finally {
+ _PrintExit("DestroyIcon() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DestroyMenu(HMENU a0)
+{
+ _PrintEnter("DestroyMenu(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DestroyMenu(a0);
+ } __finally {
+ _PrintExit("DestroyMenu() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DestroyWindow(HWND a0)
+{
+ _PrintEnter("DestroyWindow(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DestroyWindow(a0);
+ } __finally {
+ _PrintExit("DestroyWindow() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DeviceIoControl(HANDLE a0,
+ DWORD a1,
+ LPVOID a2,
+ DWORD a3,
+ LPVOID a4,
+ DWORD a5,
+ LPDWORD a6,
+ LPOVERLAPPED a7)
+{
+ _PrintEnter("DeviceIoControl(%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DeviceIoControl(a0, a1, a2, a3, a4, a5, a6, a7);
+ } __finally {
+ _PrintExit("DeviceIoControl(,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+INT_PTR __stdcall Mine_DialogBoxIndirectParamA(HINSTANCE a0,
+ LPCDLGTEMPLATEA a1,
+ HWND a2,
+ DLGPROC a3,
+ LPARAM a4)
+{
+ _PrintEnter("DialogBoxIndirectParamA(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ INT_PTR rv = 0;
+ __try {
+ rv = Real_DialogBoxIndirectParamA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("DialogBoxIndirectParamA(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+INT_PTR __stdcall Mine_DialogBoxIndirectParamW(HINSTANCE a0,
+ LPCDLGTEMPLATEW a1,
+ HWND a2,
+ DLGPROC a3,
+ LPARAM a4)
+{
+ _PrintEnter("DialogBoxIndirectParamW(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ INT_PTR rv = 0;
+ __try {
+ rv = Real_DialogBoxIndirectParamW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("DialogBoxIndirectParamW(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+INT_PTR __stdcall Mine_DialogBoxParamA(HINSTANCE a0,
+ LPCSTR a1,
+ HWND a2,
+ DLGPROC a3,
+ LPARAM a4)
+{
+ _PrintEnter("DialogBoxParamA(%p,%hs,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ INT_PTR rv = 0;
+ __try {
+ rv = Real_DialogBoxParamA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("DialogBoxParamA(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+INT_PTR __stdcall Mine_DialogBoxParamW(HINSTANCE a0,
+ LPCWSTR a1,
+ HWND a2,
+ DLGPROC a3,
+ LPARAM a4)
+{
+ _PrintEnter("DialogBoxParamW(%p,%ls,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ INT_PTR rv = 0;
+ __try {
+ rv = Real_DialogBoxParamW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("DialogBoxParamW(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DisableThreadLibraryCalls(HMODULE a0)
+{
+ _PrintEnter("DisableThreadLibraryCalls(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DisableThreadLibraryCalls(a0);
+ } __finally {
+ _PrintExit("DisableThreadLibraryCalls() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DisconnectNamedPipe(HANDLE a0)
+{
+ _PrintEnter("DisconnectNamedPipe(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DisconnectNamedPipe(a0);
+ } __finally {
+ _PrintExit("DisconnectNamedPipe() -> %p\n", rv);
+ };
+ return rv;
+}
+
+LRESULT __stdcall Mine_DispatchMessageA(MSG* a0)
+{
+ _PrintEnter("DispatchMessageA(%p)\n", a0);
+
+ LRESULT rv = 0;
+ __try {
+ rv = Real_DispatchMessageA(a0);
+ } __finally {
+ _PrintExit("DispatchMessageA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+LRESULT __stdcall Mine_DispatchMessageW(MSG* a0)
+{
+ _PrintEnter("DispatchMessageW(%p)\n", a0);
+
+ LRESULT rv = 0;
+ __try {
+ rv = Real_DispatchMessageW(a0);
+ } __finally {
+ _PrintExit("DispatchMessageW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_DlgDirListA(HWND a0,
+ LPSTR a1,
+ int a2,
+ int a3,
+ UINT a4)
+{
+ _PrintEnter("DlgDirListA(%p,%hs,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ int rv = 0;
+ __try {
+ rv = Real_DlgDirListA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("DlgDirListA(,%hs,,,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_DlgDirListComboBoxA(HWND a0,
+ LPSTR a1,
+ int a2,
+ int a3,
+ UINT a4)
+{
+ _PrintEnter("DlgDirListComboBoxA(%p,%hs,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ int rv = 0;
+ __try {
+ rv = Real_DlgDirListComboBoxA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("DlgDirListComboBoxA(,%hs,,,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_DlgDirListComboBoxW(HWND a0,
+ LPWSTR a1,
+ int a2,
+ int a3,
+ UINT a4)
+{
+ _PrintEnter("DlgDirListComboBoxW(%p,%ls,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ int rv = 0;
+ __try {
+ rv = Real_DlgDirListComboBoxW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("DlgDirListComboBoxW(,%ls,,,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_DlgDirListW(HWND a0,
+ LPWSTR a1,
+ int a2,
+ int a3,
+ UINT a4)
+{
+ _PrintEnter("DlgDirListW(%p,%ls,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ int rv = 0;
+ __try {
+ rv = Real_DlgDirListW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("DlgDirListW(,%ls,,,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DlgDirSelectComboBoxExA(HWND a0,
+ LPSTR a1,
+ int a2,
+ int a3)
+{
+ _PrintEnter("DlgDirSelectComboBoxExA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DlgDirSelectComboBoxExA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("DlgDirSelectComboBoxExA(,%hs,,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DlgDirSelectComboBoxExW(HWND a0,
+ LPWSTR a1,
+ int a2,
+ int a3)
+{
+ _PrintEnter("DlgDirSelectComboBoxExW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DlgDirSelectComboBoxExW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("DlgDirSelectComboBoxExW(,%ls,,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DlgDirSelectExA(HWND a0,
+ LPSTR a1,
+ int a2,
+ int a3)
+{
+ _PrintEnter("DlgDirSelectExA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DlgDirSelectExA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("DlgDirSelectExA(,%hs,,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DlgDirSelectExW(HWND a0,
+ LPWSTR a1,
+ int a2,
+ int a3)
+{
+ _PrintEnter("DlgDirSelectExW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DlgDirSelectExW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("DlgDirSelectExW(,%ls,,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_DoDragDrop(IDataObject* a0,
+ IDropSource* a1,
+ DWORD a2,
+ LPDWORD a3)
+{
+ _PrintEnter("DoDragDrop(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_DoDragDrop(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("DoDragDrop(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DosDateTimeToFileTime(WORD a0,
+ WORD a1,
+ LPFILETIME a2)
+{
+ _PrintEnter("DosDateTimeToFileTime(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DosDateTimeToFileTime(a0, a1, a2);
+ } __finally {
+ _PrintExit("DosDateTimeToFileTime(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DragDetect(HWND a0,
+ POINT a1)
+{
+ _PrintEnter("DragDetect(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DragDetect(a0, a1);
+ } __finally {
+ _PrintExit("DragDetect(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_DragObject(HWND a0,
+ HWND a1,
+ UINT a2,
+ ULONG_PTR a3,
+ HCURSOR a4)
+{
+ _PrintEnter("DragObject(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_DragObject(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("DragObject(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DrawAnimatedRects(HWND a0,
+ int a1,
+ RECT* a2,
+ RECT* a3)
+{
+ _PrintEnter("DrawAnimatedRects(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DrawAnimatedRects(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("DrawAnimatedRects(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DrawCaption(HWND a0,
+ HDC a1,
+ RECT* a2,
+ UINT a3)
+{
+ _PrintEnter("DrawCaption(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DrawCaption(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("DrawCaption(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DrawEdge(HDC a0,
+ LPRECT a1,
+ UINT a2,
+ UINT a3)
+{
+ _PrintEnter("DrawEdge(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DrawEdge(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("DrawEdge(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_DrawEscape(HDC a0,
+ int a1,
+ int a2,
+ LPCSTR a3)
+{
+ _PrintEnter("DrawEscape(%p,%p,%p,%hs)\n", a0, a1, a2, a3);
+
+ int rv = 0;
+ __try {
+ rv = Real_DrawEscape(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("DrawEscape(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DrawFocusRect(HDC a0,
+ RECT* a1)
+{
+ _PrintEnter("DrawFocusRect(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DrawFocusRect(a0, a1);
+ } __finally {
+ _PrintExit("DrawFocusRect(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DrawFrameControl(HDC a0,
+ LPRECT a1,
+ UINT a2,
+ UINT a3)
+{
+ _PrintEnter("DrawFrameControl(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DrawFrameControl(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("DrawFrameControl(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DrawIcon(HDC a0,
+ int a1,
+ int a2,
+ HICON a3)
+{
+ _PrintEnter("DrawIcon(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DrawIcon(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("DrawIcon(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DrawIconEx(HDC a0,
+ int a1,
+ int a2,
+ HICON a3,
+ int a4,
+ int a5,
+ UINT a6,
+ HBRUSH a7,
+ UINT a8)
+{
+ _PrintEnter("DrawIconEx(%p,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DrawIconEx(a0, a1, a2, a3, a4, a5, a6, a7, a8);
+ } __finally {
+ _PrintExit("DrawIconEx(,,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DrawMenuBar(HWND a0)
+{
+ _PrintEnter("DrawMenuBar(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DrawMenuBar(a0);
+ } __finally {
+ _PrintExit("DrawMenuBar() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DrawStateA(HDC a0,
+ HBRUSH a1,
+ DRAWSTATEPROC a2,
+ LPARAM a3,
+ WPARAM a4,
+ int a5,
+ int a6,
+ int a7,
+ int a8,
+ UINT a9)
+{
+ _PrintEnter("DrawStateA(%p,%p,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DrawStateA(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
+ } __finally {
+ _PrintExit("DrawStateA(,,,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DrawStateW(HDC a0,
+ HBRUSH a1,
+ DRAWSTATEPROC a2,
+ LPARAM a3,
+ WPARAM a4,
+ int a5,
+ int a6,
+ int a7,
+ int a8,
+ UINT a9)
+{
+ _PrintEnter("DrawStateW(%p,%p,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DrawStateW(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
+ } __finally {
+ _PrintExit("DrawStateW(,,,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_DrawTextA(HDC a0,
+ LPCSTR a1,
+ int a2,
+ LPRECT a3,
+ UINT a4)
+{
+ _PrintEnter("DrawTextA(%p,%hs,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ int rv = 0;
+ __try {
+ rv = Real_DrawTextA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("DrawTextA(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_DrawTextExA(HDC a0,
+ LPSTR a1,
+ int a2,
+ LPRECT a3,
+ UINT a4,
+ LPDRAWTEXTPARAMS a5)
+{
+ _PrintEnter("DrawTextExA(%p,%hs,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ int rv = 0;
+ __try {
+ rv = Real_DrawTextExA(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("DrawTextExA(,%hs,,,,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_DrawTextExW(HDC a0,
+ LPWSTR a1,
+ int a2,
+ LPRECT a3,
+ UINT a4,
+ LPDRAWTEXTPARAMS a5)
+{
+ _PrintEnter("DrawTextExW(%p,%ls,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ int rv = 0;
+ __try {
+ rv = Real_DrawTextExW(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("DrawTextExW(,%ls,,,,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_DrawTextW(HDC a0,
+ LPCWSTR a1,
+ int a2,
+ LPRECT a3,
+ UINT a4)
+{
+ _PrintEnter("DrawTextW(%p,%ls,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ int rv = 0;
+ __try {
+ rv = Real_DrawTextW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("DrawTextW(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_DuplicateHandle(HANDLE a0,
+ HANDLE a1,
+ HANDLE a2,
+ LPHANDLE a3,
+ DWORD a4,
+ BOOL a5,
+ DWORD a6)
+{
+ _PrintEnter("DuplicateHandle(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DuplicateHandle(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("DuplicateHandle(,,,%p,,,) -> %p\n", a3 != NULL ? *a3 : NULL, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_Ellipse(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4)
+{
+ _PrintEnter("Ellipse(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_Ellipse(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("Ellipse(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EmptyClipboard(void)
+{
+ _PrintEnter("EmptyClipboard()\n");
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EmptyClipboard();
+ } __finally {
+ _PrintExit("EmptyClipboard() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EnableMenuItem(HMENU a0,
+ UINT a1,
+ UINT a2)
+{
+ _PrintEnter("EnableMenuItem(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnableMenuItem(a0, a1, a2);
+ } __finally {
+ _PrintExit("EnableMenuItem(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EnableScrollBar(HWND a0,
+ UINT a1,
+ UINT a2)
+{
+ _PrintEnter("EnableScrollBar(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnableScrollBar(a0, a1, a2);
+ } __finally {
+ _PrintExit("EnableScrollBar(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EnableWindow(HWND a0,
+ BOOL a1)
+{
+ _PrintEnter("EnableWindow(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnableWindow(a0, a1);
+ } __finally {
+ _PrintExit("EnableWindow(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EndDeferWindowPos(HDWP a0)
+{
+ _PrintEnter("EndDeferWindowPos(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EndDeferWindowPos(a0);
+ } __finally {
+ _PrintExit("EndDeferWindowPos() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EndDialog(HWND a0,
+ INT_PTR a1)
+{
+ _PrintEnter("EndDialog(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EndDialog(a0, a1);
+ } __finally {
+ _PrintExit("EndDialog(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_EndDoc(HDC a0)
+{
+ _PrintEnter("EndDoc(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_EndDoc(a0);
+ } __finally {
+ _PrintExit("EndDoc() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_EndPage(HDC a0)
+{
+ _PrintEnter("EndPage(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_EndPage(a0);
+ } __finally {
+ _PrintExit("EndPage() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EndPaint(HWND a0,
+ PAINTSTRUCT* a1)
+{
+ _PrintEnter("EndPaint(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EndPaint(a0, a1);
+ } __finally {
+ _PrintExit("EndPaint(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EndPath(HDC a0)
+{
+ _PrintEnter("EndPath(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EndPath(a0);
+ } __finally {
+ _PrintExit("EndPath() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EndUpdateResourceA(HANDLE a0,
+ BOOL a1)
+{
+ _PrintEnter("EndUpdateResourceA(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EndUpdateResourceA(a0, a1);
+ } __finally {
+ _PrintExit("EndUpdateResourceA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EndUpdateResourceW(HANDLE a0,
+ BOOL a1)
+{
+ _PrintEnter("EndUpdateResourceW(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EndUpdateResourceW(a0, a1);
+ } __finally {
+ _PrintExit("EndUpdateResourceW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EnumCalendarInfoA(CALINFO_ENUMPROCA a0,
+ LCID a1,
+ CALID a2,
+ CALTYPE a3)
+{
+ _PrintEnter("EnumCalendarInfoA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnumCalendarInfoA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("EnumCalendarInfoA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EnumCalendarInfoW(CALINFO_ENUMPROCW a0,
+ LCID a1,
+ CALID a2,
+ CALTYPE a3)
+{
+ _PrintEnter("EnumCalendarInfoW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnumCalendarInfoW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("EnumCalendarInfoW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EnumChildWindows(HWND a0,
+ WNDENUMPROC a1,
+ LPARAM a2)
+{
+ _PrintEnter("EnumChildWindows(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnumChildWindows(a0, a1, a2);
+ } __finally {
+ _PrintExit("EnumChildWindows(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_EnumClipboardFormats(UINT a0)
+{
+ _PrintEnter("EnumClipboardFormats(%p)\n", a0);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_EnumClipboardFormats(a0);
+ } __finally {
+ _PrintExit("EnumClipboardFormats() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EnumDateFormatsA(DATEFMT_ENUMPROCA a0,
+ LCID a1,
+ DWORD a2)
+{
+ _PrintEnter("EnumDateFormatsA(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnumDateFormatsA(a0, a1, a2);
+ } __finally {
+ _PrintExit("EnumDateFormatsA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EnumDateFormatsW(DATEFMT_ENUMPROCW a0,
+ LCID a1,
+ DWORD a2)
+{
+ _PrintEnter("EnumDateFormatsW(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnumDateFormatsW(a0, a1, a2);
+ } __finally {
+ _PrintExit("EnumDateFormatsW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EnumDesktopWindows(HDESK a0,
+ WNDENUMPROC a1,
+ LPARAM a2)
+{
+ _PrintEnter("EnumDesktopWindows(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnumDesktopWindows(a0, a1, a2);
+ } __finally {
+ _PrintExit("EnumDesktopWindows(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EnumDesktopsA(HWINSTA a0,
+ DESKTOPENUMPROCA a1,
+ LPARAM a2)
+{
+ _PrintEnter("EnumDesktopsA(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnumDesktopsA(a0, a1, a2);
+ } __finally {
+ _PrintExit("EnumDesktopsA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EnumDesktopsW(HWINSTA a0,
+ DESKTOPENUMPROCW a1,
+ LPARAM a2)
+{
+ _PrintEnter("EnumDesktopsW(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnumDesktopsW(a0, a1, a2);
+ } __finally {
+ _PrintExit("EnumDesktopsW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EnumDisplaySettingsA(LPCSTR a0,
+ DWORD a1,
+ LPDEVMODEA a2)
+{
+ _PrintEnter("EnumDisplaySettingsA(%hs,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnumDisplaySettingsA(a0, a1, a2);
+ } __finally {
+ _PrintExit("EnumDisplaySettingsA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EnumDisplaySettingsW(LPCWSTR a0,
+ DWORD a1,
+ LPDEVMODEW a2)
+{
+ _PrintEnter("EnumDisplaySettingsW(%ls,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnumDisplaySettingsW(a0, a1, a2);
+ } __finally {
+ _PrintExit("EnumDisplaySettingsW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EnumEnhMetaFile(HDC a0,
+ HENHMETAFILE a1,
+ ENHMFENUMPROC a2,
+ LPVOID a3,
+ RECT* a4)
+{
+ _PrintEnter("EnumEnhMetaFile(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnumEnhMetaFile(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("EnumEnhMetaFile(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_EnumFontFamiliesA(HDC a0,
+ LPCSTR a1,
+ FONTENUMPROCA a2,
+ LPARAM a3)
+{
+ _PrintEnter("EnumFontFamiliesA(%p,%hs,%p,%p)\n", a0, a1, a2, a3);
+
+ int rv = 0;
+ __try {
+ rv = Real_EnumFontFamiliesA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("EnumFontFamiliesA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_EnumFontFamiliesExA(HDC a0,
+ LPLOGFONTA a1,
+ FONTENUMPROCA a2,
+ LPARAM a3,
+ DWORD a4)
+{
+ _PrintEnter("EnumFontFamiliesExA(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ int rv = 0;
+ __try {
+ rv = Real_EnumFontFamiliesExA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("EnumFontFamiliesExA(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_EnumFontFamiliesExW(HDC a0,
+ LPLOGFONTW a1,
+ FONTENUMPROCW a2,
+ LPARAM a3,
+ DWORD a4)
+{
+ _PrintEnter("EnumFontFamiliesExW(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ int rv = 0;
+ __try {
+ rv = Real_EnumFontFamiliesExW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("EnumFontFamiliesExW(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_EnumFontFamiliesW(HDC a0,
+ LPCWSTR a1,
+ FONTENUMPROCW a2,
+ LPARAM a3)
+{
+ _PrintEnter("EnumFontFamiliesW(%p,%ls,%p,%p)\n", a0, a1, a2, a3);
+
+ int rv = 0;
+ __try {
+ rv = Real_EnumFontFamiliesW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("EnumFontFamiliesW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_EnumFontsA(HDC a0,
+ LPCSTR a1,
+ FONTENUMPROCA a2,
+ LPARAM a3)
+{
+ _PrintEnter("EnumFontsA(%p,%hs,%p,%p)\n", a0, a1, a2, a3);
+
+ int rv = 0;
+ __try {
+ rv = Real_EnumFontsA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("EnumFontsA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_EnumFontsW(HDC a0,
+ LPCWSTR a1,
+ FONTENUMPROCW a2,
+ LPARAM a3)
+{
+ _PrintEnter("EnumFontsW(%p,%ls,%p,%p)\n", a0, a1, a2, a3);
+
+ int rv = 0;
+ __try {
+ rv = Real_EnumFontsW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("EnumFontsW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_EnumICMProfilesA(HDC a0,
+ ICMENUMPROCA a1,
+ LPARAM a2)
+{
+ _PrintEnter("EnumICMProfilesA(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_EnumICMProfilesA(a0, a1, a2);
+ } __finally {
+ _PrintExit("EnumICMProfilesA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_EnumICMProfilesW(HDC a0,
+ ICMENUMPROCW a1,
+ LPARAM a2)
+{
+ _PrintEnter("EnumICMProfilesW(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_EnumICMProfilesW(a0, a1, a2);
+ } __finally {
+ _PrintExit("EnumICMProfilesW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EnumMetaFile(HDC a0,
+ HMETAFILE a1,
+ MFENUMPROC a2,
+ LPARAM a3)
+{
+ _PrintEnter("EnumMetaFile(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnumMetaFile(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("EnumMetaFile(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_EnumObjects(HDC a0,
+ int a1,
+ GOBJENUMPROC a2,
+ LPARAM a3)
+{
+ _PrintEnter("EnumObjects(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ int rv = 0;
+ __try {
+ rv = Real_EnumObjects(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("EnumObjects(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_EnumPropsA(HWND a0,
+ PROPENUMPROCA a1)
+{
+ _PrintEnter("EnumPropsA(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_EnumPropsA(a0, a1);
+ } __finally {
+ _PrintExit("EnumPropsA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_EnumPropsExA(HWND a0,
+ PROPENUMPROCEXA a1,
+ LPARAM a2)
+{
+ _PrintEnter("EnumPropsExA(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_EnumPropsExA(a0, a1, a2);
+ } __finally {
+ _PrintExit("EnumPropsExA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_EnumPropsExW(HWND a0,
+ PROPENUMPROCEXW a1,
+ LPARAM a2)
+{
+ _PrintEnter("EnumPropsExW(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_EnumPropsExW(a0, a1, a2);
+ } __finally {
+ _PrintExit("EnumPropsExW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_EnumPropsW(HWND a0,
+ PROPENUMPROCW a1)
+{
+ _PrintEnter("EnumPropsW(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_EnumPropsW(a0, a1);
+ } __finally {
+ _PrintExit("EnumPropsW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+#if _MSC_VER < 1300
+BOOL __stdcall Mine_EnumResourceLanguagesA(HMODULE a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ ENUMRESLANGPROC a3,
+ LONG_PTR a4)
+#else
+BOOL __stdcall Mine_EnumResourceLanguagesA(HMODULE a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ ENUMRESLANGPROCA a3,
+ LONG_PTR a4)
+#endif
+{
+ _PrintEnter("EnumResourceLanguagesA(%p,%hs,%hs,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnumResourceLanguagesA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("EnumResourceLanguagesA(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+#if _MSC_VER < 1300
+BOOL __stdcall Mine_EnumResourceLanguagesW(HMODULE a0,
+ LPCWSTR a1,
+ LPCWSTR a2,
+ ENUMRESLANGPROC a3,
+ LONG_PTR a4)
+#else
+BOOL __stdcall Mine_EnumResourceLanguagesW(HMODULE a0,
+ LPCWSTR a1,
+ LPCWSTR a2,
+ ENUMRESLANGPROCW a3,
+ LONG_PTR a4)
+#endif
+{
+ _PrintEnter("EnumResourceLanguagesW(%p,%ls,%ls,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnumResourceLanguagesW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("EnumResourceLanguagesW(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+#if _MSC_VER < 1300
+BOOL __stdcall Mine_EnumResourceNamesA(HMODULE a0,
+ LPCSTR a1,
+ ENUMRESNAMEPROC a2,
+ LONG_PTR a3)
+#else
+BOOL __stdcall Mine_EnumResourceNamesA(HMODULE a0,
+ LPCSTR a1,
+ ENUMRESNAMEPROCA a2,
+ LONG_PTR a3)
+#endif
+{
+ _PrintEnter("EnumResourceNamesA(%p,%hs,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnumResourceNamesA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("EnumResourceNamesA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+#if _MSC_VER < 1300
+BOOL __stdcall Mine_EnumResourceNamesW(HMODULE a0,
+ LPCWSTR a1,
+ ENUMRESNAMEPROC a2,
+ LONG_PTR a3)
+#else
+BOOL __stdcall Mine_EnumResourceNamesW(HMODULE a0,
+ LPCWSTR a1,
+ ENUMRESNAMEPROCW a2,
+ LONG_PTR a3)
+#endif
+{
+ _PrintEnter("EnumResourceNamesW(%p,%ls,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnumResourceNamesW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("EnumResourceNamesW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+#if _MSC_VER < 1300
+BOOL __stdcall Mine_EnumResourceTypesA(HMODULE a0,
+ ENUMRESTYPEPROC a1,
+ LONG_PTR a2)
+#else
+BOOL __stdcall Mine_EnumResourceTypesA(HMODULE a0,
+ ENUMRESTYPEPROCA a1,
+ LONG_PTR a2)
+#endif
+{
+ _PrintEnter("EnumResourceTypesA(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnumResourceTypesA(a0, a1, a2);
+ } __finally {
+ _PrintExit("EnumResourceTypesA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+#if _MSC_VER < 1300
+BOOL __stdcall Mine_EnumResourceTypesW(HMODULE a0,
+ ENUMRESTYPEPROC a1,
+ LONG_PTR a2)
+#else
+BOOL __stdcall Mine_EnumResourceTypesW(HMODULE a0,
+ ENUMRESTYPEPROCW a1,
+ LONG_PTR a2)
+#endif
+{
+ _PrintEnter("EnumResourceTypesW(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnumResourceTypesW(a0, a1, a2);
+ } __finally {
+ _PrintExit("EnumResourceTypesW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EnumSystemCodePagesA(CODEPAGE_ENUMPROCA a0,
+ DWORD a1)
+{
+ _PrintEnter("EnumSystemCodePagesA(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnumSystemCodePagesA(a0, a1);
+ } __finally {
+ _PrintExit("EnumSystemCodePagesA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EnumSystemCodePagesW(CODEPAGE_ENUMPROCW a0,
+ DWORD a1)
+{
+ _PrintEnter("EnumSystemCodePagesW(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnumSystemCodePagesW(a0, a1);
+ } __finally {
+ _PrintExit("EnumSystemCodePagesW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+#if(WINVER >= 0x0500)
+BOOL __stdcall Mine_EnumSystemLocalesA(LOCALE_ENUMPROCA a0,
+ DWORD a1)
+{
+ _PrintEnter("EnumSystemLocalesA(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnumSystemLocalesA(a0, a1);
+ } __finally {
+ _PrintExit("EnumSystemLocalesA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EnumSystemLocalesW(LOCALE_ENUMPROCW a0,
+ DWORD a1)
+{
+ _PrintEnter("EnumSystemLocalesW(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnumSystemLocalesW(a0, a1);
+ } __finally {
+ _PrintExit("EnumSystemLocalesW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+#endif // (WINVER >= 0x0500)
+
+BOOL __stdcall Mine_EnumThreadWindows(DWORD a0,
+ WNDENUMPROC a1,
+ LPARAM a2)
+{
+ _PrintEnter("EnumThreadWindows(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnumThreadWindows(a0, a1, a2);
+ } __finally {
+ _PrintExit("EnumThreadWindows(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EnumTimeFormatsA(TIMEFMT_ENUMPROCA a0,
+ LCID a1,
+ DWORD a2)
+{
+ _PrintEnter("EnumTimeFormatsA(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnumTimeFormatsA(a0, a1, a2);
+ } __finally {
+ _PrintExit("EnumTimeFormatsA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EnumTimeFormatsW(TIMEFMT_ENUMPROCW a0,
+ LCID a1,
+ DWORD a2)
+{
+ _PrintEnter("EnumTimeFormatsW(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnumTimeFormatsW(a0, a1, a2);
+ } __finally {
+ _PrintExit("EnumTimeFormatsW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EnumWindowStationsA(WINSTAENUMPROCA a0,
+ LPARAM a1)
+{
+ _PrintEnter("EnumWindowStationsA(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnumWindowStationsA(a0, a1);
+ } __finally {
+ _PrintExit("EnumWindowStationsA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EnumWindowStationsW(WINSTAENUMPROCW a0,
+ LPARAM a1)
+{
+ _PrintEnter("EnumWindowStationsW(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnumWindowStationsW(a0, a1);
+ } __finally {
+ _PrintExit("EnumWindowStationsW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EnumWindows(WNDENUMPROC a0,
+ LPARAM a1)
+{
+ _PrintEnter("EnumWindows(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EnumWindows(a0, a1);
+ } __finally {
+ _PrintExit("EnumWindows(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EqualRect(RECT* a0,
+ RECT* a1)
+{
+ _PrintEnter("EqualRect(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EqualRect(a0, a1);
+ } __finally {
+ _PrintExit("EqualRect(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EqualRgn(HRGN a0,
+ HRGN a1)
+{
+ _PrintEnter("EqualRgn(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EqualRgn(a0, a1);
+ } __finally {
+ _PrintExit("EqualRgn(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_EraseTape(HANDLE a0,
+ DWORD a1,
+ BOOL a2)
+{
+ _PrintEnter("EraseTape(%p,%p,%p)\n", a0, a1, a2);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_EraseTape(a0, a1, a2);
+ } __finally {
+ _PrintExit("EraseTape(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_Escape(HDC a0,
+ int a1,
+ int a2,
+ LPCSTR a3,
+ LPVOID a4)
+{
+ _PrintEnter("Escape(%p,%p,%p,%hs,%p)\n", a0, a1, a2, a3, a4);
+
+ int rv = 0;
+ __try {
+ rv = Real_Escape(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("Escape(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_EscapeCommFunction(HANDLE a0,
+ DWORD a1)
+{
+ _PrintEnter("EscapeCommFunction(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EscapeCommFunction(a0, a1);
+ } __finally {
+ _PrintExit("EscapeCommFunction(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_ExcludeClipRect(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4)
+{
+ _PrintEnter("ExcludeClipRect(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ int rv = 0;
+ __try {
+ rv = Real_ExcludeClipRect(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("ExcludeClipRect(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_ExcludeUpdateRgn(HDC a0,
+ HWND a1)
+{
+ _PrintEnter("ExcludeUpdateRgn(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_ExcludeUpdateRgn(a0, a1);
+ } __finally {
+ _PrintExit("ExcludeUpdateRgn(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+void __stdcall Mine_ExitProcess(UINT a0)
+{
+ _PrintEnter("ExitProcess(%p)\n", a0);
+
+ __try {
+ Real_ExitProcess(a0);
+ } __finally {
+ _PrintExit("ExitProcess() ->\n");
+ };
+}
+
+void __stdcall Mine_ExitThread(DWORD a0)
+{
+ _PrintEnter("ExitThread(%p)\n", a0);
+
+ __try {
+ Real_ExitThread(a0);
+ } __finally {
+ _PrintExit("ExitThread() ->\n");
+ };
+}
+
+BOOL __stdcall Mine_ExitWindowsEx(UINT a0,
+ DWORD a1)
+{
+ _PrintEnter("ExitWindowsEx(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ExitWindowsEx(a0, a1);
+ } __finally {
+ _PrintExit("ExitWindowsEx(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_ExpandEnvironmentStringsA(LPCSTR a0,
+ LPSTR a1,
+ DWORD a2)
+{
+ _PrintEnter("ExpandEnvironmentStringsA(%hs,%p,%p)\n", a0, a1, a2);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_ExpandEnvironmentStringsA(a0, a1, a2);
+ } __finally {
+ _PrintExit("ExpandEnvironmentStringsA(,%hs,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_ExpandEnvironmentStringsW(LPCWSTR a0,
+ LPWSTR a1,
+ DWORD a2)
+{
+ _PrintEnter("ExpandEnvironmentStringsW(%ls,%p,%p)\n", a0, a1, a2);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_ExpandEnvironmentStringsW(a0, a1, a2);
+ } __finally {
+ _PrintExit("ExpandEnvironmentStringsW(,%ls,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+HPEN __stdcall Mine_ExtCreatePen(DWORD a0,
+ DWORD a1,
+ LOGBRUSH* a2,
+ DWORD a3,
+ DWORD* a4)
+{
+ _PrintEnter("ExtCreatePen(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ HPEN rv = 0;
+ __try {
+ rv = Real_ExtCreatePen(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("ExtCreatePen(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRGN __stdcall Mine_ExtCreateRegion(XFORM* a0,
+ DWORD a1,
+ RGNDATA* a2)
+{
+ _PrintEnter("ExtCreateRegion(%p,%p,%p)\n", a0, a1, a2);
+
+ HRGN rv = 0;
+ __try {
+ rv = Real_ExtCreateRegion(a0, a1, a2);
+ } __finally {
+ _PrintExit("ExtCreateRegion(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_ExtEscape(HDC a0,
+ int a1,
+ int a2,
+ LPCSTR a3,
+ int a4,
+ LPSTR a5)
+{
+ _PrintEnter("ExtEscape(%p,%p,%p,%hs,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ int rv = 0;
+ __try {
+ rv = Real_ExtEscape(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("ExtEscape(,,,,,%hs) -> %p\n", a5, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ExtFloodFill(HDC a0,
+ int a1,
+ int a2,
+ COLORREF a3,
+ UINT a4)
+{
+ _PrintEnter("ExtFloodFill(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ExtFloodFill(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("ExtFloodFill(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_ExtSelectClipRgn(HDC a0,
+ HRGN a1,
+ int a2)
+{
+ _PrintEnter("ExtSelectClipRgn(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_ExtSelectClipRgn(a0, a1, a2);
+ } __finally {
+ _PrintExit("ExtSelectClipRgn(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ExtTextOutA(HDC a0,
+ int a1,
+ int a2,
+ UINT a3,
+ RECT* a4,
+ LPCSTR a5,
+ UINT a6,
+ INT* a7)
+{
+ _PrintEnter("ExtTextOutA(%p,%p,%p,%p,%p,%hs,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ExtTextOutA(a0, a1, a2, a3, a4, a5, a6, a7);
+ } __finally {
+ _PrintExit("ExtTextOutA(,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ExtTextOutW(HDC a0,
+ int a1,
+ int a2,
+ UINT a3,
+ RECT* a4,
+ LPCWSTR a5,
+ UINT a6,
+ INT* a7)
+{
+ _PrintEnter("ExtTextOutW(%p,%p,%p,%p,%p,%ls,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ExtTextOutW(a0, a1, a2, a3, a4, a5, a6, a7);
+ } __finally {
+ _PrintExit("ExtTextOutW(,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+void __stdcall Mine_FatalAppExitA(UINT a0,
+ LPCSTR a1)
+{
+ _PrintEnter("FatalAppExitA(%p,%hs)\n", a0, a1);
+
+ __try {
+ Real_FatalAppExitA(a0, a1);
+ } __finally {
+ _PrintExit("FatalAppExitA(,) ->\n");
+ };
+}
+
+void __stdcall Mine_FatalAppExitW(UINT a0,
+ LPCWSTR a1)
+{
+ _PrintEnter("FatalAppExitW(%p,%ls)\n", a0, a1);
+
+ __try {
+ Real_FatalAppExitW(a0, a1);
+ } __finally {
+ _PrintExit("FatalAppExitW(,) ->\n");
+ };
+}
+
+void __stdcall Mine_FatalExit(int a0)
+{
+ _PrintEnter("FatalExit(%p)\n", a0);
+
+ __try {
+ Real_FatalExit(a0);
+ } __finally {
+ _PrintExit("FatalExit() ->\n");
+ };
+}
+
+BOOL __stdcall Mine_FileTimeToDosDateTime(FILETIME* a0,
+ LPWORD a1,
+ LPWORD a2)
+{
+ _PrintEnter("FileTimeToDosDateTime(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_FileTimeToDosDateTime(a0, a1, a2);
+ } __finally {
+ _PrintExit("FileTimeToDosDateTime(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_FileTimeToLocalFileTime(FILETIME* a0,
+ LPFILETIME a1)
+{
+ _PrintEnter("FileTimeToLocalFileTime(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_FileTimeToLocalFileTime(a0, a1);
+ } __finally {
+ _PrintExit("FileTimeToLocalFileTime(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_FileTimeToSystemTime(FILETIME* a0,
+ LPSYSTEMTIME a1)
+{
+ _PrintEnter("FileTimeToSystemTime(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_FileTimeToSystemTime(a0, a1);
+ } __finally {
+ _PrintExit("FileTimeToSystemTime(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_FillConsoleOutputAttribute(HANDLE a0,
+ WORD a1,
+ DWORD a2,
+ COORD a3,
+ LPDWORD a4)
+{
+ _PrintEnter("FillConsoleOutputAttribute(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_FillConsoleOutputAttribute(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("FillConsoleOutputAttribute(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_FillConsoleOutputCharacterA(HANDLE a0,
+ CHAR a1,
+ DWORD a2,
+ COORD a3,
+ LPDWORD a4)
+{
+ _PrintEnter("FillConsoleOutputCharacterA(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_FillConsoleOutputCharacterA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("FillConsoleOutputCharacterA(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_FillConsoleOutputCharacterW(HANDLE a0,
+ WCHAR a1,
+ DWORD a2,
+ COORD a3,
+ LPDWORD a4)
+{
+ _PrintEnter("FillConsoleOutputCharacterW(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_FillConsoleOutputCharacterW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("FillConsoleOutputCharacterW(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_FillPath(HDC a0)
+{
+ _PrintEnter("FillPath(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_FillPath(a0);
+ } __finally {
+ _PrintExit("FillPath() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_FillRect(HDC a0,
+ RECT* a1,
+ HBRUSH a2)
+{
+ _PrintEnter("FillRect(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_FillRect(a0, a1, a2);
+ } __finally {
+ _PrintExit("FillRect(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_FillRgn(HDC a0,
+ HRGN a1,
+ HBRUSH a2)
+{
+ _PrintEnter("FillRgn(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_FillRgn(a0, a1, a2);
+ } __finally {
+ _PrintExit("FillRgn(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+ATOM __stdcall Mine_FindAtomA(LPCSTR a0)
+{
+ _PrintEnter("FindAtomA(%hs)\n", a0);
+
+ ATOM rv = 0;
+ __try {
+ rv = Real_FindAtomA(a0);
+ } __finally {
+ _PrintExit("FindAtomA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+ATOM __stdcall Mine_FindAtomW(LPCWSTR a0)
+{
+ _PrintEnter("FindAtomW(%ls)\n", a0);
+
+ ATOM rv = 0;
+ __try {
+ rv = Real_FindAtomW(a0);
+ } __finally {
+ _PrintExit("FindAtomW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_FindClose(HANDLE a0)
+{
+ _PrintEnter("FindClose(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_FindClose(a0);
+ } __finally {
+ _PrintExit("FindClose() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_FindCloseChangeNotification(HANDLE a0)
+{
+ _PrintEnter("FindCloseChangeNotification(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_FindCloseChangeNotification(a0);
+ } __finally {
+ _PrintExit("FindCloseChangeNotification() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_FindFirstChangeNotificationA(LPCSTR a0,
+ BOOL a1,
+ DWORD a2)
+{
+ _PrintEnter("FindFirstChangeNotificationA(%hs,%p,%p)\n", a0, a1, a2);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_FindFirstChangeNotificationA(a0, a1, a2);
+ } __finally {
+ _PrintExit("FindFirstChangeNotificationA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_FindFirstChangeNotificationW(LPCWSTR a0,
+ BOOL a1,
+ DWORD a2)
+{
+ _PrintEnter("FindFirstChangeNotificationW(%ls,%p,%p)\n", a0, a1, a2);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_FindFirstChangeNotificationW(a0, a1, a2);
+ } __finally {
+ _PrintExit("FindFirstChangeNotificationW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_FindFirstFileA(LPCSTR a0,
+ LPWIN32_FIND_DATAA a1)
+{
+ _PrintEnter("FindFirstFileA(%hs,%p)\n", a0, a1);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_FindFirstFileA(a0, a1);
+ } __finally {
+ _PrintExit("FindFirstFileA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_FindFirstFileExA(LPCSTR a0,
+ FINDEX_INFO_LEVELS a1,
+ LPVOID a2,
+ FINDEX_SEARCH_OPS a3,
+ LPVOID a4,
+ DWORD a5)
+{
+ _PrintEnter("FindFirstFileExA(%hs,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_FindFirstFileExA(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("FindFirstFileExA(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_FindFirstFileExW(LPCWSTR a0,
+ FINDEX_INFO_LEVELS a1,
+ LPVOID a2,
+ FINDEX_SEARCH_OPS a3,
+ LPVOID a4,
+ DWORD a5)
+{
+ _PrintEnter("FindFirstFileExW(%ls,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_FindFirstFileExW(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("FindFirstFileExW(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_FindFirstFileW(LPCWSTR a0,
+ LPWIN32_FIND_DATAW a1)
+{
+ _PrintEnter("FindFirstFileW(%ls,%p)\n", a0, a1);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_FindFirstFileW(a0, a1);
+ } __finally {
+ _PrintExit("FindFirstFileW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_FindNextChangeNotification(HANDLE a0)
+{
+ _PrintEnter("FindNextChangeNotification(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_FindNextChangeNotification(a0);
+ } __finally {
+ _PrintExit("FindNextChangeNotification() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_FindNextFileA(HANDLE a0,
+ LPWIN32_FIND_DATAA a1)
+{
+ _PrintEnter("FindNextFileA(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_FindNextFileA(a0, a1);
+ } __finally {
+ _PrintExit("FindNextFileA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_FindNextFileW(HANDLE a0,
+ LPWIN32_FIND_DATAW a1)
+{
+ _PrintEnter("FindNextFileW(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_FindNextFileW(a0, a1);
+ } __finally {
+ _PrintExit("FindNextFileW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRSRC __stdcall Mine_FindResourceA(HMODULE a0,
+ LPCSTR a1,
+ LPCSTR a2)
+{
+ _PrintEnter("FindResourceA(%p,%hs,%hs)\n", a0, a1, a2);
+
+ HRSRC rv = 0;
+ __try {
+ rv = Real_FindResourceA(a0, a1, a2);
+ } __finally {
+ _PrintExit("FindResourceA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRSRC __stdcall Mine_FindResourceExA(HMODULE a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ WORD a3)
+{
+ _PrintEnter("FindResourceExA(%p,%hs,%hs,%p)\n", a0, a1, a2, a3);
+
+ HRSRC rv = 0;
+ __try {
+ rv = Real_FindResourceExA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("FindResourceExA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRSRC __stdcall Mine_FindResourceExW(HMODULE a0,
+ LPCWSTR a1,
+ LPCWSTR a2,
+ WORD a3)
+{
+ _PrintEnter("FindResourceExW(%p,%ls,%ls,%p)\n", a0, a1, a2, a3);
+
+ HRSRC rv = 0;
+ __try {
+ rv = Real_FindResourceExW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("FindResourceExW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRSRC __stdcall Mine_FindResourceW(HMODULE a0,
+ LPCWSTR a1,
+ LPCWSTR a2)
+{
+ _PrintEnter("FindResourceW(%p,%ls,%ls)\n", a0, a1, a2);
+
+ HRSRC rv = 0;
+ __try {
+ rv = Real_FindResourceW(a0, a1, a2);
+ } __finally {
+ _PrintExit("FindResourceW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_FindWindowA(LPCSTR a0,
+ LPCSTR a1)
+{
+ _PrintEnter("FindWindowA(%hs,%hs)\n", a0, a1);
+
+ HWND rv = 0;
+ __try {
+ rv = Real_FindWindowA(a0, a1);
+ } __finally {
+ _PrintExit("FindWindowA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_FindWindowExA(HWND a0,
+ HWND a1,
+ LPCSTR a2,
+ LPCSTR a3)
+{
+ _PrintEnter("FindWindowExA(%p,%p,%hs,%hs)\n", a0, a1, a2, a3);
+
+ HWND rv = 0;
+ __try {
+ rv = Real_FindWindowExA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("FindWindowExA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_FindWindowExW(HWND a0,
+ HWND a1,
+ LPCWSTR a2,
+ LPCWSTR a3)
+{
+ _PrintEnter("FindWindowExW(%p,%p,%ls,%ls)\n", a0, a1, a2, a3);
+
+ HWND rv = 0;
+ __try {
+ rv = Real_FindWindowExW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("FindWindowExW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_FindWindowW(LPCWSTR a0,
+ LPCWSTR a1)
+{
+ _PrintEnter("FindWindowW(%ls,%ls)\n", a0, a1);
+
+ HWND rv = 0;
+ __try {
+ rv = Real_FindWindowW(a0, a1);
+ } __finally {
+ _PrintExit("FindWindowW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_FixBrushOrgEx(HDC a0,
+ int a1,
+ int a2,
+ POINT* a3)
+{
+ _PrintEnter("FixBrushOrgEx(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_FixBrushOrgEx(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("FixBrushOrgEx(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_FlashWindow(HWND a0,
+ BOOL a1)
+{
+ _PrintEnter("FlashWindow(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_FlashWindow(a0, a1);
+ } __finally {
+ _PrintExit("FlashWindow(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_FlattenPath(HDC a0)
+{
+ _PrintEnter("FlattenPath(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_FlattenPath(a0);
+ } __finally {
+ _PrintExit("FlattenPath() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_FloodFill(HDC a0,
+ int a1,
+ int a2,
+ COLORREF a3)
+{
+ _PrintEnter("FloodFill(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_FloodFill(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("FloodFill(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_FlushConsoleInputBuffer(HANDLE a0)
+{
+ _PrintEnter("FlushConsoleInputBuffer(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_FlushConsoleInputBuffer(a0);
+ } __finally {
+ _PrintExit("FlushConsoleInputBuffer() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_FlushFileBuffers(HANDLE a0)
+{
+ _PrintEnter("FlushFileBuffers(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_FlushFileBuffers(a0);
+ } __finally {
+ _PrintExit("FlushFileBuffers() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_FlushViewOfFile(LPCVOID a0,
+ SIZE_T a1)
+{
+ _PrintEnter("FlushViewOfFile(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_FlushViewOfFile(a0, a1);
+ } __finally {
+ _PrintExit("FlushViewOfFile(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_FmtIdToPropStgName(FMTID* a0,
+ LPOLESTR a1)
+{
+ _PrintEnter("FmtIdToPropStgName(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_FmtIdToPropStgName(a0, a1);
+ } __finally {
+ _PrintExit("FmtIdToPropStgName(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_FoldStringA(DWORD a0,
+ LPCSTR a1,
+ int a2,
+ LPSTR a3,
+ int a4)
+{
+ _PrintEnter("FoldStringA(%p,%hs,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ int rv = 0;
+ __try {
+ rv = Real_FoldStringA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("FoldStringA(,,,%hs,) -> %p\n", a3, rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_FoldStringW(DWORD a0,
+ LPCWSTR a1,
+ int a2,
+ LPWSTR a3,
+ int a4)
+{
+ _PrintEnter("FoldStringW(%p,%ls,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ int rv = 0;
+ __try {
+ rv = Real_FoldStringW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("FoldStringW(,,,%ls,) -> %p\n", a3, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_FormatMessageA(DWORD a0,
+ LPCVOID a1,
+ DWORD a2,
+ DWORD a3,
+ LPSTR a4,
+ DWORD a5,
+ va_list* a6)
+{
+ _PrintEnter("FormatMessageA(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_FormatMessageA(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("FormatMessageA(,,,,%hs,,) -> %p\n", a4, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_FormatMessageW(DWORD a0,
+ LPCVOID a1,
+ DWORD a2,
+ DWORD a3,
+ LPWSTR a4,
+ DWORD a5,
+ va_list* a6)
+{
+ _PrintEnter("FormatMessageW(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_FormatMessageW(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("FormatMessageW(,,,,%ls,,) -> %p\n", a4, rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_FrameRect(HDC a0,
+ RECT* a1,
+ HBRUSH a2)
+{
+ _PrintEnter("FrameRect(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_FrameRect(a0, a1, a2);
+ } __finally {
+ _PrintExit("FrameRect(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_FrameRgn(HDC a0,
+ HRGN a1,
+ HBRUSH a2,
+ int a3,
+ int a4)
+{
+ _PrintEnter("FrameRgn(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_FrameRgn(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("FrameRgn(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_FreeConsole(void)
+{
+ _PrintEnter("FreeConsole()\n");
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_FreeConsole();
+ } __finally {
+ _PrintExit("FreeConsole() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_FreeDDElParam(UINT a0,
+ LPARAM a1)
+{
+ _PrintEnter("FreeDDElParam(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_FreeDDElParam(a0, a1);
+ } __finally {
+ _PrintExit("FreeDDElParam(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_FreeEnvironmentStringsA(LPSTR a0)
+{
+ _PrintEnter("FreeEnvironmentStringsA(%hs)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_FreeEnvironmentStringsA(a0);
+ } __finally {
+ _PrintExit("FreeEnvironmentStringsA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_FreeEnvironmentStringsW(LPWSTR a0)
+{
+ _PrintEnter("FreeEnvironmentStringsW(%ls)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_FreeEnvironmentStringsW(a0);
+ } __finally {
+ _PrintExit("FreeEnvironmentStringsW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_FreeLibrary(HMODULE a0)
+{
+ _PrintEnter("FreeLibrary(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_FreeLibrary(a0);
+ } __finally {
+ _PrintExit("FreeLibrary() -> %p\n", rv);
+ };
+ return rv;
+}
+
+void __stdcall Mine_FreeLibraryAndExitThread(HMODULE a0,
+ DWORD a1)
+{
+ _PrintEnter("FreeLibraryAndExitThread(%p,%p)\n", a0, a1);
+
+ __try {
+ Real_FreeLibraryAndExitThread(a0, a1);
+ } __finally {
+ _PrintExit("FreeLibraryAndExitThread(,) ->\n");
+ };
+}
+
+HRESULT __stdcall Mine_FreePropVariantArray(ULONG a0,
+ PROPVARIANT* a1)
+{
+ _PrintEnter("FreePropVariantArray(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_FreePropVariantArray(a0, a1);
+ } __finally {
+ _PrintExit("FreePropVariantArray(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_FreeResource(HGLOBAL a0)
+{
+ _PrintEnter("FreeResource(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_FreeResource(a0);
+ } __finally {
+ _PrintExit("FreeResource() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GdiComment(HDC a0,
+ UINT a1,
+ BYTE* a2)
+{
+ _PrintEnter("GdiComment(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GdiComment(a0, a1, a2);
+ } __finally {
+ _PrintExit("GdiComment(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GdiFlush(void)
+{
+ _PrintEnter("GdiFlush()\n");
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GdiFlush();
+ } __finally {
+ _PrintExit("GdiFlush() -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GdiGetBatchLimit(void)
+{
+ _PrintEnter("GdiGetBatchLimit()\n");
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GdiGetBatchLimit();
+ } __finally {
+ _PrintExit("GdiGetBatchLimit() -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GdiSetBatchLimit(DWORD a0)
+{
+ _PrintEnter("GdiSetBatchLimit(%p)\n", a0);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GdiSetBatchLimit(a0);
+ } __finally {
+ _PrintExit("GdiSetBatchLimit() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GenerateConsoleCtrlEvent(DWORD a0,
+ DWORD a1)
+{
+ _PrintEnter("GenerateConsoleCtrlEvent(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GenerateConsoleCtrlEvent(a0, a1);
+ } __finally {
+ _PrintExit("GenerateConsoleCtrlEvent(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetACP(void)
+{
+ _PrintEnter("GetACP()\n");
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetACP();
+ } __finally {
+ _PrintExit("GetACP() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_GetActiveWindow(void)
+{
+ _PrintEnter("GetActiveWindow()\n");
+
+ HWND rv = 0;
+ __try {
+ rv = Real_GetActiveWindow();
+ } __finally {
+ _PrintExit("GetActiveWindow() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetArcDirection(HDC a0)
+{
+ _PrintEnter("GetArcDirection(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetArcDirection(a0);
+ } __finally {
+ _PrintExit("GetArcDirection() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetAspectRatioFilterEx(HDC a0,
+ SIZE* a1)
+{
+ _PrintEnter("GetAspectRatioFilterEx(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetAspectRatioFilterEx(a0, a1);
+ } __finally {
+ _PrintExit("GetAspectRatioFilterEx(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+SHORT __stdcall Mine_GetAsyncKeyState(int a0)
+{
+ _PrintEnter("GetAsyncKeyState(%p)\n", a0);
+
+ SHORT rv = 0;
+ __try {
+ rv = Real_GetAsyncKeyState(a0);
+ } __finally {
+ _PrintExit("GetAsyncKeyState() -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetAtomNameA(ATOM a0,
+ LPSTR a1,
+ int a2)
+{
+ _PrintEnter("GetAtomNameA(%p,%p,%p)\n", a0, a1, a2);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetAtomNameA(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetAtomNameA(,%hs,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetAtomNameW(ATOM a0,
+ LPWSTR a1,
+ int a2)
+{
+ _PrintEnter("GetAtomNameW(%p,%p,%p)\n", a0, a1, a2);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetAtomNameW(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetAtomNameW(,%ls,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetBinaryTypeA(LPCSTR a0,
+ LPDWORD a1)
+{
+ _PrintEnter("GetBinaryTypeA(%hs,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetBinaryTypeA(a0, a1);
+ } __finally {
+ _PrintExit("GetBinaryTypeA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetBinaryTypeW(LPCWSTR a0,
+ LPDWORD a1)
+{
+ _PrintEnter("GetBinaryTypeW(%ls,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetBinaryTypeW(a0, a1);
+ } __finally {
+ _PrintExit("GetBinaryTypeW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LONG __stdcall Mine_GetBitmapBits(HBITMAP a0,
+ LONG a1,
+ LPVOID a2)
+{
+ _PrintEnter("GetBitmapBits(%p,%p,%p)\n", a0, a1, a2);
+
+ LONG rv = 0;
+ __try {
+ rv = Real_GetBitmapBits(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetBitmapBits(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetBitmapDimensionEx(HBITMAP a0,
+ SIZE* a1)
+{
+ _PrintEnter("GetBitmapDimensionEx(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetBitmapDimensionEx(a0, a1);
+ } __finally {
+ _PrintExit("GetBitmapDimensionEx(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+COLORREF __stdcall Mine_GetBkColor(HDC a0)
+{
+ _PrintEnter("GetBkColor(%p)\n", a0);
+
+ COLORREF rv = 0;
+ __try {
+ rv = Real_GetBkColor(a0);
+ } __finally {
+ _PrintExit("GetBkColor() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetBkMode(HDC a0)
+{
+ _PrintEnter("GetBkMode(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetBkMode(a0);
+ } __finally {
+ _PrintExit("GetBkMode() -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetBoundsRect(HDC a0,
+ LPRECT a1,
+ UINT a2)
+{
+ _PrintEnter("GetBoundsRect(%p,%p,%p)\n", a0, a1, a2);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetBoundsRect(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetBoundsRect(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetBrushOrgEx(HDC a0,
+ POINT* a1)
+{
+ _PrintEnter("GetBrushOrgEx(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetBrushOrgEx(a0, a1);
+ } __finally {
+ _PrintExit("GetBrushOrgEx(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetCPInfo(UINT a0,
+ LPCPINFO a1)
+{
+ _PrintEnter("GetCPInfo(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetCPInfo(a0, a1);
+ } __finally {
+ _PrintExit("GetCPInfo(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_GetCapture(void)
+{
+ _PrintEnter("GetCapture()\n");
+
+ HWND rv = 0;
+ __try {
+ rv = Real_GetCapture();
+ } __finally {
+ _PrintExit("GetCapture() -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetCaretBlinkTime(void)
+{
+ _PrintEnter("GetCaretBlinkTime()\n");
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetCaretBlinkTime();
+ } __finally {
+ _PrintExit("GetCaretBlinkTime() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetCaretPos(POINT* a0)
+{
+ _PrintEnter("GetCaretPos(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetCaretPos(a0);
+ } __finally {
+ _PrintExit("GetCaretPos() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetCharABCWidthsA(HDC a0,
+ UINT a1,
+ UINT a2,
+ LPABC a3)
+{
+ _PrintEnter("GetCharABCWidthsA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetCharABCWidthsA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetCharABCWidthsA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetCharABCWidthsFloatA(HDC a0,
+ UINT a1,
+ UINT a2,
+ LPABCFLOAT a3)
+{
+ _PrintEnter("GetCharABCWidthsFloatA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetCharABCWidthsFloatA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetCharABCWidthsFloatA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetCharABCWidthsFloatW(HDC a0,
+ UINT a1,
+ UINT a2,
+ LPABCFLOAT a3)
+{
+ _PrintEnter("GetCharABCWidthsFloatW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetCharABCWidthsFloatW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetCharABCWidthsFloatW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetCharABCWidthsW(HDC a0,
+ UINT a1,
+ UINT a2,
+ LPABC a3)
+{
+ _PrintEnter("GetCharABCWidthsW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetCharABCWidthsW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetCharABCWidthsW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetCharWidth32A(HDC a0,
+ UINT a1,
+ UINT a2,
+ LPINT a3)
+{
+ _PrintEnter("GetCharWidth32A(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetCharWidth32A(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetCharWidth32A(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetCharWidth32W(HDC a0,
+ UINT a1,
+ UINT a2,
+ LPINT a3)
+{
+ _PrintEnter("GetCharWidth32W(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetCharWidth32W(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetCharWidth32W(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetCharWidthA(HDC a0,
+ UINT a1,
+ UINT a2,
+ LPINT a3)
+{
+ _PrintEnter("GetCharWidthA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetCharWidthA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetCharWidthA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetCharWidthFloatA(HDC a0,
+ UINT a1,
+ UINT a2,
+ PFLOAT a3)
+{
+ _PrintEnter("GetCharWidthFloatA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetCharWidthFloatA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetCharWidthFloatA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetCharWidthFloatW(HDC a0,
+ UINT a1,
+ UINT a2,
+ PFLOAT a3)
+{
+ _PrintEnter("GetCharWidthFloatW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetCharWidthFloatW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetCharWidthFloatW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetCharWidthW(HDC a0,
+ UINT a1,
+ UINT a2,
+ LPINT a3)
+{
+ _PrintEnter("GetCharWidthW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetCharWidthW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetCharWidthW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetCharacterPlacementA(HDC a0,
+ LPCSTR a1,
+ int a2,
+ int a3,
+ LPGCP_RESULTSA a4,
+ DWORD a5)
+{
+ _PrintEnter("GetCharacterPlacementA(%p,%hs,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetCharacterPlacementA(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("GetCharacterPlacementA(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetCharacterPlacementW(HDC a0,
+ LPCWSTR a1,
+ int a2,
+ int a3,
+ LPGCP_RESULTSW a4,
+ DWORD a5)
+{
+ _PrintEnter("GetCharacterPlacementW(%p,%ls,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetCharacterPlacementW(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("GetCharacterPlacementW(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_GetClassFile(LPCOLESTR a0,
+ CLSID* a1)
+{
+ _PrintEnter("GetClassFile(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_GetClassFile(a0, a1);
+ } __finally {
+ _PrintExit("GetClassFile(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetClassInfoA(HINSTANCE a0,
+ LPCSTR a1,
+ LPWNDCLASSA a2)
+{
+ _PrintEnter("GetClassInfoA(%p,%hs,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetClassInfoA(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetClassInfoA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetClassInfoExA(HINSTANCE a0,
+ LPCSTR a1,
+ LPWNDCLASSEXA a2)
+{
+ _PrintEnter("GetClassInfoExA(%p,%hs,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetClassInfoExA(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetClassInfoExA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetClassInfoExW(HINSTANCE a0,
+ LPCWSTR a1,
+ LPWNDCLASSEXW a2)
+{
+ _PrintEnter("GetClassInfoExW(%p,%ls,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetClassInfoExW(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetClassInfoExW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetClassInfoW(HINSTANCE a0,
+ LPCWSTR a1,
+ LPWNDCLASSW a2)
+{
+ _PrintEnter("GetClassInfoW(%p,%ls,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetClassInfoW(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetClassInfoW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetClassLongA(HWND a0,
+ int a1)
+{
+ _PrintEnter("GetClassLongA(%p,%p)\n", a0, a1);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetClassLongA(a0, a1);
+ } __finally {
+ _PrintExit("GetClassLongA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetClassLongW(HWND a0,
+ int a1)
+{
+ _PrintEnter("GetClassLongW(%p,%p)\n", a0, a1);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetClassLongW(a0, a1);
+ } __finally {
+ _PrintExit("GetClassLongW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetClassNameA(HWND a0,
+ LPSTR a1,
+ int a2)
+{
+ _PrintEnter("GetClassNameA(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetClassNameA(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetClassNameA(,%hs,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetClassNameW(HWND a0,
+ LPWSTR a1,
+ int a2)
+{
+ _PrintEnter("GetClassNameW(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetClassNameW(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetClassNameW(,%ls,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+WORD __stdcall Mine_GetClassWord(HWND a0,
+ int a1)
+{
+ _PrintEnter("GetClassWord(%p,%p)\n", a0, a1);
+
+ WORD rv = 0;
+ __try {
+ rv = Real_GetClassWord(a0, a1);
+ } __finally {
+ _PrintExit("GetClassWord(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetClientRect(HWND a0,
+ LPRECT a1)
+{
+ _PrintEnter("GetClientRect(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetClientRect(a0, a1);
+ } __finally {
+ _PrintExit("GetClientRect(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetClipBox(HDC a0,
+ LPRECT a1)
+{
+ _PrintEnter("GetClipBox(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetClipBox(a0, a1);
+ } __finally {
+ _PrintExit("GetClipBox(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetClipCursor(LPRECT a0)
+{
+ _PrintEnter("GetClipCursor(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetClipCursor(a0);
+ } __finally {
+ _PrintExit("GetClipCursor() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetClipRgn(HDC a0,
+ HRGN a1)
+{
+ _PrintEnter("GetClipRgn(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetClipRgn(a0, a1);
+ } __finally {
+ _PrintExit("GetClipRgn(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_GetClipboardData(UINT a0)
+{
+ _PrintEnter("GetClipboardData(%p)\n", a0);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_GetClipboardData(a0);
+ } __finally {
+ _PrintExit("GetClipboardData() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetClipboardFormatNameA(UINT a0,
+ LPSTR a1,
+ int a2)
+{
+ _PrintEnter("GetClipboardFormatNameA(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetClipboardFormatNameA(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetClipboardFormatNameA(,%hs,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetClipboardFormatNameW(UINT a0,
+ LPWSTR a1,
+ int a2)
+{
+ _PrintEnter("GetClipboardFormatNameW(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetClipboardFormatNameW(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetClipboardFormatNameW(,%ls,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_GetClipboardOwner(void)
+{
+ _PrintEnter("GetClipboardOwner()\n");
+
+ HWND rv = 0;
+ __try {
+ rv = Real_GetClipboardOwner();
+ } __finally {
+ _PrintExit("GetClipboardOwner() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_GetClipboardViewer(void)
+{
+ _PrintEnter("GetClipboardViewer()\n");
+
+ HWND rv = 0;
+ __try {
+ rv = Real_GetClipboardViewer();
+ } __finally {
+ _PrintExit("GetClipboardViewer() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetColorAdjustment(HDC a0,
+ LPCOLORADJUSTMENT a1)
+{
+ _PrintEnter("GetColorAdjustment(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetColorAdjustment(a0, a1);
+ } __finally {
+ _PrintExit("GetColorAdjustment(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HCOLORSPACE __stdcall Mine_GetColorSpace(HDC a0)
+{
+ _PrintEnter("GetColorSpace(%p)\n", a0);
+
+ HCOLORSPACE rv = 0;
+ __try {
+ rv = Real_GetColorSpace(a0);
+ } __finally {
+ _PrintExit("GetColorSpace() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetCommConfig(HANDLE a0,
+ LPCOMMCONFIG a1,
+ LPDWORD a2)
+{
+ _PrintEnter("GetCommConfig(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetCommConfig(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetCommConfig(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetCommMask(HANDLE a0,
+ LPDWORD a1)
+{
+ _PrintEnter("GetCommMask(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetCommMask(a0, a1);
+ } __finally {
+ _PrintExit("GetCommMask(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetCommModemStatus(HANDLE a0,
+ LPDWORD a1)
+{
+ _PrintEnter("GetCommModemStatus(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetCommModemStatus(a0, a1);
+ } __finally {
+ _PrintExit("GetCommModemStatus(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetCommProperties(HANDLE a0,
+ LPCOMMPROP a1)
+{
+ _PrintEnter("GetCommProperties(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetCommProperties(a0, a1);
+ } __finally {
+ _PrintExit("GetCommProperties(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetCommState(HANDLE a0,
+ LPDCB a1)
+{
+ _PrintEnter("GetCommState(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetCommState(a0, a1);
+ } __finally {
+ _PrintExit("GetCommState(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetCommTimeouts(HANDLE a0,
+ LPCOMMTIMEOUTS a1)
+{
+ _PrintEnter("GetCommTimeouts(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetCommTimeouts(a0, a1);
+ } __finally {
+ _PrintExit("GetCommTimeouts(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LPSTR __stdcall Mine_GetCommandLineA(void)
+{
+ _PrintEnter("GetCommandLineA()\n");
+
+ LPSTR rv = 0;
+ __try {
+ rv = Real_GetCommandLineA();
+ } __finally {
+ _PrintExit("GetCommandLineA() -> %hs\n", rv);
+ };
+ return rv;
+}
+
+LPWSTR __stdcall Mine_GetCommandLineW(void)
+{
+ _PrintEnter("GetCommandLineW()\n");
+
+ LPWSTR rv = 0;
+ __try {
+ rv = Real_GetCommandLineW();
+ } __finally {
+ _PrintExit("GetCommandLineW() -> %ls\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetComputerNameA(LPSTR a0,
+ LPDWORD a1)
+{
+ _PrintEnter("GetComputerNameA(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetComputerNameA(a0, a1);
+ } __finally {
+ _PrintExit("GetComputerNameA(%hs,) -> %p\n", a0, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetComputerNameW(LPWSTR a0,
+ LPDWORD a1)
+{
+ _PrintEnter("GetComputerNameW(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetComputerNameW(a0, a1);
+ } __finally {
+ _PrintExit("GetComputerNameW(%ls,) -> %p\n", a0, rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetConsoleCP(void)
+{
+ _PrintEnter("GetConsoleCP()\n");
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetConsoleCP();
+ } __finally {
+ _PrintExit("GetConsoleCP() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetConsoleCursorInfo(HANDLE a0,
+ PCONSOLE_CURSOR_INFO a1)
+{
+ _PrintEnter("GetConsoleCursorInfo(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetConsoleCursorInfo(a0, a1);
+ } __finally {
+ _PrintExit("GetConsoleCursorInfo(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetConsoleMode(HANDLE a0,
+ LPDWORD a1)
+{
+ _PrintEnter("GetConsoleMode(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetConsoleMode(a0, a1);
+ } __finally {
+ _PrintExit("GetConsoleMode(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetConsoleOutputCP(void)
+{
+ _PrintEnter("GetConsoleOutputCP()\n");
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetConsoleOutputCP();
+ } __finally {
+ _PrintExit("GetConsoleOutputCP() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetConsoleScreenBufferInfo(HANDLE a0,
+ PCONSOLE_SCREEN_BUFFER_INFO a1)
+{
+ _PrintEnter("GetConsoleScreenBufferInfo(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetConsoleScreenBufferInfo(a0, a1);
+ } __finally {
+ _PrintExit("GetConsoleScreenBufferInfo(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetConsoleTitleA(LPSTR a0,
+ DWORD a1)
+{
+ _PrintEnter("GetConsoleTitleA(%p,%p)\n", a0, a1);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetConsoleTitleA(a0, a1);
+ } __finally {
+ _PrintExit("GetConsoleTitleA(%hs,) -> %p\n", a0, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetConsoleTitleW(LPWSTR a0,
+ DWORD a1)
+{
+ _PrintEnter("GetConsoleTitleW(%p,%p)\n", a0, a1);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetConsoleTitleW(a0, a1);
+ } __finally {
+ _PrintExit("GetConsoleTitleW(%ls,) -> %p\n", a0, rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_GetConvertStg(LPSTORAGE a0)
+{
+ _PrintEnter("GetConvertStg(%p)\n", a0);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_GetConvertStg(a0);
+ } __finally {
+ _PrintExit("GetConvertStg() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetCurrencyFormatA(LCID a0,
+ DWORD a1,
+ LPCSTR a2,
+ CURRENCYFMTA* a3,
+ LPSTR a4,
+ int a5)
+{
+ _PrintEnter("GetCurrencyFormatA(%p,%p,%hs,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetCurrencyFormatA(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("GetCurrencyFormatA(,,,,%hs,) -> %p\n", a4, rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetCurrencyFormatW(LCID a0,
+ DWORD a1,
+ LPCWSTR a2,
+ CURRENCYFMTW* a3,
+ LPWSTR a4,
+ int a5)
+{
+ _PrintEnter("GetCurrencyFormatW(%p,%p,%ls,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetCurrencyFormatW(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("GetCurrencyFormatW(,,,,%ls,) -> %p\n", a4, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetCurrentDirectoryA(DWORD a0,
+ LPSTR a1)
+{
+ _PrintEnter("GetCurrentDirectoryA(%p,%p)\n", a0, a1);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetCurrentDirectoryA(a0, a1);
+ } __finally {
+ _PrintExit("GetCurrentDirectoryA(,%hs) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetCurrentDirectoryW(DWORD a0,
+ LPWSTR a1)
+{
+ _PrintEnter("GetCurrentDirectoryW(%p,%p)\n", a0, a1);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetCurrentDirectoryW(a0, a1);
+ } __finally {
+ _PrintExit("GetCurrentDirectoryW(,%ls) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+HGDIOBJ __stdcall Mine_GetCurrentObject(HDC a0,
+ UINT a1)
+{
+ _PrintEnter("GetCurrentObject(%p,%p)\n", a0, a1);
+
+ HGDIOBJ rv = 0;
+ __try {
+ rv = Real_GetCurrentObject(a0, a1);
+ } __finally {
+ _PrintExit("GetCurrentObject(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetCurrentPositionEx(HDC a0,
+ POINT* a1)
+{
+ _PrintEnter("GetCurrentPositionEx(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetCurrentPositionEx(a0, a1);
+ } __finally {
+ _PrintExit("GetCurrentPositionEx(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_GetCurrentProcess(void)
+{
+ _PrintEnter("GetCurrentProcess()\n");
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_GetCurrentProcess();
+ } __finally {
+ _PrintExit("GetCurrentProcess() -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetCurrentProcessId(void)
+{
+ _PrintEnter("GetCurrentProcessId()\n");
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetCurrentProcessId();
+ } __finally {
+ _PrintExit("GetCurrentProcessId() -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetCurrentThreadId(void)
+{
+ _PrintEnter("GetCurrentThreadId()\n");
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetCurrentThreadId();
+ } __finally {
+ _PrintExit("GetCurrentThreadId() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HCURSOR __stdcall Mine_GetCursor(void)
+{
+ _PrintEnter("GetCursor()\n");
+
+ HCURSOR rv = 0;
+ __try {
+ rv = Real_GetCursor();
+ } __finally {
+ _PrintExit("GetCursor() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetCursorPos(POINT* a0)
+{
+ _PrintEnter("GetCursorPos(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetCursorPos(a0);
+ } __finally {
+ _PrintExit("GetCursorPos() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HDC __stdcall Mine_GetDC(HWND a0)
+{
+ _PrintEnter("GetDC(%p)\n", a0);
+
+ HDC rv = 0;
+ __try {
+ rv = Real_GetDC(a0);
+ } __finally {
+ _PrintExit("GetDC() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HDC __stdcall Mine_GetDCEx(HWND a0,
+ HRGN a1,
+ DWORD a2)
+{
+ _PrintEnter("GetDCEx(%p,%p,%p)\n", a0, a1, a2);
+
+ HDC rv = 0;
+ __try {
+ rv = Real_GetDCEx(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetDCEx(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetDCOrgEx(HDC a0,
+ POINT* a1)
+{
+ _PrintEnter("GetDCOrgEx(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetDCOrgEx(a0, a1);
+ } __finally {
+ _PrintExit("GetDCOrgEx(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetDIBColorTable(HDC a0,
+ UINT a1,
+ UINT a2,
+ RGBQUAD* a3)
+{
+ _PrintEnter("GetDIBColorTable(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetDIBColorTable(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetDIBColorTable(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetDIBits(HDC a0,
+ HBITMAP a1,
+ UINT a2,
+ UINT a3,
+ LPVOID a4,
+ LPBITMAPINFO a5,
+ UINT a6)
+{
+ _PrintEnter("GetDIBits(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetDIBits(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("GetDIBits(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetDateFormatA(LCID a0,
+ DWORD a1,
+ SYSTEMTIME* a2,
+ LPCSTR a3,
+ LPSTR a4,
+ int a5)
+{
+ _PrintEnter("GetDateFormatA(%p,%p,%p,%hs,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetDateFormatA(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("GetDateFormatA(,,,,%hs,) -> %p\n", a4, rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetDateFormatW(LCID a0,
+ DWORD a1,
+ SYSTEMTIME* a2,
+ LPCWSTR a3,
+ LPWSTR a4,
+ int a5)
+{
+ _PrintEnter("GetDateFormatW(%p,%p,%p,%ls,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetDateFormatW(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("GetDateFormatW(,,,,%ls,) -> %p\n", a4, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetDefaultCommConfigA(LPCSTR a0,
+ LPCOMMCONFIG a1,
+ LPDWORD a2)
+{
+ _PrintEnter("GetDefaultCommConfigA(%hs,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetDefaultCommConfigA(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetDefaultCommConfigA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetDefaultCommConfigW(LPCWSTR a0,
+ LPCOMMCONFIG a1,
+ LPDWORD a2)
+{
+ _PrintEnter("GetDefaultCommConfigW(%ls,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetDefaultCommConfigW(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetDefaultCommConfigW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_GetDesktopWindow(void)
+{
+ _PrintEnter("GetDesktopWindow()\n");
+
+ HWND rv = 0;
+ __try {
+ rv = Real_GetDesktopWindow();
+ } __finally {
+ _PrintExit("GetDesktopWindow() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetDeviceCaps(HDC a0,
+ int a1)
+{
+ _PrintEnter("GetDeviceCaps(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetDeviceCaps(a0, a1);
+ } __finally {
+ _PrintExit("GetDeviceCaps(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetDeviceGammaRamp(HDC a0,
+ LPVOID a1)
+{
+ _PrintEnter("GetDeviceGammaRamp(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetDeviceGammaRamp(a0, a1);
+ } __finally {
+ _PrintExit("GetDeviceGammaRamp(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+long __stdcall Mine_GetDialogBaseUnits(void)
+{
+ _PrintEnter("GetDialogBaseUnits()\n");
+
+ long rv = 0;
+ __try {
+ rv = Real_GetDialogBaseUnits();
+ } __finally {
+ _PrintExit("GetDialogBaseUnits() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetDiskFreeSpaceA(LPCSTR a0,
+ LPDWORD a1,
+ LPDWORD a2,
+ LPDWORD a3,
+ LPDWORD a4)
+{
+ _PrintEnter("GetDiskFreeSpaceA(%hs,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetDiskFreeSpaceA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("GetDiskFreeSpaceA(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetDiskFreeSpaceExA(LPCSTR a0,
+ union _ULARGE_INTEGER* a1,
+ union _ULARGE_INTEGER* a2,
+ union _ULARGE_INTEGER* a3)
+{
+ _PrintEnter("GetDiskFreeSpaceExA(%hs,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetDiskFreeSpaceExA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetDiskFreeSpaceExA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetDiskFreeSpaceExW(LPCWSTR a0,
+ union _ULARGE_INTEGER* a1,
+ union _ULARGE_INTEGER* a2,
+ union _ULARGE_INTEGER* a3)
+{
+ _PrintEnter("GetDiskFreeSpaceExW(%ls,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetDiskFreeSpaceExW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetDiskFreeSpaceExW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetDiskFreeSpaceW(LPCWSTR a0,
+ LPDWORD a1,
+ LPDWORD a2,
+ LPDWORD a3,
+ LPDWORD a4)
+{
+ _PrintEnter("GetDiskFreeSpaceW(%ls,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetDiskFreeSpaceW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("GetDiskFreeSpaceW(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetDlgCtrlID(HWND a0)
+{
+ _PrintEnter("GetDlgCtrlID(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetDlgCtrlID(a0);
+ } __finally {
+ _PrintExit("GetDlgCtrlID() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_GetDlgItem(HWND a0,
+ int a1)
+{
+ _PrintEnter("GetDlgItem(%p,%p)\n", a0, a1);
+
+ HWND rv = 0;
+ __try {
+ rv = Real_GetDlgItem(a0, a1);
+ } __finally {
+ _PrintExit("GetDlgItem(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetDlgItemInt(HWND a0,
+ int a1,
+ BOOL* a2,
+ BOOL a3)
+{
+ _PrintEnter("GetDlgItemInt(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetDlgItemInt(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetDlgItemInt(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetDlgItemTextA(HWND a0,
+ int a1,
+ LPSTR a2,
+ int a3)
+{
+ _PrintEnter("GetDlgItemTextA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetDlgItemTextA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetDlgItemTextA(,,%hs,) -> %p\n", a2, rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetDlgItemTextW(HWND a0,
+ int a1,
+ LPWSTR a2,
+ int a3)
+{
+ _PrintEnter("GetDlgItemTextW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetDlgItemTextW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetDlgItemTextW(,,%ls,) -> %p\n", a2, rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetDoubleClickTime(void)
+{
+ _PrintEnter("GetDoubleClickTime()\n");
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetDoubleClickTime();
+ } __finally {
+ _PrintExit("GetDoubleClickTime() -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetDriveTypeA(LPCSTR a0)
+{
+ _PrintEnter("GetDriveTypeA(%hs)\n", a0);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetDriveTypeA(a0);
+ } __finally {
+ _PrintExit("GetDriveTypeA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetDriveTypeW(LPCWSTR a0)
+{
+ _PrintEnter("GetDriveTypeW(%ls)\n", a0);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetDriveTypeW(a0);
+ } __finally {
+ _PrintExit("GetDriveTypeW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HENHMETAFILE __stdcall Mine_GetEnhMetaFileA(LPCSTR a0)
+{
+ _PrintEnter("GetEnhMetaFileA(%hs)\n", a0);
+
+ HENHMETAFILE rv = 0;
+ __try {
+ rv = Real_GetEnhMetaFileA(a0);
+ } __finally {
+ _PrintExit("GetEnhMetaFileA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetEnhMetaFileBits(HENHMETAFILE a0,
+ UINT a1,
+ LPBYTE a2)
+{
+ _PrintEnter("GetEnhMetaFileBits(%p,%p,%p)\n", a0, a1, a2);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetEnhMetaFileBits(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetEnhMetaFileBits(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetEnhMetaFileDescriptionA(HENHMETAFILE a0,
+ UINT a1,
+ LPSTR a2)
+{
+ _PrintEnter("GetEnhMetaFileDescriptionA(%p,%p,%p)\n", a0, a1, a2);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetEnhMetaFileDescriptionA(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetEnhMetaFileDescriptionA(,,%hs) -> %p\n", a2, rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetEnhMetaFileDescriptionW(HENHMETAFILE a0,
+ UINT a1,
+ LPWSTR a2)
+{
+ _PrintEnter("GetEnhMetaFileDescriptionW(%p,%p,%p)\n", a0, a1, a2);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetEnhMetaFileDescriptionW(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetEnhMetaFileDescriptionW(,,%ls) -> %p\n", a2, rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetEnhMetaFileHeader(HENHMETAFILE a0,
+ UINT a1,
+ ENHMETAHEADER* a2)
+{
+ _PrintEnter("GetEnhMetaFileHeader(%p,%p,%p)\n", a0, a1, a2);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetEnhMetaFileHeader(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetEnhMetaFileHeader(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetEnhMetaFilePaletteEntries(HENHMETAFILE a0,
+ UINT a1,
+ PALETTEENTRY* a2)
+{
+ _PrintEnter("GetEnhMetaFilePaletteEntries(%p,%p,%p)\n", a0, a1, a2);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetEnhMetaFilePaletteEntries(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetEnhMetaFilePaletteEntries(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetEnhMetaFilePixelFormat(HENHMETAFILE a0,
+ UINT a1,
+ PIXELFORMATDESCRIPTOR* a2)
+{
+ _PrintEnter("GetEnhMetaFilePixelFormat(%p,%p,%p)\n", a0, a1, a2);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetEnhMetaFilePixelFormat(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetEnhMetaFilePixelFormat(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HENHMETAFILE __stdcall Mine_GetEnhMetaFileW(LPCWSTR a0)
+{
+ _PrintEnter("GetEnhMetaFileW(%ls)\n", a0);
+
+ HENHMETAFILE rv = 0;
+ __try {
+ rv = Real_GetEnhMetaFileW(a0);
+ } __finally {
+ _PrintExit("GetEnhMetaFileW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+LPSTR __stdcall Mine_GetEnvironmentStrings(void)
+{
+ _PrintEnter("GetEnvironmentStrings()\n");
+
+ LPSTR rv = 0;
+ __try {
+ rv = Real_GetEnvironmentStrings();
+ } __finally {
+ _PrintExit("GetEnvironmentStrings() -> %hs\n", rv);
+ };
+ return rv;
+}
+
+LPWSTR __stdcall Mine_GetEnvironmentStringsW(void)
+{
+ _PrintEnter("GetEnvironmentStringsW()\n");
+
+ LPWSTR rv = 0;
+ __try {
+ rv = Real_GetEnvironmentStringsW();
+ } __finally {
+ _PrintExit("GetEnvironmentStringsW() -> %ls\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetEnvironmentVariableA(LPCSTR a0,
+ LPSTR a1,
+ DWORD a2)
+{
+ _PrintEnter("GetEnvironmentVariableA(%hs,%p,%p)\n", a0, a1, a2);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetEnvironmentVariableA(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetEnvironmentVariableA(,%hs,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetEnvironmentVariableW(LPCWSTR a0,
+ LPWSTR a1,
+ DWORD a2)
+{
+ _PrintEnter("GetEnvironmentVariableW(%ls,%p,%p)\n", a0, a1, a2);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetEnvironmentVariableW(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetEnvironmentVariableW(,%ls,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetExitCodeProcess(HANDLE a0,
+ LPDWORD a1)
+{
+ _PrintEnter("GetExitCodeProcess(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetExitCodeProcess(a0, a1);
+ } __finally {
+ _PrintExit("GetExitCodeProcess(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetExitCodeThread(HANDLE a0,
+ LPDWORD a1)
+{
+ _PrintEnter("GetExitCodeThread(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetExitCodeThread(a0, a1);
+ } __finally {
+ _PrintExit("GetExitCodeThread(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetFileAttributesA(LPCSTR a0)
+{
+ _PrintEnter("GetFileAttributesA(%hs)\n", a0);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetFileAttributesA(a0);
+ } __finally {
+ _PrintExit("GetFileAttributesA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetFileAttributesExA(LPCSTR a0,
+ enum _GET_FILEEX_INFO_LEVELS a1,
+ LPVOID a2)
+{
+ _PrintEnter("GetFileAttributesExA(%hs,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetFileAttributesExA(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetFileAttributesExA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetFileAttributesExW(LPCWSTR a0,
+ enum _GET_FILEEX_INFO_LEVELS a1,
+ LPVOID a2)
+{
+ _PrintEnter("GetFileAttributesExW(%ls,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetFileAttributesExW(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetFileAttributesExW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetFileAttributesW(LPCWSTR a0)
+{
+ _PrintEnter("GetFileAttributesW(%ls)\n", a0);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetFileAttributesW(a0);
+ } __finally {
+ _PrintExit("GetFileAttributesW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetFileInformationByHandle(HANDLE a0,
+ LPBY_HANDLE_FILE_INFORMATION a1)
+{
+ _PrintEnter("GetFileInformationByHandle(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetFileInformationByHandle(a0, a1);
+ } __finally {
+ _PrintExit("GetFileInformationByHandle(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetFileSize(HANDLE a0,
+ LPDWORD a1)
+{
+ _PrintEnter("GetFileSize(%p,%p)\n", a0, a1);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetFileSize(a0, a1);
+ } __finally {
+ _PrintExit("GetFileSize(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetFileTime(HANDLE a0,
+ LPFILETIME a1,
+ LPFILETIME a2,
+ LPFILETIME a3)
+{
+ _PrintEnter("GetFileTime(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetFileTime(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetFileTime(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetFileType(HANDLE a0)
+{
+ _PrintEnter("GetFileType(%p)\n", a0);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetFileType(a0);
+ } __finally {
+ _PrintExit("GetFileType() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_GetFocus(void)
+{
+ _PrintEnter("GetFocus()\n");
+
+ HWND rv = 0;
+ __try {
+ rv = Real_GetFocus();
+ } __finally {
+ _PrintExit("GetFocus() -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetFontData(HDC a0,
+ DWORD a1,
+ DWORD a2,
+ LPVOID a3,
+ DWORD a4)
+{
+ _PrintEnter("GetFontData(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetFontData(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("GetFontData(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetFontLanguageInfo(HDC a0)
+{
+ _PrintEnter("GetFontLanguageInfo(%p)\n", a0);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetFontLanguageInfo(a0);
+ } __finally {
+ _PrintExit("GetFontLanguageInfo() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_GetForegroundWindow(void)
+{
+ _PrintEnter("GetForegroundWindow()\n");
+
+ HWND rv = 0;
+ __try {
+ rv = Real_GetForegroundWindow();
+ } __finally {
+ _PrintExit("GetForegroundWindow() -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetFullPathNameA(LPCSTR a0,
+ DWORD a1,
+ LPSTR a2,
+ LPSTR* a3)
+{
+ _PrintEnter("GetFullPathNameA(%hs,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetFullPathNameA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetFullPathNameA(,,%hs,) -> %p\n", a2, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetFullPathNameW(LPCWSTR a0,
+ DWORD a1,
+ LPWSTR a2,
+ LPWSTR* a3)
+{
+ _PrintEnter("GetFullPathNameW(%ls,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetFullPathNameW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetFullPathNameW(,,%ls,) -> %p\n", a2, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetGlyphOutlineA(HDC a0,
+ UINT a1,
+ UINT a2,
+ LPGLYPHMETRICS a3,
+ DWORD a4,
+ LPVOID a5,
+ MAT2* a6)
+{
+ _PrintEnter("GetGlyphOutlineA(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetGlyphOutlineA(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("GetGlyphOutlineA(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetGlyphOutlineW(HDC a0,
+ UINT a1,
+ UINT a2,
+ LPGLYPHMETRICS a3,
+ DWORD a4,
+ LPVOID a5,
+ MAT2* a6)
+{
+ _PrintEnter("GetGlyphOutlineW(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetGlyphOutlineW(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("GetGlyphOutlineW(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetGraphicsMode(HDC a0)
+{
+ _PrintEnter("GetGraphicsMode(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetGraphicsMode(a0);
+ } __finally {
+ _PrintExit("GetGraphicsMode() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_GetHGlobalFromILockBytes(ILockBytes* a0,
+ HGLOBAL* a1)
+{
+ _PrintEnter("GetHGlobalFromILockBytes(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_GetHGlobalFromILockBytes(a0, a1);
+ } __finally {
+ _PrintExit("GetHGlobalFromILockBytes(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_GetHGlobalFromStream(LPSTREAM a0,
+ HGLOBAL* a1)
+{
+ _PrintEnter("GetHGlobalFromStream(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_GetHGlobalFromStream(a0, a1);
+ } __finally {
+ _PrintExit("GetHGlobalFromStream(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetHandleInformation(HANDLE a0,
+ LPDWORD a1)
+{
+ _PrintEnter("GetHandleInformation(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetHandleInformation(a0, a1);
+ } __finally {
+ _PrintExit("GetHandleInformation(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetICMProfileA(HDC a0,
+ LPDWORD a1,
+ LPSTR a2)
+{
+ _PrintEnter("GetICMProfileA(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetICMProfileA(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetICMProfileA(,,%hs) -> %p\n", a2, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetICMProfileW(HDC a0,
+ LPDWORD a1,
+ LPWSTR a2)
+{
+ _PrintEnter("GetICMProfileW(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetICMProfileW(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetICMProfileW(,,%ls) -> %p\n", a2, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetIconInfo(HICON a0,
+ PICONINFO a1)
+{
+ _PrintEnter("GetIconInfo(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetIconInfo(a0, a1);
+ } __finally {
+ _PrintExit("GetIconInfo(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetInputState(void)
+{
+ _PrintEnter("GetInputState()\n");
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetInputState();
+ } __finally {
+ _PrintExit("GetInputState() -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetKBCodePage(void)
+{
+ _PrintEnter("GetKBCodePage()\n");
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetKBCodePage();
+ } __finally {
+ _PrintExit("GetKBCodePage() -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetKerningPairsA(HDC a0,
+ DWORD a1,
+ KERNINGPAIR* a2)
+{
+ _PrintEnter("GetKerningPairsA(%p,%p,%p)\n", a0, a1, a2);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetKerningPairsA(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetKerningPairsA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetKerningPairsW(HDC a0,
+ DWORD a1,
+ KERNINGPAIR* a2)
+{
+ _PrintEnter("GetKerningPairsW(%p,%p,%p)\n", a0, a1, a2);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetKerningPairsW(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetKerningPairsW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetKeyNameTextA(LONG a0,
+ LPSTR a1,
+ int a2)
+{
+ _PrintEnter("GetKeyNameTextA(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetKeyNameTextA(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetKeyNameTextA(,%hs,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetKeyNameTextW(LONG a0,
+ LPWSTR a1,
+ int a2)
+{
+ _PrintEnter("GetKeyNameTextW(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetKeyNameTextW(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetKeyNameTextW(,%ls,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+SHORT __stdcall Mine_GetKeyState(int a0)
+{
+ _PrintEnter("GetKeyState(%p)\n", a0);
+
+ SHORT rv = 0;
+ __try {
+ rv = Real_GetKeyState(a0);
+ } __finally {
+ _PrintExit("GetKeyState() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HKL __stdcall Mine_GetKeyboardLayout(DWORD a0)
+{
+ _PrintEnter("GetKeyboardLayout(%p)\n", a0);
+
+ HKL rv = 0;
+ __try {
+ rv = Real_GetKeyboardLayout(a0);
+ } __finally {
+ _PrintExit("GetKeyboardLayout() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetKeyboardLayoutList(int a0,
+ HKL* a1)
+{
+ _PrintEnter("GetKeyboardLayoutList(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetKeyboardLayoutList(a0, a1);
+ } __finally {
+ _PrintExit("GetKeyboardLayoutList(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetKeyboardLayoutNameA(LPSTR a0)
+{
+ _PrintEnter("GetKeyboardLayoutNameA(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetKeyboardLayoutNameA(a0);
+ } __finally {
+ _PrintExit("GetKeyboardLayoutNameA(%hs) -> %p\n", a0, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetKeyboardLayoutNameW(LPWSTR a0)
+{
+ _PrintEnter("GetKeyboardLayoutNameW(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetKeyboardLayoutNameW(a0);
+ } __finally {
+ _PrintExit("GetKeyboardLayoutNameW(%ls) -> %p\n", a0, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetKeyboardState(PBYTE a0)
+{
+ _PrintEnter("GetKeyboardState(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetKeyboardState(a0);
+ } __finally {
+ _PrintExit("GetKeyboardState() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetKeyboardType(int a0)
+{
+ _PrintEnter("GetKeyboardType(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetKeyboardType(a0);
+ } __finally {
+ _PrintExit("GetKeyboardType() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_GetLastActivePopup(HWND a0)
+{
+ _PrintEnter("GetLastActivePopup(%p)\n", a0);
+
+ HWND rv = 0;
+ __try {
+ rv = Real_GetLastActivePopup(a0);
+ } __finally {
+ _PrintExit("GetLastActivePopup() -> %p\n", rv);
+ };
+ return rv;
+}
+
+void __stdcall Mine_GetLocalTime(LPSYSTEMTIME a0)
+{
+ _PrintEnter("GetLocalTime(%p)\n", a0);
+
+ __try {
+ Real_GetLocalTime(a0);
+ } __finally {
+ _PrintExit("GetLocalTime() ->\n");
+ };
+}
+
+int __stdcall Mine_GetLocaleInfoA(LCID a0,
+ LCTYPE a1,
+ LPSTR a2,
+ int a3)
+{
+ _PrintEnter("GetLocaleInfoA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetLocaleInfoA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetLocaleInfoA(,,%hs,) -> %p\n", a2, rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetLocaleInfoW(LCID a0,
+ LCTYPE a1,
+ LPWSTR a2,
+ int a3)
+{
+ _PrintEnter("GetLocaleInfoW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetLocaleInfoW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetLocaleInfoW(,,%ls,) -> %p\n", a2, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetLogColorSpaceA(HCOLORSPACE a0,
+ LOGCOLORSPACEA* a1,
+ DWORD a2)
+{
+ _PrintEnter("GetLogColorSpaceA(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetLogColorSpaceA(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetLogColorSpaceA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetLogColorSpaceW(HCOLORSPACE a0,
+ LOGCOLORSPACEW* a1,
+ DWORD a2)
+{
+ _PrintEnter("GetLogColorSpaceW(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetLogColorSpaceW(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetLogColorSpaceW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetLogicalDriveStringsA(DWORD a0,
+ LPSTR a1)
+{
+ _PrintEnter("GetLogicalDriveStringsA(%p,%p)\n", a0, a1);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetLogicalDriveStringsA(a0, a1);
+ } __finally {
+ _PrintExit("GetLogicalDriveStringsA(,%hs) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetLogicalDriveStringsW(DWORD a0,
+ LPWSTR a1)
+{
+ _PrintEnter("GetLogicalDriveStringsW(%p,%p)\n", a0, a1);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetLogicalDriveStringsW(a0, a1);
+ } __finally {
+ _PrintExit("GetLogicalDriveStringsW(,%ls) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetLogicalDrives(void)
+{
+ _PrintEnter("GetLogicalDrives()\n");
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetLogicalDrives();
+ } __finally {
+ _PrintExit("GetLogicalDrives() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetMailslotInfo(HANDLE a0,
+ LPDWORD a1,
+ LPDWORD a2,
+ LPDWORD a3,
+ LPDWORD a4)
+{
+ _PrintEnter("GetMailslotInfo(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetMailslotInfo(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("GetMailslotInfo(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetMapMode(HDC a0)
+{
+ _PrintEnter("GetMapMode(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetMapMode(a0);
+ } __finally {
+ _PrintExit("GetMapMode() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HMENU __stdcall Mine_GetMenu(HWND a0)
+{
+ _PrintEnter("GetMenu(%p)\n", a0);
+
+ HMENU rv = 0;
+ __try {
+ rv = Real_GetMenu(a0);
+ } __finally {
+ _PrintExit("GetMenu() -> %p\n", rv);
+ };
+ return rv;
+}
+
+LONG __stdcall Mine_GetMenuCheckMarkDimensions(void)
+{
+ _PrintEnter("GetMenuCheckMarkDimensions()\n");
+
+ LONG rv = 0;
+ __try {
+ rv = Real_GetMenuCheckMarkDimensions();
+ } __finally {
+ _PrintExit("GetMenuCheckMarkDimensions() -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetMenuContextHelpId(HMENU a0)
+{
+ _PrintEnter("GetMenuContextHelpId(%p)\n", a0);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetMenuContextHelpId(a0);
+ } __finally {
+ _PrintExit("GetMenuContextHelpId() -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetMenuDefaultItem(HMENU a0,
+ UINT a1,
+ UINT a2)
+{
+ _PrintEnter("GetMenuDefaultItem(%p,%p,%p)\n", a0, a1, a2);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetMenuDefaultItem(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetMenuDefaultItem(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetMenuItemCount(HMENU a0)
+{
+ _PrintEnter("GetMenuItemCount(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetMenuItemCount(a0);
+ } __finally {
+ _PrintExit("GetMenuItemCount() -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetMenuItemID(HMENU a0,
+ int a1)
+{
+ _PrintEnter("GetMenuItemID(%p,%p)\n", a0, a1);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetMenuItemID(a0, a1);
+ } __finally {
+ _PrintExit("GetMenuItemID(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetMenuItemInfoA(HMENU a0,
+ UINT a1,
+ BOOL a2,
+ LPMENUITEMINFOA a3)
+{
+ _PrintEnter("GetMenuItemInfoA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetMenuItemInfoA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetMenuItemInfoA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetMenuItemInfoW(HMENU a0,
+ UINT a1,
+ BOOL a2,
+ LPMENUITEMINFOW a3)
+{
+ _PrintEnter("GetMenuItemInfoW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetMenuItemInfoW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetMenuItemInfoW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetMenuItemRect(HWND a0,
+ HMENU a1,
+ UINT a2,
+ LPRECT a3)
+{
+ _PrintEnter("GetMenuItemRect(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetMenuItemRect(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetMenuItemRect(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetMenuState(HMENU a0,
+ UINT a1,
+ UINT a2)
+{
+ _PrintEnter("GetMenuState(%p,%p,%p)\n", a0, a1, a2);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetMenuState(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetMenuState(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetMenuStringA(HMENU a0,
+ UINT a1,
+ LPSTR a2,
+ int a3,
+ UINT a4)
+{
+ _PrintEnter("GetMenuStringA(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetMenuStringA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("GetMenuStringA(,,%hs,,) -> %p\n", a2, rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetMenuStringW(HMENU a0,
+ UINT a1,
+ LPWSTR a2,
+ int a3,
+ UINT a4)
+{
+ _PrintEnter("GetMenuStringW(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetMenuStringW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("GetMenuStringW(,,%ls,,) -> %p\n", a2, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetMessageA(LPMSG a0,
+ HWND a1,
+ UINT a2,
+ UINT a3)
+{
+ _PrintEnter("GetMessageA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetMessageA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetMessageA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LPARAM __stdcall Mine_GetMessageExtraInfo(void)
+{
+ _PrintEnter("GetMessageExtraInfo()\n");
+
+ LPARAM rv = 0;
+ __try {
+ rv = Real_GetMessageExtraInfo();
+ } __finally {
+ _PrintExit("GetMessageExtraInfo() -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetMessagePos(void)
+{
+ _PrintEnter("GetMessagePos()\n");
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetMessagePos();
+ } __finally {
+ _PrintExit("GetMessagePos() -> %p\n", rv);
+ };
+ return rv;
+}
+
+LONG __stdcall Mine_GetMessageTime(void)
+{
+ _PrintEnter("GetMessageTime()\n");
+
+ LONG rv = 0;
+ __try {
+ rv = Real_GetMessageTime();
+ } __finally {
+ _PrintExit("GetMessageTime() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetMessageW(LPMSG a0,
+ HWND a1,
+ UINT a2,
+ UINT a3)
+{
+ _PrintEnter("GetMessageW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetMessageW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetMessageW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HMETAFILE __stdcall Mine_GetMetaFileA(LPCSTR a0)
+{
+ _PrintEnter("GetMetaFileA(%hs)\n", a0);
+
+ HMETAFILE rv = 0;
+ __try {
+ rv = Real_GetMetaFileA(a0);
+ } __finally {
+ _PrintExit("GetMetaFileA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetMetaFileBitsEx(HMETAFILE a0,
+ UINT a1,
+ LPVOID a2)
+{
+ _PrintEnter("GetMetaFileBitsEx(%p,%p,%p)\n", a0, a1, a2);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetMetaFileBitsEx(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetMetaFileBitsEx(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HMETAFILE __stdcall Mine_GetMetaFileW(LPCWSTR a0)
+{
+ _PrintEnter("GetMetaFileW(%ls)\n", a0);
+
+ HMETAFILE rv = 0;
+ __try {
+ rv = Real_GetMetaFileW(a0);
+ } __finally {
+ _PrintExit("GetMetaFileW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetMetaRgn(HDC a0,
+ HRGN a1)
+{
+ _PrintEnter("GetMetaRgn(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetMetaRgn(a0, a1);
+ } __finally {
+ _PrintExit("GetMetaRgn(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetMiterLimit(HDC a0,
+ PFLOAT a1)
+{
+ _PrintEnter("GetMiterLimit(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetMiterLimit(a0, a1);
+ } __finally {
+ _PrintExit("GetMiterLimit(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetModuleFileNameA(HMODULE a0,
+ LPSTR a1,
+ DWORD a2)
+{
+ _PrintEnter("GetModuleFileNameA(%p,%p,%p)\n", a0, a1, a2);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetModuleFileNameA(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetModuleFileNameA(,%hs,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetModuleFileNameW(HMODULE a0,
+ LPWSTR a1,
+ DWORD a2)
+{
+ _PrintEnter("GetModuleFileNameW(%p,%p,%p)\n", a0, a1, a2);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetModuleFileNameW(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetModuleFileNameW(,%ls,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+HMODULE __stdcall Mine_GetModuleHandleA(LPCSTR a0)
+{
+ _PrintEnter("GetModuleHandleA(%hs)\n", a0);
+
+ HMODULE rv = 0;
+ __try {
+ rv = Real_GetModuleHandleA(a0);
+ } __finally {
+ _PrintExit("GetModuleHandleA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HMODULE __stdcall Mine_GetModuleHandleW(LPCWSTR a0)
+{
+ _PrintEnter("GetModuleHandleW(%ls)\n", a0);
+
+ HMODULE rv = 0;
+ __try {
+ rv = Real_GetModuleHandleW(a0);
+ } __finally {
+ _PrintExit("GetModuleHandleW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetNamedPipeHandleStateA(HANDLE a0,
+ LPDWORD a1,
+ LPDWORD a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPSTR a5,
+ DWORD a6)
+{
+ _PrintEnter("GetNamedPipeHandleStateA(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetNamedPipeHandleStateA(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("GetNamedPipeHandleStateA(,,,,,%hs,) -> %p\n", a5, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetNamedPipeHandleStateW(HANDLE a0,
+ LPDWORD a1,
+ LPDWORD a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPWSTR a5,
+ DWORD a6)
+{
+ _PrintEnter("GetNamedPipeHandleStateW(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetNamedPipeHandleStateW(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("GetNamedPipeHandleStateW(,,,,,%ls,) -> %p\n", a5, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetNamedPipeInfo(HANDLE a0,
+ LPDWORD a1,
+ LPDWORD a2,
+ LPDWORD a3,
+ LPDWORD a4)
+{
+ _PrintEnter("GetNamedPipeInfo(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetNamedPipeInfo(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("GetNamedPipeInfo(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+COLORREF __stdcall Mine_GetNearestColor(HDC a0,
+ COLORREF a1)
+{
+ _PrintEnter("GetNearestColor(%p,%p)\n", a0, a1);
+
+ COLORREF rv = 0;
+ __try {
+ rv = Real_GetNearestColor(a0, a1);
+ } __finally {
+ _PrintExit("GetNearestColor(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetNearestPaletteIndex(HPALETTE a0,
+ COLORREF a1)
+{
+ _PrintEnter("GetNearestPaletteIndex(%p,%p)\n", a0, a1);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetNearestPaletteIndex(a0, a1);
+ } __finally {
+ _PrintExit("GetNearestPaletteIndex(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_GetNextDlgGroupItem(HWND a0,
+ HWND a1,
+ BOOL a2)
+{
+ _PrintEnter("GetNextDlgGroupItem(%p,%p,%p)\n", a0, a1, a2);
+
+ HWND rv = 0;
+ __try {
+ rv = Real_GetNextDlgGroupItem(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetNextDlgGroupItem(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_GetNextDlgTabItem(HWND a0,
+ HWND a1,
+ BOOL a2)
+{
+ _PrintEnter("GetNextDlgTabItem(%p,%p,%p)\n", a0, a1, a2);
+
+ HWND rv = 0;
+ __try {
+ rv = Real_GetNextDlgTabItem(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetNextDlgTabItem(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetNumberFormatA(LCID a0,
+ DWORD a1,
+ LPCSTR a2,
+ NUMBERFMTA* a3,
+ LPSTR a4,
+ int a5)
+{
+ _PrintEnter("GetNumberFormatA(%p,%p,%hs,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetNumberFormatA(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("GetNumberFormatA(,,,,%hs,) -> %p\n", a4, rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetNumberFormatW(LCID a0,
+ DWORD a1,
+ LPCWSTR a2,
+ NUMBERFMTW* a3,
+ LPWSTR a4,
+ int a5)
+{
+ _PrintEnter("GetNumberFormatW(%p,%p,%ls,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetNumberFormatW(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("GetNumberFormatW(,,,,%ls,) -> %p\n", a4, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetNumberOfConsoleInputEvents(HANDLE a0,
+ LPDWORD a1)
+{
+ _PrintEnter("GetNumberOfConsoleInputEvents(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetNumberOfConsoleInputEvents(a0, a1);
+ } __finally {
+ _PrintExit("GetNumberOfConsoleInputEvents(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetNumberOfConsoleMouseButtons(LPDWORD a0)
+{
+ _PrintEnter("GetNumberOfConsoleMouseButtons(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetNumberOfConsoleMouseButtons(a0);
+ } __finally {
+ _PrintExit("GetNumberOfConsoleMouseButtons() -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetOEMCP(void)
+{
+ _PrintEnter("GetOEMCP()\n");
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetOEMCP();
+ } __finally {
+ _PrintExit("GetOEMCP() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetObjectA(HGDIOBJ a0,
+ int a1,
+ LPVOID a2)
+{
+ _PrintEnter("GetObjectA(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetObjectA(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetObjectA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetObjectType(HGDIOBJ a0)
+{
+ _PrintEnter("GetObjectType(%p)\n", a0);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetObjectType(a0);
+ } __finally {
+ _PrintExit("GetObjectType() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetObjectW(HGDIOBJ a0,
+ int a1,
+ LPVOID a2)
+{
+ _PrintEnter("GetObjectW(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetObjectW(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetObjectW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_GetOpenClipboardWindow(void)
+{
+ _PrintEnter("GetOpenClipboardWindow()\n");
+
+ HWND rv = 0;
+ __try {
+ rv = Real_GetOpenClipboardWindow();
+ } __finally {
+ _PrintExit("GetOpenClipboardWindow() -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetOutlineTextMetricsA(HDC a0,
+ UINT a1,
+ LPOUTLINETEXTMETRICA a2)
+{
+ _PrintEnter("GetOutlineTextMetricsA(%p,%p,%p)\n", a0, a1, a2);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetOutlineTextMetricsA(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetOutlineTextMetricsA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetOutlineTextMetricsW(HDC a0,
+ UINT a1,
+ LPOUTLINETEXTMETRICW a2)
+{
+ _PrintEnter("GetOutlineTextMetricsW(%p,%p,%p)\n", a0, a1, a2);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetOutlineTextMetricsW(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetOutlineTextMetricsW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetOverlappedResult(HANDLE a0,
+ LPOVERLAPPED a1,
+ LPDWORD a2,
+ BOOL a3)
+{
+ _PrintEnter("GetOverlappedResult(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetOverlappedResult(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetOverlappedResult(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetPaletteEntries(HPALETTE a0,
+ UINT a1,
+ UINT a2,
+ PALETTEENTRY* a3)
+{
+ _PrintEnter("GetPaletteEntries(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetPaletteEntries(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetPaletteEntries(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_GetParent(HWND a0)
+{
+ _PrintEnter("GetParent(%p)\n", a0);
+
+ HWND rv = 0;
+ __try {
+ rv = Real_GetParent(a0);
+ } __finally {
+ _PrintExit("GetParent() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetPath(HDC a0,
+ POINT* a1,
+ LPBYTE a2,
+ int a3)
+{
+ _PrintEnter("GetPath(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetPath(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetPath(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+COLORREF __stdcall Mine_GetPixel(HDC a0,
+ int a1,
+ int a2)
+{
+ _PrintEnter("GetPixel(%p,%p,%p)\n", a0, a1, a2);
+
+ COLORREF rv = 0;
+ __try {
+ rv = Real_GetPixel(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetPixel(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetPixelFormat(HDC a0)
+{
+ _PrintEnter("GetPixelFormat(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetPixelFormat(a0);
+ } __finally {
+ _PrintExit("GetPixelFormat() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetPolyFillMode(HDC a0)
+{
+ _PrintEnter("GetPolyFillMode(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetPolyFillMode(a0);
+ } __finally {
+ _PrintExit("GetPolyFillMode() -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetPriorityClass(HANDLE a0)
+{
+ _PrintEnter("GetPriorityClass(%p)\n", a0);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetPriorityClass(a0);
+ } __finally {
+ _PrintExit("GetPriorityClass() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetPriorityClipboardFormat(UINT* a0,
+ int a1)
+{
+ _PrintEnter("GetPriorityClipboardFormat(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetPriorityClipboardFormat(a0, a1);
+ } __finally {
+ _PrintExit("GetPriorityClipboardFormat(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetPrivateProfileIntA(LPCSTR a0,
+ LPCSTR a1,
+ INT a2,
+ LPCSTR a3)
+{
+ _PrintEnter("GetPrivateProfileIntA(%hs,%hs,%p,%hs)\n", a0, a1, a2, a3);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetPrivateProfileIntA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetPrivateProfileIntA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetPrivateProfileIntW(LPCWSTR a0,
+ LPCWSTR a1,
+ INT a2,
+ LPCWSTR a3)
+{
+ _PrintEnter("GetPrivateProfileIntW(%ls,%ls,%p,%ls)\n", a0, a1, a2, a3);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetPrivateProfileIntW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetPrivateProfileIntW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetPrivateProfileSectionA(LPCSTR a0,
+ LPSTR a1,
+ DWORD a2,
+ LPCSTR a3)
+{
+ _PrintEnter("GetPrivateProfileSectionA(%hs,%p,%p,%hs)\n", a0, a1, a2, a3);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetPrivateProfileSectionA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetPrivateProfileSectionA(,%hs,,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetPrivateProfileSectionNamesA(LPSTR a0,
+ DWORD a1,
+ LPCSTR a2)
+{
+ _PrintEnter("GetPrivateProfileSectionNamesA(%p,%p,%hs)\n", a0, a1, a2);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetPrivateProfileSectionNamesA(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetPrivateProfileSectionNamesA(%hs,,) -> %p\n", a0, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetPrivateProfileSectionNamesW(LPWSTR a0,
+ DWORD a1,
+ LPCWSTR a2)
+{
+ _PrintEnter("GetPrivateProfileSectionNamesW(%p,%p,%ls)\n", a0, a1, a2);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetPrivateProfileSectionNamesW(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetPrivateProfileSectionNamesW(%ls,,) -> %p\n", a0, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetPrivateProfileSectionW(LPCWSTR a0,
+ LPWSTR a1,
+ DWORD a2,
+ LPCWSTR a3)
+{
+ _PrintEnter("GetPrivateProfileSectionW(%ls,%p,%p,%ls)\n", a0, a1, a2, a3);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetPrivateProfileSectionW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetPrivateProfileSectionW(,%ls,,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetPrivateProfileStringA(LPCSTR a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ LPSTR a3,
+ DWORD a4,
+ LPCSTR a5)
+{
+ _PrintEnter("GetPrivateProfileStringA(%hs,%hs,%hs,%p,%p,%hs)\n", a0, a1, a2, a3, a4, a5);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetPrivateProfileStringA(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("GetPrivateProfileStringA(,,,%hs,,) -> %p\n", a3, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetPrivateProfileStringW(LPCWSTR a0,
+ LPCWSTR a1,
+ LPCWSTR a2,
+ LPWSTR a3,
+ DWORD a4,
+ LPCWSTR a5)
+{
+ _PrintEnter("GetPrivateProfileStringW(%ls,%ls,%ls,%p,%p,%ls)\n", a0, a1, a2, a3, a4, a5);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetPrivateProfileStringW(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("GetPrivateProfileStringW(,,,%ls,,) -> %p\n", a3, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetPrivateProfileStructA(LPCSTR a0,
+ LPCSTR a1,
+ LPVOID a2,
+ UINT a3,
+ LPCSTR a4)
+{
+ _PrintEnter("GetPrivateProfileStructA(%hs,%hs,%p,%p,%hs)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetPrivateProfileStructA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("GetPrivateProfileStructA(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetPrivateProfileStructW(LPCWSTR a0,
+ LPCWSTR a1,
+ LPVOID a2,
+ UINT a3,
+ LPCWSTR a4)
+{
+ _PrintEnter("GetPrivateProfileStructW(%ls,%ls,%p,%p,%ls)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetPrivateProfileStructW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("GetPrivateProfileStructW(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+FARPROC __stdcall Mine_GetProcAddress(HMODULE a0,
+ LPCSTR a1)
+{
+ _PrintEnter("GetProcAddress(%p,%hs)\n", a0, a1);
+
+ FARPROC rv = 0;
+ __try {
+ rv = Real_GetProcAddress(a0, a1);
+ } __finally {
+ _PrintExit("GetProcAddress(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetProcessAffinityMask(HANDLE a0,
+ PDWORD_PTR a1,
+ PDWORD_PTR a2)
+{
+ _PrintEnter("GetProcessAffinityMask(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetProcessAffinityMask(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetProcessAffinityMask(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetProcessHeaps(DWORD a0,
+ PHANDLE a1)
+{
+ _PrintEnter("GetProcessHeaps(%p,%p)\n", a0, a1);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetProcessHeaps(a0, a1);
+ } __finally {
+ _PrintExit("GetProcessHeaps(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetProcessShutdownParameters(LPDWORD a0,
+ LPDWORD a1)
+{
+ _PrintEnter("GetProcessShutdownParameters(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetProcessShutdownParameters(a0, a1);
+ } __finally {
+ _PrintExit("GetProcessShutdownParameters(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetProcessTimes(HANDLE a0,
+ LPFILETIME a1,
+ LPFILETIME a2,
+ LPFILETIME a3,
+ LPFILETIME a4)
+{
+ _PrintEnter("GetProcessTimes(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetProcessTimes(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("GetProcessTimes(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetProcessVersion(DWORD a0)
+{
+ _PrintEnter("GetProcessVersion(%p)\n", a0);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetProcessVersion(a0);
+ } __finally {
+ _PrintExit("GetProcessVersion() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWINSTA __stdcall Mine_GetProcessWindowStation(void)
+{
+ _PrintEnter("GetProcessWindowStation()\n");
+
+ HWINSTA rv = 0;
+ __try {
+ rv = Real_GetProcessWindowStation();
+ } __finally {
+ _PrintExit("GetProcessWindowStation() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetProcessWorkingSetSize(HANDLE a0,
+ PSIZE_T a1,
+ PSIZE_T a2)
+{
+ _PrintEnter("GetProcessWorkingSetSize(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetProcessWorkingSetSize(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetProcessWorkingSetSize(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetProfileIntA(LPCSTR a0,
+ LPCSTR a1,
+ INT a2)
+{
+ _PrintEnter("GetProfileIntA(%hs,%hs,%p)\n", a0, a1, a2);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetProfileIntA(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetProfileIntA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetProfileIntW(LPCWSTR a0,
+ LPCWSTR a1,
+ INT a2)
+{
+ _PrintEnter("GetProfileIntW(%ls,%ls,%p)\n", a0, a1, a2);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetProfileIntW(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetProfileIntW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetProfileSectionA(LPCSTR a0,
+ LPSTR a1,
+ DWORD a2)
+{
+ _PrintEnter("GetProfileSectionA(%hs,%p,%p)\n", a0, a1, a2);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetProfileSectionA(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetProfileSectionA(,%hs,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetProfileSectionW(LPCWSTR a0,
+ LPWSTR a1,
+ DWORD a2)
+{
+ _PrintEnter("GetProfileSectionW(%ls,%p,%p)\n", a0, a1, a2);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetProfileSectionW(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetProfileSectionW(,%ls,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetProfileStringA(LPCSTR a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ LPSTR a3,
+ DWORD a4)
+{
+ _PrintEnter("GetProfileStringA(%hs,%hs,%hs,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetProfileStringA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("GetProfileStringA(,,,%hs,) -> %p\n", a3, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetProfileStringW(LPCWSTR a0,
+ LPCWSTR a1,
+ LPCWSTR a2,
+ LPWSTR a3,
+ DWORD a4)
+{
+ _PrintEnter("GetProfileStringW(%ls,%ls,%ls,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetProfileStringW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("GetProfileStringW(,,,%ls,) -> %p\n", a3, rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_GetPropA(HWND a0,
+ LPCSTR a1)
+{
+ _PrintEnter("GetPropA(%p,%hs)\n", a0, a1);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_GetPropA(a0, a1);
+ } __finally {
+ _PrintExit("GetPropA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_GetPropW(HWND a0,
+ LPCWSTR a1)
+{
+ _PrintEnter("GetPropW(%p,%ls)\n", a0, a1);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_GetPropW(a0, a1);
+ } __finally {
+ _PrintExit("GetPropW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetQueueStatus(UINT a0)
+{
+ _PrintEnter("GetQueueStatus(%p)\n", a0);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetQueueStatus(a0);
+ } __finally {
+ _PrintExit("GetQueueStatus() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetQueuedCompletionStatus(HANDLE a0,
+ LPDWORD a1,
+ PULONG_PTR a2,
+ LPOVERLAPPED* a3,
+ DWORD a4)
+{
+ _PrintEnter("GetQueuedCompletionStatus(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetQueuedCompletionStatus(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("GetQueuedCompletionStatus(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetROP2(HDC a0)
+{
+ _PrintEnter("GetROP2(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetROP2(a0);
+ } __finally {
+ _PrintExit("GetROP2() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetRasterizerCaps(LPRASTERIZER_STATUS a0,
+ UINT a1)
+{
+ _PrintEnter("GetRasterizerCaps(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetRasterizerCaps(a0, a1);
+ } __finally {
+ _PrintExit("GetRasterizerCaps(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetRegionData(HRGN a0,
+ DWORD a1,
+ LPRGNDATA a2)
+{
+ _PrintEnter("GetRegionData(%p,%p,%p)\n", a0, a1, a2);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetRegionData(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetRegionData(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetRgnBox(HRGN a0,
+ LPRECT a1)
+{
+ _PrintEnter("GetRgnBox(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetRgnBox(a0, a1);
+ } __finally {
+ _PrintExit("GetRgnBox(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_GetRunningObjectTable(DWORD a0,
+ LPRUNNINGOBJECTTABLE* a1)
+{
+ _PrintEnter("GetRunningObjectTable(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_GetRunningObjectTable(a0, a1);
+ } __finally {
+ _PrintExit("GetRunningObjectTable(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetScrollInfo(HWND a0,
+ int a1,
+ LPSCROLLINFO a2)
+{
+ _PrintEnter("GetScrollInfo(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetScrollInfo(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetScrollInfo(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetScrollPos(HWND a0,
+ int a1)
+{
+ _PrintEnter("GetScrollPos(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetScrollPos(a0, a1);
+ } __finally {
+ _PrintExit("GetScrollPos(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetScrollRange(HWND a0,
+ int a1,
+ LPINT a2,
+ LPINT a3)
+{
+ _PrintEnter("GetScrollRange(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetScrollRange(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetScrollRange(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetShortPathNameA(LPCSTR a0,
+ LPSTR a1,
+ DWORD a2)
+{
+ _PrintEnter("GetShortPathNameA(%hs,%p,%p)\n", a0, a1, a2);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetShortPathNameA(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetShortPathNameA(,%hs,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetShortPathNameW(LPCWSTR a0,
+ LPWSTR a1,
+ DWORD a2)
+{
+ _PrintEnter("GetShortPathNameW(%ls,%p,%p)\n", a0, a1, a2);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetShortPathNameW(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetShortPathNameW(,%ls,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+void __stdcall Mine_GetStartupInfoA(LPSTARTUPINFOA a0)
+{
+ _PrintEnter("GetStartupInfoA(%p)\n", a0);
+
+ __try {
+ Real_GetStartupInfoA(a0);
+ } __finally {
+ _PrintExit("GetStartupInfoA() ->\n");
+ };
+}
+
+void __stdcall Mine_GetStartupInfoW(LPSTARTUPINFOW a0)
+{
+ _PrintEnter("GetStartupInfoW(%p)\n", a0);
+
+ __try {
+ Real_GetStartupInfoW(a0);
+ } __finally {
+ _PrintExit("GetStartupInfoW() ->\n");
+ };
+}
+
+HANDLE __stdcall Mine_GetStdHandle(DWORD a0)
+{
+ _PrintEnter("GetStdHandle(%p)\n", a0);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_GetStdHandle(a0);
+ } __finally {
+ _PrintExit("GetStdHandle() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HGDIOBJ __stdcall Mine_GetStockObject(int a0)
+{
+ _PrintEnter("GetStockObject(%p)\n", a0);
+
+ HGDIOBJ rv = 0;
+ __try {
+ rv = Real_GetStockObject(a0);
+ } __finally {
+ _PrintExit("GetStockObject() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetStretchBltMode(HDC a0)
+{
+ _PrintEnter("GetStretchBltMode(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetStretchBltMode(a0);
+ } __finally {
+ _PrintExit("GetStretchBltMode() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HMENU __stdcall Mine_GetSubMenu(HMENU a0,
+ int a1)
+{
+ _PrintEnter("GetSubMenu(%p,%p)\n", a0, a1);
+
+ HMENU rv = 0;
+ __try {
+ rv = Real_GetSubMenu(a0, a1);
+ } __finally {
+ _PrintExit("GetSubMenu(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetSysColor(int a0)
+{
+ _PrintEnter("GetSysColor(%p)\n", a0);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetSysColor(a0);
+ } __finally {
+ _PrintExit("GetSysColor() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HBRUSH __stdcall Mine_GetSysColorBrush(int a0)
+{
+ _PrintEnter("GetSysColorBrush(%p)\n", a0);
+
+ HBRUSH rv = 0;
+ __try {
+ rv = Real_GetSysColorBrush(a0);
+ } __finally {
+ _PrintExit("GetSysColorBrush() -> %p\n", rv);
+ };
+ return rv;
+}
+
+LCID __stdcall Mine_GetSystemDefaultLCID(void)
+{
+ _PrintEnter("GetSystemDefaultLCID()\n");
+
+ LCID rv = 0;
+ __try {
+ rv = Real_GetSystemDefaultLCID();
+ } __finally {
+ _PrintExit("GetSystemDefaultLCID() -> %p\n", rv);
+ };
+ return rv;
+}
+
+LANGID __stdcall Mine_GetSystemDefaultLangID(void)
+{
+ _PrintEnter("GetSystemDefaultLangID()\n");
+
+ LANGID rv = 0;
+ __try {
+ rv = Real_GetSystemDefaultLangID();
+ } __finally {
+ _PrintExit("GetSystemDefaultLangID() -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetSystemDirectoryA(LPSTR a0,
+ UINT a1)
+{
+ _PrintEnter("GetSystemDirectoryA(%p,%p)\n", a0, a1);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetSystemDirectoryA(a0, a1);
+ } __finally {
+ _PrintExit("GetSystemDirectoryA(%hs,) -> %p\n", a0, rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetSystemDirectoryW(LPWSTR a0,
+ UINT a1)
+{
+ _PrintEnter("GetSystemDirectoryW(%p,%p)\n", a0, a1);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetSystemDirectoryW(a0, a1);
+ } __finally {
+ _PrintExit("GetSystemDirectoryW(%ls,) -> %p\n", a0, rv);
+ };
+ return rv;
+}
+
+void __stdcall Mine_GetSystemInfo(LPSYSTEM_INFO a0)
+{
+ _PrintEnter("GetSystemInfo(%p)\n", a0);
+
+ __try {
+ Real_GetSystemInfo(a0);
+ } __finally {
+ _PrintExit("GetSystemInfo() ->\n");
+ };
+}
+
+HMENU __stdcall Mine_GetSystemMenu(HWND a0,
+ BOOL a1)
+{
+ _PrintEnter("GetSystemMenu(%p,%p)\n", a0, a1);
+
+ HMENU rv = 0;
+ __try {
+ rv = Real_GetSystemMenu(a0, a1);
+ } __finally {
+ _PrintExit("GetSystemMenu(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetSystemMetrics(int a0)
+{
+ _PrintEnter("GetSystemMetrics(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetSystemMetrics(a0);
+ } __finally {
+ _PrintExit("GetSystemMetrics() -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetSystemPaletteEntries(HDC a0,
+ UINT a1,
+ UINT a2,
+ PALETTEENTRY* a3)
+{
+ _PrintEnter("GetSystemPaletteEntries(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetSystemPaletteEntries(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetSystemPaletteEntries(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetSystemPaletteUse(HDC a0)
+{
+ _PrintEnter("GetSystemPaletteUse(%p)\n", a0);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetSystemPaletteUse(a0);
+ } __finally {
+ _PrintExit("GetSystemPaletteUse() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetSystemPowerStatus(LPSYSTEM_POWER_STATUS a0)
+{
+ _PrintEnter("GetSystemPowerStatus(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetSystemPowerStatus(a0);
+ } __finally {
+ _PrintExit("GetSystemPowerStatus() -> %p\n", rv);
+ };
+ return rv;
+}
+
+void __stdcall Mine_GetSystemTime(LPSYSTEMTIME a0)
+{
+ _PrintEnter("GetSystemTime(%p)\n", a0);
+
+ __try {
+ Real_GetSystemTime(a0);
+ } __finally {
+ _PrintExit("GetSystemTime() ->\n");
+ };
+}
+
+BOOL __stdcall Mine_GetSystemTimeAdjustment(PDWORD a0,
+ PDWORD a1,
+ PBOOL a2)
+{
+ _PrintEnter("GetSystemTimeAdjustment(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetSystemTimeAdjustment(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetSystemTimeAdjustment(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+void __stdcall Mine_GetSystemTimeAsFileTime(LPFILETIME a0)
+{
+ _PrintEnter("GetSystemTimeAsFileTime(%p)\n", a0);
+
+ __try {
+ Real_GetSystemTimeAsFileTime(a0);
+ } __finally {
+ _PrintExit("GetSystemTimeAsFileTime() ->\n");
+ };
+}
+
+DWORD __stdcall Mine_GetTabbedTextExtentA(HDC a0,
+ LPCSTR a1,
+ int a2,
+ int a3,
+ INT* a4)
+{
+ _PrintEnter("GetTabbedTextExtentA(%p,%hs,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetTabbedTextExtentA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("GetTabbedTextExtentA(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetTabbedTextExtentW(HDC a0,
+ LPCWSTR a1,
+ int a2,
+ int a3,
+ INT* a4)
+{
+ _PrintEnter("GetTabbedTextExtentW(%p,%ls,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetTabbedTextExtentW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("GetTabbedTextExtentW(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetTapeParameters(HANDLE a0,
+ DWORD a1,
+ LPDWORD a2,
+ LPVOID a3)
+{
+ _PrintEnter("GetTapeParameters(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetTapeParameters(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetTapeParameters(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetTapePosition(HANDLE a0,
+ DWORD a1,
+ LPDWORD a2,
+ LPDWORD a3,
+ LPDWORD a4)
+{
+ _PrintEnter("GetTapePosition(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetTapePosition(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("GetTapePosition(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetTapeStatus(HANDLE a0)
+{
+ _PrintEnter("GetTapeStatus(%p)\n", a0);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetTapeStatus(a0);
+ } __finally {
+ _PrintExit("GetTapeStatus() -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetTempFileNameA(LPCSTR a0,
+ LPCSTR a1,
+ UINT a2,
+ LPSTR a3)
+{
+ _PrintEnter("GetTempFileNameA(%hs,%hs,%p,%p)\n", a0, a1, a2, a3);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetTempFileNameA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetTempFileNameA(,,,%hs) -> %p\n", a3, rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetTempFileNameW(LPCWSTR a0,
+ LPCWSTR a1,
+ UINT a2,
+ LPWSTR a3)
+{
+ _PrintEnter("GetTempFileNameW(%ls,%ls,%p,%p)\n", a0, a1, a2, a3);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetTempFileNameW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetTempFileNameW(,,,%ls) -> %p\n", a3, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetTempPathA(DWORD a0,
+ LPSTR a1)
+{
+ _PrintEnter("GetTempPathA(%p,%p)\n", a0, a1);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetTempPathA(a0, a1);
+ } __finally {
+ _PrintExit("GetTempPathA(,%hs) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetTempPathW(DWORD a0,
+ LPWSTR a1)
+{
+ _PrintEnter("GetTempPathW(%p,%p)\n", a0, a1);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetTempPathW(a0, a1);
+ } __finally {
+ _PrintExit("GetTempPathW(,%ls) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetTextAlign(HDC a0)
+{
+ _PrintEnter("GetTextAlign(%p)\n", a0);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetTextAlign(a0);
+ } __finally {
+ _PrintExit("GetTextAlign() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetTextCharacterExtra(HDC a0)
+{
+ _PrintEnter("GetTextCharacterExtra(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetTextCharacterExtra(a0);
+ } __finally {
+ _PrintExit("GetTextCharacterExtra() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetTextCharset(HDC a0)
+{
+ _PrintEnter("GetTextCharset(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetTextCharset(a0);
+ } __finally {
+ _PrintExit("GetTextCharset() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetTextCharsetInfo(HDC a0,
+ LPFONTSIGNATURE a1,
+ DWORD a2)
+{
+ _PrintEnter("GetTextCharsetInfo(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetTextCharsetInfo(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetTextCharsetInfo(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+COLORREF __stdcall Mine_GetTextColor(HDC a0)
+{
+ _PrintEnter("GetTextColor(%p)\n", a0);
+
+ COLORREF rv = 0;
+ __try {
+ rv = Real_GetTextColor(a0);
+ } __finally {
+ _PrintExit("GetTextColor() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetTextExtentExPointA(HDC a0,
+ LPCSTR a1,
+ int a2,
+ int a3,
+ LPINT a4,
+ LPINT a5,
+ SIZE* a6)
+{
+ _PrintEnter("GetTextExtentExPointA(%p,%hs,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetTextExtentExPointA(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("GetTextExtentExPointA(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetTextExtentExPointW(HDC a0,
+ LPCWSTR a1,
+ int a2,
+ int a3,
+ LPINT a4,
+ LPINT a5,
+ SIZE* a6)
+{
+ _PrintEnter("GetTextExtentExPointW(%p,%ls,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetTextExtentExPointW(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("GetTextExtentExPointW(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetTextExtentPoint32A(HDC a0,
+ LPCSTR a1,
+ int a2,
+ SIZE* a3)
+{
+ _PrintEnter("GetTextExtentPoint32A(%p,%hs,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetTextExtentPoint32A(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetTextExtentPoint32A(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetTextExtentPoint32W(HDC a0,
+ LPCWSTR a1,
+ int a2,
+ SIZE* a3)
+{
+ _PrintEnter("GetTextExtentPoint32W(%p,%ls,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetTextExtentPoint32W(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetTextExtentPoint32W(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetTextExtentPointA(HDC a0,
+ LPCSTR a1,
+ int a2,
+ SIZE* a3)
+{
+ _PrintEnter("GetTextExtentPointA(%p,%hs,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetTextExtentPointA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetTextExtentPointA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetTextExtentPointW(HDC a0,
+ LPCWSTR a1,
+ int a2,
+ SIZE* a3)
+{
+ _PrintEnter("GetTextExtentPointW(%p,%ls,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetTextExtentPointW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetTextExtentPointW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetTextFaceA(HDC a0,
+ int a1,
+ LPSTR a2)
+{
+ _PrintEnter("GetTextFaceA(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetTextFaceA(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetTextFaceA(,,%hs) -> %p\n", a2, rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetTextFaceW(HDC a0,
+ int a1,
+ LPWSTR a2)
+{
+ _PrintEnter("GetTextFaceW(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetTextFaceW(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetTextFaceW(,,%ls) -> %p\n", a2, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetTextMetricsA(HDC a0,
+ LPTEXTMETRICA a1)
+{
+ _PrintEnter("GetTextMetricsA(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetTextMetricsA(a0, a1);
+ } __finally {
+ _PrintExit("GetTextMetricsA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetTextMetricsW(HDC a0,
+ LPTEXTMETRICW a1)
+{
+ _PrintEnter("GetTextMetricsW(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetTextMetricsW(a0, a1);
+ } __finally {
+ _PrintExit("GetTextMetricsW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetThreadContext(HANDLE a0,
+ LPCONTEXT a1)
+{
+ _PrintEnter("GetThreadContext(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetThreadContext(a0, a1);
+ } __finally {
+ _PrintExit("GetThreadContext(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HDESK __stdcall Mine_GetThreadDesktop(DWORD a0)
+{
+ _PrintEnter("GetThreadDesktop(%p)\n", a0);
+
+ HDESK rv = 0;
+ __try {
+ rv = Real_GetThreadDesktop(a0);
+ } __finally {
+ _PrintExit("GetThreadDesktop() -> %p\n", rv);
+ };
+ return rv;
+}
+
+#if(WINVER >= 0x0500)
+LCID __stdcall Mine_GetThreadLocale(void)
+{
+ _PrintEnter("GetThreadLocale()\n");
+
+ LCID rv = 0;
+ __try {
+ rv = Real_GetThreadLocale();
+ } __finally {
+ _PrintExit("GetThreadLocale() -> %p\n", rv);
+ };
+ return rv;
+}
+#endif // (WINVER >= 0x0500)
+
+int __stdcall Mine_GetThreadPriority(HANDLE a0)
+{
+ _PrintEnter("GetThreadPriority(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetThreadPriority(a0);
+ } __finally {
+ _PrintExit("GetThreadPriority() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetThreadPriorityBoost(HANDLE a0,
+ PBOOL a1)
+{
+ _PrintEnter("GetThreadPriorityBoost(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetThreadPriorityBoost(a0, a1);
+ } __finally {
+ _PrintExit("GetThreadPriorityBoost(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetThreadSelectorEntry(HANDLE a0,
+ DWORD a1,
+ LPLDT_ENTRY a2)
+{
+ _PrintEnter("GetThreadSelectorEntry(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetThreadSelectorEntry(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetThreadSelectorEntry(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetThreadTimes(HANDLE a0,
+ LPFILETIME a1,
+ LPFILETIME a2,
+ LPFILETIME a3,
+ LPFILETIME a4)
+{
+ _PrintEnter("GetThreadTimes(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetThreadTimes(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("GetThreadTimes(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetTickCount(void)
+{
+ _PrintEnter("GetTickCount()\n");
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetTickCount();
+ } __finally {
+ _PrintExit("GetTickCount() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetTimeFormatA(LCID a0,
+ DWORD a1,
+ SYSTEMTIME* a2,
+ LPCSTR a3,
+ LPSTR a4,
+ int a5)
+{
+ _PrintEnter("GetTimeFormatA(%p,%p,%p,%hs,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetTimeFormatA(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("GetTimeFormatA(,,,,%hs,) -> %p\n", a4, rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetTimeFormatW(LCID a0,
+ DWORD a1,
+ SYSTEMTIME* a2,
+ LPCWSTR a3,
+ LPWSTR a4,
+ int a5)
+{
+ _PrintEnter("GetTimeFormatW(%p,%p,%p,%ls,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetTimeFormatW(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("GetTimeFormatW(,,,,%ls,) -> %p\n", a4, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetTimeZoneInformation(LPTIME_ZONE_INFORMATION a0)
+{
+ _PrintEnter("GetTimeZoneInformation(%p)\n", a0);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetTimeZoneInformation(a0);
+ } __finally {
+ _PrintExit("GetTimeZoneInformation() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_GetTopWindow(HWND a0)
+{
+ _PrintEnter("GetTopWindow(%p)\n", a0);
+
+ HWND rv = 0;
+ __try {
+ rv = Real_GetTopWindow(a0);
+ } __finally {
+ _PrintExit("GetTopWindow() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetUpdateRect(HWND a0,
+ LPRECT a1,
+ BOOL a2)
+{
+ _PrintEnter("GetUpdateRect(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetUpdateRect(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetUpdateRect(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetUpdateRgn(HWND a0,
+ HRGN a1,
+ BOOL a2)
+{
+ _PrintEnter("GetUpdateRgn(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetUpdateRgn(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetUpdateRgn(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LCID __stdcall Mine_GetUserDefaultLCID(void)
+{
+ _PrintEnter("GetUserDefaultLCID()\n");
+
+ LCID rv = 0;
+ __try {
+ rv = Real_GetUserDefaultLCID();
+ } __finally {
+ _PrintExit("GetUserDefaultLCID() -> %p\n", rv);
+ };
+ return rv;
+}
+
+LANGID __stdcall Mine_GetUserDefaultLangID(void)
+{
+ _PrintEnter("GetUserDefaultLangID()\n");
+
+ LANGID rv = 0;
+ __try {
+ rv = Real_GetUserDefaultLangID();
+ } __finally {
+ _PrintExit("GetUserDefaultLangID() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetUserObjectInformationA(HANDLE a0,
+ int a1,
+ PVOID a2,
+ DWORD a3,
+ LPDWORD a4)
+{
+ _PrintEnter("GetUserObjectInformationA(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetUserObjectInformationA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("GetUserObjectInformationA(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetUserObjectInformationW(HANDLE a0,
+ int a1,
+ PVOID a2,
+ DWORD a3,
+ LPDWORD a4)
+{
+ _PrintEnter("GetUserObjectInformationW(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetUserObjectInformationW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("GetUserObjectInformationW(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetUserObjectSecurity(HANDLE a0,
+ PSECURITY_INFORMATION a1,
+ PSECURITY_DESCRIPTOR a2,
+ DWORD a3,
+ LPDWORD a4)
+{
+ _PrintEnter("GetUserObjectSecurity(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetUserObjectSecurity(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("GetUserObjectSecurity(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetVersion(void)
+{
+ _PrintEnter("GetVersion()\n");
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetVersion();
+ } __finally {
+ _PrintExit("GetVersion() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetVersionExA(LPOSVERSIONINFOA a0)
+{
+ _PrintEnter("GetVersionExA(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetVersionExA(a0);
+ } __finally {
+ _PrintExit("GetVersionExA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetVersionExW(LPOSVERSIONINFOW a0)
+{
+ _PrintEnter("GetVersionExW(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetVersionExW(a0);
+ } __finally {
+ _PrintExit("GetVersionExW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetViewportExtEx(HDC a0,
+ SIZE* a1)
+{
+ _PrintEnter("GetViewportExtEx(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetViewportExtEx(a0, a1);
+ } __finally {
+ _PrintExit("GetViewportExtEx(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetViewportOrgEx(HDC a0,
+ POINT* a1)
+{
+ _PrintEnter("GetViewportOrgEx(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetViewportOrgEx(a0, a1);
+ } __finally {
+ _PrintExit("GetViewportOrgEx(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetVolumeInformationA(LPCSTR a0,
+ LPSTR a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPDWORD a5,
+ LPSTR a6,
+ DWORD a7)
+{
+ _PrintEnter("GetVolumeInformationA(%hs,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetVolumeInformationA(a0, a1, a2, a3, a4, a5, a6, a7);
+ } __finally {
+ _PrintExit("GetVolumeInformationA(,%hs,,,,,%hs,) -> %p\n", a1, a6, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetVolumeInformationW(LPCWSTR a0,
+ LPWSTR a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPDWORD a5,
+ LPWSTR a6,
+ DWORD a7)
+{
+ _PrintEnter("GetVolumeInformationW(%ls,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetVolumeInformationW(a0, a1, a2, a3, a4, a5, a6, a7);
+ } __finally {
+ _PrintExit("GetVolumeInformationW(,%ls,,,,,%ls,) -> %p\n", a1, a6, rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetWinMetaFileBits(HENHMETAFILE a0,
+ UINT a1,
+ LPBYTE a2,
+ INT a3,
+ HDC a4)
+{
+ _PrintEnter("GetWinMetaFileBits(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetWinMetaFileBits(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("GetWinMetaFileBits(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_GetWindow(HWND a0,
+ UINT a1)
+{
+ _PrintEnter("GetWindow(%p,%p)\n", a0, a1);
+
+ HWND rv = 0;
+ __try {
+ rv = Real_GetWindow(a0, a1);
+ } __finally {
+ _PrintExit("GetWindow(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetWindowContextHelpId(HWND a0)
+{
+ _PrintEnter("GetWindowContextHelpId(%p)\n", a0);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetWindowContextHelpId(a0);
+ } __finally {
+ _PrintExit("GetWindowContextHelpId() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HDC __stdcall Mine_GetWindowDC(HWND a0)
+{
+ _PrintEnter("GetWindowDC(%p)\n", a0);
+
+ HDC rv = 0;
+ __try {
+ rv = Real_GetWindowDC(a0);
+ } __finally {
+ _PrintExit("GetWindowDC() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetWindowExtEx(HDC a0,
+ SIZE* a1)
+{
+ _PrintEnter("GetWindowExtEx(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetWindowExtEx(a0, a1);
+ } __finally {
+ _PrintExit("GetWindowExtEx(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LONG __stdcall Mine_GetWindowLongA(HWND a0,
+ int a1)
+{
+ _PrintEnter("GetWindowLongA(%p,%p)\n", a0, a1);
+
+ LONG rv = 0;
+ __try {
+ rv = Real_GetWindowLongA(a0, a1);
+ } __finally {
+ _PrintExit("GetWindowLongA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LONG __stdcall Mine_GetWindowLongW(HWND a0,
+ int a1)
+{
+ _PrintEnter("GetWindowLongW(%p,%p)\n", a0, a1);
+
+ LONG rv = 0;
+ __try {
+ rv = Real_GetWindowLongW(a0, a1);
+ } __finally {
+ _PrintExit("GetWindowLongW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetWindowOrgEx(HDC a0,
+ POINT* a1)
+{
+ _PrintEnter("GetWindowOrgEx(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetWindowOrgEx(a0, a1);
+ } __finally {
+ _PrintExit("GetWindowOrgEx(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetWindowPlacement(HWND a0,
+ WINDOWPLACEMENT* a1)
+{
+ _PrintEnter("GetWindowPlacement(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetWindowPlacement(a0, a1);
+ } __finally {
+ _PrintExit("GetWindowPlacement(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetWindowRect(HWND a0,
+ LPRECT a1)
+{
+ _PrintEnter("GetWindowRect(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetWindowRect(a0, a1);
+ } __finally {
+ _PrintExit("GetWindowRect(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetWindowRgn(HWND a0,
+ HRGN a1)
+{
+ _PrintEnter("GetWindowRgn(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetWindowRgn(a0, a1);
+ } __finally {
+ _PrintExit("GetWindowRgn(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetWindowTextA(HWND a0,
+ LPSTR a1,
+ int a2)
+{
+ _PrintEnter("GetWindowTextA(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetWindowTextA(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetWindowTextA(,%hs,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetWindowTextLengthA(HWND a0)
+{
+ _PrintEnter("GetWindowTextLengthA(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetWindowTextLengthA(a0);
+ } __finally {
+ _PrintExit("GetWindowTextLengthA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetWindowTextLengthW(HWND a0)
+{
+ _PrintEnter("GetWindowTextLengthW(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetWindowTextLengthW(a0);
+ } __finally {
+ _PrintExit("GetWindowTextLengthW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_GetWindowTextW(HWND a0,
+ LPWSTR a1,
+ int a2)
+{
+ _PrintEnter("GetWindowTextW(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_GetWindowTextW(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetWindowTextW(,%ls,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_GetWindowThreadProcessId(HWND a0,
+ LPDWORD a1)
+{
+ _PrintEnter("GetWindowThreadProcessId(%p,%p)\n", a0, a1);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetWindowThreadProcessId(a0, a1);
+ } __finally {
+ _PrintExit("GetWindowThreadProcessId(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+WORD __stdcall Mine_GetWindowWord(HWND a0,
+ int a1)
+{
+ _PrintEnter("GetWindowWord(%p,%p)\n", a0, a1);
+
+ WORD rv = 0;
+ __try {
+ rv = Real_GetWindowWord(a0, a1);
+ } __finally {
+ _PrintExit("GetWindowWord(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetWindowsDirectoryA(LPSTR a0,
+ UINT a1)
+{
+ _PrintEnter("GetWindowsDirectoryA(%p,%p)\n", a0, a1);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetWindowsDirectoryA(a0, a1);
+ } __finally {
+ _PrintExit("GetWindowsDirectoryA(%hs,) -> %p\n", a0, rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GetWindowsDirectoryW(LPWSTR a0,
+ UINT a1)
+{
+ _PrintEnter("GetWindowsDirectoryW(%p,%p)\n", a0, a1);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GetWindowsDirectoryW(a0, a1);
+ } __finally {
+ _PrintExit("GetWindowsDirectoryW(%ls,) -> %p\n", a0, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GetWorldTransform(HDC a0,
+ XFORM* a1)
+{
+ _PrintEnter("GetWorldTransform(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetWorldTransform(a0, a1);
+ } __finally {
+ _PrintExit("GetWorldTransform(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+ATOM __stdcall Mine_GlobalAddAtomA(LPCSTR a0)
+{
+ _PrintEnter("GlobalAddAtomA(%hs)\n", a0);
+
+ ATOM rv = 0;
+ __try {
+ rv = Real_GlobalAddAtomA(a0);
+ } __finally {
+ _PrintExit("GlobalAddAtomA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+ATOM __stdcall Mine_GlobalAddAtomW(LPCWSTR a0)
+{
+ _PrintEnter("GlobalAddAtomW(%ls)\n", a0);
+
+ ATOM rv = 0;
+ __try {
+ rv = Real_GlobalAddAtomW(a0);
+ } __finally {
+ _PrintExit("GlobalAddAtomW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HGLOBAL __stdcall Mine_GlobalAlloc(UINT a0,
+ SIZE_T a1)
+{
+ _PrintEnter("GlobalAlloc(%p,%p)\n", a0, a1);
+
+ HGLOBAL rv = 0;
+ __try {
+ rv = Real_GlobalAlloc(a0, a1);
+ } __finally {
+ _PrintExit("GlobalAlloc(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+SIZE_T __stdcall Mine_GlobalCompact(DWORD a0)
+{
+ _PrintEnter("GlobalCompact(%p)\n", a0);
+
+ SIZE_T rv = 0;
+ __try {
+ rv = Real_GlobalCompact(a0);
+ } __finally {
+ _PrintExit("GlobalCompact() -> %p\n", rv);
+ };
+ return rv;
+}
+
+ATOM __stdcall Mine_GlobalDeleteAtom(ATOM a0)
+{
+ _PrintEnter("GlobalDeleteAtom(%p)\n", a0);
+
+ ATOM rv = 0;
+ __try {
+ rv = Real_GlobalDeleteAtom(a0);
+ } __finally {
+ _PrintExit("GlobalDeleteAtom() -> %p\n", rv);
+ };
+ return rv;
+}
+
+ATOM __stdcall Mine_GlobalFindAtomA(LPCSTR a0)
+{
+ _PrintEnter("GlobalFindAtomA(%hs)\n", a0);
+
+ ATOM rv = 0;
+ __try {
+ rv = Real_GlobalFindAtomA(a0);
+ } __finally {
+ _PrintExit("GlobalFindAtomA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+ATOM __stdcall Mine_GlobalFindAtomW(LPCWSTR a0)
+{
+ _PrintEnter("GlobalFindAtomW(%ls)\n", a0);
+
+ ATOM rv = 0;
+ __try {
+ rv = Real_GlobalFindAtomW(a0);
+ } __finally {
+ _PrintExit("GlobalFindAtomW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+void __stdcall Mine_GlobalFix(HGLOBAL a0)
+{
+ _PrintEnter("GlobalFix(%p)\n", a0);
+
+ __try {
+ Real_GlobalFix(a0);
+ } __finally {
+ _PrintExit("GlobalFix() ->\n");
+ };
+}
+
+UINT __stdcall Mine_GlobalFlags(HGLOBAL a0)
+{
+ _PrintEnter("GlobalFlags(%p)\n", a0);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GlobalFlags(a0);
+ } __finally {
+ _PrintExit("GlobalFlags() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HGLOBAL __stdcall Mine_GlobalFree(HGLOBAL a0)
+{
+ _PrintEnter("GlobalFree(%p)\n", a0);
+
+ HGLOBAL rv = 0;
+ __try {
+ rv = Real_GlobalFree(a0);
+ } __finally {
+ _PrintExit("GlobalFree() -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GlobalGetAtomNameA(ATOM a0,
+ LPSTR a1,
+ int a2)
+{
+ _PrintEnter("GlobalGetAtomNameA(%p,%p,%p)\n", a0, a1, a2);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GlobalGetAtomNameA(a0, a1, a2);
+ } __finally {
+ _PrintExit("GlobalGetAtomNameA(,%hs,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_GlobalGetAtomNameW(ATOM a0,
+ LPWSTR a1,
+ int a2)
+{
+ _PrintEnter("GlobalGetAtomNameW(%p,%p,%p)\n", a0, a1, a2);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_GlobalGetAtomNameW(a0, a1, a2);
+ } __finally {
+ _PrintExit("GlobalGetAtomNameW(,%ls,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+HGLOBAL __stdcall Mine_GlobalHandle(LPCVOID a0)
+{
+ _PrintEnter("GlobalHandle(%p)\n", a0);
+
+ HGLOBAL rv = 0;
+ __try {
+ rv = Real_GlobalHandle(a0);
+ } __finally {
+ _PrintExit("GlobalHandle() -> %p\n", rv);
+ };
+ return rv;
+}
+
+LPVOID __stdcall Mine_GlobalLock(HGLOBAL a0)
+{
+ _PrintEnter("GlobalLock(%p)\n", a0);
+
+ LPVOID rv = 0;
+ __try {
+ rv = Real_GlobalLock(a0);
+ } __finally {
+ _PrintExit("GlobalLock() -> %p\n", rv);
+ };
+ return rv;
+}
+
+void __stdcall Mine_GlobalMemoryStatus(LPMEMORYSTATUS a0)
+{
+ _PrintEnter("GlobalMemoryStatus(%p)\n", a0);
+
+ __try {
+ Real_GlobalMemoryStatus(a0);
+ } __finally {
+ _PrintExit("GlobalMemoryStatus() ->\n");
+ };
+}
+
+HGLOBAL __stdcall Mine_GlobalReAlloc(HGLOBAL a0,
+ SIZE_T a1,
+ UINT a2)
+{
+ _PrintEnter("GlobalReAlloc(%p,%p,%p)\n", a0, a1, a2);
+
+ HGLOBAL rv = 0;
+ __try {
+ rv = Real_GlobalReAlloc(a0, a1, a2);
+ } __finally {
+ _PrintExit("GlobalReAlloc(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+SIZE_T __stdcall Mine_GlobalSize(HGLOBAL a0)
+{
+ _PrintEnter("GlobalSize(%p)\n", a0);
+
+ SIZE_T rv = 0;
+ __try {
+ rv = Real_GlobalSize(a0);
+ } __finally {
+ _PrintExit("GlobalSize() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GlobalUnWire(HGLOBAL a0)
+{
+ _PrintEnter("GlobalUnWire(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GlobalUnWire(a0);
+ } __finally {
+ _PrintExit("GlobalUnWire() -> %p\n", rv);
+ };
+ return rv;
+}
+
+void __stdcall Mine_GlobalUnfix(HGLOBAL a0)
+{
+ _PrintEnter("GlobalUnfix(%p)\n", a0);
+
+ __try {
+ Real_GlobalUnfix(a0);
+ } __finally {
+ _PrintExit("GlobalUnfix() ->\n");
+ };
+}
+
+BOOL __stdcall Mine_GlobalUnlock(HGLOBAL a0)
+{
+ _PrintEnter("GlobalUnlock(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GlobalUnlock(a0);
+ } __finally {
+ _PrintExit("GlobalUnlock() -> %p\n", rv);
+ };
+ return rv;
+}
+
+LPVOID __stdcall Mine_GlobalWire(HGLOBAL a0)
+{
+ _PrintEnter("GlobalWire(%p)\n", a0);
+
+ LPVOID rv = 0;
+ __try {
+ rv = Real_GlobalWire(a0);
+ } __finally {
+ _PrintExit("GlobalWire() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GrayStringA(HDC a0,
+ HBRUSH a1,
+ GRAYSTRINGPROC a2,
+ LPARAM a3,
+ int a4,
+ int a5,
+ int a6,
+ int a7,
+ int a8)
+{
+ _PrintEnter("GrayStringA(%p,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GrayStringA(a0, a1, a2, a3, a4, a5, a6, a7, a8);
+ } __finally {
+ _PrintExit("GrayStringA(,,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_GrayStringW(HDC a0,
+ HBRUSH a1,
+ GRAYSTRINGPROC a2,
+ LPARAM a3,
+ int a4,
+ int a5,
+ int a6,
+ int a7,
+ int a8)
+{
+ _PrintEnter("GrayStringW(%p,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GrayStringW(a0, a1, a2, a3, a4, a5, a6, a7, a8);
+ } __finally {
+ _PrintExit("GrayStringW(,,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_HeapLock(HANDLE a0)
+{
+ _PrintEnter("HeapLock(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_HeapLock(a0);
+ } __finally {
+ _PrintExit("HeapLock() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_HeapUnlock(HANDLE a0)
+{
+ _PrintEnter("HeapUnlock(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_HeapUnlock(a0);
+ } __finally {
+ _PrintExit("HeapUnlock() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_HideCaret(HWND a0)
+{
+ _PrintEnter("HideCaret(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_HideCaret(a0);
+ } __finally {
+ _PrintExit("HideCaret() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_HiliteMenuItem(HWND a0,
+ HMENU a1,
+ UINT a2,
+ UINT a3)
+{
+ _PrintEnter("HiliteMenuItem(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_HiliteMenuItem(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("HiliteMenuItem(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_IIDFromString(LPOLESTR a0,
+ LPGUID a1)
+{
+ _PrintEnter("IIDFromString(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_IIDFromString(a0, a1);
+ } __finally {
+ _PrintExit("IIDFromString(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ImpersonateDdeClientWindow(HWND a0,
+ HWND a1)
+{
+ _PrintEnter("ImpersonateDdeClientWindow(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ImpersonateDdeClientWindow(a0, a1);
+ } __finally {
+ _PrintExit("ImpersonateDdeClientWindow(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_InSendMessage(void)
+{
+ _PrintEnter("InSendMessage()\n");
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_InSendMessage();
+ } __finally {
+ _PrintExit("InSendMessage() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_InflateRect(LPRECT a0,
+ int a1,
+ int a2)
+{
+ _PrintEnter("InflateRect(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_InflateRect(a0, a1, a2);
+ } __finally {
+ _PrintExit("InflateRect(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_InitAtomTable(DWORD a0)
+{
+ _PrintEnter("InitAtomTable(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_InitAtomTable(a0);
+ } __finally {
+ _PrintExit("InitAtomTable() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_InsertMenuA(HMENU a0,
+ UINT a1,
+ UINT a2,
+ UINT_PTR a3,
+ LPCSTR a4)
+{
+ _PrintEnter("InsertMenuA(%p,%p,%p,%p,%hs)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_InsertMenuA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("InsertMenuA(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_InsertMenuItemA(HMENU a0,
+ UINT a1,
+ BOOL a2,
+ MENUITEMINFOA* a3)
+{
+ _PrintEnter("InsertMenuItemA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_InsertMenuItemA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("InsertMenuItemA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_InsertMenuItemW(HMENU a0,
+ UINT a1,
+ BOOL a2,
+ MENUITEMINFOW* a3)
+{
+ _PrintEnter("InsertMenuItemW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_InsertMenuItemW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("InsertMenuItemW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_InsertMenuW(HMENU a0,
+ UINT a1,
+ UINT a2,
+ UINT_PTR a3,
+ LPCWSTR a4)
+{
+ _PrintEnter("InsertMenuW(%p,%p,%p,%p,%ls)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_InsertMenuW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("InsertMenuW(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_IntersectClipRect(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4)
+{
+ _PrintEnter("IntersectClipRect(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ int rv = 0;
+ __try {
+ rv = Real_IntersectClipRect(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("IntersectClipRect(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IntersectRect(LPRECT a0,
+ RECT* a1,
+ RECT* a2)
+{
+ _PrintEnter("IntersectRect(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IntersectRect(a0, a1, a2);
+ } __finally {
+ _PrintExit("IntersectRect(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_InvalidateRect(HWND a0,
+ RECT* a1,
+ BOOL a2)
+{
+ _PrintEnter("InvalidateRect(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_InvalidateRect(a0, a1, a2);
+ } __finally {
+ _PrintExit("InvalidateRect(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_InvalidateRgn(HWND a0,
+ HRGN a1,
+ BOOL a2)
+{
+ _PrintEnter("InvalidateRgn(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_InvalidateRgn(a0, a1, a2);
+ } __finally {
+ _PrintExit("InvalidateRgn(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_InvertRect(HDC a0,
+ RECT* a1)
+{
+ _PrintEnter("InvertRect(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_InvertRect(a0, a1);
+ } __finally {
+ _PrintExit("InvertRect(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_InvertRgn(HDC a0,
+ HRGN a1)
+{
+ _PrintEnter("InvertRgn(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_InvertRgn(a0, a1);
+ } __finally {
+ _PrintExit("InvertRgn(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsAccelerator(HACCEL a0,
+ int a1,
+ LPMSG a2,
+ WORD* a3)
+{
+ _PrintEnter("IsAccelerator(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsAccelerator(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("IsAccelerator(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsBadCodePtr(FARPROC a0)
+{
+ _PrintEnter("IsBadCodePtr(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsBadCodePtr(a0);
+ } __finally {
+ _PrintExit("IsBadCodePtr() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsBadHugeReadPtr(void* a0,
+ UINT_PTR a1)
+{
+ _PrintEnter("IsBadHugeReadPtr(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsBadHugeReadPtr(a0, a1);
+ } __finally {
+ _PrintExit("IsBadHugeReadPtr(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsBadHugeWritePtr(LPVOID a0,
+ UINT_PTR a1)
+{
+ _PrintEnter("IsBadHugeWritePtr(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsBadHugeWritePtr(a0, a1);
+ } __finally {
+ _PrintExit("IsBadHugeWritePtr(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsBadReadPtr(void* a0,
+ UINT_PTR a1)
+{
+ _PrintEnter("IsBadReadPtr(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsBadReadPtr(a0, a1);
+ } __finally {
+ _PrintExit("IsBadReadPtr(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsBadStringPtrA(LPCSTR a0,
+ UINT_PTR a1)
+{
+ _PrintEnter("IsBadStringPtrA(%hs,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsBadStringPtrA(a0, a1);
+ } __finally {
+ _PrintExit("IsBadStringPtrA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsBadStringPtrW(LPCWSTR a0,
+ UINT_PTR a1)
+{
+ _PrintEnter("IsBadStringPtrW(%ls,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsBadStringPtrW(a0, a1);
+ } __finally {
+ _PrintExit("IsBadStringPtrW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsBadWritePtr(LPVOID a0,
+ UINT_PTR a1)
+{
+ _PrintEnter("IsBadWritePtr(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsBadWritePtr(a0, a1);
+ } __finally {
+ _PrintExit("IsBadWritePtr(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsCharAlphaA(CHAR a0)
+{
+ _PrintEnter("IsCharAlphaA(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsCharAlphaA(a0);
+ } __finally {
+ _PrintExit("IsCharAlphaA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsCharAlphaNumericA(CHAR a0)
+{
+ _PrintEnter("IsCharAlphaNumericA(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsCharAlphaNumericA(a0);
+ } __finally {
+ _PrintExit("IsCharAlphaNumericA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsCharAlphaNumericW(WCHAR a0)
+{
+ _PrintEnter("IsCharAlphaNumericW(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsCharAlphaNumericW(a0);
+ } __finally {
+ _PrintExit("IsCharAlphaNumericW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsCharAlphaW(WCHAR a0)
+{
+ _PrintEnter("IsCharAlphaW(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsCharAlphaW(a0);
+ } __finally {
+ _PrintExit("IsCharAlphaW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsCharLowerA(CHAR a0)
+{
+ _PrintEnter("IsCharLowerA(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsCharLowerA(a0);
+ } __finally {
+ _PrintExit("IsCharLowerA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsCharLowerW(WCHAR a0)
+{
+ _PrintEnter("IsCharLowerW(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsCharLowerW(a0);
+ } __finally {
+ _PrintExit("IsCharLowerW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsCharUpperA(CHAR a0)
+{
+ _PrintEnter("IsCharUpperA(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsCharUpperA(a0);
+ } __finally {
+ _PrintExit("IsCharUpperA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsCharUpperW(WCHAR a0)
+{
+ _PrintEnter("IsCharUpperW(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsCharUpperW(a0);
+ } __finally {
+ _PrintExit("IsCharUpperW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsChild(HWND a0,
+ HWND a1)
+{
+ _PrintEnter("IsChild(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsChild(a0, a1);
+ } __finally {
+ _PrintExit("IsChild(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsClipboardFormatAvailable(UINT a0)
+{
+ _PrintEnter("IsClipboardFormatAvailable(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsClipboardFormatAvailable(a0);
+ } __finally {
+ _PrintExit("IsClipboardFormatAvailable() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsDBCSLeadByte(BYTE a0)
+{
+ _PrintEnter("IsDBCSLeadByte(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsDBCSLeadByte(a0);
+ } __finally {
+ _PrintExit("IsDBCSLeadByte() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsDBCSLeadByteEx(UINT a0,
+ BYTE a1)
+{
+ _PrintEnter("IsDBCSLeadByteEx(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsDBCSLeadByteEx(a0, a1);
+ } __finally {
+ _PrintExit("IsDBCSLeadByteEx(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsDebuggerPresent(void)
+{
+ _PrintEnter("IsDebuggerPresent()\n");
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsDebuggerPresent();
+ } __finally {
+ _PrintExit("IsDebuggerPresent() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsDialogMessageA(HWND a0,
+ LPMSG a1)
+{
+ _PrintEnter("IsDialogMessageA(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsDialogMessageA(a0, a1);
+ } __finally {
+ _PrintExit("IsDialogMessageA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsDialogMessageW(HWND a0,
+ LPMSG a1)
+{
+ _PrintEnter("IsDialogMessageW(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsDialogMessageW(a0, a1);
+ } __finally {
+ _PrintExit("IsDialogMessageW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_IsDlgButtonChecked(HWND a0,
+ int a1)
+{
+ _PrintEnter("IsDlgButtonChecked(%p,%p)\n", a0, a1);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_IsDlgButtonChecked(a0, a1);
+ } __finally {
+ _PrintExit("IsDlgButtonChecked(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsIconic(HWND a0)
+{
+ _PrintEnter("IsIconic(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsIconic(a0);
+ } __finally {
+ _PrintExit("IsIconic() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsMenu(HMENU a0)
+{
+ _PrintEnter("IsMenu(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsMenu(a0);
+ } __finally {
+ _PrintExit("IsMenu() -> %p\n", rv);
+ };
+ return rv;
+}
+
+#if !defined(DETOURS_ARM)
+BOOL __stdcall Mine_IsProcessorFeaturePresent(DWORD a0)
+{
+ _PrintEnter("IsProcessorFeaturePresent(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsProcessorFeaturePresent(a0);
+ } __finally {
+ _PrintExit("IsProcessorFeaturePresent() -> %p\n", rv);
+ };
+ return rv;
+}
+#endif // !DETOURS_ARM
+
+BOOL __stdcall Mine_IsRectEmpty(RECT* a0)
+{
+ _PrintEnter("IsRectEmpty(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsRectEmpty(a0);
+ } __finally {
+ _PrintExit("IsRectEmpty() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsValidCodePage(UINT a0)
+{
+ _PrintEnter("IsValidCodePage(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsValidCodePage(a0);
+ } __finally {
+ _PrintExit("IsValidCodePage() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsValidLocale(LCID a0,
+ DWORD a1)
+{
+ _PrintEnter("IsValidLocale(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsValidLocale(a0, a1);
+ } __finally {
+ _PrintExit("IsValidLocale(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsWindow(HWND a0)
+{
+ _PrintEnter("IsWindow(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsWindow(a0);
+ } __finally {
+ _PrintExit("IsWindow() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsWindowEnabled(HWND a0)
+{
+ _PrintEnter("IsWindowEnabled(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsWindowEnabled(a0);
+ } __finally {
+ _PrintExit("IsWindowEnabled() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsWindowUnicode(HWND a0)
+{
+ _PrintEnter("IsWindowUnicode(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsWindowUnicode(a0);
+ } __finally {
+ _PrintExit("IsWindowUnicode() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsWindowVisible(HWND a0)
+{
+ _PrintEnter("IsWindowVisible(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsWindowVisible(a0);
+ } __finally {
+ _PrintExit("IsWindowVisible() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_IsZoomed(HWND a0)
+{
+ _PrintEnter("IsZoomed(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_IsZoomed(a0);
+ } __finally {
+ _PrintExit("IsZoomed() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_KillTimer(HWND a0,
+ UINT_PTR a1)
+{
+ _PrintEnter("KillTimer(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_KillTimer(a0, a1);
+ } __finally {
+ _PrintExit("KillTimer(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_LPtoDP(HDC a0,
+ POINT* a1,
+ int a2)
+{
+ _PrintEnter("LPtoDP(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_LPtoDP(a0, a1, a2);
+ } __finally {
+ _PrintExit("LPtoDP(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_LineDDA(int a0,
+ int a1,
+ int a2,
+ int a3,
+ LINEDDAPROC a4,
+ LPARAM a5)
+{
+ _PrintEnter("LineDDA(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_LineDDA(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("LineDDA(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_LineTo(HDC a0,
+ int a1,
+ int a2)
+{
+ _PrintEnter("LineTo(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_LineTo(a0, a1, a2);
+ } __finally {
+ _PrintExit("LineTo(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HACCEL __stdcall Mine_LoadAcceleratorsA(HINSTANCE a0,
+ LPCSTR a1)
+{
+ _PrintEnter("LoadAcceleratorsA(%p,%hs)\n", a0, a1);
+
+ HACCEL rv = 0;
+ __try {
+ rv = Real_LoadAcceleratorsA(a0, a1);
+ } __finally {
+ _PrintExit("LoadAcceleratorsA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HACCEL __stdcall Mine_LoadAcceleratorsW(HINSTANCE a0,
+ LPCWSTR a1)
+{
+ _PrintEnter("LoadAcceleratorsW(%p,%ls)\n", a0, a1);
+
+ HACCEL rv = 0;
+ __try {
+ rv = Real_LoadAcceleratorsW(a0, a1);
+ } __finally {
+ _PrintExit("LoadAcceleratorsW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HBITMAP __stdcall Mine_LoadBitmapA(HINSTANCE a0,
+ LPCSTR a1)
+{
+ _PrintEnter("LoadBitmapA(%p,%hs)\n", a0, a1);
+
+ HBITMAP rv = 0;
+ __try {
+ rv = Real_LoadBitmapA(a0, a1);
+ } __finally {
+ _PrintExit("LoadBitmapA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HBITMAP __stdcall Mine_LoadBitmapW(HINSTANCE a0,
+ LPCWSTR a1)
+{
+ _PrintEnter("LoadBitmapW(%p,%ls)\n", a0, a1);
+
+ HBITMAP rv = 0;
+ __try {
+ rv = Real_LoadBitmapW(a0, a1);
+ } __finally {
+ _PrintExit("LoadBitmapW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HCURSOR __stdcall Mine_LoadCursorA(HINSTANCE a0,
+ LPCSTR a1)
+{
+ _PrintEnter("LoadCursorA(%p,%hs)\n", a0, a1);
+
+ HCURSOR rv = 0;
+ __try {
+ rv = Real_LoadCursorA(a0, a1);
+ } __finally {
+ _PrintExit("LoadCursorA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HCURSOR __stdcall Mine_LoadCursorFromFileA(LPCSTR a0)
+{
+ _PrintEnter("LoadCursorFromFileA(%hs)\n", a0);
+
+ HCURSOR rv = 0;
+ __try {
+ rv = Real_LoadCursorFromFileA(a0);
+ } __finally {
+ _PrintExit("LoadCursorFromFileA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HCURSOR __stdcall Mine_LoadCursorFromFileW(LPCWSTR a0)
+{
+ _PrintEnter("LoadCursorFromFileW(%ls)\n", a0);
+
+ HCURSOR rv = 0;
+ __try {
+ rv = Real_LoadCursorFromFileW(a0);
+ } __finally {
+ _PrintExit("LoadCursorFromFileW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HCURSOR __stdcall Mine_LoadCursorW(HINSTANCE a0,
+ LPCWSTR a1)
+{
+ _PrintEnter("LoadCursorW(%p,%ls)\n", a0, a1);
+
+ HCURSOR rv = 0;
+ __try {
+ rv = Real_LoadCursorW(a0, a1);
+ } __finally {
+ _PrintExit("LoadCursorW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HICON __stdcall Mine_LoadIconA(HINSTANCE a0,
+ LPCSTR a1)
+{
+ _PrintEnter("LoadIconA(%p,%hs)\n", a0, a1);
+
+ HICON rv = 0;
+ __try {
+ rv = Real_LoadIconA(a0, a1);
+ } __finally {
+ _PrintExit("LoadIconA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HICON __stdcall Mine_LoadIconW(HINSTANCE a0,
+ LPCWSTR a1)
+{
+ _PrintEnter("LoadIconW(%p,%ls)\n", a0, a1);
+
+ HICON rv = 0;
+ __try {
+ rv = Real_LoadIconW(a0, a1);
+ } __finally {
+ _PrintExit("LoadIconW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_LoadImageA(HINSTANCE a0,
+ LPCSTR a1,
+ UINT a2,
+ int a3,
+ int a4,
+ UINT a5)
+{
+ _PrintEnter("LoadImageA(%p,%hs,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_LoadImageA(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("LoadImageA(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_LoadImageW(HINSTANCE a0,
+ LPCWSTR a1,
+ UINT a2,
+ int a3,
+ int a4,
+ UINT a5)
+{
+ _PrintEnter("LoadImageW(%p,%ls,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_LoadImageW(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("LoadImageW(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HKL __stdcall Mine_LoadKeyboardLayoutA(LPCSTR a0,
+ UINT a1)
+{
+ _PrintEnter("LoadKeyboardLayoutA(%hs,%p)\n", a0, a1);
+
+ HKL rv = 0;
+ __try {
+ rv = Real_LoadKeyboardLayoutA(a0, a1);
+ } __finally {
+ _PrintExit("LoadKeyboardLayoutA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HKL __stdcall Mine_LoadKeyboardLayoutW(LPCWSTR a0,
+ UINT a1)
+{
+ _PrintEnter("LoadKeyboardLayoutW(%ls,%p)\n", a0, a1);
+
+ HKL rv = 0;
+ __try {
+ rv = Real_LoadKeyboardLayoutW(a0, a1);
+ } __finally {
+ _PrintExit("LoadKeyboardLayoutW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HMODULE __stdcall Mine_LoadLibraryA(LPCSTR a0)
+{
+ _PrintEnter("LoadLibraryA(%hs)\n", a0);
+
+ HMODULE rv = 0;
+ __try {
+ rv = Real_LoadLibraryA(a0);
+ } __finally {
+ _PrintExit("LoadLibraryA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HMODULE __stdcall Mine_LoadLibraryExA(LPCSTR a0,
+ HANDLE a1,
+ DWORD a2)
+{
+ _PrintEnter("LoadLibraryExA(%hs,%p,%p)\n", a0, a1, a2);
+
+ HMODULE rv = 0;
+ __try {
+ rv = Real_LoadLibraryExA(a0, a1, a2);
+ } __finally {
+ _PrintExit("LoadLibraryExA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HMODULE __stdcall Mine_LoadLibraryExW(LPCWSTR a0,
+ HANDLE a1,
+ DWORD a2)
+{
+ _PrintEnter("LoadLibraryExW(%ls,%p,%p)\n", a0, a1, a2);
+
+ HMODULE rv = 0;
+ __try {
+ rv = Real_LoadLibraryExW(a0, a1, a2);
+ } __finally {
+ _PrintExit("LoadLibraryExW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HMODULE __stdcall Mine_LoadLibraryW(LPCWSTR a0)
+{
+ _PrintEnter("LoadLibraryW(%ls)\n", a0);
+
+ HMODULE rv = 0;
+ __try {
+ rv = Real_LoadLibraryW(a0);
+ } __finally {
+ _PrintExit("LoadLibraryW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HMENU __stdcall Mine_LoadMenuA(HINSTANCE a0,
+ LPCSTR a1)
+{
+ _PrintEnter("LoadMenuA(%p,%hs)\n", a0, a1);
+
+ HMENU rv = 0;
+ __try {
+ rv = Real_LoadMenuA(a0, a1);
+ } __finally {
+ _PrintExit("LoadMenuA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HMENU __stdcall Mine_LoadMenuIndirectA(MENUTEMPLATEA* a0)
+{
+ _PrintEnter("LoadMenuIndirectA(%p)\n", a0);
+
+ HMENU rv = 0;
+ __try {
+ rv = Real_LoadMenuIndirectA(a0);
+ } __finally {
+ _PrintExit("LoadMenuIndirectA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HMENU __stdcall Mine_LoadMenuIndirectW(MENUTEMPLATEW* a0)
+{
+ _PrintEnter("LoadMenuIndirectW(%p)\n", a0);
+
+ HMENU rv = 0;
+ __try {
+ rv = Real_LoadMenuIndirectW(a0);
+ } __finally {
+ _PrintExit("LoadMenuIndirectW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HMENU __stdcall Mine_LoadMenuW(HINSTANCE a0,
+ LPCWSTR a1)
+{
+ _PrintEnter("LoadMenuW(%p,%ls)\n", a0, a1);
+
+ HMENU rv = 0;
+ __try {
+ rv = Real_LoadMenuW(a0, a1);
+ } __finally {
+ _PrintExit("LoadMenuW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_LoadModule(LPCSTR a0,
+ LPVOID a1)
+{
+ _PrintEnter("LoadModule(%hs,%p)\n", a0, a1);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_LoadModule(a0, a1);
+ } __finally {
+ _PrintExit("LoadModule(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HGLOBAL __stdcall Mine_LoadResource(HMODULE a0,
+ HRSRC a1)
+{
+ _PrintEnter("LoadResource(%p,%p)\n", a0, a1);
+
+ HGLOBAL rv = 0;
+ __try {
+ rv = Real_LoadResource(a0, a1);
+ } __finally {
+ _PrintExit("LoadResource(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_LoadStringA(HINSTANCE a0,
+ UINT a1,
+ LPSTR a2,
+ int a3)
+{
+ _PrintEnter("LoadStringA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ int rv = 0;
+ __try {
+ rv = Real_LoadStringA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("LoadStringA(,,%hs,) -> %p\n", a2, rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_LoadStringW(HINSTANCE a0,
+ UINT a1,
+ LPWSTR a2,
+ int a3)
+{
+ _PrintEnter("LoadStringW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ int rv = 0;
+ __try {
+ rv = Real_LoadStringW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("LoadStringW(,,%ls,) -> %p\n", a2, rv);
+ };
+ return rv;
+}
+
+HLOCAL __stdcall Mine_LocalAlloc(UINT a0,
+ SIZE_T a1)
+{
+ _PrintEnter("LocalAlloc(%p,%p)\n", a0, a1);
+
+ HLOCAL rv = 0;
+ __try {
+ rv = Real_LocalAlloc(a0, a1);
+ } __finally {
+ _PrintExit("LocalAlloc(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+SIZE_T __stdcall Mine_LocalCompact(UINT a0)
+{
+ _PrintEnter("LocalCompact(%p)\n", a0);
+
+ SIZE_T rv = 0;
+ __try {
+ rv = Real_LocalCompact(a0);
+ } __finally {
+ _PrintExit("LocalCompact() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_LocalFileTimeToFileTime(FILETIME* a0,
+ LPFILETIME a1)
+{
+ _PrintEnter("LocalFileTimeToFileTime(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_LocalFileTimeToFileTime(a0, a1);
+ } __finally {
+ _PrintExit("LocalFileTimeToFileTime(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_LocalFlags(HLOCAL a0)
+{
+ _PrintEnter("LocalFlags(%p)\n", a0);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_LocalFlags(a0);
+ } __finally {
+ _PrintExit("LocalFlags() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HLOCAL __stdcall Mine_LocalFree(HLOCAL a0)
+{
+ _PrintEnter("LocalFree(%p)\n", a0);
+
+ HLOCAL rv = 0;
+ __try {
+ rv = Real_LocalFree(a0);
+ } __finally {
+ _PrintExit("LocalFree() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HLOCAL __stdcall Mine_LocalHandle(LPCVOID a0)
+{
+ _PrintEnter("LocalHandle(%p)\n", a0);
+
+ HLOCAL rv = 0;
+ __try {
+ rv = Real_LocalHandle(a0);
+ } __finally {
+ _PrintExit("LocalHandle() -> %p\n", rv);
+ };
+ return rv;
+}
+
+LPVOID __stdcall Mine_LocalLock(HLOCAL a0)
+{
+ _PrintEnter("LocalLock(%p)\n", a0);
+
+ LPVOID rv = 0;
+ __try {
+ rv = Real_LocalLock(a0);
+ } __finally {
+ _PrintExit("LocalLock() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HLOCAL __stdcall Mine_LocalReAlloc(HLOCAL a0,
+ SIZE_T a1,
+ UINT a2)
+{
+ _PrintEnter("LocalReAlloc(%p,%p,%p)\n", a0, a1, a2);
+
+ HLOCAL rv = 0;
+ __try {
+ rv = Real_LocalReAlloc(a0, a1, a2);
+ } __finally {
+ _PrintExit("LocalReAlloc(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+SIZE_T __stdcall Mine_LocalShrink(HLOCAL a0,
+ UINT a1)
+{
+ _PrintEnter("LocalShrink(%p,%p)\n", a0, a1);
+
+ SIZE_T rv = 0;
+ __try {
+ rv = Real_LocalShrink(a0, a1);
+ } __finally {
+ _PrintExit("LocalShrink(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+SIZE_T __stdcall Mine_LocalSize(HLOCAL a0)
+{
+ _PrintEnter("LocalSize(%p)\n", a0);
+
+ SIZE_T rv = 0;
+ __try {
+ rv = Real_LocalSize(a0);
+ } __finally {
+ _PrintExit("LocalSize() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_LocalUnlock(HLOCAL a0)
+{
+ _PrintEnter("LocalUnlock(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_LocalUnlock(a0);
+ } __finally {
+ _PrintExit("LocalUnlock() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_LockFile(HANDLE a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3,
+ DWORD a4)
+{
+ _PrintEnter("LockFile(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_LockFile(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("LockFile(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_LockFileEx(HANDLE a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3,
+ DWORD a4,
+ LPOVERLAPPED a5)
+{
+ _PrintEnter("LockFileEx(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_LockFileEx(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("LockFileEx(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LPVOID __stdcall Mine_LockResource(HGLOBAL a0)
+{
+ _PrintEnter("LockResource(%p)\n", a0);
+
+ LPVOID rv = 0;
+ __try {
+ rv = Real_LockResource(a0);
+ } __finally {
+ _PrintExit("LockResource() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_LockWindowUpdate(HWND a0)
+{
+ _PrintEnter("LockWindowUpdate(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_LockWindowUpdate(a0);
+ } __finally {
+ _PrintExit("LockWindowUpdate() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_LookupIconIdFromDirectory(PBYTE a0,
+ BOOL a1)
+{
+ _PrintEnter("LookupIconIdFromDirectory(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_LookupIconIdFromDirectory(a0, a1);
+ } __finally {
+ _PrintExit("LookupIconIdFromDirectory(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_LookupIconIdFromDirectoryEx(PBYTE a0,
+ BOOL a1,
+ int a2,
+ int a3,
+ UINT a4)
+{
+ _PrintEnter("LookupIconIdFromDirectoryEx(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ int rv = 0;
+ __try {
+ rv = Real_LookupIconIdFromDirectoryEx(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("LookupIconIdFromDirectoryEx(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_MapDialogRect(HWND a0,
+ LPRECT a1)
+{
+ _PrintEnter("MapDialogRect(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_MapDialogRect(a0, a1);
+ } __finally {
+ _PrintExit("MapDialogRect(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LPVOID __stdcall Mine_MapViewOfFile(HANDLE a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3,
+ SIZE_T a4)
+{
+ _PrintEnter("MapViewOfFile(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ LPVOID rv = 0;
+ __try {
+ rv = Real_MapViewOfFile(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("MapViewOfFile(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LPVOID __stdcall Mine_MapViewOfFileEx(HANDLE a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3,
+ SIZE_T a4,
+ LPVOID a5)
+{
+ _PrintEnter("MapViewOfFileEx(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ LPVOID rv = 0;
+ __try {
+ rv = Real_MapViewOfFileEx(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("MapViewOfFileEx(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_MapVirtualKeyA(UINT a0,
+ UINT a1)
+{
+ _PrintEnter("MapVirtualKeyA(%p,%p)\n", a0, a1);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_MapVirtualKeyA(a0, a1);
+ } __finally {
+ _PrintExit("MapVirtualKeyA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_MapVirtualKeyExA(UINT a0,
+ UINT a1,
+ HKL a2)
+{
+ _PrintEnter("MapVirtualKeyExA(%p,%p,%p)\n", a0, a1, a2);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_MapVirtualKeyExA(a0, a1, a2);
+ } __finally {
+ _PrintExit("MapVirtualKeyExA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_MapVirtualKeyExW(UINT a0,
+ UINT a1,
+ HKL a2)
+{
+ _PrintEnter("MapVirtualKeyExW(%p,%p,%p)\n", a0, a1, a2);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_MapVirtualKeyExW(a0, a1, a2);
+ } __finally {
+ _PrintExit("MapVirtualKeyExW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_MapVirtualKeyW(UINT a0,
+ UINT a1)
+{
+ _PrintEnter("MapVirtualKeyW(%p,%p)\n", a0, a1);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_MapVirtualKeyW(a0, a1);
+ } __finally {
+ _PrintExit("MapVirtualKeyW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_MapWindowPoints(HWND a0,
+ HWND a1,
+ POINT* a2,
+ UINT a3)
+{
+ _PrintEnter("MapWindowPoints(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ int rv = 0;
+ __try {
+ rv = Real_MapWindowPoints(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("MapWindowPoints(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_MaskBlt(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ HDC a5,
+ int a6,
+ int a7,
+ HBITMAP a8,
+ int a9,
+ int a10,
+ DWORD a11)
+{
+ _PrintEnter("MaskBlt(%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_MaskBlt(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
+ } __finally {
+ _PrintExit("MaskBlt(,,,,,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_MenuItemFromPoint(HWND a0,
+ HMENU a1,
+ POINT a2)
+{
+ _PrintEnter("MenuItemFromPoint(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_MenuItemFromPoint(a0, a1, a2);
+ } __finally {
+ _PrintExit("MenuItemFromPoint(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_MessageBeep(UINT a0)
+{
+ _PrintEnter("MessageBeep(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_MessageBeep(a0);
+ } __finally {
+ _PrintExit("MessageBeep() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_MessageBoxA(HWND a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ UINT a3)
+{
+ _PrintEnter("MessageBoxA(%p,%hs,%hs,%p)\n", a0, a1, a2, a3);
+
+ int rv = 0;
+ __try {
+ rv = Real_MessageBoxA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("MessageBoxA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_MessageBoxExA(HWND a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ UINT a3,
+ WORD a4)
+{
+ _PrintEnter("MessageBoxExA(%p,%hs,%hs,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ int rv = 0;
+ __try {
+ rv = Real_MessageBoxExA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("MessageBoxExA(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_MessageBoxExW(HWND a0,
+ LPCWSTR a1,
+ LPCWSTR a2,
+ UINT a3,
+ WORD a4)
+{
+ _PrintEnter("MessageBoxExW(%p,%ls,%ls,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ int rv = 0;
+ __try {
+ rv = Real_MessageBoxExW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("MessageBoxExW(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_MessageBoxIndirectA(MSGBOXPARAMSA* a0)
+{
+ _PrintEnter("MessageBoxIndirectA(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_MessageBoxIndirectA(a0);
+ } __finally {
+ _PrintExit("MessageBoxIndirectA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_MessageBoxIndirectW(MSGBOXPARAMSW* a0)
+{
+ _PrintEnter("MessageBoxIndirectW(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_MessageBoxIndirectW(a0);
+ } __finally {
+ _PrintExit("MessageBoxIndirectW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_MessageBoxW(HWND a0,
+ LPCWSTR a1,
+ LPCWSTR a2,
+ UINT a3)
+{
+ _PrintEnter("MessageBoxW(%p,%ls,%ls,%p)\n", a0, a1, a2, a3);
+
+ int rv = 0;
+ __try {
+ rv = Real_MessageBoxW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("MessageBoxW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_MkParseDisplayName(IBindCtx* a0,
+ LPCOLESTR a1,
+ ULONG* a2,
+ IMoniker** a3)
+{
+ _PrintEnter("MkParseDisplayName(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_MkParseDisplayName(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("MkParseDisplayName(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ModifyMenuA(HMENU a0,
+ UINT a1,
+ UINT a2,
+ UINT_PTR a3,
+ LPCSTR a4)
+{
+ _PrintEnter("ModifyMenuA(%p,%p,%p,%p,%hs)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ModifyMenuA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("ModifyMenuA(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ModifyMenuW(HMENU a0,
+ UINT a1,
+ UINT a2,
+ UINT_PTR a3,
+ LPCWSTR a4)
+{
+ _PrintEnter("ModifyMenuW(%p,%p,%p,%p,%ls)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ModifyMenuW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("ModifyMenuW(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ModifyWorldTransform(HDC a0,
+ XFORM* a1,
+ DWORD a2)
+{
+ _PrintEnter("ModifyWorldTransform(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ModifyWorldTransform(a0, a1, a2);
+ } __finally {
+ _PrintExit("ModifyWorldTransform(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_MonikerCommonPrefixWith(IMoniker* a0,
+ IMoniker* a1,
+ IMoniker** a2)
+{
+ _PrintEnter("MonikerCommonPrefixWith(%p,%p,%p)\n", a0, a1, a2);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_MonikerCommonPrefixWith(a0, a1, a2);
+ } __finally {
+ _PrintExit("MonikerCommonPrefixWith(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_MonikerRelativePathTo(IMoniker* a0,
+ IMoniker* a1,
+ IMoniker** a2,
+ BOOL a3)
+{
+ _PrintEnter("MonikerRelativePathTo(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_MonikerRelativePathTo(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("MonikerRelativePathTo(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_MoveFileA(LPCSTR a0,
+ LPCSTR a1)
+{
+ _PrintEnter("MoveFileA(%hs,%hs)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_MoveFileA(a0, a1);
+ } __finally {
+ _PrintExit("MoveFileA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_MoveFileExA(LPCSTR a0,
+ LPCSTR a1,
+ DWORD a2)
+{
+ _PrintEnter("MoveFileExA(%hs,%hs,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_MoveFileExA(a0, a1, a2);
+ } __finally {
+ _PrintExit("MoveFileExA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_MoveFileExW(LPCWSTR a0,
+ LPCWSTR a1,
+ DWORD a2)
+{
+ _PrintEnter("MoveFileExW(%ls,%ls,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_MoveFileExW(a0, a1, a2);
+ } __finally {
+ _PrintExit("MoveFileExW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_MoveFileW(LPCWSTR a0,
+ LPCWSTR a1)
+{
+ _PrintEnter("MoveFileW(%ls,%ls)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_MoveFileW(a0, a1);
+ } __finally {
+ _PrintExit("MoveFileW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_MoveToEx(HDC a0,
+ int a1,
+ int a2,
+ POINT* a3)
+{
+ _PrintEnter("MoveToEx(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_MoveToEx(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("MoveToEx(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_MoveWindow(HWND a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ BOOL a5)
+{
+ _PrintEnter("MoveWindow(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_MoveWindow(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("MoveWindow(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_MsgWaitForMultipleObjects(DWORD a0,
+ void** a1,
+ BOOL a2,
+ DWORD a3,
+ DWORD a4)
+{
+ _PrintEnter("MsgWaitForMultipleObjects(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_MsgWaitForMultipleObjects(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("MsgWaitForMultipleObjects(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_MsgWaitForMultipleObjectsEx(DWORD a0,
+ void** a1,
+ DWORD a2,
+ DWORD a3,
+ DWORD a4)
+{
+ _PrintEnter("MsgWaitForMultipleObjectsEx(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_MsgWaitForMultipleObjectsEx(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("MsgWaitForMultipleObjectsEx(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_MulDiv(int a0,
+ int a1,
+ int a2)
+{
+ _PrintEnter("MulDiv(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_MulDiv(a0, a1, a2);
+ } __finally {
+ _PrintExit("MulDiv(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_OemKeyScan(WORD a0)
+{
+ _PrintEnter("OemKeyScan(%p)\n", a0);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_OemKeyScan(a0);
+ } __finally {
+ _PrintExit("OemKeyScan() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_OemToCharA(LPCSTR a0,
+ LPSTR a1)
+{
+ _PrintEnter("OemToCharA(%hs,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_OemToCharA(a0, a1);
+ } __finally {
+ _PrintExit("OemToCharA(,%hs) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_OemToCharBuffA(LPCSTR a0,
+ LPSTR a1,
+ DWORD a2)
+{
+ _PrintEnter("OemToCharBuffA(%hs,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_OemToCharBuffA(a0, a1, a2);
+ } __finally {
+ _PrintExit("OemToCharBuffA(,%hs,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_OemToCharBuffW(LPCSTR a0,
+ LPWSTR a1,
+ DWORD a2)
+{
+ _PrintEnter("OemToCharBuffW(%hs,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_OemToCharBuffW(a0, a1, a2);
+ } __finally {
+ _PrintExit("OemToCharBuffW(,%ls,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_OemToCharW(LPCSTR a0,
+ LPWSTR a1)
+{
+ _PrintEnter("OemToCharW(%hs,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_OemToCharW(a0, a1);
+ } __finally {
+ _PrintExit("OemToCharW(,%ls) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_OffsetClipRgn(HDC a0,
+ int a1,
+ int a2)
+{
+ _PrintEnter("OffsetClipRgn(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_OffsetClipRgn(a0, a1, a2);
+ } __finally {
+ _PrintExit("OffsetClipRgn(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_OffsetRect(LPRECT a0,
+ int a1,
+ int a2)
+{
+ _PrintEnter("OffsetRect(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_OffsetRect(a0, a1, a2);
+ } __finally {
+ _PrintExit("OffsetRect(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_OffsetRgn(HRGN a0,
+ int a1,
+ int a2)
+{
+ _PrintEnter("OffsetRgn(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_OffsetRgn(a0, a1, a2);
+ } __finally {
+ _PrintExit("OffsetRgn(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_OffsetViewportOrgEx(HDC a0,
+ int a1,
+ int a2,
+ POINT* a3)
+{
+ _PrintEnter("OffsetViewportOrgEx(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_OffsetViewportOrgEx(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("OffsetViewportOrgEx(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_OffsetWindowOrgEx(HDC a0,
+ int a1,
+ int a2,
+ POINT* a3)
+{
+ _PrintEnter("OffsetWindowOrgEx(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_OffsetWindowOrgEx(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("OffsetWindowOrgEx(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_OleBuildVersion(void)
+{
+ _PrintEnter("OleBuildVersion()\n");
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_OleBuildVersion();
+ } __finally {
+ _PrintExit("OleBuildVersion() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleConvertIStorageToOLESTREAM(LPSTORAGE a0,
+ LPOLESTREAM a1)
+{
+ _PrintEnter("OleConvertIStorageToOLESTREAM(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleConvertIStorageToOLESTREAM(a0, a1);
+ } __finally {
+ _PrintExit("OleConvertIStorageToOLESTREAM(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleConvertIStorageToOLESTREAMEx(LPSTORAGE a0,
+ CLIPFORMAT a1,
+ LONG a2,
+ LONG a3,
+ DWORD a4,
+ LPSTGMEDIUM a5,
+ LPOLESTREAM a6)
+{
+ _PrintEnter("OleConvertIStorageToOLESTREAMEx(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleConvertIStorageToOLESTREAMEx(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("OleConvertIStorageToOLESTREAMEx(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleConvertOLESTREAMToIStorage(LPOLESTREAM a0,
+ LPSTORAGE a1,
+ DVTARGETDEVICE* a2)
+{
+ _PrintEnter("OleConvertOLESTREAMToIStorage(%p,%p,%p)\n", a0, a1, a2);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleConvertOLESTREAMToIStorage(a0, a1, a2);
+ } __finally {
+ _PrintExit("OleConvertOLESTREAMToIStorage(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleConvertOLESTREAMToIStorageEx(LPOLESTREAM a0,
+ LPSTORAGE a1,
+ CLIPFORMAT* a2,
+ LONG* a3,
+ LONG* a4,
+ DWORD* a5,
+ LPSTGMEDIUM a6)
+{
+ _PrintEnter("OleConvertOLESTREAMToIStorageEx(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleConvertOLESTREAMToIStorageEx(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("OleConvertOLESTREAMToIStorageEx(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleCreate(CONST IID& a0,
+ CONST IID& a1,
+ DWORD a2,
+ LPFORMATETC a3,
+ LPOLECLIENTSITE a4,
+ LPSTORAGE a5,
+ LPVOID* a6)
+{
+ _PrintEnter("OleCreate(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleCreate(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("OleCreate(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleCreateDefaultHandler(CONST IID& a0,
+ LPUNKNOWN a1,
+ CONST IID& a2,
+ LPVOID* a3)
+{
+ _PrintEnter("OleCreateDefaultHandler(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleCreateDefaultHandler(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("OleCreateDefaultHandler(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleCreateEmbeddingHelper(CONST IID& a0,
+ LPUNKNOWN a1,
+ DWORD a2,
+ LPCLASSFACTORY a3,
+ CONST IID& a4,
+ LPVOID* a5)
+{
+ _PrintEnter("OleCreateEmbeddingHelper(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleCreateEmbeddingHelper(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("OleCreateEmbeddingHelper(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleCreateEx(CONST IID& a0,
+ CONST IID& a1,
+ DWORD a2,
+ DWORD a3,
+ ULONG a4,
+ DWORD* a5,
+ LPFORMATETC a6,
+ IAdviseSink* a7,
+ DWORD* a8,
+ LPOLECLIENTSITE a9,
+ LPSTORAGE a10,
+ LPVOID* a11)
+{
+ _PrintEnter("OleCreateEx(%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleCreateEx(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
+ } __finally {
+ _PrintExit("OleCreateEx(,,,,,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleCreateFromData(IDataObject* a0,
+ CONST IID& a1,
+ DWORD a2,
+ LPFORMATETC a3,
+ LPOLECLIENTSITE a4,
+ LPSTORAGE a5,
+ LPVOID* a6)
+{
+ _PrintEnter("OleCreateFromData(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleCreateFromData(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("OleCreateFromData(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleCreateFromDataEx(IDataObject* a0,
+ CONST IID& a1,
+ DWORD a2,
+ DWORD a3,
+ ULONG a4,
+ DWORD* a5,
+ LPFORMATETC a6,
+ IAdviseSink* a7,
+ DWORD* a8,
+ LPOLECLIENTSITE a9,
+ LPSTORAGE a10,
+ LPVOID* a11)
+{
+ _PrintEnter("OleCreateFromDataEx(%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleCreateFromDataEx(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
+ } __finally {
+ _PrintExit("OleCreateFromDataEx(,,,,,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleCreateFromFile(CONST IID& a0,
+ LPCOLESTR a1,
+ CONST IID& a2,
+ DWORD a3,
+ LPFORMATETC a4,
+ LPOLECLIENTSITE a5,
+ LPSTORAGE a6,
+ LPVOID* a7)
+{
+ _PrintEnter("OleCreateFromFile(%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleCreateFromFile(a0, a1, a2, a3, a4, a5, a6, a7);
+ } __finally {
+ _PrintExit("OleCreateFromFile(,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleCreateFromFileEx(CONST IID& a0,
+ LPCOLESTR a1,
+ CONST IID& a2,
+ DWORD a3,
+ DWORD a4,
+ ULONG a5,
+ DWORD* a6,
+ LPFORMATETC a7,
+ IAdviseSink* a8,
+ DWORD* a9,
+ LPOLECLIENTSITE a10,
+ LPSTORAGE a11,
+ LPVOID* a12)
+{
+ _PrintEnter("OleCreateFromFileEx(%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleCreateFromFileEx(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12);
+ } __finally {
+ _PrintExit("OleCreateFromFileEx(,,,,,,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleCreateLink(IMoniker* a0,
+ CONST IID& a1,
+ DWORD a2,
+ LPFORMATETC a3,
+ LPOLECLIENTSITE a4,
+ LPSTORAGE a5,
+ LPVOID* a6)
+{
+ _PrintEnter("OleCreateLink(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleCreateLink(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("OleCreateLink(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleCreateLinkEx(IMoniker* a0,
+ CONST IID& a1,
+ DWORD a2,
+ DWORD a3,
+ ULONG a4,
+ DWORD* a5,
+ LPFORMATETC a6,
+ IAdviseSink* a7,
+ DWORD* a8,
+ LPOLECLIENTSITE a9,
+ LPSTORAGE a10,
+ LPVOID* a11)
+{
+ _PrintEnter("OleCreateLinkEx(%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleCreateLinkEx(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
+ } __finally {
+ _PrintExit("OleCreateLinkEx(,,,,,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleCreateLinkFromData(IDataObject* a0,
+ CONST IID& a1,
+ DWORD a2,
+ LPFORMATETC a3,
+ LPOLECLIENTSITE a4,
+ LPSTORAGE a5,
+ LPVOID* a6)
+{
+ _PrintEnter("OleCreateLinkFromData(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleCreateLinkFromData(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("OleCreateLinkFromData(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleCreateLinkFromDataEx(IDataObject* a0,
+ CONST IID& a1,
+ DWORD a2,
+ DWORD a3,
+ ULONG a4,
+ DWORD* a5,
+ LPFORMATETC a6,
+ IAdviseSink* a7,
+ DWORD* a8,
+ LPOLECLIENTSITE a9,
+ LPSTORAGE a10,
+ LPVOID* a11)
+{
+ _PrintEnter("OleCreateLinkFromDataEx(%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleCreateLinkFromDataEx(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
+ } __finally {
+ _PrintExit("OleCreateLinkFromDataEx(,,,,,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleCreateLinkToFile(LPCOLESTR a0,
+ CONST IID& a1,
+ DWORD a2,
+ LPFORMATETC a3,
+ LPOLECLIENTSITE a4,
+ LPSTORAGE a5,
+ LPVOID* a6)
+{
+ _PrintEnter("OleCreateLinkToFile(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleCreateLinkToFile(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("OleCreateLinkToFile(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleCreateLinkToFileEx(LPCOLESTR a0,
+ CONST IID& a1,
+ DWORD a2,
+ DWORD a3,
+ ULONG a4,
+ DWORD* a5,
+ LPFORMATETC a6,
+ IAdviseSink* a7,
+ DWORD* a8,
+ LPOLECLIENTSITE a9,
+ LPSTORAGE a10,
+ LPVOID* a11)
+{
+ _PrintEnter("OleCreateLinkToFileEx(%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleCreateLinkToFileEx(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
+ } __finally {
+ _PrintExit("OleCreateLinkToFileEx(,,,,,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HOLEMENU __stdcall Mine_OleCreateMenuDescriptor(HMENU a0,
+ LPOLEMENUGROUPWIDTHS a1)
+{
+ _PrintEnter("OleCreateMenuDescriptor(%p,%p)\n", a0, a1);
+
+ HOLEMENU rv = 0;
+ __try {
+ rv = Real_OleCreateMenuDescriptor(a0, a1);
+ } __finally {
+ _PrintExit("OleCreateMenuDescriptor(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleCreateStaticFromData(IDataObject* a0,
+ CONST IID& a1,
+ DWORD a2,
+ LPFORMATETC a3,
+ LPOLECLIENTSITE a4,
+ LPSTORAGE a5,
+ LPVOID* a6)
+{
+ _PrintEnter("OleCreateStaticFromData(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleCreateStaticFromData(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("OleCreateStaticFromData(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleDestroyMenuDescriptor(HOLEMENU a0)
+{
+ _PrintEnter("OleDestroyMenuDescriptor(%p)\n", a0);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleDestroyMenuDescriptor(a0);
+ } __finally {
+ _PrintExit("OleDestroyMenuDescriptor() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleDoAutoConvert(LPSTORAGE a0,
+ LPGUID a1)
+{
+ _PrintEnter("OleDoAutoConvert(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleDoAutoConvert(a0, a1);
+ } __finally {
+ _PrintExit("OleDoAutoConvert(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleDraw(LPUNKNOWN a0,
+ DWORD a1,
+ HDC a2,
+ LPCRECT a3)
+{
+ _PrintEnter("OleDraw(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleDraw(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("OleDraw(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_OleDuplicateData(HANDLE a0,
+ CLIPFORMAT a1,
+ UINT a2)
+{
+ _PrintEnter("OleDuplicateData(%p,%p,%p)\n", a0, a1, a2);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_OleDuplicateData(a0, a1, a2);
+ } __finally {
+ _PrintExit("OleDuplicateData(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleFlushClipboard(void)
+{
+ _PrintEnter("OleFlushClipboard()\n");
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleFlushClipboard();
+ } __finally {
+ _PrintExit("OleFlushClipboard() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleGetAutoConvert(CONST IID& a0,
+ LPGUID a1)
+{
+ _PrintEnter("OleGetAutoConvert(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleGetAutoConvert(a0, a1);
+ } __finally {
+ _PrintExit("OleGetAutoConvert(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleGetClipboard(IDataObject** a0)
+{
+ _PrintEnter("OleGetClipboard(%p)\n", a0);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleGetClipboard(a0);
+ } __finally {
+ _PrintExit("OleGetClipboard() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HGLOBAL __stdcall Mine_OleGetIconOfClass(CONST IID& a0,
+ LPOLESTR a1,
+ BOOL a2)
+{
+ _PrintEnter("OleGetIconOfClass(%p,%p,%p)\n", a0, a1, a2);
+
+ HGLOBAL rv = 0;
+ __try {
+ rv = Real_OleGetIconOfClass(a0, a1, a2);
+ } __finally {
+ _PrintExit("OleGetIconOfClass(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HGLOBAL __stdcall Mine_OleGetIconOfFile(LPOLESTR a0,
+ BOOL a1)
+{
+ _PrintEnter("OleGetIconOfFile(%p,%p)\n", a0, a1);
+
+ HGLOBAL rv = 0;
+ __try {
+ rv = Real_OleGetIconOfFile(a0, a1);
+ } __finally {
+ _PrintExit("OleGetIconOfFile(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleInitialize(LPVOID a0)
+{
+ _PrintEnter("OleInitialize(%p)\n", a0);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleInitialize(a0);
+ } __finally {
+ _PrintExit("OleInitialize() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleIsCurrentClipboard(IDataObject* a0)
+{
+ _PrintEnter("OleIsCurrentClipboard(%p)\n", a0);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleIsCurrentClipboard(a0);
+ } __finally {
+ _PrintExit("OleIsCurrentClipboard() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_OleIsRunning(IOleObject* a0)
+{
+ _PrintEnter("OleIsRunning(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_OleIsRunning(a0);
+ } __finally {
+ _PrintExit("OleIsRunning() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleLoad(LPSTORAGE a0,
+ CONST IID& a1,
+ LPOLECLIENTSITE a2,
+ LPVOID* a3)
+{
+ _PrintEnter("OleLoad(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleLoad(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("OleLoad(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleLoadFromStream(LPSTREAM a0,
+ CONST IID& a1,
+ LPVOID* a2)
+{
+ _PrintEnter("OleLoadFromStream(%p,%p,%p)\n", a0, a1, a2);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleLoadFromStream(a0, a1, a2);
+ } __finally {
+ _PrintExit("OleLoadFromStream(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleLockRunning(LPUNKNOWN a0,
+ BOOL a1,
+ BOOL a2)
+{
+ _PrintEnter("OleLockRunning(%p,%p,%p)\n", a0, a1, a2);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleLockRunning(a0, a1, a2);
+ } __finally {
+ _PrintExit("OleLockRunning(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HGLOBAL __stdcall Mine_OleMetafilePictFromIconAndLabel(HICON a0,
+ LPOLESTR a1,
+ LPOLESTR a2,
+ UINT a3)
+{
+ _PrintEnter("OleMetafilePictFromIconAndLabel(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HGLOBAL rv = 0;
+ __try {
+ rv = Real_OleMetafilePictFromIconAndLabel(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("OleMetafilePictFromIconAndLabel(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleNoteObjectVisible(LPUNKNOWN a0,
+ BOOL a1)
+{
+ _PrintEnter("OleNoteObjectVisible(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleNoteObjectVisible(a0, a1);
+ } __finally {
+ _PrintExit("OleNoteObjectVisible(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleQueryCreateFromData(IDataObject* a0)
+{
+ _PrintEnter("OleQueryCreateFromData(%p)\n", a0);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleQueryCreateFromData(a0);
+ } __finally {
+ _PrintExit("OleQueryCreateFromData() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleQueryLinkFromData(IDataObject* a0)
+{
+ _PrintEnter("OleQueryLinkFromData(%p)\n", a0);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleQueryLinkFromData(a0);
+ } __finally {
+ _PrintExit("OleQueryLinkFromData() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleRegEnumFormatEtc(CONST IID& a0,
+ DWORD a1,
+ IEnumFORMATETC** a2)
+{
+ _PrintEnter("OleRegEnumFormatEtc(%p,%p,%p)\n", a0, a1, a2);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleRegEnumFormatEtc(a0, a1, a2);
+ } __finally {
+ _PrintExit("OleRegEnumFormatEtc(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleRegEnumVerbs(CONST IID& a0,
+ IEnumOLEVERB** a1)
+{
+ _PrintEnter("OleRegEnumVerbs(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleRegEnumVerbs(a0, a1);
+ } __finally {
+ _PrintExit("OleRegEnumVerbs(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleRegGetMiscStatus(CONST IID& a0,
+ DWORD a1,
+ DWORD* a2)
+{
+ _PrintEnter("OleRegGetMiscStatus(%p,%p,%p)\n", a0, a1, a2);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleRegGetMiscStatus(a0, a1, a2);
+ } __finally {
+ _PrintExit("OleRegGetMiscStatus(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleRegGetUserType(CONST IID& a0,
+ DWORD a1,
+ LPOLESTR* a2)
+{
+ _PrintEnter("OleRegGetUserType(%p,%p,%p)\n", a0, a1, a2);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleRegGetUserType(a0, a1, a2);
+ } __finally {
+ _PrintExit("OleRegGetUserType(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleRun(LPUNKNOWN a0)
+{
+ _PrintEnter("OleRun(%p)\n", a0);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleRun(a0);
+ } __finally {
+ _PrintExit("OleRun() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleSave(LPPERSISTSTORAGE a0,
+ LPSTORAGE a1,
+ BOOL a2)
+{
+ _PrintEnter("OleSave(%p,%p,%p)\n", a0, a1, a2);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleSave(a0, a1, a2);
+ } __finally {
+ _PrintExit("OleSave(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleSaveToStream(IPersistStream* a0,
+ LPSTREAM a1)
+{
+ _PrintEnter("OleSaveToStream(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleSaveToStream(a0, a1);
+ } __finally {
+ _PrintExit("OleSaveToStream(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleSetAutoConvert(CONST IID& a0,
+ CONST IID& a1)
+{
+ _PrintEnter("OleSetAutoConvert(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleSetAutoConvert(a0, a1);
+ } __finally {
+ _PrintExit("OleSetAutoConvert(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleSetClipboard(IDataObject* a0)
+{
+ _PrintEnter("OleSetClipboard(%p)\n", a0);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleSetClipboard(a0);
+ } __finally {
+ _PrintExit("OleSetClipboard() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleSetContainedObject(LPUNKNOWN a0,
+ BOOL a1)
+{
+ _PrintEnter("OleSetContainedObject(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleSetContainedObject(a0, a1);
+ } __finally {
+ _PrintExit("OleSetContainedObject(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleSetMenuDescriptor(HOLEMENU a0,
+ HWND a1,
+ HWND a2,
+ LPOLEINPLACEFRAME a3,
+ LPOLEINPLACEACTIVEOBJECT a4)
+{
+ _PrintEnter("OleSetMenuDescriptor(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleSetMenuDescriptor(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("OleSetMenuDescriptor(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_OleTranslateAccelerator(LPOLEINPLACEFRAME a0,
+ LPOLEINPLACEFRAMEINFO a1,
+ LPMSG a2)
+{
+ _PrintEnter("OleTranslateAccelerator(%p,%p,%p)\n", a0, a1, a2);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_OleTranslateAccelerator(a0, a1, a2);
+ } __finally {
+ _PrintExit("OleTranslateAccelerator(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+void __stdcall Mine_OleUninitialize(void)
+{
+ _PrintEnter("OleUninitialize()\n");
+
+ __try {
+ Real_OleUninitialize();
+ } __finally {
+ _PrintExit("OleUninitialize() ->\n");
+ };
+}
+
+BOOL __stdcall Mine_OpenClipboard(HWND a0)
+{
+ _PrintEnter("OpenClipboard(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_OpenClipboard(a0);
+ } __finally {
+ _PrintExit("OpenClipboard() -> %p\n", rv);
+ };
+ return rv;
+}
+
+#if _MSC_VER < 1300
+HDESK __stdcall Mine_OpenDesktopA(LPSTR a0,
+ DWORD a1,
+ BOOL a2,
+ ACCESS_MASK a3)
+#else
+HDESK __stdcall Mine_OpenDesktopA(LPCSTR a0,
+ DWORD a1,
+ BOOL a2,
+ ACCESS_MASK a3)
+#endif
+{
+ _PrintEnter("OpenDesktopA(%hs,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HDESK rv = 0;
+ __try {
+ rv = Real_OpenDesktopA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("OpenDesktopA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+#if _MSC_VER < 1300
+HDESK __stdcall Mine_OpenDesktopW(LPWSTR a0,
+ DWORD a1,
+ BOOL a2,
+ ACCESS_MASK a3)
+#else
+HDESK __stdcall Mine_OpenDesktopW(LPCWSTR a0,
+ DWORD a1,
+ BOOL a2,
+ ACCESS_MASK a3)
+#endif
+{
+ _PrintEnter("OpenDesktopW(%ls,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HDESK rv = 0;
+ __try {
+ rv = Real_OpenDesktopW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("OpenDesktopW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_OpenEventA(DWORD a0,
+ BOOL a1,
+ LPCSTR a2)
+{
+ _PrintEnter("OpenEventA(%p,%p,%hs)\n", a0, a1, a2);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_OpenEventA(a0, a1, a2);
+ } __finally {
+ _PrintExit("OpenEventA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_OpenEventW(DWORD a0,
+ BOOL a1,
+ LPCWSTR a2)
+{
+ _PrintEnter("OpenEventW(%p,%p,%ls)\n", a0, a1, a2);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_OpenEventW(a0, a1, a2);
+ } __finally {
+ _PrintExit("OpenEventW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HFILE __stdcall Mine_OpenFile(LPCSTR a0,
+ LPOFSTRUCT a1,
+ UINT a2)
+{
+ _PrintEnter("OpenFile(%hs,%p,%p)\n", a0, a1, a2);
+
+ HFILE rv = 0;
+ __try {
+ rv = Real_OpenFile(a0, a1, a2);
+ } __finally {
+ _PrintExit("OpenFile(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_OpenFileMappingA(DWORD a0,
+ BOOL a1,
+ LPCSTR a2)
+{
+ _PrintEnter("OpenFileMappingA(%p,%p,%hs)\n", a0, a1, a2);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_OpenFileMappingA(a0, a1, a2);
+ } __finally {
+ _PrintExit("OpenFileMappingA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_OpenFileMappingW(DWORD a0,
+ BOOL a1,
+ LPCWSTR a2)
+{
+ _PrintEnter("OpenFileMappingW(%p,%p,%ls)\n", a0, a1, a2);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_OpenFileMappingW(a0, a1, a2);
+ } __finally {
+ _PrintExit("OpenFileMappingW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_OpenIcon(HWND a0)
+{
+ _PrintEnter("OpenIcon(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_OpenIcon(a0);
+ } __finally {
+ _PrintExit("OpenIcon() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HDESK __stdcall Mine_OpenInputDesktop(DWORD a0,
+ BOOL a1,
+ ACCESS_MASK a2)
+{
+ _PrintEnter("OpenInputDesktop(%p,%p,%p)\n", a0, a1, a2);
+
+ HDESK rv = 0;
+ __try {
+ rv = Real_OpenInputDesktop(a0, a1, a2);
+ } __finally {
+ _PrintExit("OpenInputDesktop(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_OpenMutexA(DWORD a0,
+ BOOL a1,
+ LPCSTR a2)
+{
+ _PrintEnter("OpenMutexA(%p,%p,%hs)\n", a0, a1, a2);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_OpenMutexA(a0, a1, a2);
+ } __finally {
+ _PrintExit("OpenMutexA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_OpenMutexW(DWORD a0,
+ BOOL a1,
+ LPCWSTR a2)
+{
+ _PrintEnter("OpenMutexW(%p,%p,%ls)\n", a0, a1, a2);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_OpenMutexW(a0, a1, a2);
+ } __finally {
+ _PrintExit("OpenMutexW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_OpenProcess(DWORD a0,
+ BOOL a1,
+ DWORD pid)
+{
+ _PrintEnter("OpenProcess(%p,%p,pid=%d)\n", a0, a1, pid);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_OpenProcess(a0, a1, pid);
+ } __finally {
+ _PrintExit("OpenProcess(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_OpenProcessToken(__in HANDLE ProcessHandle,
+ __in DWORD DesiredAccess,
+ __out PHANDLE TokenHandle
+ )
+{
+ _PrintEnter("OpenProcessToken(%p,%p,%p)\n",
+ ProcessHandle,
+ DesiredAccess,
+ TokenHandle);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_OpenProcessToken(ProcessHandle,
+ DesiredAccess,
+ TokenHandle);
+
+ } __finally {
+ _PrintExit("OpenProcessToken(,,%p) -> %p\n",
+ TokenHandle != NULL ? *TokenHandle : 0,
+ rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_OpenSemaphoreA(DWORD a0,
+ BOOL a1,
+ LPCSTR a2)
+{
+ _PrintEnter("OpenSemaphoreA(%p,%p,%hs)\n", a0, a1, a2);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_OpenSemaphoreA(a0, a1, a2);
+ } __finally {
+ _PrintExit("OpenSemaphoreA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_OpenSemaphoreW(DWORD a0,
+ BOOL a1,
+ LPCWSTR a2)
+{
+ _PrintEnter("OpenSemaphoreW(%p,%p,%ls)\n", a0, a1, a2);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_OpenSemaphoreW(a0, a1, a2);
+ } __finally {
+ _PrintExit("OpenSemaphoreW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_OpenWaitableTimerA(DWORD a0,
+ BOOL a1,
+ LPCSTR a2)
+{
+ _PrintEnter("OpenWaitableTimerA(%p,%p,%hs)\n", a0, a1, a2);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_OpenWaitableTimerA(a0, a1, a2);
+ } __finally {
+ _PrintExit("OpenWaitableTimerA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_OpenWaitableTimerW(DWORD a0,
+ BOOL a1,
+ LPCWSTR a2)
+{
+ _PrintEnter("OpenWaitableTimerW(%p,%p,%ls)\n", a0, a1, a2);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_OpenWaitableTimerW(a0, a1, a2);
+ } __finally {
+ _PrintExit("OpenWaitableTimerW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+#if _MSC_VER < 1300
+HWINSTA __stdcall Mine_OpenWindowStationA(LPSTR a0,
+ BOOL a1,
+ ACCESS_MASK a2)
+#else
+HWINSTA __stdcall Mine_OpenWindowStationA(LPCSTR a0,
+ BOOL a1,
+ ACCESS_MASK a2)
+#endif
+{
+ _PrintEnter("OpenWindowStationA(%hs,%p,%p)\n", a0, a1, a2);
+
+ HWINSTA rv = 0;
+ __try {
+ rv = Real_OpenWindowStationA(a0, a1, a2);
+ } __finally {
+ _PrintExit("OpenWindowStationA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+#if _MSC_VER < 1300
+HWINSTA __stdcall Mine_OpenWindowStationW(LPWSTR a0,
+ BOOL a1,
+ ACCESS_MASK a2)
+#else
+HWINSTA __stdcall Mine_OpenWindowStationW(LPCWSTR a0,
+ BOOL a1,
+ ACCESS_MASK a2)
+#endif
+{
+ _PrintEnter("OpenWindowStationW(%ls,%p,%p)\n", a0, a1, a2);
+
+ HWINSTA rv = 0;
+ __try {
+ rv = Real_OpenWindowStationW(a0, a1, a2);
+ } __finally {
+ _PrintExit("OpenWindowStationW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+void __stdcall Mine_OutputDebugStringA(LPCSTR a0)
+{
+ _PrintEnter("OutputDebugStringA(%hs)\n", a0);
+
+ __try {
+ Real_OutputDebugStringA(a0);
+ } __finally {
+ _PrintExit("OutputDebugStringA() ->\n");
+ };
+}
+
+void __stdcall Mine_OutputDebugStringW(LPCWSTR a0)
+{
+ _PrintEnter("OutputDebugStringW(%ls)\n", a0);
+
+ __try {
+ Real_OutputDebugStringW(a0);
+ } __finally {
+ _PrintExit("OutputDebugStringW() ->\n");
+ };
+}
+
+LPARAM __stdcall Mine_PackDDElParam(UINT a0,
+ UINT_PTR a1,
+ UINT_PTR a2)
+{
+ _PrintEnter("PackDDElParam(%p,%p,%p)\n", a0, a1, a2);
+
+ LPARAM rv = 0;
+ __try {
+ rv = Real_PackDDElParam(a0, a1, a2);
+ } __finally {
+ _PrintExit("PackDDElParam(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PaintDesktop(HDC a0)
+{
+ _PrintEnter("PaintDesktop(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PaintDesktop(a0);
+ } __finally {
+ _PrintExit("PaintDesktop() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PaintRgn(HDC a0,
+ HRGN a1)
+{
+ _PrintEnter("PaintRgn(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PaintRgn(a0, a1);
+ } __finally {
+ _PrintExit("PaintRgn(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PatBlt(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ DWORD a5)
+{
+ _PrintEnter("PatBlt(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PatBlt(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("PatBlt(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRGN __stdcall Mine_PathToRegion(HDC a0)
+{
+ _PrintEnter("PathToRegion(%p)\n", a0);
+
+ HRGN rv = 0;
+ __try {
+ rv = Real_PathToRegion(a0);
+ } __finally {
+ _PrintExit("PathToRegion() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PeekConsoleInputA(HANDLE a0,
+ PINPUT_RECORD a1,
+ DWORD a2,
+ LPDWORD a3)
+{
+ _PrintEnter("PeekConsoleInputA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PeekConsoleInputA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("PeekConsoleInputA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PeekConsoleInputW(HANDLE a0,
+ PINPUT_RECORD a1,
+ DWORD a2,
+ LPDWORD a3)
+{
+ _PrintEnter("PeekConsoleInputW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PeekConsoleInputW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("PeekConsoleInputW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PeekMessageA(LPMSG a0,
+ HWND a1,
+ UINT a2,
+ UINT a3,
+ UINT a4)
+{
+ _PrintEnter("PeekMessageA(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PeekMessageA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("PeekMessageA(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PeekMessageW(LPMSG a0,
+ HWND a1,
+ UINT a2,
+ UINT a3,
+ UINT a4)
+{
+ _PrintEnter("PeekMessageW(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PeekMessageW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("PeekMessageW(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PeekNamedPipe(HANDLE a0,
+ LPVOID a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPDWORD a5)
+{
+ _PrintEnter("PeekNamedPipe(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PeekNamedPipe(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("PeekNamedPipe(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_Pie(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ int a5,
+ int a6,
+ int a7,
+ int a8)
+{
+ _PrintEnter("Pie(%p,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_Pie(a0, a1, a2, a3, a4, a5, a6, a7, a8);
+ } __finally {
+ _PrintExit("Pie(,,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PlayEnhMetaFile(HDC a0,
+ HENHMETAFILE a1,
+ RECT* a2)
+{
+ _PrintEnter("PlayEnhMetaFile(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PlayEnhMetaFile(a0, a1, a2);
+ } __finally {
+ _PrintExit("PlayEnhMetaFile(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PlayEnhMetaFileRecord(HDC a0,
+ LPHANDLETABLE a1,
+ ENHMETARECORD* a2,
+ UINT a3)
+{
+ _PrintEnter("PlayEnhMetaFileRecord(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PlayEnhMetaFileRecord(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("PlayEnhMetaFileRecord(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PlayMetaFile(HDC a0,
+ HMETAFILE a1)
+{
+ _PrintEnter("PlayMetaFile(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PlayMetaFile(a0, a1);
+ } __finally {
+ _PrintExit("PlayMetaFile(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PlayMetaFileRecord(HDC a0,
+ LPHANDLETABLE a1,
+ LPMETARECORD a2,
+ UINT a3)
+{
+ _PrintEnter("PlayMetaFileRecord(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PlayMetaFileRecord(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("PlayMetaFileRecord(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PlgBlt(HDC a0,
+ POINT* a1,
+ HDC a2,
+ int a3,
+ int a4,
+ int a5,
+ int a6,
+ HBITMAP a7,
+ int a8,
+ int a9)
+{
+ _PrintEnter("PlgBlt(%p,%p,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PlgBlt(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
+ } __finally {
+ _PrintExit("PlgBlt(,,,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PolyBezier(HDC a0,
+ POINT* a1,
+ DWORD a2)
+{
+ _PrintEnter("PolyBezier(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PolyBezier(a0, a1, a2);
+ } __finally {
+ _PrintExit("PolyBezier(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PolyBezierTo(HDC a0,
+ POINT* a1,
+ DWORD a2)
+{
+ _PrintEnter("PolyBezierTo(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PolyBezierTo(a0, a1, a2);
+ } __finally {
+ _PrintExit("PolyBezierTo(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PolyDraw(HDC a0,
+ POINT* a1,
+ BYTE* a2,
+ int a3)
+{
+ _PrintEnter("PolyDraw(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PolyDraw(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("PolyDraw(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PolyPolygon(HDC a0,
+ POINT* a1,
+ INT* a2,
+ int a3)
+{
+ _PrintEnter("PolyPolygon(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PolyPolygon(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("PolyPolygon(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PolyPolyline(HDC a0,
+ POINT* a1,
+ DWORD* a2,
+ DWORD a3)
+{
+ _PrintEnter("PolyPolyline(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PolyPolyline(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("PolyPolyline(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PolyTextOutA(HDC a0,
+ POLYTEXTA* a1,
+ int a2)
+{
+ _PrintEnter("PolyTextOutA(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PolyTextOutA(a0, a1, a2);
+ } __finally {
+ _PrintExit("PolyTextOutA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PolyTextOutW(HDC a0,
+ POLYTEXTW* a1,
+ int a2)
+{
+ _PrintEnter("PolyTextOutW(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PolyTextOutW(a0, a1, a2);
+ } __finally {
+ _PrintExit("PolyTextOutW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_Polygon(HDC a0,
+ POINT* a1,
+ int a2)
+{
+ _PrintEnter("Polygon(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_Polygon(a0, a1, a2);
+ } __finally {
+ _PrintExit("Polygon(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_Polyline(HDC a0,
+ POINT* a1,
+ int a2)
+{
+ _PrintEnter("Polyline(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_Polyline(a0, a1, a2);
+ } __finally {
+ _PrintExit("Polyline(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PolylineTo(HDC a0,
+ POINT* a1,
+ DWORD a2)
+{
+ _PrintEnter("PolylineTo(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PolylineTo(a0, a1, a2);
+ } __finally {
+ _PrintExit("PolylineTo(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PostMessageA(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3)
+{
+ _PrintEnter("PostMessageA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PostMessageA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("PostMessageA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PostMessageW(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3)
+{
+ _PrintEnter("PostMessageW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PostMessageW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("PostMessageW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PostQueuedCompletionStatus(HANDLE a0,
+ DWORD a1,
+ ULONG_PTR a2,
+ LPOVERLAPPED a3)
+{
+ _PrintEnter("PostQueuedCompletionStatus(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PostQueuedCompletionStatus(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("PostQueuedCompletionStatus(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+void __stdcall Mine_PostQuitMessage(int a0)
+{
+ _PrintEnter("PostQuitMessage(%p)\n", a0);
+
+ __try {
+ Real_PostQuitMessage(a0);
+ } __finally {
+ _PrintExit("PostQuitMessage() ->\n");
+ };
+}
+
+BOOL __stdcall Mine_PostThreadMessageA(DWORD a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3)
+{
+ _PrintEnter("PostThreadMessageA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PostThreadMessageA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("PostThreadMessageA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PostThreadMessageW(DWORD a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3)
+{
+ _PrintEnter("PostThreadMessageW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PostThreadMessageW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("PostThreadMessageW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_PrepareTape(HANDLE a0,
+ DWORD a1,
+ BOOL a2)
+{
+ _PrintEnter("PrepareTape(%p,%p,%p)\n", a0, a1, a2);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_PrepareTape(a0, a1, a2);
+ } __finally {
+ _PrintExit("PrepareTape(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_ProgIDFromCLSID(CONST IID& a0,
+ LPOLESTR* a1)
+{
+ _PrintEnter("ProgIDFromCLSID(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_ProgIDFromCLSID(a0, a1);
+ } __finally {
+ _PrintExit("ProgIDFromCLSID(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_PropVariantClear(PROPVARIANT* a0)
+{
+ _PrintEnter("PropVariantClear(%p)\n", a0);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_PropVariantClear(a0);
+ } __finally {
+ _PrintExit("PropVariantClear() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_PropVariantCopy(PROPVARIANT* a0,
+ PROPVARIANT* a1)
+{
+ _PrintEnter("PropVariantCopy(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_PropVariantCopy(a0, a1);
+ } __finally {
+ _PrintExit("PropVariantCopy(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PtInRect(RECT* a0,
+ POINT a1)
+{
+ _PrintEnter("PtInRect(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PtInRect(a0, a1);
+ } __finally {
+ _PrintExit("PtInRect(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PtInRegion(HRGN a0,
+ int a1,
+ int a2)
+{
+ _PrintEnter("PtInRegion(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PtInRegion(a0, a1, a2);
+ } __finally {
+ _PrintExit("PtInRegion(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PtVisible(HDC a0,
+ int a1,
+ int a2)
+{
+ _PrintEnter("PtVisible(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PtVisible(a0, a1, a2);
+ } __finally {
+ _PrintExit("PtVisible(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PulseEvent(HANDLE a0)
+{
+ _PrintEnter("PulseEvent(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PulseEvent(a0);
+ } __finally {
+ _PrintExit("PulseEvent() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_PurgeComm(HANDLE a0,
+ DWORD a1)
+{
+ _PrintEnter("PurgeComm(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PurgeComm(a0, a1);
+ } __finally {
+ _PrintExit("PurgeComm(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_QueryDosDeviceA(LPCSTR a0,
+ LPSTR a1,
+ DWORD a2)
+{
+ _PrintEnter("QueryDosDeviceA(%hs,%p,%p)\n", a0, a1, a2);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_QueryDosDeviceA(a0, a1, a2);
+ } __finally {
+ _PrintExit("QueryDosDeviceA(,%hs,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_QueryDosDeviceW(LPCWSTR a0,
+ LPWSTR a1,
+ DWORD a2)
+{
+ _PrintEnter("QueryDosDeviceW(%ls,%p,%p)\n", a0, a1, a2);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_QueryDosDeviceW(a0, a1, a2);
+ } __finally {
+ _PrintExit("QueryDosDeviceW(,%ls,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_QueryPerformanceCounter(LARGE_INTEGER* a0)
+{
+ _PrintEnter("QueryPerformanceCounter(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_QueryPerformanceCounter(a0);
+ } __finally {
+ _PrintExit("QueryPerformanceCounter() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_QueryPerformanceFrequency(LARGE_INTEGER* a0)
+{
+ _PrintEnter("QueryPerformanceFrequency(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_QueryPerformanceFrequency(a0);
+ } __finally {
+ _PrintExit("QueryPerformanceFrequency() -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_QueueUserAPC(PAPCFUNC a0,
+ HANDLE a1,
+ ULONG_PTR a2)
+{
+ _PrintEnter("QueueUserAPC(%p,%p,%p)\n", a0, a1, a2);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_QueueUserAPC(a0, a1, a2);
+ } __finally {
+ _PrintExit("QueueUserAPC(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+void __stdcall Mine_RaiseException(DWORD a0,
+ DWORD a1,
+ DWORD a2,
+ ULONG_PTR* a3)
+{
+ _PrintEnter("RaiseException(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ __try {
+ Real_RaiseException(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("RaiseException(,,,) ->\n");
+ };
+}
+
+HRESULT __stdcall Mine_ReadClassStg(LPSTORAGE a0,
+ CLSID* a1)
+{
+ _PrintEnter("ReadClassStg(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_ReadClassStg(a0, a1);
+ } __finally {
+ _PrintExit("ReadClassStg(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_ReadClassStm(LPSTREAM a0,
+ CLSID* a1)
+{
+ _PrintEnter("ReadClassStm(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_ReadClassStm(a0, a1);
+ } __finally {
+ _PrintExit("ReadClassStm(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ReadConsoleA(
+ HANDLE a0,
+ LPVOID a1,
+ DWORD a2,
+ LPDWORD a3,
+#ifdef ENABLE_INSERT_MODE
+ PCONSOLE_READCONSOLE_CONTROL a4
+#else
+ LPVOID a4
+#endif
+ )
+{
+ _PrintEnter("ReadConsoleA(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ReadConsoleA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("ReadConsoleA(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ReadConsoleInputA(HANDLE a0,
+ PINPUT_RECORD a1,
+ DWORD a2,
+ LPDWORD a3)
+{
+ _PrintEnter("ReadConsoleInputA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ReadConsoleInputA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("ReadConsoleInputA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ReadConsoleInputW(HANDLE a0,
+ PINPUT_RECORD a1,
+ DWORD a2,
+ LPDWORD a3)
+{
+ _PrintEnter("ReadConsoleInputW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ReadConsoleInputW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("ReadConsoleInputW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ReadConsoleOutputA(HANDLE a0,
+ PCHAR_INFO a1,
+ COORD a2,
+ COORD a3,
+ PSMALL_RECT a4)
+{
+ _PrintEnter("ReadConsoleOutputA(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ReadConsoleOutputA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("ReadConsoleOutputA(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ReadConsoleOutputAttribute(HANDLE a0,
+ LPWORD a1,
+ DWORD a2,
+ COORD a3,
+ LPDWORD a4)
+{
+ _PrintEnter("ReadConsoleOutputAttribute(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ReadConsoleOutputAttribute(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("ReadConsoleOutputAttribute(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ReadConsoleOutputCharacterA(HANDLE a0,
+ LPSTR a1,
+ DWORD a2,
+ COORD a3,
+ LPDWORD a4)
+{
+ _PrintEnter("ReadConsoleOutputCharacterA(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ReadConsoleOutputCharacterA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("ReadConsoleOutputCharacterA(,%hs,,,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ReadConsoleOutputCharacterW(HANDLE a0,
+ LPWSTR a1,
+ DWORD a2,
+ COORD a3,
+ LPDWORD a4)
+{
+ _PrintEnter("ReadConsoleOutputCharacterW(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ReadConsoleOutputCharacterW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("ReadConsoleOutputCharacterW(,%ls,,,) -> %p\n", a1, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ReadConsoleOutputW(HANDLE a0,
+ PCHAR_INFO a1,
+ COORD a2,
+ COORD a3,
+ PSMALL_RECT a4)
+{
+ _PrintEnter("ReadConsoleOutputW(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ReadConsoleOutputW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("ReadConsoleOutputW(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ReadConsoleW(
+ HANDLE a0,
+ LPVOID a1,
+ DWORD a2,
+ LPDWORD a3,
+#ifdef ENABLE_INSERT_MODE
+ PCONSOLE_READCONSOLE_CONTROL a4
+#else
+ LPVOID a4
+#endif
+ )
+{
+ _PrintEnter("ReadConsoleW(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ReadConsoleW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("ReadConsoleW(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ReadDirectoryChangesW(HANDLE a0,
+ LPVOID a1,
+ DWORD a2,
+ BOOL a3,
+ DWORD a4,
+ LPDWORD a5,
+ LPOVERLAPPED a6,
+ LPOVERLAPPED_COMPLETION_ROUTINE a7)
+{
+ _PrintEnter("ReadDirectoryChangesW(%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ReadDirectoryChangesW(a0, a1, a2, a3, a4, a5, a6, a7);
+ } __finally {
+ _PrintExit("ReadDirectoryChangesW(,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ReadFile(HANDLE a0,
+ LPVOID a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPOVERLAPPED a4)
+{
+ _PrintEnter("ReadFile(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ReadFile(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("ReadFile(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ReadFileEx(HANDLE a0,
+ LPVOID a1,
+ DWORD a2,
+ LPOVERLAPPED a3,
+ LPOVERLAPPED_COMPLETION_ROUTINE a4)
+{
+ _PrintEnter("ReadFileEx(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ReadFileEx(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("ReadFileEx(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_ReadFmtUserTypeStg(LPSTORAGE a0,
+ CLIPFORMAT* a1,
+ LPOLESTR* a2)
+{
+ _PrintEnter("ReadFmtUserTypeStg(%p,%p,%p)\n", a0, a1, a2);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_ReadFmtUserTypeStg(a0, a1, a2);
+ } __finally {
+ _PrintExit("ReadFmtUserTypeStg(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ReadProcessMemory(HANDLE a0,
+ LPCVOID lpBase,
+ LPVOID lpBuf,
+ DWORD_PTR nSize,
+ PDWORD_PTR a4)
+{
+ _PrintEnter("ReadProcessMemory(%p,@%p..%p,%p,%p)\n",
+ a0, lpBase,
+ (PBYTE)lpBase + ((nSize > 0) ? nSize - 1 : 0),
+ lpBuf, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ReadProcessMemory(a0, lpBase, lpBuf, nSize, a4);
+ } __finally {
+ _PrintExit("ReadProcessMemory(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_RealizePalette(HDC a0)
+{
+ _PrintEnter("RealizePalette(%p)\n", a0);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_RealizePalette(a0);
+ } __finally {
+ _PrintExit("RealizePalette() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_RectInRegion(HRGN a0,
+ RECT* a1)
+{
+ _PrintEnter("RectInRegion(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_RectInRegion(a0, a1);
+ } __finally {
+ _PrintExit("RectInRegion(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_RectVisible(HDC a0,
+ RECT* a1)
+{
+ _PrintEnter("RectVisible(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_RectVisible(a0, a1);
+ } __finally {
+ _PrintExit("RectVisible(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_Rectangle(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4)
+{
+ _PrintEnter("Rectangle(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_Rectangle(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("Rectangle(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_RedrawWindow(HWND a0,
+ RECT* a1,
+ HRGN a2,
+ UINT a3)
+{
+ _PrintEnter("RedrawWindow(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_RedrawWindow(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("RedrawWindow(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+ATOM __stdcall Mine_RegisterClassA(WNDCLASSA* a0)
+{
+ _PrintEnter("RegisterClassA(%p)\n", a0);
+
+ ATOM rv = 0;
+ __try {
+ rv = Real_RegisterClassA(a0);
+ } __finally {
+ _PrintExit("RegisterClassA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+ATOM __stdcall Mine_RegisterClassExA(WNDCLASSEXA* a0)
+{
+ _PrintEnter("RegisterClassExA(%p)\n", a0);
+
+ ATOM rv = 0;
+ __try {
+ rv = Real_RegisterClassExA(a0);
+ } __finally {
+ _PrintExit("RegisterClassExA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+ATOM __stdcall Mine_RegisterClassExW(WNDCLASSEXW* a0)
+{
+ _PrintEnter("RegisterClassExW(%p)\n", a0);
+
+ ATOM rv = 0;
+ __try {
+ rv = Real_RegisterClassExW(a0);
+ } __finally {
+ _PrintExit("RegisterClassExW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+ATOM __stdcall Mine_RegisterClassW(WNDCLASSW* a0)
+{
+ _PrintEnter("RegisterClassW(%p)\n", a0);
+
+ ATOM rv = 0;
+ __try {
+ rv = Real_RegisterClassW(a0);
+ } __finally {
+ _PrintExit("RegisterClassW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_RegisterClipboardFormatA(LPCSTR a0)
+{
+ _PrintEnter("RegisterClipboardFormatA(%hs)\n", a0);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_RegisterClipboardFormatA(a0);
+ } __finally {
+ _PrintExit("RegisterClipboardFormatA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_RegisterClipboardFormatW(LPCWSTR a0)
+{
+ _PrintEnter("RegisterClipboardFormatW(%ls)\n", a0);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_RegisterClipboardFormatW(a0);
+ } __finally {
+ _PrintExit("RegisterClipboardFormatW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_RegisterDragDrop(HWND a0,
+ IDropTarget* a1)
+{
+ _PrintEnter("RegisterDragDrop(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_RegisterDragDrop(a0, a1);
+ } __finally {
+ _PrintExit("RegisterDragDrop(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_RegisterHotKey(HWND a0,
+ int a1,
+ UINT a2,
+ UINT a3)
+{
+ _PrintEnter("RegisterHotKey(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_RegisterHotKey(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("RegisterHotKey(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_RegisterWindowMessageA(LPCSTR a0)
+{
+ _PrintEnter("RegisterWindowMessageA(%hs)\n", a0);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_RegisterWindowMessageA(a0);
+ } __finally {
+ _PrintExit("RegisterWindowMessageA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_RegisterWindowMessageW(LPCWSTR a0)
+{
+ _PrintEnter("RegisterWindowMessageW(%ls)\n", a0);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_RegisterWindowMessageW(a0);
+ } __finally {
+ _PrintExit("RegisterWindowMessageW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ReleaseCapture(void)
+{
+ _PrintEnter("ReleaseCapture()\n");
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ReleaseCapture();
+ } __finally {
+ _PrintExit("ReleaseCapture() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_ReleaseDC(HWND a0,
+ HDC a1)
+{
+ _PrintEnter("ReleaseDC(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_ReleaseDC(a0, a1);
+ } __finally {
+ _PrintExit("ReleaseDC(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ReleaseMutex(HANDLE a0)
+{
+ _PrintEnter("ReleaseMutex(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ReleaseMutex(a0);
+ } __finally {
+ _PrintExit("ReleaseMutex() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ReleaseSemaphore(HANDLE a0,
+ LONG a1,
+ LPLONG a2)
+{
+ _PrintEnter("ReleaseSemaphore(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ReleaseSemaphore(a0, a1, a2);
+ } __finally {
+ _PrintExit("ReleaseSemaphore(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+void __stdcall Mine_ReleaseStgMedium(LPSTGMEDIUM a0)
+{
+ _PrintEnter("ReleaseStgMedium(%p)\n", a0);
+
+ __try {
+ Real_ReleaseStgMedium(a0);
+ } __finally {
+ _PrintExit("ReleaseStgMedium() ->\n");
+ };
+}
+
+BOOL __stdcall Mine_RemoveDirectoryA(LPCSTR a0)
+{
+ _PrintEnter("RemoveDirectoryA(%hs)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_RemoveDirectoryA(a0);
+ } __finally {
+ _PrintExit("RemoveDirectoryA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_RemoveDirectoryW(LPCWSTR a0)
+{
+ _PrintEnter("RemoveDirectoryW(%ls)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_RemoveDirectoryW(a0);
+ } __finally {
+ _PrintExit("RemoveDirectoryW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_RemoveFontResourceA(LPCSTR a0)
+{
+ _PrintEnter("RemoveFontResourceA(%hs)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_RemoveFontResourceA(a0);
+ } __finally {
+ _PrintExit("RemoveFontResourceA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_RemoveFontResourceW(LPCWSTR a0)
+{
+ _PrintEnter("RemoveFontResourceW(%ls)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_RemoveFontResourceW(a0);
+ } __finally {
+ _PrintExit("RemoveFontResourceW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_RemoveMenu(HMENU a0,
+ UINT a1,
+ UINT a2)
+{
+ _PrintEnter("RemoveMenu(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_RemoveMenu(a0, a1, a2);
+ } __finally {
+ _PrintExit("RemoveMenu(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_RemovePropA(HWND a0,
+ LPCSTR a1)
+{
+ _PrintEnter("RemovePropA(%p,%hs)\n", a0, a1);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_RemovePropA(a0, a1);
+ } __finally {
+ _PrintExit("RemovePropA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_RemovePropW(HWND a0,
+ LPCWSTR a1)
+{
+ _PrintEnter("RemovePropW(%p,%ls)\n", a0, a1);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_RemovePropW(a0, a1);
+ } __finally {
+ _PrintExit("RemovePropW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ReplyMessage(LRESULT a0)
+{
+ _PrintEnter("ReplyMessage(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ReplyMessage(a0);
+ } __finally {
+ _PrintExit("ReplyMessage() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HDC __stdcall Mine_ResetDCA(HDC a0,
+ CONST DEVMODEA* a1)
+{
+ _PrintEnter("ResetDCA(%p,%p)\n", a0, a1);
+
+ HDC rv = 0;
+ __try {
+ rv = Real_ResetDCA(a0, a1);
+ } __finally {
+ _PrintExit("ResetDCA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HDC __stdcall Mine_ResetDCW(HDC a0,
+ CONST DEVMODEW* a1)
+{
+ _PrintEnter("ResetDCW(%p,%p)\n", a0, a1);
+
+ HDC rv = 0;
+ __try {
+ rv = Real_ResetDCW(a0, a1);
+ } __finally {
+ _PrintExit("ResetDCW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ResetEvent(HANDLE a0)
+{
+ _PrintEnter("ResetEvent(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ResetEvent(a0);
+ } __finally {
+ _PrintExit("ResetEvent() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ResizePalette(HPALETTE a0,
+ UINT a1)
+{
+ _PrintEnter("ResizePalette(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ResizePalette(a0, a1);
+ } __finally {
+ _PrintExit("ResizePalette(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_RestoreDC(HDC a0,
+ int a1)
+{
+ _PrintEnter("RestoreDC(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_RestoreDC(a0, a1);
+ } __finally {
+ _PrintExit("RestoreDC(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_ResumeThread(HANDLE a0)
+{
+ _PrintEnter("ResumeThread(%p)\n", a0);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_ResumeThread(a0);
+ } __finally {
+ _PrintExit("ResumeThread() -> %p\n", rv);
+ };
+ return rv;
+}
+
+LPARAM __stdcall Mine_ReuseDDElParam(LPARAM a0,
+ UINT a1,
+ UINT a2,
+ UINT_PTR a3,
+ UINT_PTR a4)
+{
+ _PrintEnter("ReuseDDElParam(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ LPARAM rv = 0;
+ __try {
+ rv = Real_ReuseDDElParam(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("ReuseDDElParam(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_RevokeDragDrop(HWND a0)
+{
+ _PrintEnter("RevokeDragDrop(%p)\n", a0);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_RevokeDragDrop(a0);
+ } __finally {
+ _PrintExit("RevokeDragDrop() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_RoundRect(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ int a5,
+ int a6)
+{
+ _PrintEnter("RoundRect(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_RoundRect(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("RoundRect(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_SaveDC(HDC a0)
+{
+ _PrintEnter("SaveDC(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_SaveDC(a0);
+ } __finally {
+ _PrintExit("SaveDC() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ScaleViewportExtEx(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ SIZE* a5)
+{
+ _PrintEnter("ScaleViewportExtEx(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ScaleViewportExtEx(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("ScaleViewportExtEx(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ScaleWindowExtEx(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ SIZE* a5)
+{
+ _PrintEnter("ScaleWindowExtEx(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ScaleWindowExtEx(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("ScaleWindowExtEx(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ScreenToClient(HWND a0,
+ POINT* a1)
+{
+ _PrintEnter("ScreenToClient(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ScreenToClient(a0, a1);
+ } __finally {
+ _PrintExit("ScreenToClient(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ScrollConsoleScreenBufferA(HANDLE a0,
+ SMALL_RECT* a1,
+ SMALL_RECT* a2,
+ COORD a3,
+ CHAR_INFO* a4)
+{
+ _PrintEnter("ScrollConsoleScreenBufferA(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ScrollConsoleScreenBufferA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("ScrollConsoleScreenBufferA(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ScrollConsoleScreenBufferW(HANDLE a0,
+ SMALL_RECT* a1,
+ SMALL_RECT* a2,
+ COORD a3,
+ CHAR_INFO* a4)
+{
+ _PrintEnter("ScrollConsoleScreenBufferW(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ScrollConsoleScreenBufferW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("ScrollConsoleScreenBufferW(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ScrollDC(HDC a0,
+ int a1,
+ int a2,
+ RECT* a3,
+ RECT* a4,
+ HRGN a5,
+ LPRECT a6)
+{
+ _PrintEnter("ScrollDC(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ScrollDC(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("ScrollDC(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ScrollWindow(HWND a0,
+ int a1,
+ int a2,
+ RECT* a3,
+ RECT* a4)
+{
+ _PrintEnter("ScrollWindow(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ScrollWindow(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("ScrollWindow(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_ScrollWindowEx(HWND a0,
+ int a1,
+ int a2,
+ RECT* a3,
+ RECT* a4,
+ HRGN a5,
+ LPRECT a6,
+ UINT a7)
+{
+ _PrintEnter("ScrollWindowEx(%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7);
+
+ int rv = 0;
+ __try {
+ rv = Real_ScrollWindowEx(a0, a1, a2, a3, a4, a5, a6, a7);
+ } __finally {
+ _PrintExit("ScrollWindowEx(,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_SearchPathA(LPCSTR a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ DWORD a3,
+ LPSTR a4,
+ LPSTR* a5)
+{
+ _PrintEnter("SearchPathA(%hs,%hs,%hs,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_SearchPathA(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("SearchPathA(,,,,%hs,) -> %p\n", a4, rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_SearchPathW(LPCWSTR a0,
+ LPCWSTR a1,
+ LPCWSTR a2,
+ DWORD a3,
+ LPWSTR a4,
+ LPWSTR* a5)
+{
+ _PrintEnter("SearchPathW(%ls,%ls,%ls,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_SearchPathW(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("SearchPathW(,,,,%ls,) -> %p\n", a4, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SelectClipPath(HDC a0,
+ int a1)
+{
+ _PrintEnter("SelectClipPath(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SelectClipPath(a0, a1);
+ } __finally {
+ _PrintExit("SelectClipPath(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_SelectClipRgn(HDC a0,
+ HRGN a1)
+{
+ _PrintEnter("SelectClipRgn(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_SelectClipRgn(a0, a1);
+ } __finally {
+ _PrintExit("SelectClipRgn(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HGDIOBJ __stdcall Mine_SelectObject(HDC a0,
+ HGDIOBJ a1)
+{
+ _PrintEnter("SelectObject(%p,%p)\n", a0, a1);
+
+ HGDIOBJ rv = 0;
+ __try {
+ rv = Real_SelectObject(a0, a1);
+ } __finally {
+ _PrintExit("SelectObject(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HPALETTE __stdcall Mine_SelectPalette(HDC a0,
+ HPALETTE a1,
+ BOOL a2)
+{
+ _PrintEnter("SelectPalette(%p,%p,%p)\n", a0, a1, a2);
+
+ HPALETTE rv = 0;
+ __try {
+ rv = Real_SelectPalette(a0, a1, a2);
+ } __finally {
+ _PrintExit("SelectPalette(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LRESULT __stdcall Mine_SendDlgItemMessageA(HWND a0,
+ int a1,
+ UINT a2,
+ WPARAM a3,
+ LPARAM a4)
+{
+ _PrintEnter("SendDlgItemMessageA(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ LRESULT rv = 0;
+ __try {
+ rv = Real_SendDlgItemMessageA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("SendDlgItemMessageA(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LRESULT __stdcall Mine_SendDlgItemMessageW(HWND a0,
+ int a1,
+ UINT a2,
+ WPARAM a3,
+ LPARAM a4)
+{
+ _PrintEnter("SendDlgItemMessageW(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ LRESULT rv = 0;
+ __try {
+ rv = Real_SendDlgItemMessageW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("SendDlgItemMessageW(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LRESULT __stdcall Mine_SendMessageA(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3)
+{
+ _PrintEnter("SendMessageA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ LRESULT rv = 0;
+ __try {
+ rv = Real_SendMessageA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SendMessageA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SendMessageCallbackA(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3,
+ SENDASYNCPROC a4,
+ ULONG_PTR a5)
+{
+ _PrintEnter("SendMessageCallbackA(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SendMessageCallbackA(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("SendMessageCallbackA(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SendMessageCallbackW(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3,
+ SENDASYNCPROC a4,
+ ULONG_PTR a5)
+{
+ _PrintEnter("SendMessageCallbackW(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SendMessageCallbackW(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("SendMessageCallbackW(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LRESULT __stdcall Mine_SendMessageTimeoutA(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3,
+ UINT a4,
+ UINT a5,
+ PULONG_PTR a6)
+{
+ _PrintEnter("SendMessageTimeoutA(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ LRESULT rv = 0;
+ __try {
+ rv = Real_SendMessageTimeoutA(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("SendMessageTimeoutA(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LRESULT __stdcall Mine_SendMessageTimeoutW(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3,
+ UINT a4,
+ UINT a5,
+ PULONG_PTR a6)
+{
+ _PrintEnter("SendMessageTimeoutW(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ LRESULT rv = 0;
+ __try {
+ rv = Real_SendMessageTimeoutW(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("SendMessageTimeoutW(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LRESULT __stdcall Mine_SendMessageW(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3)
+{
+ _PrintEnter("SendMessageW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ LRESULT rv = 0;
+ __try {
+ rv = Real_SendMessageW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SendMessageW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SendNotifyMessageA(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3)
+{
+ _PrintEnter("SendNotifyMessageA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SendNotifyMessageA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SendNotifyMessageA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SendNotifyMessageW(HWND a0,
+ UINT a1,
+ WPARAM a2,
+ LPARAM a3)
+{
+ _PrintEnter("SendNotifyMessageW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SendNotifyMessageW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SendNotifyMessageW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_SetAbortProc(HDC a0,
+ ABORTPROC a1)
+{
+ _PrintEnter("SetAbortProc(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_SetAbortProc(a0, a1);
+ } __finally {
+ _PrintExit("SetAbortProc(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_SetActiveWindow(HWND a0)
+{
+ _PrintEnter("SetActiveWindow(%p)\n", a0);
+
+ HWND rv = 0;
+ __try {
+ rv = Real_SetActiveWindow(a0);
+ } __finally {
+ _PrintExit("SetActiveWindow() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_SetArcDirection(HDC a0,
+ int a1)
+{
+ _PrintEnter("SetArcDirection(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_SetArcDirection(a0, a1);
+ } __finally {
+ _PrintExit("SetArcDirection(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LONG __stdcall Mine_SetBitmapBits(HBITMAP a0,
+ DWORD a1,
+ void* a2)
+{
+ _PrintEnter("SetBitmapBits(%p,%p,%p)\n", a0, a1, a2);
+
+ LONG rv = 0;
+ __try {
+ rv = Real_SetBitmapBits(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetBitmapBits(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetBitmapDimensionEx(HBITMAP a0,
+ int a1,
+ int a2,
+ SIZE* a3)
+{
+ _PrintEnter("SetBitmapDimensionEx(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetBitmapDimensionEx(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SetBitmapDimensionEx(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+COLORREF __stdcall Mine_SetBkColor(HDC a0,
+ COLORREF a1)
+{
+ _PrintEnter("SetBkColor(%p,%p)\n", a0, a1);
+
+ COLORREF rv = 0;
+ __try {
+ rv = Real_SetBkColor(a0, a1);
+ } __finally {
+ _PrintExit("SetBkColor(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_SetBkMode(HDC a0,
+ int a1)
+{
+ _PrintEnter("SetBkMode(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_SetBkMode(a0, a1);
+ } __finally {
+ _PrintExit("SetBkMode(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_SetBoundsRect(HDC a0,
+ RECT* a1,
+ UINT a2)
+{
+ _PrintEnter("SetBoundsRect(%p,%p,%p)\n", a0, a1, a2);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_SetBoundsRect(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetBoundsRect(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetBrushOrgEx(HDC a0,
+ int a1,
+ int a2,
+ POINT* a3)
+{
+ _PrintEnter("SetBrushOrgEx(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetBrushOrgEx(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SetBrushOrgEx(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_SetCapture(HWND a0)
+{
+ _PrintEnter("SetCapture(%p)\n", a0);
+
+ HWND rv = 0;
+ __try {
+ rv = Real_SetCapture(a0);
+ } __finally {
+ _PrintExit("SetCapture() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetCaretBlinkTime(UINT a0)
+{
+ _PrintEnter("SetCaretBlinkTime(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetCaretBlinkTime(a0);
+ } __finally {
+ _PrintExit("SetCaretBlinkTime() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetCaretPos(int a0,
+ int a1)
+{
+ _PrintEnter("SetCaretPos(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetCaretPos(a0, a1);
+ } __finally {
+ _PrintExit("SetCaretPos(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_SetClassLongA(HWND a0,
+ int a1,
+ LONG a2)
+{
+ _PrintEnter("SetClassLongA(%p,%p,%p)\n", a0, a1, a2);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_SetClassLongA(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetClassLongA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_SetClassLongW(HWND a0,
+ int a1,
+ LONG a2)
+{
+ _PrintEnter("SetClassLongW(%p,%p,%p)\n", a0, a1, a2);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_SetClassLongW(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetClassLongW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+WORD __stdcall Mine_SetClassWord(HWND a0,
+ int a1,
+ WORD a2)
+{
+ _PrintEnter("SetClassWord(%p,%p,%p)\n", a0, a1, a2);
+
+ WORD rv = 0;
+ __try {
+ rv = Real_SetClassWord(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetClassWord(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_SetClipboardData(UINT a0,
+ HANDLE a1)
+{
+ _PrintEnter("SetClipboardData(%p,%p)\n", a0, a1);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_SetClipboardData(a0, a1);
+ } __finally {
+ _PrintExit("SetClipboardData(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_SetClipboardViewer(HWND a0)
+{
+ _PrintEnter("SetClipboardViewer(%p)\n", a0);
+
+ HWND rv = 0;
+ __try {
+ rv = Real_SetClipboardViewer(a0);
+ } __finally {
+ _PrintExit("SetClipboardViewer() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetColorAdjustment(HDC a0,
+ COLORADJUSTMENT* a1)
+{
+ _PrintEnter("SetColorAdjustment(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetColorAdjustment(a0, a1);
+ } __finally {
+ _PrintExit("SetColorAdjustment(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HCOLORSPACE __stdcall Mine_SetColorSpace(HDC a0,
+ HCOLORSPACE a1)
+{
+ _PrintEnter("SetColorSpace(%p,%p)\n", a0, a1);
+
+ HCOLORSPACE rv = 0;
+ __try {
+ rv = Real_SetColorSpace(a0, a1);
+ } __finally {
+ _PrintExit("SetColorSpace(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetCommBreak(HANDLE a0)
+{
+ _PrintEnter("SetCommBreak(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetCommBreak(a0);
+ } __finally {
+ _PrintExit("SetCommBreak() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetCommConfig(HANDLE a0,
+ LPCOMMCONFIG a1,
+ DWORD a2)
+{
+ _PrintEnter("SetCommConfig(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetCommConfig(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetCommConfig(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetCommMask(HANDLE a0,
+ DWORD a1)
+{
+ _PrintEnter("SetCommMask(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetCommMask(a0, a1);
+ } __finally {
+ _PrintExit("SetCommMask(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetCommState(HANDLE a0,
+ LPDCB a1)
+{
+ _PrintEnter("SetCommState(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetCommState(a0, a1);
+ } __finally {
+ _PrintExit("SetCommState(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetCommTimeouts(HANDLE a0,
+ LPCOMMTIMEOUTS a1)
+{
+ _PrintEnter("SetCommTimeouts(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetCommTimeouts(a0, a1);
+ } __finally {
+ _PrintExit("SetCommTimeouts(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetComputerNameA(LPCSTR a0)
+{
+ _PrintEnter("SetComputerNameA(%hs)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetComputerNameA(a0);
+ } __finally {
+ _PrintExit("SetComputerNameA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetComputerNameW(LPCWSTR a0)
+{
+ _PrintEnter("SetComputerNameW(%ls)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetComputerNameW(a0);
+ } __finally {
+ _PrintExit("SetComputerNameW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetConsoleActiveScreenBuffer(HANDLE a0)
+{
+ _PrintEnter("SetConsoleActiveScreenBuffer(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetConsoleActiveScreenBuffer(a0);
+ } __finally {
+ _PrintExit("SetConsoleActiveScreenBuffer() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetConsoleCP(UINT a0)
+{
+ _PrintEnter("SetConsoleCP(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetConsoleCP(a0);
+ } __finally {
+ _PrintExit("SetConsoleCP() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetConsoleCtrlHandler(PHANDLER_ROUTINE a0,
+ BOOL a1)
+{
+ _PrintEnter("SetConsoleCtrlHandler(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetConsoleCtrlHandler(a0, a1);
+ } __finally {
+ _PrintExit("SetConsoleCtrlHandler(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetConsoleCursorInfo(HANDLE a0,
+ CONSOLE_CURSOR_INFO* a1)
+{
+ _PrintEnter("SetConsoleCursorInfo(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetConsoleCursorInfo(a0, a1);
+ } __finally {
+ _PrintExit("SetConsoleCursorInfo(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetConsoleCursorPosition(HANDLE a0,
+ COORD a1)
+{
+ _PrintEnter("SetConsoleCursorPosition(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetConsoleCursorPosition(a0, a1);
+ } __finally {
+ _PrintExit("SetConsoleCursorPosition(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetConsoleMode(HANDLE a0,
+ DWORD a1)
+{
+ _PrintEnter("SetConsoleMode(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetConsoleMode(a0, a1);
+ } __finally {
+ _PrintExit("SetConsoleMode(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetConsoleOutputCP(UINT a0)
+{
+ _PrintEnter("SetConsoleOutputCP(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetConsoleOutputCP(a0);
+ } __finally {
+ _PrintExit("SetConsoleOutputCP() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetConsoleScreenBufferSize(HANDLE a0,
+ COORD a1)
+{
+ _PrintEnter("SetConsoleScreenBufferSize(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetConsoleScreenBufferSize(a0, a1);
+ } __finally {
+ _PrintExit("SetConsoleScreenBufferSize(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetConsoleTextAttribute(HANDLE a0,
+ WORD a1)
+{
+ _PrintEnter("SetConsoleTextAttribute(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetConsoleTextAttribute(a0, a1);
+ } __finally {
+ _PrintExit("SetConsoleTextAttribute(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetConsoleTitleA(LPCSTR a0)
+{
+ _PrintEnter("SetConsoleTitleA(%hs)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetConsoleTitleA(a0);
+ } __finally {
+ _PrintExit("SetConsoleTitleA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetConsoleTitleW(LPCWSTR a0)
+{
+ _PrintEnter("SetConsoleTitleW(%ls)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetConsoleTitleW(a0);
+ } __finally {
+ _PrintExit("SetConsoleTitleW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetConsoleWindowInfo(HANDLE a0,
+ BOOL a1,
+ SMALL_RECT* a2)
+{
+ _PrintEnter("SetConsoleWindowInfo(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetConsoleWindowInfo(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetConsoleWindowInfo(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_SetConvertStg(LPSTORAGE a0,
+ BOOL a1)
+{
+ _PrintEnter("SetConvertStg(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_SetConvertStg(a0, a1);
+ } __finally {
+ _PrintExit("SetConvertStg(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetCurrentDirectoryA(LPCSTR a0)
+{
+ _PrintEnter("SetCurrentDirectoryA(%hs)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetCurrentDirectoryA(a0);
+ } __finally {
+ _PrintExit("SetCurrentDirectoryA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetCurrentDirectoryW(LPCWSTR a0)
+{
+ _PrintEnter("SetCurrentDirectoryW(%ls)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetCurrentDirectoryW(a0);
+ } __finally {
+ _PrintExit("SetCurrentDirectoryW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HCURSOR __stdcall Mine_SetCursor(HCURSOR a0)
+{
+ _PrintEnter("SetCursor(%p)\n", a0);
+
+ HCURSOR rv = 0;
+ __try {
+ rv = Real_SetCursor(a0);
+ } __finally {
+ _PrintExit("SetCursor() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetCursorPos(int a0,
+ int a1)
+{
+ _PrintEnter("SetCursorPos(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetCursorPos(a0, a1);
+ } __finally {
+ _PrintExit("SetCursorPos(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_SetDIBColorTable(HDC a0,
+ UINT a1,
+ UINT a2,
+ RGBQUAD* a3)
+{
+ _PrintEnter("SetDIBColorTable(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_SetDIBColorTable(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SetDIBColorTable(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_SetDIBits(HDC a0,
+ HBITMAP a1,
+ UINT a2,
+ UINT a3,
+ void* a4,
+ BITMAPINFO* a5,
+ UINT a6)
+{
+ _PrintEnter("SetDIBits(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ int rv = 0;
+ __try {
+ rv = Real_SetDIBits(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("SetDIBits(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_SetDIBitsToDevice(HDC a0,
+ int a1,
+ int a2,
+ DWORD a3,
+ DWORD a4,
+ int a5,
+ int a6,
+ UINT a7,
+ UINT a8,
+ void* a9,
+ BITMAPINFO* a10,
+ UINT a11)
+{
+ _PrintEnter("SetDIBitsToDevice(%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
+
+ int rv = 0;
+ __try {
+ rv = Real_SetDIBitsToDevice(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
+ } __finally {
+ _PrintExit("SetDIBitsToDevice(,,,,,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetDefaultCommConfigA(LPCSTR a0,
+ LPCOMMCONFIG a1,
+ DWORD a2)
+{
+ _PrintEnter("SetDefaultCommConfigA(%hs,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetDefaultCommConfigA(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetDefaultCommConfigA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetDefaultCommConfigW(LPCWSTR a0,
+ LPCOMMCONFIG a1,
+ DWORD a2)
+{
+ _PrintEnter("SetDefaultCommConfigW(%ls,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetDefaultCommConfigW(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetDefaultCommConfigW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetDeviceGammaRamp(HDC a0,
+ LPVOID a1)
+{
+ _PrintEnter("SetDeviceGammaRamp(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetDeviceGammaRamp(a0, a1);
+ } __finally {
+ _PrintExit("SetDeviceGammaRamp(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetDlgItemInt(HWND a0,
+ int a1,
+ UINT a2,
+ BOOL a3)
+{
+ _PrintEnter("SetDlgItemInt(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetDlgItemInt(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SetDlgItemInt(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetDlgItemTextA(HWND a0,
+ int a1,
+ LPCSTR a2)
+{
+ _PrintEnter("SetDlgItemTextA(%p,%p,%hs)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetDlgItemTextA(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetDlgItemTextA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetDlgItemTextW(HWND a0,
+ int a1,
+ LPCWSTR a2)
+{
+ _PrintEnter("SetDlgItemTextW(%p,%p,%ls)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetDlgItemTextW(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetDlgItemTextW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetDoubleClickTime(UINT a0)
+{
+ _PrintEnter("SetDoubleClickTime(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetDoubleClickTime(a0);
+ } __finally {
+ _PrintExit("SetDoubleClickTime() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetEndOfFile(HANDLE a0)
+{
+ _PrintEnter("SetEndOfFile(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetEndOfFile(a0);
+ } __finally {
+ _PrintExit("SetEndOfFile() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HENHMETAFILE __stdcall Mine_SetEnhMetaFileBits(UINT a0,
+ BYTE* a1)
+{
+ _PrintEnter("SetEnhMetaFileBits(%p,%p)\n", a0, a1);
+
+ HENHMETAFILE rv = 0;
+ __try {
+ rv = Real_SetEnhMetaFileBits(a0, a1);
+ } __finally {
+ _PrintExit("SetEnhMetaFileBits(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetEnvironmentVariableA(LPCSTR a0,
+ LPCSTR a1)
+{
+ _PrintEnter("SetEnvironmentVariableA(%hs,%hs)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetEnvironmentVariableA(a0, a1);
+ } __finally {
+ _PrintExit("SetEnvironmentVariableA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetEnvironmentVariableW(LPCWSTR a0,
+ LPCWSTR a1)
+{
+ _PrintEnter("SetEnvironmentVariableW(%ls,%ls)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetEnvironmentVariableW(a0, a1);
+ } __finally {
+ _PrintExit("SetEnvironmentVariableW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_SetErrorMode(UINT a0)
+{
+ _PrintEnter("SetErrorMode(%p)\n", a0);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_SetErrorMode(a0);
+ } __finally {
+ _PrintExit("SetErrorMode() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetEvent(HANDLE a0)
+{
+ _PrintEnter("SetEvent(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetEvent(a0);
+ } __finally {
+ _PrintExit("SetEvent() -> %p\n", rv);
+ };
+ return rv;
+}
+
+void __stdcall Mine_SetFileApisToANSI(void)
+{
+ _PrintEnter("SetFileApisToANSI()\n");
+
+ __try {
+ Real_SetFileApisToANSI();
+ } __finally {
+ _PrintExit("SetFileApisToANSI() ->\n");
+ };
+}
+
+void __stdcall Mine_SetFileApisToOEM(void)
+{
+ _PrintEnter("SetFileApisToOEM()\n");
+
+ __try {
+ Real_SetFileApisToOEM();
+ } __finally {
+ _PrintExit("SetFileApisToOEM() ->\n");
+ };
+}
+
+BOOL __stdcall Mine_SetFileAttributesA(LPCSTR a0,
+ DWORD a1)
+{
+ _PrintEnter("SetFileAttributesA(%hs,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetFileAttributesA(a0, a1);
+ } __finally {
+ _PrintExit("SetFileAttributesA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetFileAttributesW(LPCWSTR a0,
+ DWORD a1)
+{
+ _PrintEnter("SetFileAttributesW(%ls,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetFileAttributesW(a0, a1);
+ } __finally {
+ _PrintExit("SetFileAttributesW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_SetFilePointer(HANDLE a0,
+ LONG a1,
+ PLONG a2,
+ DWORD a3)
+{
+ _PrintEnter("SetFilePointer(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_SetFilePointer(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SetFilePointer(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetFileTime(HANDLE a0,
+ FILETIME* a1,
+ FILETIME* a2,
+ FILETIME* a3)
+{
+ _PrintEnter("SetFileTime(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetFileTime(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SetFileTime(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_SetFocus(HWND a0)
+{
+ _PrintEnter("SetFocus(%p)\n", a0);
+
+ HWND rv = 0;
+ __try {
+ rv = Real_SetFocus(a0);
+ } __finally {
+ _PrintExit("SetFocus() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetForegroundWindow(HWND a0)
+{
+ _PrintEnter("SetForegroundWindow(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetForegroundWindow(a0);
+ } __finally {
+ _PrintExit("SetForegroundWindow() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_SetGraphicsMode(HDC a0,
+ int a1)
+{
+ _PrintEnter("SetGraphicsMode(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_SetGraphicsMode(a0, a1);
+ } __finally {
+ _PrintExit("SetGraphicsMode(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_SetHandleCount(UINT a0)
+{
+ _PrintEnter("SetHandleCount(%p)\n", a0);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_SetHandleCount(a0);
+ } __finally {
+ _PrintExit("SetHandleCount() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetHandleInformation(HANDLE a0,
+ DWORD a1,
+ DWORD a2)
+{
+ _PrintEnter("SetHandleInformation(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetHandleInformation(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetHandleInformation(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_SetICMMode(HDC a0,
+ int a1)
+{
+ _PrintEnter("SetICMMode(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_SetICMMode(a0, a1);
+ } __finally {
+ _PrintExit("SetICMMode(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetICMProfileA(HDC a0,
+ LPSTR a1)
+{
+ _PrintEnter("SetICMProfileA(%p,%hs)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetICMProfileA(a0, a1);
+ } __finally {
+ _PrintExit("SetICMProfileA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetICMProfileW(HDC a0,
+ LPWSTR a1)
+{
+ _PrintEnter("SetICMProfileW(%p,%ls)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetICMProfileW(a0, a1);
+ } __finally {
+ _PrintExit("SetICMProfileW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetKeyboardState(LPBYTE a0)
+{
+ _PrintEnter("SetKeyboardState(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetKeyboardState(a0);
+ } __finally {
+ _PrintExit("SetKeyboardState() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetLocalTime(SYSTEMTIME* a0)
+{
+ _PrintEnter("SetLocalTime(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetLocalTime(a0);
+ } __finally {
+ _PrintExit("SetLocalTime() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetLocaleInfoA(LCID a0,
+ LCTYPE a1,
+ LPCSTR a2)
+{
+ _PrintEnter("SetLocaleInfoA(%p,%p,%hs)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetLocaleInfoA(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetLocaleInfoA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetLocaleInfoW(LCID a0,
+ LCTYPE a1,
+ LPCWSTR a2)
+{
+ _PrintEnter("SetLocaleInfoW(%p,%p,%ls)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetLocaleInfoW(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetLocaleInfoW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetMailslotInfo(HANDLE a0,
+ DWORD a1)
+{
+ _PrintEnter("SetMailslotInfo(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetMailslotInfo(a0, a1);
+ } __finally {
+ _PrintExit("SetMailslotInfo(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_SetMapMode(HDC a0,
+ int a1)
+{
+ _PrintEnter("SetMapMode(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_SetMapMode(a0, a1);
+ } __finally {
+ _PrintExit("SetMapMode(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_SetMapperFlags(HDC a0,
+ DWORD a1)
+{
+ _PrintEnter("SetMapperFlags(%p,%p)\n", a0, a1);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_SetMapperFlags(a0, a1);
+ } __finally {
+ _PrintExit("SetMapperFlags(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetMenu(HWND a0,
+ HMENU a1)
+{
+ _PrintEnter("SetMenu(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetMenu(a0, a1);
+ } __finally {
+ _PrintExit("SetMenu(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetMenuContextHelpId(HMENU a0,
+ DWORD a1)
+{
+ _PrintEnter("SetMenuContextHelpId(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetMenuContextHelpId(a0, a1);
+ } __finally {
+ _PrintExit("SetMenuContextHelpId(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetMenuDefaultItem(HMENU a0,
+ UINT a1,
+ UINT a2)
+{
+ _PrintEnter("SetMenuDefaultItem(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetMenuDefaultItem(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetMenuDefaultItem(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetMenuItemBitmaps(HMENU a0,
+ UINT a1,
+ UINT a2,
+ HBITMAP a3,
+ HBITMAP a4)
+{
+ _PrintEnter("SetMenuItemBitmaps(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetMenuItemBitmaps(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("SetMenuItemBitmaps(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetMenuItemInfoA(HMENU a0,
+ UINT a1,
+ BOOL a2,
+ MENUITEMINFOA* a3)
+{
+ _PrintEnter("SetMenuItemInfoA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetMenuItemInfoA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SetMenuItemInfoA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetMenuItemInfoW(HMENU a0,
+ UINT a1,
+ BOOL a2,
+ MENUITEMINFOW* a3)
+{
+ _PrintEnter("SetMenuItemInfoW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetMenuItemInfoW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SetMenuItemInfoW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LPARAM __stdcall Mine_SetMessageExtraInfo(LPARAM a0)
+{
+ _PrintEnter("SetMessageExtraInfo(%p)\n", a0);
+
+ LPARAM rv = 0;
+ __try {
+ rv = Real_SetMessageExtraInfo(a0);
+ } __finally {
+ _PrintExit("SetMessageExtraInfo() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetMessageQueue(int a0)
+{
+ _PrintEnter("SetMessageQueue(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetMessageQueue(a0);
+ } __finally {
+ _PrintExit("SetMessageQueue() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HMETAFILE __stdcall Mine_SetMetaFileBitsEx(UINT a0,
+ BYTE* a1)
+{
+ _PrintEnter("SetMetaFileBitsEx(%p,%p)\n", a0, a1);
+
+ HMETAFILE rv = 0;
+ __try {
+ rv = Real_SetMetaFileBitsEx(a0, a1);
+ } __finally {
+ _PrintExit("SetMetaFileBitsEx(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_SetMetaRgn(HDC a0)
+{
+ _PrintEnter("SetMetaRgn(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_SetMetaRgn(a0);
+ } __finally {
+ _PrintExit("SetMetaRgn() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetMiterLimit(HDC a0,
+ FLOAT a1,
+ PFLOAT a2)
+{
+ _PrintEnter("SetMiterLimit(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetMiterLimit(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetMiterLimit(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetNamedPipeHandleState(HANDLE a0,
+ LPDWORD a1,
+ LPDWORD a2,
+ LPDWORD a3)
+{
+ _PrintEnter("SetNamedPipeHandleState(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetNamedPipeHandleState(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SetNamedPipeHandleState(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_SetPaletteEntries(HPALETTE a0,
+ UINT a1,
+ UINT a2,
+ PALETTEENTRY* a3)
+{
+ _PrintEnter("SetPaletteEntries(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_SetPaletteEntries(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SetPaletteEntries(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_SetParent(HWND a0,
+ HWND a1)
+{
+ _PrintEnter("SetParent(%p,%p)\n", a0, a1);
+
+ HWND rv = 0;
+ __try {
+ rv = Real_SetParent(a0, a1);
+ } __finally {
+ _PrintExit("SetParent(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+COLORREF __stdcall Mine_SetPixel(HDC a0,
+ int a1,
+ int a2,
+ COLORREF a3)
+{
+ _PrintEnter("SetPixel(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ COLORREF rv = 0;
+ __try {
+ rv = Real_SetPixel(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SetPixel(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetPixelFormat(HDC a0,
+ int a1,
+ PIXELFORMATDESCRIPTOR* a2)
+{
+ _PrintEnter("SetPixelFormat(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetPixelFormat(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetPixelFormat(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetPixelV(HDC a0,
+ int a1,
+ int a2,
+ COLORREF a3)
+{
+ _PrintEnter("SetPixelV(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetPixelV(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SetPixelV(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_SetPolyFillMode(HDC a0,
+ int a1)
+{
+ _PrintEnter("SetPolyFillMode(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_SetPolyFillMode(a0, a1);
+ } __finally {
+ _PrintExit("SetPolyFillMode(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetPriorityClass(HANDLE a0,
+ DWORD a1)
+{
+ _PrintEnter("SetPriorityClass(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetPriorityClass(a0, a1);
+ } __finally {
+ _PrintExit("SetPriorityClass(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetProcessAffinityMask(HANDLE a0,
+ DWORD_PTR a1)
+{
+ _PrintEnter("SetProcessAffinityMask(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetProcessAffinityMask(a0, a1);
+ } __finally {
+ _PrintExit("SetProcessAffinityMask(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetProcessShutdownParameters(DWORD a0,
+ DWORD a1)
+{
+ _PrintEnter("SetProcessShutdownParameters(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetProcessShutdownParameters(a0, a1);
+ } __finally {
+ _PrintExit("SetProcessShutdownParameters(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetProcessWindowStation(HWINSTA a0)
+{
+ _PrintEnter("SetProcessWindowStation(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetProcessWindowStation(a0);
+ } __finally {
+ _PrintExit("SetProcessWindowStation() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetProcessWorkingSetSize(HANDLE a0,
+ SIZE_T a1,
+ SIZE_T a2)
+{
+ _PrintEnter("SetProcessWorkingSetSize(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetProcessWorkingSetSize(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetProcessWorkingSetSize(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetPropA(HWND a0,
+ LPCSTR a1,
+ HANDLE a2)
+{
+ _PrintEnter("SetPropA(%p,%hs,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetPropA(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetPropA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetPropW(HWND a0,
+ LPCWSTR a1,
+ HANDLE a2)
+{
+ _PrintEnter("SetPropW(%p,%ls,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetPropW(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetPropW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_SetROP2(HDC a0,
+ int a1)
+{
+ _PrintEnter("SetROP2(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_SetROP2(a0, a1);
+ } __finally {
+ _PrintExit("SetROP2(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetRect(LPRECT a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4)
+{
+ _PrintEnter("SetRect(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetRect(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("SetRect(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetRectEmpty(LPRECT a0)
+{
+ _PrintEnter("SetRectEmpty(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetRectEmpty(a0);
+ } __finally {
+ _PrintExit("SetRectEmpty() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetRectRgn(HRGN a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4)
+{
+ _PrintEnter("SetRectRgn(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetRectRgn(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("SetRectRgn(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_SetScrollInfo(HWND a0,
+ int a1,
+ LPCSCROLLINFO a2,
+ BOOL a3)
+{
+ _PrintEnter("SetScrollInfo(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ int rv = 0;
+ __try {
+ rv = Real_SetScrollInfo(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SetScrollInfo(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_SetScrollPos(HWND a0,
+ int a1,
+ int a2,
+ BOOL a3)
+{
+ _PrintEnter("SetScrollPos(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ int rv = 0;
+ __try {
+ rv = Real_SetScrollPos(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SetScrollPos(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetScrollRange(HWND a0,
+ int a1,
+ int a2,
+ int a3,
+ BOOL a4)
+{
+ _PrintEnter("SetScrollRange(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetScrollRange(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("SetScrollRange(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetStdHandle(DWORD a0,
+ HANDLE a1)
+{
+ _PrintEnter("SetStdHandle(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetStdHandle(a0, a1);
+ } __finally {
+ _PrintExit("SetStdHandle(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_SetStretchBltMode(HDC a0,
+ int a1)
+{
+ _PrintEnter("SetStretchBltMode(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_SetStretchBltMode(a0, a1);
+ } __finally {
+ _PrintExit("SetStretchBltMode(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetSysColors(int a0,
+ INT* a1,
+ COLORREF* a2)
+{
+ _PrintEnter("SetSysColors(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetSysColors(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetSysColors(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetSystemCursor(HCURSOR a0,
+ DWORD a1)
+{
+ _PrintEnter("SetSystemCursor(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetSystemCursor(a0, a1);
+ } __finally {
+ _PrintExit("SetSystemCursor(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_SetSystemPaletteUse(HDC a0,
+ UINT a1)
+{
+ _PrintEnter("SetSystemPaletteUse(%p,%p)\n", a0, a1);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_SetSystemPaletteUse(a0, a1);
+ } __finally {
+ _PrintExit("SetSystemPaletteUse(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetSystemPowerState(BOOL a0,
+ BOOL a1)
+{
+ _PrintEnter("SetSystemPowerState(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetSystemPowerState(a0, a1);
+ } __finally {
+ _PrintExit("SetSystemPowerState(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetSystemTime(SYSTEMTIME* a0)
+{
+ _PrintEnter("SetSystemTime(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetSystemTime(a0);
+ } __finally {
+ _PrintExit("SetSystemTime() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetSystemTimeAdjustment(DWORD a0,
+ BOOL a1)
+{
+ _PrintEnter("SetSystemTimeAdjustment(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetSystemTimeAdjustment(a0, a1);
+ } __finally {
+ _PrintExit("SetSystemTimeAdjustment(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_SetTapeParameters(HANDLE a0,
+ DWORD a1,
+ LPVOID a2)
+{
+ _PrintEnter("SetTapeParameters(%p,%p,%p)\n", a0, a1, a2);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_SetTapeParameters(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetTapeParameters(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_SetTapePosition(HANDLE a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3,
+ DWORD a4,
+ BOOL a5)
+{
+ _PrintEnter("SetTapePosition(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_SetTapePosition(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("SetTapePosition(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_SetTextAlign(HDC a0,
+ UINT a1)
+{
+ _PrintEnter("SetTextAlign(%p,%p)\n", a0, a1);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_SetTextAlign(a0, a1);
+ } __finally {
+ _PrintExit("SetTextAlign(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_SetTextCharacterExtra(HDC a0,
+ int a1)
+{
+ _PrintEnter("SetTextCharacterExtra(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_SetTextCharacterExtra(a0, a1);
+ } __finally {
+ _PrintExit("SetTextCharacterExtra(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+COLORREF __stdcall Mine_SetTextColor(HDC a0,
+ COLORREF a1)
+{
+ _PrintEnter("SetTextColor(%p,%p)\n", a0, a1);
+
+ COLORREF rv = 0;
+ __try {
+ rv = Real_SetTextColor(a0, a1);
+ } __finally {
+ _PrintExit("SetTextColor(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetTextJustification(HDC a0,
+ int a1,
+ int a2)
+{
+ _PrintEnter("SetTextJustification(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetTextJustification(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetTextJustification(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD_PTR __stdcall Mine_SetThreadAffinityMask(HANDLE a0,
+ DWORD_PTR a1)
+{
+ _PrintEnter("SetThreadAffinityMask(%p,%p)\n", a0, a1);
+
+ DWORD_PTR rv = 0;
+ __try {
+ rv = Real_SetThreadAffinityMask(a0, a1);
+ } __finally {
+ _PrintExit("SetThreadAffinityMask(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetThreadContext(HANDLE a0,
+ CONTEXT* a1)
+{
+ _PrintEnter("SetThreadContext(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetThreadContext(a0, a1);
+ } __finally {
+ _PrintExit("SetThreadContext(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetThreadDesktop(HDESK a0)
+{
+ _PrintEnter("SetThreadDesktop(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetThreadDesktop(a0);
+ } __finally {
+ _PrintExit("SetThreadDesktop() -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_SetThreadIdealProcessor(HANDLE a0,
+ DWORD a1)
+{
+ _PrintEnter("SetThreadIdealProcessor(%p,%p)\n", a0, a1);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_SetThreadIdealProcessor(a0, a1);
+ } __finally {
+ _PrintExit("SetThreadIdealProcessor(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+#if(WINVER >= 0x0500)
+BOOL __stdcall Mine_SetThreadLocale(LCID a0)
+{
+ _PrintEnter("SetThreadLocale(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetThreadLocale(a0);
+ } __finally {
+ _PrintExit("SetThreadLocale() -> %p\n", rv);
+ };
+ return rv;
+}
+#endif // (WINVER >= 0x0500)
+
+BOOL __stdcall Mine_SetThreadPriority(HANDLE a0,
+ int a1)
+{
+ _PrintEnter("SetThreadPriority(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetThreadPriority(a0, a1);
+ } __finally {
+ _PrintExit("SetThreadPriority(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetThreadPriorityBoost(HANDLE a0,
+ BOOL a1)
+{
+ _PrintEnter("SetThreadPriorityBoost(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetThreadPriorityBoost(a0, a1);
+ } __finally {
+ _PrintExit("SetThreadPriorityBoost(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetTimeZoneInformation(TIME_ZONE_INFORMATION* a0)
+{
+ _PrintEnter("SetTimeZoneInformation(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetTimeZoneInformation(a0);
+ } __finally {
+ _PrintExit("SetTimeZoneInformation() -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT_PTR __stdcall Mine_SetTimer(HWND a0,
+ UINT_PTR a1,
+ UINT a2,
+ TIMERPROC a3)
+{
+ _PrintEnter("SetTimer(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ UINT_PTR rv = 0;
+ __try {
+ rv = Real_SetTimer(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SetTimer(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LPTOP_LEVEL_EXCEPTION_FILTER __stdcall Mine_SetUnhandledExceptionFilter(LPTOP_LEVEL_EXCEPTION_FILTER a0)
+{
+ _PrintEnter("SetUnhandledExceptionFilter(%p)\n", a0);
+
+ LPTOP_LEVEL_EXCEPTION_FILTER rv = 0;
+ __try {
+ rv = Real_SetUnhandledExceptionFilter(a0);
+ } __finally {
+ _PrintExit("SetUnhandledExceptionFilter() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetUserObjectInformationA(HANDLE a0,
+ int a1,
+ PVOID a2,
+ DWORD a3)
+{
+ _PrintEnter("SetUserObjectInformationA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetUserObjectInformationA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SetUserObjectInformationA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetUserObjectInformationW(HANDLE a0,
+ int a1,
+ PVOID a2,
+ DWORD a3)
+{
+ _PrintEnter("SetUserObjectInformationW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetUserObjectInformationW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SetUserObjectInformationW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetUserObjectSecurity(HANDLE a0,
+ PSECURITY_INFORMATION a1,
+ PSECURITY_DESCRIPTOR a2)
+{
+ _PrintEnter("SetUserObjectSecurity(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetUserObjectSecurity(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetUserObjectSecurity(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetViewportExtEx(HDC a0,
+ int a1,
+ int a2,
+ SIZE* a3)
+{
+ _PrintEnter("SetViewportExtEx(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetViewportExtEx(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SetViewportExtEx(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetViewportOrgEx(HDC a0,
+ int a1,
+ int a2,
+ POINT* a3)
+{
+ _PrintEnter("SetViewportOrgEx(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetViewportOrgEx(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SetViewportOrgEx(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetVolumeLabelA(LPCSTR a0,
+ LPCSTR a1)
+{
+ _PrintEnter("SetVolumeLabelA(%hs,%hs)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetVolumeLabelA(a0, a1);
+ } __finally {
+ _PrintExit("SetVolumeLabelA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetVolumeLabelW(LPCWSTR a0,
+ LPCWSTR a1)
+{
+ _PrintEnter("SetVolumeLabelW(%ls,%ls)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetVolumeLabelW(a0, a1);
+ } __finally {
+ _PrintExit("SetVolumeLabelW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetWaitableTimer(HANDLE a0,
+ LARGE_INTEGER* a1,
+ LONG a2,
+ PTIMERAPCROUTINE a3,
+ LPVOID a4,
+ BOOL a5)
+{
+ _PrintEnter("SetWaitableTimer(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetWaitableTimer(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("SetWaitableTimer(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HENHMETAFILE __stdcall Mine_SetWinMetaFileBits(UINT a0,
+ BYTE* a1,
+ HDC a2,
+ METAFILEPICT* a3)
+{
+ _PrintEnter("SetWinMetaFileBits(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HENHMETAFILE rv = 0;
+ __try {
+ rv = Real_SetWinMetaFileBits(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SetWinMetaFileBits(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetWindowContextHelpId(HWND a0,
+ DWORD a1)
+{
+ _PrintEnter("SetWindowContextHelpId(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetWindowContextHelpId(a0, a1);
+ } __finally {
+ _PrintExit("SetWindowContextHelpId(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetWindowExtEx(HDC a0,
+ int a1,
+ int a2,
+ SIZE* a3)
+{
+ _PrintEnter("SetWindowExtEx(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetWindowExtEx(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SetWindowExtEx(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LONG __stdcall Mine_SetWindowLongA(HWND a0,
+ int a1,
+ LONG a2)
+{
+ _PrintEnter("SetWindowLongA(%p,%p,%p)\n", a0, a1, a2);
+
+ LONG rv = 0;
+ __try {
+ rv = Real_SetWindowLongA(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetWindowLongA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LONG __stdcall Mine_SetWindowLongW(HWND a0,
+ int a1,
+ LONG a2)
+{
+ _PrintEnter("SetWindowLongW(%p,%p,%p)\n", a0, a1, a2);
+
+ LONG rv = 0;
+ __try {
+ rv = Real_SetWindowLongW(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetWindowLongW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetWindowOrgEx(HDC a0,
+ int a1,
+ int a2,
+ POINT* a3)
+{
+ _PrintEnter("SetWindowOrgEx(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetWindowOrgEx(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SetWindowOrgEx(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetWindowPlacement(HWND a0,
+ WINDOWPLACEMENT* a1)
+{
+ _PrintEnter("SetWindowPlacement(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetWindowPlacement(a0, a1);
+ } __finally {
+ _PrintExit("SetWindowPlacement(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetWindowPos(HWND a0,
+ HWND a1,
+ int a2,
+ int a3,
+ int a4,
+ int a5,
+ UINT a6)
+{
+ _PrintEnter("SetWindowPos(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetWindowPos(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("SetWindowPos(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_SetWindowRgn(HWND a0,
+ HRGN a1,
+ BOOL a2)
+{
+ _PrintEnter("SetWindowRgn(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_SetWindowRgn(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetWindowRgn(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetWindowTextA(HWND a0,
+ LPCSTR a1)
+{
+ _PrintEnter("SetWindowTextA(%p,%hs)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetWindowTextA(a0, a1);
+ } __finally {
+ _PrintExit("SetWindowTextA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetWindowTextW(HWND a0,
+ LPCWSTR a1)
+{
+ _PrintEnter("SetWindowTextW(%p,%ls)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetWindowTextW(a0, a1);
+ } __finally {
+ _PrintExit("SetWindowTextW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+WORD __stdcall Mine_SetWindowWord(HWND a0,
+ int a1,
+ WORD a2)
+{
+ _PrintEnter("SetWindowWord(%p,%p,%p)\n", a0, a1, a2);
+
+ WORD rv = 0;
+ __try {
+ rv = Real_SetWindowWord(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetWindowWord(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HHOOK __stdcall Mine_SetWindowsHookA(int a0,
+ HOOKPROC a1)
+{
+ _PrintEnter("SetWindowsHookA(%p,%p)\n", a0, a1);
+
+ HHOOK rv = 0;
+ __try {
+ rv = Real_SetWindowsHookA(a0, a1);
+ } __finally {
+ _PrintExit("SetWindowsHookA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HHOOK __stdcall Mine_SetWindowsHookExA(int a0,
+ HOOKPROC a1,
+ HINSTANCE a2,
+ DWORD a3)
+{
+ _PrintEnter("SetWindowsHookExA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HHOOK rv = 0;
+ __try {
+ rv = Real_SetWindowsHookExA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SetWindowsHookExA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HHOOK __stdcall Mine_SetWindowsHookExW(int a0,
+ HOOKPROC a1,
+ HINSTANCE a2,
+ DWORD a3)
+{
+ _PrintEnter("SetWindowsHookExW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HHOOK rv = 0;
+ __try {
+ rv = Real_SetWindowsHookExW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SetWindowsHookExW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HHOOK __stdcall Mine_SetWindowsHookW(int a0,
+ HOOKPROC a1)
+{
+ _PrintEnter("SetWindowsHookW(%p,%p)\n", a0, a1);
+
+ HHOOK rv = 0;
+ __try {
+ rv = Real_SetWindowsHookW(a0, a1);
+ } __finally {
+ _PrintExit("SetWindowsHookW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetWorldTransform(HDC a0,
+ XFORM* a1)
+{
+ _PrintEnter("SetWorldTransform(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetWorldTransform(a0, a1);
+ } __finally {
+ _PrintExit("SetWorldTransform(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SetupComm(HANDLE a0,
+ DWORD a1,
+ DWORD a2)
+{
+ _PrintEnter("SetupComm(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetupComm(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetupComm(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ShowCaret(HWND a0)
+{
+ _PrintEnter("ShowCaret(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ShowCaret(a0);
+ } __finally {
+ _PrintExit("ShowCaret() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_ShowCursor(BOOL a0)
+{
+ _PrintEnter("ShowCursor(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_ShowCursor(a0);
+ } __finally {
+ _PrintExit("ShowCursor() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ShowOwnedPopups(HWND a0,
+ BOOL a1)
+{
+ _PrintEnter("ShowOwnedPopups(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ShowOwnedPopups(a0, a1);
+ } __finally {
+ _PrintExit("ShowOwnedPopups(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ShowScrollBar(HWND a0,
+ int a1,
+ BOOL a2)
+{
+ _PrintEnter("ShowScrollBar(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ShowScrollBar(a0, a1, a2);
+ } __finally {
+ _PrintExit("ShowScrollBar(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ShowWindow(HWND a0,
+ int a1)
+{
+ _PrintEnter("ShowWindow(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ShowWindow(a0, a1);
+ } __finally {
+ _PrintExit("ShowWindow(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ShowWindowAsync(HWND a0,
+ int a1)
+{
+ _PrintEnter("ShowWindowAsync(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ShowWindowAsync(a0, a1);
+ } __finally {
+ _PrintExit("ShowWindowAsync(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_SignalObjectAndWait(HANDLE a0,
+ HANDLE a1,
+ DWORD a2,
+ BOOL a3)
+{
+ _PrintEnter("SignalObjectAndWait(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_SignalObjectAndWait(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SignalObjectAndWait(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_SizeofResource(HMODULE a0,
+ HRSRC a1)
+{
+ _PrintEnter("SizeofResource(%p,%p)\n", a0, a1);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_SizeofResource(a0, a1);
+ } __finally {
+ _PrintExit("SizeofResource(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_SleepEx(DWORD a0,
+ BOOL a1)
+{
+ _PrintEnter("SleepEx(%p,%p)\n", a0, a1);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_SleepEx(a0, a1);
+ } __finally {
+ _PrintExit("SleepEx(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_StartDocA(HDC a0,
+ DOCINFOA* a1)
+{
+ _PrintEnter("StartDocA(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_StartDocA(a0, a1);
+ } __finally {
+ _PrintExit("StartDocA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_StartDocW(HDC a0,
+ DOCINFOW* a1)
+{
+ _PrintEnter("StartDocW(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_StartDocW(a0, a1);
+ } __finally {
+ _PrintExit("StartDocW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_StartPage(HDC a0)
+{
+ _PrintEnter("StartPage(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_StartPage(a0);
+ } __finally {
+ _PrintExit("StartPage() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_StgCreateDocfile(OLECHAR* a0,
+ DWORD a1,
+ DWORD a2,
+ IStorage** a3)
+{
+ _PrintEnter("StgCreateDocfile(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_StgCreateDocfile(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("StgCreateDocfile(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_StgCreateDocfileOnILockBytes(ILockBytes* a0,
+ DWORD a1,
+ DWORD a2,
+ IStorage** a3)
+{
+ _PrintEnter("StgCreateDocfileOnILockBytes(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_StgCreateDocfileOnILockBytes(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("StgCreateDocfileOnILockBytes(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_StgCreatePropSetStg(IStorage* a0,
+ DWORD a1,
+ IPropertySetStorage** a2)
+{
+ _PrintEnter("StgCreatePropSetStg(%p,%p,%p)\n", a0, a1, a2);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_StgCreatePropSetStg(a0, a1, a2);
+ } __finally {
+ _PrintExit("StgCreatePropSetStg(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_StgCreatePropStg(IUnknown* a0,
+ CONST IID& a1,
+ CLSID* a2,
+ DWORD a3,
+ DWORD a4,
+ IPropertyStorage** a5)
+{
+ _PrintEnter("StgCreatePropStg(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_StgCreatePropStg(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("StgCreatePropStg(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+#if _MSC_VER < 1300
+HRESULT __stdcall Mine_StgCreateStorageEx(WCHAR* a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3,
+ void* a4,
+ void* a5,
+ CONST IID& a6,
+ void** a7)
+#else
+HRESULT __stdcall Mine_StgCreateStorageEx(WCHAR* a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3,
+ STGOPTIONS* a4,
+ void* a5,
+ CONST IID& a6,
+ void** a7)
+#endif
+{
+ _PrintEnter("StgCreateStorageEx(%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_StgCreateStorageEx(a0, a1, a2, a3, a4, a5, a6, a7);
+ } __finally {
+ _PrintExit("StgCreateStorageEx(,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_StgGetIFillLockBytesOnFile(OLECHAR* a0,
+ IFillLockBytes** a1)
+{
+ _PrintEnter("StgGetIFillLockBytesOnFile(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_StgGetIFillLockBytesOnFile(a0, a1);
+ } __finally {
+ _PrintExit("StgGetIFillLockBytesOnFile(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_StgGetIFillLockBytesOnILockBytes(ILockBytes* a0,
+ IFillLockBytes** a1)
+{
+ _PrintEnter("StgGetIFillLockBytesOnILockBytes(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_StgGetIFillLockBytesOnILockBytes(a0, a1);
+ } __finally {
+ _PrintExit("StgGetIFillLockBytesOnILockBytes(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_StgIsStorageFile(OLECHAR* a0)
+{
+ _PrintEnter("StgIsStorageFile(%p)\n", a0);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_StgIsStorageFile(a0);
+ } __finally {
+ _PrintExit("StgIsStorageFile() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_StgIsStorageILockBytes(ILockBytes* a0)
+{
+ _PrintEnter("StgIsStorageILockBytes(%p)\n", a0);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_StgIsStorageILockBytes(a0);
+ } __finally {
+ _PrintExit("StgIsStorageILockBytes() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_StgOpenAsyncDocfileOnIFillLockBytes(IFillLockBytes* a0,
+ DWORD a1,
+ DWORD a2,
+ IStorage** a3)
+{
+ _PrintEnter("StgOpenAsyncDocfileOnIFillLockBytes(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_StgOpenAsyncDocfileOnIFillLockBytes(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("StgOpenAsyncDocfileOnIFillLockBytes(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_StgOpenPropStg(IUnknown* a0,
+ CONST IID& a1,
+ DWORD a2,
+ DWORD a3,
+ IPropertyStorage** a4)
+{
+ _PrintEnter("StgOpenPropStg(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_StgOpenPropStg(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("StgOpenPropStg(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_StgOpenStorage(OLECHAR* a0,
+ IStorage* a1,
+ DWORD a2,
+ SNB a3,
+ DWORD a4,
+ IStorage** a5)
+{
+ _PrintEnter("StgOpenStorage(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_StgOpenStorage(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("StgOpenStorage(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+#if _MSC_VER < 1300
+HRESULT __stdcall Mine_StgOpenStorageEx(WCHAR* a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3,
+ void* a4,
+ void* a5,
+ CONST IID& a6,
+ void** a7)
+#else
+HRESULT __stdcall Mine_StgOpenStorageEx(WCHAR* a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3,
+ STGOPTIONS* a4,
+ void* a5,
+ CONST IID& a6,
+ void** a7)
+#endif
+{
+ _PrintEnter("StgOpenStorageEx(%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_StgOpenStorageEx(a0, a1, a2, a3, a4, a5, a6, a7);
+ } __finally {
+ _PrintExit("StgOpenStorageEx(,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_StgOpenStorageOnILockBytes(ILockBytes* a0,
+ IStorage* a1,
+ DWORD a2,
+ SNB a3,
+ DWORD a4,
+ IStorage** a5)
+{
+ _PrintEnter("StgOpenStorageOnILockBytes(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_StgOpenStorageOnILockBytes(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("StgOpenStorageOnILockBytes(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_StgSetTimes(OLECHAR* a0,
+ FILETIME* a1,
+ FILETIME* a2,
+ FILETIME* a3)
+{
+ _PrintEnter("StgSetTimes(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_StgSetTimes(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("StgSetTimes(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_StretchBlt(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ HDC a5,
+ int a6,
+ int a7,
+ int a8,
+ int a9,
+ DWORD a10)
+{
+ _PrintEnter("StretchBlt(%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_StretchBlt(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
+ } __finally {
+ _PrintExit("StretchBlt(,,,,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_StretchDIBits(HDC a0,
+ int a1,
+ int a2,
+ int a3,
+ int a4,
+ int a5,
+ int a6,
+ int a7,
+ int a8,
+ void* a9,
+ BITMAPINFO* a10,
+ UINT a11,
+ DWORD a12)
+{
+ _PrintEnter("StretchDIBits(%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12);
+
+ int rv = 0;
+ __try {
+ rv = Real_StretchDIBits(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12);
+ } __finally {
+ _PrintExit("StretchDIBits(,,,,,,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_StringFromCLSID(CONST IID& a0,
+ LPOLESTR* a1)
+{
+ _PrintEnter("StringFromCLSID(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_StringFromCLSID(a0, a1);
+ } __finally {
+ _PrintExit("StringFromCLSID(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_StringFromGUID2(CONST GUID& a0,
+ LPOLESTR a1,
+ int a2)
+{
+ _PrintEnter("StringFromGUID2(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_StringFromGUID2(a0, a1, a2);
+ } __finally {
+ _PrintExit("StringFromGUID2(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_StringFromIID(CONST IID& a0,
+ LPOLESTR* a1)
+{
+ _PrintEnter("StringFromIID(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_StringFromIID(a0, a1);
+ } __finally {
+ _PrintExit("StringFromIID(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_StrokeAndFillPath(HDC a0)
+{
+ _PrintEnter("StrokeAndFillPath(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_StrokeAndFillPath(a0);
+ } __finally {
+ _PrintExit("StrokeAndFillPath() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_StrokePath(HDC a0)
+{
+ _PrintEnter("StrokePath(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_StrokePath(a0);
+ } __finally {
+ _PrintExit("StrokePath() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SubtractRect(LPRECT a0,
+ RECT* a1,
+ RECT* a2)
+{
+ _PrintEnter("SubtractRect(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SubtractRect(a0, a1, a2);
+ } __finally {
+ _PrintExit("SubtractRect(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_SuspendThread(HANDLE a0)
+{
+ _PrintEnter("SuspendThread(%p)\n", a0);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_SuspendThread(a0);
+ } __finally {
+ _PrintExit("SuspendThread() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SwapBuffers(HDC a0)
+{
+ _PrintEnter("SwapBuffers(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SwapBuffers(a0);
+ } __finally {
+ _PrintExit("SwapBuffers() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SwapMouseButton(BOOL a0)
+{
+ _PrintEnter("SwapMouseButton(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SwapMouseButton(a0);
+ } __finally {
+ _PrintExit("SwapMouseButton() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SwitchDesktop(HDESK a0)
+{
+ _PrintEnter("SwitchDesktop(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SwitchDesktop(a0);
+ } __finally {
+ _PrintExit("SwitchDesktop() -> %p\n", rv);
+ };
+ return rv;
+}
+
+void __stdcall Mine_SwitchToFiber(LPVOID a0)
+{
+ _PrintEnter("SwitchToFiber(%p)\n", a0);
+
+ __try {
+ Real_SwitchToFiber(a0);
+ } __finally {
+ _PrintExit("SwitchToFiber() ->\n");
+ };
+}
+
+BOOL __stdcall Mine_SwitchToThread(void)
+{
+ _PrintEnter("SwitchToThread()\n");
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SwitchToThread();
+ } __finally {
+ _PrintExit("SwitchToThread() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SystemParametersInfoA(UINT a0,
+ UINT a1,
+ PVOID a2,
+ UINT a3)
+{
+ _PrintEnter("SystemParametersInfoA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SystemParametersInfoA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SystemParametersInfoA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SystemParametersInfoW(UINT a0,
+ UINT a1,
+ PVOID a2,
+ UINT a3)
+{
+ _PrintEnter("SystemParametersInfoW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SystemParametersInfoW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("SystemParametersInfoW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SystemTimeToFileTime(SYSTEMTIME* a0,
+ LPFILETIME a1)
+{
+ _PrintEnter("SystemTimeToFileTime(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SystemTimeToFileTime(a0, a1);
+ } __finally {
+ _PrintExit("SystemTimeToFileTime(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_SystemTimeToTzSpecificLocalTime(
+#ifdef PIPE_ACCEPT_REMOTE_CLIENTS
+ const TIME_ZONE_INFORMATION *a0,
+ const SYSTEMTIME *a1,
+#else
+ LPTIME_ZONE_INFORMATION a0,
+ LPSYSTEMTIME a1,
+#endif
+ LPSYSTEMTIME a2
+ )
+{
+ _PrintEnter("SystemTimeToTzSpecificLocalTime(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SystemTimeToTzSpecificLocalTime(a0, a1, a2);
+ } __finally {
+ _PrintExit("SystemTimeToTzSpecificLocalTime(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LONG __stdcall Mine_TabbedTextOutA(HDC a0,
+ int a1,
+ int a2,
+ LPCSTR a3,
+ int a4,
+ int a5,
+ INT* a6,
+ int a7)
+{
+ _PrintEnter("TabbedTextOutA(%p,%p,%p,%hs,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7);
+
+ LONG rv = 0;
+ __try {
+ rv = Real_TabbedTextOutA(a0, a1, a2, a3, a4, a5, a6, a7);
+ } __finally {
+ _PrintExit("TabbedTextOutA(,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LONG __stdcall Mine_TabbedTextOutW(HDC a0,
+ int a1,
+ int a2,
+ LPCWSTR a3,
+ int a4,
+ int a5,
+ INT* a6,
+ int a7)
+{
+ _PrintEnter("TabbedTextOutW(%p,%p,%p,%ls,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7);
+
+ LONG rv = 0;
+ __try {
+ rv = Real_TabbedTextOutW(a0, a1, a2, a3, a4, a5, a6, a7);
+ } __finally {
+ _PrintExit("TabbedTextOutW(,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_TerminateProcess(HANDLE a0,
+ UINT a1)
+{
+ _PrintEnter("TerminateProcess(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_TerminateProcess(a0, a1);
+ } __finally {
+ _PrintExit("TerminateProcess(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_TerminateThread(HANDLE a0,
+ DWORD a1)
+{
+ _PrintEnter("TerminateThread(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_TerminateThread(a0, a1);
+ } __finally {
+ _PrintExit("TerminateThread(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_TextOutA(HDC a0,
+ int a1,
+ int a2,
+ LPCSTR a3,
+ int a4)
+{
+ _PrintEnter("TextOutA(%p,%p,%p,%hs,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_TextOutA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("TextOutA(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_TextOutW(HDC a0,
+ int a1,
+ int a2,
+ LPCWSTR a3,
+ int a4)
+{
+ _PrintEnter("TextOutW(%p,%p,%p,%ls,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_TextOutW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("TextOutW(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+WORD __stdcall Mine_TileWindows(HWND a0,
+ UINT a1,
+ RECT* a2,
+ UINT a3,
+ struct HWND__** a4)
+{
+ _PrintEnter("TileWindows(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ WORD rv = 0;
+ __try {
+ rv = Real_TileWindows(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("TileWindows(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_ToAscii(UINT a0,
+ UINT a1,
+ BYTE* a2,
+ LPWORD a3,
+ UINT a4)
+{
+ _PrintEnter("ToAscii(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ int rv = 0;
+ __try {
+ rv = Real_ToAscii(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("ToAscii(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_ToAsciiEx(UINT a0,
+ UINT a1,
+ BYTE* a2,
+ LPWORD a3,
+ UINT a4,
+ HKL a5)
+{
+ _PrintEnter("ToAsciiEx(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ int rv = 0;
+ __try {
+ rv = Real_ToAsciiEx(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("ToAsciiEx(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_ToUnicode(UINT a0,
+ UINT a1,
+ BYTE* a2,
+ LPWSTR a3,
+ int a4,
+ UINT a5)
+{
+ _PrintEnter("ToUnicode(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ int rv = 0;
+ __try {
+ rv = Real_ToUnicode(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("ToUnicode(,,,%ls,,) -> %p\n", a3, rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_ToUnicodeEx(UINT a0,
+ UINT a1,
+ BYTE* a2,
+ LPWSTR a3,
+ int a4,
+ UINT a5,
+ HKL a6)
+{
+ _PrintEnter("ToUnicodeEx(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ int rv = 0;
+ __try {
+ rv = Real_ToUnicodeEx(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("ToUnicodeEx(,,,%ls,,,) -> %p\n", a3, rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_TrackMouseEvent(TRACKMOUSEEVENT* a0)
+{
+ _PrintEnter("TrackMouseEvent(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_TrackMouseEvent(a0);
+ } __finally {
+ _PrintExit("TrackMouseEvent() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_TrackPopupMenu(HMENU a0,
+ UINT a1,
+ int a2,
+ int a3,
+ int a4,
+ HWND a5,
+ RECT* a6)
+{
+ _PrintEnter("TrackPopupMenu(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_TrackPopupMenu(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("TrackPopupMenu(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_TrackPopupMenuEx(HMENU a0,
+ UINT a1,
+ int a2,
+ int a3,
+ HWND a4,
+ LPTPMPARAMS a5)
+{
+ _PrintEnter("TrackPopupMenuEx(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_TrackPopupMenuEx(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("TrackPopupMenuEx(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_TransactNamedPipe(HANDLE a0,
+ LPVOID a1,
+ DWORD a2,
+ LPVOID a3,
+ DWORD a4,
+ LPDWORD a5,
+ LPOVERLAPPED a6)
+{
+ _PrintEnter("TransactNamedPipe(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_TransactNamedPipe(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("TransactNamedPipe(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_TranslateAcceleratorA(HWND a0,
+ HACCEL a1,
+ LPMSG a2)
+{
+ _PrintEnter("TranslateAcceleratorA(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_TranslateAcceleratorA(a0, a1, a2);
+ } __finally {
+ _PrintExit("TranslateAcceleratorA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_TranslateAcceleratorW(HWND a0,
+ HACCEL a1,
+ LPMSG a2)
+{
+ _PrintEnter("TranslateAcceleratorW(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_TranslateAcceleratorW(a0, a1, a2);
+ } __finally {
+ _PrintExit("TranslateAcceleratorW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_TranslateCharsetInfo(DWORD* a0,
+ CHARSETINFO* a1,
+ DWORD a2)
+{
+ _PrintEnter("TranslateCharsetInfo(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_TranslateCharsetInfo(a0, a1, a2);
+ } __finally {
+ _PrintExit("TranslateCharsetInfo(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_TranslateMDISysAccel(HWND a0,
+ LPMSG a1)
+{
+ _PrintEnter("TranslateMDISysAccel(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_TranslateMDISysAccel(a0, a1);
+ } __finally {
+ _PrintExit("TranslateMDISysAccel(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_TranslateMessage(MSG* a0)
+{
+ _PrintEnter("TranslateMessage(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_TranslateMessage(a0);
+ } __finally {
+ _PrintExit("TranslateMessage() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_TransmitCommChar(HANDLE a0,
+ char a1)
+{
+ _PrintEnter("TransmitCommChar(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_TransmitCommChar(a0, a1);
+ } __finally {
+ _PrintExit("TransmitCommChar(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+#if DETOUR_TryEnterCriticalSection_EVEN_IF_IT_EXERCISES_A_BUG_IN_RtlLookupFunctionTable
+BOOL __stdcall Mine_TryEnterCriticalSection(LPCRITICAL_SECTION a0)
+{
+ _PrintEnter("TryEnterCriticalSection(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_TryEnterCriticalSection(a0);
+ } __finally {
+ _PrintExit("TryEnterCriticalSection() -> %p\n", rv);
+ };
+ return rv;
+}
+#endif
+
+BOOL __stdcall Mine_UnhookWindowsHook(int a0,
+ HOOKPROC a1)
+{
+ _PrintEnter("UnhookWindowsHook(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_UnhookWindowsHook(a0, a1);
+ } __finally {
+ _PrintExit("UnhookWindowsHook(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_UnhookWindowsHookEx(HHOOK a0)
+{
+ _PrintEnter("UnhookWindowsHookEx(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_UnhookWindowsHookEx(a0);
+ } __finally {
+ _PrintExit("UnhookWindowsHookEx() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_UnionRect(LPRECT a0,
+ RECT* a1,
+ RECT* a2)
+{
+ _PrintEnter("UnionRect(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_UnionRect(a0, a1, a2);
+ } __finally {
+ _PrintExit("UnionRect(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_UnloadKeyboardLayout(HKL a0)
+{
+ _PrintEnter("UnloadKeyboardLayout(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_UnloadKeyboardLayout(a0);
+ } __finally {
+ _PrintExit("UnloadKeyboardLayout() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_UnlockFile(HANDLE a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3,
+ DWORD a4)
+{
+ _PrintEnter("UnlockFile(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_UnlockFile(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("UnlockFile(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_UnlockFileEx(HANDLE a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3,
+ LPOVERLAPPED a4)
+{
+ _PrintEnter("UnlockFileEx(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_UnlockFileEx(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("UnlockFileEx(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_UnmapViewOfFile(LPCVOID a0)
+{
+ _PrintEnter("UnmapViewOfFile(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_UnmapViewOfFile(a0);
+ } __finally {
+ _PrintExit("UnmapViewOfFile() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_UnpackDDElParam(UINT a0,
+ LPARAM a1,
+ PUINT_PTR a2,
+ PUINT_PTR a3)
+{
+ _PrintEnter("UnpackDDElParam(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_UnpackDDElParam(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("UnpackDDElParam(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_UnrealizeObject(HGDIOBJ a0)
+{
+ _PrintEnter("UnrealizeObject(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_UnrealizeObject(a0);
+ } __finally {
+ _PrintExit("UnrealizeObject() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_UnregisterClassA(LPCSTR a0,
+ HINSTANCE a1)
+{
+ _PrintEnter("UnregisterClassA(%hs,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_UnregisterClassA(a0, a1);
+ } __finally {
+ _PrintExit("UnregisterClassA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_UnregisterClassW(LPCWSTR a0,
+ HINSTANCE a1)
+{
+ _PrintEnter("UnregisterClassW(%ls,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_UnregisterClassW(a0, a1);
+ } __finally {
+ _PrintExit("UnregisterClassW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_UnregisterHotKey(HWND a0,
+ int a1)
+{
+ _PrintEnter("UnregisterHotKey(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_UnregisterHotKey(a0, a1);
+ } __finally {
+ _PrintExit("UnregisterHotKey(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_UpdateColors(HDC a0)
+{
+ _PrintEnter("UpdateColors(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_UpdateColors(a0);
+ } __finally {
+ _PrintExit("UpdateColors() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_UpdateResourceA(HANDLE a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ WORD a3,
+ LPVOID a4,
+ DWORD a5)
+{
+ _PrintEnter("UpdateResourceA(%p,%hs,%hs,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_UpdateResourceA(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("UpdateResourceA(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_UpdateResourceW(HANDLE a0,
+ LPCWSTR a1,
+ LPCWSTR a2,
+ WORD a3,
+ LPVOID a4,
+ DWORD a5)
+{
+ _PrintEnter("UpdateResourceW(%p,%ls,%ls,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_UpdateResourceW(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("UpdateResourceW(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_UpdateWindow(HWND a0)
+{
+ _PrintEnter("UpdateWindow(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_UpdateWindow(a0);
+ } __finally {
+ _PrintExit("UpdateWindow() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ValidateRect(HWND a0,
+ RECT* a1)
+{
+ _PrintEnter("ValidateRect(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ValidateRect(a0, a1);
+ } __finally {
+ _PrintExit("ValidateRect(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_ValidateRgn(HWND a0,
+ HRGN a1)
+{
+ _PrintEnter("ValidateRgn(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ValidateRgn(a0, a1);
+ } __finally {
+ _PrintExit("ValidateRgn(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_VerLanguageNameA(DWORD a0,
+ LPSTR a1,
+ DWORD a2)
+{
+ _PrintEnter("VerLanguageNameA(%p,%p,%p)\n", a0, a1, a2);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_VerLanguageNameA(a0, a1, a2);
+ } __finally {
+ _PrintExit("VerLanguageNameA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_VerLanguageNameW(DWORD a0,
+ LPWSTR a1,
+ DWORD a2)
+{
+ _PrintEnter("VerLanguageNameW(%p,%p,%p)\n", a0, a1, a2);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_VerLanguageNameW(a0, a1, a2);
+ } __finally {
+ _PrintExit("VerLanguageNameW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LPVOID __stdcall Mine_VirtualAllocEx(HANDLE a0,
+ LPVOID a1,
+ SIZE_T a2,
+ DWORD a3,
+ DWORD a4)
+{
+ _PrintEnter("VirtualAllocEx(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ LPVOID rv = 0;
+ __try {
+ rv = Real_VirtualAllocEx(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("VirtualAllocEx(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_VirtualFreeEx(HANDLE a0,
+ LPVOID a1,
+ SIZE_T a2,
+ DWORD a3)
+{
+ _PrintEnter("VirtualFreeEx(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_VirtualFreeEx(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("VirtualFreeEx(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_VirtualProtectEx(HANDLE a0,
+ LPVOID a1,
+ SIZE_T a2,
+ DWORD a3,
+ PDWORD a4)
+{
+ _PrintEnter("VirtualProtectEx(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_VirtualProtectEx(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("VirtualProtectEx(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD_PTR __stdcall Mine_VirtualQueryEx(HANDLE a0,
+ LPCVOID a1,
+ PMEMORY_BASIC_INFORMATION a2,
+ DWORD_PTR a3)
+{
+ _PrintEnter("VirtualQueryEx(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ DWORD_PTR rv = 0;
+ __try {
+ rv = Real_VirtualQueryEx(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("VirtualQueryEx(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+SHORT __stdcall Mine_VkKeyScanA(CHAR a0)
+{
+ _PrintEnter("VkKeyScanA(%p)\n", a0);
+
+ SHORT rv = 0;
+ __try {
+ rv = Real_VkKeyScanA(a0);
+ } __finally {
+ _PrintExit("VkKeyScanA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+SHORT __stdcall Mine_VkKeyScanExA(CHAR a0,
+ HKL a1)
+{
+ _PrintEnter("VkKeyScanExA(%p,%p)\n", a0, a1);
+
+ SHORT rv = 0;
+ __try {
+ rv = Real_VkKeyScanExA(a0, a1);
+ } __finally {
+ _PrintExit("VkKeyScanExA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+SHORT __stdcall Mine_VkKeyScanExW(WCHAR a0,
+ HKL a1)
+{
+ _PrintEnter("VkKeyScanExW(%p,%p)\n", a0, a1);
+
+ SHORT rv = 0;
+ __try {
+ rv = Real_VkKeyScanExW(a0, a1);
+ } __finally {
+ _PrintExit("VkKeyScanExW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+SHORT __stdcall Mine_VkKeyScanW(WCHAR a0)
+{
+ _PrintEnter("VkKeyScanW(%p)\n", a0);
+
+ SHORT rv = 0;
+ __try {
+ rv = Real_VkKeyScanW(a0);
+ } __finally {
+ _PrintExit("VkKeyScanW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+SOCKET __stdcall Mine_WSAAccept(SOCKET a0,
+ sockaddr* a1,
+ LPINT a2,
+ LPCONDITIONPROC a3,
+ DWORD_PTR a4)
+{
+ _PrintEnter("WSAAccept(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ SOCKET rv = 0;
+ __try {
+ rv = Real_WSAAccept(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WSAAccept(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+INT __stdcall Mine_WSAAddressToStringA(LPSOCKADDR a0,
+ DWORD a1,
+ LPWSAPROTOCOL_INFOA a2,
+ LPSTR a3,
+ LPDWORD a4)
+{
+ _PrintEnter("WSAAddressToStringA(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSAAddressToStringA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WSAAddressToStringA(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+INT __stdcall Mine_WSAAddressToStringW(LPSOCKADDR a0,
+ DWORD a1,
+ LPWSAPROTOCOL_INFOW a2,
+ LPWSTR a3,
+ LPDWORD a4)
+{
+ _PrintEnter("WSAAddressToStringW(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSAAddressToStringW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WSAAddressToStringW(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_WSAAsyncGetHostByAddr(HWND a0,
+ u_int a1,
+ char* a2,
+ int a3,
+ int a4,
+ char* a5,
+ int a6)
+{
+ _PrintEnter("WSAAsyncGetHostByAddr(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_WSAAsyncGetHostByAddr(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("WSAAsyncGetHostByAddr(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_WSAAsyncGetHostByName(HWND a0,
+ u_int a1,
+ char* a2,
+ char* a3,
+ int a4)
+{
+ _PrintEnter("WSAAsyncGetHostByName(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_WSAAsyncGetHostByName(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WSAAsyncGetHostByName(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_WSAAsyncGetProtoByName(HWND a0,
+ u_int a1,
+ char* a2,
+ char* a3,
+ int a4)
+{
+ _PrintEnter("WSAAsyncGetProtoByName(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_WSAAsyncGetProtoByName(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WSAAsyncGetProtoByName(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_WSAAsyncGetProtoByNumber(HWND a0,
+ u_int a1,
+ int a2,
+ char* a3,
+ int a4)
+{
+ _PrintEnter("WSAAsyncGetProtoByNumber(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_WSAAsyncGetProtoByNumber(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WSAAsyncGetProtoByNumber(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_WSAAsyncGetServByName(HWND a0,
+ u_int a1,
+ char* a2,
+ char* a3,
+ char* a4,
+ int a5)
+{
+ _PrintEnter("WSAAsyncGetServByName(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_WSAAsyncGetServByName(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("WSAAsyncGetServByName(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_WSAAsyncGetServByPort(HWND a0,
+ u_int a1,
+ int a2,
+ char* a3,
+ char* a4,
+ int a5)
+{
+ _PrintEnter("WSAAsyncGetServByPort(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_WSAAsyncGetServByPort(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("WSAAsyncGetServByPort(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_WSAAsyncSelect(SOCKET a0,
+ HWND a1,
+ u_int a2,
+ long a3)
+{
+ _PrintEnter("WSAAsyncSelect(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSAAsyncSelect(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("WSAAsyncSelect(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_WSACancelAsyncRequest(HANDLE a0)
+{
+ _PrintEnter("WSACancelAsyncRequest(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSACancelAsyncRequest(a0);
+ } __finally {
+ _PrintExit("WSACancelAsyncRequest() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_WSACancelBlockingCall(void)
+{
+ _PrintEnter("WSACancelBlockingCall()\n");
+
+ int rv = 0;
+ __try {
+ rv = Real_WSACancelBlockingCall();
+ } __finally {
+ _PrintExit("WSACancelBlockingCall() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_WSACleanup(void)
+{
+ _PrintEnter("WSACleanup()\n");
+
+ int rv = 0;
+ __try {
+ rv = Real_WSACleanup();
+ } __finally {
+ _PrintExit("WSACleanup() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WSACloseEvent(HANDLE a0)
+{
+ _PrintEnter("WSACloseEvent(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WSACloseEvent(a0);
+ } __finally {
+ _PrintExit("WSACloseEvent() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_WSAConnect(SOCKET a0,
+ sockaddr* a1,
+ int a2,
+ LPWSABUF a3,
+ LPWSABUF a4,
+ LPQOS a5,
+ LPQOS a6)
+{
+ _PrintEnter("WSAConnect(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSAConnect(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("WSAConnect(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE __stdcall Mine_WSACreateEvent(void)
+{
+ _PrintEnter("WSACreateEvent()\n");
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_WSACreateEvent();
+ } __finally {
+ _PrintExit("WSACreateEvent() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_WSADuplicateSocketA(SOCKET a0,
+ DWORD a1,
+ LPWSAPROTOCOL_INFOA a2)
+{
+ _PrintEnter("WSADuplicateSocketA(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSADuplicateSocketA(a0, a1, a2);
+ } __finally {
+ _PrintExit("WSADuplicateSocketA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_WSADuplicateSocketW(SOCKET a0,
+ DWORD a1,
+ LPWSAPROTOCOL_INFOW a2)
+{
+ _PrintEnter("WSADuplicateSocketW(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSADuplicateSocketW(a0, a1, a2);
+ } __finally {
+ _PrintExit("WSADuplicateSocketW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+INT __stdcall Mine_WSAEnumNameSpaceProvidersA(LPDWORD a0,
+ LPWSANAMESPACE_INFOA a1)
+{
+ _PrintEnter("WSAEnumNameSpaceProvidersA(%p,%p)\n", a0, a1);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSAEnumNameSpaceProvidersA(a0, a1);
+ } __finally {
+ _PrintExit("WSAEnumNameSpaceProvidersA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+INT __stdcall Mine_WSAEnumNameSpaceProvidersW(LPDWORD a0,
+ LPWSANAMESPACE_INFOW a1)
+{
+ _PrintEnter("WSAEnumNameSpaceProvidersW(%p,%p)\n", a0, a1);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSAEnumNameSpaceProvidersW(a0, a1);
+ } __finally {
+ _PrintExit("WSAEnumNameSpaceProvidersW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_WSAEnumNetworkEvents(SOCKET a0,
+ HANDLE a1,
+ LPWSANETWORKEVENTS a2)
+{
+ _PrintEnter("WSAEnumNetworkEvents(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSAEnumNetworkEvents(a0, a1, a2);
+ } __finally {
+ _PrintExit("WSAEnumNetworkEvents(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_WSAEnumProtocolsA(LPINT a0,
+ LPWSAPROTOCOL_INFOA a1,
+ LPDWORD a2)
+{
+ _PrintEnter("WSAEnumProtocolsA(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSAEnumProtocolsA(a0, a1, a2);
+ } __finally {
+ _PrintExit("WSAEnumProtocolsA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_WSAEnumProtocolsW(LPINT a0,
+ LPWSAPROTOCOL_INFOW a1,
+ LPDWORD a2)
+{
+ _PrintEnter("WSAEnumProtocolsW(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSAEnumProtocolsW(a0, a1, a2);
+ } __finally {
+ _PrintExit("WSAEnumProtocolsW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_WSAEventSelect(SOCKET a0,
+ HANDLE a1,
+ long a2)
+{
+ _PrintEnter("WSAEventSelect(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSAEventSelect(a0, a1, a2);
+ } __finally {
+ _PrintExit("WSAEventSelect(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WSAGetOverlappedResult(SOCKET a0,
+ LPWSAOVERLAPPED a1,
+ LPDWORD a2,
+ BOOL a3,
+ LPDWORD a4)
+{
+ _PrintEnter("WSAGetOverlappedResult(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WSAGetOverlappedResult(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WSAGetOverlappedResult(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WSAGetQOSByName(SOCKET a0,
+ LPWSABUF a1,
+ LPQOS a2)
+{
+ _PrintEnter("WSAGetQOSByName(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WSAGetQOSByName(a0, a1, a2);
+ } __finally {
+ _PrintExit("WSAGetQOSByName(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+INT __stdcall Mine_WSAGetServiceClassInfoA(LPGUID a0,
+ LPGUID a1,
+ LPDWORD a2,
+ LPWSASERVICECLASSINFOA a3)
+{
+ _PrintEnter("WSAGetServiceClassInfoA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSAGetServiceClassInfoA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("WSAGetServiceClassInfoA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+INT __stdcall Mine_WSAGetServiceClassInfoW(LPGUID a0,
+ LPGUID a1,
+ LPDWORD a2,
+ LPWSASERVICECLASSINFOW a3)
+{
+ _PrintEnter("WSAGetServiceClassInfoW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSAGetServiceClassInfoW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("WSAGetServiceClassInfoW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+INT __stdcall Mine_WSAGetServiceClassNameByClassIdA(LPGUID a0,
+ LPSTR a1,
+ LPDWORD a2)
+{
+ _PrintEnter("WSAGetServiceClassNameByClassIdA(%p,%p,%p)\n", a0, a1, a2);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSAGetServiceClassNameByClassIdA(a0, a1, a2);
+ } __finally {
+ _PrintExit("WSAGetServiceClassNameByClassIdA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+INT __stdcall Mine_WSAGetServiceClassNameByClassIdW(LPGUID a0,
+ LPWSTR a1,
+ LPDWORD a2)
+{
+ _PrintEnter("WSAGetServiceClassNameByClassIdW(%p,%p,%p)\n", a0, a1, a2);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSAGetServiceClassNameByClassIdW(a0, a1, a2);
+ } __finally {
+ _PrintExit("WSAGetServiceClassNameByClassIdW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_WSAHtonl(SOCKET a0,
+ u_long a1,
+ u_long* a2)
+{
+ _PrintEnter("WSAHtonl(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSAHtonl(a0, a1, a2);
+ } __finally {
+ _PrintExit("WSAHtonl(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_WSAHtons(SOCKET a0,
+ u_short a1,
+ u_short* a2)
+{
+ _PrintEnter("WSAHtons(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSAHtons(a0, a1, a2);
+ } __finally {
+ _PrintExit("WSAHtons(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+INT __stdcall Mine_WSAInstallServiceClassA(LPWSASERVICECLASSINFOA a0)
+{
+ _PrintEnter("WSAInstallServiceClassA(%p)\n", a0);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSAInstallServiceClassA(a0);
+ } __finally {
+ _PrintExit("WSAInstallServiceClassA() -> %p\n", rv);
+ };
+ return rv;
+}
+
+INT __stdcall Mine_WSAInstallServiceClassW(LPWSASERVICECLASSINFOW a0)
+{
+ _PrintEnter("WSAInstallServiceClassW(%p)\n", a0);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSAInstallServiceClassW(a0);
+ } __finally {
+ _PrintExit("WSAInstallServiceClassW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_WSAIoctl(SOCKET a0,
+ DWORD a1,
+ LPVOID a2,
+ DWORD a3,
+ LPVOID a4,
+ DWORD a5,
+ LPDWORD a6,
+ LPWSAOVERLAPPED a7,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a8)
+{
+ _PrintEnter("WSAIoctl(%p,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSAIoctl(a0, a1, a2, a3, a4, a5, a6, a7, a8);
+ } __finally {
+ _PrintExit("WSAIoctl(,,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WSAIsBlocking(void)
+{
+ _PrintEnter("WSAIsBlocking()\n");
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WSAIsBlocking();
+ } __finally {
+ _PrintExit("WSAIsBlocking() -> %p\n", rv);
+ };
+ return rv;
+}
+
+SOCKET __stdcall Mine_WSAJoinLeaf(SOCKET a0,
+ sockaddr* a1,
+ int a2,
+ LPWSABUF a3,
+ LPWSABUF a4,
+ LPQOS a5,
+ LPQOS a6,
+ DWORD a7)
+{
+ _PrintEnter("WSAJoinLeaf(%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7);
+
+ SOCKET rv = 0;
+ __try {
+ rv = Real_WSAJoinLeaf(a0, a1, a2, a3, a4, a5, a6, a7);
+ } __finally {
+ _PrintExit("WSAJoinLeaf(,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+INT __stdcall Mine_WSALookupServiceBeginA(LPWSAQUERYSETA a0,
+ DWORD a1,
+ LPHANDLE a2)
+{
+ _PrintEnter("WSALookupServiceBeginA(%p,%p,%p)\n", a0, a1, a2);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSALookupServiceBeginA(a0, a1, a2);
+ } __finally {
+ _PrintExit("WSALookupServiceBeginA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+INT __stdcall Mine_WSALookupServiceBeginW(LPWSAQUERYSETW a0,
+ DWORD a1,
+ LPHANDLE a2)
+{
+ _PrintEnter("WSALookupServiceBeginW(%p,%p,%p)\n", a0, a1, a2);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSALookupServiceBeginW(a0, a1, a2);
+ } __finally {
+ _PrintExit("WSALookupServiceBeginW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+INT __stdcall Mine_WSALookupServiceEnd(HANDLE a0)
+{
+ _PrintEnter("WSALookupServiceEnd(%p)\n", a0);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSALookupServiceEnd(a0);
+ } __finally {
+ _PrintExit("WSALookupServiceEnd() -> %p\n", rv);
+ };
+ return rv;
+}
+
+INT __stdcall Mine_WSALookupServiceNextA(HANDLE a0,
+ DWORD a1,
+ LPDWORD a2,
+ LPWSAQUERYSETA a3)
+{
+ _PrintEnter("WSALookupServiceNextA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSALookupServiceNextA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("WSALookupServiceNextA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+INT __stdcall Mine_WSALookupServiceNextW(HANDLE a0,
+ DWORD a1,
+ LPDWORD a2,
+ LPWSAQUERYSETW a3)
+{
+ _PrintEnter("WSALookupServiceNextW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSALookupServiceNextW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("WSALookupServiceNextW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_WSANtohl(SOCKET a0,
+ u_long a1,
+ u_long* a2)
+{
+ _PrintEnter("WSANtohl(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSANtohl(a0, a1, a2);
+ } __finally {
+ _PrintExit("WSANtohl(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_WSANtohs(SOCKET a0,
+ u_short a1,
+ u_short* a2)
+{
+ _PrintEnter("WSANtohs(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSANtohs(a0, a1, a2);
+ } __finally {
+ _PrintExit("WSANtohs(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+INT __stdcall Mine_WSAProviderConfigChange(LPHANDLE a0,
+ LPWSAOVERLAPPED a1,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a2)
+{
+ _PrintEnter("WSAProviderConfigChange(%p,%p,%p)\n", a0, a1, a2);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSAProviderConfigChange(a0, a1, a2);
+ } __finally {
+ _PrintExit("WSAProviderConfigChange(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_WSARecv(SOCKET a0,
+ LPWSABUF a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPWSAOVERLAPPED a5,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a6)
+{
+ _PrintEnter("WSARecv(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSARecv(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("WSARecv(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_WSARecvDisconnect(SOCKET a0,
+ LPWSABUF a1)
+{
+ _PrintEnter("WSARecvDisconnect(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSARecvDisconnect(a0, a1);
+ } __finally {
+ _PrintExit("WSARecvDisconnect(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_WSARecvFrom(SOCKET a0,
+ LPWSABUF a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ sockaddr* a5,
+ LPINT a6,
+ LPWSAOVERLAPPED a7,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a8)
+{
+ _PrintEnter("WSARecvFrom(%p,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSARecvFrom(a0, a1, a2, a3, a4, a5, a6, a7, a8);
+ } __finally {
+ _PrintExit("WSARecvFrom(,,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+INT __stdcall Mine_WSARemoveServiceClass(LPGUID a0)
+{
+ _PrintEnter("WSARemoveServiceClass(%p)\n", a0);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSARemoveServiceClass(a0);
+ } __finally {
+ _PrintExit("WSARemoveServiceClass() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WSAResetEvent(HANDLE a0)
+{
+ _PrintEnter("WSAResetEvent(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WSAResetEvent(a0);
+ } __finally {
+ _PrintExit("WSAResetEvent() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_WSASend(SOCKET a0,
+ LPWSABUF a1,
+ DWORD a2,
+ LPDWORD a3,
+ DWORD a4,
+ LPWSAOVERLAPPED a5,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a6)
+{
+ _PrintEnter("WSASend(%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSASend(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("WSASend(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_WSASendDisconnect(SOCKET a0,
+ LPWSABUF a1)
+{
+ _PrintEnter("WSASendDisconnect(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSASendDisconnect(a0, a1);
+ } __finally {
+ _PrintExit("WSASendDisconnect(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_WSASendTo(SOCKET a0,
+ LPWSABUF a1,
+ DWORD a2,
+ LPDWORD a3,
+ DWORD a4,
+ sockaddr* a5,
+ int a6,
+ LPWSAOVERLAPPED a7,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a8)
+{
+ _PrintEnter("WSASendTo(%p,%p,%p,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSASendTo(a0, a1, a2, a3, a4, a5, a6, a7, a8);
+ } __finally {
+ _PrintExit("WSASendTo(,,,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+FARPROC __stdcall Mine_WSASetBlockingHook(FARPROC a0)
+{
+ _PrintEnter("WSASetBlockingHook(%p)\n", a0);
+
+ FARPROC rv = 0;
+ __try {
+ rv = Real_WSASetBlockingHook(a0);
+ } __finally {
+ _PrintExit("WSASetBlockingHook() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WSASetEvent(HANDLE a0)
+{
+ _PrintEnter("WSASetEvent(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WSASetEvent(a0);
+ } __finally {
+ _PrintExit("WSASetEvent() -> %p\n", rv);
+ };
+ return rv;
+}
+
+INT __stdcall Mine_WSASetServiceA(LPWSAQUERYSETA a0,
+ WSAESETSERVICEOP a1,
+ DWORD a2)
+{
+ _PrintEnter("WSASetServiceA(%p,%p,%p)\n", a0, a1, a2);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSASetServiceA(a0, a1, a2);
+ } __finally {
+ _PrintExit("WSASetServiceA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+INT __stdcall Mine_WSASetServiceW(LPWSAQUERYSETW a0,
+ WSAESETSERVICEOP a1,
+ DWORD a2)
+{
+ _PrintEnter("WSASetServiceW(%p,%p,%p)\n", a0, a1, a2);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSASetServiceW(a0, a1, a2);
+ } __finally {
+ _PrintExit("WSASetServiceW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+SOCKET __stdcall Mine_WSASocketA(int a0,
+ int a1,
+ int a2,
+ LPWSAPROTOCOL_INFOA a3,
+ GROUP a4,
+ DWORD a5)
+{
+ _PrintEnter("WSASocketA(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ SOCKET rv = 0;
+ __try {
+ rv = Real_WSASocketA(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("WSASocketA(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+SOCKET __stdcall Mine_WSASocketW(int a0,
+ int a1,
+ int a2,
+ LPWSAPROTOCOL_INFOW a3,
+ GROUP a4,
+ DWORD a5)
+{
+ _PrintEnter("WSASocketW(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ SOCKET rv = 0;
+ __try {
+ rv = Real_WSASocketW(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("WSASocketW(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_WSAStartup(WORD a0,
+ LPWSADATA a1)
+{
+ _PrintEnter("WSAStartup(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSAStartup(a0, a1);
+ } __finally {
+ _PrintExit("WSAStartup(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+INT __stdcall Mine_WSAStringToAddressA(LPSTR a0,
+ INT a1,
+ LPWSAPROTOCOL_INFOA a2,
+ LPSOCKADDR a3,
+ LPINT a4)
+{
+ _PrintEnter("WSAStringToAddressA(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSAStringToAddressA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WSAStringToAddressA(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+INT __stdcall Mine_WSAStringToAddressW(LPWSTR a0,
+ INT a1,
+ LPWSAPROTOCOL_INFOW a2,
+ LPSOCKADDR a3,
+ LPINT a4)
+{
+ _PrintEnter("WSAStringToAddressW(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSAStringToAddressW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WSAStringToAddressW(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_WSAUnhookBlockingHook(void)
+{
+ _PrintEnter("WSAUnhookBlockingHook()\n");
+
+ int rv = 0;
+ __try {
+ rv = Real_WSAUnhookBlockingHook();
+ } __finally {
+ _PrintExit("WSAUnhookBlockingHook() -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_WSAWaitForMultipleEvents(DWORD a0,
+ void** a1,
+ BOOL a2,
+ DWORD a3,
+ BOOL a4)
+{
+ _PrintEnter("WSAWaitForMultipleEvents(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_WSAWaitForMultipleEvents(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WSAWaitForMultipleEvents(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WaitCommEvent(HANDLE a0,
+ LPDWORD a1,
+ LPOVERLAPPED a2)
+{
+ _PrintEnter("WaitCommEvent(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WaitCommEvent(a0, a1, a2);
+ } __finally {
+ _PrintExit("WaitCommEvent(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+#if !defined(DETOURS_ARM)
+BOOL __stdcall Mine_WaitForDebugEvent(LPDEBUG_EVENT a0,
+ DWORD a1)
+{
+ _PrintEnter("WaitForDebugEvent(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WaitForDebugEvent(a0, a1);
+ } __finally {
+ if (rv) {
+ _PrintExit("WaitForDebugEvent(%d,) -> %p\n", a0->dwDebugEventCode, rv);
+ }
+ else {
+ _PrintExit("WaitForDebugEvent(,) -> %p\n", rv);
+ }
+ };
+ return rv;
+}
+#endif // !DETOURS_ARM
+
+DWORD __stdcall Mine_WaitForInputIdle(HANDLE a0,
+ DWORD a1)
+{
+ _PrintEnter("WaitForInputIdle(%p,%p)\n", a0, a1);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_WaitForInputIdle(a0, a1);
+ } __finally {
+ _PrintExit("WaitForInputIdle(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_WaitForMultipleObjects(DWORD a0,
+ void** a1,
+ BOOL a2,
+ DWORD a3)
+{
+ _PrintEnter("WaitForMultipleObjects(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_WaitForMultipleObjects(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("WaitForMultipleObjects(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_WaitForMultipleObjectsEx(DWORD a0,
+ void** a1,
+ BOOL a2,
+ DWORD a3,
+ BOOL a4)
+{
+ _PrintEnter("WaitForMultipleObjectsEx(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_WaitForMultipleObjectsEx(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WaitForMultipleObjectsEx(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_WaitForSingleObject(HANDLE a0,
+ DWORD a1)
+{
+ _PrintEnter("WaitForSingleObject(%p,%p)\n", a0, a1);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_WaitForSingleObject(a0, a1);
+ } __finally {
+ _PrintExit("WaitForSingleObject(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_WaitForSingleObjectEx(HANDLE a0,
+ DWORD a1,
+ BOOL a2)
+{
+ _PrintEnter("WaitForSingleObjectEx(%p,%p,%p)\n", a0, a1, a2);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_WaitForSingleObjectEx(a0, a1, a2);
+ } __finally {
+ _PrintExit("WaitForSingleObjectEx(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WaitMessage(void)
+{
+ _PrintEnter("WaitMessage()\n");
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WaitMessage();
+ } __finally {
+ _PrintExit("WaitMessage() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WaitNamedPipeA(LPCSTR a0,
+ DWORD a1)
+{
+ _PrintEnter("WaitNamedPipeA(%hs,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WaitNamedPipeA(a0, a1);
+ } __finally {
+ _PrintExit("WaitNamedPipeA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WaitNamedPipeW(LPCWSTR a0,
+ DWORD a1)
+{
+ _PrintEnter("WaitNamedPipeW(%ls,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WaitNamedPipeW(a0, a1);
+ } __finally {
+ _PrintExit("WaitNamedPipeW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WidenPath(HDC a0)
+{
+ _PrintEnter("WidenPath(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WidenPath(a0);
+ } __finally {
+ _PrintExit("WidenPath() -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine_WinExec(LPCSTR a0,
+ UINT a1)
+{
+ _PrintEnter("WinExec(%hs,%p)\n", a0, a1);
+
+ UINT rv = 0;
+ __try {
+ rv = Real_WinExec(a0, a1);
+ } __finally {
+ _PrintExit("WinExec(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WinHelpA(HWND a0,
+ LPCSTR a1,
+ UINT a2,
+ ULONG_PTR a3)
+{
+ _PrintEnter("WinHelpA(%p,%hs,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WinHelpA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("WinHelpA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WinHelpW(HWND a0,
+ LPCWSTR a1,
+ UINT a2,
+ ULONG_PTR a3)
+{
+ _PrintEnter("WinHelpW(%p,%ls,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WinHelpW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("WinHelpW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_WindowFromDC(HDC a0)
+{
+ _PrintEnter("WindowFromDC(%p)\n", a0);
+
+ HWND rv = 0;
+ __try {
+ rv = Real_WindowFromDC(a0);
+ } __finally {
+ _PrintExit("WindowFromDC() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HWND __stdcall Mine_WindowFromPoint(POINT a0)
+{
+ _PrintEnter("WindowFromPoint(%p)\n", a0);
+
+ HWND rv = 0;
+ __try {
+ rv = Real_WindowFromPoint(a0);
+ } __finally {
+ _PrintExit("WindowFromPoint() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_WriteClassStg(LPSTORAGE a0,
+ CONST IID& a1)
+{
+ _PrintEnter("WriteClassStg(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_WriteClassStg(a0, a1);
+ } __finally {
+ _PrintExit("WriteClassStg(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_WriteClassStm(LPSTREAM a0,
+ CONST IID& a1)
+{
+ _PrintEnter("WriteClassStm(%p,%p)\n", a0, a1);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_WriteClassStm(a0, a1);
+ } __finally {
+ _PrintExit("WriteClassStm(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WriteConsoleA(HANDLE a0,
+ void* a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPVOID a4)
+{
+ _PrintEnter("WriteConsoleA(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WriteConsoleA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WriteConsoleA(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WriteConsoleInputA(HANDLE a0,
+ INPUT_RECORD* a1,
+ DWORD a2,
+ LPDWORD a3)
+{
+ _PrintEnter("WriteConsoleInputA(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WriteConsoleInputA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("WriteConsoleInputA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WriteConsoleInputW(HANDLE a0,
+ INPUT_RECORD* a1,
+ DWORD a2,
+ LPDWORD a3)
+{
+ _PrintEnter("WriteConsoleInputW(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WriteConsoleInputW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("WriteConsoleInputW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WriteConsoleOutputA(HANDLE a0,
+ CHAR_INFO* a1,
+ COORD a2,
+ COORD a3,
+ PSMALL_RECT a4)
+{
+ _PrintEnter("WriteConsoleOutputA(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WriteConsoleOutputA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WriteConsoleOutputA(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WriteConsoleOutputAttribute(HANDLE a0,
+ WORD* a1,
+ DWORD a2,
+ COORD a3,
+ LPDWORD a4)
+{
+ _PrintEnter("WriteConsoleOutputAttribute(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WriteConsoleOutputAttribute(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WriteConsoleOutputAttribute(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WriteConsoleOutputCharacterA(HANDLE a0,
+ LPCSTR a1,
+ DWORD a2,
+ COORD a3,
+ LPDWORD a4)
+{
+ _PrintEnter("WriteConsoleOutputCharacterA(%p,%hs,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WriteConsoleOutputCharacterA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WriteConsoleOutputCharacterA(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WriteConsoleOutputCharacterW(HANDLE a0,
+ LPCWSTR a1,
+ DWORD a2,
+ COORD a3,
+ LPDWORD a4)
+{
+ _PrintEnter("WriteConsoleOutputCharacterW(%p,%ls,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WriteConsoleOutputCharacterW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WriteConsoleOutputCharacterW(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WriteConsoleOutputW(HANDLE a0,
+ CHAR_INFO* a1,
+ COORD a2,
+ COORD a3,
+ PSMALL_RECT a4)
+{
+ _PrintEnter("WriteConsoleOutputW(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WriteConsoleOutputW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WriteConsoleOutputW(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WriteConsoleW(HANDLE a0,
+ void* a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPVOID a4)
+{
+ _PrintEnter("WriteConsoleW(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WriteConsoleW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WriteConsoleW(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WriteFile(HANDLE a0,
+ LPCVOID a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPOVERLAPPED a4)
+{
+ _PrintEnter("WriteFile(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WriteFile(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WriteFile(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WriteFileEx(HANDLE a0,
+ LPCVOID a1,
+ DWORD a2,
+ LPOVERLAPPED a3,
+ LPOVERLAPPED_COMPLETION_ROUTINE a4)
+{
+ _PrintEnter("WriteFileEx(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WriteFileEx(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WriteFileEx(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HRESULT __stdcall Mine_WriteFmtUserTypeStg(LPSTORAGE a0,
+ CLIPFORMAT a1,
+ LPOLESTR a2)
+{
+ _PrintEnter("WriteFmtUserTypeStg(%p,%p,%p)\n", a0, a1, a2);
+
+ HRESULT rv = 0;
+ __try {
+ rv = Real_WriteFmtUserTypeStg(a0, a1, a2);
+ } __finally {
+ _PrintExit("WriteFmtUserTypeStg(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WritePrivateProfileSectionA(LPCSTR a0,
+ LPCSTR a1,
+ LPCSTR a2)
+{
+ _PrintEnter("WritePrivateProfileSectionA(%hs,%hs,%hs)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WritePrivateProfileSectionA(a0, a1, a2);
+ } __finally {
+ _PrintExit("WritePrivateProfileSectionA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WritePrivateProfileSectionW(LPCWSTR a0,
+ LPCWSTR a1,
+ LPCWSTR a2)
+{
+ _PrintEnter("WritePrivateProfileSectionW(%ls,%ls,%ls)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WritePrivateProfileSectionW(a0, a1, a2);
+ } __finally {
+ _PrintExit("WritePrivateProfileSectionW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WritePrivateProfileStringA(LPCSTR a0,
+ LPCSTR a1,
+ LPCSTR a2,
+ LPCSTR a3)
+{
+ _PrintEnter("WritePrivateProfileStringA(%hs,%hs,%hs,%hs)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WritePrivateProfileStringA(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("WritePrivateProfileStringA(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WritePrivateProfileStringW(LPCWSTR a0,
+ LPCWSTR a1,
+ LPCWSTR a2,
+ LPCWSTR a3)
+{
+ _PrintEnter("WritePrivateProfileStringW(%ls,%ls,%ls,%ls)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WritePrivateProfileStringW(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("WritePrivateProfileStringW(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WritePrivateProfileStructA(LPCSTR a0,
+ LPCSTR a1,
+ LPVOID a2,
+ UINT a3,
+ LPCSTR a4)
+{
+ _PrintEnter("WritePrivateProfileStructA(%hs,%hs,%p,%p,%hs)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WritePrivateProfileStructA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WritePrivateProfileStructA(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WritePrivateProfileStructW(LPCWSTR a0,
+ LPCWSTR a1,
+ LPVOID a2,
+ UINT a3,
+ LPCWSTR a4)
+{
+ _PrintEnter("WritePrivateProfileStructW(%ls,%ls,%p,%p,%ls)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WritePrivateProfileStructW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WritePrivateProfileStructW(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WriteProcessMemory(HANDLE a0,
+ LPVOID lpBase,
+ LPVOID lpBuf,
+ DWORD_PTR nSize,
+ PDWORD_PTR a4)
+{
+ _PrintEnter("WriteProcessMemory(%p,@%p..%p,%p,%p)\n",
+ a0, lpBase,
+ (PBYTE)lpBase + ((nSize > 0) ? nSize - 1 : 0),
+ lpBuf, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WriteProcessMemory(a0, lpBase, lpBuf, nSize, a4);
+ } __finally {
+ _PrintExit("WriteProcessMemory(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WriteProfileSectionA(LPCSTR a0,
+ LPCSTR a1)
+{
+ _PrintEnter("WriteProfileSectionA(%hs,%hs)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WriteProfileSectionA(a0, a1);
+ } __finally {
+ _PrintExit("WriteProfileSectionA(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WriteProfileSectionW(LPCWSTR a0,
+ LPCWSTR a1)
+{
+ _PrintEnter("WriteProfileSectionW(%ls,%ls)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WriteProfileSectionW(a0, a1);
+ } __finally {
+ _PrintExit("WriteProfileSectionW(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WriteProfileStringA(LPCSTR a0,
+ LPCSTR a1,
+ LPCSTR a2)
+{
+ _PrintEnter("WriteProfileStringA(%hs,%hs,%hs)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WriteProfileStringA(a0, a1, a2);
+ } __finally {
+ _PrintExit("WriteProfileStringA(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL __stdcall Mine_WriteProfileStringW(LPCWSTR a0,
+ LPCWSTR a1,
+ LPCWSTR a2)
+{
+ _PrintEnter("WriteProfileStringW(%ls,%ls,%ls)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WriteProfileStringW(a0, a1, a2);
+ } __finally {
+ _PrintExit("WriteProfileStringW(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+DWORD __stdcall Mine_WriteTapemark(HANDLE a0,
+ DWORD a1,
+ DWORD a2,
+ BOOL a3)
+{
+ _PrintEnter("WriteTapemark(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_WriteTapemark(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("WriteTapemark(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine___WSAFDIsSet(SOCKET a0,
+ fd_set* a1)
+{
+ _PrintEnter("__WSAFDIsSet(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real___WSAFDIsSet(a0, a1);
+ } __finally {
+ _PrintExit("__WSAFDIsSet(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+long __stdcall Mine__hread(HFILE a0,
+ LPVOID a1,
+ long a2)
+{
+ _PrintEnter("_hread(%p,%p,%p)\n", a0, a1, a2);
+
+ long rv = 0;
+ __try {
+ rv = Real__hread(a0, a1, a2);
+ } __finally {
+ _PrintExit("_hread(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+long __stdcall Mine__hwrite(HFILE a0,
+ LPCSTR a1,
+ long a2)
+{
+ _PrintEnter("_hwrite(%p,%hs,%p)\n", a0, a1, a2);
+
+ long rv = 0;
+ __try {
+ rv = Real__hwrite(a0, a1, a2);
+ } __finally {
+ _PrintExit("_hwrite(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HFILE __stdcall Mine__lclose(HFILE a0)
+{
+ _PrintEnter("_lclose(%p)\n", a0);
+
+ HFILE rv = 0;
+ __try {
+ rv = Real__lclose(a0);
+ } __finally {
+ _PrintExit("_lclose() -> %p\n", rv);
+ };
+ return rv;
+}
+
+HFILE __stdcall Mine__lcreat(LPCSTR a0,
+ int a1)
+{
+ _PrintEnter("_lcreat(%hs,%p)\n", a0, a1);
+
+ HFILE rv = 0;
+ __try {
+ rv = Real__lcreat(a0, a1);
+ } __finally {
+ _PrintExit("_lcreat(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LONG __stdcall Mine__llseek(HFILE a0,
+ LONG a1,
+ int a2)
+{
+ _PrintEnter("_llseek(%p,%p,%p)\n", a0, a1, a2);
+
+ LONG rv = 0;
+ __try {
+ rv = Real__llseek(a0, a1, a2);
+ } __finally {
+ _PrintExit("_llseek(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HFILE __stdcall Mine__lopen(LPCSTR a0,
+ int a1)
+{
+ _PrintEnter("_lopen(%hs,%p)\n", a0, a1);
+
+ HFILE rv = 0;
+ __try {
+ rv = Real__lopen(a0, a1);
+ } __finally {
+ _PrintExit("_lopen(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine__lread(HFILE a0,
+ LPVOID a1,
+ UINT a2)
+{
+ _PrintEnter("_lread(%p,%p,%p)\n", a0, a1, a2);
+
+ UINT rv = 0;
+ __try {
+ rv = Real__lread(a0, a1, a2);
+ } __finally {
+ _PrintExit("_lread(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+UINT __stdcall Mine__lwrite(HFILE a0,
+ LPCSTR a1,
+ UINT a2)
+{
+ _PrintEnter("_lwrite(%p,%hs,%p)\n", a0, a1, a2);
+
+ UINT rv = 0;
+ __try {
+ rv = Real__lwrite(a0, a1, a2);
+ } __finally {
+ _PrintExit("_lwrite(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+SOCKET __stdcall Mine_accept(SOCKET a0,
+ sockaddr* a1,
+ int* a2)
+{
+ _PrintEnter("accept(%p,%p,%p)\n", a0, a1, a2);
+
+ SOCKET rv = 0;
+ __try {
+ rv = Real_accept(a0, a1, a2);
+ } __finally {
+ _PrintExit("accept(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_bind(SOCKET a0,
+ sockaddr* a1,
+ int a2)
+{
+ _PrintEnter("bind(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_bind(a0, a1, a2);
+ } __finally {
+ _PrintExit("bind(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_closesocket(SOCKET a0)
+{
+ _PrintEnter("closesocket(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_closesocket(a0);
+ } __finally {
+ _PrintExit("closesocket() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_connect(SOCKET a0,
+ sockaddr* a1,
+ int a2)
+{
+ _PrintEnter("connect(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_connect(a0, a1, a2);
+ } __finally {
+ _PrintExit("connect(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+hostent* __stdcall Mine_gethostbyaddr(char* a0,
+ int a1,
+ int a2)
+{
+ _PrintEnter("gethostbyaddr(%p,%p,%p)\n", a0, a1, a2);
+
+ hostent* rv = 0;
+ __try {
+ rv = Real_gethostbyaddr(a0, a1, a2);
+ } __finally {
+ _PrintExit("gethostbyaddr(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+hostent* __stdcall Mine_gethostbyname(char* a0)
+{
+ _PrintEnter("gethostbyname(%p)\n", a0);
+
+ hostent* rv = 0;
+ __try {
+ rv = Real_gethostbyname(a0);
+ } __finally {
+ _PrintExit("gethostbyname() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_gethostname(char* a0,
+ int a1)
+{
+ _PrintEnter("gethostname(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_gethostname(a0, a1);
+ } __finally {
+ _PrintExit("gethostname(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_getpeername(SOCKET a0,
+ sockaddr* a1,
+ int* a2)
+{
+ _PrintEnter("getpeername(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_getpeername(a0, a1, a2);
+ } __finally {
+ _PrintExit("getpeername(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+protoent* __stdcall Mine_getprotobyname(char* a0)
+{
+ _PrintEnter("getprotobyname(%p)\n", a0);
+
+ protoent* rv = 0;
+ __try {
+ rv = Real_getprotobyname(a0);
+ } __finally {
+ _PrintExit("getprotobyname() -> %p\n", rv);
+ };
+ return rv;
+}
+
+protoent* __stdcall Mine_getprotobynumber(int a0)
+{
+ _PrintEnter("getprotobynumber(%p)\n", a0);
+
+ protoent* rv = 0;
+ __try {
+ rv = Real_getprotobynumber(a0);
+ } __finally {
+ _PrintExit("getprotobynumber() -> %p\n", rv);
+ };
+ return rv;
+}
+
+servent* __stdcall Mine_getservbyname(char* a0,
+ char* a1)
+{
+ _PrintEnter("getservbyname(%p,%p)\n", a0, a1);
+
+ servent* rv = 0;
+ __try {
+ rv = Real_getservbyname(a0, a1);
+ } __finally {
+ _PrintExit("getservbyname(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+servent* __stdcall Mine_getservbyport(int a0,
+ char* a1)
+{
+ _PrintEnter("getservbyport(%p,%p)\n", a0, a1);
+
+ servent* rv = 0;
+ __try {
+ rv = Real_getservbyport(a0, a1);
+ } __finally {
+ _PrintExit("getservbyport(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_getsockname(SOCKET a0,
+ sockaddr* a1,
+ int* a2)
+{
+ _PrintEnter("getsockname(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_getsockname(a0, a1, a2);
+ } __finally {
+ _PrintExit("getsockname(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_getsockopt(SOCKET a0,
+ int a1,
+ int a2,
+ char* a3,
+ int* a4)
+{
+ _PrintEnter("getsockopt(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ int rv = 0;
+ __try {
+ rv = Real_getsockopt(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("getsockopt(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+u_long __stdcall Mine_htonl(u_long a0)
+{
+ _PrintEnter("htonl(%p)\n", a0);
+
+ u_long rv = 0;
+ __try {
+ rv = Real_htonl(a0);
+ } __finally {
+ _PrintExit("htonl() -> %p\n", rv);
+ };
+ return rv;
+}
+
+u_short __stdcall Mine_htons(u_short a0)
+{
+ _PrintEnter("htons(%p)\n", a0);
+
+ u_short rv = 0;
+ __try {
+ rv = Real_htons(a0);
+ } __finally {
+ _PrintExit("htons() -> %p\n", rv);
+ };
+ return rv;
+}
+
+unsigned long __stdcall Mine_inet_addr(char* a0)
+{
+ _PrintEnter("inet_addr(%p)\n", a0);
+
+ unsigned long rv = 0;
+ __try {
+ rv = Real_inet_addr(a0);
+ } __finally {
+ _PrintExit("inet_addr() -> %p\n", rv);
+ };
+ return rv;
+}
+
+char* __stdcall Mine_inet_ntoa(in_addr a0)
+{
+ _PrintEnter("inet_ntoa(%p)\n", a0);
+
+ char* rv = 0;
+ __try {
+ rv = Real_inet_ntoa(a0);
+ } __finally {
+ _PrintExit("inet_ntoa() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_ioctlsocket(SOCKET a0,
+ long a1,
+ u_long* a2)
+{
+ _PrintEnter("ioctlsocket(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_ioctlsocket(a0, a1, a2);
+ } __finally {
+ _PrintExit("ioctlsocket(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+void __stdcall Mine_keybd_event(BYTE a0,
+ BYTE a1,
+ DWORD a2,
+ ULONG_PTR a3)
+{
+ _PrintEnter("keybd_event(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ __try {
+ Real_keybd_event(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("keybd_event(,,,) ->\n");
+ };
+}
+
+int __stdcall Mine_listen(SOCKET a0,
+ int a1)
+{
+ _PrintEnter("listen(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_listen(a0, a1);
+ } __finally {
+ _PrintExit("listen(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+void __stdcall Mine_mouse_event(DWORD a0,
+ DWORD a1,
+ DWORD a2,
+ DWORD a3,
+ ULONG_PTR a4)
+{
+ _PrintEnter("mouse_event(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ __try {
+ Real_mouse_event(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("mouse_event(,,,,) ->\n");
+ };
+}
+
+u_long __stdcall Mine_ntohl(u_long a0)
+{
+ _PrintEnter("ntohl(%p)\n", a0);
+
+ u_long rv = 0;
+ __try {
+ rv = Real_ntohl(a0);
+ } __finally {
+ _PrintExit("ntohl() -> %p\n", rv);
+ };
+ return rv;
+}
+
+u_short __stdcall Mine_ntohs(u_short a0)
+{
+ _PrintEnter("ntohs(%p)\n", a0);
+
+ u_short rv = 0;
+ __try {
+ rv = Real_ntohs(a0);
+ } __finally {
+ _PrintExit("ntohs() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_recv(SOCKET a0,
+ char* a1,
+ int a2,
+ int a3)
+{
+ _PrintEnter("recv(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ int rv = 0;
+ __try {
+ rv = Real_recv(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("recv(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_recvfrom(SOCKET a0,
+ char* a1,
+ int a2,
+ int a3,
+ sockaddr* a4,
+ int* a5)
+{
+ _PrintEnter("recvfrom(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ int rv = 0;
+ __try {
+ rv = Real_recvfrom(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("recvfrom(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_select(int a0,
+ fd_set* a1,
+ fd_set* a2,
+ fd_set* a3,
+ timeval* a4)
+{
+ _PrintEnter("select(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ int rv = 0;
+ __try {
+ rv = Real_select(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("select(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_send(SOCKET a0,
+ char* a1,
+ int a2,
+ int a3)
+{
+ _PrintEnter("send(%p,%p,%p,%p)\n", a0, a1, a2, a3);
+
+ int rv = 0;
+ __try {
+ rv = Real_send(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("send(,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_sendto(SOCKET a0,
+ char* a1,
+ int a2,
+ int a3,
+ sockaddr* a4,
+ int a5)
+{
+ _PrintEnter("sendto(%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ int rv = 0;
+ __try {
+ rv = Real_sendto(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("sendto(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_setsockopt(SOCKET a0,
+ int a1,
+ int a2,
+ char* a3,
+ int a4)
+{
+ _PrintEnter("setsockopt(%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ int rv = 0;
+ __try {
+ rv = Real_setsockopt(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("setsockopt(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int __stdcall Mine_shutdown(SOCKET a0,
+ int a1)
+{
+ _PrintEnter("shutdown(%p,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_shutdown(a0, a1);
+ } __finally {
+ _PrintExit("shutdown(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+SOCKET __stdcall Mine_socket(int a0,
+ int a1,
+ int a2)
+{
+ _PrintEnter("socket(%x,%x,%x)\n", a0, a1, a2);
+
+ SOCKET rv = 0;
+ __try {
+ rv = Real_socket(a0, a1, a2);
+ } __finally {
+ _PrintExit("socket(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+////////////////////////////////////////////////////////////// AttachDetours.
+//
+static PCHAR DetRealName(PCHAR psz)
+{
+ PCHAR pszBeg = psz;
+ // Move to end of name.
+ while (*psz) {
+ psz++;
+ }
+ // Move back through A-Za-z0-9 names.
+ while (psz > pszBeg &&
+ ((psz[-1] >= 'A' && psz[-1] <= 'Z') ||
+ (psz[-1] >= 'a' && psz[-1] <= 'z') ||
+ (psz[-1] >= '0' && psz[-1] <= '9'))) {
+ psz--;
+ }
+ return psz;
+}
+
+static VOID Dump(PBYTE pbBytes, LONG nBytes, PBYTE pbTarget)
+{
+ CHAR szBuffer[256];
+ PCHAR pszBuffer = szBuffer;
+
+ for (LONG n = 0; n < nBytes; n += 12) {
+ pszBuffer += StringCchPrintfA(pszBuffer, sizeof(szBuffer), " %p: ", pbBytes + n);
+ for (LONG m = n; m < n + 12; m++) {
+ if (m >= nBytes) {
+ pszBuffer += StringCchPrintfA(pszBuffer, sizeof(szBuffer), " ");
+ }
+ else {
+ pszBuffer += StringCchPrintfA(pszBuffer, sizeof(szBuffer), "%02x ", pbBytes[m]);
+ }
+ }
+ if (n == 0) {
+ pszBuffer += StringCchPrintfA(pszBuffer, sizeof(szBuffer), "[%p]", pbTarget);
+ }
+ pszBuffer += StringCchPrintfA(pszBuffer, sizeof(szBuffer), "\n");
+ }
+
+ Syelog(SYELOG_SEVERITY_INFORMATION, "%s", szBuffer);
+}
+
+static VOID Decode(PBYTE pbCode, LONG nInst)
+{
+ PBYTE pbSrc = pbCode;
+ PBYTE pbEnd;
+ PBYTE pbTarget;
+ for (LONG n = 0; n < nInst; n++) {
+ pbTarget = NULL;
+ pbEnd = (PBYTE)DetourCopyInstruction(NULL, NULL, (PVOID)pbSrc, (PVOID*)&pbTarget, NULL);
+ Dump(pbSrc, (int)(pbEnd - pbSrc), pbTarget);
+ pbSrc = pbEnd;
+
+ if (pbTarget != NULL) {
+ break;
+ }
+ }
+}
+
+VOID DetAttach(PVOID *ppvReal, PVOID pvMine, PCHAR psz)
+{
+ PVOID pvReal = NULL;
+ if (ppvReal == NULL) {
+ ppvReal = &pvReal;
+ }
+
+ LONG l = DetourAttach(ppvReal, pvMine);
+ if (l != 0) {
+ Syelog(SYELOG_SEVERITY_NOTICE,
+ "Attach failed: `%s': error %d\n", DetRealName(psz), l);
+
+ Decode((PBYTE)*ppvReal, 3);
+ }
+}
+
+VOID DetDetach(PVOID *ppvReal, PVOID pvMine, PCHAR psz)
+{
+ LONG l = DetourDetach(ppvReal, pvMine);
+ if (l != 0) {
+#if 0
+ Syelog(SYELOG_SEVERITY_NOTICE,
+ "Detach failed: `%s': error %d\n", DetRealName(psz), l);
+#else
+ (void)psz;
+#endif
+ }
+}
+
+#define ATTACH(x) DetAttach(&(PVOID&)Real_##x,Mine_##x,#x)
+#define DETACH(x) DetDetach(&(PVOID&)Real_##x,Mine_##x,#x)
+
+LONG AttachDetours(VOID)
+{
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+
+ // For this many APIs, we'll ignore one or two can't be detoured.
+ DetourSetIgnoreTooSmall(TRUE);
+
+ ATTACH(AbortDoc);
+ ATTACH(AbortPath);
+ ATTACH(ActivateKeyboardLayout);
+ ATTACH(AddAtomA);
+ ATTACH(AddAtomW);
+ ATTACH(AddFontResourceA);
+ ATTACH(AddFontResourceW);
+ ATTACH(AdjustWindowRect);
+ ATTACH(AdjustWindowRectEx);
+ ATTACH(AllocConsole);
+ ATTACH(AngleArc);
+ ATTACH(AnimatePalette);
+ ATTACH(AnyPopup);
+ ATTACH(AppendMenuA);
+ ATTACH(AppendMenuW);
+ ATTACH(Arc);
+ ATTACH(ArcTo);
+ ATTACH(AreFileApisANSI);
+ ATTACH(ArrangeIconicWindows);
+ ATTACH(AttachThreadInput);
+ ATTACH(BackupRead);
+ ATTACH(BackupSeek);
+ ATTACH(BackupWrite);
+ ATTACH(Beep);
+ ATTACH(BeginDeferWindowPos);
+ ATTACH(BeginPaint);
+ ATTACH(BeginPath);
+ ATTACH(BeginUpdateResourceA);
+ ATTACH(BeginUpdateResourceW);
+ ATTACH(BindMoniker);
+ ATTACH(BitBlt);
+ ATTACH(BringWindowToTop);
+ ATTACH(BroadcastSystemMessageA);
+ ATTACH(BroadcastSystemMessageW);
+ ATTACH(BuildCommDCBA);
+ ATTACH(BuildCommDCBAndTimeoutsA);
+ ATTACH(BuildCommDCBAndTimeoutsW);
+ ATTACH(BuildCommDCBW);
+ ATTACH(CLSIDFromProgID);
+ ATTACH(CLSIDFromString);
+ ATTACH(CallMsgFilterA);
+ ATTACH(CallMsgFilterW);
+ ATTACH(CallNamedPipeA);
+ ATTACH(CallNamedPipeW);
+ ATTACH(CallNextHookEx);
+ ATTACH(CallWindowProcA);
+ ATTACH(CallWindowProcW);
+ ATTACH(CancelDC);
+ ATTACH(CancelIo);
+ ATTACH(CancelWaitableTimer);
+ ATTACH(CascadeWindows);
+ ATTACH(ChangeClipboardChain);
+ ATTACH(ChangeDisplaySettingsA);
+ ATTACH(ChangeDisplaySettingsExA);
+ ATTACH(ChangeDisplaySettingsExW);
+ ATTACH(ChangeDisplaySettingsW);
+ ATTACH(ChangeMenuA);
+ ATTACH(ChangeMenuW);
+ ATTACH(CharLowerA);
+ ATTACH(CharLowerBuffA);
+ ATTACH(CharLowerBuffW);
+ ATTACH(CharLowerW);
+ ATTACH(CharNextA);
+ ATTACH(CharNextExA);
+ ATTACH(CharNextW);
+ ATTACH(CharPrevA);
+ ATTACH(CharPrevExA);
+ ATTACH(CharPrevW);
+ ATTACH(CharToOemA);
+ ATTACH(CharToOemBuffA);
+ ATTACH(CharToOemBuffW);
+ ATTACH(CharToOemW);
+ ATTACH(CharUpperA);
+ ATTACH(CharUpperBuffA);
+ ATTACH(CharUpperBuffW);
+ ATTACH(CharUpperW);
+ ATTACH(CheckColorsInGamut);
+ ATTACH(CheckDlgButton);
+ ATTACH(CheckMenuItem);
+ ATTACH(CheckMenuRadioItem);
+ ATTACH(CheckRadioButton);
+ ATTACH(ChildWindowFromPoint);
+ ATTACH(ChildWindowFromPointEx);
+ ATTACH(ChoosePixelFormat);
+ ATTACH(Chord);
+ ATTACH(ClearCommBreak);
+ ATTACH(ClearCommError);
+ ATTACH(ClientToScreen);
+ ATTACH(ClipCursor);
+ ATTACH(CloseClipboard);
+ ATTACH(CloseDesktop);
+ ATTACH(CloseEnhMetaFile);
+ ATTACH(CloseFigure);
+ ATTACH(CloseHandle);
+ ATTACH(CloseMetaFile);
+ ATTACH(CloseWindow);
+ ATTACH(CloseWindowStation);
+ ATTACH(CoAddRefServerProcess);
+ ATTACH(CoBuildVersion);
+ ATTACH(CoCopyProxy);
+ ATTACH(CoCreateFreeThreadedMarshaler);
+ ATTACH(CoCreateGuid);
+ ATTACH(CoCreateInstance);
+ ATTACH(CoCreateInstanceEx);
+ ATTACH(CoDisconnectObject);
+ ATTACH(CoDosDateTimeToFileTime);
+ ATTACH(CoFileTimeNow);
+ ATTACH(CoFileTimeToDosDateTime);
+ ATTACH(CoFreeAllLibraries);
+ ATTACH(CoFreeLibrary);
+ ATTACH(CoFreeUnusedLibraries);
+ ATTACH(CoGetCallContext);
+ ATTACH(CoGetClassObject);
+ ATTACH(CoGetCurrentProcess);
+ ATTACH(CoGetInstanceFromFile);
+ ATTACH(CoGetInstanceFromIStorage);
+ ATTACH(CoGetInterfaceAndReleaseStream);
+ ATTACH(CoGetMalloc);
+ ATTACH(CoGetMarshalSizeMax);
+ ATTACH(CoGetObject);
+ ATTACH(CoGetPSClsid);
+ ATTACH(CoGetStandardMarshal);
+ ATTACH(CoGetStdMarshalEx);
+ ATTACH(CoGetTreatAsClass);
+ ATTACH(CoImpersonateClient);
+ ATTACH(CoInitialize);
+ ATTACH(CoInitializeEx);
+ ATTACH(CoInitializeSecurity);
+ ATTACH(CoIsHandlerConnected);
+ ATTACH(CoIsOle1Class);
+ ATTACH(CoLoadLibrary);
+ ATTACH(CoLockObjectExternal);
+ ATTACH(CoMarshalHresult);
+ ATTACH(CoMarshalInterThreadInterfaceInStream);
+ ATTACH(CoMarshalInterface);
+ ATTACH(CoQueryAuthenticationServices);
+ ATTACH(CoQueryClientBlanket);
+ ATTACH(CoQueryProxyBlanket);
+ ATTACH(CoRegisterChannelHook);
+ ATTACH(CoRegisterClassObject);
+ ATTACH(CoRegisterMallocSpy);
+ ATTACH(CoRegisterMessageFilter);
+ ATTACH(CoRegisterPSClsid);
+ ATTACH(CoRegisterSurrogate);
+ ATTACH(CoReleaseMarshalData);
+ ATTACH(CoReleaseServerProcess);
+ ATTACH(CoResumeClassObjects);
+ ATTACH(CoRevertToSelf);
+ ATTACH(CoRevokeClassObject);
+ ATTACH(CoRevokeMallocSpy);
+ ATTACH(CoSetProxyBlanket);
+ ATTACH(CoSuspendClassObjects);
+ ATTACH(CoSwitchCallContext);
+ ATTACH(CoTaskMemAlloc);
+ ATTACH(CoTaskMemFree);
+ ATTACH(CoTaskMemRealloc);
+ ATTACH(CoTreatAsClass);
+ ATTACH(CoUninitialize);
+ ATTACH(CoUnmarshalHresult);
+ ATTACH(CoUnmarshalInterface);
+ ATTACH(ColorMatchToTarget);
+ ATTACH(CombineRgn);
+ ATTACH(CombineTransform);
+ ATTACH(CommConfigDialogA);
+ ATTACH(CommConfigDialogW);
+ ATTACH(CompareFileTime);
+ ATTACH(CompareStringA);
+ ATTACH(CompareStringW);
+ ATTACH(ConnectNamedPipe);
+#if !defined(DETOURS_ARM)
+ ATTACH(ContinueDebugEvent);
+#endif // !DETOURS_ARM
+ ATTACH(ConvertDefaultLocale);
+ ATTACH(ConvertThreadToFiber);
+ ATTACH(CopyAcceleratorTableA);
+ ATTACH(CopyAcceleratorTableW);
+ ATTACH(CopyEnhMetaFileA);
+ ATTACH(CopyEnhMetaFileW);
+ ATTACH(CopyFileA);
+ ATTACH(CopyFileExA);
+ ATTACH(CopyFileExW);
+ ATTACH(CopyFileW);
+ ATTACH(CopyIcon);
+ ATTACH(CopyImage);
+ ATTACH(CopyMetaFileA);
+ ATTACH(CopyMetaFileW);
+ ATTACH(CopyRect);
+ ATTACH(CountClipboardFormats);
+ ATTACH(CreateAcceleratorTableA);
+ ATTACH(CreateAcceleratorTableW);
+ ATTACH(CreateAntiMoniker);
+ ATTACH(CreateBindCtx);
+ ATTACH(CreateBitmap);
+ ATTACH(CreateBitmapIndirect);
+ ATTACH(CreateBrushIndirect);
+ ATTACH(CreateCaret);
+ ATTACH(CreateClassMoniker);
+ ATTACH(CreateColorSpaceA);
+ ATTACH(CreateColorSpaceW);
+ ATTACH(CreateCompatibleBitmap);
+ ATTACH(CreateCompatibleDC);
+ ATTACH(CreateConsoleScreenBuffer);
+ ATTACH(CreateCursor);
+ ATTACH(CreateDCA);
+ ATTACH(CreateDCW);
+ ATTACH(CreateDIBPatternBrush);
+ ATTACH(CreateDIBPatternBrushPt);
+ ATTACH(CreateDIBSection);
+ ATTACH(CreateDIBitmap);
+ ATTACH(CreateDataAdviseHolder);
+ ATTACH(CreateDataCache);
+ ATTACH(CreateDesktopA);
+ ATTACH(CreateDesktopW);
+ ATTACH(CreateDialogIndirectParamA);
+ ATTACH(CreateDialogIndirectParamW);
+ ATTACH(CreateDialogParamA);
+ ATTACH(CreateDialogParamW);
+ ATTACH(CreateDirectoryA);
+ ATTACH(CreateDirectoryExA);
+ ATTACH(CreateDirectoryExW);
+ ATTACH(CreateDirectoryW);
+ ATTACH(CreateDiscardableBitmap);
+ ATTACH(CreateEllipticRgn);
+ ATTACH(CreateEllipticRgnIndirect);
+ ATTACH(CreateEnhMetaFileA);
+ ATTACH(CreateEnhMetaFileW);
+ ATTACH(CreateEventA);
+ ATTACH(CreateEventW);
+ ATTACH(CreateFiber);
+ ATTACH(CreateFileA);
+ ATTACH(CreateFileMappingA);
+ ATTACH(CreateFileMappingW);
+ ATTACH(CreateFileMoniker);
+ ATTACH(CreateFileW);
+ ATTACH(CreateFontA);
+ ATTACH(CreateFontIndirectA);
+ ATTACH(CreateFontIndirectW);
+ ATTACH(CreateFontW);
+ ATTACH(CreateGenericComposite);
+ ATTACH(CreateHalftonePalette);
+ ATTACH(CreateHatchBrush);
+ ATTACH(CreateICA);
+ ATTACH(CreateICW);
+ ATTACH(CreateILockBytesOnHGlobal);
+ ATTACH(CreateIcon);
+ ATTACH(CreateIconFromResource);
+ ATTACH(CreateIconFromResourceEx);
+ ATTACH(CreateIconIndirect);
+ ATTACH(CreateIoCompletionPort);
+ ATTACH(CreateItemMoniker);
+ ATTACH(CreateMDIWindowA);
+ ATTACH(CreateMDIWindowW);
+ ATTACH(CreateMailslotA);
+ ATTACH(CreateMailslotW);
+ ATTACH(CreateMenu);
+ ATTACH(CreateMetaFileA);
+ ATTACH(CreateMetaFileW);
+ ATTACH(CreateMutexA);
+ ATTACH(CreateMutexW);
+ ATTACH(CreateNamedPipeA);
+ ATTACH(CreateNamedPipeW);
+ ATTACH(CreateOleAdviseHolder);
+ ATTACH(CreatePalette);
+ ATTACH(CreatePatternBrush);
+ ATTACH(CreatePen);
+ ATTACH(CreatePenIndirect);
+ ATTACH(CreatePipe);
+ ATTACH(CreatePointerMoniker);
+ ATTACH(CreatePolyPolygonRgn);
+ ATTACH(CreatePolygonRgn);
+ ATTACH(CreatePopupMenu);
+ ATTACH(CreateProcessA);
+ ATTACH(CreateProcessW);
+ ATTACH(CreateProcessAsUserA);
+ ATTACH(CreateProcessAsUserW);
+#if(_WIN32_WINNT >= 0x0500)
+ ATTACH(CreateProcessWithLogonW);
+ ATTACH(CreateProcessWithTokenW);
+#endif //(_WIN32_WINNT >= 0x0500)
+ ATTACH(CreateRectRgn);
+ ATTACH(CreateRectRgnIndirect);
+ ATTACH(CreateRemoteThread);
+ ATTACH(CreateRoundRectRgn);
+ ATTACH(CreateScalableFontResourceA);
+ ATTACH(CreateScalableFontResourceW);
+ ATTACH(CreateSemaphoreA);
+ ATTACH(CreateSemaphoreW);
+ ATTACH(CreateSolidBrush);
+ ATTACH(CreateStdProgressIndicator);
+ ATTACH(CreateStreamOnHGlobal);
+ ATTACH(CreateTapePartition);
+ ATTACH(CreateThread);
+ ATTACH(CreateWaitableTimerA);
+ ATTACH(CreateWaitableTimerW);
+ ATTACH(CreateWindowExA);
+ ATTACH(CreateWindowExW);
+ ATTACH(CreateWindowStationA);
+ ATTACH(CreateWindowStationW);
+ ATTACH(DPtoLP);
+ ATTACH(DdeAbandonTransaction);
+ ATTACH(DdeAccessData);
+ ATTACH(DdeAddData);
+ ATTACH(DdeClientTransaction);
+ ATTACH(DdeCmpStringHandles);
+ ATTACH(DdeConnect);
+ ATTACH(DdeConnectList);
+ ATTACH(DdeCreateDataHandle);
+ ATTACH(DdeCreateStringHandleA);
+ ATTACH(DdeCreateStringHandleW);
+ ATTACH(DdeDisconnect);
+ ATTACH(DdeDisconnectList);
+ ATTACH(DdeEnableCallback);
+ ATTACH(DdeFreeDataHandle);
+ ATTACH(DdeFreeStringHandle);
+ ATTACH(DdeGetData);
+ ATTACH(DdeGetLastError);
+ ATTACH(DdeImpersonateClient);
+ ATTACH(DdeKeepStringHandle);
+ ATTACH(DdeNameService);
+ ATTACH(DdePostAdvise);
+ ATTACH(DdeQueryConvInfo);
+ ATTACH(DdeQueryNextServer);
+ ATTACH(DdeQueryStringA);
+ ATTACH(DdeQueryStringW);
+ ATTACH(DdeReconnect);
+ ATTACH(DdeSetQualityOfService);
+ ATTACH(DdeSetUserHandle);
+ ATTACH(DdeUnaccessData);
+ ATTACH(DdeUninitialize);
+ ATTACH(DebugActiveProcess);
+ ATTACH(DebugActiveProcessStop);
+ ATTACH(DebugBreak);
+ ATTACH(DefDlgProcA);
+ ATTACH(DefDlgProcW);
+ ATTACH(DefFrameProcA);
+ ATTACH(DefFrameProcW);
+ ATTACH(DefMDIChildProcA);
+ ATTACH(DefMDIChildProcW);
+ ATTACH(DefWindowProcA);
+ ATTACH(DefWindowProcW);
+ ATTACH(DeferWindowPos);
+ ATTACH(DefineDosDeviceA);
+ ATTACH(DefineDosDeviceW);
+ ATTACH(DeleteAtom);
+ ATTACH(DeleteColorSpace);
+ ATTACH(DeleteDC);
+ ATTACH(DeleteEnhMetaFile);
+ ATTACH(DeleteFiber);
+ ATTACH(DeleteFileA);
+ ATTACH(DeleteFileW);
+ ATTACH(DeleteMenu);
+ ATTACH(DeleteMetaFile);
+ ATTACH(DeleteObject);
+ ATTACH(DescribePixelFormat);
+ ATTACH(DestroyAcceleratorTable);
+ ATTACH(DestroyCaret);
+ ATTACH(DestroyCursor);
+ ATTACH(DestroyIcon);
+ ATTACH(DestroyMenu);
+ ATTACH(DestroyWindow);
+ ATTACH(DeviceIoControl);
+ ATTACH(DialogBoxIndirectParamA);
+ ATTACH(DialogBoxIndirectParamW);
+ ATTACH(DialogBoxParamA);
+ ATTACH(DialogBoxParamW);
+ ATTACH(DisableThreadLibraryCalls);
+ ATTACH(DisconnectNamedPipe);
+ ATTACH(DispatchMessageA);
+ ATTACH(DispatchMessageW);
+ ATTACH(DlgDirListA);
+ ATTACH(DlgDirListComboBoxA);
+ ATTACH(DlgDirListComboBoxW);
+ ATTACH(DlgDirListW);
+ ATTACH(DlgDirSelectComboBoxExA);
+ ATTACH(DlgDirSelectComboBoxExW);
+ ATTACH(DlgDirSelectExA);
+ ATTACH(DlgDirSelectExW);
+ ATTACH(DoDragDrop);
+ ATTACH(DosDateTimeToFileTime);
+ ATTACH(DragDetect);
+ ATTACH(DragObject);
+ ATTACH(DrawAnimatedRects);
+ ATTACH(DrawCaption);
+ ATTACH(DrawEdge);
+ ATTACH(DrawEscape);
+ ATTACH(DrawFocusRect);
+ ATTACH(DrawFrameControl);
+ ATTACH(DrawIcon);
+ ATTACH(DrawIconEx);
+ ATTACH(DrawMenuBar);
+ ATTACH(DrawStateA);
+ ATTACH(DrawStateW);
+ ATTACH(DrawTextA);
+ ATTACH(DrawTextExA);
+ ATTACH(DrawTextExW);
+ ATTACH(DrawTextW);
+ ATTACH(DuplicateHandle);
+ ATTACH(Ellipse);
+ ATTACH(EmptyClipboard);
+ ATTACH(EnableMenuItem);
+ ATTACH(EnableScrollBar);
+ ATTACH(EnableWindow);
+ ATTACH(EndDeferWindowPos);
+ ATTACH(EndDialog);
+ ATTACH(EndDoc);
+ ATTACH(EndPage);
+ ATTACH(EndPaint);
+ ATTACH(EndPath);
+ ATTACH(EndUpdateResourceA);
+ ATTACH(EndUpdateResourceW);
+ ATTACH(EnumCalendarInfoA);
+ ATTACH(EnumCalendarInfoW);
+ ATTACH(EnumChildWindows);
+ ATTACH(EnumClipboardFormats);
+ ATTACH(EnumDateFormatsA);
+ ATTACH(EnumDateFormatsW);
+ ATTACH(EnumDesktopWindows);
+ ATTACH(EnumDesktopsA);
+ ATTACH(EnumDesktopsW);
+ ATTACH(EnumDisplaySettingsA);
+ ATTACH(EnumDisplaySettingsW);
+ ATTACH(EnumEnhMetaFile);
+ ATTACH(EnumFontFamiliesA);
+ ATTACH(EnumFontFamiliesExA);
+ ATTACH(EnumFontFamiliesExW);
+ ATTACH(EnumFontFamiliesW);
+ ATTACH(EnumFontsA);
+ ATTACH(EnumFontsW);
+ ATTACH(EnumICMProfilesA);
+ ATTACH(EnumICMProfilesW);
+ ATTACH(EnumMetaFile);
+ ATTACH(EnumObjects);
+ ATTACH(EnumPropsA);
+ ATTACH(EnumPropsExA);
+ ATTACH(EnumPropsExW);
+ ATTACH(EnumPropsW);
+ ATTACH(EnumResourceLanguagesA);
+ ATTACH(EnumResourceLanguagesW);
+ ATTACH(EnumResourceNamesA);
+ ATTACH(EnumResourceNamesW);
+ ATTACH(EnumResourceTypesA);
+ ATTACH(EnumResourceTypesW);
+ ATTACH(EnumSystemCodePagesA);
+ ATTACH(EnumSystemCodePagesW);
+#if(WINVER >= 0x0500)
+ ATTACH(EnumSystemLocalesA);
+ ATTACH(EnumSystemLocalesW);
+#endif // (WINVER >= 0x0500)
+ ATTACH(EnumThreadWindows);
+ ATTACH(EnumTimeFormatsA);
+ ATTACH(EnumTimeFormatsW);
+ ATTACH(EnumWindowStationsA);
+ ATTACH(EnumWindowStationsW);
+ ATTACH(EnumWindows);
+ ATTACH(EqualRect);
+ ATTACH(EqualRgn);
+ ATTACH(EraseTape);
+ ATTACH(Escape);
+ ATTACH(EscapeCommFunction);
+ ATTACH(ExcludeClipRect);
+ ATTACH(ExcludeUpdateRgn);
+ ATTACH(ExitProcess);
+ ATTACH(ExitThread);
+ ATTACH(ExitWindowsEx);
+ ATTACH(ExpandEnvironmentStringsA);
+ ATTACH(ExpandEnvironmentStringsW);
+ ATTACH(ExtCreatePen);
+ ATTACH(ExtCreateRegion);
+ ATTACH(ExtEscape);
+ ATTACH(ExtFloodFill);
+ ATTACH(ExtSelectClipRgn);
+ ATTACH(ExtTextOutA);
+ ATTACH(ExtTextOutW);
+ ATTACH(FatalAppExitA);
+ ATTACH(FatalAppExitW);
+ ATTACH(FatalExit);
+ ATTACH(FileTimeToDosDateTime);
+ ATTACH(FileTimeToLocalFileTime);
+ ATTACH(FileTimeToSystemTime);
+ ATTACH(FillConsoleOutputAttribute);
+ ATTACH(FillConsoleOutputCharacterA);
+ ATTACH(FillConsoleOutputCharacterW);
+ ATTACH(FillPath);
+ ATTACH(FillRect);
+ ATTACH(FillRgn);
+ ATTACH(FindAtomA);
+ ATTACH(FindAtomW);
+ ATTACH(FindClose);
+ ATTACH(FindCloseChangeNotification);
+ ATTACH(FindFirstChangeNotificationA);
+ ATTACH(FindFirstChangeNotificationW);
+ ATTACH(FindFirstFileA);
+ ATTACH(FindFirstFileExA);
+ ATTACH(FindFirstFileExW);
+ ATTACH(FindFirstFileW);
+ ATTACH(FindNextChangeNotification);
+ ATTACH(FindNextFileA);
+ ATTACH(FindNextFileW);
+ ATTACH(FindResourceA);
+ ATTACH(FindResourceExA);
+ ATTACH(FindResourceExW);
+ ATTACH(FindResourceW);
+ ATTACH(FindWindowA);
+ ATTACH(FindWindowExA);
+ ATTACH(FindWindowExW);
+ ATTACH(FindWindowW);
+ ATTACH(FixBrushOrgEx);
+ ATTACH(FlashWindow);
+ ATTACH(FlattenPath);
+ ATTACH(FloodFill);
+ ATTACH(FlushConsoleInputBuffer);
+ ATTACH(FlushFileBuffers);
+ ATTACH(FlushViewOfFile);
+ ATTACH(FmtIdToPropStgName);
+ ATTACH(FoldStringA);
+ ATTACH(FoldStringW);
+ ATTACH(FormatMessageA);
+ ATTACH(FormatMessageW);
+ ATTACH(FrameRect);
+ ATTACH(FrameRgn);
+ ATTACH(FreeConsole);
+ ATTACH(FreeDDElParam);
+ ATTACH(FreeEnvironmentStringsA);
+ ATTACH(FreeEnvironmentStringsW);
+ ATTACH(FreeLibrary);
+ ATTACH(FreeLibraryAndExitThread);
+ ATTACH(FreePropVariantArray);
+ ATTACH(FreeResource);
+ ATTACH(GdiComment);
+ ATTACH(GdiFlush);
+ ATTACH(GdiGetBatchLimit);
+ ATTACH(GdiSetBatchLimit);
+ ATTACH(GenerateConsoleCtrlEvent);
+ ATTACH(GetACP);
+ ATTACH(GetActiveWindow);
+ ATTACH(GetArcDirection);
+ ATTACH(GetAspectRatioFilterEx);
+ ATTACH(GetAsyncKeyState);
+ ATTACH(GetAtomNameA);
+ ATTACH(GetAtomNameW);
+ ATTACH(GetBinaryTypeA);
+ ATTACH(GetBinaryTypeW);
+ ATTACH(GetBitmapBits);
+ ATTACH(GetBitmapDimensionEx);
+ ATTACH(GetBkColor);
+ ATTACH(GetBkMode);
+ ATTACH(GetBoundsRect);
+ ATTACH(GetBrushOrgEx);
+ ATTACH(GetCPInfo);
+ ATTACH(GetCapture);
+ ATTACH(GetCaretBlinkTime);
+ ATTACH(GetCaretPos);
+ ATTACH(GetCharABCWidthsA);
+ ATTACH(GetCharABCWidthsFloatA);
+ ATTACH(GetCharABCWidthsFloatW);
+ ATTACH(GetCharABCWidthsW);
+ ATTACH(GetCharWidth32A);
+ ATTACH(GetCharWidth32W);
+ ATTACH(GetCharWidthA);
+ ATTACH(GetCharWidthFloatA);
+ ATTACH(GetCharWidthFloatW);
+ ATTACH(GetCharWidthW);
+ ATTACH(GetCharacterPlacementA);
+ ATTACH(GetCharacterPlacementW);
+ ATTACH(GetClassFile);
+ ATTACH(GetClassInfoA);
+ ATTACH(GetClassInfoExA);
+ ATTACH(GetClassInfoExW);
+ ATTACH(GetClassInfoW);
+ ATTACH(GetClassLongA);
+ ATTACH(GetClassLongW);
+ ATTACH(GetClassNameA);
+ ATTACH(GetClassNameW);
+ ATTACH(GetClassWord);
+ ATTACH(GetClientRect);
+ ATTACH(GetClipBox);
+ ATTACH(GetClipCursor);
+ ATTACH(GetClipRgn);
+ ATTACH(GetClipboardData);
+ ATTACH(GetClipboardFormatNameA);
+ ATTACH(GetClipboardFormatNameW);
+ ATTACH(GetClipboardOwner);
+ ATTACH(GetClipboardViewer);
+ ATTACH(GetColorAdjustment);
+ ATTACH(GetColorSpace);
+ ATTACH(GetCommConfig);
+ ATTACH(GetCommMask);
+ ATTACH(GetCommModemStatus);
+ ATTACH(GetCommProperties);
+ ATTACH(GetCommState);
+ ATTACH(GetCommTimeouts);
+ ATTACH(GetCommandLineA);
+ ATTACH(GetCommandLineW);
+ ATTACH(GetComputerNameA);
+ ATTACH(GetComputerNameW);
+ ATTACH(GetConsoleCP);
+ ATTACH(GetConsoleCursorInfo);
+ ATTACH(GetConsoleMode);
+ ATTACH(GetConsoleOutputCP);
+ ATTACH(GetConsoleScreenBufferInfo);
+ ATTACH(GetConsoleTitleA);
+ ATTACH(GetConsoleTitleW);
+ ATTACH(GetConvertStg);
+ ATTACH(GetCurrencyFormatA);
+ ATTACH(GetCurrencyFormatW);
+ ATTACH(GetCurrentDirectoryA);
+ ATTACH(GetCurrentDirectoryW);
+ ATTACH(GetCurrentObject);
+ ATTACH(GetCurrentPositionEx);
+ ATTACH(GetCurrentProcess);
+ ATTACH(GetCurrentProcessId);
+ ATTACH(GetCurrentThreadId);
+ ATTACH(GetCursor);
+ ATTACH(GetCursorPos);
+ ATTACH(GetDC);
+ ATTACH(GetDCEx);
+ ATTACH(GetDCOrgEx);
+ ATTACH(GetDIBColorTable);
+ ATTACH(GetDIBits);
+ ATTACH(GetDateFormatA);
+ ATTACH(GetDateFormatW);
+ ATTACH(GetDefaultCommConfigA);
+ ATTACH(GetDefaultCommConfigW);
+ ATTACH(GetDesktopWindow);
+ ATTACH(GetDeviceCaps);
+ ATTACH(GetDeviceGammaRamp);
+ ATTACH(GetDialogBaseUnits);
+ ATTACH(GetDiskFreeSpaceA);
+ ATTACH(GetDiskFreeSpaceExA);
+ ATTACH(GetDiskFreeSpaceExW);
+ ATTACH(GetDiskFreeSpaceW);
+ ATTACH(GetDlgCtrlID);
+ ATTACH(GetDlgItem);
+ ATTACH(GetDlgItemInt);
+ ATTACH(GetDlgItemTextA);
+ ATTACH(GetDlgItemTextW);
+ ATTACH(GetDoubleClickTime);
+ ATTACH(GetDriveTypeA);
+ ATTACH(GetDriveTypeW);
+ ATTACH(GetEnhMetaFileA);
+ ATTACH(GetEnhMetaFileBits);
+ ATTACH(GetEnhMetaFileDescriptionA);
+ ATTACH(GetEnhMetaFileDescriptionW);
+ ATTACH(GetEnhMetaFileHeader);
+ ATTACH(GetEnhMetaFilePaletteEntries);
+ ATTACH(GetEnhMetaFilePixelFormat);
+ ATTACH(GetEnhMetaFileW);
+ ATTACH(GetEnvironmentStrings);
+ ATTACH(GetEnvironmentStringsW);
+ ATTACH(GetEnvironmentVariableA);
+ ATTACH(GetEnvironmentVariableW);
+ ATTACH(GetExitCodeProcess);
+ ATTACH(GetExitCodeThread);
+ ATTACH(GetFileAttributesA);
+ ATTACH(GetFileAttributesExA);
+ ATTACH(GetFileAttributesExW);
+ ATTACH(GetFileAttributesW);
+ ATTACH(GetFileInformationByHandle);
+ ATTACH(GetFileSize);
+ ATTACH(GetFileTime);
+ ATTACH(GetFileType);
+ ATTACH(GetFocus);
+ ATTACH(GetFontData);
+ ATTACH(GetFontLanguageInfo);
+ ATTACH(GetForegroundWindow);
+ ATTACH(GetFullPathNameA);
+ ATTACH(GetFullPathNameW);
+ ATTACH(GetGlyphOutlineA);
+ ATTACH(GetGlyphOutlineW);
+ ATTACH(GetGraphicsMode);
+ ATTACH(GetHGlobalFromILockBytes);
+ ATTACH(GetHGlobalFromStream);
+ ATTACH(GetHandleInformation);
+ ATTACH(GetICMProfileA);
+ ATTACH(GetICMProfileW);
+ ATTACH(GetIconInfo);
+ ATTACH(GetInputState);
+ ATTACH(GetKBCodePage);
+ ATTACH(GetKerningPairsA);
+ ATTACH(GetKerningPairsW);
+ ATTACH(GetKeyNameTextA);
+ ATTACH(GetKeyNameTextW);
+ ATTACH(GetKeyState);
+ ATTACH(GetKeyboardLayout);
+ ATTACH(GetKeyboardLayoutList);
+ ATTACH(GetKeyboardLayoutNameA);
+ ATTACH(GetKeyboardLayoutNameW);
+ ATTACH(GetKeyboardState);
+ ATTACH(GetKeyboardType);
+ ATTACH(GetLastActivePopup);
+ ATTACH(GetLocalTime);
+ ATTACH(GetLocaleInfoA);
+ ATTACH(GetLocaleInfoW);
+ ATTACH(GetLogColorSpaceA);
+ ATTACH(GetLogColorSpaceW);
+ ATTACH(GetLogicalDriveStringsA);
+ ATTACH(GetLogicalDriveStringsW);
+ ATTACH(GetLogicalDrives);
+ ATTACH(GetMailslotInfo);
+ ATTACH(GetMapMode);
+ ATTACH(GetMenu);
+ ATTACH(GetMenuCheckMarkDimensions);
+ ATTACH(GetMenuContextHelpId);
+ ATTACH(GetMenuDefaultItem);
+ ATTACH(GetMenuItemCount);
+ ATTACH(GetMenuItemID);
+ ATTACH(GetMenuItemInfoA);
+ ATTACH(GetMenuItemInfoW);
+ ATTACH(GetMenuItemRect);
+ ATTACH(GetMenuState);
+ ATTACH(GetMenuStringA);
+ ATTACH(GetMenuStringW);
+ ATTACH(GetMessageA);
+ ATTACH(GetMessageExtraInfo);
+ ATTACH(GetMessagePos);
+ ATTACH(GetMessageTime);
+ ATTACH(GetMessageW);
+ ATTACH(GetMetaFileA);
+ ATTACH(GetMetaFileBitsEx);
+ ATTACH(GetMetaFileW);
+ ATTACH(GetMetaRgn);
+ ATTACH(GetMiterLimit);
+ ATTACH(GetModuleFileNameA);
+ ATTACH(GetModuleFileNameW);
+ ATTACH(GetModuleHandleA);
+ ATTACH(GetModuleHandleW);
+ ATTACH(GetNamedPipeHandleStateA);
+ ATTACH(GetNamedPipeHandleStateW);
+ ATTACH(GetNamedPipeInfo);
+ ATTACH(GetNearestColor);
+ ATTACH(GetNearestPaletteIndex);
+ ATTACH(GetNextDlgGroupItem);
+ ATTACH(GetNextDlgTabItem);
+ ATTACH(GetNumberFormatA);
+ ATTACH(GetNumberFormatW);
+ ATTACH(GetNumberOfConsoleInputEvents);
+ ATTACH(GetNumberOfConsoleMouseButtons);
+ ATTACH(GetOEMCP);
+ ATTACH(GetObjectA);
+ ATTACH(GetObjectType);
+ ATTACH(GetObjectW);
+ ATTACH(GetOpenClipboardWindow);
+ ATTACH(GetOutlineTextMetricsA);
+ ATTACH(GetOutlineTextMetricsW);
+ ATTACH(GetOverlappedResult);
+ ATTACH(GetPaletteEntries);
+ ATTACH(GetParent);
+ ATTACH(GetPath);
+ ATTACH(GetPixel);
+ ATTACH(GetPixelFormat);
+ ATTACH(GetPolyFillMode);
+ ATTACH(GetPriorityClass);
+ ATTACH(GetPriorityClipboardFormat);
+ ATTACH(GetPrivateProfileIntA);
+ ATTACH(GetPrivateProfileIntW);
+ ATTACH(GetPrivateProfileSectionA);
+ ATTACH(GetPrivateProfileSectionNamesA);
+ ATTACH(GetPrivateProfileSectionNamesW);
+ ATTACH(GetPrivateProfileSectionW);
+ ATTACH(GetPrivateProfileStringA);
+ ATTACH(GetPrivateProfileStringW);
+ ATTACH(GetPrivateProfileStructA);
+ ATTACH(GetPrivateProfileStructW);
+ ATTACH(GetProcAddress);
+ ATTACH(GetProcessAffinityMask);
+ ATTACH(GetProcessHeaps);
+ ATTACH(GetProcessShutdownParameters);
+ ATTACH(GetProcessTimes);
+ ATTACH(GetProcessVersion);
+ ATTACH(GetProcessWindowStation);
+ ATTACH(GetProcessWorkingSetSize);
+ ATTACH(GetProfileIntA);
+ ATTACH(GetProfileIntW);
+ ATTACH(GetProfileSectionA);
+ ATTACH(GetProfileSectionW);
+ ATTACH(GetProfileStringA);
+ ATTACH(GetProfileStringW);
+ ATTACH(GetPropA);
+ ATTACH(GetPropW);
+ ATTACH(GetQueueStatus);
+ ATTACH(GetQueuedCompletionStatus);
+ ATTACH(GetROP2);
+ ATTACH(GetRasterizerCaps);
+ ATTACH(GetRegionData);
+ ATTACH(GetRgnBox);
+ ATTACH(GetRunningObjectTable);
+ ATTACH(GetScrollInfo);
+ ATTACH(GetScrollPos);
+ ATTACH(GetScrollRange);
+ ATTACH(GetShortPathNameA);
+ ATTACH(GetShortPathNameW);
+ ATTACH(GetStartupInfoA);
+ ATTACH(GetStartupInfoW);
+ ATTACH(GetStdHandle);
+ ATTACH(GetStockObject);
+ ATTACH(GetStretchBltMode);
+ ATTACH(GetSubMenu);
+ ATTACH(GetSysColor);
+ ATTACH(GetSysColorBrush);
+ ATTACH(GetSystemDefaultLCID);
+ ATTACH(GetSystemDefaultLangID);
+ ATTACH(GetSystemDirectoryA);
+ ATTACH(GetSystemDirectoryW);
+ ATTACH(GetSystemInfo);
+ ATTACH(GetSystemMenu);
+ ATTACH(GetSystemMetrics);
+ ATTACH(GetSystemPaletteEntries);
+ ATTACH(GetSystemPaletteUse);
+ ATTACH(GetSystemPowerStatus);
+ ATTACH(GetSystemTime);
+ ATTACH(GetSystemTimeAdjustment);
+ ATTACH(GetSystemTimeAsFileTime);
+ ATTACH(GetTabbedTextExtentA);
+ ATTACH(GetTabbedTextExtentW);
+ ATTACH(GetTapeParameters);
+ ATTACH(GetTapePosition);
+ ATTACH(GetTapeStatus);
+ ATTACH(GetTempFileNameA);
+ ATTACH(GetTempFileNameW);
+ ATTACH(GetTempPathA);
+ ATTACH(GetTempPathW);
+ ATTACH(GetTextAlign);
+ ATTACH(GetTextCharacterExtra);
+ ATTACH(GetTextCharset);
+ ATTACH(GetTextCharsetInfo);
+ ATTACH(GetTextColor);
+ ATTACH(GetTextExtentExPointA);
+ ATTACH(GetTextExtentExPointW);
+ ATTACH(GetTextExtentPoint32A);
+ ATTACH(GetTextExtentPoint32W);
+ ATTACH(GetTextExtentPointA);
+ ATTACH(GetTextExtentPointW);
+ ATTACH(GetTextFaceA);
+ ATTACH(GetTextFaceW);
+ ATTACH(GetTextMetricsA);
+ ATTACH(GetTextMetricsW);
+ ATTACH(GetThreadContext);
+ ATTACH(GetThreadDesktop);
+#if(WINVER >= 0x0500)
+ ATTACH(GetThreadLocale);
+#endif // (WINVER >= 0x0500)
+ ATTACH(GetThreadPriority);
+ ATTACH(GetThreadPriorityBoost);
+ ATTACH(GetThreadSelectorEntry);
+ ATTACH(GetThreadTimes);
+ ATTACH(GetTickCount);
+ ATTACH(GetTimeFormatA);
+ ATTACH(GetTimeFormatW);
+ ATTACH(GetTimeZoneInformation);
+ ATTACH(GetTopWindow);
+ ATTACH(GetUpdateRect);
+ ATTACH(GetUpdateRgn);
+ ATTACH(GetUserDefaultLCID);
+ ATTACH(GetUserDefaultLangID);
+ ATTACH(GetUserObjectInformationA);
+ ATTACH(GetUserObjectInformationW);
+ ATTACH(GetUserObjectSecurity);
+ ATTACH(GetVersion);
+ ATTACH(GetVersionExA);
+ ATTACH(GetVersionExW);
+ ATTACH(GetViewportExtEx);
+ ATTACH(GetViewportOrgEx);
+ ATTACH(GetVolumeInformationA);
+ ATTACH(GetVolumeInformationW);
+ ATTACH(GetWinMetaFileBits);
+ ATTACH(GetWindow);
+ ATTACH(GetWindowContextHelpId);
+ ATTACH(GetWindowDC);
+ ATTACH(GetWindowExtEx);
+ ATTACH(GetWindowLongA);
+ ATTACH(GetWindowLongW);
+ ATTACH(GetWindowOrgEx);
+ ATTACH(GetWindowPlacement);
+ ATTACH(GetWindowRect);
+ ATTACH(GetWindowRgn);
+ ATTACH(GetWindowTextA);
+ ATTACH(GetWindowTextLengthA);
+ ATTACH(GetWindowTextLengthW);
+ ATTACH(GetWindowTextW);
+ ATTACH(GetWindowThreadProcessId);
+ ATTACH(GetWindowWord);
+ ATTACH(GetWindowsDirectoryA);
+ ATTACH(GetWindowsDirectoryW);
+ ATTACH(GetWorldTransform);
+ ATTACH(GlobalAddAtomA);
+ ATTACH(GlobalAddAtomW);
+ ATTACH(GlobalAlloc);
+ ATTACH(GlobalCompact);
+ ATTACH(GlobalDeleteAtom);
+ ATTACH(GlobalFindAtomA);
+ ATTACH(GlobalFindAtomW);
+ ATTACH(GlobalFix);
+ ATTACH(GlobalFlags);
+ ATTACH(GlobalFree);
+ ATTACH(GlobalGetAtomNameA);
+ ATTACH(GlobalGetAtomNameW);
+ ATTACH(GlobalHandle);
+ ATTACH(GlobalLock);
+ ATTACH(GlobalMemoryStatus);
+ ATTACH(GlobalReAlloc);
+ ATTACH(GlobalSize);
+ ATTACH(GlobalUnWire);
+ ATTACH(GlobalUnfix);
+ ATTACH(GlobalUnlock);
+ ATTACH(GlobalWire);
+ ATTACH(GrayStringA);
+ ATTACH(GrayStringW);
+ ATTACH(HeapLock);
+ ATTACH(HeapUnlock);
+ ATTACH(HideCaret);
+ ATTACH(HiliteMenuItem);
+ ATTACH(IIDFromString);
+ ATTACH(ImpersonateDdeClientWindow);
+ ATTACH(InSendMessage);
+ ATTACH(InflateRect);
+ ATTACH(InitAtomTable);
+ ATTACH(InsertMenuA);
+ ATTACH(InsertMenuItemA);
+ ATTACH(InsertMenuItemW);
+ ATTACH(InsertMenuW);
+ ATTACH(IntersectClipRect);
+ ATTACH(IntersectRect);
+ ATTACH(InvalidateRect);
+ ATTACH(InvalidateRgn);
+ ATTACH(InvertRect);
+ ATTACH(InvertRgn);
+ ATTACH(IsAccelerator);
+ ATTACH(IsBadCodePtr);
+ ATTACH(IsBadHugeReadPtr);
+ ATTACH(IsBadHugeWritePtr);
+ ATTACH(IsBadReadPtr);
+ ATTACH(IsBadStringPtrA);
+ ATTACH(IsBadStringPtrW);
+ ATTACH(IsBadWritePtr);
+ ATTACH(IsCharAlphaA);
+ ATTACH(IsCharAlphaNumericA);
+ ATTACH(IsCharAlphaNumericW);
+ ATTACH(IsCharAlphaW);
+ ATTACH(IsCharLowerA);
+ ATTACH(IsCharLowerW);
+ ATTACH(IsCharUpperA);
+ ATTACH(IsCharUpperW);
+ ATTACH(IsChild);
+ ATTACH(IsClipboardFormatAvailable);
+ ATTACH(IsDBCSLeadByte);
+ ATTACH(IsDBCSLeadByteEx);
+ ATTACH(IsDebuggerPresent);
+ ATTACH(IsDialogMessageA);
+ ATTACH(IsDialogMessageW);
+ ATTACH(IsDlgButtonChecked);
+ ATTACH(IsIconic);
+ ATTACH(IsMenu);
+#if !defined(DETOURS_ARM)
+ ATTACH(IsProcessorFeaturePresent);
+#endif // !DETOURS_ARM
+ ATTACH(IsRectEmpty);
+ ATTACH(IsValidCodePage);
+ ATTACH(IsValidLocale);
+ ATTACH(IsWindow);
+ ATTACH(IsWindowEnabled);
+ ATTACH(IsWindowUnicode);
+ ATTACH(IsWindowVisible);
+ ATTACH(IsZoomed);
+ ATTACH(KillTimer);
+ ATTACH(LPtoDP);
+ ATTACH(LineDDA);
+ ATTACH(LineTo);
+ ATTACH(LoadAcceleratorsA);
+ ATTACH(LoadAcceleratorsW);
+ ATTACH(LoadBitmapA);
+ ATTACH(LoadBitmapW);
+ ATTACH(LoadCursorA);
+ ATTACH(LoadCursorFromFileA);
+ ATTACH(LoadCursorFromFileW);
+ ATTACH(LoadCursorW);
+ ATTACH(LoadIconA);
+ ATTACH(LoadIconW);
+ ATTACH(LoadImageA);
+ ATTACH(LoadImageW);
+ ATTACH(LoadKeyboardLayoutA);
+ ATTACH(LoadKeyboardLayoutW);
+ ATTACH(LoadLibraryA);
+ ATTACH(LoadLibraryExA);
+ ATTACH(LoadLibraryExW);
+ ATTACH(LoadLibraryW);
+ ATTACH(LoadMenuA);
+ ATTACH(LoadMenuIndirectA);
+ ATTACH(LoadMenuIndirectW);
+ ATTACH(LoadMenuW);
+ ATTACH(LoadModule);
+ ATTACH(LoadResource);
+ ATTACH(LoadStringA);
+ ATTACH(LoadStringW);
+ ATTACH(LocalAlloc);
+ ATTACH(LocalCompact);
+ ATTACH(LocalFileTimeToFileTime);
+ ATTACH(LocalFlags);
+ ATTACH(LocalFree);
+ ATTACH(LocalHandle);
+ ATTACH(LocalLock);
+ ATTACH(LocalReAlloc);
+ ATTACH(LocalShrink);
+ ATTACH(LocalSize);
+ ATTACH(LocalUnlock);
+ ATTACH(LockFile);
+ ATTACH(LockFileEx);
+ ATTACH(LockResource);
+ ATTACH(LockWindowUpdate);
+ ATTACH(LookupIconIdFromDirectory);
+ ATTACH(LookupIconIdFromDirectoryEx);
+ ATTACH(MapDialogRect);
+ ATTACH(MapViewOfFile);
+ ATTACH(MapViewOfFileEx);
+ ATTACH(MapVirtualKeyA);
+ ATTACH(MapVirtualKeyExA);
+ ATTACH(MapVirtualKeyExW);
+ ATTACH(MapVirtualKeyW);
+ ATTACH(MapWindowPoints);
+ ATTACH(MaskBlt);
+ ATTACH(MenuItemFromPoint);
+ ATTACH(MessageBeep);
+ ATTACH(MessageBoxA);
+ ATTACH(MessageBoxExA);
+ ATTACH(MessageBoxExW);
+ ATTACH(MessageBoxIndirectA);
+ ATTACH(MessageBoxIndirectW);
+ ATTACH(MessageBoxW);
+ ATTACH(MkParseDisplayName);
+ ATTACH(ModifyMenuA);
+ ATTACH(ModifyMenuW);
+ ATTACH(ModifyWorldTransform);
+ ATTACH(MonikerCommonPrefixWith);
+ ATTACH(MonikerRelativePathTo);
+ ATTACH(MoveFileA);
+ ATTACH(MoveFileExA);
+ ATTACH(MoveFileExW);
+ ATTACH(MoveFileW);
+ ATTACH(MoveToEx);
+ ATTACH(MoveWindow);
+ ATTACH(MsgWaitForMultipleObjects);
+ ATTACH(MsgWaitForMultipleObjectsEx);
+ ATTACH(MulDiv);
+ ATTACH(OemKeyScan);
+ ATTACH(OemToCharA);
+ ATTACH(OemToCharBuffA);
+ ATTACH(OemToCharBuffW);
+ ATTACH(OemToCharW);
+ ATTACH(OffsetClipRgn);
+ ATTACH(OffsetRect);
+ ATTACH(OffsetRgn);
+ ATTACH(OffsetViewportOrgEx);
+ ATTACH(OffsetWindowOrgEx);
+ ATTACH(OleBuildVersion);
+ ATTACH(OleConvertIStorageToOLESTREAM);
+ ATTACH(OleConvertIStorageToOLESTREAMEx);
+ ATTACH(OleConvertOLESTREAMToIStorage);
+ ATTACH(OleConvertOLESTREAMToIStorageEx);
+ ATTACH(OleCreate);
+ ATTACH(OleCreateDefaultHandler);
+ ATTACH(OleCreateEmbeddingHelper);
+ ATTACH(OleCreateEx);
+ ATTACH(OleCreateFromData);
+ ATTACH(OleCreateFromDataEx);
+ ATTACH(OleCreateFromFile);
+ ATTACH(OleCreateFromFileEx);
+ ATTACH(OleCreateLink);
+ ATTACH(OleCreateLinkEx);
+ ATTACH(OleCreateLinkFromData);
+ ATTACH(OleCreateLinkFromDataEx);
+ ATTACH(OleCreateLinkToFile);
+ ATTACH(OleCreateLinkToFileEx);
+ ATTACH(OleCreateMenuDescriptor);
+ ATTACH(OleCreateStaticFromData);
+ ATTACH(OleDestroyMenuDescriptor);
+ ATTACH(OleDoAutoConvert);
+ ATTACH(OleDraw);
+ ATTACH(OleDuplicateData);
+ ATTACH(OleFlushClipboard);
+ ATTACH(OleGetAutoConvert);
+ ATTACH(OleGetClipboard);
+ ATTACH(OleGetIconOfClass);
+ ATTACH(OleGetIconOfFile);
+ ATTACH(OleInitialize);
+ ATTACH(OleIsCurrentClipboard);
+ ATTACH(OleIsRunning);
+ ATTACH(OleLoad);
+ ATTACH(OleLoadFromStream);
+ ATTACH(OleLockRunning);
+ ATTACH(OleMetafilePictFromIconAndLabel);
+ ATTACH(OleNoteObjectVisible);
+ ATTACH(OleQueryCreateFromData);
+ ATTACH(OleQueryLinkFromData);
+ ATTACH(OleRegEnumFormatEtc);
+ ATTACH(OleRegEnumVerbs);
+ ATTACH(OleRegGetMiscStatus);
+ ATTACH(OleRegGetUserType);
+ ATTACH(OleRun);
+ ATTACH(OleSave);
+ ATTACH(OleSaveToStream);
+ ATTACH(OleSetAutoConvert);
+ ATTACH(OleSetClipboard);
+ ATTACH(OleSetContainedObject);
+ ATTACH(OleSetMenuDescriptor);
+ ATTACH(OleTranslateAccelerator);
+ ATTACH(OleUninitialize);
+ ATTACH(OpenClipboard);
+ ATTACH(OpenDesktopA);
+ ATTACH(OpenDesktopW);
+ ATTACH(OpenEventA);
+ ATTACH(OpenEventW);
+ ATTACH(OpenFile);
+ ATTACH(OpenFileMappingA);
+ ATTACH(OpenFileMappingW);
+ ATTACH(OpenIcon);
+ ATTACH(OpenInputDesktop);
+ ATTACH(OpenMutexA);
+ ATTACH(OpenMutexW);
+ ATTACH(OpenProcess);
+ ATTACH(OpenProcessToken);
+ ATTACH(OpenSemaphoreA);
+ ATTACH(OpenSemaphoreW);
+ ATTACH(OpenWaitableTimerA);
+ ATTACH(OpenWaitableTimerW);
+ ATTACH(OpenWindowStationA);
+ ATTACH(OpenWindowStationW);
+ ATTACH(OutputDebugStringA);
+ ATTACH(OutputDebugStringW);
+ ATTACH(PackDDElParam);
+ ATTACH(PaintDesktop);
+ ATTACH(PaintRgn);
+ ATTACH(PatBlt);
+ ATTACH(PathToRegion);
+ ATTACH(PeekConsoleInputA);
+ ATTACH(PeekConsoleInputW);
+ ATTACH(PeekMessageA);
+ ATTACH(PeekMessageW);
+ ATTACH(PeekNamedPipe);
+ ATTACH(Pie);
+ ATTACH(PlayEnhMetaFile);
+ ATTACH(PlayEnhMetaFileRecord);
+ ATTACH(PlayMetaFile);
+ ATTACH(PlayMetaFileRecord);
+ ATTACH(PlgBlt);
+ ATTACH(PolyBezier);
+ ATTACH(PolyBezierTo);
+ ATTACH(PolyDraw);
+ ATTACH(PolyPolygon);
+ ATTACH(PolyPolyline);
+ ATTACH(PolyTextOutA);
+ ATTACH(PolyTextOutW);
+ ATTACH(Polygon);
+ ATTACH(Polyline);
+ ATTACH(PolylineTo);
+ ATTACH(PostMessageA);
+ ATTACH(PostMessageW);
+ ATTACH(PostQueuedCompletionStatus);
+ ATTACH(PostQuitMessage);
+ ATTACH(PostThreadMessageA);
+ ATTACH(PostThreadMessageW);
+ ATTACH(PrepareTape);
+ ATTACH(ProgIDFromCLSID);
+ ATTACH(PropVariantClear);
+ ATTACH(PropVariantCopy);
+ ATTACH(PtInRect);
+ ATTACH(PtInRegion);
+ ATTACH(PtVisible);
+ ATTACH(PulseEvent);
+ ATTACH(PurgeComm);
+ ATTACH(QueryDosDeviceA);
+ ATTACH(QueryDosDeviceW);
+ ATTACH(QueryPerformanceCounter);
+ ATTACH(QueryPerformanceFrequency);
+ ATTACH(QueueUserAPC);
+ ATTACH(RaiseException);
+ ATTACH(ReadClassStg);
+ ATTACH(ReadClassStm);
+ ATTACH(ReadConsoleA);
+ ATTACH(ReadConsoleInputA);
+ ATTACH(ReadConsoleInputW);
+ ATTACH(ReadConsoleOutputA);
+ ATTACH(ReadConsoleOutputAttribute);
+ ATTACH(ReadConsoleOutputCharacterA);
+ ATTACH(ReadConsoleOutputCharacterW);
+ ATTACH(ReadConsoleOutputW);
+ ATTACH(ReadConsoleW);
+ ATTACH(ReadDirectoryChangesW);
+ ATTACH(ReadFile);
+ ATTACH(ReadFileEx);
+ ATTACH(ReadFmtUserTypeStg);
+ ATTACH(ReadProcessMemory);
+ ATTACH(RealizePalette);
+ ATTACH(RectInRegion);
+ ATTACH(RectVisible);
+ ATTACH(Rectangle);
+ ATTACH(RedrawWindow);
+ ATTACH(RegisterClassA);
+ ATTACH(RegisterClassExA);
+ ATTACH(RegisterClassExW);
+ ATTACH(RegisterClassW);
+ ATTACH(RegisterClipboardFormatA);
+ ATTACH(RegisterClipboardFormatW);
+ ATTACH(RegisterDragDrop);
+ ATTACH(RegisterHotKey);
+ ATTACH(RegisterWindowMessageA);
+ ATTACH(RegisterWindowMessageW);
+ ATTACH(ReleaseCapture);
+ ATTACH(ReleaseDC);
+ ATTACH(ReleaseMutex);
+ ATTACH(ReleaseSemaphore);
+ ATTACH(ReleaseStgMedium);
+ ATTACH(RemoveDirectoryA);
+ ATTACH(RemoveDirectoryW);
+ ATTACH(RemoveFontResourceA);
+ ATTACH(RemoveFontResourceW);
+ ATTACH(RemoveMenu);
+ ATTACH(RemovePropA);
+ ATTACH(RemovePropW);
+ ATTACH(ReplyMessage);
+ ATTACH(ResetDCA);
+ ATTACH(ResetDCW);
+ ATTACH(ResetEvent);
+ ATTACH(ResizePalette);
+ ATTACH(RestoreDC);
+ ATTACH(ResumeThread);
+ ATTACH(ReuseDDElParam);
+ ATTACH(RevokeDragDrop);
+ ATTACH(RoundRect);
+ ATTACH(SaveDC);
+ ATTACH(ScaleViewportExtEx);
+ ATTACH(ScaleWindowExtEx);
+ ATTACH(ScreenToClient);
+ ATTACH(ScrollConsoleScreenBufferA);
+ ATTACH(ScrollConsoleScreenBufferW);
+ ATTACH(ScrollDC);
+ ATTACH(ScrollWindow);
+ ATTACH(ScrollWindowEx);
+ ATTACH(SearchPathA);
+ ATTACH(SearchPathW);
+ ATTACH(SelectClipPath);
+ ATTACH(SelectClipRgn);
+ ATTACH(SelectObject);
+ ATTACH(SelectPalette);
+ ATTACH(SendDlgItemMessageA);
+ ATTACH(SendDlgItemMessageW);
+ ATTACH(SendMessageA);
+ ATTACH(SendMessageCallbackA);
+ ATTACH(SendMessageCallbackW);
+ ATTACH(SendMessageTimeoutA);
+ ATTACH(SendMessageTimeoutW);
+ ATTACH(SendMessageW);
+ ATTACH(SendNotifyMessageA);
+ ATTACH(SendNotifyMessageW);
+ ATTACH(SetAbortProc);
+ ATTACH(SetActiveWindow);
+ ATTACH(SetArcDirection);
+ ATTACH(SetBitmapBits);
+ ATTACH(SetBitmapDimensionEx);
+ ATTACH(SetBkColor);
+ ATTACH(SetBkMode);
+ ATTACH(SetBoundsRect);
+ ATTACH(SetBrushOrgEx);
+ ATTACH(SetCapture);
+ ATTACH(SetCaretBlinkTime);
+ ATTACH(SetCaretPos);
+ ATTACH(SetClassLongA);
+ ATTACH(SetClassLongW);
+ ATTACH(SetClassWord);
+ ATTACH(SetClipboardData);
+ ATTACH(SetClipboardViewer);
+ ATTACH(SetColorAdjustment);
+ ATTACH(SetColorSpace);
+ ATTACH(SetCommBreak);
+ ATTACH(SetCommConfig);
+ ATTACH(SetCommMask);
+ ATTACH(SetCommState);
+ ATTACH(SetCommTimeouts);
+ ATTACH(SetComputerNameA);
+ ATTACH(SetComputerNameW);
+ ATTACH(SetConsoleActiveScreenBuffer);
+ ATTACH(SetConsoleCP);
+ ATTACH(SetConsoleCtrlHandler);
+ ATTACH(SetConsoleCursorInfo);
+ ATTACH(SetConsoleCursorPosition);
+ ATTACH(SetConsoleMode);
+ ATTACH(SetConsoleOutputCP);
+ ATTACH(SetConsoleScreenBufferSize);
+ ATTACH(SetConsoleTextAttribute);
+ ATTACH(SetConsoleTitleA);
+ ATTACH(SetConsoleTitleW);
+ ATTACH(SetConsoleWindowInfo);
+ ATTACH(SetConvertStg);
+ ATTACH(SetCurrentDirectoryA);
+ ATTACH(SetCurrentDirectoryW);
+ ATTACH(SetCursor);
+ ATTACH(SetCursorPos);
+ ATTACH(SetDIBColorTable);
+ ATTACH(SetDIBits);
+ ATTACH(SetDIBitsToDevice);
+ ATTACH(SetDefaultCommConfigA);
+ ATTACH(SetDefaultCommConfigW);
+ ATTACH(SetDeviceGammaRamp);
+ ATTACH(SetDlgItemInt);
+ ATTACH(SetDlgItemTextA);
+ ATTACH(SetDlgItemTextW);
+ ATTACH(SetDoubleClickTime);
+ ATTACH(SetEndOfFile);
+ ATTACH(SetEnhMetaFileBits);
+ ATTACH(SetEnvironmentVariableA);
+ ATTACH(SetEnvironmentVariableW);
+ ATTACH(SetErrorMode);
+ ATTACH(SetEvent);
+ ATTACH(SetFileApisToANSI);
+ ATTACH(SetFileApisToOEM);
+ ATTACH(SetFileAttributesA);
+ ATTACH(SetFileAttributesW);
+ ATTACH(SetFilePointer);
+ ATTACH(SetFileTime);
+ ATTACH(SetFocus);
+ ATTACH(SetForegroundWindow);
+ ATTACH(SetGraphicsMode);
+ ATTACH(SetHandleCount);
+ ATTACH(SetHandleInformation);
+ ATTACH(SetICMMode);
+ ATTACH(SetICMProfileA);
+ ATTACH(SetICMProfileW);
+ ATTACH(SetKeyboardState);
+ ATTACH(SetLocalTime);
+ ATTACH(SetLocaleInfoA);
+ ATTACH(SetLocaleInfoW);
+ ATTACH(SetMailslotInfo);
+ ATTACH(SetMapMode);
+ ATTACH(SetMapperFlags);
+ ATTACH(SetMenu);
+ ATTACH(SetMenuContextHelpId);
+ ATTACH(SetMenuDefaultItem);
+ ATTACH(SetMenuItemBitmaps);
+ ATTACH(SetMenuItemInfoA);
+ ATTACH(SetMenuItemInfoW);
+ ATTACH(SetMessageExtraInfo);
+ ATTACH(SetMessageQueue);
+ ATTACH(SetMetaFileBitsEx);
+ ATTACH(SetMetaRgn);
+ ATTACH(SetMiterLimit);
+ ATTACH(SetNamedPipeHandleState);
+ ATTACH(SetPaletteEntries);
+ ATTACH(SetParent);
+ ATTACH(SetPixel);
+ ATTACH(SetPixelFormat);
+ ATTACH(SetPixelV);
+ ATTACH(SetPolyFillMode);
+ ATTACH(SetPriorityClass);
+ ATTACH(SetProcessAffinityMask);
+ ATTACH(SetProcessShutdownParameters);
+ ATTACH(SetProcessWindowStation);
+ ATTACH(SetProcessWorkingSetSize);
+ ATTACH(SetPropA);
+ ATTACH(SetPropW);
+ ATTACH(SetROP2);
+ ATTACH(SetRect);
+ ATTACH(SetRectEmpty);
+ ATTACH(SetRectRgn);
+ ATTACH(SetScrollInfo);
+ ATTACH(SetScrollPos);
+ ATTACH(SetScrollRange);
+ ATTACH(SetStdHandle);
+ ATTACH(SetStretchBltMode);
+ ATTACH(SetSysColors);
+ ATTACH(SetSystemCursor);
+ ATTACH(SetSystemPaletteUse);
+ ATTACH(SetSystemPowerState);
+ ATTACH(SetSystemTime);
+ ATTACH(SetSystemTimeAdjustment);
+ ATTACH(SetTapeParameters);
+ ATTACH(SetTapePosition);
+ ATTACH(SetTextAlign);
+ ATTACH(SetTextCharacterExtra);
+ ATTACH(SetTextColor);
+ ATTACH(SetTextJustification);
+ ATTACH(SetThreadAffinityMask);
+ ATTACH(SetThreadContext);
+ ATTACH(SetThreadDesktop);
+ ATTACH(SetThreadIdealProcessor);
+#if(WINVER >= 0x0500)
+ ATTACH(SetThreadLocale);
+#endif // (WINVER >= 0x0500)
+ ATTACH(SetThreadPriority);
+ ATTACH(SetThreadPriorityBoost);
+ ATTACH(SetTimeZoneInformation);
+ ATTACH(SetTimer);
+ ATTACH(SetUnhandledExceptionFilter);
+ ATTACH(SetUserObjectInformationA);
+ ATTACH(SetUserObjectInformationW);
+ ATTACH(SetUserObjectSecurity);
+ ATTACH(SetViewportExtEx);
+ ATTACH(SetViewportOrgEx);
+ ATTACH(SetVolumeLabelA);
+ ATTACH(SetVolumeLabelW);
+ ATTACH(SetWaitableTimer);
+ ATTACH(SetWinMetaFileBits);
+ ATTACH(SetWindowContextHelpId);
+ ATTACH(SetWindowExtEx);
+ ATTACH(SetWindowLongA);
+ ATTACH(SetWindowLongW);
+ ATTACH(SetWindowOrgEx);
+ ATTACH(SetWindowPlacement);
+ ATTACH(SetWindowPos);
+ ATTACH(SetWindowRgn);
+ ATTACH(SetWindowTextA);
+ ATTACH(SetWindowTextW);
+ ATTACH(SetWindowWord);
+ ATTACH(SetWindowsHookA);
+ ATTACH(SetWindowsHookExA);
+ ATTACH(SetWindowsHookExW);
+ ATTACH(SetWindowsHookW);
+ ATTACH(SetWorldTransform);
+ ATTACH(SetupComm);
+ ATTACH(ShowCaret);
+ ATTACH(ShowCursor);
+ ATTACH(ShowOwnedPopups);
+ ATTACH(ShowScrollBar);
+ ATTACH(ShowWindow);
+ ATTACH(ShowWindowAsync);
+ ATTACH(SignalObjectAndWait);
+ ATTACH(SizeofResource);
+ ATTACH(SleepEx);
+ ATTACH(StartDocA);
+ ATTACH(StartDocW);
+ ATTACH(StartPage);
+ ATTACH(StgCreateDocfile);
+ ATTACH(StgCreateDocfileOnILockBytes);
+ ATTACH(StgCreatePropSetStg);
+ ATTACH(StgCreatePropStg);
+ ATTACH(StgCreateStorageEx);
+ ATTACH(StgGetIFillLockBytesOnFile);
+ ATTACH(StgGetIFillLockBytesOnILockBytes);
+ ATTACH(StgIsStorageFile);
+ ATTACH(StgIsStorageILockBytes);
+ ATTACH(StgOpenAsyncDocfileOnIFillLockBytes);
+ ATTACH(StgOpenPropStg);
+ ATTACH(StgOpenStorage);
+ ATTACH(StgOpenStorageEx);
+ ATTACH(StgOpenStorageOnILockBytes);
+ ATTACH(StgSetTimes);
+ ATTACH(StretchBlt);
+ ATTACH(StretchDIBits);
+ ATTACH(StringFromCLSID);
+ ATTACH(StringFromGUID2);
+ ATTACH(StringFromIID);
+ ATTACH(StrokeAndFillPath);
+ ATTACH(StrokePath);
+ ATTACH(SubtractRect);
+ ATTACH(SuspendThread);
+ ATTACH(SwapBuffers);
+ ATTACH(SwapMouseButton);
+ ATTACH(SwitchDesktop);
+ ATTACH(SwitchToFiber);
+ ATTACH(SwitchToThread);
+ ATTACH(SystemParametersInfoA);
+ ATTACH(SystemParametersInfoW);
+ ATTACH(SystemTimeToFileTime);
+ ATTACH(SystemTimeToTzSpecificLocalTime);
+ ATTACH(TabbedTextOutA);
+ ATTACH(TabbedTextOutW);
+ ATTACH(TerminateProcess);
+ ATTACH(TerminateThread);
+ ATTACH(TextOutA);
+ ATTACH(TextOutW);
+ ATTACH(TileWindows);
+ ATTACH(ToAscii);
+ ATTACH(ToAsciiEx);
+ ATTACH(ToUnicode);
+ ATTACH(ToUnicodeEx);
+ ATTACH(TrackMouseEvent);
+ ATTACH(TrackPopupMenu);
+ ATTACH(TrackPopupMenuEx);
+ ATTACH(TransactNamedPipe);
+ ATTACH(TranslateAcceleratorA);
+ ATTACH(TranslateAcceleratorW);
+ ATTACH(TranslateCharsetInfo);
+ ATTACH(TranslateMDISysAccel);
+ ATTACH(TranslateMessage);
+ ATTACH(TransmitCommChar);
+#if DETOUR_TryEnterCriticalSection_EVEN_IF_IT_EXERCISES_A_BUG_IN_RtlLookupFunctionTable
+ ATTACH(TryEnterCriticalSection);
+#endif
+ ATTACH(UnhookWindowsHook);
+ ATTACH(UnhookWindowsHookEx);
+ ATTACH(UnionRect);
+ ATTACH(UnloadKeyboardLayout);
+ ATTACH(UnlockFile);
+ ATTACH(UnlockFileEx);
+ ATTACH(UnmapViewOfFile);
+ ATTACH(UnpackDDElParam);
+ ATTACH(UnrealizeObject);
+ ATTACH(UnregisterClassA);
+ ATTACH(UnregisterClassW);
+ ATTACH(UnregisterHotKey);
+ ATTACH(UpdateColors);
+ ATTACH(UpdateResourceA);
+ ATTACH(UpdateResourceW);
+ ATTACH(UpdateWindow);
+ ATTACH(ValidateRect);
+ ATTACH(ValidateRgn);
+ ATTACH(VerLanguageNameA);
+ ATTACH(VerLanguageNameW);
+ ATTACH(VirtualAllocEx);
+ ATTACH(VirtualFreeEx);
+ ATTACH(VirtualProtectEx);
+ ATTACH(VirtualQueryEx);
+ ATTACH(VkKeyScanA);
+ ATTACH(VkKeyScanExA);
+ ATTACH(VkKeyScanExW);
+ ATTACH(VkKeyScanW);
+ ATTACH(WSAAccept);
+ ATTACH(WSAAddressToStringA);
+ ATTACH(WSAAddressToStringW);
+ ATTACH(WSAAsyncGetHostByAddr);
+ ATTACH(WSAAsyncGetHostByName);
+ ATTACH(WSAAsyncGetProtoByName);
+ ATTACH(WSAAsyncGetProtoByNumber);
+ ATTACH(WSAAsyncGetServByName);
+ ATTACH(WSAAsyncGetServByPort);
+ ATTACH(WSAAsyncSelect);
+ ATTACH(WSACancelAsyncRequest);
+ ATTACH(WSACancelBlockingCall);
+ ATTACH(WSACleanup);
+ ATTACH(WSACloseEvent);
+ ATTACH(WSAConnect);
+ ATTACH(WSACreateEvent);
+ ATTACH(WSADuplicateSocketA);
+ ATTACH(WSADuplicateSocketW);
+ ATTACH(WSAEnumNameSpaceProvidersA);
+ ATTACH(WSAEnumNameSpaceProvidersW);
+ ATTACH(WSAEnumNetworkEvents);
+ ATTACH(WSAEnumProtocolsA);
+ ATTACH(WSAEnumProtocolsW);
+ ATTACH(WSAEventSelect);
+ ATTACH(WSAGetOverlappedResult);
+ ATTACH(WSAGetQOSByName);
+ ATTACH(WSAGetServiceClassInfoA);
+ ATTACH(WSAGetServiceClassInfoW);
+ ATTACH(WSAGetServiceClassNameByClassIdA);
+ ATTACH(WSAGetServiceClassNameByClassIdW);
+ ATTACH(WSAHtonl);
+ ATTACH(WSAHtons);
+ ATTACH(WSAInstallServiceClassA);
+ ATTACH(WSAInstallServiceClassW);
+ ATTACH(WSAIoctl);
+ ATTACH(WSAIsBlocking);
+ ATTACH(WSAJoinLeaf);
+ ATTACH(WSALookupServiceBeginA);
+ ATTACH(WSALookupServiceBeginW);
+ ATTACH(WSALookupServiceEnd);
+ ATTACH(WSALookupServiceNextA);
+ ATTACH(WSALookupServiceNextW);
+ ATTACH(WSANtohl);
+ ATTACH(WSANtohs);
+ ATTACH(WSAProviderConfigChange);
+ ATTACH(WSARecv);
+ ATTACH(WSARecvDisconnect);
+ ATTACH(WSARecvFrom);
+ ATTACH(WSARemoveServiceClass);
+ ATTACH(WSAResetEvent);
+ ATTACH(WSASend);
+ ATTACH(WSASendDisconnect);
+ ATTACH(WSASendTo);
+ ATTACH(WSASetBlockingHook);
+ ATTACH(WSASetEvent);
+ ATTACH(WSASetServiceA);
+ ATTACH(WSASetServiceW);
+ ATTACH(WSASocketA);
+ ATTACH(WSASocketW);
+ ATTACH(WSAStartup);
+ ATTACH(WSAStringToAddressA);
+ ATTACH(WSAStringToAddressW);
+ ATTACH(WSAUnhookBlockingHook);
+ ATTACH(WSAWaitForMultipleEvents);
+ ATTACH(WaitCommEvent);
+#if !defined(DETOURS_ARM)
+ ATTACH(WaitForDebugEvent);
+#endif // !DETOURS_ARM
+ ATTACH(WaitForInputIdle);
+ ATTACH(WaitForMultipleObjects);
+ ATTACH(WaitForMultipleObjectsEx);
+ ATTACH(WaitForSingleObject);
+ ATTACH(WaitForSingleObjectEx);
+ ATTACH(WaitMessage);
+ ATTACH(WaitNamedPipeA);
+ ATTACH(WaitNamedPipeW);
+ ATTACH(WidenPath);
+ ATTACH(WinExec);
+ ATTACH(WinHelpA);
+ ATTACH(WinHelpW);
+ ATTACH(WindowFromDC);
+ ATTACH(WindowFromPoint);
+ ATTACH(WriteClassStg);
+ ATTACH(WriteClassStm);
+ ATTACH(WriteConsoleA);
+ ATTACH(WriteConsoleInputA);
+ ATTACH(WriteConsoleInputW);
+ ATTACH(WriteConsoleOutputA);
+ ATTACH(WriteConsoleOutputAttribute);
+ ATTACH(WriteConsoleOutputCharacterA);
+ ATTACH(WriteConsoleOutputCharacterW);
+ ATTACH(WriteConsoleOutputW);
+ ATTACH(WriteConsoleW);
+ ATTACH(WriteFile);
+ ATTACH(WriteFileEx);
+ ATTACH(WriteFmtUserTypeStg);
+ ATTACH(WritePrivateProfileSectionA);
+ ATTACH(WritePrivateProfileSectionW);
+ ATTACH(WritePrivateProfileStringA);
+ ATTACH(WritePrivateProfileStringW);
+ ATTACH(WritePrivateProfileStructA);
+ ATTACH(WritePrivateProfileStructW);
+ ATTACH(WriteProcessMemory);
+ ATTACH(WriteProfileSectionA);
+ ATTACH(WriteProfileSectionW);
+ ATTACH(WriteProfileStringA);
+ ATTACH(WriteProfileStringW);
+ ATTACH(WriteTapemark);
+ ATTACH(__WSAFDIsSet);
+ ATTACH(_hread);
+ ATTACH(_hwrite);
+ ATTACH(_lclose);
+ ATTACH(_lcreat);
+ ATTACH(_llseek);
+ ATTACH(_lopen);
+ ATTACH(_lread);
+ ATTACH(_lwrite);
+ ATTACH(accept);
+ ATTACH(bind);
+ ATTACH(closesocket);
+ ATTACH(connect);
+ ATTACH(gethostbyaddr);
+ ATTACH(gethostbyname);
+ ATTACH(gethostname);
+ ATTACH(getpeername);
+ ATTACH(getprotobyname);
+ ATTACH(getprotobynumber);
+ ATTACH(getservbyname);
+ ATTACH(getservbyport);
+ ATTACH(getsockname);
+ ATTACH(getsockopt);
+ ATTACH(htonl);
+ ATTACH(htons);
+ ATTACH(inet_addr);
+ ATTACH(inet_ntoa);
+ ATTACH(ioctlsocket);
+ ATTACH(keybd_event);
+ ATTACH(listen);
+ ATTACH(mouse_event);
+ ATTACH(ntohl);
+ ATTACH(ntohs);
+ ATTACH(recv);
+ ATTACH(recvfrom);
+ ATTACH(select);
+ ATTACH(send);
+ ATTACH(sendto);
+ ATTACH(setsockopt);
+ ATTACH(shutdown);
+ ATTACH(socket);
+
+ PVOID *ppbFailedPointer = NULL;
+ LONG error = DetourTransactionCommitEx(&ppbFailedPointer);
+ if (error != 0) {
+ printf("traceapi.dll: Attach transaction failed to commit. Error %ld (%p/%p)",
+ error, ppbFailedPointer, *ppbFailedPointer);
+ return error;
+ }
+ return 0;
+}
+
+LONG DetachDetours(VOID)
+{
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+
+ // For this many APIs, we'll ignore one or two can't be detoured.
+ DetourSetIgnoreTooSmall(TRUE);
+
+ DETACH(AbortDoc);
+ DETACH(AbortPath);
+ DETACH(ActivateKeyboardLayout);
+ DETACH(AddAtomA);
+ DETACH(AddAtomW);
+ DETACH(AddFontResourceA);
+ DETACH(AddFontResourceW);
+ DETACH(AdjustWindowRect);
+ DETACH(AdjustWindowRectEx);
+ DETACH(AllocConsole);
+ DETACH(AngleArc);
+ DETACH(AnimatePalette);
+ DETACH(AnyPopup);
+ DETACH(AppendMenuA);
+ DETACH(AppendMenuW);
+ DETACH(Arc);
+ DETACH(ArcTo);
+ DETACH(AreFileApisANSI);
+ DETACH(ArrangeIconicWindows);
+ DETACH(AttachThreadInput);
+ DETACH(BackupRead);
+ DETACH(BackupSeek);
+ DETACH(BackupWrite);
+ DETACH(Beep);
+ DETACH(BeginDeferWindowPos);
+ DETACH(BeginPaint);
+ DETACH(BeginPath);
+ DETACH(BeginUpdateResourceA);
+ DETACH(BeginUpdateResourceW);
+ DETACH(BindMoniker);
+ DETACH(BitBlt);
+ DETACH(BringWindowToTop);
+ DETACH(BroadcastSystemMessageA);
+ DETACH(BroadcastSystemMessageW);
+ DETACH(BuildCommDCBA);
+ DETACH(BuildCommDCBAndTimeoutsA);
+ DETACH(BuildCommDCBAndTimeoutsW);
+ DETACH(BuildCommDCBW);
+ DETACH(CLSIDFromProgID);
+ DETACH(CLSIDFromString);
+ DETACH(CallMsgFilterA);
+ DETACH(CallMsgFilterW);
+ DETACH(CallNamedPipeA);
+ DETACH(CallNamedPipeW);
+ DETACH(CallNextHookEx);
+ DETACH(CallWindowProcA);
+ DETACH(CallWindowProcW);
+ DETACH(CancelDC);
+ DETACH(CancelIo);
+ DETACH(CancelWaitableTimer);
+ DETACH(CascadeWindows);
+ DETACH(ChangeClipboardChain);
+ DETACH(ChangeDisplaySettingsA);
+ DETACH(ChangeDisplaySettingsExA);
+ DETACH(ChangeDisplaySettingsExW);
+ DETACH(ChangeDisplaySettingsW);
+ DETACH(ChangeMenuA);
+ DETACH(ChangeMenuW);
+ DETACH(CharLowerA);
+ DETACH(CharLowerBuffA);
+ DETACH(CharLowerBuffW);
+ DETACH(CharLowerW);
+ DETACH(CharNextA);
+ DETACH(CharNextExA);
+ DETACH(CharNextW);
+ DETACH(CharPrevA);
+ DETACH(CharPrevExA);
+ DETACH(CharPrevW);
+ DETACH(CharToOemA);
+ DETACH(CharToOemBuffA);
+ DETACH(CharToOemBuffW);
+ DETACH(CharToOemW);
+ DETACH(CharUpperA);
+ DETACH(CharUpperBuffA);
+ DETACH(CharUpperBuffW);
+ DETACH(CharUpperW);
+ DETACH(CheckColorsInGamut);
+ DETACH(CheckDlgButton);
+ DETACH(CheckMenuItem);
+ DETACH(CheckMenuRadioItem);
+ DETACH(CheckRadioButton);
+ DETACH(ChildWindowFromPoint);
+ DETACH(ChildWindowFromPointEx);
+ DETACH(ChoosePixelFormat);
+ DETACH(Chord);
+ DETACH(ClearCommBreak);
+ DETACH(ClearCommError);
+ DETACH(ClientToScreen);
+ DETACH(ClipCursor);
+ DETACH(CloseClipboard);
+ DETACH(CloseDesktop);
+ DETACH(CloseEnhMetaFile);
+ DETACH(CloseFigure);
+ DETACH(CloseHandle);
+ DETACH(CloseMetaFile);
+ DETACH(CloseWindow);
+ DETACH(CloseWindowStation);
+ DETACH(CoAddRefServerProcess);
+ DETACH(CoBuildVersion);
+ DETACH(CoCopyProxy);
+ DETACH(CoCreateFreeThreadedMarshaler);
+ DETACH(CoCreateGuid);
+ DETACH(CoCreateInstance);
+ DETACH(CoCreateInstanceEx);
+ DETACH(CoDisconnectObject);
+ DETACH(CoDosDateTimeToFileTime);
+ DETACH(CoFileTimeNow);
+ DETACH(CoFileTimeToDosDateTime);
+ DETACH(CoFreeAllLibraries);
+ DETACH(CoFreeLibrary);
+ DETACH(CoFreeUnusedLibraries);
+ DETACH(CoGetCallContext);
+ DETACH(CoGetClassObject);
+ DETACH(CoGetCurrentProcess);
+ DETACH(CoGetInstanceFromFile);
+ DETACH(CoGetInstanceFromIStorage);
+ DETACH(CoGetInterfaceAndReleaseStream);
+ DETACH(CoGetMalloc);
+ DETACH(CoGetMarshalSizeMax);
+ DETACH(CoGetObject);
+ DETACH(CoGetPSClsid);
+ DETACH(CoGetStandardMarshal);
+ DETACH(CoGetStdMarshalEx);
+ DETACH(CoGetTreatAsClass);
+ DETACH(CoImpersonateClient);
+ DETACH(CoInitialize);
+ DETACH(CoInitializeEx);
+ DETACH(CoInitializeSecurity);
+ DETACH(CoIsHandlerConnected);
+ DETACH(CoIsOle1Class);
+ DETACH(CoLoadLibrary);
+ DETACH(CoLockObjectExternal);
+ DETACH(CoMarshalHresult);
+ DETACH(CoMarshalInterThreadInterfaceInStream);
+ DETACH(CoMarshalInterface);
+ DETACH(CoQueryAuthenticationServices);
+ DETACH(CoQueryClientBlanket);
+ DETACH(CoQueryProxyBlanket);
+ DETACH(CoRegisterChannelHook);
+ DETACH(CoRegisterClassObject);
+ DETACH(CoRegisterMallocSpy);
+ DETACH(CoRegisterMessageFilter);
+ DETACH(CoRegisterPSClsid);
+ DETACH(CoRegisterSurrogate);
+ DETACH(CoReleaseMarshalData);
+ DETACH(CoReleaseServerProcess);
+ DETACH(CoResumeClassObjects);
+ DETACH(CoRevertToSelf);
+ DETACH(CoRevokeClassObject);
+ DETACH(CoRevokeMallocSpy);
+ DETACH(CoSetProxyBlanket);
+ DETACH(CoSuspendClassObjects);
+ DETACH(CoSwitchCallContext);
+ DETACH(CoTaskMemAlloc);
+ DETACH(CoTaskMemFree);
+ DETACH(CoTaskMemRealloc);
+ DETACH(CoTreatAsClass);
+ DETACH(CoUninitialize);
+ DETACH(CoUnmarshalHresult);
+ DETACH(CoUnmarshalInterface);
+ DETACH(ColorMatchToTarget);
+ DETACH(CombineRgn);
+ DETACH(CombineTransform);
+ DETACH(CommConfigDialogA);
+ DETACH(CommConfigDialogW);
+ DETACH(CompareFileTime);
+ DETACH(CompareStringA);
+ DETACH(CompareStringW);
+ DETACH(ConnectNamedPipe);
+#if !defined(DETOURS_ARM)
+ DETACH(ContinueDebugEvent);
+#endif // !DETOURS_ARM
+ DETACH(ConvertDefaultLocale);
+ DETACH(ConvertThreadToFiber);
+ DETACH(CopyAcceleratorTableA);
+ DETACH(CopyAcceleratorTableW);
+ DETACH(CopyEnhMetaFileA);
+ DETACH(CopyEnhMetaFileW);
+ DETACH(CopyFileA);
+ DETACH(CopyFileExA);
+ DETACH(CopyFileExW);
+ DETACH(CopyFileW);
+ DETACH(CopyIcon);
+ DETACH(CopyImage);
+ DETACH(CopyMetaFileA);
+ DETACH(CopyMetaFileW);
+ DETACH(CopyRect);
+ DETACH(CountClipboardFormats);
+ DETACH(CreateAcceleratorTableA);
+ DETACH(CreateAcceleratorTableW);
+ DETACH(CreateAntiMoniker);
+ DETACH(CreateBindCtx);
+ DETACH(CreateBitmap);
+ DETACH(CreateBitmapIndirect);
+ DETACH(CreateBrushIndirect);
+ DETACH(CreateCaret);
+ DETACH(CreateClassMoniker);
+ DETACH(CreateColorSpaceA);
+ DETACH(CreateColorSpaceW);
+ DETACH(CreateCompatibleBitmap);
+ DETACH(CreateCompatibleDC);
+ DETACH(CreateConsoleScreenBuffer);
+ DETACH(CreateCursor);
+ DETACH(CreateDCA);
+ DETACH(CreateDCW);
+ DETACH(CreateDIBPatternBrush);
+ DETACH(CreateDIBPatternBrushPt);
+ DETACH(CreateDIBSection);
+ DETACH(CreateDIBitmap);
+ DETACH(CreateDataAdviseHolder);
+ DETACH(CreateDataCache);
+ DETACH(CreateDesktopA);
+ DETACH(CreateDesktopW);
+ DETACH(CreateDialogIndirectParamA);
+ DETACH(CreateDialogIndirectParamW);
+ DETACH(CreateDialogParamA);
+ DETACH(CreateDialogParamW);
+ DETACH(CreateDirectoryA);
+ DETACH(CreateDirectoryExA);
+ DETACH(CreateDirectoryExW);
+ DETACH(CreateDirectoryW);
+ DETACH(CreateDiscardableBitmap);
+ DETACH(CreateEllipticRgn);
+ DETACH(CreateEllipticRgnIndirect);
+ DETACH(CreateEnhMetaFileA);
+ DETACH(CreateEnhMetaFileW);
+ DETACH(CreateEventA);
+ DETACH(CreateEventW);
+ DETACH(CreateFiber);
+ DETACH(CreateFileA);
+ DETACH(CreateFileMappingA);
+ DETACH(CreateFileMappingW);
+ DETACH(CreateFileMoniker);
+ DETACH(CreateFileW);
+ DETACH(CreateFontA);
+ DETACH(CreateFontIndirectA);
+ DETACH(CreateFontIndirectW);
+ DETACH(CreateFontW);
+ DETACH(CreateGenericComposite);
+ DETACH(CreateHalftonePalette);
+ DETACH(CreateHatchBrush);
+ DETACH(CreateICA);
+ DETACH(CreateICW);
+ DETACH(CreateILockBytesOnHGlobal);
+ DETACH(CreateIcon);
+ DETACH(CreateIconFromResource);
+ DETACH(CreateIconFromResourceEx);
+ DETACH(CreateIconIndirect);
+ DETACH(CreateIoCompletionPort);
+ DETACH(CreateItemMoniker);
+ DETACH(CreateMDIWindowA);
+ DETACH(CreateMDIWindowW);
+ DETACH(CreateMailslotA);
+ DETACH(CreateMailslotW);
+ DETACH(CreateMenu);
+ DETACH(CreateMetaFileA);
+ DETACH(CreateMetaFileW);
+ DETACH(CreateMutexA);
+ DETACH(CreateMutexW);
+ DETACH(CreateNamedPipeA);
+ DETACH(CreateNamedPipeW);
+ DETACH(CreateOleAdviseHolder);
+ DETACH(CreatePalette);
+ DETACH(CreatePatternBrush);
+ DETACH(CreatePen);
+ DETACH(CreatePenIndirect);
+ DETACH(CreatePipe);
+ DETACH(CreatePointerMoniker);
+ DETACH(CreatePolyPolygonRgn);
+ DETACH(CreatePolygonRgn);
+ DETACH(CreatePopupMenu);
+ DETACH(CreateProcessA);
+ DETACH(CreateProcessW);
+ DETACH(CreateProcessAsUserA);
+ DETACH(CreateProcessAsUserW);
+#if(_WIN32_WINNT >= 0x0500)
+ DETACH(CreateProcessWithLogonW);
+ DETACH(CreateProcessWithTokenW);
+#endif //(_WIN32_WINNT >= 0x0500)
+ DETACH(CreateRectRgn);
+ DETACH(CreateRectRgnIndirect);
+ DETACH(CreateRemoteThread);
+ DETACH(CreateRoundRectRgn);
+ DETACH(CreateScalableFontResourceA);
+ DETACH(CreateScalableFontResourceW);
+ DETACH(CreateSemaphoreA);
+ DETACH(CreateSemaphoreW);
+ DETACH(CreateSolidBrush);
+ DETACH(CreateStdProgressIndicator);
+ DETACH(CreateStreamOnHGlobal);
+ DETACH(CreateTapePartition);
+ DETACH(CreateThread);
+ DETACH(CreateWaitableTimerA);
+ DETACH(CreateWaitableTimerW);
+ DETACH(CreateWindowExA);
+ DETACH(CreateWindowExW);
+ DETACH(CreateWindowStationA);
+ DETACH(CreateWindowStationW);
+ DETACH(DPtoLP);
+ DETACH(DdeAbandonTransaction);
+ DETACH(DdeAccessData);
+ DETACH(DdeAddData);
+ DETACH(DdeClientTransaction);
+ DETACH(DdeCmpStringHandles);
+ DETACH(DdeConnect);
+ DETACH(DdeConnectList);
+ DETACH(DdeCreateDataHandle);
+ DETACH(DdeCreateStringHandleA);
+ DETACH(DdeCreateStringHandleW);
+ DETACH(DdeDisconnect);
+ DETACH(DdeDisconnectList);
+ DETACH(DdeEnableCallback);
+ DETACH(DdeFreeDataHandle);
+ DETACH(DdeFreeStringHandle);
+ DETACH(DdeGetData);
+ DETACH(DdeGetLastError);
+ DETACH(DdeImpersonateClient);
+ DETACH(DdeKeepStringHandle);
+ DETACH(DdeNameService);
+ DETACH(DdePostAdvise);
+ DETACH(DdeQueryConvInfo);
+ DETACH(DdeQueryNextServer);
+ DETACH(DdeQueryStringA);
+ DETACH(DdeQueryStringW);
+ DETACH(DdeReconnect);
+ DETACH(DdeSetQualityOfService);
+ DETACH(DdeSetUserHandle);
+ DETACH(DdeUnaccessData);
+ DETACH(DdeUninitialize);
+ DETACH(DebugActiveProcess);
+ DETACH(DebugActiveProcessStop);
+ DETACH(DebugBreak);
+ DETACH(DefDlgProcA);
+ DETACH(DefDlgProcW);
+ DETACH(DefFrameProcA);
+ DETACH(DefFrameProcW);
+ DETACH(DefMDIChildProcA);
+ DETACH(DefMDIChildProcW);
+ DETACH(DefWindowProcA);
+ DETACH(DefWindowProcW);
+ DETACH(DeferWindowPos);
+ DETACH(DefineDosDeviceA);
+ DETACH(DefineDosDeviceW);
+ DETACH(DeleteAtom);
+ DETACH(DeleteColorSpace);
+ DETACH(DeleteDC);
+ DETACH(DeleteEnhMetaFile);
+ DETACH(DeleteFiber);
+ DETACH(DeleteFileA);
+ DETACH(DeleteFileW);
+ DETACH(DeleteMenu);
+ DETACH(DeleteMetaFile);
+ DETACH(DeleteObject);
+ DETACH(DescribePixelFormat);
+ DETACH(DestroyAcceleratorTable);
+ DETACH(DestroyCaret);
+ DETACH(DestroyCursor);
+ DETACH(DestroyIcon);
+ DETACH(DestroyMenu);
+ DETACH(DestroyWindow);
+ DETACH(DeviceIoControl);
+ DETACH(DialogBoxIndirectParamA);
+ DETACH(DialogBoxIndirectParamW);
+ DETACH(DialogBoxParamA);
+ DETACH(DialogBoxParamW);
+ DETACH(DisableThreadLibraryCalls);
+ DETACH(DisconnectNamedPipe);
+ DETACH(DispatchMessageA);
+ DETACH(DispatchMessageW);
+ DETACH(DlgDirListA);
+ DETACH(DlgDirListComboBoxA);
+ DETACH(DlgDirListComboBoxW);
+ DETACH(DlgDirListW);
+ DETACH(DlgDirSelectComboBoxExA);
+ DETACH(DlgDirSelectComboBoxExW);
+ DETACH(DlgDirSelectExA);
+ DETACH(DlgDirSelectExW);
+ DETACH(DoDragDrop);
+ DETACH(DosDateTimeToFileTime);
+ DETACH(DragDetect);
+ DETACH(DragObject);
+ DETACH(DrawAnimatedRects);
+ DETACH(DrawCaption);
+ DETACH(DrawEdge);
+ DETACH(DrawEscape);
+ DETACH(DrawFocusRect);
+ DETACH(DrawFrameControl);
+ DETACH(DrawIcon);
+ DETACH(DrawIconEx);
+ DETACH(DrawMenuBar);
+ DETACH(DrawStateA);
+ DETACH(DrawStateW);
+ DETACH(DrawTextA);
+ DETACH(DrawTextExA);
+ DETACH(DrawTextExW);
+ DETACH(DrawTextW);
+ DETACH(DuplicateHandle);
+ DETACH(Ellipse);
+ DETACH(EmptyClipboard);
+ DETACH(EnableMenuItem);
+ DETACH(EnableScrollBar);
+ DETACH(EnableWindow);
+ DETACH(EndDeferWindowPos);
+ DETACH(EndDialog);
+ DETACH(EndDoc);
+ DETACH(EndPage);
+ DETACH(EndPaint);
+ DETACH(EndPath);
+ DETACH(EndUpdateResourceA);
+ DETACH(EndUpdateResourceW);
+ DETACH(EnumCalendarInfoA);
+ DETACH(EnumCalendarInfoW);
+ DETACH(EnumChildWindows);
+ DETACH(EnumClipboardFormats);
+ DETACH(EnumDateFormatsA);
+ DETACH(EnumDateFormatsW);
+ DETACH(EnumDesktopWindows);
+ DETACH(EnumDesktopsA);
+ DETACH(EnumDesktopsW);
+ DETACH(EnumDisplaySettingsA);
+ DETACH(EnumDisplaySettingsW);
+ DETACH(EnumEnhMetaFile);
+ DETACH(EnumFontFamiliesA);
+ DETACH(EnumFontFamiliesExA);
+ DETACH(EnumFontFamiliesExW);
+ DETACH(EnumFontFamiliesW);
+ DETACH(EnumFontsA);
+ DETACH(EnumFontsW);
+ DETACH(EnumICMProfilesA);
+ DETACH(EnumICMProfilesW);
+ DETACH(EnumMetaFile);
+ DETACH(EnumObjects);
+ DETACH(EnumPropsA);
+ DETACH(EnumPropsExA);
+ DETACH(EnumPropsExW);
+ DETACH(EnumPropsW);
+ DETACH(EnumResourceLanguagesA);
+ DETACH(EnumResourceLanguagesW);
+ DETACH(EnumResourceNamesA);
+ DETACH(EnumResourceNamesW);
+ DETACH(EnumResourceTypesA);
+ DETACH(EnumResourceTypesW);
+ DETACH(EnumSystemCodePagesA);
+ DETACH(EnumSystemCodePagesW);
+#if(WINVER >= 0x0500)
+ DETACH(EnumSystemLocalesA);
+ DETACH(EnumSystemLocalesW);
+#endif // (WINVER >= 0x0500)
+ DETACH(EnumThreadWindows);
+ DETACH(EnumTimeFormatsA);
+ DETACH(EnumTimeFormatsW);
+ DETACH(EnumWindowStationsA);
+ DETACH(EnumWindowStationsW);
+ DETACH(EnumWindows);
+ DETACH(EqualRect);
+ DETACH(EqualRgn);
+ DETACH(EraseTape);
+ DETACH(Escape);
+ DETACH(EscapeCommFunction);
+ DETACH(ExcludeClipRect);
+ DETACH(ExcludeUpdateRgn);
+ DETACH(ExitProcess);
+ DETACH(ExitThread);
+ DETACH(ExitWindowsEx);
+ DETACH(ExpandEnvironmentStringsA);
+ DETACH(ExpandEnvironmentStringsW);
+ DETACH(ExtCreatePen);
+ DETACH(ExtCreateRegion);
+ DETACH(ExtEscape);
+ DETACH(ExtFloodFill);
+ DETACH(ExtSelectClipRgn);
+ DETACH(ExtTextOutA);
+ DETACH(ExtTextOutW);
+ DETACH(FatalAppExitA);
+ DETACH(FatalAppExitW);
+ DETACH(FatalExit);
+ DETACH(FileTimeToDosDateTime);
+ DETACH(FileTimeToLocalFileTime);
+ DETACH(FileTimeToSystemTime);
+ DETACH(FillConsoleOutputAttribute);
+ DETACH(FillConsoleOutputCharacterA);
+ DETACH(FillConsoleOutputCharacterW);
+ DETACH(FillPath);
+ DETACH(FillRect);
+ DETACH(FillRgn);
+ DETACH(FindAtomA);
+ DETACH(FindAtomW);
+ DETACH(FindClose);
+ DETACH(FindCloseChangeNotification);
+ DETACH(FindFirstChangeNotificationA);
+ DETACH(FindFirstChangeNotificationW);
+ DETACH(FindFirstFileA);
+ DETACH(FindFirstFileExA);
+ DETACH(FindFirstFileExW);
+ DETACH(FindFirstFileW);
+ DETACH(FindNextChangeNotification);
+ DETACH(FindNextFileA);
+ DETACH(FindNextFileW);
+ DETACH(FindResourceA);
+ DETACH(FindResourceExA);
+ DETACH(FindResourceExW);
+ DETACH(FindResourceW);
+ DETACH(FindWindowA);
+ DETACH(FindWindowExA);
+ DETACH(FindWindowExW);
+ DETACH(FindWindowW);
+ DETACH(FixBrushOrgEx);
+ DETACH(FlashWindow);
+ DETACH(FlattenPath);
+ DETACH(FloodFill);
+ DETACH(FlushConsoleInputBuffer);
+ DETACH(FlushFileBuffers);
+ DETACH(FlushViewOfFile);
+ DETACH(FmtIdToPropStgName);
+ DETACH(FoldStringA);
+ DETACH(FoldStringW);
+ DETACH(FormatMessageA);
+ DETACH(FormatMessageW);
+ DETACH(FrameRect);
+ DETACH(FrameRgn);
+ DETACH(FreeConsole);
+ DETACH(FreeDDElParam);
+ DETACH(FreeEnvironmentStringsA);
+ DETACH(FreeEnvironmentStringsW);
+ DETACH(FreeLibrary);
+ DETACH(FreeLibraryAndExitThread);
+ DETACH(FreePropVariantArray);
+ DETACH(FreeResource);
+ DETACH(GdiComment);
+ DETACH(GdiFlush);
+ DETACH(GdiGetBatchLimit);
+ DETACH(GdiSetBatchLimit);
+ DETACH(GenerateConsoleCtrlEvent);
+ DETACH(GetACP);
+ DETACH(GetActiveWindow);
+ DETACH(GetArcDirection);
+ DETACH(GetAspectRatioFilterEx);
+ DETACH(GetAsyncKeyState);
+ DETACH(GetAtomNameA);
+ DETACH(GetAtomNameW);
+ DETACH(GetBinaryTypeA);
+ DETACH(GetBinaryTypeW);
+ DETACH(GetBitmapBits);
+ DETACH(GetBitmapDimensionEx);
+ DETACH(GetBkColor);
+ DETACH(GetBkMode);
+ DETACH(GetBoundsRect);
+ DETACH(GetBrushOrgEx);
+ DETACH(GetCPInfo);
+ DETACH(GetCapture);
+ DETACH(GetCaretBlinkTime);
+ DETACH(GetCaretPos);
+ DETACH(GetCharABCWidthsA);
+ DETACH(GetCharABCWidthsFloatA);
+ DETACH(GetCharABCWidthsFloatW);
+ DETACH(GetCharABCWidthsW);
+ DETACH(GetCharWidth32A);
+ DETACH(GetCharWidth32W);
+ DETACH(GetCharWidthA);
+ DETACH(GetCharWidthFloatA);
+ DETACH(GetCharWidthFloatW);
+ DETACH(GetCharWidthW);
+ DETACH(GetCharacterPlacementA);
+ DETACH(GetCharacterPlacementW);
+ DETACH(GetClassFile);
+ DETACH(GetClassInfoA);
+ DETACH(GetClassInfoExA);
+ DETACH(GetClassInfoExW);
+ DETACH(GetClassInfoW);
+ DETACH(GetClassLongA);
+ DETACH(GetClassLongW);
+ DETACH(GetClassNameA);
+ DETACH(GetClassNameW);
+ DETACH(GetClassWord);
+ DETACH(GetClientRect);
+ DETACH(GetClipBox);
+ DETACH(GetClipCursor);
+ DETACH(GetClipRgn);
+ DETACH(GetClipboardData);
+ DETACH(GetClipboardFormatNameA);
+ DETACH(GetClipboardFormatNameW);
+ DETACH(GetClipboardOwner);
+ DETACH(GetClipboardViewer);
+ DETACH(GetColorAdjustment);
+ DETACH(GetColorSpace);
+ DETACH(GetCommConfig);
+ DETACH(GetCommMask);
+ DETACH(GetCommModemStatus);
+ DETACH(GetCommProperties);
+ DETACH(GetCommState);
+ DETACH(GetCommTimeouts);
+ DETACH(GetCommandLineA);
+ DETACH(GetCommandLineW);
+ DETACH(GetComputerNameA);
+ DETACH(GetComputerNameW);
+ DETACH(GetConsoleCP);
+ DETACH(GetConsoleCursorInfo);
+ DETACH(GetConsoleMode);
+ DETACH(GetConsoleOutputCP);
+ DETACH(GetConsoleScreenBufferInfo);
+ DETACH(GetConsoleTitleA);
+ DETACH(GetConsoleTitleW);
+ DETACH(GetConvertStg);
+ DETACH(GetCurrencyFormatA);
+ DETACH(GetCurrencyFormatW);
+ DETACH(GetCurrentDirectoryA);
+ DETACH(GetCurrentDirectoryW);
+ DETACH(GetCurrentObject);
+ DETACH(GetCurrentPositionEx);
+ DETACH(GetCurrentProcess);
+ DETACH(GetCurrentProcessId);
+ DETACH(GetCurrentThreadId);
+ DETACH(GetCursor);
+ DETACH(GetCursorPos);
+ DETACH(GetDC);
+ DETACH(GetDCEx);
+ DETACH(GetDCOrgEx);
+ DETACH(GetDIBColorTable);
+ DETACH(GetDIBits);
+ DETACH(GetDateFormatA);
+ DETACH(GetDateFormatW);
+ DETACH(GetDefaultCommConfigA);
+ DETACH(GetDefaultCommConfigW);
+ DETACH(GetDesktopWindow);
+ DETACH(GetDeviceCaps);
+ DETACH(GetDeviceGammaRamp);
+ DETACH(GetDialogBaseUnits);
+ DETACH(GetDiskFreeSpaceA);
+ DETACH(GetDiskFreeSpaceExA);
+ DETACH(GetDiskFreeSpaceExW);
+ DETACH(GetDiskFreeSpaceW);
+ DETACH(GetDlgCtrlID);
+ DETACH(GetDlgItem);
+ DETACH(GetDlgItemInt);
+ DETACH(GetDlgItemTextA);
+ DETACH(GetDlgItemTextW);
+ DETACH(GetDoubleClickTime);
+ DETACH(GetDriveTypeA);
+ DETACH(GetDriveTypeW);
+ DETACH(GetEnhMetaFileA);
+ DETACH(GetEnhMetaFileBits);
+ DETACH(GetEnhMetaFileDescriptionA);
+ DETACH(GetEnhMetaFileDescriptionW);
+ DETACH(GetEnhMetaFileHeader);
+ DETACH(GetEnhMetaFilePaletteEntries);
+ DETACH(GetEnhMetaFilePixelFormat);
+ DETACH(GetEnhMetaFileW);
+ DETACH(GetEnvironmentStrings);
+ DETACH(GetEnvironmentStringsW);
+ DETACH(GetEnvironmentVariableA);
+ DETACH(GetEnvironmentVariableW);
+ DETACH(GetExitCodeProcess);
+ DETACH(GetExitCodeThread);
+ DETACH(GetFileAttributesA);
+ DETACH(GetFileAttributesExA);
+ DETACH(GetFileAttributesExW);
+ DETACH(GetFileAttributesW);
+ DETACH(GetFileInformationByHandle);
+ DETACH(GetFileSize);
+ DETACH(GetFileTime);
+ DETACH(GetFileType);
+ DETACH(GetFocus);
+ DETACH(GetFontData);
+ DETACH(GetFontLanguageInfo);
+ DETACH(GetForegroundWindow);
+ DETACH(GetFullPathNameA);
+ DETACH(GetFullPathNameW);
+ DETACH(GetGlyphOutlineA);
+ DETACH(GetGlyphOutlineW);
+ DETACH(GetGraphicsMode);
+ DETACH(GetHGlobalFromILockBytes);
+ DETACH(GetHGlobalFromStream);
+ DETACH(GetHandleInformation);
+ DETACH(GetICMProfileA);
+ DETACH(GetICMProfileW);
+ DETACH(GetIconInfo);
+ DETACH(GetInputState);
+ DETACH(GetKBCodePage);
+ DETACH(GetKerningPairsA);
+ DETACH(GetKerningPairsW);
+ DETACH(GetKeyNameTextA);
+ DETACH(GetKeyNameTextW);
+ DETACH(GetKeyState);
+ DETACH(GetKeyboardLayout);
+ DETACH(GetKeyboardLayoutList);
+ DETACH(GetKeyboardLayoutNameA);
+ DETACH(GetKeyboardLayoutNameW);
+ DETACH(GetKeyboardState);
+ DETACH(GetKeyboardType);
+ DETACH(GetLastActivePopup);
+ DETACH(GetLocalTime);
+ DETACH(GetLocaleInfoA);
+ DETACH(GetLocaleInfoW);
+ DETACH(GetLogColorSpaceA);
+ DETACH(GetLogColorSpaceW);
+ DETACH(GetLogicalDriveStringsA);
+ DETACH(GetLogicalDriveStringsW);
+ DETACH(GetLogicalDrives);
+ DETACH(GetMailslotInfo);
+ DETACH(GetMapMode);
+ DETACH(GetMenu);
+ DETACH(GetMenuCheckMarkDimensions);
+ DETACH(GetMenuContextHelpId);
+ DETACH(GetMenuDefaultItem);
+ DETACH(GetMenuItemCount);
+ DETACH(GetMenuItemID);
+ DETACH(GetMenuItemInfoA);
+ DETACH(GetMenuItemInfoW);
+ DETACH(GetMenuItemRect);
+ DETACH(GetMenuState);
+ DETACH(GetMenuStringA);
+ DETACH(GetMenuStringW);
+ DETACH(GetMessageA);
+ DETACH(GetMessageExtraInfo);
+ DETACH(GetMessagePos);
+ DETACH(GetMessageTime);
+ DETACH(GetMessageW);
+ DETACH(GetMetaFileA);
+ DETACH(GetMetaFileBitsEx);
+ DETACH(GetMetaFileW);
+ DETACH(GetMetaRgn);
+ DETACH(GetMiterLimit);
+ DETACH(GetModuleFileNameA);
+ DETACH(GetModuleFileNameW);
+ DETACH(GetModuleHandleA);
+ DETACH(GetModuleHandleW);
+ DETACH(GetNamedPipeHandleStateA);
+ DETACH(GetNamedPipeHandleStateW);
+ DETACH(GetNamedPipeInfo);
+ DETACH(GetNearestColor);
+ DETACH(GetNearestPaletteIndex);
+ DETACH(GetNextDlgGroupItem);
+ DETACH(GetNextDlgTabItem);
+ DETACH(GetNumberFormatA);
+ DETACH(GetNumberFormatW);
+ DETACH(GetNumberOfConsoleInputEvents);
+ DETACH(GetNumberOfConsoleMouseButtons);
+ DETACH(GetOEMCP);
+ DETACH(GetObjectA);
+ DETACH(GetObjectType);
+ DETACH(GetObjectW);
+ DETACH(GetOpenClipboardWindow);
+ DETACH(GetOutlineTextMetricsA);
+ DETACH(GetOutlineTextMetricsW);
+ DETACH(GetOverlappedResult);
+ DETACH(GetPaletteEntries);
+ DETACH(GetParent);
+ DETACH(GetPath);
+ DETACH(GetPixel);
+ DETACH(GetPixelFormat);
+ DETACH(GetPolyFillMode);
+ DETACH(GetPriorityClass);
+ DETACH(GetPriorityClipboardFormat);
+ DETACH(GetPrivateProfileIntA);
+ DETACH(GetPrivateProfileIntW);
+ DETACH(GetPrivateProfileSectionA);
+ DETACH(GetPrivateProfileSectionNamesA);
+ DETACH(GetPrivateProfileSectionNamesW);
+ DETACH(GetPrivateProfileSectionW);
+ DETACH(GetPrivateProfileStringA);
+ DETACH(GetPrivateProfileStringW);
+ DETACH(GetPrivateProfileStructA);
+ DETACH(GetPrivateProfileStructW);
+ DETACH(GetProcAddress);
+ DETACH(GetProcessAffinityMask);
+ DETACH(GetProcessHeaps);
+ DETACH(GetProcessShutdownParameters);
+ DETACH(GetProcessTimes);
+ DETACH(GetProcessVersion);
+ DETACH(GetProcessWindowStation);
+ DETACH(GetProcessWorkingSetSize);
+ DETACH(GetProfileIntA);
+ DETACH(GetProfileIntW);
+ DETACH(GetProfileSectionA);
+ DETACH(GetProfileSectionW);
+ DETACH(GetProfileStringA);
+ DETACH(GetProfileStringW);
+ DETACH(GetPropA);
+ DETACH(GetPropW);
+ DETACH(GetQueueStatus);
+ DETACH(GetQueuedCompletionStatus);
+ DETACH(GetROP2);
+ DETACH(GetRasterizerCaps);
+ DETACH(GetRegionData);
+ DETACH(GetRgnBox);
+ DETACH(GetRunningObjectTable);
+ DETACH(GetScrollInfo);
+ DETACH(GetScrollPos);
+ DETACH(GetScrollRange);
+ DETACH(GetShortPathNameA);
+ DETACH(GetShortPathNameW);
+ DETACH(GetStartupInfoA);
+ DETACH(GetStartupInfoW);
+ DETACH(GetStdHandle);
+ DETACH(GetStockObject);
+ DETACH(GetStretchBltMode);
+ DETACH(GetSubMenu);
+ DETACH(GetSysColor);
+ DETACH(GetSysColorBrush);
+ DETACH(GetSystemDefaultLCID);
+ DETACH(GetSystemDefaultLangID);
+ DETACH(GetSystemDirectoryA);
+ DETACH(GetSystemDirectoryW);
+ DETACH(GetSystemInfo);
+ DETACH(GetSystemMenu);
+ DETACH(GetSystemMetrics);
+ DETACH(GetSystemPaletteEntries);
+ DETACH(GetSystemPaletteUse);
+ DETACH(GetSystemPowerStatus);
+ DETACH(GetSystemTime);
+ DETACH(GetSystemTimeAdjustment);
+ DETACH(GetSystemTimeAsFileTime);
+ DETACH(GetTabbedTextExtentA);
+ DETACH(GetTabbedTextExtentW);
+ DETACH(GetTapeParameters);
+ DETACH(GetTapePosition);
+ DETACH(GetTapeStatus);
+ DETACH(GetTempFileNameA);
+ DETACH(GetTempFileNameW);
+ DETACH(GetTempPathA);
+ DETACH(GetTempPathW);
+ DETACH(GetTextAlign);
+ DETACH(GetTextCharacterExtra);
+ DETACH(GetTextCharset);
+ DETACH(GetTextCharsetInfo);
+ DETACH(GetTextColor);
+ DETACH(GetTextExtentExPointA);
+ DETACH(GetTextExtentExPointW);
+ DETACH(GetTextExtentPoint32A);
+ DETACH(GetTextExtentPoint32W);
+ DETACH(GetTextExtentPointA);
+ DETACH(GetTextExtentPointW);
+ DETACH(GetTextFaceA);
+ DETACH(GetTextFaceW);
+ DETACH(GetTextMetricsA);
+ DETACH(GetTextMetricsW);
+ DETACH(GetThreadContext);
+ DETACH(GetThreadDesktop);
+#if(WINVER >= 0x0500)
+ DETACH(GetThreadLocale);
+#endif // (WINVER >= 0x0500)
+ DETACH(GetThreadPriority);
+ DETACH(GetThreadPriorityBoost);
+ DETACH(GetThreadSelectorEntry);
+ DETACH(GetThreadTimes);
+ DETACH(GetTickCount);
+ DETACH(GetTimeFormatA);
+ DETACH(GetTimeFormatW);
+ DETACH(GetTimeZoneInformation);
+ DETACH(GetTopWindow);
+ DETACH(GetUpdateRect);
+ DETACH(GetUpdateRgn);
+ DETACH(GetUserDefaultLCID);
+ DETACH(GetUserDefaultLangID);
+ DETACH(GetUserObjectInformationA);
+ DETACH(GetUserObjectInformationW);
+ DETACH(GetUserObjectSecurity);
+ DETACH(GetVersion);
+ DETACH(GetVersionExA);
+ DETACH(GetVersionExW);
+ DETACH(GetViewportExtEx);
+ DETACH(GetViewportOrgEx);
+ DETACH(GetVolumeInformationA);
+ DETACH(GetVolumeInformationW);
+ DETACH(GetWinMetaFileBits);
+ DETACH(GetWindow);
+ DETACH(GetWindowContextHelpId);
+ DETACH(GetWindowDC);
+ DETACH(GetWindowExtEx);
+ DETACH(GetWindowLongA);
+ DETACH(GetWindowLongW);
+ DETACH(GetWindowOrgEx);
+ DETACH(GetWindowPlacement);
+ DETACH(GetWindowRect);
+ DETACH(GetWindowRgn);
+ DETACH(GetWindowTextA);
+ DETACH(GetWindowTextLengthA);
+ DETACH(GetWindowTextLengthW);
+ DETACH(GetWindowTextW);
+ DETACH(GetWindowThreadProcessId);
+ DETACH(GetWindowWord);
+ DETACH(GetWindowsDirectoryA);
+ DETACH(GetWindowsDirectoryW);
+ DETACH(GetWorldTransform);
+ DETACH(GlobalAddAtomA);
+ DETACH(GlobalAddAtomW);
+ DETACH(GlobalAlloc);
+ DETACH(GlobalCompact);
+ DETACH(GlobalDeleteAtom);
+ DETACH(GlobalFindAtomA);
+ DETACH(GlobalFindAtomW);
+ DETACH(GlobalFix);
+ DETACH(GlobalFlags);
+ DETACH(GlobalFree);
+ DETACH(GlobalGetAtomNameA);
+ DETACH(GlobalGetAtomNameW);
+ DETACH(GlobalHandle);
+ DETACH(GlobalLock);
+ DETACH(GlobalMemoryStatus);
+ DETACH(GlobalReAlloc);
+ DETACH(GlobalSize);
+ DETACH(GlobalUnWire);
+ DETACH(GlobalUnfix);
+ DETACH(GlobalUnlock);
+ DETACH(GlobalWire);
+ DETACH(GrayStringA);
+ DETACH(GrayStringW);
+ DETACH(HeapLock);
+ DETACH(HeapUnlock);
+ DETACH(HideCaret);
+ DETACH(HiliteMenuItem);
+ DETACH(IIDFromString);
+ DETACH(ImpersonateDdeClientWindow);
+ DETACH(InSendMessage);
+ DETACH(InflateRect);
+ DETACH(InitAtomTable);
+ DETACH(InsertMenuA);
+ DETACH(InsertMenuItemA);
+ DETACH(InsertMenuItemW);
+ DETACH(InsertMenuW);
+ DETACH(IntersectClipRect);
+ DETACH(IntersectRect);
+ DETACH(InvalidateRect);
+ DETACH(InvalidateRgn);
+ DETACH(InvertRect);
+ DETACH(InvertRgn);
+ DETACH(IsAccelerator);
+ DETACH(IsBadCodePtr);
+ DETACH(IsBadHugeReadPtr);
+ DETACH(IsBadHugeWritePtr);
+ DETACH(IsBadReadPtr);
+ DETACH(IsBadStringPtrA);
+ DETACH(IsBadStringPtrW);
+ DETACH(IsBadWritePtr);
+ DETACH(IsCharAlphaA);
+ DETACH(IsCharAlphaNumericA);
+ DETACH(IsCharAlphaNumericW);
+ DETACH(IsCharAlphaW);
+ DETACH(IsCharLowerA);
+ DETACH(IsCharLowerW);
+ DETACH(IsCharUpperA);
+ DETACH(IsCharUpperW);
+ DETACH(IsChild);
+ DETACH(IsClipboardFormatAvailable);
+ DETACH(IsDBCSLeadByte);
+ DETACH(IsDBCSLeadByteEx);
+ DETACH(IsDebuggerPresent);
+ DETACH(IsDialogMessageA);
+ DETACH(IsDialogMessageW);
+ DETACH(IsDlgButtonChecked);
+ DETACH(IsIconic);
+ DETACH(IsMenu);
+#if !defined(DETOURS_ARM)
+ DETACH(IsProcessorFeaturePresent);
+#endif // !DETOURS_ARM
+ DETACH(IsRectEmpty);
+ DETACH(IsValidCodePage);
+ DETACH(IsValidLocale);
+ DETACH(IsWindow);
+ DETACH(IsWindowEnabled);
+ DETACH(IsWindowUnicode);
+ DETACH(IsWindowVisible);
+ DETACH(IsZoomed);
+ DETACH(KillTimer);
+ DETACH(LPtoDP);
+ DETACH(LineDDA);
+ DETACH(LineTo);
+ DETACH(LoadAcceleratorsA);
+ DETACH(LoadAcceleratorsW);
+ DETACH(LoadBitmapA);
+ DETACH(LoadBitmapW);
+ DETACH(LoadCursorA);
+ DETACH(LoadCursorFromFileA);
+ DETACH(LoadCursorFromFileW);
+ DETACH(LoadCursorW);
+ DETACH(LoadIconA);
+ DETACH(LoadIconW);
+ DETACH(LoadImageA);
+ DETACH(LoadImageW);
+ DETACH(LoadKeyboardLayoutA);
+ DETACH(LoadKeyboardLayoutW);
+ DETACH(LoadLibraryA);
+ DETACH(LoadLibraryExA);
+ DETACH(LoadLibraryExW);
+ DETACH(LoadLibraryW);
+ DETACH(LoadMenuA);
+ DETACH(LoadMenuIndirectA);
+ DETACH(LoadMenuIndirectW);
+ DETACH(LoadMenuW);
+ DETACH(LoadModule);
+ DETACH(LoadResource);
+ DETACH(LoadStringA);
+ DETACH(LoadStringW);
+ DETACH(LocalAlloc);
+ DETACH(LocalCompact);
+ DETACH(LocalFileTimeToFileTime);
+ DETACH(LocalFlags);
+ DETACH(LocalFree);
+ DETACH(LocalHandle);
+ DETACH(LocalLock);
+ DETACH(LocalReAlloc);
+ DETACH(LocalShrink);
+ DETACH(LocalSize);
+ DETACH(LocalUnlock);
+ DETACH(LockFile);
+ DETACH(LockFileEx);
+ DETACH(LockResource);
+ DETACH(LockWindowUpdate);
+ DETACH(LookupIconIdFromDirectory);
+ DETACH(LookupIconIdFromDirectoryEx);
+ DETACH(MapDialogRect);
+ DETACH(MapViewOfFile);
+ DETACH(MapViewOfFileEx);
+ DETACH(MapVirtualKeyA);
+ DETACH(MapVirtualKeyExA);
+ DETACH(MapVirtualKeyExW);
+ DETACH(MapVirtualKeyW);
+ DETACH(MapWindowPoints);
+ DETACH(MaskBlt);
+ DETACH(MenuItemFromPoint);
+ DETACH(MessageBeep);
+ DETACH(MessageBoxA);
+ DETACH(MessageBoxExA);
+ DETACH(MessageBoxExW);
+ DETACH(MessageBoxIndirectA);
+ DETACH(MessageBoxIndirectW);
+ DETACH(MessageBoxW);
+ DETACH(MkParseDisplayName);
+ DETACH(ModifyMenuA);
+ DETACH(ModifyMenuW);
+ DETACH(ModifyWorldTransform);
+ DETACH(MonikerCommonPrefixWith);
+ DETACH(MonikerRelativePathTo);
+ DETACH(MoveFileA);
+ DETACH(MoveFileExA);
+ DETACH(MoveFileExW);
+ DETACH(MoveFileW);
+ DETACH(MoveToEx);
+ DETACH(MoveWindow);
+ DETACH(MsgWaitForMultipleObjects);
+ DETACH(MsgWaitForMultipleObjectsEx);
+ DETACH(MulDiv);
+ DETACH(OemKeyScan);
+ DETACH(OemToCharA);
+ DETACH(OemToCharBuffA);
+ DETACH(OemToCharBuffW);
+ DETACH(OemToCharW);
+ DETACH(OffsetClipRgn);
+ DETACH(OffsetRect);
+ DETACH(OffsetRgn);
+ DETACH(OffsetViewportOrgEx);
+ DETACH(OffsetWindowOrgEx);
+ DETACH(OleBuildVersion);
+ DETACH(OleConvertIStorageToOLESTREAM);
+ DETACH(OleConvertIStorageToOLESTREAMEx);
+ DETACH(OleConvertOLESTREAMToIStorage);
+ DETACH(OleConvertOLESTREAMToIStorageEx);
+ DETACH(OleCreate);
+ DETACH(OleCreateDefaultHandler);
+ DETACH(OleCreateEmbeddingHelper);
+ DETACH(OleCreateEx);
+ DETACH(OleCreateFromData);
+ DETACH(OleCreateFromDataEx);
+ DETACH(OleCreateFromFile);
+ DETACH(OleCreateFromFileEx);
+ DETACH(OleCreateLink);
+ DETACH(OleCreateLinkEx);
+ DETACH(OleCreateLinkFromData);
+ DETACH(OleCreateLinkFromDataEx);
+ DETACH(OleCreateLinkToFile);
+ DETACH(OleCreateLinkToFileEx);
+ DETACH(OleCreateMenuDescriptor);
+ DETACH(OleCreateStaticFromData);
+ DETACH(OleDestroyMenuDescriptor);
+ DETACH(OleDoAutoConvert);
+ DETACH(OleDraw);
+ DETACH(OleDuplicateData);
+ DETACH(OleFlushClipboard);
+ DETACH(OleGetAutoConvert);
+ DETACH(OleGetClipboard);
+ DETACH(OleGetIconOfClass);
+ DETACH(OleGetIconOfFile);
+ DETACH(OleInitialize);
+ DETACH(OleIsCurrentClipboard);
+ DETACH(OleIsRunning);
+ DETACH(OleLoad);
+ DETACH(OleLoadFromStream);
+ DETACH(OleLockRunning);
+ DETACH(OleMetafilePictFromIconAndLabel);
+ DETACH(OleNoteObjectVisible);
+ DETACH(OleQueryCreateFromData);
+ DETACH(OleQueryLinkFromData);
+ DETACH(OleRegEnumFormatEtc);
+ DETACH(OleRegEnumVerbs);
+ DETACH(OleRegGetMiscStatus);
+ DETACH(OleRegGetUserType);
+ DETACH(OleRun);
+ DETACH(OleSave);
+ DETACH(OleSaveToStream);
+ DETACH(OleSetAutoConvert);
+ DETACH(OleSetClipboard);
+ DETACH(OleSetContainedObject);
+ DETACH(OleSetMenuDescriptor);
+ DETACH(OleTranslateAccelerator);
+ DETACH(OleUninitialize);
+ DETACH(OpenClipboard);
+ DETACH(OpenDesktopA);
+ DETACH(OpenDesktopW);
+ DETACH(OpenEventA);
+ DETACH(OpenEventW);
+ DETACH(OpenFile);
+ DETACH(OpenFileMappingA);
+ DETACH(OpenFileMappingW);
+ DETACH(OpenIcon);
+ DETACH(OpenInputDesktop);
+ DETACH(OpenMutexA);
+ DETACH(OpenMutexW);
+ DETACH(OpenProcess);
+ DETACH(OpenProcessToken);
+ DETACH(OpenSemaphoreA);
+ DETACH(OpenSemaphoreW);
+ DETACH(OpenWaitableTimerA);
+ DETACH(OpenWaitableTimerW);
+ DETACH(OpenWindowStationA);
+ DETACH(OpenWindowStationW);
+ DETACH(OutputDebugStringA);
+ DETACH(OutputDebugStringW);
+ DETACH(PackDDElParam);
+ DETACH(PaintDesktop);
+ DETACH(PaintRgn);
+ DETACH(PatBlt);
+ DETACH(PathToRegion);
+ DETACH(PeekConsoleInputA);
+ DETACH(PeekConsoleInputW);
+ DETACH(PeekMessageA);
+ DETACH(PeekMessageW);
+ DETACH(PeekNamedPipe);
+ DETACH(Pie);
+ DETACH(PlayEnhMetaFile);
+ DETACH(PlayEnhMetaFileRecord);
+ DETACH(PlayMetaFile);
+ DETACH(PlayMetaFileRecord);
+ DETACH(PlgBlt);
+ DETACH(PolyBezier);
+ DETACH(PolyBezierTo);
+ DETACH(PolyDraw);
+ DETACH(PolyPolygon);
+ DETACH(PolyPolyline);
+ DETACH(PolyTextOutA);
+ DETACH(PolyTextOutW);
+ DETACH(Polygon);
+ DETACH(Polyline);
+ DETACH(PolylineTo);
+ DETACH(PostMessageA);
+ DETACH(PostMessageW);
+ DETACH(PostQueuedCompletionStatus);
+ DETACH(PostQuitMessage);
+ DETACH(PostThreadMessageA);
+ DETACH(PostThreadMessageW);
+ DETACH(PrepareTape);
+ DETACH(ProgIDFromCLSID);
+ DETACH(PropVariantClear);
+ DETACH(PropVariantCopy);
+ DETACH(PtInRect);
+ DETACH(PtInRegion);
+ DETACH(PtVisible);
+ DETACH(PulseEvent);
+ DETACH(PurgeComm);
+ DETACH(QueryDosDeviceA);
+ DETACH(QueryDosDeviceW);
+ DETACH(QueryPerformanceCounter);
+ DETACH(QueryPerformanceFrequency);
+ DETACH(QueueUserAPC);
+ DETACH(RaiseException);
+ DETACH(ReadClassStg);
+ DETACH(ReadClassStm);
+ DETACH(ReadConsoleA);
+ DETACH(ReadConsoleInputA);
+ DETACH(ReadConsoleInputW);
+ DETACH(ReadConsoleOutputA);
+ DETACH(ReadConsoleOutputAttribute);
+ DETACH(ReadConsoleOutputCharacterA);
+ DETACH(ReadConsoleOutputCharacterW);
+ DETACH(ReadConsoleOutputW);
+ DETACH(ReadConsoleW);
+ DETACH(ReadDirectoryChangesW);
+ DETACH(ReadFile);
+ DETACH(ReadFileEx);
+ DETACH(ReadFmtUserTypeStg);
+ DETACH(ReadProcessMemory);
+ DETACH(RealizePalette);
+ DETACH(RectInRegion);
+ DETACH(RectVisible);
+ DETACH(Rectangle);
+ DETACH(RedrawWindow);
+ DETACH(RegisterClassA);
+ DETACH(RegisterClassExA);
+ DETACH(RegisterClassExW);
+ DETACH(RegisterClassW);
+ DETACH(RegisterClipboardFormatA);
+ DETACH(RegisterClipboardFormatW);
+ DETACH(RegisterDragDrop);
+ DETACH(RegisterHotKey);
+ DETACH(RegisterWindowMessageA);
+ DETACH(RegisterWindowMessageW);
+ DETACH(ReleaseCapture);
+ DETACH(ReleaseDC);
+ DETACH(ReleaseMutex);
+ DETACH(ReleaseSemaphore);
+ DETACH(ReleaseStgMedium);
+ DETACH(RemoveDirectoryA);
+ DETACH(RemoveDirectoryW);
+ DETACH(RemoveFontResourceA);
+ DETACH(RemoveFontResourceW);
+ DETACH(RemoveMenu);
+ DETACH(RemovePropA);
+ DETACH(RemovePropW);
+ DETACH(ReplyMessage);
+ DETACH(ResetDCA);
+ DETACH(ResetDCW);
+ DETACH(ResetEvent);
+ DETACH(ResizePalette);
+ DETACH(RestoreDC);
+ DETACH(ResumeThread);
+ DETACH(ReuseDDElParam);
+ DETACH(RevokeDragDrop);
+ DETACH(RoundRect);
+ DETACH(SaveDC);
+ DETACH(ScaleViewportExtEx);
+ DETACH(ScaleWindowExtEx);
+ DETACH(ScreenToClient);
+ DETACH(ScrollConsoleScreenBufferA);
+ DETACH(ScrollConsoleScreenBufferW);
+ DETACH(ScrollDC);
+ DETACH(ScrollWindow);
+ DETACH(ScrollWindowEx);
+ DETACH(SearchPathA);
+ DETACH(SearchPathW);
+ DETACH(SelectClipPath);
+ DETACH(SelectClipRgn);
+ DETACH(SelectObject);
+ DETACH(SelectPalette);
+ DETACH(SendDlgItemMessageA);
+ DETACH(SendDlgItemMessageW);
+ DETACH(SendMessageA);
+ DETACH(SendMessageCallbackA);
+ DETACH(SendMessageCallbackW);
+ DETACH(SendMessageTimeoutA);
+ DETACH(SendMessageTimeoutW);
+ DETACH(SendMessageW);
+ DETACH(SendNotifyMessageA);
+ DETACH(SendNotifyMessageW);
+ DETACH(SetAbortProc);
+ DETACH(SetActiveWindow);
+ DETACH(SetArcDirection);
+ DETACH(SetBitmapBits);
+ DETACH(SetBitmapDimensionEx);
+ DETACH(SetBkColor);
+ DETACH(SetBkMode);
+ DETACH(SetBoundsRect);
+ DETACH(SetBrushOrgEx);
+ DETACH(SetCapture);
+ DETACH(SetCaretBlinkTime);
+ DETACH(SetCaretPos);
+ DETACH(SetClassLongA);
+ DETACH(SetClassLongW);
+ DETACH(SetClassWord);
+ DETACH(SetClipboardData);
+ DETACH(SetClipboardViewer);
+ DETACH(SetColorAdjustment);
+ DETACH(SetColorSpace);
+ DETACH(SetCommBreak);
+ DETACH(SetCommConfig);
+ DETACH(SetCommMask);
+ DETACH(SetCommState);
+ DETACH(SetCommTimeouts);
+ DETACH(SetComputerNameA);
+ DETACH(SetComputerNameW);
+ DETACH(SetConsoleActiveScreenBuffer);
+ DETACH(SetConsoleCP);
+ DETACH(SetConsoleCtrlHandler);
+ DETACH(SetConsoleCursorInfo);
+ DETACH(SetConsoleCursorPosition);
+ DETACH(SetConsoleMode);
+ DETACH(SetConsoleOutputCP);
+ DETACH(SetConsoleScreenBufferSize);
+ DETACH(SetConsoleTextAttribute);
+ DETACH(SetConsoleTitleA);
+ DETACH(SetConsoleTitleW);
+ DETACH(SetConsoleWindowInfo);
+ DETACH(SetConvertStg);
+ DETACH(SetCurrentDirectoryA);
+ DETACH(SetCurrentDirectoryW);
+ DETACH(SetCursor);
+ DETACH(SetCursorPos);
+ DETACH(SetDIBColorTable);
+ DETACH(SetDIBits);
+ DETACH(SetDIBitsToDevice);
+ DETACH(SetDefaultCommConfigA);
+ DETACH(SetDefaultCommConfigW);
+ DETACH(SetDeviceGammaRamp);
+ DETACH(SetDlgItemInt);
+ DETACH(SetDlgItemTextA);
+ DETACH(SetDlgItemTextW);
+ DETACH(SetDoubleClickTime);
+ DETACH(SetEndOfFile);
+ DETACH(SetEnhMetaFileBits);
+ DETACH(SetEnvironmentVariableA);
+ DETACH(SetEnvironmentVariableW);
+ DETACH(SetErrorMode);
+ DETACH(SetEvent);
+ DETACH(SetFileApisToANSI);
+ DETACH(SetFileApisToOEM);
+ DETACH(SetFileAttributesA);
+ DETACH(SetFileAttributesW);
+ DETACH(SetFilePointer);
+ DETACH(SetFileTime);
+ DETACH(SetFocus);
+ DETACH(SetForegroundWindow);
+ DETACH(SetGraphicsMode);
+ DETACH(SetHandleCount);
+ DETACH(SetHandleInformation);
+ DETACH(SetICMMode);
+ DETACH(SetICMProfileA);
+ DETACH(SetICMProfileW);
+ DETACH(SetKeyboardState);
+ DETACH(SetLocalTime);
+ DETACH(SetLocaleInfoA);
+ DETACH(SetLocaleInfoW);
+ DETACH(SetMailslotInfo);
+ DETACH(SetMapMode);
+ DETACH(SetMapperFlags);
+ DETACH(SetMenu);
+ DETACH(SetMenuContextHelpId);
+ DETACH(SetMenuDefaultItem);
+ DETACH(SetMenuItemBitmaps);
+ DETACH(SetMenuItemInfoA);
+ DETACH(SetMenuItemInfoW);
+ DETACH(SetMessageExtraInfo);
+ DETACH(SetMessageQueue);
+ DETACH(SetMetaFileBitsEx);
+ DETACH(SetMetaRgn);
+ DETACH(SetMiterLimit);
+ DETACH(SetNamedPipeHandleState);
+ DETACH(SetPaletteEntries);
+ DETACH(SetParent);
+ DETACH(SetPixel);
+ DETACH(SetPixelFormat);
+ DETACH(SetPixelV);
+ DETACH(SetPolyFillMode);
+ DETACH(SetPriorityClass);
+ DETACH(SetProcessAffinityMask);
+ DETACH(SetProcessShutdownParameters);
+ DETACH(SetProcessWindowStation);
+ DETACH(SetProcessWorkingSetSize);
+ DETACH(SetPropA);
+ DETACH(SetPropW);
+ DETACH(SetROP2);
+ DETACH(SetRect);
+ DETACH(SetRectEmpty);
+ DETACH(SetRectRgn);
+ DETACH(SetScrollInfo);
+ DETACH(SetScrollPos);
+ DETACH(SetScrollRange);
+ DETACH(SetStdHandle);
+ DETACH(SetStretchBltMode);
+ DETACH(SetSysColors);
+ DETACH(SetSystemCursor);
+ DETACH(SetSystemPaletteUse);
+ DETACH(SetSystemPowerState);
+ DETACH(SetSystemTime);
+ DETACH(SetSystemTimeAdjustment);
+ DETACH(SetTapeParameters);
+ DETACH(SetTapePosition);
+ DETACH(SetTextAlign);
+ DETACH(SetTextCharacterExtra);
+ DETACH(SetTextColor);
+ DETACH(SetTextJustification);
+ DETACH(SetThreadAffinityMask);
+ DETACH(SetThreadContext);
+ DETACH(SetThreadDesktop);
+ DETACH(SetThreadIdealProcessor);
+#if(WINVER >= 0x0500)
+ DETACH(SetThreadLocale);
+#endif // (WINVER >= 0x0500)
+ DETACH(SetThreadPriority);
+ DETACH(SetThreadPriorityBoost);
+ DETACH(SetTimeZoneInformation);
+ DETACH(SetTimer);
+ DETACH(SetUnhandledExceptionFilter);
+ DETACH(SetUserObjectInformationA);
+ DETACH(SetUserObjectInformationW);
+ DETACH(SetUserObjectSecurity);
+ DETACH(SetViewportExtEx);
+ DETACH(SetViewportOrgEx);
+ DETACH(SetVolumeLabelA);
+ DETACH(SetVolumeLabelW);
+ DETACH(SetWaitableTimer);
+ DETACH(SetWinMetaFileBits);
+ DETACH(SetWindowContextHelpId);
+ DETACH(SetWindowExtEx);
+ DETACH(SetWindowLongA);
+ DETACH(SetWindowLongW);
+ DETACH(SetWindowOrgEx);
+ DETACH(SetWindowPlacement);
+ DETACH(SetWindowPos);
+ DETACH(SetWindowRgn);
+ DETACH(SetWindowTextA);
+ DETACH(SetWindowTextW);
+ DETACH(SetWindowWord);
+ DETACH(SetWindowsHookA);
+ DETACH(SetWindowsHookExA);
+ DETACH(SetWindowsHookExW);
+ DETACH(SetWindowsHookW);
+ DETACH(SetWorldTransform);
+ DETACH(SetupComm);
+ DETACH(ShowCaret);
+ DETACH(ShowCursor);
+ DETACH(ShowOwnedPopups);
+ DETACH(ShowScrollBar);
+ DETACH(ShowWindow);
+ DETACH(ShowWindowAsync);
+ DETACH(SignalObjectAndWait);
+ DETACH(SizeofResource);
+ DETACH(SleepEx);
+ DETACH(StartDocA);
+ DETACH(StartDocW);
+ DETACH(StartPage);
+ DETACH(StgCreateDocfile);
+ DETACH(StgCreateDocfileOnILockBytes);
+ DETACH(StgCreatePropSetStg);
+ DETACH(StgCreatePropStg);
+ DETACH(StgCreateStorageEx);
+ DETACH(StgGetIFillLockBytesOnFile);
+ DETACH(StgGetIFillLockBytesOnILockBytes);
+ DETACH(StgIsStorageFile);
+ DETACH(StgIsStorageILockBytes);
+ DETACH(StgOpenAsyncDocfileOnIFillLockBytes);
+ DETACH(StgOpenPropStg);
+ DETACH(StgOpenStorage);
+ DETACH(StgOpenStorageEx);
+ DETACH(StgOpenStorageOnILockBytes);
+ DETACH(StgSetTimes);
+ DETACH(StretchBlt);
+ DETACH(StretchDIBits);
+ DETACH(StringFromCLSID);
+ DETACH(StringFromGUID2);
+ DETACH(StringFromIID);
+ DETACH(StrokeAndFillPath);
+ DETACH(StrokePath);
+ DETACH(SubtractRect);
+ DETACH(SuspendThread);
+ DETACH(SwapBuffers);
+ DETACH(SwapMouseButton);
+ DETACH(SwitchDesktop);
+ DETACH(SwitchToFiber);
+ DETACH(SwitchToThread);
+ DETACH(SystemParametersInfoA);
+ DETACH(SystemParametersInfoW);
+ DETACH(SystemTimeToFileTime);
+ DETACH(SystemTimeToTzSpecificLocalTime);
+ DETACH(TabbedTextOutA);
+ DETACH(TabbedTextOutW);
+ DETACH(TerminateProcess);
+ DETACH(TerminateThread);
+ DETACH(TextOutA);
+ DETACH(TextOutW);
+ DETACH(TileWindows);
+ DETACH(ToAscii);
+ DETACH(ToAsciiEx);
+ DETACH(ToUnicode);
+ DETACH(ToUnicodeEx);
+ DETACH(TrackMouseEvent);
+ DETACH(TrackPopupMenu);
+ DETACH(TrackPopupMenuEx);
+ DETACH(TransactNamedPipe);
+ DETACH(TranslateAcceleratorA);
+ DETACH(TranslateAcceleratorW);
+ DETACH(TranslateCharsetInfo);
+ DETACH(TranslateMDISysAccel);
+ DETACH(TranslateMessage);
+ DETACH(TransmitCommChar);
+#if DETOUR_TryEnterCriticalSection_EVEN_IF_IT_EXERCISES_A_BUG_IN_RtlLookupFunctionTable
+ DETACH(TryEnterCriticalSection);
+#endif
+ DETACH(UnhookWindowsHook);
+ DETACH(UnhookWindowsHookEx);
+ DETACH(UnionRect);
+ DETACH(UnloadKeyboardLayout);
+ DETACH(UnlockFile);
+ DETACH(UnlockFileEx);
+ DETACH(UnmapViewOfFile);
+ DETACH(UnpackDDElParam);
+ DETACH(UnrealizeObject);
+ DETACH(UnregisterClassA);
+ DETACH(UnregisterClassW);
+ DETACH(UnregisterHotKey);
+ DETACH(UpdateColors);
+ DETACH(UpdateResourceA);
+ DETACH(UpdateResourceW);
+ DETACH(UpdateWindow);
+ DETACH(ValidateRect);
+ DETACH(ValidateRgn);
+ DETACH(VerLanguageNameA);
+ DETACH(VerLanguageNameW);
+ DETACH(VirtualAllocEx);
+ DETACH(VirtualFreeEx);
+ DETACH(VirtualProtectEx);
+ DETACH(VirtualQueryEx);
+ DETACH(VkKeyScanA);
+ DETACH(VkKeyScanExA);
+ DETACH(VkKeyScanExW);
+ DETACH(VkKeyScanW);
+ DETACH(WSAAccept);
+ DETACH(WSAAddressToStringA);
+ DETACH(WSAAddressToStringW);
+ DETACH(WSAAsyncGetHostByAddr);
+ DETACH(WSAAsyncGetHostByName);
+ DETACH(WSAAsyncGetProtoByName);
+ DETACH(WSAAsyncGetProtoByNumber);
+ DETACH(WSAAsyncGetServByName);
+ DETACH(WSAAsyncGetServByPort);
+ DETACH(WSAAsyncSelect);
+ DETACH(WSACancelAsyncRequest);
+ DETACH(WSACancelBlockingCall);
+ DETACH(WSACleanup);
+ DETACH(WSACloseEvent);
+ DETACH(WSAConnect);
+ DETACH(WSACreateEvent);
+ DETACH(WSADuplicateSocketA);
+ DETACH(WSADuplicateSocketW);
+ DETACH(WSAEnumNameSpaceProvidersA);
+ DETACH(WSAEnumNameSpaceProvidersW);
+ DETACH(WSAEnumNetworkEvents);
+ DETACH(WSAEnumProtocolsA);
+ DETACH(WSAEnumProtocolsW);
+ DETACH(WSAEventSelect);
+ DETACH(WSAGetOverlappedResult);
+ DETACH(WSAGetQOSByName);
+ DETACH(WSAGetServiceClassInfoA);
+ DETACH(WSAGetServiceClassInfoW);
+ DETACH(WSAGetServiceClassNameByClassIdA);
+ DETACH(WSAGetServiceClassNameByClassIdW);
+ DETACH(WSAHtonl);
+ DETACH(WSAHtons);
+ DETACH(WSAInstallServiceClassA);
+ DETACH(WSAInstallServiceClassW);
+ DETACH(WSAIoctl);
+ DETACH(WSAIsBlocking);
+ DETACH(WSAJoinLeaf);
+ DETACH(WSALookupServiceBeginA);
+ DETACH(WSALookupServiceBeginW);
+ DETACH(WSALookupServiceEnd);
+ DETACH(WSALookupServiceNextA);
+ DETACH(WSALookupServiceNextW);
+ DETACH(WSANtohl);
+ DETACH(WSANtohs);
+ DETACH(WSAProviderConfigChange);
+ DETACH(WSARecv);
+ DETACH(WSARecvDisconnect);
+ DETACH(WSARecvFrom);
+ DETACH(WSARemoveServiceClass);
+ DETACH(WSAResetEvent);
+ DETACH(WSASend);
+ DETACH(WSASendDisconnect);
+ DETACH(WSASendTo);
+ DETACH(WSASetBlockingHook);
+ DETACH(WSASetEvent);
+ DETACH(WSASetServiceA);
+ DETACH(WSASetServiceW);
+ DETACH(WSASocketA);
+ DETACH(WSASocketW);
+ DETACH(WSAStartup);
+ DETACH(WSAStringToAddressA);
+ DETACH(WSAStringToAddressW);
+ DETACH(WSAUnhookBlockingHook);
+ DETACH(WSAWaitForMultipleEvents);
+ DETACH(WaitCommEvent);
+#if !defined(DETOURS_ARM)
+ DETACH(WaitForDebugEvent);
+#endif // !DETOURS_ARM
+ DETACH(WaitForInputIdle);
+ DETACH(WaitForMultipleObjects);
+ DETACH(WaitForMultipleObjectsEx);
+ DETACH(WaitForSingleObject);
+ DETACH(WaitForSingleObjectEx);
+ DETACH(WaitMessage);
+ DETACH(WaitNamedPipeA);
+ DETACH(WaitNamedPipeW);
+ DETACH(WidenPath);
+ DETACH(WinExec);
+ DETACH(WinHelpA);
+ DETACH(WinHelpW);
+ DETACH(WindowFromDC);
+ DETACH(WindowFromPoint);
+ DETACH(WriteClassStg);
+ DETACH(WriteClassStm);
+ DETACH(WriteConsoleA);
+ DETACH(WriteConsoleInputA);
+ DETACH(WriteConsoleInputW);
+ DETACH(WriteConsoleOutputA);
+ DETACH(WriteConsoleOutputAttribute);
+ DETACH(WriteConsoleOutputCharacterA);
+ DETACH(WriteConsoleOutputCharacterW);
+ DETACH(WriteConsoleOutputW);
+ DETACH(WriteConsoleW);
+ DETACH(WriteFile);
+ DETACH(WriteFileEx);
+ DETACH(WriteFmtUserTypeStg);
+ DETACH(WritePrivateProfileSectionA);
+ DETACH(WritePrivateProfileSectionW);
+ DETACH(WritePrivateProfileStringA);
+ DETACH(WritePrivateProfileStringW);
+ DETACH(WritePrivateProfileStructA);
+ DETACH(WritePrivateProfileStructW);
+ DETACH(WriteProcessMemory);
+ DETACH(WriteProfileSectionA);
+ DETACH(WriteProfileSectionW);
+ DETACH(WriteProfileStringA);
+ DETACH(WriteProfileStringW);
+ DETACH(WriteTapemark);
+ DETACH(__WSAFDIsSet);
+ DETACH(_hread);
+ DETACH(_hwrite);
+ DETACH(_lclose);
+ DETACH(_lcreat);
+ DETACH(_llseek);
+ DETACH(_lopen);
+ DETACH(_lread);
+ DETACH(_lwrite);
+ DETACH(accept);
+ DETACH(bind);
+ DETACH(closesocket);
+ DETACH(connect);
+ DETACH(gethostbyaddr);
+ DETACH(gethostbyname);
+ DETACH(gethostname);
+ DETACH(getpeername);
+ DETACH(getprotobyname);
+ DETACH(getprotobynumber);
+ DETACH(getservbyname);
+ DETACH(getservbyport);
+ DETACH(getsockname);
+ DETACH(getsockopt);
+ DETACH(htonl);
+ DETACH(htons);
+ DETACH(inet_addr);
+ DETACH(inet_ntoa);
+ DETACH(ioctlsocket);
+ DETACH(keybd_event);
+ DETACH(listen);
+ DETACH(mouse_event);
+ DETACH(ntohl);
+ DETACH(ntohs);
+ DETACH(recv);
+ DETACH(recvfrom);
+ DETACH(select);
+ DETACH(send);
+ DETACH(sendto);
+ DETACH(setsockopt);
+ DETACH(shutdown);
+ DETACH(socket);
+
+ if (DetourTransactionCommit() != 0) {
+ PVOID *ppbFailedPointer = NULL;
+ LONG error = DetourTransactionCommitEx(&ppbFailedPointer);
+
+ printf("traceapi.dll: Detach transaction failed to commit. Error %ld (%p/%p)",
+ error, ppbFailedPointer, *ppbFailedPointer);
+ return error;
+ }
+ return 0;
+}
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/traceapi/testapi.cpp b/ext/detours/samples/traceapi/testapi.cpp
new file mode 100644
index 0000000..d85fc02
--- /dev/null
+++ b/ext/detours/samples/traceapi/testapi.cpp
@@ -0,0 +1,94 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (testapi.cpp of testapi.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#include "trcapi.cpp"
+
+#if (_MSC_VER < 1299)
+typedef ULONG * PULONG_PTR;
+typedef ULONG ULONG_PTR;
+typedef LONG * PLONG_PTR;
+typedef LONG LONG_PTR;
+#endif
+
+VOID SyelogOpen(PCSTR pszIdentifier, BYTE nFacility)
+{
+ (void)pszIdentifier;
+ (void)nFacility;
+}
+
+VOID SyelogExV(BOOL fTerminate, BYTE nSeverity, PCSTR pszMsgf, va_list args)
+{
+ (void)fTerminate;
+
+ CHAR szBuffer[1024];
+ PCHAR psz = szBuffer;
+ BOOL fLf = FALSE;
+
+ StringCchPrintfA(psz, szBuffer + sizeof(szBuffer) - psz, "--.%02x: ", nSeverity);
+ while (*psz) {
+ psz++;
+ }
+
+ StringCchVPrintfA(psz, szBuffer + sizeof(szBuffer) - psz, pszMsgf, args);
+ for (psz = szBuffer; *psz; psz++) {
+ if (*psz == '\n') {
+ if (fLf) {
+ *psz = '\0';
+ break;
+ }
+ fLf = TRUE;
+ }
+ }
+ if (!fLf) {
+ *psz++ = '\n';
+ *psz = '\0';
+ }
+ printf("%s", szBuffer);
+ Real_OutputDebugStringA(szBuffer);
+}
+
+VOID SyelogV(BYTE nSeverity, PCSTR pszMsgf, va_list args)
+{
+ SyelogExV(FALSE, nSeverity, pszMsgf, args);
+}
+
+VOID Syelog(BYTE nSeverity, PCSTR pszMsgf, ...)
+{
+ va_list args;
+ va_start(args, pszMsgf);
+ SyelogExV(FALSE, nSeverity, pszMsgf, args);
+ va_end(args);
+}
+
+VOID SyelogEx(BOOL fTerminate, BYTE nSeverity, PCSTR pszMsgf, ...)
+{
+ va_list args;
+ va_start(args, pszMsgf);
+ SyelogExV(fTerminate, nSeverity, pszMsgf, args);
+ va_end(args);
+}
+
+VOID SyelogClose(BOOL fTerminate)
+{
+ (void)fTerminate;
+}
+
+DWORD main(int argc, char **argv)
+{
+ (void)argc;
+ (void)argv;
+
+ printf("testapi: Starting\n");
+ ProcessAttach(NULL);
+ Sleep(100);
+ ProcessDetach(NULL);
+
+ return 0;
+}
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/ext/detours/samples/traceapi/trcapi.cpp b/ext/detours/samples/traceapi/trcapi.cpp
new file mode 100644
index 0000000..e7b7240
--- /dev/null
+++ b/ext/detours/samples/traceapi/trcapi.cpp
@@ -0,0 +1,473 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (trcapi.cpp of trcapi.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#undef WIN32_LEAN_AND_MEAN
+#define _WIN32_WINNT 0x400
+#define WIN32
+#define NT
+#define _WINSOCK_DEPRECATED_NO_WARNINGS
+
+#define DBG_TRACE 0
+
+#if _MSC_VER >= 1300
+#include <winsock2.h>
+#endif
+#include <windows.h>
+#include <stdio.h>
+#pragma warning(push)
+#if _MSC_VER > 1400
+#pragma warning(disable:6102 6103) // /analyze warnings
+#endif
+#include <strsafe.h>
+#pragma warning(pop)
+#include "detours.h"
+#include "syelog.h"
+
+#if (_MSC_VER < 1299)
+#define LONG_PTR LONG
+#define ULONG_PTR ULONG
+#define PLONG_PTR PLONG
+#define PULONG_PTR PULONG
+#define INT_PTR INT
+#define UINT_PTR UINT
+#define PINT_PTR PINT
+#define PUINT_PTR PUINT
+#define DWORD_PTR DWORD
+#define PDWORD_PTR PDWORD
+#endif
+
+#pragma warning(disable:4996) // We don't care about deprecated APIs.
+
+//////////////////////////////////////////////////////////////////////////////
+#pragma warning(disable:4127) // Many of our asserts are constants.
+
+#define ASSERT_ALWAYS(x) \
+ do { \
+ if (!(x)) { \
+ AssertMessage(#x, __FILE__, __LINE__); \
+ DebugBreak(); \
+ } \
+ } while (0)
+
+#ifndef NDEBUG
+#define ASSERT(x) ASSERT_ALWAYS(x)
+#else
+#define ASSERT(x)
+#endif
+
+#define UNUSED(c) (c) = (c)
+
+//////////////////////////////////////////////////////////////////////////////
+static HMODULE s_hInst = NULL;
+static WCHAR s_wzDllPath[MAX_PATH];
+static CHAR s_szDllPath[MAX_PATH];
+
+BOOL ProcessEnumerate();
+BOOL InstanceEnumerate(HINSTANCE hInst);
+
+VOID _PrintEnter(const CHAR *psz, ...);
+VOID _PrintExit(const CHAR *psz, ...);
+VOID _Print(const CHAR *psz, ...);
+VOID _VPrint(PCSTR msg, va_list args, PCHAR pszBuf, LONG cbBuf);
+
+VOID AssertMessage(CONST PCHAR pszMsg, CONST PCHAR pszFile, ULONG nLine);
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// Trampolines
+//
+extern "C" {
+ // Trampolines for SYELOG library.
+ //
+ extern HANDLE (WINAPI *Real_CreateFileW)(LPCWSTR a0, DWORD a1, DWORD a2,
+ LPSECURITY_ATTRIBUTES a3, DWORD a4, DWORD a5,
+ HANDLE a6);
+ extern BOOL (WINAPI *Real_WriteFile)(HANDLE hFile,
+ LPCVOID lpBuffer,
+ DWORD nNumberOfBytesToWrite,
+ LPDWORD lpNumberOfBytesWritten,
+ LPOVERLAPPED lpOverlapped);
+ extern BOOL (WINAPI *Real_FlushFileBuffers)(HANDLE hFile);
+ extern BOOL (WINAPI *Real_CloseHandle)(HANDLE hObject);
+ extern BOOL (WINAPI *Real_WaitNamedPipeW)(LPCWSTR lpNamedPipeName, DWORD nTimeOut);
+ extern BOOL (WINAPI *Real_SetNamedPipeHandleState)(HANDLE hNamedPipe,
+ LPDWORD lpMode,
+ LPDWORD lpMaxCollectionCount,
+ LPDWORD lpCollectDataTimeout);
+ extern DWORD (WINAPI *Real_GetCurrentProcessId)(VOID);
+ extern VOID (WINAPI *Real_GetSystemTimeAsFileTime)(LPFILETIME lpSystemTimeAsFileTime);
+
+ VOID ( WINAPI * Real_InitializeCriticalSection)(LPCRITICAL_SECTION lpSection)
+ = InitializeCriticalSection;
+ VOID ( WINAPI * Real_EnterCriticalSection)(LPCRITICAL_SECTION lpSection)
+ = EnterCriticalSection;
+ VOID ( WINAPI * Real_LeaveCriticalSection)(LPCRITICAL_SECTION lpSection)
+ = LeaveCriticalSection;
+}
+
+#include "_win32.cpp"
+
+////////////////////////////////////////////////////////////// Logging System.
+//
+static BOOL s_bLog = FALSE;
+static LONG s_nTlsIndent = -1;
+static LONG s_nTlsThread = -1;
+static LONG s_nThreadCnt = 0;
+
+VOID _PrintEnter(const CHAR *psz, ...)
+{
+ DWORD dwErr = GetLastError();
+
+ LONG nIndent = 0;
+ LONG nThread = 0;
+ if (s_nTlsIndent >= 0) {
+ nIndent = (LONG)(LONG_PTR)TlsGetValue(s_nTlsIndent);
+ TlsSetValue(s_nTlsIndent, (PVOID)(LONG_PTR)(nIndent + 1));
+ }
+ if (s_nTlsThread >= 0) {
+ nThread = (LONG)(LONG_PTR)TlsGetValue(s_nTlsThread);
+ }
+
+ if (s_bLog && psz) {
+ CHAR szBuf[1024];
+ PCHAR pszBuf = szBuf;
+ PCHAR pszEnd = szBuf + ARRAYSIZE(szBuf) - 1;
+ LONG nLen = (nIndent > 0) ? (nIndent < 35 ? nIndent * 2 : 70) : 0;
+ *pszBuf++ = (CHAR)('0' + ((nThread / 100) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 10) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 1) % 10));
+ *pszBuf++ = ' ';
+ while (nLen-- > 0) {
+ *pszBuf++ = ' ';
+ }
+ *pszBuf++ = '+';
+ *pszBuf = '\0';
+
+ va_list args;
+ va_start(args, psz);
+
+ while ((*pszBuf++ = *psz++) != 0 && pszBuf < pszEnd) {
+ // Copy characters.
+ }
+ *pszEnd = '\0';
+ SyelogV(SYELOG_SEVERITY_INFORMATION, szBuf, args);
+
+ va_end(args);
+ }
+ SetLastError(dwErr);
+}
+
+VOID _PrintExit(const CHAR *psz, ...)
+{
+ DWORD dwErr = GetLastError();
+
+ LONG nIndent = 0;
+ LONG nThread = 0;
+ if (s_nTlsIndent >= 0) {
+ nIndent = (LONG)(LONG_PTR)TlsGetValue(s_nTlsIndent) - 1;
+ ASSERT_ALWAYS(nIndent >= 0);
+ TlsSetValue(s_nTlsIndent, (PVOID)(LONG_PTR)nIndent);
+ }
+ if (s_nTlsThread >= 0) {
+ nThread = (LONG)(LONG_PTR)TlsGetValue(s_nTlsThread);
+ }
+
+ if (s_bLog && psz) {
+ CHAR szBuf[1024];
+ PCHAR pszEnd = szBuf + ARRAYSIZE(szBuf) - 1;
+ PCHAR pszBuf = szBuf;
+ LONG nLen = (nIndent > 0) ? (nIndent < 35 ? nIndent * 2 : 70) : 0;
+ *pszBuf++ = (CHAR)('0' + ((nThread / 100) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 10) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 1) % 10));
+ *pszBuf++ = ' ';
+ while (nLen-- > 0) {
+ *pszBuf++ = ' ';
+ }
+ *pszBuf++ = '-';
+ *pszBuf = '\0';
+
+ va_list args;
+ va_start(args, psz);
+
+ while ((*pszBuf++ = *psz++) != 0 && pszBuf < pszEnd) {
+ // Copy characters.
+ }
+ *pszEnd = '\0';
+ SyelogV(SYELOG_SEVERITY_INFORMATION, szBuf, args);
+
+ va_end(args);
+ }
+ SetLastError(dwErr);
+}
+
+VOID _Print(const CHAR *psz, ...)
+{
+ DWORD dwErr = GetLastError();
+
+ LONG nIndent = 0;
+ LONG nThread = 0;
+ if (s_nTlsIndent >= 0) {
+ nIndent = (LONG)(LONG_PTR)TlsGetValue(s_nTlsIndent);
+ }
+ if (s_nTlsThread >= 0) {
+ nThread = (LONG)(LONG_PTR)TlsGetValue(s_nTlsThread);
+ }
+
+ if (s_bLog && psz) {
+ CHAR szBuf[1024];
+ PCHAR pszEnd = szBuf + ARRAYSIZE(szBuf) - 1;
+ PCHAR pszBuf = szBuf;
+ LONG nLen = (nIndent > 0) ? (nIndent < 35 ? nIndent * 2 : 70) : 0;
+ *pszBuf++ = (CHAR)('0' + ((nThread / 100) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 10) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 1) % 10));
+ *pszBuf++ = ' ';
+ while (nLen-- > 0) {
+ *pszBuf++ = ' ';
+ }
+ *pszBuf = '\0';
+
+ va_list args;
+ va_start(args, psz);
+
+ while ((*pszBuf++ = *psz++) != 0 && pszBuf < pszEnd) {
+ // Copy characters.
+ }
+ *pszEnd = '\0';
+ SyelogV(SYELOG_SEVERITY_INFORMATION, szBuf, args);
+
+ va_end(args);
+ }
+ SetLastError(dwErr);
+}
+
+VOID AssertMessage(CONST PCHAR pszMsg, CONST PCHAR pszFile, ULONG nLine)
+{
+ Syelog(SYELOG_SEVERITY_FATAL,
+ "ASSERT(%s) failed in %s, line %d.\n", pszMsg, pszFile, nLine);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+PIMAGE_NT_HEADERS NtHeadersForInstance(HINSTANCE hInst)
+{
+ PIMAGE_DOS_HEADER pDosHeader = (PIMAGE_DOS_HEADER)hInst;
+ __try {
+ if (pDosHeader->e_magic != IMAGE_DOS_SIGNATURE) {
+ SetLastError(ERROR_BAD_EXE_FORMAT);
+ return NULL;
+ }
+
+ PIMAGE_NT_HEADERS pNtHeader = (PIMAGE_NT_HEADERS)((PBYTE)pDosHeader +
+ pDosHeader->e_lfanew);
+ if (pNtHeader->Signature != IMAGE_NT_SIGNATURE) {
+ SetLastError(ERROR_INVALID_EXE_SIGNATURE);
+ return NULL;
+ }
+ if (pNtHeader->FileHeader.SizeOfOptionalHeader == 0) {
+ SetLastError(ERROR_EXE_MARKED_INVALID);
+ return NULL;
+ }
+ return pNtHeader;
+ } __except(EXCEPTION_EXECUTE_HANDLER) {
+ }
+ SetLastError(ERROR_EXE_MARKED_INVALID);
+
+ return NULL;
+}
+
+BOOL InstanceEnumerate(HINSTANCE hInst)
+{
+ WCHAR wzDllName[MAX_PATH];
+
+ PIMAGE_NT_HEADERS pinh = NtHeadersForInstance(hInst);
+ if (pinh && Real_GetModuleFileNameW(hInst, wzDllName, ARRAYSIZE(wzDllName))) {
+ Syelog(SYELOG_SEVERITY_INFORMATION, "### %p: %ls\n", hInst, wzDllName);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+BOOL ProcessEnumerate()
+{
+ Syelog(SYELOG_SEVERITY_INFORMATION,
+ "######################################################### Binaries\n");
+
+ PBYTE pbNext;
+ for (PBYTE pbRegion = (PBYTE)0x10000;; pbRegion = pbNext) {
+ MEMORY_BASIC_INFORMATION mbi;
+ ZeroMemory(&mbi, sizeof(mbi));
+
+ if (VirtualQuery((PVOID)pbRegion, &mbi, sizeof(mbi)) <= 0) {
+ break;
+ }
+ pbNext = (PBYTE)mbi.BaseAddress + mbi.RegionSize;
+
+ // Skip free regions, reserver regions, and guard pages.
+ //
+ if (mbi.State == MEM_FREE || mbi.State == MEM_RESERVE) {
+ continue;
+ }
+ if (mbi.Protect & PAGE_GUARD || mbi.Protect & PAGE_NOCACHE) {
+ continue;
+ }
+ if (mbi.Protect == PAGE_NOACCESS) {
+ continue;
+ }
+
+ // Skip over regions from the same allocation...
+ {
+ MEMORY_BASIC_INFORMATION mbiStep;
+
+ while (VirtualQuery((PVOID)pbNext, &mbiStep, sizeof(mbiStep)) > 0) {
+ if ((PBYTE)mbiStep.AllocationBase != pbRegion) {
+ break;
+ }
+ pbNext = (PBYTE)mbiStep.BaseAddress + mbiStep.RegionSize;
+ mbi.Protect |= mbiStep.Protect;
+ }
+ }
+
+ WCHAR wzDllName[MAX_PATH];
+ PIMAGE_NT_HEADERS pinh = NtHeadersForInstance((HINSTANCE)pbRegion);
+
+ if (pinh &&
+ Real_GetModuleFileNameW((HINSTANCE)pbRegion,wzDllName,ARRAYSIZE(wzDllName))) {
+
+ Syelog(SYELOG_SEVERITY_INFORMATION,
+ "### %p..%p: %ls\n", pbRegion, pbNext, wzDllName);
+ }
+ else {
+ Syelog(SYELOG_SEVERITY_INFORMATION,
+ "### %p..%p: State=%04x, Protect=%08x\n",
+ pbRegion, pbNext, mbi.State, mbi.Protect);
+ }
+ }
+ Syelog(SYELOG_SEVERITY_INFORMATION, "###\n");
+
+ LPVOID lpvEnv = Real_GetEnvironmentStrings();
+ Syelog(SYELOG_SEVERITY_INFORMATION, "### Env= %08x [%08x %08x]\n",
+ lpvEnv, ((PVOID*)lpvEnv)[0], ((PVOID*)lpvEnv)[1]);
+
+ return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// DLL module information
+//
+BOOL ThreadAttach(HMODULE hDll)
+{
+ (void)hDll;
+
+ if (s_nTlsIndent >= 0) {
+ TlsSetValue(s_nTlsIndent, (PVOID)0);
+ }
+ if (s_nTlsThread >= 0) {
+ LONG nThread = InterlockedIncrement(&s_nThreadCnt);
+ TlsSetValue(s_nTlsThread, (PVOID)(LONG_PTR)nThread);
+ }
+ return TRUE;
+}
+
+BOOL ThreadDetach(HMODULE hDll)
+{
+ (void)hDll;
+
+ if (s_nTlsIndent >= 0) {
+ TlsSetValue(s_nTlsIndent, (PVOID)0);
+ }
+ if (s_nTlsThread >= 0) {
+ TlsSetValue(s_nTlsThread, (PVOID)0);
+ }
+ return TRUE;
+}
+
+BOOL ProcessAttach(HMODULE hDll)
+{
+ s_bLog = FALSE;
+ s_nTlsIndent = TlsAlloc();
+ s_nTlsThread = TlsAlloc();
+ ThreadAttach(hDll);
+
+ WCHAR wzExeName[MAX_PATH];
+
+ s_hInst = hDll;
+ Real_GetModuleFileNameW(hDll, s_wzDllPath, ARRAYSIZE(s_wzDllPath));
+ Real_GetModuleFileNameW(NULL, wzExeName, ARRAYSIZE(wzExeName));
+ StringCchPrintfA(s_szDllPath, ARRAYSIZE(s_szDllPath), "%ls", s_wzDllPath);
+
+ SyelogOpen("trcapi" DETOURS_STRINGIFY(DETOURS_BITS), SYELOG_FACILITY_APPLICATION);
+ ProcessEnumerate();
+
+ LONG error = AttachDetours();
+ if (error != NO_ERROR) {
+ Syelog(SYELOG_SEVERITY_FATAL, "### Error attaching detours: %d\n", error);
+ }
+
+ s_bLog = TRUE;
+ return TRUE;
+}
+
+BOOL ProcessDetach(HMODULE hDll)
+{
+ ThreadDetach(hDll);
+ s_bLog = FALSE;
+
+ LONG error = DetachDetours();
+ if (error != NO_ERROR) {
+ Syelog(SYELOG_SEVERITY_FATAL, "### Error detaching detours: %d\n", error);
+ }
+
+ Syelog(SYELOG_SEVERITY_NOTICE, "### Closing.\n");
+ SyelogClose(FALSE);
+
+ if (s_nTlsIndent >= 0) {
+ TlsFree(s_nTlsIndent);
+ }
+ if (s_nTlsThread >= 0) {
+ TlsFree(s_nTlsThread);
+ }
+ return TRUE;
+}
+
+BOOL APIENTRY DllMain(HINSTANCE hModule, DWORD dwReason, PVOID lpReserved)
+{
+ (void)hModule;
+ (void)lpReserved;
+ BOOL ret;
+
+ if (DetourIsHelperProcess()) {
+ return TRUE;
+ }
+
+ switch (dwReason) {
+ case DLL_PROCESS_ATTACH:
+ DetourRestoreAfterWith();
+ OutputDebugStringA("trcapi" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
+ " DllMain DLL_PROCESS_ATTACH\n");
+ return ProcessAttach(hModule);
+ case DLL_PROCESS_DETACH:
+ ret = ProcessDetach(hModule);
+ OutputDebugStringA("trcapi" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
+ " DllMain DLL_PROCESS_DETACH\n");
+ return ret;
+ case DLL_THREAD_ATTACH:
+ OutputDebugStringA("trcapi" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
+ " DllMain DLL_THREAD_ATTACH\n");
+ return ThreadAttach(hModule);
+ case DLL_THREAD_DETACH:
+ OutputDebugStringA("trcapi" DETOURS_STRINGIFY(DETOURS_BITS) ".dll:"
+ " DllMain DLL_THREAD_DETACH\n");
+ return ThreadDetach(hModule);
+ }
+ return TRUE;
+}
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/traceapi/trcapi.rc b/ext/detours/samples/traceapi/trcapi.rc
new file mode 100644
index 0000000..dc1975f
--- /dev/null
+++ b/ext/detours/samples/traceapi/trcapi.rc
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Version information for trcapi.rc.
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include "detver.h"
+
+#define VER_INTERNALNAME_STR "trcapi" DETOURS_STRINGIFY(DETOURS_BITS)
+#define VER_ORIGINALFILENAME_STR "trcapi" DETOURS_STRINGIFY(DETOURS_BITS) ".dll"
+#define VER_FILEDESCRIPTION_STR "Detours Win32 API Tracing Module"
+#define VER_COMPANYNAME_STR "Microsoft Corporation"
+
+#include "common.ver"
diff --git a/ext/detours/samples/tracebld/Makefile b/ext/detours/samples/tracebld/Makefile
new file mode 100644
index 0000000..182655d
--- /dev/null
+++ b/ext/detours/samples/tracebld/Makefile
@@ -0,0 +1,157 @@
+##############################################################################
+##
+## Utility to registry and file access APIs.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+LIBS=$(LIBS) kernel32.lib
+
+##############################################################################
+
+all: dirs \
+ $(BIND)\trcbld$(DETOURS_BITS).dll \
+ $(BIND)\tracebld.exe \
+ \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\trcbld$(DETOURS_BITS).bsc \
+ $(OBJD)\tracebld.bsc \
+!ENDIF
+ option
+
+##############################################################################
+
+clean:
+ -del *~ test.txt log.*.xml 2>nul
+ -del $(BIND)\tracebld.* $(BIND)\trcbld*.* 2>nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+##############################################################################
+
+$(OBJD)\trcbld.obj : trcbld.cpp
+$(OBJD)\trcbld.res : trcbld.rc
+$(BIND)\trcbld$(DETOURS_BITS).dll : $(OBJD)\trcbld.obj $(OBJD)\trcbld.res $(DEPS)
+ cl /LD $(CFLAGS) /Fe$@ /Fd$(@R).pdb \
+ $(OBJD)\trcbld.obj $(OBJD)\trcbld.res \
+ /link $(LINKFLAGS) /release /subsystem:console \
+ /export:DetourFinishHelperProcess,@1,NONAME \
+ $(LIBS)
+
+$(OBJD)\trcbld$(DETOURS_BITS).bsc : $(OBJD)\trcbld.obj
+ bscmake /v /n /o $@ $(OBJD)\trcbld.sbr
+
+$(OBJD)\tracebld.obj : tracebld.cpp
+
+$(BIND)\tracebld.exe : $(OBJD)\tracebld.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb $(OBJD)\tracebld.obj \
+ /link $(LINKFLAGS) $(LIBS) \
+ /subsystem:console /fixed:no
+
+$(OBJD)\tracebld.bsc : $(OBJD)\tracebld.obj
+ bscmake /v /n /o $@ $(OBJD)\tracebld.sbr
+
+############################################### Install non-bit-size binaries.
+
+!IF "$(DETOURS_OPTION_PROCESSOR)" != ""
+
+$(OPTD)\trcbld$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\trcbld$(DETOURS_OPTION_BITS).pdb:
+
+$(BIND)\trcbld$(DETOURS_OPTION_BITS).dll : $(OPTD)\trcbld$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\trcbld$(DETOURS_OPTION_BITS).pdb : $(OPTD)\trcbld$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+
+option: \
+ $(BIND)\trcbld$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\trcbld$(DETOURS_OPTION_BITS).pdb \
+
+!ELSE
+
+option:
+
+!ENDIF
+
+##############################################################################
+
+test: all
+ -del log.*.xml 2>nul
+ $(BIND)\tracebld.exe /o:log %COMSPEC% /c dir
+ @echo -------- Log from log.00000000 ---------------------
+ type log.00000000.xml
+
+test0: all
+ -del log.*.xml 2>nul
+ $(BIND)\tracebld.exe /o:log %COMSPEC% /c xx.cmd
+ @echo -------- Log from log.00000000 ---------------------
+ type log.00000000.xml
+ @echo -------- Log from log.00000001 ---------------------
+ type log.00000001.xml
+
+test1: all
+ set FooBAR=1
+ -del log.*.xml 2>nul
+ @echo -------- Logging output to log ------------
+ -rmdir /q /s obj 2>nul
+ $(BIND)\tracebld.exe /o:log nmake.exe test2
+ @echo -------- Log from log.00000000 ---------------------
+ type log.00000000.xml | findstr /c:"t:Line"
+ type log.00000002.xml | findstr /c:"t:Line"
+
+test1d: all
+ -del log.*.xml 2>nul
+ @echo -------- Logging output to log ------------
+ -rmdir /q /s obj 2>nul
+ windbg -g -G -o $(BIND)\tracebld.exe /o:log nmake.exe test2
+ @echo -------- Log from log.00000000 ---------------------
+ type log.00000000.xml | findstr /c:"t:Line"
+ type log.00000002.xml | findstr /c:"t:Line"
+
+
+test2: all
+ -del foo.txt
+ echo foo1 >> foo.txt
+ echo foo2 >> foo.txt
+ echo foo3 >> foo.txt
+ -del log.foo.xml
+ -mkdir obj
+ cmd.exe /c "set Foo=BAR&&cmd.exe /c echo. FOO=%Foo%"
+ cl /LD $(CFLAGS) /Tp<< @<<obj\response.txt > log.foo.xml
+#include <windows.h>
+<<
+/Feobj\tbtest.exe /Fd$(@R).pdb $(DET_SRC)
+/link $(LINKFLAGS) /subsystem:console
+/export:DetourFinishHelperProcess,@1
+<<NOKEEP
+ type $(BIND)\trcbld.cpp | findstr CreateFile
+ echo int main() { return 0; } > obj\test.cpp
+ cl /c /Foobj\test.obj obj\test.cpp
+ -del tbtest.* 2>nul
+
+test3: all
+ -del log.*.xml 2>nul
+ @echo -------- Logging output to log ------------
+ -rmdir /q /s foo
+ $(BIND)\tracebld.exe /o:log xcopy.exe $(BIND)\trcbld.cpp foo\ /y
+ @echo -------- Log from log.00000000 ---------------------
+ type log.00000000.xml
+
+test4: all
+ -del log.*.xml 2>nul
+ echo int main() { return 0; } > obj\test.cpp
+ $(BIND)\tracebld.exe /o:log cl /c /Foobj\test.obj obj\test.cpp
+ @echo -------- Log from log.00000000 ---------------------
+ type log.00000000.xml
+
+################################################################# End of File.
diff --git a/ext/detours/samples/tracebld/tracebld.cpp b/ext/detours/samples/tracebld/tracebld.cpp
new file mode 100644
index 0000000..7573b4a
--- /dev/null
+++ b/ext/detours/samples/tracebld/tracebld.cpp
@@ -0,0 +1,569 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (tracebld.cpp of tracebld.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#pragma warning(push)
+#if _MSC_VER > 1400
+#pragma warning(disable:6102 6103) // /analyze warnings
+#endif
+#include <strsafe.h>
+#pragma warning(pop)
+#include <detours.h>
+#include "tracebld.h"
+
+#if (_MSC_VER < 1299)
+typedef ULONG * PULONG_PTR;
+typedef ULONG ULONG_PTR;
+typedef LONG * PLONG_PTR;
+typedef LONG LONG_PTR;
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+#pragma warning(disable:4127) // Many of our asserts are constants.
+
+#define ASSERT_ALWAYS(x) \
+ do { \
+ if (!(x)) { \
+ AssertMessage(#x, __FILE__, __LINE__); \
+ DebugBreak(); \
+ } \
+ } while (0)
+
+#ifndef NDEBUG
+#define ASSERT(x) ASSERT_ALWAYS(x)
+#else
+#define ASSERT(x)
+#endif
+
+#define UNUSED(c) (c) = (c)
+
+//////////////////////////////////////////////////////////////////////////////
+
+enum {
+ CLIENT_AWAITING_PIPE_ACCEPT = 0x21,
+ CLIENT_AWAITING_PIPE_DATA = 0x22,
+};
+
+typedef struct _CLIENT : OVERLAPPED
+{
+ HANDLE hPipe;
+ LONG nClient;
+ HANDLE hFile;
+ BOOL fAwaitingAccept;
+ PVOID Zero;
+ TBLOG_MESSAGE Message;
+
+ BOOL LogMessage(PTBLOG_MESSAGE pMessage, DWORD nBytes);
+ BOOL LogMessageV(PCHAR pszMsg, ...);
+} CLIENT, *PCLIENT;
+
+//////////////////////////////////////////////////////////////////////////////
+//
+CHAR s_szLogFile[MAX_PATH];
+CHAR s_szPipe[MAX_PATH];
+LONG s_nActiveClients = 0;
+LONG s_nTotalClients = 0;
+LONGLONG s_llStartTime;
+BOOL s_fVerbose = FALSE;
+TBLOG_PAYLOAD s_Payload;
+
+//////////////////////////////////////////////////////////////////////////////
+//
+VOID MyErrExit(PCSTR pszMsg)
+{
+ DWORD error = GetLastError();
+
+ fprintf(stderr, "TRACEBLD: Error %ld in %s.\n", error, pszMsg);
+ fflush(stderr);
+ exit(1);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+BOOL CLIENT::LogMessageV(PCHAR pszMsg, ...)
+{
+ DWORD cbWritten = 0;
+ CHAR szBuf[1024];
+ PCHAR pcchEnd = szBuf + ARRAYSIZE(szBuf) - 2;
+ PCHAR pcchCur = szBuf;
+ HRESULT hr;
+
+ va_list args;
+ va_start(args, pszMsg);
+ hr = StringCchVPrintfExA(pcchCur, pcchEnd - pcchCur,
+ &pcchCur, NULL, STRSAFE_NULL_ON_FAILURE,
+ pszMsg, args);
+ va_end(args);
+ if (FAILED(hr)) {
+ goto cleanup;
+ }
+
+ hr = StringCchPrintfExA(pcchCur, szBuf + (ARRAYSIZE(szBuf)) - pcchCur,
+ &pcchCur, NULL, STRSAFE_NULL_ON_FAILURE,
+ "\n");
+
+ cleanup:
+ WriteFile(hFile, szBuf, (DWORD)(pcchCur - szBuf), &cbWritten, NULL);
+ return TRUE;
+}
+
+BOOL CLIENT::LogMessage(PTBLOG_MESSAGE pMessage, DWORD nBytes)
+{
+ // Sanity check the size of the message.
+ //
+ if (nBytes > pMessage->nBytes) {
+ nBytes = pMessage->nBytes;
+ }
+ if (nBytes >= sizeof(*pMessage)) {
+ nBytes = sizeof(*pMessage) - 1;
+ }
+
+ // Don't log message if there isn't and message text.
+ //
+ DWORD cbWrite = nBytes - offsetof(TBLOG_MESSAGE, szMessage);
+ if (cbWrite <= 0 ) {
+ return TRUE;
+ }
+
+ if (s_fVerbose) {
+ printf("[%s]", pMessage->szMessage);
+ }
+
+ DWORD cbWritten = 0;
+ WriteFile(hFile, pMessage->szMessage, cbWrite, &cbWritten, NULL);
+ return TRUE;
+}
+
+BOOL CloseConnection(PCLIENT pClient)
+{
+ InterlockedDecrement(&s_nActiveClients);
+ if (pClient != NULL) {
+ if (pClient->hPipe != INVALID_HANDLE_VALUE) {
+ //FlushFileBuffers(pClient->hPipe);
+ if (!DisconnectNamedPipe(pClient->hPipe)) {
+ DWORD error = GetLastError();
+ pClient->LogMessageV("<!-- Error %d in DisconnectNamedPipe. -->\n", error);
+ }
+ CloseHandle(pClient->hPipe);
+ pClient->hPipe = INVALID_HANDLE_VALUE;
+ }
+ if (pClient->hFile != INVALID_HANDLE_VALUE) {
+ CloseHandle(pClient->hFile);
+ pClient->hFile = INVALID_HANDLE_VALUE;
+ }
+ GlobalFree(pClient);
+ pClient = NULL;
+ }
+ return TRUE;
+}
+
+// Creates a pipe instance and initiate an accept request.
+//
+PCLIENT CreatePipeConnection(HANDLE hCompletionPort, LONG nClient)
+{
+ HANDLE hPipe = CreateNamedPipeA(s_szPipe, // pipe name
+ PIPE_ACCESS_INBOUND | // read-only access
+ FILE_FLAG_OVERLAPPED, // overlapped mode
+ PIPE_TYPE_MESSAGE | // message-type pipe
+ PIPE_READMODE_MESSAGE | // message read mode
+ PIPE_WAIT, // blocking mode
+ PIPE_UNLIMITED_INSTANCES, // unlimited instances
+ 0, // output buffer size
+ 0, // input buffer size
+ 20000, // client time-out
+ NULL); // no security attributes
+ if (hPipe == INVALID_HANDLE_VALUE) {
+ MyErrExit("CreateNamedPipe");
+ }
+
+ // Allocate the client data structure.
+ //
+ PCLIENT pClient = (PCLIENT) GlobalAlloc(GPTR, sizeof(CLIENT));
+ if (pClient == NULL) {
+ MyErrExit("GlobalAlloc pClient");
+ }
+
+ CHAR szLogFile[MAX_PATH];
+ StringCchPrintfA(szLogFile, ARRAYSIZE(szLogFile), "%s.%08d.xml", s_szLogFile, nClient);
+
+ ZeroMemory(pClient, sizeof(*pClient));
+ pClient->hPipe = hPipe;
+ pClient->nClient = nClient;
+ pClient->fAwaitingAccept = TRUE;
+ pClient->hFile = CreateFileA(szLogFile,
+ GENERIC_WRITE,
+ FILE_SHARE_READ,
+ NULL,
+ CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL |
+ FILE_FLAG_SEQUENTIAL_SCAN,
+ NULL);
+ if (pClient->hFile == INVALID_HANDLE_VALUE) {
+ fprintf(stderr, "TRACEBLD: Error opening output file: %s: %ld\n\n",
+ szLogFile, GetLastError());
+ fflush(stderr);
+ MyErrExit("CreateFile");
+ }
+
+ // Associate file with our complietion port.
+ //
+ if (!CreateIoCompletionPort(pClient->hPipe, hCompletionPort, (ULONG_PTR)pClient, 0)) {
+ MyErrExit("CreateIoComplietionPort pClient");
+ }
+
+ if (!ConnectNamedPipe(hPipe, pClient)) {
+ DWORD error = GetLastError();
+
+ if (error == ERROR_IO_PENDING) {
+ return NULL;
+ }
+ if (error == ERROR_PIPE_CONNECTED) {
+#if 0
+ pClient->LogMessageV("<!-- ConnectNamedPipe client already connected. -->");
+#endif
+ pClient->fAwaitingAccept = FALSE;
+ }
+ else if (error != ERROR_IO_PENDING &&
+ error != ERROR_PIPE_LISTENING) {
+
+ MyErrExit("ConnectNamedPipe");
+ }
+ }
+ else {
+ fprintf(stderr, "*** ConnectNamedPipe accepted immediately.\n");
+#if 0
+ pClient->LogMessageV("<!-- ConnectNamedPipe accepted immediately. -->");
+#endif
+ pClient->fAwaitingAccept = FALSE;
+ }
+ return pClient;
+}
+
+BOOL DoRead(PCLIENT pClient)
+{
+ SetLastError(NO_ERROR);
+ DWORD nBytes = 0;
+ BOOL b = ReadFile(pClient->hPipe, &pClient->Message, sizeof(pClient->Message),
+ &nBytes, pClient);
+
+ DWORD error = GetLastError();
+
+ if (b && error == NO_ERROR) {
+ return TRUE;
+ }
+ if (error == ERROR_BROKEN_PIPE) {
+ pClient->LogMessageV("<!-- **** ReadFile 002 *** ERROR_BROKEN_PIPE [%d] -->\n", nBytes);
+ CloseConnection(pClient);
+ return TRUE;
+ }
+ else if (error == ERROR_INVALID_HANDLE) {
+ // ?
+ pClient->LogMessageV("<!-- **** ReadFile 002 *** ERROR_INVALID_HANDLE -->\n");
+ // I have no idea why this happens. Our remedy is to drop the connection.
+ return TRUE;
+ }
+ else if (error != ERROR_IO_PENDING) {
+ if (b) {
+ pClient->LogMessageV("<!-- **** ReadFile 002 succeeded: %d -->\n", error);
+ }
+ else {
+ pClient->LogMessageV("<!-- **** ReadFile 002 failed: %d -->\n", error);
+ }
+ CloseConnection(pClient);
+ }
+ return TRUE;
+}
+
+DWORD WINAPI WorkerThread(LPVOID pvVoid)
+{
+ PCLIENT pClient;
+ BOOL b;
+ LPOVERLAPPED lpo;
+ DWORD nBytes;
+ HANDLE hCompletionPort = (HANDLE)pvVoid;
+
+ for (BOOL fKeepLooping = TRUE; fKeepLooping;) {
+ pClient = NULL;
+ lpo = NULL;
+ nBytes = 0;
+ b = GetQueuedCompletionStatus(hCompletionPort,
+ &nBytes, (PULONG_PTR)&pClient, &lpo, INFINITE);
+
+ if (!b) {
+ if (pClient) {
+ if (GetLastError() == ERROR_BROKEN_PIPE) {
+ pClient->LogMessageV("<!-- Client closed pipe. -->");
+ }
+ else {
+ pClient->LogMessageV("<!-- *** GetQueuedCompletionStatus failed %d -->",
+ GetLastError());
+ }
+ CloseConnection(pClient);
+ }
+ continue;
+ }
+
+ if (pClient->fAwaitingAccept) {
+ BOOL fAgain = TRUE;
+ while (fAgain) {
+ LONG nClient = InterlockedIncrement(&s_nTotalClients);
+ InterlockedIncrement(&s_nActiveClients);
+ pClient->fAwaitingAccept = FALSE;
+
+ PCLIENT pNew = CreatePipeConnection(hCompletionPort, nClient);
+
+ fAgain = FALSE;
+ if (pNew != NULL) {
+ fAgain = !pNew->fAwaitingAccept;
+ DoRead(pNew);
+ }
+ }
+ }
+ else {
+ if (nBytes <= offsetof(TBLOG_MESSAGE, szMessage)) {
+ pClient->LogMessageV("</t:Process>\n");
+ CloseConnection(pClient);
+ continue;
+ }
+ pClient->LogMessage(&pClient->Message, nBytes);
+ }
+
+ DoRead(pClient);
+ }
+ return 0;
+}
+
+BOOL CreateWorkers(HANDLE hCompletionPort)
+{
+ DWORD dwThread;
+ HANDLE hThread;
+ DWORD i;
+ SYSTEM_INFO SystemInfo;
+
+ GetSystemInfo(&SystemInfo);
+
+ for (i = 0; i < 1; i++) {
+ hThread = CreateThread(NULL, 0, WorkerThread, hCompletionPort, 0, &dwThread);
+ if (!hThread) {
+ MyErrExit("CreateThread WorkerThread");
+ // Unreachable: return FALSE;
+ }
+ CloseHandle(hThread);
+ }
+ return TRUE;
+}
+
+DWORD CopyEnvironment(PWCHAR pwzzOut, PCWSTR pwzzIn)
+{
+ PCWSTR pwzzBeg = pwzzOut;
+ while (*pwzzIn) {
+ while (*pwzzIn) {
+ *pwzzOut++ = *pwzzIn++;
+ }
+ *pwzzOut++ = *pwzzIn++; // Copy zero.
+ }
+ *pwzzOut++ = '\0'; // Add last zero.
+
+ return (DWORD)(pwzzOut - pwzzBeg);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+DWORD main(int argc, char **argv)
+{
+ HANDLE hCompletionPort;
+ BOOL fNeedHelp = FALSE;
+ WCHAR wzzDrop[1024] = L"build\0nmake\0";
+
+ GetSystemTimeAsFileTime((FILETIME *)&s_llStartTime);
+ StringCchPrintfA(s_szPipe, ARRAYSIZE(s_szPipe), "%s.%d", TBLOG_PIPE_NAME, GetCurrentProcessId());
+
+ int arg = 1;
+ for (; arg < argc && (argv[arg][0] == '-' || argv[arg][0] == '/'); arg++) {
+ CHAR *argn = argv[arg] + 1;
+ CHAR *argp = argn;
+ while (*argp && *argp != ':' && *argp != '=') {
+ argp++;
+ }
+ if (*argp == ':' || *argp == '=') {
+ *argp++ = '\0';
+ }
+
+ switch (argn[0]) {
+
+ case 'd': // Drop Processes
+ case 'D':
+ if (*argp) {
+ PWCHAR pwz = wzzDrop;
+ while (*argp) {
+ if (*argp == ';') {
+ *pwz++ = '\0';
+ }
+ else {
+ *pwz++ = *argp++;
+ }
+ }
+ *pwz++ = '\0';
+ *pwz = '\0';
+ }
+ case 'o': // Output file.
+ case 'O':
+ StringCchCopyA(s_szLogFile, ARRAYSIZE(s_szLogFile), argp);
+ break;
+
+ case 'v': // Verbose
+ case 'V':
+ s_fVerbose = TRUE;
+ break;
+
+ case '?': // Help.
+ fNeedHelp = TRUE;
+ break;
+
+ default:
+ fNeedHelp = TRUE;
+ printf("TRACEBLD: Bad argument: %s:%s\n", argn, argp);
+ break;
+ }
+ }
+
+ if (arg >= argc) {
+ fNeedHelp = TRUE;
+ }
+
+ if (fNeedHelp) {
+ printf("Usage:\n"
+ " tracebld [options] command {command arguments}\n"
+ "Options:\n"
+ " /o:file Log all events to the output files.\n"
+ " /? Display this help message.\n"
+ "Summary:\n"
+ " Runs the build commands and figures out which files have dependencies..\n"
+ "\n");
+ exit(9001);
+ }
+
+ // Create the completion port.
+ hCompletionPort = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, NULL, 0);
+ if (hCompletionPort == NULL) {
+ MyErrExit("CreateIoCompletionPort");
+ }
+
+ // Create completion port worker threads.
+ //
+ CreateWorkers(hCompletionPort);
+ CreatePipeConnection(hCompletionPort, 0);
+
+ printf("TRACEBLD: Ready for clients. Press Ctrl-C to stop.\n");
+
+ /////////////////////////////////////////////////////////// Validate DLLs.
+ //
+ CHAR szTmpPath[MAX_PATH];
+ CHAR szExePath[MAX_PATH];
+ CHAR szDllPath[MAX_PATH];
+ PCHAR pszFilePart = NULL;
+
+ if (!GetModuleFileNameA(NULL, szTmpPath, ARRAYSIZE(szTmpPath))) {
+ printf("TRACEBLD: Couldn't retreive exe name.\n");
+ return 9002;
+ }
+ if (!GetFullPathNameA(szTmpPath, ARRAYSIZE(szExePath), szExePath, &pszFilePart) ||
+ pszFilePart == NULL) {
+ printf("TRACEBLD: Error: %s is not a valid path name..\n", szTmpPath);
+ return 9002;
+ }
+
+ StringCchCopyA(pszFilePart, szExePath + ARRAYSIZE(szExePath) - pszFilePart,
+ "trcbld" DETOURS_STRINGIFY(DETOURS_BITS) ".dll");
+ StringCchCopyA(szDllPath, ARRAYSIZE(szDllPath), szExePath);
+
+ //////////////////////////////////////////////////////////////////////////
+ STARTUPINFOA si;
+ PROCESS_INFORMATION pi;
+ CHAR szCommand[2048];
+ CHAR szExe[MAX_PATH];
+ CHAR szFullExe[MAX_PATH] = "\0";
+ PCHAR pszFileExe = NULL;
+
+ ZeroMemory(&si, sizeof(si));
+ ZeroMemory(&pi, sizeof(pi));
+ si.cb = sizeof(si);
+
+ szCommand[0] = L'\0';
+
+ StringCchCopyA(szExe, sizeof(szExe), argv[arg]);
+ for (; arg < argc; arg++) {
+ if (strchr(argv[arg], ' ') != NULL || strchr(argv[arg], '\t') != NULL) {
+ StringCchCatA(szCommand, sizeof(szCommand), "\"");
+ StringCchCatA(szCommand, sizeof(szCommand), argv[arg]);
+ StringCchCatA(szCommand, sizeof(szCommand), "\"");
+ }
+ else {
+ StringCchCatA(szCommand, sizeof(szCommand), argv[arg]);
+ }
+
+ if (arg + 1 < argc) {
+ StringCchCatA(szCommand, sizeof(szCommand), " ");
+ }
+ }
+ printf("TRACEBLD: Starting: `%s'\n", szCommand);
+ printf("TRACEBLD: with `%s'\n", szDllPath);
+ fflush(stdout);
+
+ DWORD dwFlags = CREATE_DEFAULT_ERROR_MODE | CREATE_SUSPENDED;
+
+ SetLastError(0);
+ SearchPathA(NULL, szExe, ".exe", ARRAYSIZE(szFullExe), szFullExe, &pszFileExe);
+
+
+ if (!DetourCreateProcessWithDllExA(szFullExe[0] ? szFullExe : NULL, szCommand,
+ NULL, NULL, TRUE, dwFlags, NULL, NULL,
+ &si, &pi, szDllPath, NULL)) {
+ printf("TRACEBLD: DetourCreateProcessWithDllEx failed: %ld\n", GetLastError());
+ ExitProcess(9007);
+ }
+
+ ZeroMemory(&s_Payload, sizeof(s_Payload));
+ s_Payload.nParentProcessId = GetCurrentProcessId();
+ s_Payload.nTraceProcessId = GetCurrentProcessId();
+ s_Payload.nGeneology = 1;
+ s_Payload.rGeneology[0] = 0;
+ StringCchCopyW(s_Payload.wzStdin, ARRAYSIZE(s_Payload.wzStdin), L"\\\\.\\CONIN$");
+ StringCchCopyW(s_Payload.wzStdout, ARRAYSIZE(s_Payload.wzStdout), L"\\\\.\\CONOUT$");
+ StringCchCopyW(s_Payload.wzStderr, ARRAYSIZE(s_Payload.wzStderr), L"\\\\.\\CONOUT$");
+ StringCchCopyW(s_Payload.wzParents, ARRAYSIZE(s_Payload.wzParents), L"");
+ CopyEnvironment(s_Payload.wzzDrop, wzzDrop);
+ LPWCH pwStrings = GetEnvironmentStringsW();
+ CopyEnvironment(s_Payload.wzzEnvironment, pwStrings);
+ FreeEnvironmentStringsW(pwStrings);
+
+ if (!DetourCopyPayloadToProcess(pi.hProcess, s_guidTrace,
+ &s_Payload, sizeof(s_Payload))) {
+ printf("TRACEBLD: DetourCopyPayloadToProcess failed: %ld\n", GetLastError());
+ ExitProcess(9008);
+ }
+
+ ResumeThread(pi.hThread);
+
+ WaitForSingleObject(pi.hProcess, INFINITE);
+
+ DWORD dwResult = 0;
+ if (!GetExitCodeProcess(pi.hProcess, &dwResult)) {
+ printf("TRACEBLD: GetExitCodeProcess failed: %ld\n", GetLastError());
+ return 9008;
+ }
+
+ printf("TRACEBLD: %ld processes.\n", s_nTotalClients);
+
+ return dwResult;
+}
+//
+//////////////////////////////////////////////////////////////////////////////
diff --git a/ext/detours/samples/tracebld/tracebld.h b/ext/detours/samples/tracebld/tracebld.h
new file mode 100644
index 0000000..9a878af
--- /dev/null
+++ b/ext/detours/samples/tracebld/tracebld.h
@@ -0,0 +1,59 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (tracebld.h of tracebld.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#pragma once
+#ifndef _TRACEBLD_H_
+#define _TRACEBLD_H_
+#include <stdarg.h>
+
+//////////////////////////////////////////////////////////////////////////////
+//
+//
+#define TBLOG_PIPE_NAMEA "\\\\.\\pipe\\tracebuild"
+#define TBLOG_PIPE_NAMEW L"\\\\.\\pipe\\tracebuild"
+#ifdef UNICODE
+#define TBLOG_PIPE_NAME TBLOG_PIPE_NAMEW
+#else
+#define TBLOG_PIPE_NAME TBLOG_PIPE_NAMEA
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+//
+typedef struct _TBLOG_MESSAGE
+{
+ DWORD nBytes;
+ CHAR szMessage[32764]; // 32768 - sizeof(nBytes)
+} TBLOG_MESSAGE, *PTBLOG_MESSAGE;
+
+typedef struct _TBLOG_PAYLOAD
+{
+ DWORD nParentProcessId;
+ DWORD nTraceProcessId;
+ DWORD nGeneology;
+ DWORD rGeneology[64];
+ WCHAR wzParents[256];
+ WCHAR wzStdin[256];
+ WCHAR wzStdout[256];
+ WCHAR wzStderr[256];
+ BOOL fStdoutAppend;
+ BOOL fStderrAppend;
+ WCHAR wzzDrop[1024]; // Like an environment: zero terminated strings with a last zero.
+ WCHAR wzzEnvironment[32768];
+} TBLOG_PAYLOAD, *PTBLOG_PAYLOAD;
+
+// Shared state payload guid.
+//
+const GUID s_guidTrace = {
+ 0xd8e2dc69, 0x3004, 0x453e,
+ {0x94, 0x15, 0x19, 0x0e, 0x79, 0xe8, 0x93, 0x52}
+};
+
+
+#endif // _TRACEBLD_H_
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/tracebld/trcbld.cpp b/ext/detours/samples/tracebld/trcbld.cpp
new file mode 100644
index 0000000..5392f90
--- /dev/null
+++ b/ext/detours/samples/tracebld/trcbld.cpp
@@ -0,0 +1,4573 @@
+/////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (trcbld.cpp of trcbld.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#define _WIN32_WINNT 0x0500
+#define WIN32
+#define NT
+
+#define DBG_TRACE 0
+
+#include <windows.h>
+#include <stdio.h>
+#pragma warning(push)
+#if _MSC_VER > 1400
+#pragma warning(disable:6102 6103) // /analyze warnings
+#endif
+#include <strsafe.h>
+#pragma warning(pop)
+#include "detours.h"
+#include "tracebld.h"
+
+#define PULONG_PTR PVOID
+#define PLONG_PTR PVOID
+#define ULONG_PTR PVOID
+
+//////////////////////////////////////////////////////////////////////////////
+
+#pragma warning(disable:4127) // Many of our asserts are constants.
+
+#define DEBUG_BREAK() DebugBreak()
+
+#define ASSERT_ALWAYS(x) \
+ do { \
+ if (!(x)) { \
+ AssertFailed(#x, __FILE__, __LINE__); \
+ DebugBreak(); \
+ } \
+ } while (0)
+
+#ifndef NDEBUG
+#define ASSERT(x) ASSERT_ALWAYS(x)
+#else
+#define ASSERT(x)
+#endif
+
+#define UNUSED(c) (c) = (c)
+
+//////////////////////////////////////////////////////////////////////////////
+static HMODULE s_hInst = NULL;
+static HMODULE s_hKernel32 = NULL;
+static CHAR s_szDllPath[MAX_PATH];
+static TBLOG_PAYLOAD s_Payload;
+static TBLOG_PAYLOAD s_ChildPayload;
+static CRITICAL_SECTION s_csChildPayload;
+static DWORD s_nTraceProcessId = 0;
+static LONG s_nChildCnt = 0;
+
+static CRITICAL_SECTION s_csPipe; // Guards access to hPipe.
+static HANDLE s_hPipe = INVALID_HANDLE_VALUE;
+static TBLOG_MESSAGE s_rMessage;
+
+// Logging Functions.
+//
+VOID Tblog(PCSTR pszMsgf, ...);
+VOID TblogV(PCSTR pszMsgf, va_list args);
+
+VOID VSafePrintf(PCSTR pszMsg, va_list args, PCHAR pszBuffer, LONG cbBuffer);
+PCHAR SafePrintf(PCHAR pszBuffer, LONG cbBuffer, PCSTR pszMsg, ...);
+
+LONG EnterFunc();
+VOID ExitFunc();
+VOID Print(PCSTR psz, ...);
+VOID NoteRead(PCSTR psz);
+VOID NoteRead(PCWSTR pwz);
+VOID NoteWrite(PCSTR psz);
+VOID NoteWrite(PCWSTR pwz);
+VOID NoteDelete(PCSTR psz);
+VOID NoteDelete(PCWSTR pwz);
+VOID NoteCleanup(PCSTR psz);
+VOID NoteCleanup(PCWSTR pwz);
+
+PBYTE LoadFile(HANDLE hFile, DWORD cbFile);
+static PCHAR RemoveReturns(PCHAR pszBuffer);
+static PWCHAR RemoveReturns(PWCHAR pwzBuffer);
+
+VOID AssertFailed(CONST PCHAR pszMsg, CONST PCHAR pszFile, ULONG nLine);
+
+int WINAPI Mine_EntryPoint(VOID);
+VOID WINAPI Mine_ExitProcess(UINT a0);
+
+//////////////////////////////////////////////////////////////////////////////
+//
+int (WINAPI * Real_EntryPoint)(VOID)
+ = NULL;
+
+BOOL (WINAPI * Real_CreateDirectoryW)(LPCWSTR a0,
+ LPSECURITY_ATTRIBUTES a1)
+ = CreateDirectoryW;
+
+BOOL (WINAPI * Real_CreateDirectoryExW)(LPCWSTR a0,
+ LPCWSTR a1,
+ LPSECURITY_ATTRIBUTES a2)
+ = CreateDirectoryExW;
+
+HANDLE (WINAPI * Real_CreateFileW)(LPCWSTR a0,
+ DWORD a1,
+ DWORD a2,
+ LPSECURITY_ATTRIBUTES a3,
+ DWORD a4,
+ DWORD a5,
+ HANDLE a6)
+ = CreateFileW;
+
+HANDLE (WINAPI * Real_CreateFileMappingW)(HANDLE hFile,
+ LPSECURITY_ATTRIBUTES lpAttributes,
+ DWORD flProtect,
+ DWORD dwMaximumSizeHigh,
+ DWORD dwMaximumSizeLow,
+ LPCWSTR lpName
+ )
+ = CreateFileMappingW;
+
+BOOL (WINAPI * Real_CreatePipe)(PHANDLE hReadPipe,
+ PHANDLE hWritePipe,
+ LPSECURITY_ATTRIBUTES lpPipeAttributes,
+ DWORD nSize)
+ = CreatePipe;
+
+BOOL (WINAPI * Real_CloseHandle)(HANDLE a0)
+ = CloseHandle;
+
+BOOL (WINAPI * Real_DuplicateHandle)(HANDLE hSourceProcessHandle,
+ HANDLE hSourceHandle,
+ HANDLE hTargetProcessHandle,
+ LPHANDLE lpTargetHandle,
+ DWORD dwDesiredAccess,
+ BOOL bInheritHandle,
+ DWORD dwOptions)
+ = DuplicateHandle;
+
+BOOL (WINAPI * Real_CreateProcessW)(LPCWSTR lpApplicationName,
+ LPWSTR lpCommandLine,
+ LPSECURITY_ATTRIBUTES lpProcessAttributes,
+ LPSECURITY_ATTRIBUTES lpThreadAttributes,
+ BOOL bInheritHandles,
+ DWORD dwCreationFlags,
+ LPVOID lpEnvironment,
+ LPCWSTR lpCurrentDirectory,
+ LPSTARTUPINFOW lpStartupInfo,
+ LPPROCESS_INFORMATION lpProcessInformation)
+ = CreateProcessW;
+
+BOOL (WINAPI * Real_CreateProcessA)(LPCSTR lpApplicationName,
+ LPSTR lpCommandLine,
+ LPSECURITY_ATTRIBUTES lpProcessAttributes,
+ LPSECURITY_ATTRIBUTES lpThreadAttributes,
+ BOOL bInheritHandles,
+ DWORD dwCreationFlags,
+ LPVOID lpEnvironment,
+ LPCSTR lpCurrentDirectory,
+ LPSTARTUPINFOA lpStartupInfo,
+ LPPROCESS_INFORMATION lpProcessInformation)
+ = CreateProcessA;
+
+BOOL (WINAPI * Real_DeleteFileW)(LPCWSTR a0)
+ = DeleteFileW;
+BOOL (WINAPI * Real_DeviceIoControl)(HANDLE a0,
+ DWORD dwIoControlCode,
+ LPVOID lpInBuffer,
+ DWORD nInBufferSize,
+ LPVOID lpOutBuffer,
+ DWORD nOutBufferSize,
+ LPDWORD lpBytesReturned,
+ LPOVERLAPPED lpOverlapped)
+ = DeviceIoControl;
+
+DWORD (WINAPI * Real_GetFileAttributesW)(LPCWSTR a0)
+ = GetFileAttributesW;
+
+BOOL (WINAPI * Real_MoveFileWithProgressW)(LPCWSTR lpExistingFileName,
+ LPCWSTR lpNewFileName,
+ LPPROGRESS_ROUTINE lpProgressRoutine,
+ LPVOID lpData,
+ DWORD dwFlags)
+ = MoveFileWithProgressW;
+
+BOOL (WINAPI * Real_MoveFileA)(LPCSTR a0,
+ LPCSTR a1)
+ = MoveFileA;
+
+BOOL (WINAPI * Real_MoveFileW)(LPCWSTR a0,
+ LPCWSTR a12)
+ = MoveFileW;
+
+BOOL (WINAPI * Real_MoveFileExA)(LPCSTR a0,
+ LPCSTR a1,
+ DWORD a2)
+ = MoveFileExA;
+
+BOOL (WINAPI * Real_MoveFileExW)(LPCWSTR a0,
+ LPCWSTR a1,
+ DWORD a2)
+ = MoveFileExW;
+
+BOOL (WINAPI * Real_CopyFileExA)(LPCSTR a0,
+ LPCSTR a1,
+ LPPROGRESS_ROUTINE a2,
+ LPVOID a4,
+ LPBOOL a5,
+ DWORD a6)
+ = CopyFileExA;
+
+BOOL (WINAPI * Real_CopyFileExW)(LPCWSTR a0,
+ LPCWSTR a1,
+ LPPROGRESS_ROUTINE a2,
+ LPVOID a4,
+ LPBOOL a5,
+ DWORD a6)
+ = CopyFileExW;
+
+BOOL (WINAPI * Real_PrivCopyFileExW)(LPCWSTR lpExistingFileName,
+ LPCWSTR lpNewFileName,
+ LPPROGRESS_ROUTINE lpProgressRoutine,
+ LPVOID lpData,
+ LPBOOL pbCancel,
+ DWORD dwCopyFlags)
+ = NULL;
+
+BOOL (WINAPI * Real_CreateHardLinkA)(LPCSTR a0,
+ LPCSTR a1,
+ LPSECURITY_ATTRIBUTES a2)
+ = CreateHardLinkA;
+
+BOOL (WINAPI * Real_CreateHardLinkW)(LPCWSTR a0,
+ LPCWSTR a1,
+ LPSECURITY_ATTRIBUTES a2)
+ = CreateHardLinkW;
+
+BOOL (WINAPI * Real_SetStdHandle)(DWORD a0,
+ HANDLE a1)
+ = SetStdHandle;
+
+HMODULE (WINAPI * Real_LoadLibraryA)(LPCSTR a0)
+ = LoadLibraryA;
+
+HMODULE (WINAPI * Real_LoadLibraryW)(LPCWSTR a0)
+ = LoadLibraryW;
+
+HMODULE (WINAPI * Real_LoadLibraryExA)(LPCSTR a0,
+ HANDLE a1,
+ DWORD a2)
+ = LoadLibraryExA;
+
+HMODULE (WINAPI * Real_LoadLibraryExW)(LPCWSTR a0,
+ HANDLE a1,
+ DWORD a2)
+ = LoadLibraryExW;
+
+DWORD (WINAPI * Real_SetFilePointer)(HANDLE hFile,
+ LONG lDistanceToMove,
+ PLONG lpDistanceToMoveHigh,
+ DWORD dwMoveMethod)
+ = SetFilePointer;
+
+BOOL (WINAPI * Real_SetFilePointerEx)(HANDLE hFile,
+ LARGE_INTEGER liDistanceToMove,
+ PLARGE_INTEGER lpNewFilePointer,
+ DWORD dwMoveMethod)
+ = SetFilePointerEx;
+
+BOOL (WINAPI * Real_ReadFile)(HANDLE a0,
+ LPVOID a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPOVERLAPPED a4)
+ = ReadFile;
+
+BOOL (WINAPI * Real_ReadFileEx)(HANDLE a0,
+ LPVOID a1,
+ DWORD a2,
+ LPOVERLAPPED a3,
+ LPOVERLAPPED_COMPLETION_ROUTINE a4)
+ = ReadFileEx;
+
+BOOL (WINAPI * Real_WriteFile)(HANDLE a0,
+ LPCVOID a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPOVERLAPPED a4)
+ = WriteFile;
+
+BOOL (WINAPI * Real_WriteFileEx)(HANDLE a0,
+ LPCVOID a1,
+ DWORD a2,
+ LPOVERLAPPED a3,
+ LPOVERLAPPED_COMPLETION_ROUTINE a4)
+ = WriteFileEx;
+
+BOOL (WINAPI * Real_WriteConsoleA)(HANDLE a0,
+ const VOID* a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPVOID a4)
+ = WriteConsoleA;
+
+BOOL (WINAPI * Real_WriteConsoleW)(HANDLE a0,
+ const VOID* a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPVOID a4)
+ = WriteConsoleW;
+
+VOID (WINAPI * Real_ExitProcess)(UINT a0)
+ = ExitProcess;
+
+DWORD (WINAPI * Real_ExpandEnvironmentStringsA)(PCSTR lpSrc, PCHAR lpDst, DWORD nSize)
+ = ExpandEnvironmentStringsA;
+
+DWORD (WINAPI * Real_ExpandEnvironmentStringsW)(PCWSTR lpSrc, PWCHAR lpDst, DWORD nSize)
+ = ExpandEnvironmentStringsW;
+
+DWORD (WINAPI * Real_GetEnvironmentVariableA)(PCSTR lpName, PCHAR lpBuffer, DWORD nSize)
+ = GetEnvironmentVariableA;
+
+DWORD (WINAPI * Real_GetEnvironmentVariableW)(PCWSTR lpName, PWCHAR lpBuffer, DWORD nSize)
+ = GetEnvironmentVariableW;
+
+PCWSTR (CDECL * Real_wgetenv)(PCWSTR var) = NULL;
+PCSTR (CDECL * Real_getenv)(PCSTR var) = NULL;
+DWORD (CDECL * Real_getenv_s)(DWORD *pValue, PCHAR pBuffer, DWORD cBuffer, PCSTR varname) = NULL;
+DWORD (CDECL * Real_wgetenv_s)(DWORD *pValue, PWCHAR pBuffer, DWORD cBuffer, PCWSTR varname) = NULL;
+DWORD (CDECL * Real_dupenv_s)(PCHAR *ppBuffer, DWORD *pcBuffer, PCSTR varname) = NULL;
+DWORD (CDECL * Real_wdupenv_s)(PWCHAR *ppBuffer, DWORD *pcBuffer, PCWSTR varname) = NULL;
+
+//////////////////////////////////////////////////////////////////////////////
+//
+static VOID Copy(PWCHAR pwzDst, PCWSTR pwzSrc)
+{
+ while (*pwzSrc) {
+ *pwzDst++ = *pwzSrc++;
+ }
+ *pwzDst = '\0';
+}
+
+static DWORD Size(PCWSTR pwzSrc)
+{
+ DWORD c = 0;
+ while (pwzSrc[c]) {
+ c++;
+ }
+ return c;
+}
+
+static PCWSTR Save(PCWSTR pwzSrc)
+{
+ DWORD c = (Size(pwzSrc) + 1) * sizeof(WCHAR);
+ PWCHAR pwzDst = (PWCHAR)GlobalAlloc(GPTR, c);
+ CopyMemory(pwzDst, pwzSrc, c);
+
+ return pwzDst;
+}
+
+static BOOL HasSpace(PCWSTR pwz)
+{
+ for (; *pwz; pwz++) {
+ if (*pwz == ' ' || *pwz == '\t' || *pwz == '\r' || *pwz == '\n') {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+static BOOL HasChar(PCWSTR pwz, WCHAR w)
+{
+ for (; *pwz; pwz++) {
+ if (*pwz == w) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+static DWORD Compare(PCWSTR pwzA, PCWSTR pwzB)
+{
+ for (;;) {
+ WCHAR cA = *pwzA++;
+ WCHAR cB = *pwzB++;
+
+ if (cA >= 'A' && cA <= 'Z') {
+ cA += ('a' - 'A');
+ }
+ if (cB >= 'A' && cB <= 'Z') {
+ cB += ('a' - 'A');
+ }
+
+ if (cA == 0 && cB == 0) {
+ return 0;
+ }
+ if (cA != cB) {
+ return cA - cB;
+ }
+ }
+}
+
+static DWORD Compare(PCWSTR pwzA, PCSTR pszB)
+{
+ for (;;) {
+ WCHAR cA = *pwzA++;
+ WCHAR cB = *pszB++;
+
+ if (cA >= 'A' && cA <= 'Z') {
+ cA += ('a' - 'A');
+ }
+ if (cB >= 'A' && cB <= 'Z') {
+ cB += ('a' - 'A');
+ }
+
+ if (cA == 0 && cB == 0) {
+ return 0;
+ }
+ if (cA != cB) {
+ return cA - cB;
+ }
+ }
+}
+
+static DWORD Compare(PCSTR pszA, PCSTR pszB)
+{
+ for (;;) {
+ CHAR cA = *pszA++;
+ CHAR cB = *pszB++;
+
+ if (cA >= 'A' && cA <= 'Z') {
+ cA += ('a' - 'A');
+ }
+ if (cB >= 'A' && cB <= 'Z') {
+ cB += ('a' - 'A');
+ }
+
+ if (cA == 0 && cB == 0) {
+ return 0;
+ }
+ if (cA != cB) {
+ return cA - cB;
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+static PCSTR s_rpszMsvcrNames[] = {
+ "msvcr80.dll",
+ "msvcr80d.dll",
+ "msvcr71.dll",
+ "msvcr71d.dll",
+ "msvcr70.dll",
+ "msvcr70d.dll",
+ NULL
+};
+
+HMODULE s_hMsvcr = NULL;
+PCSTR s_pszMsvcr = NULL;
+
+static BOOL WINAPI ImportFileCallback(PVOID pContext, HMODULE hFile, PCSTR pszFile)
+{
+ UNUSED(pContext);
+
+ if (pszFile != NULL) {
+ for (int i = 0; s_rpszMsvcrNames[i]; i++) {
+ if (Compare(pszFile, s_rpszMsvcrNames[i]) == 0) {
+ s_hMsvcr = hFile;
+ s_pszMsvcr = s_rpszMsvcrNames[i];
+ return FALSE;
+ }
+ }
+ }
+ return TRUE;
+}
+
+BOOL FindMsvcr()
+{
+ DetourEnumerateImports(NULL, NULL, ImportFileCallback, NULL);
+
+ if (s_hMsvcr != NULL) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+BOOL FindProc(PVOID * ppvCode, PCSTR pwzFunc)
+{
+ PVOID pv = GetProcAddress(s_hMsvcr, pwzFunc);
+ if (pv != NULL) {
+ *ppvCode = pv;
+ return TRUE;
+ }
+ else {
+ *ppvCode = NULL;
+ return FALSE;
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+struct EnvInfo
+{
+ DWORD m_nHash;
+ DWORD m_nIndex;
+ PCWSTR m_pwzVar;
+ PCWSTR m_pwzVal;
+ BOOL m_fDefined;
+ BOOL m_fUsed;
+ BOOL m_fOriginal;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+//
+class EnvVars
+{
+ private:
+ static CRITICAL_SECTION s_csLock;
+ static DWORD s_nVars;
+ static DWORD s_nCapacity;
+ static EnvInfo ** s_pVars;
+
+ private:
+ static DWORD Hash(PCWSTR pwzVar)
+ {
+ DWORD hash = 5381;
+ while (*pwzVar != 0) {
+ WCHAR c = *pwzVar++;
+ if (c >= 'A' && c <= 'Z') {
+ c += ('a' - 'A');
+ }
+ hash = ((hash << 5) + hash) + c;
+ }
+ return hash;
+ }
+
+ static VOID LockAcquire()
+ {
+ EnterCriticalSection(&s_csLock);
+ }
+
+ static VOID LockRelease()
+ {
+ LeaveCriticalSection(&s_csLock);
+ }
+
+ static VOID Resize(DWORD nCapacity);
+ static VOID Set(EnvInfo *info);
+ static EnvInfo * Find(PCWSTR pwzVar);
+
+ public:
+ static BOOL Equal(PCWSTR pwzA, PCWSTR pwzB)
+ {
+ return (Compare(pwzA, pwzB) == 0);
+ }
+
+ public:
+ static VOID Initialize();
+ static VOID Dump();
+
+ static VOID Add(PCWSTR pwzVar, PCWSTR pwzVal);
+
+ static VOID Used(PCWSTR pwzVar);
+ static VOID Used(PCSTR pszVar);
+};
+
+CRITICAL_SECTION EnvVars::s_csLock;
+DWORD EnvVars::s_nVars = 0;
+DWORD EnvVars::s_nCapacity = 0;
+EnvInfo ** EnvVars::s_pVars = NULL;
+
+VOID EnvVars::Initialize()
+{
+ InitializeCriticalSection(&s_csLock);
+
+ Resize(919);
+}
+
+VOID EnvVars::Resize(DWORD nCapacity)
+{
+ if (nCapacity > s_nCapacity) {
+ DWORD nOld = s_nCapacity;
+ EnvInfo ** pOld = s_pVars;
+
+ // DEBUG_BREAK();
+
+ s_pVars = (EnvInfo **)GlobalAlloc(GPTR, nCapacity * sizeof(EnvInfo *));
+ s_nCapacity = nCapacity;
+
+ if (pOld != NULL) {
+ for (DWORD n = 0; n < nOld; n++) {
+ if (pOld[n] != NULL) {
+ Set(pOld[n]);
+ }
+ }
+ GlobalFree((HGLOBAL)pOld);
+ pOld = NULL;
+ }
+ }
+}
+
+VOID EnvVars::Set(EnvInfo *info)
+{
+ DWORD hash = info->m_nHash;
+ DWORD slot = hash % s_nCapacity;
+ DWORD death = 0;
+
+ // Find an empty slot.
+ for (; s_pVars[slot] != NULL; slot = (slot + 1) % s_nCapacity) {
+ if (++death > s_nCapacity) {
+ // We should have dropped out at some point...
+ DEBUG_BREAK();
+ }
+ }
+
+ s_pVars[slot] = info;
+}
+
+EnvInfo * EnvVars::Find(PCWSTR pwzVar)
+{
+ DWORD hash = Hash(pwzVar);
+ DWORD slot = hash % s_nCapacity;
+
+ LockAcquire();
+
+ // Find the the matching slot, or an empty one.
+ for (; s_pVars[slot] != NULL; slot = (slot + 1) % s_nCapacity) {
+ if (Equal(s_pVars[slot]->m_pwzVar, pwzVar)) {
+ LockRelease();
+ return s_pVars[slot];
+ }
+ }
+ LockRelease();
+ return NULL;
+}
+
+VOID EnvVars::Add(PCWSTR pwzVar, PCWSTR pwzVal)
+{
+ if (pwzVar == NULL) {
+ return;
+ }
+
+ WCHAR wzVar[MAX_PATH];
+ PWCHAR pwzDst = wzVar;
+ while (*pwzVar) {
+ if (*pwzVar >= 'a' && *pwzVar <= 'z') {
+ *pwzDst++ = *pwzVar - ('a' - 'A');
+ }
+ else {
+ *pwzDst++ = *pwzVar;
+ }
+ pwzVar++;
+ }
+ *pwzDst = '\0';
+ pwzVar = wzVar;
+
+ WCHAR wzVal[] = L"";
+ if (pwzVal != NULL) {
+ while (*pwzVal == ' ' || *pwzVal == '\t') {
+ *pwzVal++;
+ }
+ }
+ else {
+ pwzVal = wzVal;
+ }
+
+ // Tblog("<!-- ::Add var=[%le] val=[%le] -->\n", pwzVar, pwzVal);
+ LockAcquire();
+
+ // DEBUG_BREAK();
+
+ DWORD hash = Hash(pwzVar);
+ DWORD slot = hash % s_nCapacity;
+ EnvInfo *info = NULL;
+ DWORD death = 0;
+
+ // Find the the matching slot, or an empty one.
+ for (; s_pVars[slot] != NULL; slot = (slot + 1) % s_nCapacity) {
+ if (Equal(s_pVars[slot]->m_pwzVar, pwzVar)) {
+ LockRelease();
+ return;
+ }
+ if (++death > s_nCapacity) {
+ // We should have dropped out at some point...
+ DEBUG_BREAK();
+ }
+ }
+
+ // Add the var to list of known vars.
+ info = (EnvInfo *)GlobalAlloc(GPTR, sizeof(EnvInfo));
+ info->m_nHash = hash;
+ info->m_nIndex = s_nVars++;
+ info->m_pwzVar = Save(pwzVar);
+ info->m_pwzVal = Save(pwzVal);
+ if (pwzVal[0] == '\0') {
+ info->m_fDefined = FALSE;
+ info->m_fUsed = TRUE;
+ }
+ else {
+ info->m_fDefined = TRUE;
+ }
+ s_pVars[slot] = info;
+
+ // Check if we should grow the table.
+ if (s_nVars > (s_nCapacity / 2)) {
+ Resize(s_nCapacity * 2 - 1);
+ }
+
+ LockRelease();
+}
+
+VOID EnvVars::Used(PCWSTR pwzVar)
+{
+ if (pwzVar != NULL) {
+ // Tblog("<!-- Used [%le] -->\n", pwzVar);
+ EnvInfo *pInfo = Find(pwzVar);
+ if (pInfo) {
+ pInfo->m_fUsed = TRUE;
+ }
+#if 0
+ else {
+ Add(pwzVar, NULL);
+ }
+#endif
+ }
+}
+
+VOID EnvVars::Used(PCSTR pszVar)
+{
+ if (pszVar != NULL) {
+ WCHAR wzVar[MAX_PATH];
+ PWCHAR pwzVar = wzVar;
+ while (*pszVar) {
+ *pwzVar++ = *pszVar++;
+ }
+ *pwzVar = '\0';
+
+ Used(wzVar);
+ }
+}
+
+VOID EnvVars::Dump()
+{
+ if (s_nVars == 0) {
+ return;
+ }
+
+ LockAcquire();
+
+ Tblog("<t:Vars>\n");
+
+ // Remove any variables that match the original environment.
+ PCWSTR pwzz = s_Payload.wzzEnvironment;
+ while (*pwzz) {
+ WCHAR wzVar[MAX_PATH];
+ PWCHAR pwzVar = wzVar;
+
+ while (*pwzz && *pwzz != '=') {
+ *pwzVar++ = *pwzz++;
+ }
+ *pwzVar = '\0';
+ if (*pwzz == '=') {
+ pwzz++;
+ }
+
+ EnvInfo *pInfo = Find(wzVar);
+ if (pInfo) {
+ if (Compare(pwzz, pInfo->m_pwzVal) == 0) {
+ pInfo->m_fUsed = FALSE;
+ }
+ }
+ pwzz += Size(pwzz) + 1;
+ }
+
+
+ EnvInfo ** pSorted = (EnvInfo **)GlobalAlloc(GPTR, s_nVars * sizeof(EnvInfo *));
+
+ for (DWORD n = 0; n < s_nCapacity; n++) {
+ if (s_pVars[n] != NULL) {
+ if (s_pVars[n]->m_nIndex > s_nVars) {
+ DEBUG_BREAK();
+ }
+ pSorted[s_pVars[n]->m_nIndex] = s_pVars[n];
+ }
+ }
+
+ for (DWORD n = 0; n < s_nVars; n++) {
+ EnvInfo *pInfo = pSorted[n];
+
+ if (pInfo == NULL) {
+ Print("<!-- Warning: Missing %d of %d -->\n", n, s_nVars);
+ continue;
+ }
+
+ if (pInfo->m_fUsed && pInfo->m_pwzVal[0]) {
+ Print("<t:Var var=\"%le\">%le</t:Var>\n", pInfo->m_pwzVar, pInfo->m_pwzVal);
+ }
+ }
+ GlobalFree((HGLOBAL)pSorted);
+
+ Tblog("</t:Vars>\n");
+
+ LockRelease();
+}
+
+void SaveEnvironment()
+{
+ LPWCH pwStrings = GetEnvironmentStringsW();
+ PCWSTR pwEnv = (PCWSTR)pwStrings;
+
+ while (*pwEnv != '\0') {
+ WCHAR wzVar[MAX_PATH];
+ PWCHAR pwzDst = wzVar;
+ PCWSTR pwzVal = NULL;
+
+ if (*pwEnv == '=') {
+ *pwzDst++ = *pwEnv++;
+ }
+ while (*pwEnv != '\0' && *pwEnv != '=') {
+ *pwzDst++ = *pwEnv++;
+ }
+ *pwzDst++ = '\0';
+
+ if (*pwEnv == '=') {
+ pwEnv++;
+ }
+
+ pwzVal = pwEnv;
+ while (*pwEnv != '\0') {
+ pwEnv++;
+ }
+ if (*pwEnv == '\0') {
+ pwEnv++;
+ }
+ if (wzVar[0] != '=') {
+ EnvVars::Add(wzVar, pwzVal);
+ }
+ }
+ FreeEnvironmentStringsW(pwStrings);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+struct ProcInfo
+{
+ HANDLE m_hProc;
+ DWORD m_nProcId;
+ DWORD m_nProc;
+};
+
+class Procs
+{
+ private:
+ static CRITICAL_SECTION s_csLock;
+ static DWORD s_nProcs;
+ static ProcInfo s_rProcs[4049];
+
+ private:
+ static ProcInfo& HashToSlot(HANDLE handle)
+ {
+ return s_rProcs[((DWORD_PTR)handle) % ARRAYSIZE(s_rProcs)];
+ }
+
+ static VOID LockAcquire()
+ {
+ EnterCriticalSection(&s_csLock);
+ }
+
+ static VOID LockRelease()
+ {
+ LeaveCriticalSection(&s_csLock);
+ }
+
+ public:
+ static VOID Initialize();
+ static ProcInfo * Create(HANDLE hProc, DWORD nProcId);
+ static BOOL Close(HANDLE hProc);
+};
+
+CRITICAL_SECTION Procs::s_csLock;
+DWORD Procs::s_nProcs = 0;
+ProcInfo Procs::s_rProcs[4049];
+
+VOID Procs::Initialize()
+{
+ InitializeCriticalSection(&s_csLock);
+ for (DWORD i = 0; i < ARRAYSIZE(s_rProcs); i++) {
+ s_rProcs[i].m_hProc = INVALID_HANDLE_VALUE;
+ }
+}
+
+ProcInfo * Procs::Create(HANDLE hProc, DWORD nProcId)
+{
+ LockAcquire();
+ s_nProcs++;
+ ProcInfo& slot = HashToSlot(hProc);
+ slot.m_hProc = hProc;
+ slot.m_nProcId = nProcId;
+ slot.m_nProc = s_nProcs;
+ Print("<!-- CreateProcess (%d)-->\n", slot.m_nProc);
+ LockRelease();
+
+ return &slot;
+}
+
+BOOL Procs::Close(HANDLE hProc)
+{
+ BOOL first = false;
+
+ LockAcquire();
+ ProcInfo& slot = HashToSlot(hProc);
+ if (slot.m_hProc == hProc) {
+ first = true;
+ Print("<!-- CloseProcess (%d)-->\n", slot.m_nProc);
+ slot.m_hProc = INVALID_HANDLE_VALUE;
+ slot.m_nProcId = 0;
+ slot.m_nProc = 0;
+ s_nProcs--;
+ }
+ LockRelease();
+
+ return first;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+struct FileInfo
+{
+ DWORD m_nHash;
+ DWORD m_nIndex;
+
+ BOOL m_fCantRead; // Set for file that are opened Create
+ BOOL m_fRead;
+ BOOL m_fWrite;
+
+ BOOL m_fDelete;
+ BOOL m_fCleanup;
+ BOOL m_fSystemPath;
+ BOOL m_fTemporaryPath;
+ BOOL m_fTemporaryFile;
+
+ DWORD m_cbRead;
+ DWORD m_cbWrite;
+
+ BOOL m_fAppend;
+ BOOL m_fAbsorbed; // Absorbed by TraceBld.
+ BOOL m_fDirectory;
+
+ PCWSTR m_pwzPath;
+ PBYTE m_pbContent;
+ DWORD m_cbContent;
+
+};
+
+//////////////////////////////////////////////////////////////////////////////
+//
+class FileNames
+{
+ private:
+ static CRITICAL_SECTION s_csLock;
+ static DWORD s_nFiles;
+ static DWORD s_nCapacity;
+ static FileInfo ** s_pFiles;
+
+ public:
+ static WCHAR s_wzSysPath[MAX_PATH];
+ static WCHAR s_wzS64Path[MAX_PATH];
+ static WCHAR s_wzTmpPath[MAX_PATH];
+ static WCHAR s_wzExePath[MAX_PATH];
+ static DWORD s_wcSysPath;
+ static DWORD s_wcS64Path;
+ static DWORD s_wcTmpPath;
+ static DWORD s_wcExePath;
+
+ private:
+ static DWORD Hash(PCWSTR pwzFile)
+ {
+ DWORD hash = 5381;
+ while (*pwzFile != 0) {
+ WCHAR c = *pwzFile++;
+ if (c >= 'A' && c <= 'Z') {
+ c += ('a' - 'A');
+ }
+ hash = ((hash << 5) + hash) + c;
+ }
+ return hash;
+ }
+
+ static VOID LockAcquire()
+ {
+ EnterCriticalSection(&s_csLock);
+ }
+
+ static VOID LockRelease()
+ {
+ LeaveCriticalSection(&s_csLock);
+ }
+
+ static VOID Resize(DWORD nCapacity);
+ static VOID Set(FileInfo *info);
+ static VOID Replace(PWCHAR pwzBuffer, PWCHAR pwzDstEnd, DWORD cwOld, PCWSTR pwzNew);
+
+ public:
+ static BOOL Equal(PCWSTR pwzA, PCWSTR pwzB)
+ {
+ return (Compare(pwzA, pwzB) == 0);
+ }
+
+ static BOOL PrefixMatch(PCWSTR pwzFile, PCWSTR pwzPrefix)
+ {
+ for (;;) {
+ WCHAR cFile = *pwzFile++;
+ WCHAR cPrefix = *pwzPrefix++;
+
+ if (cFile >= 'A' && cFile <= 'Z') {
+ cFile += ('a' - 'A');
+ }
+ if (cPrefix >= 'A' && cPrefix <= 'Z') {
+ cPrefix += ('a' - 'A');
+ }
+
+ if (cPrefix == 0) {
+ return TRUE;
+ }
+ if (cFile != cPrefix) {
+ return FALSE;
+ }
+ }
+ }
+
+ static BOOL SuffixMatch(PCWSTR pwzFile, PCWSTR pwzSuffix)
+ {
+ // Move both pointers to the end of the strings.
+ PCWSTR pwzFileBeg = pwzFile;
+ while (*pwzFile) {
+ pwzFile++;
+ }
+
+ PCWSTR pwzSuffixBeg = pwzSuffix;
+ while (*pwzSuffix) {
+ pwzSuffix++;
+ }
+
+ // Now walk backwards comparing strings.
+ for (;;) {
+ WCHAR cFile = (pwzFile > pwzFileBeg) ? *--pwzFile : 0;
+ WCHAR cSuffix = (pwzSuffix > pwzSuffixBeg) ? *--pwzSuffix : 0;
+
+ if (cFile >= 'A' && cFile <= 'Z') {
+ cFile += ('a' - 'A');
+ }
+ if (cSuffix >= 'A' && cSuffix <= 'Z') {
+ cSuffix += ('a' - 'A');
+ }
+
+ if (cSuffix == 0) {
+ return TRUE;
+ }
+ if (cFile != cSuffix) {
+ return FALSE;
+ }
+ }
+ }
+
+ static VOID EndInSlash(PWCHAR pwzPath)
+ {
+ if (*pwzPath) {
+ while (*pwzPath) {
+ pwzPath++;
+ }
+ if (pwzPath[-1] != '\\') {
+ *pwzPath++ = '\\';
+ *pwzPath = '\0';
+ }
+ }
+ }
+
+ public:
+ static VOID Initialize();
+ static VOID Dump();
+ static FileInfo * FindPartial(PCWSTR pwzPath);
+ static FileInfo * FindPartial(PCSTR pszPath);
+ static FileInfo * FindFull(PCWSTR pwzPath);
+ static PCWSTR ParameterizeName(PWCHAR pwzDst, DWORD cMaxDst, PCWSTR pwzPath);
+ static PCWSTR ParameterizeName(PWCHAR pwzDst, DWORD cMaxDst, FileInfo *pInfo);
+ static VOID ParameterizeLine(PWCHAR pwzDst, PWCHAR pwzDstEnd);
+};
+
+CRITICAL_SECTION FileNames::s_csLock;
+DWORD FileNames::s_nFiles = 0;
+DWORD FileNames::s_nCapacity = 0;
+FileInfo ** FileNames::s_pFiles;
+WCHAR FileNames::s_wzSysPath[MAX_PATH];
+WCHAR FileNames::s_wzS64Path[MAX_PATH];
+WCHAR FileNames::s_wzTmpPath[MAX_PATH];
+WCHAR FileNames::s_wzExePath[MAX_PATH];
+DWORD FileNames::s_wcSysPath;
+DWORD FileNames::s_wcS64Path;
+DWORD FileNames::s_wcTmpPath;
+DWORD FileNames::s_wcExePath;
+
+VOID FileNames::Initialize()
+{
+ InitializeCriticalSection(&s_csLock);
+
+ s_wzSysPath[0] = '\0';
+ GetSystemDirectoryW(s_wzSysPath, ARRAYSIZE(s_wzSysPath));
+ EndInSlash(s_wzSysPath);
+
+ s_wzS64Path[0] = '\0';
+ GetWindowsDirectoryW(s_wzS64Path, ARRAYSIZE(s_wzS64Path));
+ EndInSlash(s_wzS64Path);
+ Copy(s_wzS64Path + Size(s_wzS64Path), L"SysWOW64\\");
+
+ s_wzTmpPath[0] = '\0';
+ GetTempPathW(ARRAYSIZE(s_wzTmpPath), s_wzTmpPath);
+ EndInSlash(s_wzTmpPath);
+
+ s_wzExePath[0] = '\0';
+ GetModuleFileNameW(NULL, s_wzExePath, ARRAYSIZE(s_wzExePath));
+ PWCHAR pwzLast = s_wzExePath;
+ for (PWCHAR pwz = s_wzExePath; *pwz; pwz++) {
+ if (*pwz == '\\') {
+ pwzLast = pwz;
+ }
+ }
+ if (*pwzLast == '\\') {
+ *++pwzLast = '\0';
+ }
+
+ s_wcSysPath = Size(s_wzSysPath);
+ s_wcS64Path = Size(s_wzS64Path);
+ s_wcTmpPath = Size(s_wzTmpPath);
+ s_wcExePath = Size(s_wzExePath);
+
+ Resize(4049);
+}
+
+VOID FileNames::Resize(DWORD nCapacity)
+{
+ if (nCapacity > s_nCapacity) {
+ DWORD nOld = s_nCapacity;
+ FileInfo ** pOld = s_pFiles;
+
+ s_pFiles = (FileInfo **)GlobalAlloc(GPTR, nCapacity * sizeof(FileInfo *));
+ s_nCapacity = nCapacity;
+
+ if (pOld != NULL) {
+ for (DWORD n = 0; n < nOld; n++) {
+ if (pOld[n] != NULL) {
+ Set(pOld[n]);
+ }
+ }
+ GlobalFree((HGLOBAL)pOld);
+ pOld = NULL;
+ }
+ s_nCapacity = nCapacity;
+ }
+}
+
+VOID FileNames::Set(FileInfo *info)
+{
+ DWORD hash = info->m_nHash;
+ DWORD slot = hash % s_nCapacity;
+ DWORD death = 0;
+
+ // Find an empty slot.
+ for (; s_pFiles[slot] != NULL; slot = (slot + 1) % s_nCapacity) {
+ if (++death > s_nCapacity) {
+ // We should have dropped out at some point...
+ DEBUG_BREAK();
+ }
+ }
+
+ s_pFiles[slot] = info;
+}
+
+FileInfo * FileNames::FindFull(PCWSTR pwzPath)
+{
+ if (pwzPath == NULL) {
+ return NULL;
+ }
+
+ LockAcquire();
+
+ DWORD hash = Hash(pwzPath);
+ DWORD slot = hash % s_nCapacity;
+ FileInfo *info = NULL;
+ DWORD death = 0;
+
+ // Find the the matching slot, or an empty one.
+ for (; s_pFiles[slot] != NULL; slot = (slot + 1) % s_nCapacity) {
+ if (Equal(s_pFiles[slot]->m_pwzPath, pwzPath)) {
+ info = s_pFiles[slot];
+ goto succeed;
+ }
+ if (++death > s_nCapacity) {
+ // We should have dropped out at some point...
+ DEBUG_BREAK();
+ }
+ }
+
+ // Add the file to list of known files.
+ info = (FileInfo *)GlobalAlloc(GPTR, sizeof(FileInfo));
+ info->m_nHash = hash;
+ info->m_nIndex = s_nFiles++;
+ info->m_pwzPath = Save(pwzPath);
+ info->m_fSystemPath = (PrefixMatch(info->m_pwzPath, s_wzSysPath) ||
+ PrefixMatch(info->m_pwzPath, s_wzS64Path));
+ info->m_fTemporaryPath = PrefixMatch(info->m_pwzPath, s_wzTmpPath);
+ info->m_fTemporaryFile = SuffixMatch(info->m_pwzPath, L".tmp");
+
+ s_pFiles[slot] = info;
+
+ // Check if we should grow the table.
+ if (s_nFiles > (s_nCapacity / 2)) {
+ Resize(s_nCapacity * 2 - 1);
+ }
+
+ succeed:
+ LockRelease();
+
+ return info;
+}
+
+FileInfo * FileNames::FindPartial(PCWSTR pwzPath)
+{
+ WCHAR wzPath[MAX_PATH];
+ PWCHAR pwzFile = NULL;
+
+ if (!GetFullPathNameW(pwzPath, ARRAYSIZE(wzPath), wzPath, &pwzFile)) {
+ return FindFull(pwzPath);
+ }
+ else {
+ return FindFull(wzPath);
+ }
+}
+
+FileInfo * FileNames::FindPartial(PCSTR pwzPath)
+{
+ WCHAR wzPath[MAX_PATH];
+ PWCHAR pwzFile = wzPath;
+
+ while (*pwzPath) {
+ *pwzFile++ = *pwzPath++;
+ }
+ *pwzFile = '\0';
+
+ return FindPartial(wzPath);
+}
+
+PCWSTR FileNames::ParameterizeName(PWCHAR pwzDst, DWORD cMaxDst, FileInfo *pInfo)
+{
+ return ParameterizeName(pwzDst, cMaxDst, pInfo->m_pwzPath);
+}
+
+PCWSTR FileNames::ParameterizeName(PWCHAR pwzDst, DWORD cMaxDst, PCWSTR pwzPath)
+{
+ if (PrefixMatch(pwzPath, s_wzSysPath)) {
+ Copy(pwzDst, L"%SYSDIR%\\");
+ Copy(pwzDst + Size(pwzDst), pwzPath + s_wcSysPath);
+ goto finish;
+ }
+ else if (PrefixMatch(pwzPath, s_wzS64Path)) {
+ Copy(pwzDst, L"%SYSDIR%\\");
+ Copy(pwzDst + Size(pwzDst), pwzPath + s_wcS64Path);
+ goto finish;
+ }
+ else if (PrefixMatch(pwzPath, s_wzTmpPath)) {
+ Copy(pwzDst, L"%TMPDIR%\\");
+ Copy(pwzDst + Size(pwzDst), pwzPath + s_wcTmpPath);
+ goto finish;
+ }
+ else {
+ Copy(pwzDst, pwzPath);
+
+ finish:
+#if 0 // to convert to all lower case.
+ for (PWCHAR pwz = pwzDst; *pwz && pwz < pwzDst + cMaxDst; pwz++) {
+ if (*pwz >= 'A' && *pwz <= 'Z') {
+ *pwz = 'a' + (*pwz - 'A');
+ }
+ }
+#else
+ (void)cMaxDst;
+#endif
+ return pwzDst;
+ }
+}
+
+VOID FileNames::Replace(PWCHAR pwzDst, PWCHAR pwzDstEnd, DWORD cwOld, PCWSTR pwzNew)
+{
+ DWORD cwNew = Size(pwzNew);
+ DWORD cwDst = Size(pwzDst);
+
+ if (cwOld < cwNew) { // We have to insert.
+ if ((cwDst + cwNew - cwOld) >= (DWORD)(pwzDstEnd - pwzDst)) {
+ // Won't fit, so abort.
+ return;
+ }
+
+ PWCHAR pwzTo = pwzDst + cwDst + (cwNew - cwOld);
+ PWCHAR pwzFm = pwzDst + cwDst;
+
+ while (pwzTo >= pwzDst) {
+ *pwzTo-- = *pwzFm--;
+ }
+ }
+ else if (cwOld > cwNew) { // We have to remove.
+ PWCHAR pwzTo = pwzDst + cwNew;
+ PWCHAR pwzFm = pwzDst + cwOld;
+
+ while (*pwzFm) {
+ *pwzTo++ = *pwzFm++;
+ }
+ *pwzTo = '\0';
+ }
+
+ // Now write the new string.
+ while (*pwzNew) {
+ *pwzDst++ = *pwzNew++;
+ }
+}
+
+VOID FileNames::ParameterizeLine(PWCHAR pwzDst, PWCHAR pwzDstEnd)
+{
+ for (; *pwzDst != '\0'; pwzDst++) {
+ if (PrefixMatch(pwzDst, s_wzSysPath)) {
+ Replace(pwzDst, pwzDstEnd, s_wcSysPath, L"%SYSDIR%\\");
+ }
+ else if (PrefixMatch(pwzDst, s_wzS64Path)) {
+ Replace(pwzDst, pwzDstEnd, s_wcS64Path, L"%SYSDIR%\\");
+ }
+ else if (PrefixMatch(pwzDst, s_wzTmpPath)) {
+ Replace(pwzDst, pwzDstEnd, s_wcTmpPath, L"%TMPDIR%\\");
+ }
+ }
+}
+
+VOID FileNames::Dump()
+{
+ WCHAR wzPath[MAX_PATH];
+
+ if (s_nFiles == 0) {
+ return;
+ }
+
+ LockAcquire();
+
+ Tblog("<t:Files>\n");
+
+ FileInfo ** pSorted = (FileInfo **)GlobalAlloc(GPTR, s_nFiles * sizeof(FileInfo *));
+
+ for (DWORD n = 0; n < s_nCapacity; n++) {
+ if (s_pFiles[n] != NULL) {
+ if (s_pFiles[n]->m_nIndex > s_nFiles) {
+ DEBUG_BREAK();
+ }
+ pSorted[s_pFiles[n]->m_nIndex] = s_pFiles[n];
+ }
+ }
+
+ for (DWORD n = 0; n < s_nFiles; n++) {
+ FileInfo *pInfo = pSorted[n];
+
+ if (pInfo == NULL) {
+ Print("<!-- Warning: Missing %d of %d -->\n", n, s_nFiles);
+ continue;
+ }
+
+ BOOL fRead = pInfo->m_fRead;
+ BOOL fWrite = pInfo->m_fWrite;
+ BOOL fDelete = (pInfo->m_fDelete);
+ BOOL fCleanup = (pInfo->m_fCleanup);
+ BOOL fAppend = (pInfo->m_fAppend);
+
+#if 0
+ if (fDelete && !fRead && !fWrite) {
+ Print("<!-- Discarding: %ls -->\n", pInfo->m_pwzPath);
+ // Discard pipe files only passed to children.
+ continue;
+ }
+#endif
+ if (pInfo->m_fAbsorbed) {
+ // Discard response fles
+ continue;
+ }
+
+ if (PrefixMatch(pInfo->m_pwzPath, s_wzExePath) ||
+ PrefixMatch(pInfo->m_pwzPath, s_wzSysPath) ||
+ PrefixMatch(pInfo->m_pwzPath, s_wzS64Path)) {
+ // Discard files from exec directory (because considered internal to code).
+ continue;
+ }
+
+#if 1 // Ignore PIPEs.
+ if (FileNames::PrefixMatch(pInfo->m_pwzPath, L"\\\\.\\PIPE\\")) {
+ continue;
+ }
+#endif
+ if (FileNames::SuffixMatch(pInfo->m_pwzPath, L"\\conout$")) {
+ continue;
+ }
+ if (FileNames::SuffixMatch(pInfo->m_pwzPath, L"\\conin$")) {
+ continue;
+ }
+ if (FileNames::SuffixMatch(pInfo->m_pwzPath, L"\\nul")) {
+ continue;
+ }
+
+ ParameterizeName(wzPath, ARRAYSIZE(wzPath), pInfo);
+
+ if (pInfo->m_fDirectory) {
+ Print("<t:File mkdir=\"true\">%ls</t:File>\n", wzPath);
+ continue;
+ }
+
+ if (!fRead && !fWrite && !fDelete && !fCleanup) {
+ // Discard do "none" files.
+ continue;
+ }
+
+ if (pInfo->m_pbContent == NULL ||
+ pInfo->m_fDelete ||
+ pInfo->m_fCleanup ||
+ pInfo->m_fWrite) {
+
+ Print("<t:File%s%s%s%s%s>%ls</t:File>\n",
+ fRead ? " read=\"true\"" : "",
+ fWrite ? " write=\"true\"" : "",
+ fDelete ? " delete=\"true\"" : "",
+ fCleanup ? " cleanup=\"true\"" : "",
+ fAppend ? " append=\"true\"" : "",
+ // size=\"%d\" pInfo->m_cbContent,
+ wzPath);
+ }
+ else if ((pInfo->m_pbContent)[0] == 0xff && (pInfo->m_pbContent)[1] == 0xfe) {
+ // Unicode
+ Print("<t:File%s%s%s%s%s>%ls<t:Data>%le</t:Data></t:File>\n",
+ fRead ? " read=\"true\"" : "",
+ fWrite ? " write=\"true\"" : "",
+ fDelete ? " delete=\"true\"" : "",
+ fCleanup ? " cleanup=\"true\"" : "",
+ fAppend ? " append=\"true\"" : "",
+ // size=\"%d\" pInfo->m_cbContent,
+ wzPath,
+ RemoveReturns((PWCHAR)pInfo->m_pbContent));
+ }
+ else {
+ // Ascii
+ Print("<t:File%s%s%s%s%s>%ls<t:Data>%he</t:Data></t:File>\n",
+ fRead ? " read=\"true\"" : "",
+ fWrite ? " write=\"true\"" : "",
+ fDelete ? " delete=\"true\"" : "",
+ fCleanup ? " cleanup=\"true\"" : "",
+ fAppend ? " append=\"true\"" : "",
+ // size=\"%d\" pInfo->m_cbContent,
+ wzPath,
+ RemoveReturns((PCHAR)pInfo->m_pbContent));
+ }
+
+ if (pInfo->m_pbContent != NULL) {
+ GlobalFree((HGLOBAL)pInfo->m_pbContent);
+ pInfo->m_pbContent = NULL;
+ }
+ }
+ GlobalFree((HGLOBAL)pSorted);
+
+ Tblog("</t:Files>\n");
+
+ LockRelease();
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+//
+class OpenFiles
+{
+ private:
+ struct SLOT
+ {
+ HANDLE m_hHandle;
+ FileInfo * m_pFile;
+ ProcInfo * m_pProc;
+ };
+
+ private:
+ static CRITICAL_SECTION s_csLock;
+ static DWORD s_nHandles;
+ static SLOT s_rHandles[4049];
+
+ private:
+ static SLOT& HashToSlot(HANDLE handle)
+ {
+ return s_rHandles[((DWORD_PTR)handle) % ARRAYSIZE(s_rHandles)];
+ }
+
+ static VOID LockAcquire()
+ {
+ EnterCriticalSection(&s_csLock);
+ }
+
+ static VOID LockRelease()
+ {
+ LeaveCriticalSection(&s_csLock);
+ }
+
+ public:
+ static VOID Initialize();
+
+ static VOID SetWrite(HANDLE hFile, DWORD cbData)
+ {
+ SLOT& slot = HashToSlot(hFile);
+ if (slot.m_hHandle == hFile) {
+ slot.m_pFile->m_fWrite = TRUE;
+ slot.m_pFile->m_cbWrite += cbData;
+ }
+ }
+
+ static VOID SetRead(HANDLE hFile, DWORD cbData)
+ {
+ SLOT& slot = HashToSlot(hFile);
+ if (slot.m_hHandle == hFile) {
+ slot.m_pFile->m_fRead = TRUE;
+ slot.m_pFile->m_cbRead += cbData;
+ }
+ }
+
+ static BOOL Forget(HANDLE handle);
+ static BOOL Remember(HANDLE hFile, FileInfo *pInfo);
+ static BOOL Remember(HANDLE hProc, ProcInfo *pInfo);
+ static FileInfo * RecallFile(HANDLE hFile);
+ static ProcInfo * RecallProc(HANDLE hProc);
+};
+
+CRITICAL_SECTION OpenFiles::s_csLock; // Guards access to OpenFile stuctures.
+DWORD OpenFiles::s_nHandles = 0;
+OpenFiles::SLOT OpenFiles::s_rHandles[4049];
+
+VOID OpenFiles::Initialize()
+{
+ InitializeCriticalSection(&s_csLock);
+ for (DWORD n = 0; n < ARRAYSIZE(s_rHandles); n++) {
+ s_rHandles[n].m_hHandle = INVALID_HANDLE_VALUE;
+ s_rHandles[n].m_pFile = NULL;
+ s_rHandles[n].m_pProc = NULL;
+ }
+}
+
+BOOL OpenFiles::Forget(HANDLE handle)
+{
+ LockAcquire();
+ OpenFiles::SLOT& slot = HashToSlot(handle);
+
+ if (slot.m_hHandle == handle ) {
+ slot.m_hHandle = INVALID_HANDLE_VALUE;
+ slot.m_pFile = NULL;
+ slot.m_pProc = NULL;
+ s_nHandles--;
+ }
+ LockRelease();
+ return FALSE;
+}
+
+BOOL OpenFiles::Remember(HANDLE hFile, FileInfo *pFile)
+{
+ LockAcquire();
+
+ OpenFiles::SLOT& slot = HashToSlot(hFile);
+ if (slot.m_hHandle != hFile && slot.m_hHandle != INVALID_HANDLE_VALUE) {
+ // hash collision
+ DEBUG_BREAK();
+ }
+
+ slot.m_hHandle = hFile;
+ slot.m_pFile = pFile;
+ slot.m_pProc = NULL;
+ s_nHandles++;
+
+ LockRelease();
+
+ return TRUE;
+}
+
+BOOL OpenFiles::Remember(HANDLE hProc, ProcInfo *pProc)
+{
+ LockAcquire();
+
+ OpenFiles::SLOT& slot = HashToSlot(hProc);
+ if (slot.m_hHandle != hProc && slot.m_hHandle != INVALID_HANDLE_VALUE) {
+ // hash collision
+ DEBUG_BREAK();
+ }
+
+ slot.m_hHandle = hProc;
+ slot.m_pProc = pProc;
+ slot.m_pFile = NULL;
+ s_nHandles++;
+
+ LockRelease();
+
+ return TRUE;
+}
+
+FileInfo * OpenFiles::RecallFile(HANDLE hFile)
+{
+ LockAcquire();
+
+ OpenFiles::SLOT& slot = HashToSlot(hFile);
+
+ if (slot.m_hHandle == hFile) {
+ LockRelease();
+ return slot.m_pFile;
+ }
+ LockRelease();
+ return NULL;
+}
+
+ProcInfo * OpenFiles::RecallProc(HANDLE hProc)
+{
+ LockAcquire();
+
+ OpenFiles::SLOT& slot = HashToSlot(hProc);
+
+ if (slot.m_hHandle == hProc) {
+ LockRelease();
+ return slot.m_pProc;
+ }
+ LockRelease();
+ return NULL;
+}
+
+///////////////////////////////////////////////////////////////////// VPrintf.
+//
+// Completely side-effect free printf replacement (but no FP numbers).
+//
+static PCHAR do_base(PCHAR pszOut, UINT64 nValue, UINT nBase, PCSTR pszDigits)
+{
+ CHAR szTmp[96];
+ int nDigit = sizeof(szTmp)-2;
+ for (; nDigit >= 0; nDigit--) {
+ szTmp[nDigit] = pszDigits[nValue % nBase];
+ nValue /= nBase;
+ }
+ for (nDigit = 0; nDigit < sizeof(szTmp) - 2 && szTmp[nDigit] == '0'; nDigit++) {
+ // skip leading zeros.
+ }
+ for (; nDigit < sizeof(szTmp) - 1; nDigit++) {
+ *pszOut++ = szTmp[nDigit];
+ }
+ *pszOut = '\0';
+ return pszOut;
+}
+
+static PCHAR do_str(PCHAR pszOut, PCHAR pszEnd, PCSTR pszIn)
+{
+ while (*pszIn && pszOut < pszEnd) {
+ *pszOut++ = *pszIn++;
+ }
+ *pszOut = '\0';
+ return pszOut;
+}
+
+static PCHAR do_wstr(PCHAR pszOut, PCHAR pszEnd, PCWSTR pszIn)
+{
+ while (*pszIn && pszOut < pszEnd) {
+ *pszOut++ = (CHAR)*pszIn++;
+ }
+ *pszOut = '\0';
+ return pszOut;
+}
+
+static PCHAR do_estr(PCHAR pszOut, PCHAR pszEnd, PCSTR pszIn)
+{
+ while (*pszIn && pszOut < pszEnd) {
+ if (*pszIn == '<') {
+ if (pszOut + 4 > pszEnd) {
+ break;
+ }
+ pszIn++;
+ *pszOut++ = '&';
+ *pszOut++ = 'l';
+ *pszOut++ = 't';
+ *pszOut++ = ';';
+ }
+ else if (*pszIn == '>') {
+ if (pszOut + 4 > pszEnd) {
+ break;
+ }
+ pszIn++;
+ *pszOut++ = '&';
+ *pszOut++ = 'g';
+ *pszOut++ = 't';
+ *pszOut++ = ';';
+ }
+ else if (*pszIn == '&') {
+ if (pszOut + 5 > pszEnd) {
+ break;
+ }
+ pszIn++;
+ *pszOut++ = '&';
+ *pszOut++ = 'a';
+ *pszOut++ = 'm';
+ *pszOut++ = 'p';
+ *pszOut++ = ';';
+ }
+ else if (*pszIn == '\"') {
+ if (pszOut + 6 > pszEnd) {
+ break;
+ }
+ pszIn++;
+ *pszOut++ = '&';
+ *pszOut++ = 'q';
+ *pszOut++ = 'u';
+ *pszOut++ = 'o';
+ *pszOut++ = 't';
+ *pszOut++ = ';';
+ }
+ else if (*pszIn == '\'') {
+ if (pszOut + 6 > pszEnd) {
+ break;
+ }
+ pszIn++;
+ *pszOut++ = '&';
+ *pszOut++ = 'a';
+ *pszOut++ = 'p';
+ *pszOut++ = 'o';
+ *pszOut++ = 's';
+ *pszOut++ = ';';
+ }
+ else if (*pszIn < ' ') {
+ BYTE c = (BYTE)(*pszIn++);
+ if (c < 10 && pszOut + 4 <= pszEnd) {
+ *pszOut++ = '&';
+ *pszOut++ = '#';
+ *pszOut++ = '0' + (c % 10);
+ *pszOut++ = ';';
+ }
+ else if (c < 100 && pszOut + 5 <= pszEnd) {
+ *pszOut++ = '&';
+ *pszOut++ = '#';
+ *pszOut++ = '0' + ((c / 10) % 10);
+ *pszOut++ = '0' + (c % 10);
+ *pszOut++ = ';';
+ }
+ else if (c < 1000 && pszOut + 6 <= pszEnd) {
+ *pszOut++ = '&';
+ *pszOut++ = '#';
+ *pszOut++ = '0' + ((c / 100) % 10);
+ *pszOut++ = '0' + ((c / 10) % 10);
+ *pszOut++ = '0' + (c % 10);
+ *pszOut++ = ';';
+ }
+ else {
+ break;
+ }
+ }
+ else {
+ *pszOut++ = *pszIn++;
+ }
+ }
+ *pszOut = '\0';
+ return pszOut;
+}
+
+static PCHAR do_ewstr(PCHAR pszOut, PCHAR pszEnd, PCWSTR pszIn)
+{
+ while (*pszIn && pszOut < pszEnd) {
+ if (*pszIn == '<') {
+ if (pszOut + 4 > pszEnd) {
+ break;
+ }
+ pszIn++;
+ *pszOut++ = '&';
+ *pszOut++ = 'l';
+ *pszOut++ = 't';
+ *pszOut++ = ';';
+ }
+ else if (*pszIn == '>') {
+ if (pszOut + 4 > pszEnd) {
+ break;
+ }
+ pszIn++;
+ *pszOut++ = '&';
+ *pszOut++ = 'g';
+ *pszOut++ = 't';
+ *pszOut++ = ';';
+ }
+ else if (*pszIn == '&') {
+ if (pszOut + 5 > pszEnd) {
+ break;
+ }
+ pszIn++;
+ *pszOut++ = '&';
+ *pszOut++ = 'a';
+ *pszOut++ = 'm';
+ *pszOut++ = 'p';
+ *pszOut++ = ';';
+ }
+ else if (*pszIn == '\"') {
+ if (pszOut + 6 > pszEnd) {
+ break;
+ }
+ pszIn++;
+ *pszOut++ = '&';
+ *pszOut++ = 'q';
+ *pszOut++ = 'u';
+ *pszOut++ = 'o';
+ *pszOut++ = 't';
+ *pszOut++ = ';';
+ }
+ else if (*pszIn == '\'') {
+ if (pszOut + 6 > pszEnd) {
+ break;
+ }
+ pszIn++;
+ *pszOut++ = '&';
+ *pszOut++ = 'a';
+ *pszOut++ = 'p';
+ *pszOut++ = 'o';
+ *pszOut++ = 's';
+ *pszOut++ = ';';
+ }
+ else if (*pszIn < ' ' || *pszIn > 127) {
+ WCHAR c = *pszIn++;
+ if (c < 10 && pszOut + 4 <= pszEnd) {
+ *pszOut++ = '&';
+ *pszOut++ = '#';
+ *pszOut++ = '0' + (CHAR)(c % 10);
+ *pszOut++ = ';';
+ }
+ else if (c < 100 && pszOut + 5 <= pszEnd) {
+ *pszOut++ = '&';
+ *pszOut++ = '#';
+ *pszOut++ = '0' + (CHAR)((c / 10) % 10);
+ *pszOut++ = '0' + (CHAR)(c % 10);
+ *pszOut++ = ';';
+ }
+ else if (c < 1000 && pszOut + 6 <= pszEnd) {
+ *pszOut++ = '&';
+ *pszOut++ = '#';
+ *pszOut++ = '0' + (CHAR)((c / 100) % 10);
+ *pszOut++ = '0' + (CHAR)((c / 10) % 10);
+ *pszOut++ = '0' + (CHAR)(c % 10);
+ *pszOut++ = ';';
+ }
+ else {
+ break;
+ }
+ }
+ else {
+ *pszOut++ = (CHAR)*pszIn++;
+ }
+ }
+ *pszOut = '\0';
+ return pszOut;
+}
+
+#if _MSC_VER >= 1900
+#pragma warning(push)
+#pragma warning(disable:4456) // declaration hides previous local declaration
+#endif
+
+VOID VSafePrintf(PCSTR pszMsg, va_list args, PCHAR pszBuffer, LONG cbBuffer)
+{
+ PCHAR pszOut = pszBuffer;
+ PCHAR pszEnd = pszBuffer + cbBuffer - 1;
+ pszBuffer[0] = '\0';
+
+ __try {
+ while (*pszMsg && pszOut < pszEnd) {
+ if (*pszMsg == '%') {
+ CHAR szHead[4] = "";
+ INT nLen;
+ INT nWidth = 0;
+ INT nPrecision = 0;
+ BOOL fLeft = FALSE;
+ BOOL fPositive = FALSE;
+ BOOL fPound = FALSE;
+ BOOL fBlank = FALSE;
+ BOOL fZero = FALSE;
+ BOOL fDigit = FALSE;
+ BOOL fSmall = FALSE;
+ BOOL fLarge = FALSE;
+ BOOL f64Bit = FALSE;
+ PCSTR pszArg = pszMsg;
+
+ pszMsg++;
+
+ for (; (*pszMsg == '-' ||
+ *pszMsg == '+' ||
+ *pszMsg == '#' ||
+ *pszMsg == ' ' ||
+ *pszMsg == '0'); pszMsg++) {
+ switch (*pszMsg) {
+ case '-': fLeft = TRUE; break;
+ case '+': fPositive = TRUE; break;
+ case '#': fPound = TRUE; break;
+ case ' ': fBlank = TRUE; break;
+ case '0': fZero = TRUE; break;
+ }
+ }
+
+ if (*pszMsg == '*') {
+ nWidth = va_arg(args, INT);
+ pszMsg++;
+ }
+ else {
+ while (*pszMsg >= '0' && *pszMsg <= '9') {
+ nWidth = nWidth * 10 + (*pszMsg++ - '0');
+ }
+ }
+ if (*pszMsg == '.') {
+ pszMsg++;
+ fDigit = TRUE;
+ if (*pszMsg == '*') {
+ nPrecision = va_arg(args, INT);
+ pszMsg++;
+ }
+ else {
+ while (*pszMsg >= '0' && *pszMsg <= '9') {
+ nPrecision = nPrecision * 10 + (*pszMsg++ - '0');
+ }
+ }
+ }
+
+ if (*pszMsg == 'h') {
+ fSmall = TRUE;
+ pszMsg++;
+ }
+ else if (*pszMsg == 'l') {
+ fLarge = TRUE;
+ pszMsg++;
+ }
+ else if (*pszMsg == 'I' && pszMsg[1] == '6' && pszMsg[2] == '4') {
+ f64Bit = TRUE;
+ pszMsg += 3;
+ }
+
+ if (*pszMsg == 's' || *pszMsg == 'e' || *pszMsg == 'c') {
+ // We ignore the length, precision, and alignment
+ // to avoid using a temporary buffer.
+
+ if (*pszMsg == 's') { // [GalenH] need to not use temp.
+ PVOID pvData = va_arg(args, PVOID);
+
+ pszMsg++;
+
+ if (fSmall) {
+ fLarge = FALSE;
+ }
+
+ __try {
+ if (pvData == NULL) {
+ pszOut = do_str(pszOut, pszEnd, "-NULL-");
+ }
+ else if (fLarge) {
+ pszOut = do_wstr(pszOut, pszEnd, (PWCHAR)pvData);
+ }
+ else {
+ pszOut = do_str(pszOut, pszEnd, (PCHAR)pvData);
+ }
+ } __except(EXCEPTION_EXECUTE_HANDLER) {
+ pszOut = do_str(pszOut, pszEnd, "-");
+ pszOut = do_base(pszOut, (UINT64)pvData, 16,
+ "0123456789ABCDEF");
+ pszOut = do_str(pszOut, pszEnd, "-");
+ }
+ }
+ else if (*pszMsg == 'e') { // Escape the string.
+ PVOID pvData = va_arg(args, PVOID);
+
+ pszMsg++;
+
+ if (fSmall) {
+ fLarge = FALSE;
+ }
+
+ __try {
+ if (pvData == NULL) {
+ pszOut = do_str(pszOut, pszEnd, "-NULL-");
+ }
+ else if (fLarge) {
+ pszOut = do_ewstr(pszOut, pszEnd, (PWCHAR)pvData);
+ }
+ else {
+ pszOut = do_estr(pszOut, pszEnd, (PCHAR)pvData);
+ }
+ } __except(EXCEPTION_EXECUTE_HANDLER) {
+ pszOut = do_str(pszOut, pszEnd, "-");
+ pszOut = do_base(pszOut, (UINT64)pvData, 16,
+ "0123456789ABCDEF");
+ pszOut = do_str(pszOut, pszEnd, "-");
+ }
+ }
+ else {
+ CHAR szTemp[2];
+ pszMsg++;
+
+ szTemp[0] = (CHAR)va_arg(args, INT);
+ szTemp[1] = '\0';
+ pszOut = do_str(pszOut, pszEnd, szTemp);
+ }
+ }
+ else if (*pszMsg == 'd' || *pszMsg == 'i' || *pszMsg == 'o' ||
+ *pszMsg == 'x' || *pszMsg == 'X' || *pszMsg == 'b' ||
+ *pszMsg == 'u') {
+ CHAR szTemp[128];
+ UINT64 value;
+ if (f64Bit) {
+ value = va_arg(args, UINT64);
+ }
+ else {
+ value = va_arg(args, UINT);
+ }
+
+ if (*pszMsg == 'x') {
+ pszMsg++;
+ nLen = (int)(do_base(szTemp, value, 16, "0123456789abcdef") - szTemp);
+ if (fPound && value) {
+ do_str(szHead, szHead + sizeof(szHead) - 1, "0x");
+ }
+ }
+ else if (*pszMsg == 'X') {
+ pszMsg++;
+ nLen = (int)(do_base(szTemp, value, 16, "0123456789ABCDEF") - szTemp);
+ if (fPound && value) {
+ do_str(szHead, szHead + sizeof(szHead) - 1, "0X");
+ }
+ }
+ else if (*pszMsg == 'd') {
+ pszMsg++;
+ if ((INT64)value < 0) {
+ value = -(INT64)value;
+ do_str(szHead, szHead + sizeof(szHead) - 1, "-");
+ }
+ else if (fPositive) {
+ if (value > 0) {
+ do_str(szHead, szHead + sizeof(szHead) - 1, "+");
+ }
+ }
+ else if (fBlank) {
+ if (value > 0) {
+ do_str(szHead, szHead + sizeof(szHead) - 1, " ");
+ }
+ }
+ nLen = (int)(do_base(szTemp, value, 10, "0123456789") - szTemp);
+ nPrecision = 0;
+ }
+ else if (*pszMsg == 'u') {
+ pszMsg++;
+ nLen = (int)(do_base(szTemp, value, 10, "0123456789") - szTemp);
+ nPrecision = 0;
+ }
+ else if (*pszMsg == 'o') {
+ pszMsg++;
+ nLen = (int)(do_base(szTemp, value, 8, "01234567") - szTemp);
+ nPrecision = 0;
+
+ if (fPound && value) {
+ do_str(szHead, szHead + sizeof(szHead) - 1, "0");
+ }
+ }
+ else if (*pszMsg == 'b') {
+ pszMsg++;
+ nLen = (int)(do_base(szTemp, value, 2, "01") - szTemp);
+ nPrecision = 0;
+
+ if (fPound && value) {
+ do_str(szHead, szHead + sizeof(szHead) - 1, "0b");
+ }
+ }
+ else {
+ pszMsg++;
+ if ((INT64)value < 0) {
+ value = -(INT64)value;
+ do_str(szHead, szHead + sizeof(szHead) - 1, "-");
+ }
+ else if (fPositive) {
+ if (value > 0) {
+ do_str(szHead, szHead + sizeof(szHead) - 1, "+");
+ }
+ }
+ else if (fBlank) {
+ if (value > 0) {
+ do_str(szHead, szHead + sizeof(szHead) - 1, " ");
+ }
+ }
+ nLen = (int)(do_base(szTemp, value, 10, "0123456789") - szTemp);
+ nPrecision = 0;
+ }
+
+ INT nHead = 0;
+ for (; szHead[nHead]; nHead++) {
+ // Count characters in head string.
+ }
+
+ if (fLeft) {
+ if (nHead) {
+ pszOut = do_str(pszOut, pszEnd, szHead);
+ nLen += nHead;
+ }
+ pszOut = do_str(pszOut, pszEnd, szTemp);
+ for (; nLen < nWidth && pszOut < pszEnd; nLen++) {
+ *pszOut++ = ' ';
+ }
+ }
+ else if (fZero) {
+ if (nHead) {
+ pszOut = do_str(pszOut, pszEnd, szHead);
+ nLen += nHead;
+ }
+ for (; nLen < nWidth && pszOut < pszEnd; nLen++) {
+ *pszOut++ = '0';
+ }
+ pszOut = do_str(pszOut, pszEnd, szTemp);
+ }
+ else {
+ if (nHead) {
+ nLen += nHead;
+ }
+ for (; nLen < nWidth && pszOut < pszEnd; nLen++) {
+ *pszOut++ = ' ';
+ }
+ if (nHead) {
+ pszOut = do_str(pszOut, pszEnd, szHead);
+ }
+ pszOut = do_str(pszOut, pszEnd, szTemp);
+ }
+ }
+ else if (*pszMsg == 'p') {
+ CHAR szTemp[64];
+ ULONG_PTR value;
+ value = va_arg(args, ULONG_PTR);
+
+ if (*pszMsg == 'p') {
+ pszMsg++;
+ nLen = (int)(do_base(szTemp, (UINT64)value, 16, "0123456789abcdef") - szTemp);
+ if (fPound && value) {
+ do_str(szHead, szHead + sizeof(szHead) - 1, "0x");
+ }
+ }
+ else {
+ pszMsg++;
+ nLen = (int)(do_base(szTemp, (UINT64)value, 16, "0123456789ABCDEF") - szTemp);
+ if (fPound && value) {
+ do_str(szHead, szHead + sizeof(szHead) - 1, "0x");
+ }
+ }
+
+ INT nHead = 0;
+ for (; szHead[nHead]; nHead++) {
+ // Count characters in head string.
+ }
+
+ if (nHead) {
+ pszOut = do_str(pszOut, pszEnd, szHead);
+ nLen += nHead;
+ }
+ for (; nLen < nWidth && pszOut < pszEnd; nLen++) {
+ *pszOut++ = '0';
+ }
+ pszOut = do_str(pszOut, pszEnd, szTemp);
+ }
+ else {
+ pszMsg++;
+ while (pszArg < pszMsg && pszOut < pszEnd) {
+ *pszOut++ = *pszArg++;
+ }
+ }
+ }
+ else {
+ if (pszOut < pszEnd) {
+ *pszOut++ = *pszMsg++;
+ }
+ }
+ }
+ *pszOut = '\0';
+ pszBuffer[cbBuffer - 1] = '\0';
+ } __except(EXCEPTION_EXECUTE_HANDLER) {
+ PCHAR pszOut = pszBuffer;
+ *pszOut = '\0';
+ pszOut = do_str(pszOut, pszEnd, "-exception:");
+ pszOut = do_base(pszOut, (UINT64)GetExceptionCode(), 10, "0123456789");
+ pszOut = do_str(pszOut, pszEnd, "-");
+ }
+}
+
+#if _MSC_VER >= 1900
+#pragma warning(pop)
+#endif
+
+PCHAR SafePrintf(PCHAR pszBuffer, LONG cbBuffer, PCSTR pszMsg, ...)
+{
+ va_list args;
+ va_start(args, pszMsg);
+ VSafePrintf(pszMsg, args, pszBuffer, cbBuffer);
+ va_end(args);
+
+ while (*pszBuffer) {
+ pszBuffer++;
+ }
+ return pszBuffer;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+BOOL TblogOpen()
+{
+ EnterCriticalSection(&s_csPipe);
+
+ WCHAR wzPipe[256];
+ StringCchPrintfW(wzPipe, ARRAYSIZE(wzPipe), L"%ls.%d", TBLOG_PIPE_NAMEW, s_nTraceProcessId);
+
+ for (int retries = 0; retries < 10; retries++) {
+ WaitNamedPipeW(wzPipe, 10000); // Wait up to 10 seconds for a pipe to appear.
+
+ s_hPipe = Real_CreateFileW(wzPipe, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
+ if (s_hPipe != INVALID_HANDLE_VALUE) {
+ DWORD dwMode = PIPE_READMODE_MESSAGE;
+ if (SetNamedPipeHandleState(s_hPipe, &dwMode, NULL, NULL)) {
+ LeaveCriticalSection(&s_csPipe);
+ return TRUE;
+ }
+ }
+ }
+
+ LeaveCriticalSection(&s_csPipe);
+
+ // Couldn't open pipe.
+ DEBUG_BREAK();
+ Real_ExitProcess(9990);
+ return FALSE;
+}
+
+VOID TblogV(PCSTR pszMsgf, va_list args)
+{
+ if (s_hPipe == INVALID_HANDLE_VALUE) {
+ return;
+ }
+
+ EnterCriticalSection(&s_csPipe);
+
+ DWORD cbWritten = 0;
+
+ PCHAR pszBuf = s_rMessage.szMessage;
+ VSafePrintf(pszMsgf, args,
+ pszBuf, (int)(s_rMessage.szMessage + sizeof(s_rMessage.szMessage) - pszBuf));
+
+ PCHAR pszEnd = s_rMessage.szMessage;
+ for (; *pszEnd; pszEnd++) {
+ // no internal contents.
+ }
+ s_rMessage.nBytes = (DWORD)(pszEnd - ((PCSTR)&s_rMessage));
+
+ // If the write fails, then we abort
+ if (s_hPipe != INVALID_HANDLE_VALUE) {
+ if (!Real_WriteFile(s_hPipe, &s_rMessage, s_rMessage.nBytes, &cbWritten, NULL)) {
+ Real_ExitProcess(9991);
+ }
+ }
+
+ LeaveCriticalSection(&s_csPipe);
+}
+
+VOID Tblog(PCSTR pszMsgf, ...)
+{
+ if (s_hPipe == INVALID_HANDLE_VALUE) {
+ return;
+ }
+
+ va_list args;
+ va_start(args, pszMsgf);
+ TblogV(pszMsgf, args);
+ va_end(args);
+}
+
+VOID TblogClose()
+{
+ EnterCriticalSection(&s_csPipe);
+
+ if (s_hPipe != INVALID_HANDLE_VALUE) {
+ DWORD cbWritten = 0;
+
+ s_rMessage.nBytes = 0;
+
+ Real_WriteFile(s_hPipe, &s_rMessage, 4, &cbWritten, NULL);
+ FlushFileBuffers(s_hPipe);
+ Real_CloseHandle(s_hPipe);
+ s_hPipe = INVALID_HANDLE_VALUE;
+ }
+
+ LeaveCriticalSection(&s_csPipe);
+}
+
+/////////////////////////////////////////////////////////////
+// Detours
+//
+static BOOL IsInherited(HANDLE hHandle)
+{
+ DWORD dwFlags;
+
+ if (GetHandleInformation(hHandle, &dwFlags)) {
+ return (dwFlags & HANDLE_FLAG_INHERIT) ? TRUE : FALSE;
+ }
+ return FALSE;
+}
+
+static void SaveStdHandleName(HANDLE hFile, PWCHAR pwzBuffer, BOOL *fAppend)
+{
+ pwzBuffer[0] = '\0';
+
+ if ((hFile != INVALID_HANDLE_VALUE) && IsInherited(hFile)) {
+ FileInfo * pInfo = OpenFiles::RecallFile(hFile);
+ if (pInfo) {
+ Copy(pwzBuffer, pInfo->m_pwzPath);
+ if (pInfo->m_fAppend && fAppend != NULL) {
+ *fAppend = TRUE;
+ }
+ }
+ }
+}
+
+static void LoadStdHandleName(DWORD id, PCWSTR pwzBuffer, BOOL fAppend)
+{
+ HANDLE hFile = GetStdHandle(id);
+
+ if ((hFile != INVALID_HANDLE_VALUE) && pwzBuffer[0] != '\0') {
+ FileInfo *pInfo = FileNames::FindPartial(pwzBuffer);
+ if (fAppend) {
+ pInfo->m_fAppend = TRUE;
+ }
+ OpenFiles::Remember(hFile, pInfo);
+ }
+}
+
+BOOL CreateProcessInternals(HANDLE hProcess, DWORD nProcessId, PCHAR pszId,
+ HANDLE hStdin, HANDLE hStdout, HANDLE hStderr)
+{
+ EnterCriticalSection(&s_csChildPayload);
+
+ ProcInfo *proc = Procs::Create(hProcess, nProcessId);
+ OpenFiles::Remember(hProcess, proc);
+
+ ZeroMemory(&s_ChildPayload, sizeof(s_ChildPayload));
+ CopyMemory(&s_ChildPayload, &s_Payload, sizeof(s_ChildPayload));
+
+ s_ChildPayload.nParentProcessId = GetCurrentProcessId();
+ s_ChildPayload.rGeneology[s_ChildPayload.nGeneology]
+ = (DWORD)InterlockedIncrement(&s_nChildCnt);
+ s_ChildPayload.nGeneology++;
+
+ SaveStdHandleName(hStdin, s_ChildPayload.wzStdin, NULL);
+ SaveStdHandleName(hStdout, s_ChildPayload.wzStdout, &s_ChildPayload.fStdoutAppend);
+ SaveStdHandleName(hStderr, s_ChildPayload.wzStderr, &s_ChildPayload.fStderrAppend);
+
+ DetourCopyPayloadToProcess(hProcess, s_guidTrace, &s_ChildPayload, sizeof(s_ChildPayload));
+
+ for (DWORD i = 0; i < s_ChildPayload.nGeneology; i++) {
+ pszId = SafePrintf(pszId, 16, "%d.", s_ChildPayload.rGeneology[i]);
+ }
+ *pszId = '\0';
+
+ LeaveCriticalSection(&s_csChildPayload);
+
+ return TRUE;
+}
+
+BOOL WINAPI Mine_CreateProcessW(LPCWSTR lpApplicationName,
+ LPWSTR lpCommandLine,
+ LPSECURITY_ATTRIBUTES lpProcessAttributes,
+ LPSECURITY_ATTRIBUTES lpThreadAttributes,
+ BOOL bInheritHandles,
+ DWORD dwCreationFlags,
+ LPVOID lpEnvironment,
+ LPCWSTR lpCurrentDirectory,
+ LPSTARTUPINFOW lpStartupInfo,
+ LPPROCESS_INFORMATION lpProcessInformation)
+{
+ EnterFunc();
+
+ if (lpCommandLine == NULL) {
+ lpCommandLine = (LPWSTR)lpApplicationName;
+ }
+
+ CHAR szProc[MAX_PATH];
+ BOOL rv = 0;
+ __try {
+ LPPROCESS_INFORMATION ppi = lpProcessInformation;
+ PROCESS_INFORMATION pi;
+ if (ppi == NULL) {
+ ppi = &pi;
+ }
+
+ rv = DetourCreateProcessWithDllExW(lpApplicationName,
+ lpCommandLine,
+ lpProcessAttributes,
+ lpThreadAttributes,
+ bInheritHandles,
+ dwCreationFlags | CREATE_SUSPENDED,
+ lpEnvironment,
+ lpCurrentDirectory,
+ lpStartupInfo,
+ ppi,
+ s_szDllPath,
+ Real_CreateProcessW);
+
+ if (rv) {
+ HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
+ HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
+ HANDLE hStderr = GetStdHandle(STD_ERROR_HANDLE);
+
+ if (lpStartupInfo != NULL && (lpStartupInfo->dwFlags & STARTF_USESTDHANDLES) != 0) {
+ hStdin = lpStartupInfo->hStdInput;
+ hStdout = lpStartupInfo->hStdOutput;
+ hStderr = lpStartupInfo->hStdError;
+ }
+ CreateProcessInternals(ppi->hProcess, ppi->dwProcessId,
+ szProc, hStdin, hStdout, hStderr);
+
+ Print("<t:Child id=\"::%hs::\">\n", szProc);
+
+ WCHAR wzPath[MAX_PATH];
+ FileInfo *pInfo = NULL;
+ if (lpApplicationName == NULL) {
+ PWCHAR pwzDst = wzPath;
+ PWCHAR pwzSrc = lpCommandLine;
+
+ if (*pwzSrc == '\"') {
+ WCHAR cQuote = *pwzSrc++;
+
+ while (*pwzSrc && *pwzSrc != cQuote) {
+ *pwzDst++ = *pwzSrc++;
+ }
+ *pwzDst++ = '\0';
+ }
+ else {
+ while (*pwzSrc && *pwzSrc != ' ' && *pwzSrc != '\t') {
+ if (*pwzSrc == '\t') {
+ *pwzSrc = ' ';
+ }
+ *pwzDst++ = *pwzSrc++;
+ }
+ *pwzDst++ = '\0';
+ }
+ pInfo = FileNames::FindPartial(wzPath);
+ }
+ else {
+ pInfo = FileNames::FindPartial(lpApplicationName);
+ }
+
+ Print("<t:Executable>%ls</t:Executable>\n",
+ FileNames::ParameterizeName(wzPath, ARRAYSIZE(wzPath), pInfo));
+ Print("<t:Line>%le</t:Line>\n", lpCommandLine);
+ Print("</t:Child>\n");
+
+ if (pInfo) {
+ pInfo->m_fAbsorbed = true;
+ }
+
+ if (!(dwCreationFlags & CREATE_SUSPENDED)) {
+ ResumeThread(ppi->hThread);
+ }
+
+ if (ppi == &pi) {
+ Real_CloseHandle(ppi->hThread);
+ Real_CloseHandle(ppi->hProcess);
+ }
+ }
+ } __finally {
+ ExitFunc();
+ if (!rv) {
+ Print("<!-- Warning: CreateProcessW failed %d: %ls; %ls -->\n",
+ GetLastError(), lpApplicationName, lpCommandLine);
+ }
+ }
+ return rv;
+}
+
+BOOL WINAPI Mine_CreateProcessA(LPCSTR lpApplicationName,
+ LPSTR lpCommandLine,
+ LPSECURITY_ATTRIBUTES lpProcessAttributes,
+ LPSECURITY_ATTRIBUTES lpThreadAttributes,
+ BOOL bInheritHandles,
+ DWORD dwCreationFlags,
+ LPVOID lpEnvironment,
+ LPCSTR lpCurrentDirectory,
+ LPSTARTUPINFOA lpStartupInfo,
+ LPPROCESS_INFORMATION lpProcessInformation)
+{
+ EnterFunc();
+
+ if (lpCommandLine == NULL) {
+ lpCommandLine = (LPSTR)lpApplicationName;
+ }
+
+ CHAR szProc[MAX_PATH];
+ BOOL rv = 0;
+ __try {
+ LPPROCESS_INFORMATION ppi = lpProcessInformation;
+ PROCESS_INFORMATION pi;
+ if (ppi == NULL) {
+ ppi = &pi;
+ }
+
+ rv = DetourCreateProcessWithDllExA(lpApplicationName,
+ lpCommandLine,
+ lpProcessAttributes,
+ lpThreadAttributes,
+ bInheritHandles,
+ dwCreationFlags | CREATE_SUSPENDED,
+ lpEnvironment,
+ lpCurrentDirectory,
+ lpStartupInfo,
+ ppi,
+ s_szDllPath,
+ Real_CreateProcessA);
+
+ if (rv) {
+ HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
+ HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
+ HANDLE hStderr = GetStdHandle(STD_ERROR_HANDLE);
+
+ if (lpStartupInfo != NULL && (lpStartupInfo->dwFlags & STARTF_USESTDHANDLES) != 0) {
+ hStdin = lpStartupInfo->hStdInput;
+ hStdout = lpStartupInfo->hStdOutput;
+ hStderr = lpStartupInfo->hStdError;
+ }
+ CreateProcessInternals(ppi->hProcess, ppi->dwProcessId,
+ szProc, hStdin, hStdout, hStderr);
+
+ Print("<t:Child id=\"::%hs::\">\n", szProc);
+
+ WCHAR wzPath[MAX_PATH];
+ FileInfo *pInfo = NULL;
+ if (lpApplicationName == NULL) {
+ PCHAR pszDst = szProc;
+ PCHAR pszSrc = lpCommandLine;
+
+ if (*pszSrc == '\"') {
+ CHAR cQuote = *pszSrc++;
+
+ while (*pszSrc && *pszSrc != cQuote) {
+ *pszDst++ = *pszSrc++;
+ }
+ *pszDst++ = '\0';
+ }
+ else {
+ while (*pszSrc && *pszSrc != ' ' && *pszSrc != '\t') {
+ if (*pszSrc == '\t') {
+ *pszSrc = ' ';
+ }
+ *pszDst++ = *pszSrc++;
+ }
+ *pszDst++ = '\0';
+ }
+ pInfo = FileNames::FindPartial(szProc);
+ }
+ else {
+ pInfo = FileNames::FindPartial(lpApplicationName);
+ }
+
+ Print("<t:Executable>%ls</t:Executable>\n",
+ FileNames::ParameterizeName(wzPath, ARRAYSIZE(wzPath), pInfo));
+ Print("<t:Line>%he</t:Line>\n", lpCommandLine);
+ Print("</t:Child>\n");
+
+ if (pInfo) {
+ pInfo->m_fAbsorbed = true;
+ }
+
+ if (!(dwCreationFlags & CREATE_SUSPENDED)) {
+ ResumeThread(ppi->hThread);
+ }
+ if (ppi == &pi) {
+ Real_CloseHandle(ppi->hThread);
+ Real_CloseHandle(ppi->hProcess);
+ }
+ }
+ } __finally {
+ ExitFunc();
+ if (!rv) {
+ Print("<!-- Warning: CreateProcessA failed %d: %hs; %hs -->\n",
+ GetLastError(), lpApplicationName, lpCommandLine);
+ }
+ }
+ return rv;
+}
+
+//
+//////////////////////////////////////////////////////////////////////////////
+
+BOOL WINAPI Mine_CopyFileExA(LPCSTR a0,
+ LPCSTR a1,
+ LPPROGRESS_ROUTINE a2,
+ LPVOID a3,
+ LPBOOL a4,
+ DWORD a5)
+{
+ EnterFunc();
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CopyFileExA(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ ExitFunc();
+ if (rv) {
+#if 0
+ Print("<!-- CopyFileExA %he to %he -->\n", a0, a1);
+#endif
+ NoteRead(a0);
+ NoteWrite(a1);
+ }
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_CopyFileExW(LPCWSTR a0,
+ LPCWSTR a1,
+ LPPROGRESS_ROUTINE a2,
+ LPVOID a3,
+ LPBOOL a4,
+ DWORD a5)
+{
+ EnterFunc();
+
+ BOOL rv = 0;
+ __try {
+#if 0
+ Print("\n");
+ Print("<!-- CopyFileExW %le to %le before -->\n", a0, a1);
+#endif
+ rv = Real_CopyFileExW(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ ExitFunc();
+ if (rv) {
+#if 0
+ Print("<!-- CopyFileExW %le to %le -->\n", a0, a1);
+#endif
+ NoteRead(a0);
+ NoteWrite(a1);
+ }
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_PrivCopyFileExW(LPCWSTR a0,
+ LPCWSTR a1,
+ LPPROGRESS_ROUTINE a2,
+ LPVOID a3,
+ LPBOOL a4,
+ DWORD a5)
+{
+ EnterFunc();
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PrivCopyFileExW(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ ExitFunc();
+ if (rv) {
+#if 0
+ Print("<!-- PrivCopyFileExW %le to %le -->\n", a0, a1);
+#endif
+ NoteRead(a0);
+ NoteWrite(a1);
+ }
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_CreateHardLinkA(LPCSTR a0,
+ LPCSTR a1,
+ LPSECURITY_ATTRIBUTES a2)
+{
+ EnterFunc();
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CreateHardLinkA(a0, a1, a2);
+ } __finally {
+ ExitFunc();
+ if (rv) {
+#if 0
+ Print("<!-- CreateHardLinkA %he to %he -->\n", a0, a1);
+#endif
+ NoteRead(a1);
+ NoteWrite(a0);
+ }
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_CreateHardLinkW(LPCWSTR a0,
+ LPCWSTR a1,
+ LPSECURITY_ATTRIBUTES a2)
+{
+ EnterFunc();
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CreateHardLinkW(a0, a1, a2);
+ } __finally {
+ ExitFunc();
+ if (rv) {
+#if 0
+ Print("<!-- CreateHardLinkW %le to %le -->\n", a0, a1);
+#endif
+ NoteRead(a1);
+ NoteWrite(a0);
+ }
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_CloseHandle(HANDLE a0)
+{
+ /*int nIndent =*/ EnterFunc();
+
+ BOOL rv = 0;
+ __try {
+ ProcInfo * pProc = OpenFiles::RecallProc(a0);
+ if (pProc != NULL) {
+ Procs::Close(pProc->m_hProc);
+ }
+
+ FileInfo * pFile = OpenFiles::RecallFile(a0);
+ if (pFile != NULL) {
+ DWORD dwErr = GetLastError();
+ pFile->m_cbContent = GetFileSize(a0, NULL);
+ if (pFile->m_cbContent == INVALID_FILE_SIZE) {
+ pFile->m_cbContent = 0;
+ }
+
+ if (pFile->m_fCantRead) {
+ if (pFile->m_fRead) {
+#if 0
+ Print("<!-- Warning: Removing read from %le -->\n", pFile->m_pwzPath);
+#endif
+ pFile->m_fRead = FALSE;
+ }
+ }
+
+ // Here we should think about reading the file contents as appropriate.
+ if (pFile->m_fTemporaryPath && pFile->m_fRead && !pFile->m_fAbsorbed &&
+ !pFile->m_fDelete && !pFile->m_fCleanup && !pFile->m_fWrite &&
+ pFile->m_pbContent == NULL &&
+ pFile->m_cbContent < 16384) {
+
+ pFile->m_pbContent = LoadFile(a0, pFile->m_cbContent);
+ }
+
+ SetLastError(dwErr);
+ }
+ rv = Real_CloseHandle(a0);
+ } __finally {
+ ExitFunc();
+ if (rv /* && nIndent == 0*/) {
+ OpenFiles::Forget(a0);
+ }
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_DuplicateHandle(HANDLE hSourceProcessHandle,
+ HANDLE hSourceHandle,
+ HANDLE hTargetProcessHandle,
+ LPHANDLE lpTargetHandle,
+ DWORD dwDesiredAccess,
+ BOOL bInheritHandle,
+ DWORD dwOptions)
+{
+ HANDLE hTemp = INVALID_HANDLE_VALUE;
+ EnterFunc();
+
+ BOOL rv = 0;
+ __try {
+ if (lpTargetHandle == NULL) {
+ lpTargetHandle = &hTemp;
+ }
+ *lpTargetHandle = INVALID_HANDLE_VALUE;
+
+ rv = Real_DuplicateHandle(hSourceProcessHandle,
+ hSourceHandle,
+ hTargetProcessHandle,
+ lpTargetHandle,
+ dwDesiredAccess,
+ bInheritHandle,
+ dwOptions);
+ } __finally {
+ ExitFunc();
+ if (*lpTargetHandle != INVALID_HANDLE_VALUE) {
+ FileInfo *pInfo = OpenFiles::RecallFile(hSourceHandle);
+ if (pInfo) {
+ OpenFiles::Remember(*lpTargetHandle, pInfo);
+ }
+ }
+ };
+ return rv;
+}
+
+static LONG s_nPipeCnt = 0;
+
+BOOL WINAPI Mine_CreatePipe(PHANDLE hReadPipe,
+ PHANDLE hWritePipe,
+ LPSECURITY_ATTRIBUTES lpPipeAttributes,
+ DWORD nSize)
+{
+ HANDLE hRead = INVALID_HANDLE_VALUE;
+ HANDLE hWrite = INVALID_HANDLE_VALUE;
+
+ if (hReadPipe == NULL) {
+ hReadPipe = &hRead;
+ }
+ if (hWritePipe == NULL) {
+ hWritePipe = &hWrite;
+ }
+
+ /*int nIndent = */ EnterFunc();
+ BOOL rv = 0;
+ __try {
+ rv = Real_CreatePipe(hReadPipe, hWritePipe, lpPipeAttributes, nSize);
+ } __finally {
+ ExitFunc();
+ if (rv) {
+ CHAR szPipe[128];
+
+ SafePrintf(szPipe, ARRAYSIZE(szPipe), "\\\\.\\PIPE\\Temp.%d.%d",
+ GetCurrentProcessId(),
+ InterlockedIncrement(&s_nPipeCnt));
+
+ FileInfo *pInfo = FileNames::FindPartial(szPipe);
+
+ pInfo->m_fCleanup = TRUE;
+ OpenFiles::Remember(*hReadPipe, pInfo);
+ OpenFiles::Remember(*hWritePipe, pInfo);
+ }
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_CreateDirectoryW(LPCWSTR a0,
+ LPSECURITY_ATTRIBUTES a1)
+{
+ /* int nIndent = */ EnterFunc();
+ BOOL rv = 0;
+ __try {
+ rv = Real_CreateDirectoryW(a0, a1);
+ } __finally {
+ ExitFunc();
+ if (rv) {
+ FileInfo *pInfo = FileNames::FindPartial(a0);
+ pInfo->m_fDirectory = TRUE;
+ }
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_CreateDirectoryExW(LPCWSTR a0,
+ LPCWSTR a1,
+ LPSECURITY_ATTRIBUTES a2)
+{
+ /* int nIndent = */ EnterFunc();
+ BOOL rv = 0;
+ __try {
+ rv = Real_CreateDirectoryExW(a0, a1, a2);
+ } __finally {
+ ExitFunc();
+ if (rv) {
+ FileInfo *pInfo = FileNames::FindPartial(a1);
+ pInfo->m_fDirectory = TRUE;
+ }
+ };
+ return rv;
+}
+
+HANDLE WINAPI Mine_CreateFileW(LPCWSTR a0,
+ DWORD access,
+ DWORD share,
+ LPSECURITY_ATTRIBUTES a3,
+ DWORD create,
+ DWORD flags,
+ HANDLE a6)
+{
+ /* int nIndent = */ EnterFunc();
+ HANDLE rv = 0;
+ __try {
+ rv = Real_CreateFileW(a0, access, share, a3, create, flags, a6);
+ } __finally {
+ ExitFunc();
+#if 0
+ Print("<!-- CreateFileW(%le, ac=%08x, cr=%08x, fl=%08x -->\n",
+ a0,
+ access,
+ create,
+ flags);
+#endif
+
+ if (access != 0 && /* nIndent == 0 && */ rv != INVALID_HANDLE_VALUE) {
+
+ FileInfo *pInfo = FileNames::FindPartial(a0);
+
+ // FILE_FLAG_WRITE_THROUGH 0x80000000
+ // FILE_FLAG_OVERLAPPED 0x40000000
+ // FILE_FLAG_NO_BUFFERING 0x20000000
+ // FILE_FLAG_RANDOM_ACCESS 0x10000000
+ // FILE_FLAG_SEQUENTIAL_SCAN 0x08000000
+ // FILE_FLAG_DELETE_ON_CLOSE 0x04000000
+ // FILE_FLAG_BACKUP_SEMANTICS 0x02000000
+ // FILE_FLAG_POSIX_SEMANTICS 0x01000000
+ // FILE_FLAG_OPEN_REPARSE_POINT 0x00200000
+ // FILE_FLAG_OPEN_NO_RECALL 0x00100000
+ // FILE_FLAG_FIRST_PIPE_INSTANCE 0x00080000
+ // FILE_ATTRIBUTE_ENCRYPTED 0x00004000
+ // FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
+ // FILE_ATTRIBUTE_OFFLINE 0x00001000
+ // FILE_ATTRIBUTE_COMPRESSED 0x00000800
+ // FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
+ // FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
+ // FILE_ATTRIBUTE_TEMPORARY 0x00000100
+ // FILE_ATTRIBUTE_NORMAL 0x00000080
+ // FILE_ATTRIBUTE_DEVICE 0x00000040
+ // FILE_ATTRIBUTE_ARCHIVE 0x00000020
+ // FILE_ATTRIBUTE_DIRECTORY 0x00000010
+ // FILE_ATTRIBUTE_SYSTEM 0x00000004
+ // FILE_ATTRIBUTE_HIDDEN 0x00000002
+ // FILE_ATTRIBUTE_READONLY 0x00000001
+
+ // CREATE_NEW 1
+ // CREATE_ALWAYS 2
+ // OPEN_EXISTING 3
+ // OPEN_ALWAYS 4
+ // TRUNCATE_EXISTING 5
+
+ if (create == CREATE_NEW ||
+ create == CREATE_ALWAYS ||
+ create == TRUNCATE_EXISTING) {
+
+ if (!pInfo->m_fRead) {
+ pInfo->m_fCantRead = TRUE;
+ }
+ }
+ else if (create == OPEN_EXISTING) {
+ }
+ else if (create == OPEN_ALWAYS) {
+ // pInfo->m_fAppend = TRUE; // !!!
+ }
+
+ if ((flags & FILE_FLAG_DELETE_ON_CLOSE)) {
+ pInfo->m_fCleanup = TRUE;
+ }
+
+ OpenFiles::Remember(rv, pInfo);
+ }
+ };
+ return rv;
+}
+
+HANDLE WINAPI Mine_CreateFileMappingW(HANDLE hFile,
+ LPSECURITY_ATTRIBUTES a1,
+ DWORD flProtect,
+ DWORD a3,
+ DWORD a4,
+ LPCWSTR a5)
+{
+ /* int nIndent = */ EnterFunc();
+ HANDLE rv = 0;
+ __try {
+ rv = Real_CreateFileMappingW(hFile, a1, flProtect, a3, a4, a5);
+ } __finally {
+ ExitFunc();
+ if (rv != INVALID_HANDLE_VALUE) {
+
+ FileInfo *pInfo = OpenFiles::RecallFile(hFile);
+
+ if (pInfo != NULL) {
+ switch (flProtect) {
+ case PAGE_READONLY:
+ pInfo->m_fRead = TRUE;
+ break;
+ case PAGE_READWRITE:
+ pInfo->m_fRead = TRUE;
+ pInfo->m_fWrite = TRUE;
+ break;
+ case PAGE_WRITECOPY:
+ pInfo->m_fRead = TRUE;
+ break;
+ case PAGE_EXECUTE_READ:
+ pInfo->m_fRead = TRUE;
+ break;
+ case PAGE_EXECUTE_READWRITE:
+ pInfo->m_fRead = TRUE;
+ pInfo->m_fWrite = TRUE;
+ break;
+ }
+ }
+ }
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_DeleteFileW(LPCWSTR a0)
+{
+ EnterFunc();
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DeleteFileW(a0);
+ } __finally {
+ ExitFunc();
+#if 0
+ Print("<!-- DeleteFileW(%le -->\n", a0);
+#endif
+ NoteDelete(a0);
+ };
+ return rv;
+}
+
+static VOID Dump(LPVOID pvData, DWORD cbData)
+{
+ CHAR szBuffer[128];
+ PBYTE pbData = (PBYTE)pvData;
+
+ for (DWORD i = 0; i < cbData; i += 16) {
+ PCHAR psz = szBuffer;
+ psz = SafePrintf(psz, (LONG)(szBuffer + ARRAYSIZE(szBuffer) - psz), "%4d: ", i);
+
+ for (DWORD j = i; j < i + 16; j++) {
+ if (j < cbData) {
+ psz = SafePrintf(psz, (LONG)(szBuffer + ARRAYSIZE(szBuffer) - psz),
+ "%02x", pbData[j]);
+ }
+ else {
+ psz = SafePrintf(psz, (LONG)(szBuffer + ARRAYSIZE(szBuffer) - psz), " ");
+ }
+ }
+
+ for (DWORD j = i; j < i + 16; j++) {
+ if (j < cbData) {
+ if (pbData[j] >= ' ' && pbData[j] <= 127) {
+ psz = SafePrintf(psz, (LONG)(szBuffer + ARRAYSIZE(szBuffer) - psz),
+ "%c", pbData[j]);
+ }
+ else {
+ psz = SafePrintf(psz, (LONG)(szBuffer + ARRAYSIZE(szBuffer) - psz), ".");
+ }
+ }
+ else {
+ psz = SafePrintf(psz, (LONG)(szBuffer + ARRAYSIZE(szBuffer) - psz), " ");
+ }
+ }
+ Print("%s\n", szBuffer);
+ }
+}
+
+BOOL WINAPI Mine_DeviceIoControl(HANDLE a0,
+ DWORD a1,
+ LPVOID a2,
+ DWORD a3,
+ LPVOID a4,
+ DWORD a5,
+ LPDWORD a6,
+ LPOVERLAPPED a7)
+{
+ EnterFunc();
+ DWORD d6 = 0;
+ if (a6 == NULL) {
+ a6 = &d6;
+
+ }
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DeviceIoControl(a0, a1, a2, a3, a4, a5, a6, a7);
+ } __finally {
+ ExitFunc();
+ OpenFiles::SetRead(a0, 0);
+ OpenFiles::SetWrite(a0, 0);
+ if (rv && a1 != 0x390008 && a1 != 0x4d0008 && a1 != 0x6d0008) {
+ FileInfo *pInfo = OpenFiles::RecallFile(a0);
+
+ DWORD DeviceType = (a1 & 0xffff0000) >> 16;
+ DWORD Access = (a1 & 0x0000c000) >> 14;
+ DWORD Function = (a1 & 0x00003ffc) >> 2;
+ DWORD Method = (a1 & 0x00000003) >> 0;
+
+ if (pInfo) {
+ Print("<!-- DeviceIoControl %x [dev=%x,acc=%x,fun=%x,mth=%x] on %ls! -->\n",
+ a1, DeviceType, Access, Function, Method, pInfo->m_pwzPath);
+ }
+ else {
+ Print("<!-- DeviceIoControl %x [dev=%x,acc=%x,fun=%x,mth=%x,in=%d,out=%d/%d] on (%x)! -->\n",
+ a1, DeviceType, Access, Function, Method, a3, *a6, a5, a0);
+
+ if (a3 > 0) {
+ Dump(a2, a3);
+ }
+ if (a5 > 0) {
+ Dump(a4, (*a6 < a5) ? *a6 : a5);
+ }
+ }
+ }
+ };
+ return rv;
+}
+
+DWORD WINAPI Mine_GetFileAttributesW(LPCWSTR a0)
+{
+ EnterFunc();
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetFileAttributesW(a0);
+ } __finally {
+ ExitFunc();
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_MoveFileWithProgressW(LPCWSTR a0,
+ LPCWSTR a1,
+ LPPROGRESS_ROUTINE a2,
+ LPVOID a3,
+ DWORD a4)
+{
+ EnterFunc();
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_MoveFileWithProgressW(a0, a1, a2, a3, a4);
+ } __finally {
+ ExitFunc();
+ if (rv) {
+ NoteRead(a0);
+ NoteWrite(a1);
+ }
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_MoveFileA(LPCSTR a0,
+ LPCSTR a1)
+{
+ EnterFunc();
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_MoveFileA(a0, a1);
+ } __finally {
+ ExitFunc();
+ if (rv) {
+ NoteRead(a0);
+ NoteCleanup(a0);
+ NoteWrite(a1);
+ }
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_MoveFileW(LPCWSTR a0,
+ LPCWSTR a1)
+{
+ EnterFunc();
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_MoveFileW(a0, a1);
+ } __finally {
+ ExitFunc();
+ if (rv) {
+ NoteRead(a0);
+ NoteCleanup(a0);
+ NoteWrite(a1);
+ }
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_MoveFileExA(LPCSTR a0,
+ LPCSTR a1,
+ DWORD a2)
+{
+ EnterFunc();
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_MoveFileExA(a0, a1, a2);
+ } __finally {
+ ExitFunc();
+ if (rv) {
+ NoteRead(a0);
+ NoteCleanup(a0);
+ NoteWrite(a1);
+ }
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_MoveFileExW(LPCWSTR a0,
+ LPCWSTR a1,
+ DWORD a2)
+{
+ EnterFunc();
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_MoveFileExW(a0, a1, a2);
+ } __finally {
+ ExitFunc();
+ if (rv) {
+ NoteRead(a0);
+ NoteCleanup(a0);
+ NoteWrite(a1);
+ }
+ };
+ return rv;
+}
+
+void SetHandle(PCSTR pszName, HANDLE h)
+{
+#if 0
+ FileInfo *pInfo = OpenFiles::RecallFile(h);
+
+ if (pInfo != NULL) {
+ Tblog("<!-- hset: %hs (%x) %ls -->\n", pszName, h, pInfo->m_pwzPath);
+ }
+ else {
+ Tblog("<!-- hset: %hs (%x) ***Unknown*** -->\n", pszName, h);
+ }
+#else
+ (void)pszName;
+ (void)h;
+#endif
+}
+
+
+BOOL WINAPI Mine_SetStdHandle(DWORD a0,
+ HANDLE a1)
+{
+ EnterFunc();
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetStdHandle(a0, a1);
+ if (rv && a1 != 0) {
+ switch (a0) {
+ case STD_INPUT_HANDLE:
+ SetHandle("stdin", a1);
+ break;
+ case STD_OUTPUT_HANDLE:
+ SetHandle("stdout", a1);
+ break;
+ case STD_ERROR_HANDLE:
+ SetHandle("stderr", a1);
+ break;
+ }
+ }
+ } __finally {
+ ExitFunc();
+ };
+ return rv;
+}
+
+HMODULE WINAPI Mine_LoadLibraryA(LPCSTR a0)
+{
+ EnterFunc();
+
+ HMODULE rv = 0;
+ __try {
+ rv = Real_LoadLibraryA(a0);
+ } __finally {
+ ExitFunc();
+ };
+ return rv;
+}
+
+HMODULE WINAPI Mine_LoadLibraryW(LPCWSTR a0)
+{
+ EnterFunc();
+
+ HMODULE rv = 0;
+ __try {
+ rv = Real_LoadLibraryW(a0);
+ } __finally {
+ ExitFunc();
+ };
+ return rv;
+}
+
+HMODULE WINAPI Mine_LoadLibraryExA(LPCSTR a0,
+ HANDLE a1,
+ DWORD a2)
+{
+ EnterFunc();
+
+ HMODULE rv = 0;
+ __try {
+ rv = Real_LoadLibraryExA(a0, a1, a2);
+ } __finally {
+ ExitFunc();
+ };
+ return rv;
+}
+
+HMODULE WINAPI Mine_LoadLibraryExW(LPCWSTR a0,
+ HANDLE a1,
+ DWORD a2)
+{
+ EnterFunc();
+
+ HMODULE rv = 0;
+ __try {
+ rv = Real_LoadLibraryExW(a0, a1, a2);
+ } __finally {
+ ExitFunc();
+ };
+ return rv;
+}
+
+DWORD WINAPI Mine_SetFilePointer(HANDLE hFile,
+ LONG lDistanceToMove,
+ PLONG lpDistanceToMoveHigh,
+ DWORD dwMoveMethod)
+{
+ EnterFunc();
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_SetFilePointer(hFile,
+ lDistanceToMove,
+ lpDistanceToMoveHigh,
+ dwMoveMethod);
+ } __finally {
+ LONG high = 0;
+ if (lpDistanceToMoveHigh == NULL) {
+ lpDistanceToMoveHigh = &high;
+ }
+
+ FileInfo * pInfo = OpenFiles::RecallFile(hFile);
+ if (pInfo != NULL) {
+ if (dwMoveMethod == FILE_END && lDistanceToMove == 0xffffffff) {
+#if 0
+ Print("<!-- SetFilePointer(APPEND, %le) -->\n",
+ pInfo->m_pwzPath);
+#endif
+ pInfo->m_fAppend = TRUE;
+ }
+#if 0
+ else if (dwMoveMethod == FILE_END) {
+ Print("<!-- SetFilePointer(END:%08x:%08x, %le) -->\n",
+ (int)lDistanceToMove,
+ *lpDistanceToMoveHigh,
+ pInfo->m_pwzPath);
+ }
+ else if (dwMoveMethod == FILE_BEGIN) {
+ Print("<!-- SetFilePointer(BEG:%08x:%08x, %le) -->\n",
+ (int)lDistanceToMove,
+ *lpDistanceToMoveHigh,
+ pInfo->m_pwzPath);
+ }
+ else if (dwMoveMethod == FILE_CURRENT) {
+ Print("<!-- SetFilePointer(CUR:%08x:%08x, %le) -->\n",
+ (int)lDistanceToMove,
+ *lpDistanceToMoveHigh,
+ pInfo->m_pwzPath);
+ }
+#endif
+ }
+ ExitFunc();
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_SetFilePointerEx(HANDLE hFile,
+ LARGE_INTEGER liDistanceToMove,
+ PLARGE_INTEGER lpNewFilePointer,
+ DWORD dwMoveMethod)
+{
+ EnterFunc();
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetFilePointerEx(hFile,
+ liDistanceToMove,
+ lpNewFilePointer,
+ dwMoveMethod);
+ } __finally {
+#if 0
+ FileInfo * pInfo = OpenFiles::RecallFile(hFile);
+ if (pInfo != NULL) {
+ if (dwMoveMethod == FILE_END) {
+ Print("<!-- SetFilePointerEx(END:%I64d, %le) -->\n",
+ liDistanceToMove.QuadPart,
+ pInfo->m_pwzPath);
+ }
+ else if (dwMoveMethod == FILE_BEGIN) {
+ Print("<!-- SetFilePointerEx(BEG:%I64d, %le) -->\n",
+ liDistanceToMove.QuadPart,
+ pInfo->m_pwzPath);
+ }
+ else if (dwMoveMethod == FILE_CURRENT) {
+ Print("<!-- SetFilePointerEx(CUR:%I64d, %le) -->\n",
+ liDistanceToMove.QuadPart,
+ pInfo->m_pwzPath);
+ }
+ }
+#endif
+ ExitFunc();
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_ReadFile(HANDLE a0,
+ LPVOID a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPOVERLAPPED a4)
+{
+ EnterFunc();
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ReadFile(a0, a1, a2, a3, a4);
+ } __finally {
+ if (rv) {
+ OpenFiles::SetRead(a0, a2);
+ }
+ ExitFunc();
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_ReadFileEx(HANDLE a0,
+ LPVOID a1,
+ DWORD a2,
+ LPOVERLAPPED a3,
+ LPOVERLAPPED_COMPLETION_ROUTINE a4)
+{
+ EnterFunc();
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ReadFileEx(a0, a1, a2, a3, a4);
+ } __finally {
+ if (rv) {
+ OpenFiles::SetRead(a0, a2);
+ }
+ ExitFunc();
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_WriteFile(HANDLE a0,
+ LPCVOID a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPOVERLAPPED a4)
+{
+ EnterFunc();
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WriteFile(a0, a1, a2, a3, a4);
+ } __finally {
+ OpenFiles::SetWrite(a0, a2);
+ ExitFunc();
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_WriteFileEx(HANDLE a0,
+ LPCVOID a1,
+ DWORD a2,
+ LPOVERLAPPED a3,
+ LPOVERLAPPED_COMPLETION_ROUTINE a4)
+{
+ EnterFunc();
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WriteFileEx(a0, a1, a2, a3, a4);
+ } __finally {
+ OpenFiles::SetWrite(a0, a2);
+ ExitFunc();
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_WriteConsoleA(HANDLE a0,
+ const VOID* a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPVOID a4)
+{
+ EnterFunc();
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WriteConsoleA(a0, a1, a2, a3, a4);
+ } __finally {
+ OpenFiles::SetWrite(a0, a2);
+ ExitFunc();
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_WriteConsoleW(HANDLE a0,
+ const VOID* a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPVOID a4)
+{
+ EnterFunc();
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WriteConsoleW(a0, a1, a2, a3, a4);
+ } __finally {
+ OpenFiles::SetWrite(a0, a2);
+ ExitFunc();
+ };
+ return rv;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+DWORD WINAPI Mine_ExpandEnvironmentStringsA(PCSTR lpSrc, PCHAR lpDst, DWORD nSize)
+{
+ EnterFunc();
+ DWORD rv = 0;
+ __try {
+ rv = Real_ExpandEnvironmentStringsA(lpSrc, lpDst, nSize);
+ }
+ __finally {
+ if (rv > 0) {
+#if 0
+ Print("<!-- ExpandEnvironmentStringsA(%he) -->\n", lpSrc);
+#endif
+ }
+ ExitFunc();
+ };
+ return rv;
+}
+
+DWORD WINAPI Mine_ExpandEnvironmentStringsW(PCWSTR lpSrc, PWCHAR lpDst, DWORD nSize)
+{
+ EnterFunc();
+ DWORD rv = 0;
+ __try {
+ rv = Real_ExpandEnvironmentStringsW(lpSrc, lpDst, nSize);
+ }
+ __finally {
+ if (rv > 0) {
+#if 0
+ Print("<!-- ExpandEnvironmentStringsW(%le) -->\n", lpSrc);
+#endif
+ }
+ ExitFunc();
+ };
+ return rv;
+}
+
+DWORD WINAPI Mine_GetEnvironmentVariableA(PCSTR lpName, PCHAR lpBuffer, DWORD nSize)
+{
+ EnterFunc();
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetEnvironmentVariableA(lpName, lpBuffer, nSize);
+ // if (rv > 0 && rv < nSize && lpBuffer != NULL) {
+ // EnvVars::Used(lpName);
+ // }
+ }
+ __finally {
+ EnvVars::Used(lpName);
+ ExitFunc();
+ };
+ return rv;
+}
+
+DWORD WINAPI Mine_GetEnvironmentVariableW(PCWSTR lpName, PWCHAR lpBuffer, DWORD nSize)
+{
+ EnterFunc();
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetEnvironmentVariableW(lpName, lpBuffer, nSize);
+ // if (rv > 0 && rv < nSize && lpBuffer != NULL) {
+ // EnvVars::Used(lpName);
+ // }
+ }
+ __finally {
+ EnvVars::Used(lpName);
+ ExitFunc();
+ };
+ return rv;
+}
+
+PCWSTR CDECL Mine_wgetenv(PCWSTR var)
+{
+ EnterFunc();
+ PCWSTR rv = 0;
+ __try {
+ rv = Real_wgetenv(var);
+ // if (rv != NULL) {
+ // EnvVars::Used(var);
+ // }
+ }
+ __finally {
+ EnvVars::Used(var);
+ ExitFunc();
+ }
+ return rv;
+}
+
+PCSTR CDECL Mine_getenv(PCSTR var)
+{
+ EnterFunc();
+ PCSTR rv = 0;
+ __try {
+ rv = Real_getenv(var);
+ // if (rv) {
+ // EnvVars::Used(var);
+ // }
+ }
+ __finally {
+ EnvVars::Used(var);
+ ExitFunc();
+ }
+ return rv;
+}
+
+DWORD CDECL Mine_getenv_s(DWORD *pValue, PCHAR pBuffer, DWORD cBuffer, PCSTR varname)
+{
+ EnterFunc();
+ DWORD rv = 0;
+ __try {
+ DWORD value;
+ if (pValue == NULL) {
+ pValue = &value;
+ }
+ rv = Real_getenv_s(pValue, pBuffer, cBuffer, varname);
+ // if (rv == 0 && *pValue > 0) {
+ // EnvVars::Used(varname);
+ // }
+ }
+ __finally {
+ EnvVars::Used(varname);
+ ExitFunc();
+ }
+ return rv;
+}
+
+DWORD CDECL Mine_wgetenv_s(DWORD *pValue, PWCHAR pBuffer, DWORD cBuffer, PCWSTR varname)
+{
+ EnterFunc();
+ DWORD rv = 0;
+ __try {
+ DWORD value;
+ if (pValue == NULL) {
+ pValue = &value;
+ }
+ rv = Real_wgetenv_s(pValue, pBuffer, cBuffer, varname);
+ // if (rv == 0 && *pValue > 0) {
+ // EnvVars::Used(varname);
+ // }
+ }
+ __finally {
+ EnvVars::Used(varname);
+ ExitFunc();
+ }
+ return rv;
+}
+
+DWORD CDECL Mine_dupenv_s(PCHAR *ppBuffer, DWORD *pcBuffer, PCSTR varname)
+{
+ EnterFunc();
+ DWORD rv = 0;
+ __try {
+ PCHAR pb;
+ DWORD cb;
+ if (ppBuffer == NULL) {
+ ppBuffer = &pb;
+ }
+ if (pcBuffer == NULL) {
+ pcBuffer = &cb;
+ }
+ rv = Real_dupenv_s(ppBuffer, pcBuffer, varname);
+ // if (rv == 0 && *pcBuffer > 0 && *ppBuffer != NULL) {
+ // EnvVars::Used(varname);
+ // }
+ }
+ __finally {
+ EnvVars::Used(varname);
+ ExitFunc();
+ }
+ return rv;
+}
+
+DWORD CDECL Mine_wdupenv_s(PWCHAR *ppBuffer, DWORD *pcBuffer, PCWSTR varname)
+{
+ EnterFunc();
+ DWORD rv = 0;
+ __try {
+ PWCHAR pb;
+ DWORD cb;
+ if (ppBuffer == NULL) {
+ ppBuffer = &pb;
+ }
+ if (pcBuffer == NULL) {
+ pcBuffer = &cb;
+ }
+ rv = Real_wdupenv_s(ppBuffer, pcBuffer, varname);
+ // if (rv == 0 && *pcBuffer > 0 && *ppBuffer != NULL) {
+ // EnvVars::Used(varname);
+ // }
+ }
+ __finally {
+ EnvVars::Used(varname);
+ ExitFunc();
+ }
+ return rv;
+}
+
+
+/////////////////////////////////////////////////////////////
+// AttachDetours
+//
+LONG AttachDetours(VOID)
+{
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+
+ DetourAttach(&(PVOID&)Real_EntryPoint, Mine_EntryPoint);
+ DetourAttach(&(PVOID&)Real_ExitProcess, Mine_ExitProcess);
+ DetourAttach(&(PVOID&)Real_CopyFileExA, Mine_CopyFileExA);
+ DetourAttach(&(PVOID&)Real_CopyFileExW, Mine_CopyFileExW);
+ DetourAttach(&(PVOID&)Real_PrivCopyFileExW, Mine_PrivCopyFileExW);
+ DetourAttach(&(PVOID&)Real_CreateHardLinkA, Mine_CreateHardLinkA);
+ DetourAttach(&(PVOID&)Real_CreateHardLinkW, Mine_CreateHardLinkW);
+ DetourAttach(&(PVOID&)Real_CreateDirectoryW, Mine_CreateDirectoryW);
+ DetourAttach(&(PVOID&)Real_CreateDirectoryExW, Mine_CreateDirectoryExW);
+ DetourAttach(&(PVOID&)Real_CreateFileW, Mine_CreateFileW);
+ DetourAttach(&(PVOID&)Real_CreatePipe, Mine_CreatePipe);
+ DetourAttach(&(PVOID&)Real_CreateFileMappingW, Mine_CreateFileMappingW);
+ DetourAttach(&(PVOID&)Real_CloseHandle, Mine_CloseHandle);
+ DetourAttach(&(PVOID&)Real_DuplicateHandle, Mine_DuplicateHandle);
+ DetourAttach(&(PVOID&)Real_CreateProcessW, Mine_CreateProcessW);
+ DetourAttach(&(PVOID&)Real_CreateProcessA, Mine_CreateProcessA);
+ DetourAttach(&(PVOID&)Real_DeleteFileW, Mine_DeleteFileW);
+ DetourAttach(&(PVOID&)Real_DeviceIoControl, Mine_DeviceIoControl);
+ DetourAttach(&(PVOID&)Real_GetFileAttributesW, Mine_GetFileAttributesW);
+ DetourAttach(&(PVOID&)Real_MoveFileA, Mine_MoveFileA);
+ DetourAttach(&(PVOID&)Real_MoveFileW, Mine_MoveFileW);
+ DetourAttach(&(PVOID&)Real_MoveFileExA, Mine_MoveFileExA);
+ DetourAttach(&(PVOID&)Real_MoveFileExW, Mine_MoveFileExW);
+ DetourAttach(&(PVOID&)Real_MoveFileWithProgressW, Mine_MoveFileWithProgressW);
+ DetourAttach(&(PVOID&)Real_SetStdHandle, Mine_SetStdHandle);
+ DetourAttach(&(PVOID&)Real_LoadLibraryA, Mine_LoadLibraryA);
+ DetourAttach(&(PVOID&)Real_LoadLibraryW, Mine_LoadLibraryW);
+ DetourAttach(&(PVOID&)Real_LoadLibraryExA, Mine_LoadLibraryExA);
+ DetourAttach(&(PVOID&)Real_LoadLibraryExW, Mine_LoadLibraryExW);
+ DetourAttach(&(PVOID&)Real_SetFilePointer, Mine_SetFilePointer);
+ DetourAttach(&(PVOID&)Real_SetFilePointerEx, Mine_SetFilePointerEx);
+ DetourAttach(&(PVOID&)Real_ReadFile, Mine_ReadFile);
+ DetourAttach(&(PVOID&)Real_ReadFileEx, Mine_ReadFileEx);
+ DetourAttach(&(PVOID&)Real_WriteFile, Mine_WriteFile);
+ DetourAttach(&(PVOID&)Real_WriteFileEx, Mine_WriteFileEx);
+ DetourAttach(&(PVOID&)Real_WriteConsoleA, Mine_WriteConsoleA);
+ DetourAttach(&(PVOID&)Real_WriteConsoleW, Mine_WriteConsoleW);
+ DetourAttach(&(PVOID&)Real_ExpandEnvironmentStringsA, Mine_ExpandEnvironmentStringsA);
+ DetourAttach(&(PVOID&)Real_ExpandEnvironmentStringsW, Mine_ExpandEnvironmentStringsW);
+ DetourAttach(&(PVOID&)Real_GetEnvironmentVariableA, Mine_GetEnvironmentVariableA);
+ DetourAttach(&(PVOID&)Real_GetEnvironmentVariableW, Mine_GetEnvironmentVariableW);
+
+ return DetourTransactionCommit();
+}
+
+LONG DetachDetours(VOID)
+{
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+
+ DetourDetach(&(PVOID&)Real_EntryPoint, Mine_EntryPoint);
+ DetourAttach(&(PVOID&)Real_ExitProcess, Mine_ExitProcess);
+ DetourDetach(&(PVOID&)Real_CopyFileExA, Mine_CopyFileExA);
+ DetourDetach(&(PVOID&)Real_CopyFileExW, Mine_CopyFileExW);
+ DetourDetach(&(PVOID&)Real_PrivCopyFileExW, Mine_PrivCopyFileExW);
+ DetourDetach(&(PVOID&)Real_CreateHardLinkA, Mine_CreateHardLinkA);
+ DetourDetach(&(PVOID&)Real_CreateHardLinkW, Mine_CreateHardLinkW);
+ DetourDetach(&(PVOID&)Real_CreateDirectoryW, Mine_CreateDirectoryW);
+ DetourDetach(&(PVOID&)Real_CreateDirectoryExW, Mine_CreateDirectoryExW);
+ DetourDetach(&(PVOID&)Real_CreateFileW, Mine_CreateFileW);
+ DetourDetach(&(PVOID&)Real_CreatePipe, Mine_CreatePipe);
+ DetourDetach(&(PVOID&)Real_CreateFileMappingW, Mine_CreateFileMappingW);
+ DetourDetach(&(PVOID&)Real_CloseHandle, Mine_CloseHandle);
+ DetourDetach(&(PVOID&)Real_DuplicateHandle, Mine_DuplicateHandle);
+ DetourDetach(&(PVOID&)Real_CreateProcessW, Mine_CreateProcessW);
+ DetourDetach(&(PVOID&)Real_CreateProcessA, Mine_CreateProcessA);
+ DetourDetach(&(PVOID&)Real_DeleteFileW, Mine_DeleteFileW);
+ DetourDetach(&(PVOID&)Real_DeviceIoControl, Mine_DeviceIoControl);
+ DetourDetach(&(PVOID&)Real_GetFileAttributesW, Mine_GetFileAttributesW);
+ DetourDetach(&(PVOID&)Real_MoveFileA, Mine_MoveFileA);
+ DetourDetach(&(PVOID&)Real_MoveFileW, Mine_MoveFileW);
+ DetourDetach(&(PVOID&)Real_MoveFileExA, Mine_MoveFileExA);
+ DetourDetach(&(PVOID&)Real_MoveFileExW, Mine_MoveFileExW);
+ DetourDetach(&(PVOID&)Real_MoveFileWithProgressW, Mine_MoveFileWithProgressW);
+ DetourDetach(&(PVOID&)Real_SetStdHandle, Mine_SetStdHandle);
+ DetourDetach(&(PVOID&)Real_LoadLibraryA, Mine_LoadLibraryA);
+ DetourDetach(&(PVOID&)Real_LoadLibraryW, Mine_LoadLibraryW);
+ DetourDetach(&(PVOID&)Real_LoadLibraryExA, Mine_LoadLibraryExA);
+ DetourDetach(&(PVOID&)Real_LoadLibraryExW, Mine_LoadLibraryExW);
+ DetourDetach(&(PVOID&)Real_SetFilePointer, Mine_SetFilePointer);
+ DetourDetach(&(PVOID&)Real_SetFilePointerEx, Mine_SetFilePointerEx);
+ DetourDetach(&(PVOID&)Real_ReadFile, Mine_ReadFile);
+ DetourDetach(&(PVOID&)Real_ReadFileEx, Mine_ReadFileEx);
+ DetourDetach(&(PVOID&)Real_WriteFile, Mine_WriteFile);
+ DetourDetach(&(PVOID&)Real_WriteFileEx, Mine_WriteFileEx);
+ DetourDetach(&(PVOID&)Real_WriteConsoleA, Mine_WriteConsoleA);
+ DetourDetach(&(PVOID&)Real_WriteConsoleW, Mine_WriteConsoleW);
+ DetourDetach(&(PVOID&)Real_ExpandEnvironmentStringsA, Mine_ExpandEnvironmentStringsA);
+ DetourDetach(&(PVOID&)Real_ExpandEnvironmentStringsW, Mine_ExpandEnvironmentStringsW);
+ DetourDetach(&(PVOID&)Real_GetEnvironmentVariableA, Mine_GetEnvironmentVariableA);
+ DetourDetach(&(PVOID&)Real_GetEnvironmentVariableW, Mine_GetEnvironmentVariableW);
+
+ if (Real_getenv) { DetourDetach(&(PVOID&)Real_getenv, Mine_getenv); }
+ if (Real_getenv_s) { DetourDetach(&(PVOID&)Real_getenv_s, Mine_getenv_s); }
+ if (Real_wgetenv) { DetourDetach(&(PVOID&)Real_wgetenv, Mine_wgetenv); }
+ if (Real_wgetenv_s) { DetourDetach(&(PVOID&)Real_wgetenv, Mine_wgetenv_s); }
+ if (Real_dupenv_s) { DetourDetach(&(PVOID&)Real_dupenv_s, Mine_dupenv_s); }
+ if (Real_wdupenv_s) { DetourDetach(&(PVOID&)Real_wdupenv_s, Mine_wdupenv_s); }
+
+ return DetourTransactionCommit();
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+VOID NoteRead(PCSTR psz)
+{
+ FileInfo *pInfo = FileNames::FindPartial(psz);
+ pInfo->m_fRead = TRUE;
+}
+
+VOID NoteRead(PCWSTR pwz)
+{
+ FileInfo *pInfo = FileNames::FindPartial(pwz);
+ pInfo->m_fRead = TRUE;
+}
+
+VOID NoteWrite(PCSTR psz)
+{
+ FileInfo *pInfo = FileNames::FindPartial(psz);
+ pInfo->m_fWrite = TRUE;
+ if (!pInfo->m_fRead) {
+ pInfo->m_fCantRead = TRUE;
+ }
+}
+
+VOID NoteWrite(PCWSTR pwz)
+{
+ FileInfo *pInfo = FileNames::FindPartial(pwz);
+ pInfo->m_fWrite = TRUE;
+ if (!pInfo->m_fRead) {
+ pInfo->m_fCantRead = TRUE;
+ }
+}
+
+VOID NoteDelete(PCSTR psz)
+{
+ FileInfo *pInfo = FileNames::FindPartial(psz);
+ if (pInfo->m_fWrite || pInfo->m_fRead) {
+ pInfo->m_fCleanup = TRUE;
+ }
+ else {
+ pInfo->m_fDelete = TRUE;
+ }
+ if (!pInfo->m_fRead) {
+ pInfo->m_fCantRead = TRUE;
+ }
+}
+
+VOID NoteDelete(PCWSTR pwz)
+{
+ FileInfo *pInfo = FileNames::FindPartial(pwz);
+ if (pInfo->m_fWrite || pInfo->m_fRead) {
+ pInfo->m_fCleanup = TRUE;
+ }
+ else {
+ pInfo->m_fDelete = TRUE;
+ }
+ if (!pInfo->m_fRead) {
+ pInfo->m_fCantRead = TRUE;
+ }
+}
+
+VOID NoteCleanup(PCSTR psz)
+{
+ FileInfo *pInfo = FileNames::FindPartial(psz);
+ pInfo->m_fCleanup = TRUE;
+}
+
+VOID NoteCleanup(PCWSTR pwz)
+{
+ FileInfo *pInfo = FileNames::FindPartial(pwz);
+ pInfo->m_fCleanup = TRUE;
+}
+
+////////////////////////////////////////////////////////////// Logging System.
+//
+static BOOL s_bLog = 1;
+static LONG s_nTlsIndent = -1;
+static LONG s_nTlsThread = -1;
+static LONG s_nThreadCnt = 0;
+
+LONG EnterFunc()
+{
+ DWORD dwErr = GetLastError();
+
+ LONG nIndent = 0;
+ LONG nThread = 0;
+ if (s_nTlsIndent >= 0) {
+ nIndent = (LONG)(LONG_PTR)TlsGetValue(s_nTlsIndent);
+ TlsSetValue(s_nTlsIndent, (PVOID)(LONG_PTR)(nIndent + 1));
+ }
+ if (s_nTlsThread >= 0) {
+ nThread = (LONG)(LONG_PTR)TlsGetValue(s_nTlsThread);
+ }
+
+ SetLastError(dwErr);
+
+ return nIndent;
+}
+
+VOID ExitFunc()
+{
+ DWORD dwErr = GetLastError();
+
+ LONG nIndent = 0;
+ LONG nThread = 0;
+ if (s_nTlsIndent >= 0) {
+ nIndent = (LONG)(LONG_PTR)TlsGetValue(s_nTlsIndent) - 1;
+ ASSERT(nIndent >= 0);
+ TlsSetValue(s_nTlsIndent, (PVOID)(LONG_PTR)nIndent);
+ }
+ if (s_nTlsThread >= 0) {
+ nThread = (LONG)(LONG_PTR)TlsGetValue(s_nTlsThread);
+ }
+
+ SetLastError(dwErr);
+}
+
+VOID Print(const CHAR *psz, ...)
+{
+ DWORD dwErr = GetLastError();
+
+ if (s_bLog && psz) {
+ va_list args;
+ va_start(args, psz);
+
+ TblogV(psz, args);
+
+ va_end(args);
+ }
+
+ SetLastError(dwErr);
+}
+
+VOID AssertFailed(CONST PCHAR pszMsg, CONST PCHAR pszFile, ULONG nLine)
+{
+ Tblog("ASSERT(%hs) failed in %s, line %d.\n", pszMsg, pszFile, nLine);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// DLL module information
+//
+BOOL ThreadAttach(HMODULE hDll)
+{
+ (void)hDll;
+
+ if (s_nTlsIndent >= 0) {
+ TlsSetValue(s_nTlsIndent, (PVOID)0);
+ }
+ if (s_nTlsThread >= 0) {
+ LONG nThread = InterlockedIncrement(&s_nThreadCnt);
+ TlsSetValue(s_nTlsThread, (PVOID)(LONG_PTR)nThread);
+ }
+ return TRUE;
+}
+
+BOOL ThreadDetach(HMODULE hDll)
+{
+ (void)hDll;
+
+ if (s_nTlsIndent >= 0) {
+ TlsSetValue(s_nTlsIndent, (PVOID)0);
+ }
+ if (s_nTlsThread >= 0) {
+ TlsSetValue(s_nTlsThread, (PVOID)0);
+ }
+ return TRUE;
+}
+
+BOOL ProcessAttach(HMODULE hDll)
+{
+ InitializeCriticalSection(&s_csPipe);
+ InitializeCriticalSection(&s_csChildPayload);
+
+ Procs::Initialize();
+ EnvVars::Initialize();
+ FileNames::Initialize();
+ OpenFiles::Initialize();
+
+ s_bLog = FALSE;
+ s_nTlsIndent = TlsAlloc();
+ s_nTlsThread = TlsAlloc();
+
+ s_hInst = hDll;
+ s_hKernel32 = NULL;
+
+ PBYTE xCreate = (PBYTE)DetourCodeFromPointer((PVOID)Real_CreateProcessW, NULL);
+ PTBLOG_PAYLOAD pPayload = NULL;
+
+ for (HMODULE hMod = NULL; (hMod = DetourEnumerateModules(hMod)) != NULL;) {
+ ULONG cbData;
+ PVOID pvData = DetourFindPayload(hMod, s_guidTrace, &cbData);
+
+ if (pvData != NULL && pPayload == NULL) {
+ pPayload = (PTBLOG_PAYLOAD)pvData;
+ }
+
+ ULONG cbMod = DetourGetModuleSize(hMod);
+
+ if (((PBYTE)hMod) < xCreate && ((PBYTE)hMod + cbMod) > xCreate) {
+ s_hKernel32 = hMod;
+ }
+ }
+
+ ZeroMemory(&s_Payload, sizeof(s_Payload));
+
+ if (pPayload == NULL) {
+ return FALSE;
+ }
+
+ CopyMemory(&s_Payload, pPayload, sizeof(s_Payload));
+
+ LoadStdHandleName(STD_INPUT_HANDLE, s_Payload.wzStdin, FALSE);
+ LoadStdHandleName(STD_OUTPUT_HANDLE, s_Payload.wzStdout, s_Payload.fStdoutAppend);
+ LoadStdHandleName(STD_ERROR_HANDLE, s_Payload.wzStderr, s_Payload.fStderrAppend);
+ s_nTraceProcessId = s_Payload.nTraceProcessId;
+
+ GetModuleFileNameA(s_hInst, s_szDllPath, ARRAYSIZE(s_szDllPath));
+
+ // Find hidden functions.
+ Real_PrivCopyFileExW =
+ (BOOL (WINAPI *)(LPCWSTR, LPCWSTR, LPPROGRESS_ROUTINE, LPVOID, LPBOOL, DWORD))
+ GetProcAddress(s_hKernel32, "PrivCopyFileExW");
+ if (Real_PrivCopyFileExW == NULL) {
+ DEBUG_BREAK();
+ }
+
+ LONG error = AttachDetours();
+ if (error != NO_ERROR) {
+ DEBUG_BREAK();
+ Tblog("<!-- Error attaching detours: %d -->\n", error);
+ }
+
+ ThreadAttach(hDll);
+
+ s_bLog = TRUE;
+ return TRUE;
+}
+
+BOOL ProcessDetach(HMODULE hDll)
+{
+ ThreadDetach(hDll);
+ s_bLog = FALSE;
+
+ LONG error = DetachDetours();
+ if (error != NO_ERROR) {
+ Tblog("<!-- Error detaching detours: %d -->\n", error);
+ }
+
+ TblogClose();
+
+ if (s_nTlsIndent >= 0) {
+ TlsFree(s_nTlsIndent);
+ }
+ if (s_nTlsThread >= 0) {
+ TlsFree(s_nTlsThread);
+ }
+ return TRUE;
+}
+
+inline VOID UpdateIfRoom(PWCHAR& pwzDst, PWCHAR pwzDstEnd, WCHAR c)
+{
+ if (pwzDst < pwzDstEnd) {
+ *pwzDst++ = c; // Write character if room in buffer.
+ }
+ else {
+ pwzDst++; // If no room, just advance pointer (to alloc calculation)
+ }
+}
+
+static PCHAR RemoveReturns(PCHAR pszBuffer)
+{
+ PCHAR pszIn = pszBuffer;
+ PCHAR pszOut = pszBuffer;
+
+ while (*pszIn) {
+ if (*pszIn == '\r') {
+ pszIn++;
+ continue;
+ }
+ *pszOut++ = *pszIn++;
+ }
+ *pszOut = '\0';
+
+ return pszBuffer;
+}
+
+static PWCHAR RemoveReturns(PWCHAR pwzBuffer)
+{
+ PWCHAR pwzIn = pwzBuffer;
+ PWCHAR pwzOut = pwzBuffer;
+
+ while (*pwzIn) {
+ if (*pwzIn == '\r') {
+ pwzIn++;
+ continue;
+ }
+ *pwzOut++ = *pwzIn++;
+ }
+ *pwzOut = '\0';
+
+ return pwzBuffer;
+}
+
+PBYTE LoadFile(HANDLE hFile, DWORD cbFile)
+{
+ PBYTE pbFile = (PBYTE)GlobalAlloc(GPTR, cbFile + 3);
+ if (pbFile == NULL) {
+ return NULL;
+ }
+
+ DWORD cbRead = 0;
+ Real_SetFilePointer(hFile, 0, NULL, FILE_BEGIN);
+ Real_ReadFile(hFile, pbFile, cbFile, &cbRead, NULL);
+
+ // Make sure the file is zero terminated.
+ pbFile[cbRead + 0] = 0;
+ pbFile[cbRead + 1] = 0;
+ pbFile[cbRead + 2] = 0;
+
+ return pbFile;
+}
+
+PWCHAR More(PCWSTR pwzPath, PWCHAR pwzDst, PWCHAR pwzDstEnd)
+{
+ HANDLE hFile = Real_CreateFileW(pwzPath, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
+ if (hFile == INVALID_HANDLE_VALUE) {
+ return NULL;
+ }
+
+ FileInfo *pInfo = FileNames::FindPartial(pwzPath);
+ pInfo->m_fAbsorbed = true;
+
+ DWORD cbFile = Real_SetFilePointer(hFile, 0, NULL, FILE_END);
+ DWORD cbRead = 0;
+
+ PCHAR pszFile = (PCHAR)GlobalAlloc(GPTR, cbFile + 2); // 2 bytes null for Unicode or Ascii.
+ if (pszFile != NULL) {
+ Real_SetFilePointer(hFile, 0, NULL, FILE_BEGIN);
+ Real_ReadFile(hFile, pszFile, cbFile, &cbRead, NULL);
+
+ if (((PUCHAR)pszFile)[0] == 0xff && ((PUCHAR)pszFile)[1] == 0xfe) {
+ // Unicode
+ PWCHAR pwzFile = ((PWCHAR)pszFile) + 1;
+ PCWSTR pwzIn = pwzFile;
+ while (*pwzIn) {
+ if (*pwzIn == ' ' || *pwzIn == '\t' || *pwzIn == '\r' || *pwzIn == '\n') {
+ UpdateIfRoom(pwzDst, pwzDstEnd, ' ');
+ while (*pwzIn == ' ' || *pwzIn == '\t' || *pwzIn == '\r' || *pwzIn == '\n') {
+ pwzIn++;
+ }
+ }
+ else {
+ UpdateIfRoom(pwzDst, pwzDstEnd, *pwzIn++);
+ }
+ }
+ }
+ else {
+ PCSTR pszIn = pszFile;
+ while (*pszIn) {
+ if (*pszIn == ' ' || *pszIn == '\t' || *pszIn == '\r' || *pszIn == '\n') {
+ UpdateIfRoom(pwzDst, pwzDstEnd, ' ');
+ while (*pszIn == ' ' || *pszIn == '\t' || *pszIn == '\r' || *pszIn == '\n') {
+ pszIn++;
+ }
+ }
+ else {
+ UpdateIfRoom(pwzDst, pwzDstEnd, *pszIn++);
+ }
+ }
+ }
+
+ GlobalFree(pszFile);
+ }
+
+ Real_CloseHandle(hFile);
+
+ return pwzDst;
+}
+
+// This function is called twice. On the first call, pwzDstEnd <= pwzDst and
+// no data is copied, but pwzDst is advanced so we can see how big of a
+// buffer is needed to hold the command line.
+//
+// On the second call, the command line is actually populated.
+PWCHAR LoadCommandLine(PCWSTR pwz, PWCHAR pwzDst, PWCHAR pwzDstEnd)
+{
+ while (*pwz) {
+ PCWSTR pwzArgBeg = NULL;
+ PCWSTR pwzArgEnd = NULL;
+ WCHAR cQuote = '\0';
+ BOOL fMore = false;
+
+ if (*pwz == '@') {
+ fMore = true;
+ pwz++;
+ }
+
+ if (*pwz == '\"' || *pwz == '\'') {
+ cQuote = *pwz++;
+
+ pwzArgBeg = pwz;
+ while (*pwz != '\0' && *pwz != cQuote) {
+ pwz++;
+ }
+ pwzArgEnd = pwz;
+
+ if (*pwz == cQuote) {
+ pwz++;
+ }
+ }
+ else {
+ pwzArgBeg = pwz;
+ while (*pwz != '\0' && *pwz != ' ' && *pwz != '\t' && *pwz != '\n' && *pwz != '\r') {
+ pwz++;
+ }
+ pwzArgEnd = pwz;
+ }
+
+ if (fMore) {
+ // More arguments!
+ WCHAR wzPath[MAX_PATH];
+ PWCHAR pwzPath = wzPath;
+ PCWSTR pwzTmp = pwzArgBeg + 1;
+ while (pwzTmp < pwzArgEnd && pwzPath < wzPath + ARRAYSIZE(wzPath)-2) {
+ *pwzPath++ = *pwzTmp++;
+ }
+ *pwzPath = '\0';
+
+ PWCHAR pwzOut = More(wzPath, pwzDst, pwzDstEnd);
+ if (pwzOut != NULL) {
+ pwzDst = pwzOut;
+
+ cQuote = 0;
+ pwzArgBeg = pwzArgEnd;
+ }
+ }
+
+ if (cQuote) {
+ UpdateIfRoom(pwzDst, pwzDstEnd, cQuote);
+ }
+ for (; pwzArgBeg < pwzArgEnd; pwzArgBeg++) {
+ UpdateIfRoom(pwzDst, pwzDstEnd, *pwzArgBeg);
+ }
+ if (cQuote) {
+ UpdateIfRoom(pwzDst, pwzDstEnd, cQuote);
+ }
+
+ if (*pwz) {
+ UpdateIfRoom(pwzDst, pwzDstEnd, ' ');
+ }
+
+ // skip over separating spaces.
+ while (*pwz == ' ' || *pwz == '\t' || *pwz == '\n' || *pwz == '\r') {
+ pwz++;
+ }
+ }
+ return pwzDst;
+}
+
+void TestHandle(PCSTR pszName, HANDLE h)
+{
+ FileInfo *pInfo = OpenFiles::RecallFile(h);
+
+ if (pInfo != NULL) {
+#if 1 // Ignore PIPEs.
+ if (FileNames::PrefixMatch(pInfo->m_pwzPath, L"\\\\.\\PIPE\\")) {
+ // Ignore;
+ }
+ else
+#endif
+ if (FileNames::SuffixMatch(pInfo->m_pwzPath, L"\\conout$")) {
+ // Ignore;
+ }
+ else if (FileNames::SuffixMatch(pInfo->m_pwzPath, L"\\conin$")) {
+ // Ignore;
+ }
+ else if (FileNames::SuffixMatch(pInfo->m_pwzPath, L"\\nul")) {
+ // Ignore;
+ }
+ else {
+ Tblog("<%hs%hs>%le</%hs>\n",
+ pszName, pInfo->m_fAppend ? " append=\"true\"" : "", pInfo->m_pwzPath, pszName);
+ }
+ }
+ else {
+ Tblog("<!-- hand: %hs (%x) ***Unknown*** -->\n", pszName, h);
+ }
+}
+
+LONG WINAPI DetourAttachIf(PVOID *ppPointer, PVOID pDetour)
+{
+ if (*ppPointer == NULL) {
+ Tblog("<!-- DetourAttachIf failed: %p -->\n", pDetour);
+ return NO_ERROR;
+ }
+
+ PDETOUR_TRAMPOLINE pRealTrampoline;
+ PVOID pRealTarget;
+ PVOID pRealDetour;
+
+ LONG err = DetourAttachEx(ppPointer, pDetour, &pRealTrampoline, &pRealTarget, &pRealDetour);
+ if (err == NO_ERROR) {
+ // Tblog("<!-- DetourAttachIf %p at %p -->\n", pDetour, pRealTarget);
+ return NO_ERROR;
+ }
+ return err;
+}
+
+int WINAPI Mine_EntryPoint(VOID)
+{
+ // This function is invoked instead of the process EntryPoint (Real_EntryPoint).
+
+ TblogOpen();
+
+ SaveEnvironment();
+
+ {
+ CHAR szExeName[MAX_PATH];
+ CHAR szId[128];
+ CHAR szParent[128];
+ WCHAR wzPath[MAX_PATH];
+ PCHAR pszExeName = szExeName;
+
+ // Get the base command line (skipping over the executable name)
+ PCWSTR pwzLine = GetCommandLineW();
+ if (*pwzLine == '\"') {
+ pwzLine++;
+ while (*pwzLine && *pwzLine != '\"') {
+ pwzLine++;
+ }
+ if (*pwzLine == '\"') {
+ pwzLine++;
+ }
+ }
+ else {
+ while (*pwzLine && *pwzLine != ' ' && *pwzLine != '\t') {
+ pwzLine++;
+ }
+ }
+ while (*pwzLine && (*pwzLine == ' ' || *pwzLine == '\t')) {
+ pwzLine++;
+ }
+
+ // Get the root executable name.
+ if (GetModuleFileNameA(0, szExeName, ARRAYSIZE(szExeName))) {
+ PCHAR psz = szExeName;
+
+ while (*psz) {
+ psz++;
+ }
+
+ while (psz > szExeName && psz[-1] != ':' && psz[-1] != '\\' && psz[-1] != '/') {
+ psz--;
+ }
+ pszExeName = psz;
+ while (*psz && *psz != '.') {
+ psz++;
+ }
+ *psz = '\0';
+ }
+ else {
+ szExeName[0] = '\0';
+ }
+
+ // Start the XML process node.
+ Tblog("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+ {
+ PCHAR pszId = szId;
+ PCHAR pszParent = szParent;
+ for (DWORD i = 0; i < s_Payload.nGeneology; i++) {
+ pszId = SafePrintf(pszId, 16, "%d.", s_Payload.rGeneology[i]);
+ if (i < s_Payload.nGeneology - 1) {
+ pszParent = SafePrintf(pszParent, 16, "%d.", s_Payload.rGeneology[i]);
+ }
+ }
+ *pszId = '\0';
+ *pszParent = '\0';
+
+ if (szParent[0] == '\0') {
+ Tblog("<t:Process id=\"::%hs::\"", szId);
+ }
+ else {
+ Tblog("<t:Process id=\"::%hs::\" parentId=\"::%hs::\"", szId, szParent);
+ }
+
+ Tblog(" par=\"%ls\" exe=\"%hs\"", s_Payload.wzParents, pszExeName);
+
+ BOOL drop = false;
+ PCWSTR pwzz = s_Payload.wzzDrop;
+ while (*pwzz) {
+ if (Compare(pwzz, pszExeName) == 0) {
+ // match
+ drop = true;
+ break;
+ }
+ pwzz += Size(pwzz) + 1;
+ }
+ if (drop) {
+ Tblog(" drop=\"true\"");
+ }
+ }
+
+ {
+ PWCHAR pwz = s_Payload.wzParents;
+ while (*pwz) {
+ pwz++;
+ }
+ *pwz++ = '/';
+ PCSTR psz = pszExeName;
+ while (*psz) {
+ *pwz++ = *psz++;
+ }
+ *pwz = '\0';
+ }
+
+
+ if (HasChar(pwzLine, '|')) {
+ Tblog(" pipes=\"true\"");
+ }
+ if (HasChar(pwzLine, '>')) {
+ Tblog(" redirects=\"true\"");
+ }
+
+ Tblog(" xmlns:t=\"http://schemas.microsoft.com/research/tracebld/2008\">\n");
+
+ // Get the directory.
+ DWORD dwSize = GetCurrentDirectoryA(ARRAYSIZE(szExeName), szExeName);
+ if (dwSize > 0 && dwSize < ARRAYSIZE(szExeName)) {
+ Tblog("<t:Directory>%hs</t:Directory>\n", szExeName);
+ }
+
+ // Get the real executable name.
+ wzPath[0] = '\0';
+ if (GetModuleFileNameA(0, szExeName, ARRAYSIZE(szExeName))) {
+ FileInfo *pInfo = FileNames::FindPartial(szExeName);
+ Tblog("<t:Executable>%ls</t:Executable>\n",
+ FileNames::ParameterizeName(wzPath, ARRAYSIZE(wzPath), pInfo));
+ }
+
+ // Construct the processed command line.
+ PWCHAR pwzDstEnd = (PWCHAR)pwzLine;
+ PWCHAR pwzDst = pwzDstEnd;
+ pwzDst = LoadCommandLine(pwzLine, pwzDst, pwzDstEnd);
+ DWORD wcNew = (DWORD)((pwzDst - pwzDstEnd) + 1);
+ PWCHAR pwzFin = (PWCHAR)GlobalAlloc(GPTR, wcNew * sizeof(WCHAR));
+ pwzDst = pwzFin;
+ pwzDstEnd = pwzFin + wcNew;
+ pwzDst = LoadCommandLine(pwzLine, pwzDst, pwzDstEnd);
+ *pwzDst = '\0';
+
+ FileNames::ParameterizeLine(pwzFin, pwzFin + wcNew);
+ if (HasSpace(wzPath)) {
+ Tblog("<t:Line>&quot;%le&quot; %le</t:Line>\n", wzPath, pwzFin);
+ }
+ else {
+ Tblog("<t:Line>%le %le</t:Line>\n", wzPath, pwzFin);
+ }
+
+ TestHandle("t:StdIn", GetStdHandle(STD_INPUT_HANDLE));
+ TestHandle("t:StdOut", GetStdHandle(STD_OUTPUT_HANDLE));
+ TestHandle("t:StdErr", GetStdHandle(STD_ERROR_HANDLE));
+ }
+
+ if (FindMsvcr()) {
+ FindProc(&(PVOID&)Real_getenv, "getenv");
+ FindProc(&(PVOID&)Real_wgetenv, "_wgetenv");
+ FindProc(&(PVOID&)Real_getenv_s, "getenv_s");
+ FindProc(&(PVOID&)Real_wgetenv_s, "_wgetenv_s");
+ FindProc(&(PVOID&)Real_dupenv_s, "_dupenv_s");
+ FindProc(&(PVOID&)Real_wdupenv_s, "_wdupenv_s");
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+
+ DetourAttachIf(&(PVOID&)Real_getenv, Mine_getenv);
+ DetourAttachIf(&(PVOID&)Real_getenv_s, Mine_getenv_s);
+ DetourAttachIf(&(PVOID&)Real_wgetenv, Mine_wgetenv);
+ DetourAttachIf(&(PVOID&)Real_wgetenv, Mine_wgetenv_s);
+ DetourAttachIf(&(PVOID&)Real_dupenv_s, Mine_dupenv_s);
+ DetourAttachIf(&(PVOID&)Real_wdupenv_s, Mine_wdupenv_s);
+
+ DetourTransactionCommit();
+ }
+
+ return Real_EntryPoint();
+}
+
+VOID WINAPI Mine_ExitProcess(UINT a0)
+{
+ if (a0 & 0x80000000) {
+ Tblog("<t:Return>%d</t:Return>\n", -(int)a0);
+ }
+ else {
+ Tblog("<t:Return>%d</t:Return>\n", a0);
+ }
+
+ FileNames::Dump();
+ EnvVars::Dump();
+
+ TblogClose();
+
+ Real_ExitProcess(a0);
+}
+
+BOOL APIENTRY DllMain(HINSTANCE hModule, DWORD dwReason, PVOID lpReserved)
+{
+ (void)hModule;
+ (void)lpReserved;
+
+ if (DetourIsHelperProcess()) {
+ return TRUE;
+ }
+
+ if (dwReason == DLL_PROCESS_ATTACH) {
+ DetourRestoreAfterWith();
+ Real_EntryPoint = (int (WINAPI *)(VOID))DetourGetEntryPoint(NULL);
+ return ProcessAttach(hModule);
+ }
+ else if (dwReason == DLL_PROCESS_DETACH) {
+ return ProcessDetach(hModule);
+ }
+ else if (dwReason == DLL_THREAD_ATTACH) {
+ return ThreadAttach(hModule);
+ }
+ else if (dwReason == DLL_THREAD_DETACH) {
+ return ThreadDetach(hModule);
+ }
+ return TRUE;
+}
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/tracebld/trcbld.rc b/ext/detours/samples/tracebld/trcbld.rc
new file mode 100644
index 0000000..180faec
--- /dev/null
+++ b/ext/detours/samples/tracebld/trcbld.rc
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Version information for trcbld.rc.
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include "detver.h"
+
+#define VER_INTERNALNAME_STR "trcbld" DETOURS_STRINGIFY(DETOURS_BITS)
+#define VER_ORIGINALFILENAME_STR "trcbld" DETOURS_STRINGIFY(DETOURS_BITS) ".dll"
+#define VER_FILEDESCRIPTION_STR "Detours Build Tracing Module"
+#define VER_COMPANYNAME_STR "Microsoft Corporation"
+
+#include "common.ver"
diff --git a/ext/detours/samples/tracelnk/Makefile b/ext/detours/samples/tracelnk/Makefile
new file mode 100644
index 0000000..067d4fc
--- /dev/null
+++ b/ext/detours/samples/tracelnk/Makefile
@@ -0,0 +1,103 @@
+##############################################################################
+##
+## Utility to trace Dynamic Linking.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+LIBS=$(LIBS) kernel32.lib
+
+##############################################################################
+
+all: dirs \
+ $(BIND)\trclnk$(DETOURS_BITS).dll \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\trclnk$(DETOURS_BITS).bsc \
+!ENDIF
+ option
+
+##############################################################################
+
+clean:
+ -del *~ test.txt 2>nul
+ -del $(BIND)\trclnk*.* 2>nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo . Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo . Created $(OBJD)
+
+##############################################################################
+
+$(OBJD)\trclnk.obj : trclnk.cpp
+
+$(OBJD)\trclnk.res : trclnk.rc
+
+$(BIND)\trclnk$(DETOURS_BITS).dll : $(OBJD)\trclnk.obj $(OBJD)\trclnk.res $(DEPS)
+ cl /LD $(CFLAGS) /Fe$@ /Fd$(@R).pdb \
+ $(OBJD)\trclnk.obj $(OBJD)\trclnk.res \
+ /link $(LINKFLAGS) /subsystem:console \
+ /export:DetourFinishHelperProcess,@1,NONAME \
+ $(LIBS)
+
+$(OBJD)\trclnk$(DETOURS_BITS).bsc : $(OBJD)\trclnk.obj
+ bscmake /v /n /o $@ $(OBJD)\trclnk.sbr
+
+############################################### Install non-bit-size binaries.
+
+!IF "$(DETOURS_OPTION_PROCESSOR)" != ""
+
+$(OPTD)\trclnk$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\trclnk$(DETOURS_OPTION_BITS).pdb:
+
+$(BIND)\trclnk$(DETOURS_OPTION_BITS).dll : $(OPTD)\trclnk$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\trclnk$(DETOURS_OPTION_BITS).pdb : $(OPTD)\trclnk$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+
+option: \
+ $(BIND)\trclnk$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\trclnk$(DETOURS_OPTION_BITS).pdb \
+
+!ELSE
+
+option:
+
+!ENDIF
+
+##############################################################################
+
+notepad: all
+ @echo -------- Logging output to test.txt ------------
+ start $(BIND)\syelogd.exe /o test.txt
+ $(BIND)\sleep5.exe 1
+ @echo -------- Should load trclnk$(DETOURS_BITS).dll dynamically using withdll.exe ------------
+ @echo .
+ @echo ** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE **
+ @echo **
+ @echo ** Close the NotePad window to continue test.
+ @echo **
+ @echo ** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE **
+ @echo .
+ $(BIND)\withdll -d:$(BIND)\trclnk$(DETOURS_BITS).dll $(SYSTEMROOT)\system32\notepad.exe
+ @echo -------- Log from syelog -------------
+ type test.txt
+
+test: all
+ @echo -------- Logging output to test.txt ------------
+ start $(BIND)\syelogd.exe /o test.txt
+ $(BIND)\sleep5.exe 1
+ @echo -------- Should load trclnk$(DETOURS_BITS).dll dynamically using withdll.exe ------------
+ @echo .
+ $(BIND)\withdll -d:$(BIND)\trclnk$(DETOURS_BITS).dll $(SYSTEMROOT)\system32\cmd.exe /c dir
+ @echo -------- Log from syelog -------------
+ type test.txt
+
+################################################################# End of File.
diff --git a/ext/detours/samples/tracelnk/trclnk.cpp b/ext/detours/samples/tracelnk/trclnk.cpp
new file mode 100644
index 0000000..75cbfe2
--- /dev/null
+++ b/ext/detours/samples/tracelnk/trclnk.cpp
@@ -0,0 +1,685 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (trclnk.cpp of trclnk.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#define _WIN32_WINNT 0x0400
+#define WIN32
+#define NT
+
+#define DBG_TRACE 0
+
+#include <windows.h>
+#include <stdio.h>
+#include "detours.h"
+#include "syelog.h"
+
+#define PULONG_PTR PVOID
+#define PLONG_PTR PVOID
+#define ULONG_PTR PVOID
+#define ENUMRESNAMEPROCA PVOID
+#define ENUMRESNAMEPROCW PVOID
+#define ENUMRESLANGPROCA PVOID
+#define ENUMRESLANGPROCW PVOID
+#define ENUMRESTYPEPROCA PVOID
+#define ENUMRESTYPEPROCW PVOID
+#define STGOPTIONS PVOID
+
+//////////////////////////////////////////////////////////////////////////////
+#pragma warning(disable:4127) // Many of our asserts are constants.
+
+#define ASSERT_ALWAYS(x) \
+ do { \
+ if (!(x)) { \
+ AssertMessage(#x, __FILE__, __LINE__); \
+ DebugBreak(); \
+ } \
+ } while (0)
+
+#ifndef NDEBUG
+#define ASSERT(x) ASSERT_ALWAYS(x)
+#else
+#define ASSERT(x)
+#endif
+
+#define UNUSED(c) (c) = (c)
+
+//////////////////////////////////////////////////////////////////////////////
+static HMODULE s_hInst = NULL;
+static WCHAR s_wzDllPath[MAX_PATH];
+
+BOOL ProcessEnumerate();
+BOOL InstanceEnumerate(HINSTANCE hInst);
+BOOL ImportEnumerate(HINSTANCE hInst);
+
+VOID _PrintEnter(const CHAR *psz, ...);
+VOID _PrintExit(const CHAR *psz, ...);
+VOID _Print(const CHAR *psz, ...);
+VOID _VPrint(PCSTR msg, va_list args, PCHAR pszBuf, LONG cbBuf);
+
+VOID AssertMessage(CONST PCHAR pszMsg, CONST PCHAR pszFile, ULONG nLine);
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// Trampolines
+//
+extern "C" {
+ // Trampolines for SYELOG library.
+ //
+ HANDLE (WINAPI *
+ Real_CreateFileW)(LPCWSTR a0, DWORD a1, DWORD a2,
+ LPSECURITY_ATTRIBUTES a3, DWORD a4, DWORD a5,
+ HANDLE a6)
+ = CreateFileW;
+
+ BOOL (WINAPI *
+ Real_WriteFile)(HANDLE hFile,
+ LPCVOID lpBuffer,
+ DWORD nNumberOfBytesToWrite,
+ LPDWORD lpNumberOfBytesWritten,
+ LPOVERLAPPED lpOverlapped)
+ = WriteFile;
+ BOOL (WINAPI *
+ Real_FlushFileBuffers)(HANDLE hFile)
+ = FlushFileBuffers;
+ BOOL (WINAPI *
+ Real_CloseHandle)(HANDLE hObject)
+ = CloseHandle;
+
+ BOOL (WINAPI *
+ Real_WaitNamedPipeW)(LPCWSTR lpNamedPipeName, DWORD nTimeOut)
+ = WaitNamedPipeW;
+ BOOL (WINAPI *
+ Real_SetNamedPipeHandleState)(HANDLE hNamedPipe,
+ LPDWORD lpMode,
+ LPDWORD lpMaxCollectionCount,
+ LPDWORD lpCollectDataTimeout)
+ = SetNamedPipeHandleState;
+
+ DWORD (WINAPI *
+ Real_GetCurrentProcessId)(VOID)
+ = GetCurrentProcessId;
+ VOID (WINAPI *
+ Real_GetSystemTimeAsFileTime)(LPFILETIME lpSystemTimeAsFileTime)
+ = GetSystemTimeAsFileTime;
+
+ VOID (WINAPI *
+ Real_InitializeCriticalSection)(LPCRITICAL_SECTION lpSection)
+ = InitializeCriticalSection;
+ VOID (WINAPI *
+ Real_EnterCriticalSection)(LPCRITICAL_SECTION lpSection)
+ = EnterCriticalSection;
+ VOID (WINAPI *
+ Real_LeaveCriticalSection)(LPCRITICAL_SECTION lpSection)
+ = LeaveCriticalSection;
+}
+
+BOOL (WINAPI *
+ Real_FreeLibrary)(HMODULE a0)
+ = FreeLibrary;
+
+DWORD (WINAPI *
+ Real_GetModuleFileNameW)(HMODULE a0,
+ LPWSTR a1,
+ DWORD a2)
+ = GetModuleFileNameW;
+
+HMODULE (WINAPI *
+ Real_GetModuleHandleW)(LPCWSTR a0)
+ = GetModuleHandleW;
+
+FARPROC (WINAPI *
+ Real_GetProcAddress)(HMODULE a0,
+ LPCSTR a1)
+ = GetProcAddress;
+
+HMODULE (WINAPI *
+ Real_LoadLibraryExW)(LPCWSTR a0,
+ HANDLE a1,
+ DWORD a2)
+ = LoadLibraryExW;
+
+HMODULE (WINAPI *
+ Real_LoadLibraryW)(LPCWSTR a0)
+ = LoadLibraryW;
+
+//////////////////////////////////////////////////////////////////////////////
+//
+BOOL WINAPI Mine_FreeLibrary(HMODULE a0)
+{
+ (void)a0;
+
+ return TRUE;
+}
+
+DWORD WINAPI Mine_GetModuleFileNameW(HMODULE a0,
+ LPWSTR a1,
+ DWORD a2)
+{
+ return Real_GetModuleFileNameW(a0, a1, a2);
+}
+
+HMODULE WINAPI Mine_GetModuleHandleW(LPCWSTR a0)
+{
+ return Real_GetModuleHandleW(a0);
+}
+
+FARPROC WINAPI Mine_GetProcAddress(HMODULE a0,
+ LPCSTR a1)
+{
+ _PrintEnter("GetProcAddress(%p,%hs)\n", a0, a1);
+
+ FARPROC rv = 0;
+ __try {
+ rv = Real_GetProcAddress(a0, a1);
+ } __finally {
+ _PrintExit("GetProcAddress(,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HMODULE WINAPI Mine_LoadLibraryExW(LPCWSTR a0,
+ HANDLE a1,
+ DWORD a2)
+{
+ _PrintEnter("LoadLibraryExW(%ls,%p,%x)\n", a0, a1, a2);
+
+ HMODULE rv = 0;
+ __try {
+ rv = Real_LoadLibraryExW(a0, a1, a2);
+ } __finally {
+ _PrintExit("LoadLibraryExW(,,) -> %p\n", rv);
+ if (rv) {
+ InstanceEnumerate(rv);
+ ImportEnumerate(rv);
+ }
+ };
+ return rv;
+}
+
+HMODULE WINAPI Mine_LoadLibraryW(LPCWSTR a0)
+{
+ _PrintEnter("LoadLibraryW(%ls)\n", a0);
+
+ HMODULE rv = 0;
+ __try {
+ rv = Real_LoadLibraryW(a0);
+ } __finally {
+ _PrintExit("LoadLibraryW() -> %p\n", rv);
+ };
+ return rv;
+}
+
+/////////////////////////////////////////////////////////////
+// AttachDetours
+//
+PCHAR DetRealName(PCHAR psz)
+{
+ PCHAR pszBeg = psz;
+ // Move to end of name.
+ while (*psz) {
+ psz++;
+ }
+ // Move back through A-Za-z0-9 names.
+ while (psz > pszBeg &&
+ ((psz[-1] >= 'A' && psz[-1] <= 'Z') ||
+ (psz[-1] >= 'a' && psz[-1] <= 'z') ||
+ (psz[-1] >= '0' && psz[-1] <= '9'))) {
+ psz--;
+ }
+ return psz;
+}
+
+VOID DetAttach(PVOID *ppbReal, PVOID pbMine, PCHAR psz)
+{
+ LONG l = DetourAttach(ppbReal, pbMine);
+ if (l != 0) {
+ Syelog(SYELOG_SEVERITY_NOTICE,
+ "Attach failed: `%s': error %d\n", DetRealName(psz), l);
+ }
+}
+
+VOID DetDetach(PVOID *ppbReal, PVOID pbMine, PCHAR psz)
+{
+ LONG l = DetourDetach(ppbReal, pbMine);
+ if (l != 0) {
+ Syelog(SYELOG_SEVERITY_NOTICE,
+ "Detach failed: `%s': error %d\n", DetRealName(psz), l);
+ }
+}
+
+#define ATTACH(x) DetAttach(&(PVOID&)Real_##x,Mine_##x,#x)
+#define DETACH(x) DetDetach(&(PVOID&)Real_##x,Mine_##x,#x)
+
+LONG AttachDetours(VOID)
+{
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+
+ ATTACH(FreeLibrary);
+ ATTACH(GetModuleHandleW);
+ ATTACH(GetProcAddress);
+ ATTACH(LoadLibraryExW);
+ ATTACH(LoadLibraryW);
+
+ return DetourTransactionCommit();
+}
+
+LONG DetachDetours(VOID)
+{
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+
+ DETACH(FreeLibrary);
+ DETACH(GetModuleHandleW);
+ DETACH(GetProcAddress);
+ DETACH(LoadLibraryExW);
+ DETACH(LoadLibraryW);
+
+ return DetourTransactionCommit();
+}
+
+////////////////////////////////////////////////////////////// Logging System.
+//
+static BOOL s_bLog = 1;
+static LONG s_nTlsIndent = -1;
+static LONG s_nTlsThread = -1;
+static LONG s_nThreadCnt = 0;
+
+VOID _PrintEnter(const CHAR *psz, ...)
+{
+ DWORD dwErr = GetLastError();
+
+ LONG nIndent = 0;
+ LONG nThread = 0;
+ if (s_nTlsIndent >= 0) {
+ nIndent = (LONG)(LONG_PTR)TlsGetValue(s_nTlsIndent);
+ TlsSetValue(s_nTlsIndent, (PVOID)(LONG_PTR)(nIndent + 1));
+ }
+ if (s_nTlsThread >= 0) {
+ nThread = (LONG)(LONG_PTR)TlsGetValue(s_nTlsThread);
+ }
+
+ if (s_bLog && psz) {
+ CHAR szBuf[1024];
+ PCHAR pszBuf = szBuf;
+ PCHAR pszEnd = szBuf + ARRAYSIZE(szBuf) - 1;
+ LONG nLen = (nIndent > 0) ? (nIndent < 35 ? nIndent * 2 : 70) : 0;
+ *pszBuf++ = (CHAR)('0' + ((nThread / 100) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 10) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 1) % 10));
+ *pszBuf++ = ' ';
+ while (nLen-- > 0) {
+ *pszBuf++ = ' ';
+ }
+
+ va_list args;
+ va_start(args, psz);
+
+ while ((*pszBuf++ = *psz++) != 0 && pszBuf < pszEnd) {
+ // Copy characters.
+ }
+ *pszEnd = '\0';
+ SyelogV(SYELOG_SEVERITY_INFORMATION, szBuf, args);
+
+ va_end(args);
+ }
+ SetLastError(dwErr);
+}
+
+VOID _PrintExit(const CHAR *psz, ...)
+{
+ DWORD dwErr = GetLastError();
+
+ LONG nIndent = 0;
+ LONG nThread = 0;
+ if (s_nTlsIndent >= 0) {
+ nIndent = (LONG)(LONG_PTR)TlsGetValue(s_nTlsIndent) - 1;
+ ASSERT(nIndent >= 0);
+ TlsSetValue(s_nTlsIndent, (PVOID)(LONG_PTR)nIndent);
+ }
+ if (s_nTlsThread >= 0) {
+ nThread = (LONG)(LONG_PTR)TlsGetValue(s_nTlsThread);
+ }
+
+ if (s_bLog && psz) {
+ CHAR szBuf[1024];
+ PCHAR pszBuf = szBuf;
+ PCHAR pszEnd = szBuf + ARRAYSIZE(szBuf) - 1;
+ LONG nLen = (nIndent > 0) ? (nIndent < 35 ? nIndent * 2 : 70) : 0;
+ *pszBuf++ = (CHAR)('0' + ((nThread / 100) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 10) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 1) % 10));
+ *pszBuf++ = ' ';
+ while (nLen-- > 0) {
+ *pszBuf++ = ' ';
+ }
+
+ va_list args;
+ va_start(args, psz);
+
+ while ((*pszBuf++ = *psz++) != 0 && pszBuf < pszEnd) {
+ // Copy characters.
+ }
+ *pszEnd = '\0';
+ SyelogV(SYELOG_SEVERITY_INFORMATION, szBuf, args);
+
+ va_end(args);
+ }
+ SetLastError(dwErr);
+}
+
+VOID _Print(const CHAR *psz, ...)
+{
+ DWORD dwErr = GetLastError();
+
+ LONG nIndent = 0;
+ LONG nThread = 0;
+ if (s_nTlsIndent >= 0) {
+ nIndent = (LONG)(LONG_PTR)TlsGetValue(s_nTlsIndent);
+ }
+ if (s_nTlsThread >= 0) {
+ nThread = (LONG)(LONG_PTR)TlsGetValue(s_nTlsThread);
+ }
+
+ if (s_bLog && psz) {
+ CHAR szBuf[1024];
+ PCHAR pszBuf = szBuf;
+ PCHAR pszEnd = szBuf + ARRAYSIZE(szBuf) - 1;
+ LONG nLen = (nIndent > 0) ? (nIndent < 35 ? nIndent * 2 : 70) : 0;
+ *pszBuf++ = (CHAR)('0' + ((nThread / 100) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 10) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 1) % 10));
+ *pszBuf++ = ' ';
+ while (nLen-- > 0) {
+ *pszBuf++ = ' ';
+ }
+
+ va_list args;
+ va_start(args, psz);
+
+ while ((*pszBuf++ = *psz++) != 0 && pszBuf < pszEnd) {
+ // Copy characters.
+ }
+ *pszEnd = '\0';
+ SyelogV(SYELOG_SEVERITY_INFORMATION, szBuf, args);
+
+ va_end(args);
+ }
+ SetLastError(dwErr);
+}
+
+VOID AssertMessage(CONST PCHAR pszMsg, CONST PCHAR pszFile, ULONG nLine)
+{
+ Syelog(SYELOG_SEVERITY_FATAL,
+ "ASSERT(%s) failed in %s, line %d.\n", pszMsg, pszFile, nLine);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+PIMAGE_NT_HEADERS NtHeadersForInstance(HINSTANCE hInst)
+{
+ PIMAGE_DOS_HEADER pDosHeader = (PIMAGE_DOS_HEADER)hInst;
+ __try {
+ if (pDosHeader->e_magic != IMAGE_DOS_SIGNATURE) {
+ SetLastError(ERROR_BAD_EXE_FORMAT);
+ return NULL;
+ }
+
+ PIMAGE_NT_HEADERS pNtHeader = (PIMAGE_NT_HEADERS)((PBYTE)pDosHeader +
+ pDosHeader->e_lfanew);
+ if (pNtHeader->Signature != IMAGE_NT_SIGNATURE) {
+ SetLastError(ERROR_INVALID_EXE_SIGNATURE);
+ return NULL;
+ }
+ if (pNtHeader->FileHeader.SizeOfOptionalHeader == 0) {
+ SetLastError(ERROR_EXE_MARKED_INVALID);
+ return NULL;
+ }
+ return pNtHeader;
+ } __except(EXCEPTION_EXECUTE_HANDLER) {
+ }
+ SetLastError(ERROR_EXE_MARKED_INVALID);
+
+ return NULL;
+}
+
+static inline PBYTE RvaToVa(PBYTE pbBase, DWORD nOffset)
+{
+ return nOffset ? pbBase + nOffset : NULL;
+}
+
+#if _MSC_VER >= 1900
+#pragma warning(push)
+#pragma warning(disable:4456) // declaration hides previous local declaration
+#endif
+
+BOOL ImportEnumerate(HINSTANCE hInst)
+{
+ PBYTE pbBase = (PBYTE)hInst;
+ PIMAGE_NT_HEADERS pNtHeader; // Read & Write
+ PIMAGE_SECTION_HEADER pSectionHeaders;
+ DWORD nPeOffset;
+ DWORD nSectionsOffset;
+
+ ////////////////////////////////////////////////////// Process DOS Header.
+ //
+ PIMAGE_DOS_HEADER pDosHeader = (PIMAGE_DOS_HEADER)pbBase;
+ if (pDosHeader->e_magic != IMAGE_DOS_SIGNATURE) {
+ return FALSE;
+ }
+ nPeOffset = pDosHeader->e_lfanew;
+
+ /////////////////////////////////////////////////////// Process PE Header.
+ //
+ pNtHeader = (PIMAGE_NT_HEADERS)RvaToVa(pbBase, nPeOffset);
+ if (pNtHeader->Signature != IMAGE_NT_SIGNATURE) {
+ return FALSE;
+ }
+ if (pNtHeader->FileHeader.SizeOfOptionalHeader == 0) {
+ return FALSE;
+ }
+ nSectionsOffset = nPeOffset
+ + sizeof(pNtHeader->Signature)
+ + sizeof(pNtHeader->FileHeader)
+ + pNtHeader->FileHeader.SizeOfOptionalHeader;
+
+ ///////////////////////////////////////////////// Process Section Headers.
+ //
+ pSectionHeaders = (PIMAGE_SECTION_HEADER)RvaToVa(pbBase, nSectionsOffset);
+
+ //////////////////////////////////////////////////////// Get Import Table.
+ //
+ DWORD rvaImageDirectory = pNtHeader->OptionalHeader
+ .DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress;
+ PIMAGE_IMPORT_DESCRIPTOR iidp
+ = (PIMAGE_IMPORT_DESCRIPTOR)RvaToVa(pbBase, rvaImageDirectory);
+
+ if (iidp == NULL) {
+ return FALSE;
+ }
+
+ DWORD nFiles = 0;
+ for (; iidp[nFiles].Characteristics != 0; nFiles++) {
+ // Count the files.
+ }
+
+ for (DWORD n = 0; n < nFiles; n++, iidp++) {
+ DWORD rvaName = iidp->Name;
+ PCHAR pszName = (PCHAR)RvaToVa(pbBase, rvaName);
+
+ DWORD rvaThunk = (DWORD)iidp->OriginalFirstThunk;
+ PIMAGE_THUNK_DATA pThunk = (PIMAGE_THUNK_DATA)RvaToVa(pbBase, rvaThunk);
+ rvaThunk = (DWORD)iidp->FirstThunk;
+ PIMAGE_THUNK_DATA pBoundThunk = (PIMAGE_THUNK_DATA)RvaToVa(pbBase, rvaThunk);
+
+ Syelog(SYELOG_SEVERITY_INFORMATION,
+ "%s [%p %p]\n", pszName, pThunk, pBoundThunk);
+
+ DWORD nNames = 0;
+ if (pThunk == NULL) {
+ break;
+ }
+
+ for (; pThunk[nNames].u1.Ordinal; nNames++) {
+ // Count the imports.
+ }
+
+ for (DWORD f = 0; f < nNames; f++) {
+ DWORD nOrdinal = 0;
+ PCHAR pszName = NULL;
+ PDWORD pFunc = (PDWORD)pBoundThunk[f].u1.Function;
+ DWORD rvaName = (DWORD)pThunk[f].u1.Ordinal;
+
+ if (rvaName & IMAGE_ORDINAL_FLAG) {
+ nOrdinal = IMAGE_ORDINAL(rvaName);
+ }
+ else {
+ PIMAGE_IMPORT_BY_NAME pName
+ = (PIMAGE_IMPORT_BY_NAME)RvaToVa(pbBase, rvaName);
+ if (pName) {
+ pszName = (PCHAR)pName->Name;
+ }
+ }
+ Syelog(SYELOG_SEVERITY_INFORMATION,
+ " %-32.32s %4I64d %p\n", pszName, nOrdinal, pFunc);
+ }
+ }
+ return TRUE;
+}
+
+#if _MSC_VER >= 1900
+#pragma warning(pop)
+#endif
+
+BOOL InstanceEnumerate(HINSTANCE hInst)
+{
+ WCHAR wzDllName[MAX_PATH];
+
+ PIMAGE_NT_HEADERS pinh = NtHeadersForInstance(hInst);
+ if (pinh && Real_GetModuleFileNameW(hInst, wzDllName, ARRAYSIZE(wzDllName))) {
+ Syelog(SYELOG_SEVERITY_INFORMATION,
+ "### %08lx: %-43.43ls %08x\n",
+ hInst, wzDllName, pinh->OptionalHeader.CheckSum);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+BOOL ProcessEnumerate()
+{
+ Syelog(SYELOG_SEVERITY_INFORMATION,
+ "######################################################### Binaries\n");
+ for (HINSTANCE hInst = NULL; (hInst = DetourEnumerateModules(hInst)) != NULL;) {
+ InstanceEnumerate(hInst);
+ }
+ Syelog(SYELOG_SEVERITY_INFORMATION, "###\n");
+
+ return ImportEnumerate(GetModuleHandle(NULL));
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// DLL module information
+//
+BOOL ThreadAttach(HMODULE hDll)
+{
+ (void)hDll;
+
+ if (s_nTlsIndent >= 0) {
+ TlsSetValue(s_nTlsIndent, (PVOID)0);
+ }
+ if (s_nTlsThread >= 0) {
+ LONG nThread = InterlockedIncrement(&s_nThreadCnt);
+ TlsSetValue(s_nTlsThread, (PVOID)(LONG_PTR)nThread);
+ }
+ return TRUE;
+}
+
+BOOL ThreadDetach(HMODULE hDll)
+{
+ (void)hDll;
+
+ if (s_nTlsIndent >= 0) {
+ TlsSetValue(s_nTlsIndent, (PVOID)0);
+ }
+ if (s_nTlsThread >= 0) {
+ TlsSetValue(s_nTlsThread, (PVOID)0);
+ }
+ return TRUE;
+}
+
+BOOL ProcessAttach(HMODULE hDll)
+{
+ s_bLog = FALSE;
+ s_nTlsIndent = TlsAlloc();
+ s_nTlsThread = TlsAlloc();
+ ThreadAttach(hDll);
+
+ WCHAR wzExeName[MAX_PATH];
+
+ s_hInst = hDll;
+ Real_GetModuleFileNameW(hDll, s_wzDllPath, ARRAYSIZE(s_wzDllPath));
+ Real_GetModuleFileNameW(NULL, wzExeName, ARRAYSIZE(wzExeName));
+
+ SyelogOpen("trclnk" DETOURS_STRINGIFY(DETOURS_BITS), SYELOG_FACILITY_APPLICATION);
+ ProcessEnumerate();
+
+ LONG error = AttachDetours();
+ if (error != NO_ERROR) {
+ Syelog(SYELOG_SEVERITY_FATAL, "### Error attaching detours: %d\n", error);
+ }
+
+ s_bLog = TRUE;
+ return TRUE;
+}
+
+BOOL ProcessDetach(HMODULE hDll)
+{
+ ThreadDetach(hDll);
+ s_bLog = FALSE;
+
+ LONG error = DetachDetours();
+ if (error != NO_ERROR) {
+ Syelog(SYELOG_SEVERITY_FATAL, "### Error detaching detours: %d\n", error);
+ }
+
+ Syelog(SYELOG_SEVERITY_NOTICE, "### Closing.\n");
+ SyelogClose(FALSE);
+
+ if (s_nTlsIndent >= 0) {
+ TlsFree(s_nTlsIndent);
+ }
+ if (s_nTlsThread >= 0) {
+ TlsFree(s_nTlsThread);
+ }
+ return TRUE;
+}
+
+BOOL APIENTRY DllMain(HINSTANCE hModule, DWORD dwReason, PVOID lpReserved)
+{
+ (void)hModule;
+ (void)lpReserved;
+
+ if (DetourIsHelperProcess()) {
+ return TRUE;
+ }
+
+ switch (dwReason) {
+ case DLL_PROCESS_ATTACH:
+ DetourRestoreAfterWith();
+ return ProcessAttach(hModule);
+ case DLL_PROCESS_DETACH:
+ return ProcessDetach(hModule);
+ case DLL_THREAD_ATTACH:
+ return ThreadAttach(hModule);
+ case DLL_THREAD_DETACH:
+ return ThreadDetach(hModule);
+ }
+ return TRUE;
+}
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/tracelnk/trclnk.rc b/ext/detours/samples/tracelnk/trclnk.rc
new file mode 100644
index 0000000..75e08e9
--- /dev/null
+++ b/ext/detours/samples/tracelnk/trclnk.rc
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Version information for trclnk.rc.
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include "detver.h"
+
+#define VER_INTERNALNAME_STR "trclnk" DETOURS_STRINGIFY(DETOURS_BITS)
+#define VER_ORIGINALFILENAME_STR "trclnk" DETOURS_STRINGIFY(DETOURS_BITS) ".dll"
+#define VER_FILEDESCRIPTION_STR "Detours Dynamic Linking Trace Module"
+#define VER_COMPANYNAME_STR "Microsoft Corporation"
+
+#include "common.ver"
diff --git a/ext/detours/samples/tracemem/Makefile b/ext/detours/samples/tracemem/Makefile
new file mode 100644
index 0000000..fbd6c8d
--- /dev/null
+++ b/ext/detours/samples/tracemem/Makefile
@@ -0,0 +1,82 @@
+##############################################################################
+##
+## Utility to trace HeapAlloc APIs.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+LIBS=$(LIBS) kernel32.lib
+
+all: dirs \
+ $(BIND)\trcmem$(DETOURS_BITS).dll \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\trcmem$(DETOURS_BITS).bsc \
+!ENDIF
+ option
+
+clean:
+ -del *~ test.txt 2>nul
+ -del $(BIND)\trcmem*.* 2>nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+##############################################################################
+
+$(OBJD)\trcmem.obj : trcmem.cpp
+
+$(OBJD)\trcmem.res : trcmem.rc
+
+$(BIND)\trcmem$(DETOURS_BITS).dll : $(OBJD)\trcmem.obj $(OBJD)\trcmem.res $(DEPS)
+ cl /LD $(CFLAGS) /Fe$@ /Fd$(@R).pdb \
+ $(OBJD)\trcmem.obj $(OBJD)\trcmem.res \
+ /link $(LINKFLAGS) /subsystem:console \
+ /export:DetourFinishHelperProcess,@1,NONAME \
+ $(LIBS)
+
+$(OBJD)\trcmem$(DETOURS_BITS).bsc : $(OBJD)\trcmem.obj
+ bscmake /v /n /o $@ $(OBJD)\trcmem.sbr
+
+############################################### Install non-bit-size binaries.
+
+!IF "$(DETOURS_OPTION_PROCESSOR)" != ""
+
+$(OPTD)\trcmem$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\trcmem$(DETOURS_OPTION_BITS).pdb:
+
+$(BIND)\trcmem$(DETOURS_OPTION_BITS).dll : $(OPTD)\trcmem$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\trcmem$(DETOURS_OPTION_BITS).pdb : $(OPTD)\trcmem$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+
+option: \
+ $(BIND)\trcmem$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\trcmem$(DETOURS_OPTION_BITS).pdb \
+
+!ELSE
+
+option:
+
+!ENDIF
+
+##############################################################################
+
+test: all
+ @echo -------- Logging output to test.txt ------------
+ start $(BIND)\syelogd.exe /o test.txt
+ $(BIND)\sleep5.exe 1
+ @echo -------- Should load trcmem$(DETOURS_BITS).dll dynamically using withdll.exe ------------
+ $(BIND)\withdll -d:$(BIND)\trcmem$(DETOURS_BITS).dll $(BIND)\sleepold.exe
+ @echo -------- Log from syelog -------------
+ type test.txt
+
+################################################################# End of File.
diff --git a/ext/detours/samples/tracemem/trcmem.cpp b/ext/detours/samples/tracemem/trcmem.cpp
new file mode 100644
index 0000000..85f72b9
--- /dev/null
+++ b/ext/detours/samples/tracemem/trcmem.cpp
@@ -0,0 +1,521 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (trcmem.cpp of trcmem.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#define _WIN32_WINNT 0x0400
+#define WIN32
+#define NT
+
+#define DBG_TRACE 0
+
+#include <windows.h>
+#include <stdio.h>
+#include "detours.h"
+#include "syelog.h"
+
+#define PULONG_PTR PVOID
+#define PLONG_PTR PVOID
+#define ULONG_PTR PVOID
+#define ENUMRESNAMEPROCA PVOID
+#define ENUMRESNAMEPROCW PVOID
+#define ENUMRESLANGPROCA PVOID
+#define ENUMRESLANGPROCW PVOID
+#define ENUMRESTYPEPROCA PVOID
+#define ENUMRESTYPEPROCW PVOID
+#define STGOPTIONS PVOID
+
+//////////////////////////////////////////////////////////////////////////////
+
+#pragma warning(disable:4127) // Many of our asserts are constants.
+
+#define ASSERT_ALWAYS(x) \
+ do { \
+ if (!(x)) { \
+ AssertMessage(#x, __FILE__, __LINE__); \
+ DebugBreak(); \
+ } \
+ } while (0)
+
+#ifndef NDEBUG
+#define ASSERT(x) ASSERT_ALWAYS(x)
+#else
+#define ASSERT(x)
+#endif
+
+#define UNUSED(c) (c) = (c)
+
+//////////////////////////////////////////////////////////////////////////////
+static HMODULE s_hInst = NULL;
+static CHAR s_szDllPath[MAX_PATH];
+
+VOID _PrintEnter(const CHAR *psz, ...);
+VOID _PrintExit(const CHAR *psz, ...);
+VOID _Print(const CHAR *psz, ...);
+VOID _VPrint(PCSTR msg, va_list args, PCHAR pszBuf, LONG cbBuf);
+
+VOID AssertMessage(CONST PCHAR pszMsg, CONST PCHAR pszFile, ULONG nLine);
+
+//////////////////////////////////////////////////////////////////////////////
+// Trampolines
+//
+extern "C" {
+
+ HANDLE (WINAPI *
+ Real_CreateFileW)(LPCWSTR a0,
+ DWORD a1,
+ DWORD a2,
+ LPSECURITY_ATTRIBUTES a3,
+ DWORD a4,
+ DWORD a5,
+ HANDLE a6)
+ = CreateFileW;
+
+ BOOL (WINAPI *
+ Real_WriteFile)(HANDLE hFile,
+ LPCVOID lpBuffer,
+ DWORD nNumberOfBytesToWrite,
+ LPDWORD lpNumberOfBytesWritten,
+ LPOVERLAPPED lpOverlapped)
+ = WriteFile;
+ BOOL (WINAPI *
+ Real_FlushFileBuffers)(HANDLE hFile)
+ = FlushFileBuffers;
+ BOOL (WINAPI *
+ Real_CloseHandle)(HANDLE hObject)
+ = CloseHandle;
+
+ BOOL (WINAPI *
+ Real_WaitNamedPipeW)(LPCWSTR lpNamedPipeName, DWORD nTimeOut)
+ = WaitNamedPipeW;
+ BOOL (WINAPI *
+ Real_SetNamedPipeHandleState)(HANDLE hNamedPipe,
+ LPDWORD lpMode,
+ LPDWORD lpMaxCollectionCount,
+ LPDWORD lpCollectDataTimeout)
+ = SetNamedPipeHandleState;
+
+ DWORD (WINAPI *
+ Real_GetCurrentProcessId)(VOID)
+ = GetCurrentProcessId;
+ VOID (WINAPI *
+ Real_GetSystemTimeAsFileTime)(LPFILETIME lpSystemTimeAsFileTime)
+ = GetSystemTimeAsFileTime;
+
+ VOID (WINAPI *
+ Real_InitializeCriticalSection)(LPCRITICAL_SECTION lpSection)
+ = InitializeCriticalSection;
+ VOID (WINAPI *
+ Real_EnterCriticalSection)(LPCRITICAL_SECTION lpSection)
+ = EnterCriticalSection;
+ VOID (WINAPI *
+ Real_LeaveCriticalSection)(LPCRITICAL_SECTION lpSection)
+ = LeaveCriticalSection;
+}
+
+#if _MSC_VER < 1300
+LPVOID (WINAPI *
+ Real_HeapAlloc)(HANDLE hHeap, DWORD dwFlags, DWORD dwBytes)
+ = HeapAlloc;
+#else
+LPVOID (WINAPI *
+ Real_HeapAlloc)(HANDLE hHeap, DWORD dwFlags, DWORD_PTR dwBytes)
+ = HeapAlloc;
+#endif
+
+DWORD (WINAPI * Real_GetModuleFileNameW)(HMODULE a0,
+ LPWSTR a1,
+ DWORD a2)
+ = GetModuleFileNameW;
+
+DWORD (WINAPI * Real_GetModuleFileNameA)(HMODULE a0,
+ LPSTR a1,
+ DWORD a2)
+ = GetModuleFileNameA;
+
+BOOL (WINAPI * Real_CreateProcessW)(LPCWSTR a0,
+ LPWSTR a1,
+ LPSECURITY_ATTRIBUTES a2,
+ LPSECURITY_ATTRIBUTES a3,
+ BOOL a4,
+ DWORD a5,
+ LPVOID a6,
+ LPCWSTR a7,
+ struct _STARTUPINFOW* a8,
+ LPPROCESS_INFORMATION a9)
+ = CreateProcessW;
+
+//////////////////////////////////////////////////////////////////////////////
+// Detours
+//
+#if _MSC_VER < 1300
+LPVOID WINAPI Mine_HeapAlloc(HANDLE hHeap, DWORD dwFlags, DWORD dwBytes)
+#else
+LPVOID WINAPI Mine_HeapAlloc(HANDLE hHeap, DWORD dwFlags, DWORD_PTR dwBytes)
+#endif
+{
+ _PrintEnter("HeapAlloc(%p, %x, %p))\n", hHeap, dwFlags, dwBytes);
+
+ LPVOID rv = 0;
+ __try {
+ rv = Real_HeapAlloc(hHeap, dwFlags, dwBytes);
+ } __finally {
+ _PrintExit("HeapAlloc() -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_CreateProcessW(LPCWSTR lpApplicationName,
+ LPWSTR lpCommandLine,
+ LPSECURITY_ATTRIBUTES lpProcessAttributes,
+ LPSECURITY_ATTRIBUTES lpThreadAttributes,
+ BOOL bInheritHandles,
+ DWORD dwCreationFlags,
+ LPVOID lpEnvironment,
+ LPCWSTR lpCurrentDirectory,
+ LPSTARTUPINFOW lpStartupInfo,
+ LPPROCESS_INFORMATION lpProcessInformation)
+{
+ _PrintEnter("CreateProcessW(%ls,%ls,%p,%p,%x,%x,%p,%ls,%p,%p)\n",
+ lpApplicationName,
+ lpCommandLine,
+ lpProcessAttributes,
+ lpThreadAttributes,
+ bInheritHandles,
+ dwCreationFlags,
+ lpEnvironment,
+ lpCurrentDirectory,
+ lpStartupInfo,
+ lpProcessInformation);
+
+ _Print("Calling DetourCreateProcessWithDllExW(,%hs)\n", s_szDllPath);
+
+ BOOL rv = 0;
+ __try {
+ rv = DetourCreateProcessWithDllExW(lpApplicationName,
+ lpCommandLine,
+ lpProcessAttributes,
+ lpThreadAttributes,
+ bInheritHandles,
+ dwCreationFlags,
+ lpEnvironment,
+ lpCurrentDirectory,
+ lpStartupInfo,
+ lpProcessInformation,
+ s_szDllPath,
+ Real_CreateProcessW);
+ } __finally {
+ _PrintExit("CreateProcessW(,,,,,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// AttachDetours
+//
+PCHAR DetRealName(PCHAR psz)
+{
+ PCHAR pszBeg = psz;
+ // Move to end of name.
+ while (*psz) {
+ psz++;
+ }
+ // Move back through A-Za-z0-9 names.
+ while (psz > pszBeg &&
+ ((psz[-1] >= 'A' && psz[-1] <= 'Z') ||
+ (psz[-1] >= 'a' && psz[-1] <= 'z') ||
+ (psz[-1] >= '0' && psz[-1] <= '9'))) {
+ psz--;
+ }
+ return psz;
+}
+
+VOID DetAttach(PVOID *ppbReal, PVOID pbMine, PCHAR psz)
+{
+ LONG l = DetourAttach(ppbReal, pbMine);
+ if (l != 0) {
+ Syelog(SYELOG_SEVERITY_NOTICE,
+ "Attach failed: `%s': error %d\n", DetRealName(psz), l);
+ }
+}
+
+VOID DetDetach(PVOID *ppbReal, PVOID pbMine, PCHAR psz)
+{
+ LONG l = DetourDetach(ppbReal, pbMine);
+ if (l != 0) {
+ Syelog(SYELOG_SEVERITY_NOTICE,
+ "Detach failed: `%s': error %d\n", DetRealName(psz), l);
+ }
+}
+
+#define ATTACH(x) DetAttach(&(PVOID&)Real_##x,Mine_##x,#x)
+#define DETACH(x) DetDetach(&(PVOID&)Real_##x,Mine_##x,#x)
+
+LONG AttachDetours(VOID)
+{
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+
+ ATTACH(CreateProcessW);
+ ATTACH(HeapAlloc);
+
+ return DetourTransactionCommit();
+}
+
+LONG DetachDetours(VOID)
+{
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+
+ DETACH(CreateProcessW);
+ DETACH(HeapAlloc);
+
+ return DetourTransactionCommit();
+}
+
+////////////////////////////////////////////////////////////// Logging System.
+//
+static BOOL s_bLog = FALSE;
+static LONG s_nTlsIndent = -1;
+static LONG s_nTlsThread = -1;
+static LONG s_nThreadCnt = 0;
+
+VOID _PrintEnter(const CHAR *psz, ...)
+{
+ DWORD dwErr = GetLastError();
+
+ LONG nIndent = 0;
+ LONG nThread = 0;
+ if (s_nTlsIndent >= 0) {
+ nIndent = (LONG)(LONG_PTR)TlsGetValue(s_nTlsIndent);
+ TlsSetValue(s_nTlsIndent, (PVOID)(LONG_PTR)(nIndent + 1));
+ }
+ if (s_nTlsThread >= 0) {
+ nThread = (LONG)(LONG_PTR)TlsGetValue(s_nTlsThread);
+ }
+
+ if (s_bLog && psz) {
+ CHAR szBuf[1024];
+ PCHAR pszBuf = szBuf;
+ PCHAR pszEnd = szBuf + ARRAYSIZE(szBuf) - 1;
+ LONG nLen = (nIndent > 0) ? (nIndent < 35 ? nIndent * 2 : 70) : 0;
+ *pszBuf++ = (CHAR)('0' + ((nThread / 100) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 10) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 1) % 10));
+ *pszBuf++ = ' ';
+ while (nLen-- > 0) {
+ *pszBuf++ = ' ';
+ }
+
+ va_list args;
+ va_start(args, psz);
+
+ while ((*pszBuf++ = *psz++) != 0 && pszBuf < pszEnd) {
+ // Copy characters.
+ }
+ *pszEnd = '\0';
+ SyelogV(SYELOG_SEVERITY_INFORMATION, szBuf, args);
+
+ va_end(args);
+ }
+ SetLastError(dwErr);
+}
+
+VOID _PrintExit(const CHAR *psz, ...)
+{
+ DWORD dwErr = GetLastError();
+
+ LONG nIndent = 0;
+ LONG nThread = 0;
+ if (s_nTlsIndent >= 0) {
+ nIndent = (LONG)(LONG_PTR)TlsGetValue(s_nTlsIndent) - 1;
+ ASSERT(nIndent >= 0);
+ TlsSetValue(s_nTlsIndent, (PVOID)(LONG_PTR)nIndent);
+ }
+ if (s_nTlsThread >= 0) {
+ nThread = (LONG)(LONG_PTR)TlsGetValue(s_nTlsThread);
+ }
+
+ if (s_bLog && psz) {
+ CHAR szBuf[1024];
+ PCHAR pszBuf = szBuf;
+ PCHAR pszEnd = szBuf + ARRAYSIZE(szBuf) - 1;
+ LONG nLen = (nIndent > 0) ? (nIndent < 35 ? nIndent * 2 : 70) : 0;
+ *pszBuf++ = (CHAR)('0' + ((nThread / 100) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 10) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 1) % 10));
+ *pszBuf++ = ' ';
+ while (nLen-- > 0) {
+ *pszBuf++ = ' ';
+ }
+
+ va_list args;
+ va_start(args, psz);
+
+ while ((*pszBuf++ = *psz++) != 0 && pszBuf < pszEnd) {
+ // Copy characters.
+ }
+ *pszEnd = '\0';
+ SyelogV(SYELOG_SEVERITY_INFORMATION,
+ szBuf, args);
+
+ va_end(args);
+ }
+ SetLastError(dwErr);
+}
+
+VOID _Print(const CHAR *psz, ...)
+{
+ DWORD dwErr = GetLastError();
+
+ LONG nIndent = 0;
+ LONG nThread = 0;
+ if (s_nTlsIndent >= 0) {
+ nIndent = (LONG)(LONG_PTR)TlsGetValue(s_nTlsIndent);
+ }
+ if (s_nTlsThread >= 0) {
+ nThread = (LONG)(LONG_PTR)TlsGetValue(s_nTlsThread);
+ }
+
+ if (s_bLog && psz) {
+ CHAR szBuf[1024];
+ PCHAR pszBuf = szBuf;
+ PCHAR pszEnd = szBuf + ARRAYSIZE(szBuf) - 1;
+ LONG nLen = (nIndent > 0) ? (nIndent < 35 ? nIndent * 2 : 70) : 0;
+ *pszBuf++ = (CHAR)('0' + ((nThread / 100) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 10) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 1) % 10));
+ *pszBuf++ = ' ';
+ while (nLen-- > 0) {
+ *pszBuf++ = ' ';
+ }
+
+ va_list args;
+ va_start(args, psz);
+
+ while ((*pszBuf++ = *psz++) != 0 && pszBuf < pszEnd) {
+ // Copy characters.
+ }
+ *pszEnd = '\0';
+ SyelogV(SYELOG_SEVERITY_INFORMATION,
+ szBuf, args);
+
+ va_end(args);
+ }
+
+ SetLastError(dwErr);
+}
+
+VOID AssertMessage(CONST PCHAR pszMsg, CONST PCHAR pszFile, ULONG nLine)
+{
+ Syelog(SYELOG_SEVERITY_FATAL,
+ "ASSERT(%s) failed in %s, line %d.\n", pszMsg, pszFile, nLine);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// DLL module information
+//
+BOOL ThreadAttach(HMODULE hDll)
+{
+ (void)hDll;
+
+ if (s_nTlsIndent >= 0) {
+ TlsSetValue(s_nTlsIndent, (PVOID)0);
+ }
+ if (s_nTlsThread >= 0) {
+ LONG nThread = InterlockedIncrement(&s_nThreadCnt);
+ TlsSetValue(s_nTlsThread, (PVOID)(LONG_PTR)nThread);
+ }
+ return TRUE;
+}
+
+BOOL ThreadDetach(HMODULE hDll)
+{
+ (void)hDll;
+
+ if (s_nTlsIndent >= 0) {
+ TlsSetValue(s_nTlsIndent, (PVOID)0);
+ }
+ if (s_nTlsThread >= 0) {
+ TlsSetValue(s_nTlsThread, (PVOID)0);
+ }
+ return TRUE;
+}
+
+BOOL ProcessAttach(HMODULE hDll)
+{
+ s_bLog = FALSE;
+ s_nTlsIndent = TlsAlloc();
+ s_nTlsThread = TlsAlloc();
+
+ WCHAR wzExePath[MAX_PATH];
+
+ s_hInst = hDll;
+ Real_GetModuleFileNameA(s_hInst, s_szDllPath, ARRAYSIZE(s_szDllPath));
+ Real_GetModuleFileNameW(NULL, wzExePath, ARRAYSIZE(wzExePath));
+
+ SyelogOpen("trcmem" DETOURS_STRINGIFY(DETOURS_BITS), SYELOG_FACILITY_APPLICATION);
+ Syelog(SYELOG_SEVERITY_INFORMATION, "##########################################\n");
+ Syelog(SYELOG_SEVERITY_INFORMATION, "### %ls\n", wzExePath);
+
+ LONG error = AttachDetours();
+ if (error != NO_ERROR) {
+ Syelog(SYELOG_SEVERITY_FATAL, "### Error attaching detours: %d\n", error);
+ }
+
+ ThreadAttach(hDll);
+
+ s_bLog = TRUE;
+ return TRUE;
+}
+
+BOOL ProcessDetach(HMODULE hDll)
+{
+ ThreadDetach(hDll);
+ s_bLog = FALSE;
+
+ LONG error = DetachDetours();
+ if (error != NO_ERROR) {
+ Syelog(SYELOG_SEVERITY_FATAL, "### Error detaching detours: %d\n", error);
+ }
+
+ Syelog(SYELOG_SEVERITY_NOTICE, "### Closing.\n");
+ SyelogClose(FALSE);
+
+ if (s_nTlsIndent >= 0) {
+ TlsFree(s_nTlsIndent);
+ }
+ if (s_nTlsThread >= 0) {
+ TlsFree(s_nTlsThread);
+ }
+ return TRUE;
+}
+
+BOOL APIENTRY DllMain(HINSTANCE hModule, DWORD dwReason, PVOID lpReserved)
+{
+ (void)hModule;
+ (void)lpReserved;
+
+ if (DetourIsHelperProcess()) {
+ return TRUE;
+ }
+
+ switch (dwReason) {
+ case DLL_PROCESS_ATTACH:
+ DetourRestoreAfterWith();
+ return ProcessAttach(hModule);
+ case DLL_PROCESS_DETACH:
+ return ProcessDetach(hModule);
+ case DLL_THREAD_ATTACH:
+ return ThreadAttach(hModule);
+ case DLL_THREAD_DETACH:
+ return ThreadDetach(hModule);
+ }
+ return TRUE;
+}
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/tracemem/trcmem.rc b/ext/detours/samples/tracemem/trcmem.rc
new file mode 100644
index 0000000..5e911d6
--- /dev/null
+++ b/ext/detours/samples/tracemem/trcmem.rc
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Version information for trcmem.rc.
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include "detver.h"
+
+#define VER_INTERNALNAME_STR "trcmem" DETOURS_STRINGIFY(DETOURS_BITS)
+#define VER_ORIGINALFILENAME_STR "trcmem" DETOURS_STRINGIFY(DETOURS_BITS) ".dll"
+#define VER_FILEDESCRIPTION_STR "Detours Memory Trace Module"
+#define VER_COMPANYNAME_STR "Microsoft Corporation"
+
+#include "common.ver"
diff --git a/ext/detours/samples/tracereg/Makefile b/ext/detours/samples/tracereg/Makefile
new file mode 100644
index 0000000..459747f
--- /dev/null
+++ b/ext/detours/samples/tracereg/Makefile
@@ -0,0 +1,82 @@
+##############################################################################
+##
+## Utility to registry and file access APIs.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+LIBS=$(LIBS) kernel32.lib advapi32.lib
+
+all: dirs \
+ $(BIND)\trcreg$(DETOURS_BITS).dll \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\trcreg$(DETOURS_BITS).bsc \
+!ENDIF
+ option
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+clean:
+ -del *~ test.txt 2>nul
+ -del $(BIND)\trcreg*.* 2>nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+##############################################################################
+
+$(OBJD)\trcreg.obj : trcreg.cpp
+
+$(OBJD)\trcreg.res : trcreg.rc
+
+$(BIND)\trcreg$(DETOURS_BITS).dll : $(OBJD)\trcreg.obj $(OBJD)\trcreg.res $(DEPS)
+ cl /LD $(CFLAGS) /Fe$@ /Fd$(@R).pdb \
+ $(OBJD)\trcreg.obj $(OBJD)\trcreg.res \
+ /link $(LINKFLAGS) /subsystem:console \
+ /export:DetourFinishHelperProcess,@1,NONAME \
+ $(LIBS)
+
+$(OBJD)\trcreg$(DETOURS_BITS).bsc : $(OBJD)\trcreg.obj
+ bscmake /v /n /o $@ $(OBJD)\trcreg.sbr
+
+############################################### Install non-bit-size binaries.
+
+!IF "$(DETOURS_OPTION_PROCESSOR)" != ""
+
+$(OPTD)\trcreg$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\trcreg$(DETOURS_OPTION_BITS).pdb:
+
+$(BIND)\trcreg$(DETOURS_OPTION_BITS).dll : $(OPTD)\trcreg$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\trcreg$(DETOURS_OPTION_BITS).pdb : $(OPTD)\trcreg$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+
+option: \
+ $(BIND)\trcreg$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\trcreg$(DETOURS_OPTION_BITS).pdb \
+
+!ELSE
+
+option:
+
+!ENDIF
+
+##############################################################################
+
+test: all
+ @echo -------- Logging output to test.txt ------------
+ start $(BIND)\syelogd.exe /o test.txt
+ $(BIND)\sleep5.exe 1
+ @echo -------- Should load trcreg$(DETOURS_BITS).dll dynamically using withdll.exe ------------
+ $(BIND)\withdll -d:$(BIND)\trcreg$(DETOURS_BITS).dll $(BIND)\sleepold.exe
+ @echo -------- Log from syelog -------------
+ type test.txt
+
+################################################################# End of File.
diff --git a/ext/detours/samples/tracereg/trcreg.cpp b/ext/detours/samples/tracereg/trcreg.cpp
new file mode 100644
index 0000000..7e1b780
--- /dev/null
+++ b/ext/detours/samples/tracereg/trcreg.cpp
@@ -0,0 +1,1577 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (trcreg.cpp of trcreg.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#define _WIN32_WINNT 0x0400
+#define WIN32
+#define NT
+
+#define DBG_TRACE 0
+
+#include <windows.h>
+#include <stdio.h>
+#include "detours.h"
+#include "syelog.h"
+
+#define PULONG_PTR PVOID
+#define PLONG_PTR PVOID
+#define ULONG_PTR PVOID
+#define ENUMRESNAMEPROCA PVOID
+#define ENUMRESNAMEPROCW PVOID
+#define ENUMRESLANGPROCA PVOID
+#define ENUMRESLANGPROCW PVOID
+#define ENUMRESTYPEPROCA PVOID
+#define ENUMRESTYPEPROCW PVOID
+#define STGOPTIONS PVOID
+
+//////////////////////////////////////////////////////////////////////////////
+#pragma warning(disable:4127) // Many of our asserts are constants.
+
+#define ASSERT_ALWAYS(x) \
+ do { \
+ if (!(x)) { \
+ AssertMessage(#x, __FILE__, __LINE__); \
+ DebugBreak(); \
+ } \
+ } while (0)
+
+#ifndef NDEBUG
+#define ASSERT(x) ASSERT_ALWAYS(x)
+#else
+#define ASSERT(x)
+#endif
+
+#define UNUSED(c) (c) = (c)
+
+//////////////////////////////////////////////////////////////////////////////
+static HMODULE s_hInst = NULL;
+static CHAR s_szDllPath[MAX_PATH];
+
+BOOL ProcessEnumerate();
+BOOL InstanceEnumerate(HINSTANCE hInst);
+
+VOID _PrintEnter(PCSTR psz, ...);
+VOID _PrintExit(PCSTR psz, ...);
+VOID _Print(PCSTR psz, ...);
+
+VOID AssertMessage(CONST PCHAR pszMsg, CONST PCHAR pszFile, ULONG nLine);
+
+//////////////////////////////////////////////////////////////////////////////
+//
+extern "C" {
+ HANDLE (WINAPI *
+ Real_CreateFileW)(LPCWSTR a0,
+ DWORD a1,
+ DWORD a2,
+ LPSECURITY_ATTRIBUTES a3,
+ DWORD a4,
+ DWORD a5,
+ HANDLE a6)
+ = CreateFileW;
+
+ BOOL (WINAPI *
+ Real_WriteFile)(HANDLE hFile,
+ LPCVOID lpBuffer,
+ DWORD nNumberOfBytesToWrite,
+ LPDWORD lpNumberOfBytesWritten,
+ LPOVERLAPPED lpOverlapped)
+ = WriteFile;
+ BOOL (WINAPI *
+ Real_FlushFileBuffers)(HANDLE hFile)
+ = FlushFileBuffers;
+ BOOL (WINAPI *
+ Real_CloseHandle)(HANDLE hObject)
+ = CloseHandle;
+
+ BOOL (WINAPI *
+ Real_WaitNamedPipeW)(LPCWSTR lpNamedPipeName, DWORD nTimeOut)
+ = WaitNamedPipeW;
+ BOOL (WINAPI *
+ Real_SetNamedPipeHandleState)(HANDLE hNamedPipe,
+ LPDWORD lpMode,
+ LPDWORD lpMaxCollectionCount,
+ LPDWORD lpCollectDataTimeout)
+ = SetNamedPipeHandleState;
+
+ DWORD (WINAPI *
+ Real_GetCurrentProcessId)(VOID)
+ = GetCurrentProcessId;
+ VOID (WINAPI *
+ Real_GetSystemTimeAsFileTime)(LPFILETIME lpSystemTimeAsFileTime)
+ = GetSystemTimeAsFileTime;
+
+ VOID (WINAPI *
+ Real_InitializeCriticalSection)(LPCRITICAL_SECTION lpSection)
+ = InitializeCriticalSection;
+ VOID (WINAPI *
+ Real_EnterCriticalSection)(LPCRITICAL_SECTION lpSection)
+ = EnterCriticalSection;
+ VOID (WINAPI *
+ Real_LeaveCriticalSection)(LPCRITICAL_SECTION lpSection)
+ = LeaveCriticalSection;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+
+BOOL (WINAPI * Real_CopyFileExA)(LPCSTR a0,
+ LPCSTR a1,
+ LPPROGRESS_ROUTINE a2,
+ LPVOID a3,
+ LPBOOL a4,
+ DWORD a5)
+ = CopyFileExA;
+
+BOOL (WINAPI * Real_CopyFileExW)(LPCWSTR a0,
+ LPCWSTR a1,
+ LPPROGRESS_ROUTINE a2,
+ LPVOID a3,
+ LPBOOL a4,
+ DWORD a5)
+ = CopyFileExW;
+
+BOOL (WINAPI * Real_CreateDirectoryExW)(LPCWSTR a0,
+ LPCWSTR a1,
+ LPSECURITY_ATTRIBUTES a2)
+ = CreateDirectoryExW;
+
+BOOL (WINAPI * Real_CreateDirectoryW)(LPCWSTR a0,
+ LPSECURITY_ATTRIBUTES a1)
+ = CreateDirectoryW;
+
+BOOL (WINAPI * Real_CreateProcessW)(LPCWSTR lpApplicationName,
+ LPWSTR lpCommandLine,
+ LPSECURITY_ATTRIBUTES lpProcessAttributes,
+ LPSECURITY_ATTRIBUTES lpThreadAttributes,
+ BOOL bInheritHandles,
+ DWORD dwCreationFlags,
+ LPVOID lpEnvironment,
+ LPCWSTR lpCurrentDirectory,
+ LPSTARTUPINFOW lpStartupInfo,
+ LPPROCESS_INFORMATION lpProcessInformation)
+ = CreateProcessW;
+
+BOOL (WINAPI * Real_DeleteFileA)(LPCSTR a0)
+ = DeleteFileA;
+
+BOOL (WINAPI * Real_DeleteFileW)(LPCWSTR a0)
+ = DeleteFileW;
+
+HANDLE (WINAPI * Real_FindFirstFileExA)(LPCSTR a0,
+ FINDEX_INFO_LEVELS a1,
+ LPVOID a2,
+ FINDEX_SEARCH_OPS a3,
+ LPVOID a4,
+ DWORD a5)
+ = FindFirstFileExA;
+
+HANDLE (WINAPI * Real_FindFirstFileExW)(LPCWSTR a0,
+ FINDEX_INFO_LEVELS a1,
+ LPVOID a2,
+ FINDEX_SEARCH_OPS a3,
+ LPVOID a4,
+ DWORD a5)
+ = FindFirstFileExW;
+
+DWORD (WINAPI * Real_GetFileAttributesW)(LPCWSTR a0)
+ = GetFileAttributesW;
+
+DWORD (WINAPI * Real_GetModuleFileNameW)(HMODULE a0,
+ LPWSTR a1,
+ DWORD a2)
+ = GetModuleFileNameW;
+
+DWORD (WINAPI * Real_GetModuleFileNameA)(HMODULE a0,
+ LPSTR a1,
+ DWORD a2)
+ = GetModuleFileNameA;
+
+FARPROC (WINAPI * Real_GetProcAddress)(struct HINSTANCE__* a0,
+ LPCSTR a1)
+ = GetProcAddress;
+
+HMODULE (WINAPI * Real_LoadLibraryExW)(LPCWSTR a0,
+ HANDLE a1,
+ DWORD a2)
+ = LoadLibraryExW;
+
+BOOL (WINAPI * Real_MoveFileA)(LPCSTR a0,
+ LPCSTR a1)
+ = MoveFileA;
+
+BOOL (WINAPI * Real_MoveFileExA)(LPCSTR a0,
+ LPCSTR a1,
+ DWORD a2)
+ = MoveFileExA;
+
+BOOL (WINAPI * Real_MoveFileExW)(LPCWSTR a0,
+ LPCWSTR a1,
+ DWORD a2)
+ = MoveFileExW;
+
+BOOL (WINAPI * Real_MoveFileW)(LPCWSTR a0,
+ LPCWSTR a1)
+ = MoveFileW;
+
+HFILE (WINAPI * Real_OpenFile)(LPCSTR a0,
+ struct _OFSTRUCT* a1,
+ UINT a2)
+ = OpenFile;
+
+LONG (WINAPI * Real_RegCreateKeyExA)(HKEY a0,
+ LPCSTR a1,
+ DWORD a2,
+ LPSTR a3,
+ DWORD a4,
+ REGSAM a5,
+ LPSECURITY_ATTRIBUTES a6,
+ PHKEY a7,
+ LPDWORD a8)
+ = RegCreateKeyExA;
+
+LONG (WINAPI * Real_RegCreateKeyExW)(HKEY a0,
+ LPCWSTR a1,
+ DWORD a2,
+ LPWSTR a3,
+ DWORD a4,
+ REGSAM a5,
+ LPSECURITY_ATTRIBUTES a6,
+ PHKEY a7,
+ LPDWORD a8)
+ = RegCreateKeyExW;
+
+LONG (WINAPI * Real_RegDeleteKeyA)(HKEY a0,
+ LPCSTR a1)
+ = RegDeleteKeyA;
+
+LONG (WINAPI * Real_RegDeleteKeyW)(HKEY a0,
+ LPCWSTR a1)
+ = RegDeleteKeyW;
+
+LONG (WINAPI * Real_RegDeleteValueA)(HKEY a0,
+ LPCSTR a1)
+ = RegDeleteValueA;
+
+
+LONG (WINAPI * Real_RegDeleteValueW)(HKEY a0,
+ LPCWSTR a1)
+ = RegDeleteValueW;
+
+LONG (WINAPI * Real_RegEnumKeyExA)(HKEY a0,
+ DWORD a1,
+ LPSTR a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPSTR a5,
+ LPDWORD a6,
+ struct _FILETIME* a7)
+ = RegEnumKeyExA;
+
+LONG (WINAPI * Real_RegEnumKeyExW)(HKEY a0,
+ DWORD a1,
+ LPWSTR a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPWSTR a5,
+ LPDWORD a6,
+ struct _FILETIME* a7)
+ = RegEnumKeyExW;
+
+LONG (WINAPI * Real_RegEnumValueA)(HKEY a0,
+ DWORD a1,
+ LPSTR a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPDWORD a5,
+ LPBYTE a6,
+ LPDWORD a7)
+ = RegEnumValueA;
+
+LONG (WINAPI * Real_RegEnumValueW)(HKEY a0,
+ DWORD a1,
+ LPWSTR a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPDWORD a5,
+ LPBYTE a6,
+ LPDWORD a7)
+ = RegEnumValueW;
+
+LONG (WINAPI * Real_RegOpenKeyExA)(HKEY a0,
+ LPCSTR a1,
+ DWORD a2,
+ REGSAM a3,
+ PHKEY a4)
+ = RegOpenKeyExA;
+
+LONG (WINAPI * Real_RegOpenKeyExW)(HKEY a0,
+ LPCWSTR a1,
+ DWORD a2,
+ REGSAM a3,
+ PHKEY a4)
+ = RegOpenKeyExW;
+
+LONG (WINAPI * Real_RegQueryInfoKeyA)(HKEY a0,
+ LPSTR a1,
+ LPDWORD a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPDWORD a5,
+ LPDWORD a6,
+ LPDWORD a7,
+ LPDWORD a8,
+ LPDWORD a9,
+ LPDWORD a10,
+ struct _FILETIME* a11)
+ = RegQueryInfoKeyA;
+
+LONG (WINAPI * Real_RegQueryInfoKeyW)(HKEY a0,
+ LPWSTR a1,
+ LPDWORD a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPDWORD a5,
+ LPDWORD a6,
+ LPDWORD a7,
+ LPDWORD a8,
+ LPDWORD a9,
+ LPDWORD a10,
+ struct _FILETIME* a11)
+ = RegQueryInfoKeyW;
+
+LONG (WINAPI * Real_RegQueryValueExA)(HKEY a0,
+ LPCSTR a1,
+ LPDWORD a2,
+ LPDWORD a3,
+ LPBYTE a4,
+ LPDWORD a5)
+ = RegQueryValueExA;
+
+LONG (WINAPI * Real_RegQueryValueExW)(HKEY a0,
+ LPCWSTR a1,
+ LPDWORD a2,
+ LPDWORD a3,
+ LPBYTE a4,
+ LPDWORD a5)
+ = RegQueryValueExW;
+
+LONG (WINAPI * Real_RegSetValueExA)(HKEY a0,
+ LPCSTR a1,
+ DWORD a2,
+ DWORD a3,
+ const BYTE* a4,
+ DWORD a5)
+ = RegSetValueExA;
+
+LONG (WINAPI * Real_RegSetValueExW)(HKEY a0,
+ LPCWSTR a1,
+ DWORD a2,
+ DWORD a3,
+ const BYTE* a4,
+ DWORD a5)
+ = RegSetValueExW;
+
+HFILE (WINAPI * Real__lcreat)(LPCSTR a0,
+ int a1)
+ = _lcreat;
+
+HFILE (WINAPI * Real__lopen)(LPCSTR a0,
+ int a1)
+ = _lopen;
+
+/////////////////////////////////////////////////////////////
+// Detours
+//
+BOOL WINAPI Mine_WaitNamedPipeW(LPCWSTR lpNamedPipeName, DWORD nTimeOut)
+{
+ return Real_WaitNamedPipeW(lpNamedPipeName, nTimeOut);
+}
+
+BOOL WINAPI Mine_CloseHandle(HANDLE hObject)
+{
+ return Real_CloseHandle(hObject);
+}
+
+VOID WINAPI Mine_GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime)
+{
+ Real_GetSystemTimeAsFileTime(lpSystemTimeAsFileTime);
+}
+
+BOOL WINAPI Mine_SetNamedPipeHandleState(HANDLE hNamedPipe,
+ LPDWORD lpMode,
+ LPDWORD lpMaxCollectionCount,
+ LPDWORD lpCollectDataTimeout)
+{
+ return Real_SetNamedPipeHandleState(hNamedPipe,
+ lpMode,
+ lpMaxCollectionCount,
+ lpCollectDataTimeout);
+}
+
+BOOL WINAPI Mine_WriteFile(HANDLE hFile,
+ LPCVOID lpBuffer,
+ DWORD nNumberOfBytesToWrite,
+ LPDWORD lpNumberOfBytesWritten,
+ LPOVERLAPPED lpOverlapped)
+{
+ return Real_WriteFile(hFile,
+ lpBuffer,
+ nNumberOfBytesToWrite,
+ lpNumberOfBytesWritten,
+ lpOverlapped);
+}
+
+BOOL WINAPI Mine_CreateProcessW(LPCWSTR lpApplicationName,
+ LPWSTR lpCommandLine,
+ LPSECURITY_ATTRIBUTES lpProcessAttributes,
+ LPSECURITY_ATTRIBUTES lpThreadAttributes,
+ BOOL bInheritHandles,
+ DWORD dwCreationFlags,
+ LPVOID lpEnvironment,
+ LPCWSTR lpCurrentDirectory,
+ LPSTARTUPINFOW lpStartupInfo,
+ LPPROCESS_INFORMATION lpProcessInformation)
+{
+ _PrintEnter("CreateProcessW(%ls,%ls,%p,%p,%x,%x,%p,%ls,%p,%p)\n",
+ lpApplicationName,
+ lpCommandLine,
+ lpProcessAttributes,
+ lpThreadAttributes,
+ bInheritHandles,
+ dwCreationFlags,
+ lpEnvironment,
+ lpCurrentDirectory,
+ lpStartupInfo,
+ lpProcessInformation);
+
+ _Print("Calling DetourCreateProcessWithDllExW(,%hs)\n", s_szDllPath);
+
+ BOOL rv = 0;
+ __try {
+ rv = DetourCreateProcessWithDllExW(lpApplicationName,
+ lpCommandLine,
+ lpProcessAttributes,
+ lpThreadAttributes,
+ bInheritHandles,
+ dwCreationFlags,
+ lpEnvironment,
+ lpCurrentDirectory,
+ lpStartupInfo,
+ lpProcessInformation,
+ s_szDllPath,
+ Real_CreateProcessW);
+ } __finally {
+ _PrintExit("CreateProcessW(,,,,,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+//
+//////////////////////////////////////////////////////////////////////////////
+
+BOOL WINAPI Mine_CopyFileExA(LPCSTR a0,
+ LPCSTR a1,
+ LPPROGRESS_ROUTINE a2,
+ LPVOID a3,
+ LPBOOL a4,
+ DWORD a5)
+{
+ _PrintEnter("CopyFileExA(%hs,%hs,%p,%p,%p,%x)\n", a0, a1, a2, a3, a4, a5);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CopyFileExA(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("CopyFileExA(,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_CopyFileExW(LPCWSTR a0,
+ LPCWSTR a1,
+ LPPROGRESS_ROUTINE a2,
+ LPVOID a3,
+ LPBOOL a4,
+ DWORD a5)
+{
+ _PrintEnter("CopyFileExW(%ls,%ls,%p,%p,%p,%x)\n", a0, a1, a2, a3, a4, a5);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CopyFileExW(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("CopyFileExW(,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_CreateDirectoryExW(LPCWSTR a0,
+ LPCWSTR a1,
+ LPSECURITY_ATTRIBUTES a2)
+{
+ _PrintEnter("CreateDirectoryExW(%ls,%ls,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CreateDirectoryExW(a0, a1, a2);
+ } __finally {
+ _PrintExit("CreateDirectoryExW(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_CreateDirectoryW(LPCWSTR a0,
+ LPSECURITY_ATTRIBUTES a1)
+{
+ _PrintEnter("CreateDirectoryW(%ls,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CreateDirectoryW(a0, a1);
+ } __finally {
+ _PrintExit("CreateDirectoryW(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HANDLE WINAPI Mine_CreateFileW(LPCWSTR a0,
+ DWORD a1,
+ DWORD a2,
+ LPSECURITY_ATTRIBUTES a3,
+ DWORD a4,
+ DWORD a5,
+ HANDLE a6)
+{
+ _PrintEnter(NULL);
+ HANDLE rv = 0;
+ __try {
+ rv = Real_CreateFileW(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("CreateFileW(%ls,%x,%x,%p,%x,%x,%p) -> %p\n",
+ a0, a1, a2, a3, a4, a5, a6, rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_DeleteFileA(LPCSTR a0)
+{
+ _PrintEnter("DeleteFileA(%hs)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DeleteFileA(a0);
+ } __finally {
+ _PrintExit("DeleteFileA() -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_DeleteFileW(LPCWSTR a0)
+{
+ _PrintEnter("DeleteFileW(%ls)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_DeleteFileW(a0);
+ } __finally {
+ _PrintExit("DeleteFileW() -> %x\n", rv);
+ };
+ return rv;
+}
+
+HANDLE WINAPI Mine_FindFirstFileExA(LPCSTR a0,
+ FINDEX_INFO_LEVELS a1,
+ LPVOID a2,
+ FINDEX_SEARCH_OPS a3,
+ LPVOID a4,
+ DWORD a5)
+{
+ _PrintEnter("FindFirstFileExA(%hs,%p,%p,%x,%p,%x)\n", a0, a1, a2, a3, a4, a5);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_FindFirstFileExA(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("FindFirstFileExA(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE WINAPI Mine_FindFirstFileExW(LPCWSTR a0,
+ FINDEX_INFO_LEVELS a1,
+ LPVOID a2,
+ FINDEX_SEARCH_OPS a3,
+ LPVOID a4,
+ DWORD a5)
+{
+ _PrintEnter(NULL);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_FindFirstFileExW(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("FindFirstFileExW(%ls,%x,%p,%x,%p,%x) -> %p\n",
+ a0, a1, a2, a3, a4, a5, rv);
+ };
+ return rv;
+}
+
+DWORD WINAPI Mine_GetFileAttributesW(LPCWSTR a0)
+{
+ _PrintEnter(NULL);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetFileAttributesW(a0);
+ } __finally {
+ _PrintExit("GetFileAttributesW(%ls) -> %x\n", a0, rv);
+ };
+ return rv;
+}
+
+DWORD WINAPI Mine_GetModuleFileNameW(HMODULE a0, LPWSTR a1, DWORD a2)
+{
+ _PrintEnter("GetModuleFileNameW(%p,%p,%x)\n", a0, a1, a2);
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetModuleFileNameW(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetModuleFileNameW(%p,%p:%ls,%p) -> %p\n", a0, a1, a1, a2, rv);
+ };
+ return rv;
+}
+
+FARPROC WINAPI Mine_GetProcAddress(HINSTANCE a0,
+ LPCSTR a1)
+{
+ WCHAR wzModule[MAX_PATH] = L"";
+ PWCHAR pwzModule = wzModule;
+ if (Real_GetModuleFileNameW(a0, wzModule, ARRAYSIZE(wzModule)) != 0) {
+ if ((pwzModule = wcsrchr(wzModule, '\\')) == NULL) {
+ if ((pwzModule = wcsrchr(wzModule, ':')) == NULL) {
+ pwzModule = wzModule;
+ }
+ else {
+ pwzModule++; // Skip ':'
+ }
+ }
+ else {
+ pwzModule++; // Skip '\\'
+ }
+ }
+ else {
+ wzModule[0] = '\0';
+ }
+
+ _PrintEnter(NULL);
+ FARPROC rv = 0;
+ __try {
+ rv = Real_GetProcAddress(a0, a1);
+ } __finally {
+ if (pwzModule[0] == 0) {
+ _PrintExit("GetProcAddress(%p,%hs) -> %p\n", a0, a1, rv);
+ }
+ else {
+ _PrintExit("GetProcAddress(%p:%ls,%hs) -> %p\n", a0, pwzModule, a1, rv);
+ }
+ };
+ return rv;
+}
+
+HMODULE WINAPI Mine_LoadLibraryExW(LPCWSTR a0,
+ HANDLE a1,
+ DWORD a2)
+{
+ _PrintEnter("LoadLibraryExW(%ls,%p,%x)\n", a0, a1, a2);
+
+ HMODULE rv = 0;
+ __try {
+ rv = Real_LoadLibraryExW(a0, a1, a2);
+ } __finally {
+ _PrintExit("LoadLibraryExW(,,) -> %p\n", rv);
+ if (rv) {
+ InstanceEnumerate(rv);
+ }
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_MoveFileA(LPCSTR a0,
+ LPCSTR a1)
+{
+ _PrintEnter("MoveFileA(%hs,%hs)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_MoveFileA(a0, a1);
+ } __finally {
+ _PrintExit("MoveFileA(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_MoveFileExA(LPCSTR a0,
+ LPCSTR a1,
+ DWORD a2)
+{
+ _PrintEnter("MoveFileExA(%hs,%hs,%x)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_MoveFileExA(a0, a1, a2);
+ } __finally {
+ _PrintExit("MoveFileExA(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_MoveFileExW(LPCWSTR a0,
+ LPCWSTR a1,
+ DWORD a2)
+{
+ _PrintEnter("MoveFileExW(%ls,%ls,%x)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_MoveFileExW(a0, a1, a2);
+ } __finally {
+ _PrintExit("MoveFileExW(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_MoveFileW(LPCWSTR a0,
+ LPCWSTR a1)
+{
+ _PrintEnter("MoveFileW(%ls,%ls)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_MoveFileW(a0, a1);
+ } __finally {
+ _PrintExit("MoveFileW(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HFILE WINAPI Mine_OpenFile(LPCSTR a0,
+ LPOFSTRUCT a1,
+ UINT a2)
+{
+ _PrintEnter("OpenFile(%hs,%p,%x)\n", a0, a1, a2);
+
+ HFILE rv = 0;
+ __try {
+ rv = Real_OpenFile(a0, a1, a2);
+ } __finally {
+ _PrintExit("OpenFile(,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+LONG WINAPI Mine_RegCreateKeyExA(HKEY a0,
+ LPCSTR a1,
+ DWORD a2,
+ LPSTR a3,
+ DWORD a4,
+ REGSAM a5,
+ LPSECURITY_ATTRIBUTES a6,
+ PHKEY a7,
+ LPDWORD a8)
+{
+ _PrintEnter("RegCreateKeyExA(%p,%hs,%x,%hs,%x,%x,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8);
+
+ LONG rv = 0;
+ __try {
+ rv = Real_RegCreateKeyExA(a0, a1, a2, a3, a4, a5, a6, a7, a8);
+ } __finally {
+ _PrintExit("RegCreateKeyExA(,,,,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+LONG WINAPI Mine_RegCreateKeyExW(HKEY a0,
+ LPCWSTR a1,
+ DWORD a2,
+ LPWSTR a3,
+ DWORD a4,
+ REGSAM a5,
+ LPSECURITY_ATTRIBUTES a6,
+ PHKEY a7,
+ LPDWORD a8)
+{
+ _PrintEnter(NULL);
+ LONG rv = 0;
+ __try {
+ rv = Real_RegCreateKeyExW(a0, a1, a2, a3, a4, a5, a6, a7, a8);
+ } __finally {
+ _PrintExit("RegCreateKeyExW(%p,%ls,%x,%ls,%x,%x,%p,%p,%p) -> %x\n",
+ a0, a1, a2, a3, a4, a5, a6, a7, a8, rv);
+ };
+ return rv;
+}
+
+LONG WINAPI Mine_RegDeleteKeyA(HKEY a0,
+ LPCSTR a1)
+{
+ _PrintEnter(NULL);
+ LONG rv = 0;
+ __try {
+ rv = Real_RegDeleteKeyA(a0, a1);
+ } __finally {
+ _PrintExit("RegDeleteKeyA(%p,%hs) -> %x\n", a0, a1, rv);
+ };
+ return rv;
+}
+
+LONG WINAPI Mine_RegDeleteKeyW(HKEY a0,
+ LPCWSTR a1)
+{
+ _PrintEnter(NULL);
+ LONG rv = 0;
+ __try {
+ rv = Real_RegDeleteKeyW(a0, a1);
+ } __finally {
+ _PrintExit("RegDeleteKeyW(%p,%ls) -> %x\n", a0, a1, rv);
+ };
+ return rv;
+}
+
+LONG WINAPI Mine_RegDeleteValueA(HKEY a0,
+ LPCSTR a1)
+{
+ _PrintEnter("RegDeleteValueA(%p,%hs)\n", a0, a1);
+
+ LONG rv = 0;
+ __try {
+ rv = Real_RegDeleteValueA(a0, a1);
+ } __finally {
+ _PrintExit("RegDeleteValueA(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+LONG WINAPI Mine_RegDeleteValueW(HKEY a0,
+ LPCWSTR a1)
+{
+ _PrintEnter("RegDeleteValueW(%p,%ls)\n", a0, a1);
+
+ LONG rv = 0;
+ __try {
+ rv = Real_RegDeleteValueW(a0, a1);
+ } __finally {
+ _PrintExit("RegDeleteValueW(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+LONG WINAPI Mine_RegEnumKeyExA(HKEY a0,
+ DWORD a1,
+ LPSTR a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPSTR a5,
+ LPDWORD a6,
+ LPFILETIME a7)
+{
+ _PrintEnter("RegEnumKeyExA(%p,%x,%p,%p,%p,%hs,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7);
+
+ LONG rv = 0;
+ __try {
+ rv = Real_RegEnumKeyExA(a0, a1, a2, a3, a4, a5, a6, a7);
+ } __finally {
+ _PrintExit("RegEnumKeyExA(,,%hs,,,%hs,,) -> %x\n", a2, a5, rv);
+ };
+ return rv;
+}
+
+LONG WINAPI Mine_RegEnumKeyExW(HKEY a0,
+ DWORD a1,
+ LPWSTR a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPWSTR a5,
+ LPDWORD a6,
+ struct _FILETIME* a7)
+{
+ _PrintEnter("RegEnumKeyExW(%p,%x,%p,%p,%p,%ls,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7);
+
+ LONG rv = 0;
+ __try {
+ rv = Real_RegEnumKeyExW(a0, a1, a2, a3, a4, a5, a6, a7);
+ } __finally {
+ _PrintExit("RegEnumKeyExW(,,%ls,,,%ls,,) -> %x\n", a2, a5, rv);
+ };
+ return rv;
+}
+
+LONG WINAPI Mine_RegEnumValueA(HKEY a0,
+ DWORD a1,
+ LPSTR a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPDWORD a5,
+ LPBYTE a6,
+ LPDWORD a7)
+{
+ _PrintEnter("RegEnumValueA(%p,%x,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7);
+
+ LONG rv = 0;
+ __try {
+ rv = Real_RegEnumValueA(a0, a1, a2, a3, a4, a5, a6, a7);
+ } __finally {
+ _PrintExit("RegEnumValueA(,,%hs,,,,,) -> %x\n", a2, rv);
+ };
+ return rv;
+}
+
+LONG WINAPI Mine_RegEnumValueW(HKEY a0,
+ DWORD a1,
+ LPWSTR a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPDWORD a5,
+ LPBYTE a6,
+ LPDWORD a7)
+{
+ _PrintEnter("RegEnumValueW(%p,%x,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7);
+
+ LONG rv = 0;
+ __try {
+ rv = Real_RegEnumValueW(a0, a1, a2, a3, a4, a5, a6, a7);
+ } __finally {
+ _PrintExit("RegEnumValueW(,,%ls,,,,,) -> %x\n", a2, rv);
+ };
+ return rv;
+}
+
+LONG WINAPI Mine_RegOpenKeyExA(HKEY a0,
+ LPCSTR a1,
+ DWORD a2,
+ REGSAM a3,
+ PHKEY a4)
+{
+ _PrintEnter(NULL);
+
+ LONG rv = 0;
+ __try {
+ rv = Real_RegOpenKeyExA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("RegOpenKeyExA(%p,%hs,%x,%x,%p) -> %x\n",
+ a0, a1, a2, a3, a4, rv);
+ };
+ return rv;
+}
+
+LONG WINAPI Mine_RegOpenKeyExW(HKEY a0,
+ LPCWSTR a1,
+ DWORD a2,
+ REGSAM a3,
+ PHKEY a4)
+{
+ _PrintEnter(NULL);
+
+ LONG rv = 0;
+ __try {
+ rv = Real_RegOpenKeyExW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("RegOpenKeyExW(%p,%ls,%x,%x,%p) -> %x\n",
+ a0, a1, a2, a3, a4, rv);
+ };
+ return rv;
+}
+
+LONG WINAPI Mine_RegQueryInfoKeyA(HKEY a0,
+ LPSTR a1,
+ LPDWORD a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPDWORD a5,
+ LPDWORD a6,
+ LPDWORD a7,
+ LPDWORD a8,
+ LPDWORD a9,
+ LPDWORD a10,
+ LPFILETIME a11)
+{
+ _PrintEnter("RegQueryInfoKeyA(%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p)\n",
+ a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
+
+ LONG rv = 0;
+ __try {
+ rv = Real_RegQueryInfoKeyA(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
+ } __finally {
+ _PrintExit("RegQueryInfoKeyA(,%hs,,,,,,,,,,) -> %x\n", a1, rv);
+ };
+ return rv;
+}
+
+LONG WINAPI Mine_RegQueryInfoKeyW(HKEY a0,
+ LPWSTR a1,
+ LPDWORD a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPDWORD a5,
+ LPDWORD a6,
+ LPDWORD a7,
+ LPDWORD a8,
+ LPDWORD a9,
+ LPDWORD a10,
+ LPFILETIME a11)
+{
+ _PrintEnter("RegQueryInfoKeyW(%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p,%p)\n",
+ a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
+
+ LONG rv = 0;
+ __try {
+ rv = Real_RegQueryInfoKeyW(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
+ } __finally {
+ _PrintExit("RegQueryInfoKeyW(,%ls,,,,,,,,,,) -> %x\n", a1, rv);
+ };
+ return rv;
+}
+
+LONG WINAPI Mine_RegQueryValueExA(HKEY a0,
+ LPCSTR a1,
+ LPDWORD a2,
+ LPDWORD a3,
+ LPBYTE a4,
+ LPDWORD a5)
+{
+ _PrintEnter(NULL);
+
+ LONG rv = 0;
+ __try {
+ rv = Real_RegQueryValueExA(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("RegQueryValueExA(%p,%hs,%p,%p,%p,%p) -> %x\n",
+ a0, a1, a2, a3, a4, a5, rv);
+ };
+ return rv;
+}
+
+LONG WINAPI Mine_RegQueryValueExW(HKEY a0,
+ LPCWSTR a1,
+ LPDWORD a2,
+ LPDWORD a3,
+ LPBYTE a4,
+ LPDWORD a5)
+{
+ _PrintEnter(NULL);
+ LONG rv = 0;
+ __try {
+ rv = Real_RegQueryValueExW(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("RegQueryValueExW(%p,%ls,%p,%p,%p,%p) -> %x\n",
+ a0, a1, a2, a3, a4, a5, rv);
+ };
+ return rv;
+}
+
+LONG WINAPI Mine_RegSetValueExA(HKEY a0,
+ LPCSTR a1,
+ DWORD a2,
+ DWORD a3,
+ BYTE* a4,
+ DWORD a5)
+{
+ _PrintEnter(NULL);
+ LONG rv = 0;
+ __try {
+ rv = Real_RegSetValueExA(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("RegSetValueExA(%p,%hs,%x,%x,%p,%x) -> %x\n",
+ a0, a1, a2, a3, a4, a5, rv);
+ };
+ return rv;
+}
+
+LONG WINAPI Mine_RegSetValueExW(HKEY a0,
+ LPCWSTR a1,
+ DWORD a2,
+ DWORD a3,
+ BYTE* a4,
+ DWORD a5)
+{
+ _PrintEnter(NULL);
+ LONG rv = 0;
+ __try {
+ rv = Real_RegSetValueExW(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("RegSetValueExW(%p,%ls,%x,%x,%p,%x) -> %x\n",
+ a0, a1, a2, a3, a4, a5, rv);
+ };
+ return rv;
+}
+
+HFILE WINAPI Mine__lcreat(LPCSTR a0, int a1)
+{
+ _PrintEnter(NULL);
+ HFILE rv = 0;
+ __try {
+ rv = Real__lcreat(a0, a1);
+ } __finally {
+ _PrintExit("_lcreat(%hs,%x) -> %p\n", a0, a1, rv);
+ };
+ return rv;
+}
+
+HFILE WINAPI Mine__lopen(LPCSTR a0, int a1)
+{
+ _PrintEnter(NULL);
+ HFILE rv = 0;
+ __try {
+ rv = Real__lopen(a0, a1);
+ } __finally {
+ _PrintEnter("_lopen(%hs,%x) -> %p\n", a0, a1, rv);
+ };
+ return rv;
+}
+
+/////////////////////////////////////////////////////////////
+// AttachDetours
+//
+PCHAR DetRealName(PCHAR psz)
+{
+ PCHAR pszBeg = psz;
+ // Move to end of name.
+ while (*psz) {
+ psz++;
+ }
+ // Move back through A-Za-z0-9 names.
+ while (psz > pszBeg &&
+ ((psz[-1] >= 'A' && psz[-1] <= 'Z') ||
+ (psz[-1] >= 'a' && psz[-1] <= 'z') ||
+ (psz[-1] >= '0' && psz[-1] <= '9'))) {
+ psz--;
+ }
+ return psz;
+}
+
+VOID DetAttach(PVOID *ppbReal, PVOID pbMine, PCHAR psz)
+{
+ LONG l = DetourAttach(ppbReal, pbMine);
+ if (l != 0) {
+ Syelog(SYELOG_SEVERITY_NOTICE,
+ "Attach failed: `%s': error %d\n", DetRealName(psz), l);
+ }
+}
+
+VOID DetDetach(PVOID *ppbReal, PVOID pbMine, PCHAR psz)
+{
+ LONG l = DetourDetach(ppbReal, pbMine);
+ if (l != 0) {
+ Syelog(SYELOG_SEVERITY_NOTICE,
+ "Detach failed: `%s': error %d\n", DetRealName(psz), l);
+ }
+}
+
+#define ATTACH(x) DetAttach(&(PVOID&)Real_##x,Mine_##x,#x)
+#define DETACH(x) DetDetach(&(PVOID&)Real_##x,Mine_##x,#x)
+
+LONG AttachDetours(VOID)
+{
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+
+ ATTACH(CloseHandle);
+ ATTACH(CopyFileExA);
+ ATTACH(CopyFileExW);
+ ATTACH(CreateDirectoryExW);
+ ATTACH(CreateDirectoryW);
+ ATTACH(CreateFileW);
+ ATTACH(CreateProcessW);
+ ATTACH(DeleteFileA);
+ ATTACH(DeleteFileW);
+ ATTACH(FindFirstFileExA);
+ ATTACH(FindFirstFileExW);
+ ATTACH(GetFileAttributesW);
+ ATTACH(GetModuleFileNameW);
+ ATTACH(GetProcAddress);
+ ATTACH(GetSystemTimeAsFileTime);
+ ATTACH(LoadLibraryExW);
+ ATTACH(MoveFileA);
+ ATTACH(MoveFileExA);
+ ATTACH(MoveFileExW);
+ ATTACH(MoveFileW);
+ ATTACH(OpenFile);
+ ATTACH(RegCreateKeyExA);
+ ATTACH(RegCreateKeyExW);
+ ATTACH(RegDeleteKeyA);
+ ATTACH(RegDeleteKeyW);
+ ATTACH(RegDeleteValueA);
+ ATTACH(RegDeleteValueW);
+ ATTACH(RegEnumKeyExA);
+ ATTACH(RegEnumKeyExW);
+ ATTACH(RegEnumValueA);
+ ATTACH(RegEnumValueW);
+ ATTACH(RegOpenKeyExA);
+ ATTACH(RegOpenKeyExW);
+ ATTACH(RegQueryInfoKeyA);
+ ATTACH(RegQueryInfoKeyW);
+ ATTACH(RegQueryValueExA);
+ ATTACH(RegQueryValueExW);
+ ATTACH(RegSetValueExA);
+ ATTACH(RegSetValueExW);
+ ATTACH(SetNamedPipeHandleState);
+ ATTACH(WaitNamedPipeW);
+ ATTACH(WriteFile);
+ ATTACH(_lcreat);
+ ATTACH(_lopen);
+
+ return DetourTransactionCommit();
+}
+
+LONG DetachDetours(VOID)
+{
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+
+ DETACH(CloseHandle);
+ DETACH(CopyFileExA);
+ DETACH(CopyFileExW);
+ DETACH(CreateDirectoryExW);
+ DETACH(CreateDirectoryW);
+ DETACH(CreateFileW);
+ DETACH(CreateProcessW);
+ DETACH(DeleteFileA);
+ DETACH(DeleteFileW);
+ DETACH(FindFirstFileExA);
+ DETACH(FindFirstFileExW);
+ DETACH(GetFileAttributesW);
+ DETACH(GetModuleFileNameW);
+ DETACH(GetProcAddress);
+ DETACH(GetSystemTimeAsFileTime);
+ DETACH(LoadLibraryExW);
+ DETACH(MoveFileA);
+ DETACH(MoveFileExA);
+ DETACH(MoveFileExW);
+ DETACH(MoveFileW);
+ DETACH(OpenFile);
+ DETACH(RegCreateKeyExA);
+ DETACH(RegCreateKeyExW);
+ DETACH(RegDeleteKeyA);
+ DETACH(RegDeleteKeyW);
+ DETACH(RegDeleteValueA);
+ DETACH(RegDeleteValueW);
+ DETACH(RegEnumKeyExA);
+ DETACH(RegEnumKeyExW);
+ DETACH(RegEnumValueA);
+ DETACH(RegEnumValueW);
+ DETACH(RegOpenKeyExA);
+ DETACH(RegOpenKeyExW);
+ DETACH(RegQueryInfoKeyA);
+ DETACH(RegQueryInfoKeyW);
+ DETACH(RegQueryValueExA);
+ DETACH(RegQueryValueExW);
+ DETACH(RegSetValueExA);
+ DETACH(RegSetValueExW);
+ DETACH(SetNamedPipeHandleState);
+ DETACH(WaitNamedPipeW);
+ DETACH(WriteFile);
+ DETACH(_lcreat);
+ DETACH(_lopen);
+
+ return DetourTransactionCommit();
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+
+////////////////////////////////////////////////////////////// Logging System.
+//
+static BOOL s_bLog = 1;
+static LONG s_nTlsIndent = -1;
+static LONG s_nTlsThread = -1;
+static LONG s_nThreadCnt = 0;
+
+VOID _PrintEnter(const CHAR *psz, ...)
+{
+ DWORD dwErr = GetLastError();
+
+ LONG nIndent = 0;
+ LONG nThread = 0;
+ if (s_nTlsIndent >= 0) {
+ nIndent = (LONG)(LONG_PTR)TlsGetValue(s_nTlsIndent);
+ TlsSetValue(s_nTlsIndent, (PVOID)(LONG_PTR)(nIndent + 1));
+ }
+ if (s_nTlsThread >= 0) {
+ nThread = (LONG)(LONG_PTR)TlsGetValue(s_nTlsThread);
+ }
+
+ if (s_bLog && psz) {
+ CHAR szBuf[1024];
+ PCHAR pszBuf = szBuf;
+ PCHAR pszEnd = szBuf + ARRAYSIZE(szBuf) - 1;
+ LONG nLen = (nIndent > 0) ? (nIndent < 35 ? nIndent * 2 : 70) : 0;
+ *pszBuf++ = (CHAR)('0' + ((nThread / 100) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 10) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 1) % 10));
+ *pszBuf++ = ' ';
+ while (nLen-- > 0) {
+ *pszBuf++ = ' ';
+ }
+
+ va_list args;
+ va_start(args, psz);
+
+ while ((*pszBuf++ = *psz++) != 0 && pszBuf < pszEnd) {
+ // Copy characters.
+ }
+ *pszEnd = '\0';
+ SyelogV(SYELOG_SEVERITY_INFORMATION,
+ szBuf, args);
+
+ va_end(args);
+ }
+ SetLastError(dwErr);
+}
+
+VOID _PrintExit(const CHAR *psz, ...)
+{
+ DWORD dwErr = GetLastError();
+
+ LONG nIndent = 0;
+ LONG nThread = 0;
+ if (s_nTlsIndent >= 0) {
+ nIndent = (LONG)(LONG_PTR)TlsGetValue(s_nTlsIndent) - 1;
+ ASSERT(nIndent >= 0);
+ TlsSetValue(s_nTlsIndent, (PVOID)(LONG_PTR)nIndent);
+ }
+ if (s_nTlsThread >= 0) {
+ nThread = (LONG)(LONG_PTR)TlsGetValue(s_nTlsThread);
+ }
+
+ if (s_bLog && psz) {
+ CHAR szBuf[1024];
+ PCHAR pszBuf = szBuf;
+ PCHAR pszEnd = szBuf + ARRAYSIZE(szBuf) - 1;
+ LONG nLen = (nIndent > 0) ? (nIndent < 35 ? nIndent * 2 : 70) : 0;
+ *pszBuf++ = (CHAR)('0' + ((nThread / 100) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 10) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 1) % 10));
+ *pszBuf++ = ' ';
+ while (nLen-- > 0) {
+ *pszBuf++ = ' ';
+ }
+
+ va_list args;
+ va_start(args, psz);
+
+ while ((*pszBuf++ = *psz++) != 0 && pszBuf < pszEnd) {
+ // Copy characters.
+ }
+ *pszEnd = '\0';
+ SyelogV(SYELOG_SEVERITY_INFORMATION,
+ szBuf, args);
+
+ va_end(args);
+ }
+ SetLastError(dwErr);
+}
+
+VOID _Print(const CHAR *psz, ...)
+{
+ DWORD dwErr = GetLastError();
+
+ LONG nIndent = 0;
+ LONG nThread = 0;
+ if (s_nTlsIndent >= 0) {
+ nIndent = (LONG)(LONG_PTR)TlsGetValue(s_nTlsIndent);
+ }
+ if (s_nTlsThread >= 0) {
+ nThread = (LONG)(LONG_PTR)TlsGetValue(s_nTlsThread);
+ }
+
+ if (s_bLog && psz) {
+ CHAR szBuf[1024];
+ PCHAR pszBuf = szBuf;
+ PCHAR pszEnd = szBuf + ARRAYSIZE(szBuf) - 1;
+ LONG nLen = (nIndent > 0) ? (nIndent < 35 ? nIndent * 2 : 70) : 0;
+ *pszBuf++ = (CHAR)('0' + ((nThread / 100) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 10) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 1) % 10));
+ *pszBuf++ = ' ';
+ while (nLen-- > 0) {
+ *pszBuf++ = ' ';
+ }
+
+ va_list args;
+ va_start(args, psz);
+
+ while ((*pszBuf++ = *psz++) != 0 && pszBuf < pszEnd) {
+ // Copy characters.
+ }
+ *pszEnd = '\0';
+ SyelogV(SYELOG_SEVERITY_INFORMATION,
+ szBuf, args);
+
+ va_end(args);
+ }
+
+ SetLastError(dwErr);
+}
+
+VOID AssertMessage(CONST PCHAR pszMsg, CONST PCHAR pszFile, ULONG nLine)
+{
+ Syelog(SYELOG_SEVERITY_FATAL,
+ "ASSERT(%s) failed in %s, line %d.\n", pszMsg, pszFile, nLine);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+PIMAGE_NT_HEADERS NtHeadersForInstance(HINSTANCE hInst)
+{
+ PIMAGE_DOS_HEADER pDosHeader = (PIMAGE_DOS_HEADER)hInst;
+ __try {
+ if (pDosHeader->e_magic != IMAGE_DOS_SIGNATURE) {
+ SetLastError(ERROR_BAD_EXE_FORMAT);
+ return NULL;
+ }
+
+ PIMAGE_NT_HEADERS pNtHeader = (PIMAGE_NT_HEADERS)((PBYTE)pDosHeader +
+ pDosHeader->e_lfanew);
+ if (pNtHeader->Signature != IMAGE_NT_SIGNATURE) {
+ SetLastError(ERROR_INVALID_EXE_SIGNATURE);
+ return NULL;
+ }
+ if (pNtHeader->FileHeader.SizeOfOptionalHeader == 0) {
+ SetLastError(ERROR_EXE_MARKED_INVALID);
+ return NULL;
+ }
+ return pNtHeader;
+ } __except(EXCEPTION_EXECUTE_HANDLER) {
+ }
+ SetLastError(ERROR_EXE_MARKED_INVALID);
+
+ return NULL;
+}
+
+BOOL InstanceEnumerate(HINSTANCE hInst)
+{
+ WCHAR wzDllName[MAX_PATH];
+
+ PIMAGE_NT_HEADERS pinh = NtHeadersForInstance(hInst);
+ if (pinh && Real_GetModuleFileNameW(hInst, wzDllName, ARRAYSIZE(wzDllName))) {
+ Syelog(SYELOG_SEVERITY_INFORMATION,
+ "### %08lx: %-43.43ls %08x\n",
+ hInst, wzDllName, pinh->OptionalHeader.CheckSum);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+BOOL ProcessEnumerate()
+{
+ Syelog(SYELOG_SEVERITY_INFORMATION,
+ "######################################################### Binaries\n");
+ for (HINSTANCE hInst = NULL; (hInst = DetourEnumerateModules(hInst)) != NULL;) {
+ InstanceEnumerate(hInst);
+ }
+ return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// DLL module information
+//
+BOOL ThreadAttach(HMODULE hDll)
+{
+ (void)hDll;
+
+ if (s_nTlsIndent >= 0) {
+ TlsSetValue(s_nTlsIndent, (PVOID)0);
+ }
+ if (s_nTlsThread >= 0) {
+ LONG nThread = InterlockedIncrement(&s_nThreadCnt);
+ TlsSetValue(s_nTlsThread, (PVOID)(LONG_PTR)nThread);
+ }
+ return TRUE;
+}
+
+BOOL ThreadDetach(HMODULE hDll)
+{
+ (void)hDll;
+
+ if (s_nTlsIndent >= 0) {
+ TlsSetValue(s_nTlsIndent, (PVOID)0);
+ }
+ if (s_nTlsThread >= 0) {
+ TlsSetValue(s_nTlsThread, (PVOID)0);
+ }
+ return TRUE;
+}
+
+BOOL ProcessAttach(HMODULE hDll)
+{
+ s_bLog = FALSE;
+ s_nTlsIndent = TlsAlloc();
+ s_nTlsThread = TlsAlloc();
+
+ s_hInst = hDll;
+ Real_GetModuleFileNameA(s_hInst, s_szDllPath, ARRAYSIZE(s_szDllPath));
+
+ SyelogOpen("trcreg" DETOURS_STRINGIFY(DETOURS_BITS), SYELOG_FACILITY_APPLICATION);
+ ProcessEnumerate();
+
+ LONG error = AttachDetours();
+ if (error != NO_ERROR) {
+ Syelog(SYELOG_SEVERITY_FATAL, "### Error attaching detours: %d\n", error);
+ }
+
+ ThreadAttach(hDll);
+
+ s_bLog = TRUE;
+ return TRUE;
+}
+
+BOOL ProcessDetach(HMODULE hDll)
+{
+ ThreadDetach(hDll);
+ s_bLog = FALSE;
+
+ LONG error = DetachDetours();
+ if (error != NO_ERROR) {
+ Syelog(SYELOG_SEVERITY_FATAL, "### Error detaching detours: %d\n", error);
+ }
+
+ Syelog(SYELOG_SEVERITY_NOTICE, "### Closing.\n");
+ SyelogClose(FALSE);
+
+ if (s_nTlsIndent >= 0) {
+ TlsFree(s_nTlsIndent);
+ }
+ if (s_nTlsThread >= 0) {
+ TlsFree(s_nTlsThread);
+ }
+ return TRUE;
+}
+
+BOOL APIENTRY DllMain(HINSTANCE hModule, DWORD dwReason, PVOID lpReserved)
+{
+ (void)hModule;
+ (void)lpReserved;
+
+ if (DetourIsHelperProcess()) {
+ return TRUE;
+ }
+
+ switch (dwReason) {
+ case DLL_PROCESS_ATTACH:
+ DetourRestoreAfterWith();
+ return ProcessAttach(hModule);
+ case DLL_PROCESS_DETACH:
+ return ProcessDetach(hModule);
+ case DLL_THREAD_ATTACH:
+ return ThreadAttach(hModule);
+ case DLL_THREAD_DETACH:
+ return ThreadDetach(hModule);
+ }
+ return TRUE;
+}
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/tracereg/trcreg.rc b/ext/detours/samples/tracereg/trcreg.rc
new file mode 100644
index 0000000..37adf3c
--- /dev/null
+++ b/ext/detours/samples/tracereg/trcreg.rc
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Version information for trcreg.rc.
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include "detver.h"
+
+#define VER_INTERNALNAME_STR "trcreg" DETOURS_STRINGIFY(DETOURS_BITS)
+#define VER_ORIGINALFILENAME_STR "trcreg" DETOURS_STRINGIFY(DETOURS_BITS) ".dll"
+#define VER_FILEDESCRIPTION_STR "Detours Registry Trace Module"
+#define VER_COMPANYNAME_STR "Microsoft Corporation"
+
+#include "common.ver"
diff --git a/ext/detours/samples/traceser/Makefile b/ext/detours/samples/traceser/Makefile
new file mode 100644
index 0000000..0e29f0f
--- /dev/null
+++ b/ext/detours/samples/traceser/Makefile
@@ -0,0 +1,82 @@
+##############################################################################
+##
+## Utility to trace serial (COM1, COM2, etc.) APIs.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+LIBS=$(LIBS) kernel32.lib
+
+all: dirs \
+ $(BIND)\trcser$(DETOURS_BITS).dll \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\trcser$(DETOURS_BITS).bsc \
+!ENDIF
+ option
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+clean:
+ -del *~ test.txt 2>nul
+ -del $(BIND)\trcser*.* 2>nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+##############################################################################
+
+$(OBJD)\trcser.obj: trcser.cpp
+
+$(OBJD)\trcser.res: trcser.rc
+
+$(BIND)\trcser$(DETOURS_BITS).dll: $(OBJD)\trcser.obj $(OBJD)\trcser.res $(DEPS)
+ cl /LD $(CFLAGS) /Fe$@ /Fd$(@R).pdb \
+ $(OBJD)\trcser.obj $(OBJD)\trcser.res \
+ /link $(LINKFLAGS) /subsystem:console \
+ /export:DetourFinishHelperProcess,@1,NONAME \
+ $(LIBS)
+
+$(OBJD)\trcser$(DETOURS_BITS).bsc : $(OBJD)\trcser.obj
+ bscmake /v /n /o $@ $(OBJD)\trcser.sbr
+
+############################################### Install non-bit-size binaries.
+
+!IF "$(DETOURS_OPTION_PROCESSOR)" != ""
+
+$(OPTD)\trcser$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\trcser$(DETOURS_OPTION_BITS).pdb:
+
+$(BIND)\trcser$(DETOURS_OPTION_BITS).dll : $(OPTD)\trcser$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\trcser$(DETOURS_OPTION_BITS).pdb : $(OPTD)\trcser$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+
+option: \
+ $(BIND)\trcser$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\trcser$(DETOURS_OPTION_BITS).pdb \
+
+!ELSE
+
+option:
+
+!ENDIF
+
+##############################################################################
+
+test: all
+ @echo -------- Logging output to test.txt ------------
+ start $(BIND)\syelogd.exe /o test.txt
+ $(BIND)\sleep5.exe 1
+ @echo -------- Should load trcser$(DETOURS_BITS).dll dynamically using withdll.exe ------------
+ $(BIND)\withdll -d:$(BIND)\trcser$(DETOURS_BITS).dll $(BIND)\sleepold.exe
+ @echo -------- Log from syelog -------------
+ type test.txt
+
+################################################################# End of File.
diff --git a/ext/detours/samples/traceser/trcser.cpp b/ext/detours/samples/traceser/trcser.cpp
new file mode 100644
index 0000000..b696fe6
--- /dev/null
+++ b/ext/detours/samples/traceser/trcser.cpp
@@ -0,0 +1,1180 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (trcser.cpp of trcser.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#define _WIN32_WINNT 0x0400
+#define WIN32
+#define NT
+
+#define DBG_TRACE 0
+
+#include <windows.h>
+#include <stdio.h>
+#include "detours.h"
+#include "syelog.h"
+
+#define PULONG_PTR PVOID
+#define PLONG_PTR PVOID
+#define ULONG_PTR PVOID
+#define ENUMRESNAMEPROCA PVOID
+#define ENUMRESNAMEPROCW PVOID
+#define ENUMRESLANGPROCA PVOID
+#define ENUMRESLANGPROCW PVOID
+#define ENUMRESTYPEPROCA PVOID
+#define ENUMRESTYPEPROCW PVOID
+#define STGOPTIONS PVOID
+
+//////////////////////////////////////////////////////////////////////
+#pragma warning(disable:4127) // Many of our asserts are constants.
+
+#define ASSERT_ALWAYS(x) \
+ do { \
+ if (!(x)) { \
+ AssertMessage(#x, __FILE__, __LINE__); \
+ DebugBreak(); \
+ } \
+ } while (0)
+
+#ifndef NDEBUG
+#define ASSERT(x) ASSERT_ALWAYS(x)
+#else
+#define ASSERT(x)
+#endif
+
+#define UNUSED(c) (c) = (c)
+
+//////////////////////////////////////////////////////////////////////
+static HMODULE s_hInst = NULL;
+static CHAR s_szDllPath[MAX_PATH];
+
+VOID _PrintDump(HANDLE h, PCHAR pszData, INT cbData);
+VOID _PrintEnter(PCSTR psz, ...);
+VOID _PrintExit(PCSTR psz, ...);
+VOID _Print(PCSTR psz, ...);
+
+VOID AssertMessage(CONST PCHAR pszMsg, CONST PCHAR pszFile, ULONG nLine);
+
+//////////////////////////////////////////////////////////////////////////////
+//
+extern "C" {
+ HANDLE (WINAPI * Real_CreateFileW)(LPCWSTR a0,
+ DWORD a1,
+ DWORD a2,
+ LPSECURITY_ATTRIBUTES a3,
+ DWORD a4,
+ DWORD a5,
+ HANDLE a6)
+ = CreateFileW;
+
+ BOOL (WINAPI * Real_WriteFile)(HANDLE hFile,
+ LPCVOID lpBuffer,
+ DWORD nNumberOfBytesToWrite,
+ LPDWORD lpNumberOfBytesWritten,
+ LPOVERLAPPED lpOverlapped)
+ = WriteFile;
+ BOOL (WINAPI * Real_FlushFileBuffers)(HANDLE hFile)
+ = FlushFileBuffers;
+ BOOL (WINAPI * Real_CloseHandle)(HANDLE hObject)
+ = CloseHandle;
+
+ BOOL (WINAPI * Real_WaitNamedPipeW)(LPCWSTR lpNamedPipeName, DWORD nTimeOut)
+ = WaitNamedPipeW;
+ BOOL (WINAPI * Real_SetNamedPipeHandleState)(HANDLE hNamedPipe,
+ LPDWORD lpMode,
+ LPDWORD lpMaxCollectionCount,
+ LPDWORD lpCollectDataTimeout)
+ = SetNamedPipeHandleState;
+
+ DWORD (WINAPI * Real_GetCurrentProcessId)(VOID)
+ = GetCurrentProcessId;
+ VOID (WINAPI * Real_GetSystemTimeAsFileTime)(LPFILETIME lpSystemTimeAsFileTime)
+ = GetSystemTimeAsFileTime;
+
+ VOID (WINAPI * Real_InitializeCriticalSection)(LPCRITICAL_SECTION lpSection)
+ = InitializeCriticalSection;
+ VOID (WINAPI * Real_EnterCriticalSection)(LPCRITICAL_SECTION lpSection)
+ = EnterCriticalSection;
+ VOID (WINAPI * Real_LeaveCriticalSection)(LPCRITICAL_SECTION lpSection)
+ = LeaveCriticalSection;
+}
+
+DWORD (WINAPI * Real_GetModuleFileNameW)(HMODULE a0,
+ LPWSTR a1,
+ DWORD a2)
+ = GetModuleFileNameW;
+
+DWORD (WINAPI * Real_GetModuleFileNameA)(HMODULE a0,
+ LPSTR a1,
+ DWORD a2)
+ = GetModuleFileNameA;
+
+BOOL (WINAPI * Real_CreateProcessW)(LPCWSTR a0,
+ LPWSTR a1,
+ LPSECURITY_ATTRIBUTES a2,
+ LPSECURITY_ATTRIBUTES a3,
+ BOOL a4,
+ DWORD a5,
+ LPVOID a6,
+ LPCWSTR a7,
+ struct _STARTUPINFOW* a8,
+ LPPROCESS_INFORMATION a9)
+ = CreateProcessW;
+
+BOOL (WINAPI * Real_BuildCommDCBA)(LPCSTR a0,
+ struct _DCB* a1)
+ = BuildCommDCBA;
+
+BOOL (WINAPI * Real_BuildCommDCBAndTimeoutsA)(LPCSTR a0,
+ struct _DCB* a1,
+ struct _COMMTIMEOUTS* a2)
+ = BuildCommDCBAndTimeoutsA;
+
+BOOL (WINAPI * Real_BuildCommDCBAndTimeoutsW)(LPCWSTR a0,
+ struct _DCB* a1,
+ struct _COMMTIMEOUTS* a2)
+ = BuildCommDCBAndTimeoutsW;
+
+BOOL (WINAPI * Real_BuildCommDCBW)(LPCWSTR a0,
+ struct _DCB* a1)
+ = BuildCommDCBW;
+
+BOOL (WINAPI * Real_ClearCommBreak)(HANDLE a0)
+ = ClearCommBreak;
+
+BOOL (WINAPI * Real_ClearCommError)(HANDLE a0,
+ LPDWORD a1,
+ struct _COMSTAT* a2)
+ = ClearCommError;
+
+HANDLE (WINAPI * Real_CreateFileA)(LPCSTR a0,
+ DWORD a1,
+ DWORD a2,
+ LPSECURITY_ATTRIBUTES a3,
+ DWORD a4,
+ DWORD a5,
+ HANDLE a6)
+ = CreateFileA;
+
+BOOL (WINAPI * Real_EscapeCommFunction)(HANDLE a0,
+ DWORD a1)
+ = EscapeCommFunction;
+
+BOOL (WINAPI * Real_GetCommConfig)(HANDLE a0,
+ LPCOMMCONFIG a1,
+ LPDWORD a2)
+ = GetCommConfig;
+
+BOOL (WINAPI * Real_GetCommMask)(HANDLE a0,
+ LPDWORD a1)
+ = GetCommMask;
+
+BOOL (WINAPI * Real_GetCommModemStatus)(HANDLE a0,
+ LPDWORD a1)
+ = GetCommModemStatus;
+
+BOOL (WINAPI * Real_GetCommProperties)(HANDLE a0,
+ LPCOMMPROP a1)
+ = GetCommProperties;
+
+BOOL (WINAPI * Real_GetCommState)(HANDLE a0,
+ struct _DCB* a1)
+ = GetCommState;
+
+BOOL (WINAPI * Real_GetCommTimeouts)(HANDLE a0,
+ struct _COMMTIMEOUTS* a1)
+ = GetCommTimeouts;
+
+DWORD (WINAPI * Real_GetCurrentThreadId)(void)
+ = GetCurrentThreadId;
+
+BOOL (WINAPI * Real_GetOverlappedResult)(HANDLE a0,
+ LPOVERLAPPED a1,
+ LPDWORD a2,
+ BOOL a3)
+ = GetOverlappedResult;
+
+BOOL (WINAPI * Real_PurgeComm)(HANDLE a0,
+ DWORD a1)
+ = PurgeComm;
+
+BOOL (WINAPI * Real_ReadFile)(HANDLE a0,
+ LPVOID a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPOVERLAPPED a4)
+ = ReadFile;
+
+BOOL (WINAPI * Real_SetCommBreak)(HANDLE a0)
+ = SetCommBreak;
+
+BOOL (WINAPI * Real_SetCommConfig)(HANDLE a0,
+ LPCOMMCONFIG a1,
+ DWORD a2)
+ = SetCommConfig;
+
+BOOL (WINAPI * Real_SetCommMask)(HANDLE a0,
+ DWORD a1)
+ = SetCommMask;
+
+BOOL (WINAPI * Real_SetCommState)(HANDLE a0,
+ struct _DCB* a1)
+ = SetCommState;
+
+BOOL (WINAPI * Real_SetCommTimeouts)(HANDLE a0,
+ struct _COMMTIMEOUTS* a1)
+ = SetCommTimeouts;
+
+BOOL (WINAPI * Real_SetupComm)(HANDLE a0,
+ DWORD a1,
+ DWORD a2)
+ = SetupComm;
+
+BOOL (WINAPI * Real_TransmitCommChar)(HANDLE a0,
+ char a1)
+ = TransmitCommChar;
+
+BOOL (WINAPI * Real_WaitCommEvent)(HANDLE a0,
+ LPDWORD a1,
+ LPOVERLAPPED a2)
+ = WaitCommEvent;
+
+/////////////////////////////////////////////////////////////
+// Detours
+//
+
+BOOL WINAPI Mine_CreateProcessW(LPCWSTR lpApplicationName,
+ LPWSTR lpCommandLine,
+ LPSECURITY_ATTRIBUTES lpProcessAttributes,
+ LPSECURITY_ATTRIBUTES lpThreadAttributes,
+ BOOL bInheritHandles,
+ DWORD dwCreationFlags,
+ LPVOID lpEnvironment,
+ LPCWSTR lpCurrentDirectory,
+ LPSTARTUPINFOW lpStartupInfo,
+ LPPROCESS_INFORMATION lpProcessInformation)
+{
+ _PrintEnter("CreateProcessW(%ls,%ls,%p,%p,%x,%x,%p,%ls,%p,%p)\n",
+ lpApplicationName,
+ lpCommandLine,
+ lpProcessAttributes,
+ lpThreadAttributes,
+ bInheritHandles,
+ dwCreationFlags,
+ lpEnvironment,
+ lpCurrentDirectory,
+ lpStartupInfo,
+ lpProcessInformation);
+
+ _Print("Calling DetourCreateProcessWithDllExW(,%hs)\n", s_szDllPath);
+
+ BOOL rv = 0;
+ __try {
+ rv = DetourCreateProcessWithDllExW(lpApplicationName,
+ lpCommandLine,
+ lpProcessAttributes,
+ lpThreadAttributes,
+ bInheritHandles,
+ dwCreationFlags,
+ lpEnvironment,
+ lpCurrentDirectory,
+ lpStartupInfo,
+ lpProcessInformation,
+ s_szDllPath,
+ Real_CreateProcessW);
+ } __finally {
+ _PrintExit("CreateProcessW(,,,,,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_BuildCommDCBA(LPCSTR a0,
+ LPDCB a1)
+{
+ _PrintEnter("BuildCommDCBA(%hs,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_BuildCommDCBA(a0, a1);
+ } __finally {
+ _PrintExit("BuildCommDCBA(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_BuildCommDCBAndTimeoutsA(LPCSTR a0,
+ LPDCB a1,
+ LPCOMMTIMEOUTS a2)
+{
+ _PrintEnter("BuildCommDCBAndTimeoutsA(%hs,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_BuildCommDCBAndTimeoutsA(a0, a1, a2);
+ } __finally {
+ _PrintExit("BuildCommDCBAndTimeoutsA(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_BuildCommDCBAndTimeoutsW(LPCWSTR a0,
+ LPDCB a1,
+ LPCOMMTIMEOUTS a2)
+{
+ _PrintEnter("BuildCommDCBAndTimeoutsW(%ls,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_BuildCommDCBAndTimeoutsW(a0, a1, a2);
+ } __finally {
+ _PrintExit("BuildCommDCBAndTimeoutsW(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_BuildCommDCBW(LPCWSTR a0,
+ LPDCB a1)
+{
+ _PrintEnter("BuildCommDCBW(%ls,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_BuildCommDCBW(a0, a1);
+ } __finally {
+ _PrintExit("BuildCommDCBW(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_ClearCommBreak(HANDLE a0)
+{
+ _PrintEnter("ClearCommBreak(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ClearCommBreak(a0);
+ } __finally {
+ _PrintExit("ClearCommBreak() -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_ClearCommError(HANDLE a0,
+ LPDWORD a1,
+ LPCOMSTAT a2)
+{
+ _PrintEnter("ClearCommError(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ClearCommError(a0, a1, a2);
+ } __finally {
+ _PrintExit("ClearCommError(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_CloseHandle(HANDLE a0)
+{
+ _PrintEnter("CloseHandle(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CloseHandle(a0);
+ } __finally {
+ _PrintExit("CloseHandle() -> %x\n", rv);
+ };
+ return rv;
+}
+
+HANDLE WINAPI Mine_CreateFileA(LPCSTR a0,
+ DWORD a1,
+ DWORD a2,
+ LPSECURITY_ATTRIBUTES a3,
+ DWORD a4,
+ DWORD a5,
+ HANDLE a6)
+{
+ _PrintEnter("CreateFileA(%hs,%x,%x,%p,%x,%x,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_CreateFileA(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("CreateFileA(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE WINAPI Mine_CreateFileW(LPCWSTR a0,
+ DWORD a1,
+ DWORD a2,
+ LPSECURITY_ATTRIBUTES a3,
+ DWORD a4,
+ DWORD a5,
+ HANDLE a6)
+{
+ _PrintEnter("CreateFileW(%ls,%x,%x,%p,%x,%x,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_CreateFileW(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("CreateFileW(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_EscapeCommFunction(HANDLE a0,
+ DWORD a1)
+{
+ _PrintEnter("EscapeCommFunction(%p,%x)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_EscapeCommFunction(a0, a1);
+ } __finally {
+ _PrintExit("EscapeCommFunction(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_GetCommConfig(HANDLE a0,
+ LPCOMMCONFIG a1,
+ LPDWORD a2)
+{
+ _PrintEnter("GetCommConfig(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetCommConfig(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetCommConfig(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_GetCommMask(HANDLE a0,
+ LPDWORD a1)
+{
+ _PrintEnter("GetCommMask(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetCommMask(a0, a1);
+ } __finally {
+ _PrintExit("GetCommMask(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_GetCommModemStatus(HANDLE a0,
+ LPDWORD a1)
+{
+ _PrintEnter("GetCommModemStatus(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetCommModemStatus(a0, a1);
+ } __finally {
+ _PrintExit("GetCommModemStatus(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_GetCommProperties(HANDLE a0,
+ LPCOMMPROP a1)
+{
+ _PrintEnter("GetCommProperties(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetCommProperties(a0, a1);
+ } __finally {
+ _PrintExit("GetCommProperties(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_GetCommState(HANDLE a0,
+ LPDCB a1)
+{
+ _PrintEnter("GetCommState(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetCommState(a0, a1);
+ } __finally {
+ _PrintExit("GetCommState(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_GetCommTimeouts(HANDLE a0,
+ LPCOMMTIMEOUTS a1)
+{
+ _PrintEnter("GetCommTimeouts(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetCommTimeouts(a0, a1);
+ } __finally {
+ _PrintExit("GetCommTimeouts(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+DWORD WINAPI Mine_GetCurrentThreadId(void)
+{
+ _PrintEnter("GetCurrentThreadId()\n");
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetCurrentThreadId();
+ } __finally {
+ _PrintExit("GetCurrentThreadId() -> %x\n", rv);
+ };
+ return rv;
+}
+
+DWORD WINAPI Mine_GetModuleFileNameW(HINSTANCE a0,
+ LPWSTR a1,
+ DWORD a2)
+{
+ _PrintEnter("GetModuleFileNameW(%p,%p,%x)\n", a0, a1, a2);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_GetModuleFileNameW(a0, a1, a2);
+ } __finally {
+ _PrintExit("GetModuleFileNameW(,%ls,) -> %x\n", a1, rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_GetOverlappedResult(HANDLE a0,
+ LPOVERLAPPED a1,
+ LPDWORD a2,
+ BOOL a3)
+{
+ _PrintEnter("GetOverlappedResult(%p,%p,%p,%x)\n", a0, a1, a2, a3);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_GetOverlappedResult(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("GetOverlappedResult(,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_PurgeComm(HANDLE a0,
+ DWORD a1)
+{
+ _PrintEnter("PurgeComm(%p,%x)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_PurgeComm(a0, a1);
+ } __finally {
+ _PrintExit("PurgeComm(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_ReadFile(HANDLE a0,
+ LPVOID a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPOVERLAPPED a4)
+{
+ _PrintEnter("ReadFile(%p,%p,%x,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_ReadFile(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("ReadFile(,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_SetCommBreak(HANDLE a0)
+{
+ _PrintEnter("SetCommBreak(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetCommBreak(a0);
+ } __finally {
+ _PrintExit("SetCommBreak() -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_SetCommConfig(HANDLE a0,
+ LPCOMMCONFIG a1,
+ DWORD a2)
+{
+ _PrintEnter("SetCommConfig(%p,%p,%x)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetCommConfig(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetCommConfig(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_SetCommMask(HANDLE a0,
+ DWORD a1)
+{
+ _PrintEnter("SetCommMask(%p,%x)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetCommMask(a0, a1);
+ } __finally {
+ _PrintExit("SetCommMask(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_SetCommState(HANDLE a0,
+ LPDCB a1)
+{
+ _PrintEnter("SetCommState(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetCommState(a0, a1);
+ } __finally {
+ _PrintExit("SetCommState(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_SetCommTimeouts(HANDLE a0,
+ LPCOMMTIMEOUTS a1)
+{
+ _PrintEnter("SetCommTimeouts(%p,%p)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetCommTimeouts(a0, a1);
+ } __finally {
+ _PrintExit("SetCommTimeouts(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_SetupComm(HANDLE a0,
+ DWORD a1,
+ DWORD a2)
+{
+ _PrintEnter("SetupComm(%p,%x,%x)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_SetupComm(a0, a1, a2);
+ } __finally {
+ _PrintExit("SetupComm(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_TransmitCommChar(HANDLE a0,
+ char a1)
+{
+ _PrintEnter("TransmitCommChar(%p,%x)\n", a0, a1);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_TransmitCommChar(a0, a1);
+ } __finally {
+ _PrintExit("TransmitCommChar(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_WaitCommEvent(HANDLE a0,
+ LPDWORD a1,
+ LPOVERLAPPED a2)
+{
+ _PrintEnter("WaitCommEvent(%p,%p,%p)\n", a0, a1, a2);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WaitCommEvent(a0, a1, a2);
+ } __finally {
+ _PrintExit("WaitCommEvent(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_WriteFile(HANDLE a0,
+ LPCVOID a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPOVERLAPPED a4)
+{
+ _PrintEnter("WriteFile(%p,%p,%x,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ _PrintDump(a0, (PCHAR)a1, a2);
+ rv = Real_WriteFile(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WriteFile(,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+/////////////////////////////////////////////////////////////
+// AttachDetours
+//
+PCHAR DetRealName(PCHAR psz)
+{
+ PCHAR pszBeg = psz;
+ // Move to end of name.
+ while (*psz) {
+ psz++;
+ }
+ // Move back through A-Za-z0-9 names.
+ while (psz > pszBeg &&
+ ((psz[-1] >= 'A' && psz[-1] <= 'Z') ||
+ (psz[-1] >= 'a' && psz[-1] <= 'z') ||
+ (psz[-1] >= '0' && psz[-1] <= '9'))) {
+ psz--;
+ }
+ return psz;
+}
+
+VOID DetAttach(PVOID *ppbReal, PVOID pbMine, PCHAR psz)
+{
+ LONG l = DetourAttach(ppbReal, pbMine);
+ if (l != 0) {
+ Syelog(SYELOG_SEVERITY_NOTICE,
+ "Attach failed: `%s': error %d\n", DetRealName(psz), l);
+ }
+}
+
+VOID DetDetach(PVOID *ppbReal, PVOID pbMine, PCHAR psz)
+{
+ LONG l = DetourDetach(ppbReal, pbMine);
+ if (l != 0) {
+ Syelog(SYELOG_SEVERITY_NOTICE,
+ "Detach failed: `%s': error %d\n", DetRealName(psz), l);
+ }
+}
+
+#define ATTACH(x) DetAttach(&(PVOID&)Real_##x,Mine_##x,#x)
+#define DETACH(x) DetDetach(&(PVOID&)Real_##x,Mine_##x,#x)
+
+LONG AttachDetours(VOID)
+{
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+
+ ATTACH(BuildCommDCBA);
+ ATTACH(BuildCommDCBAndTimeoutsA);
+ ATTACH(BuildCommDCBAndTimeoutsW);
+ ATTACH(BuildCommDCBW);
+ ATTACH(ClearCommBreak);
+ ATTACH(ClearCommError);
+ ATTACH(CloseHandle);
+ ATTACH(CreateFileA);
+ ATTACH(CreateFileW);
+ ATTACH(EscapeCommFunction);
+ ATTACH(GetCommConfig);
+ ATTACH(GetCommMask);
+ ATTACH(GetCommModemStatus);
+ ATTACH(GetCommProperties);
+ ATTACH(GetCommState);
+ ATTACH(GetCommTimeouts);
+ ATTACH(GetCurrentThreadId);
+ ATTACH(GetModuleFileNameW);
+ ATTACH(GetOverlappedResult);
+ ATTACH(PurgeComm);
+ ATTACH(ReadFile);
+ ATTACH(SetCommBreak);
+ ATTACH(SetCommConfig);
+ ATTACH(SetCommMask);
+ ATTACH(SetCommState);
+ ATTACH(SetCommTimeouts);
+ ATTACH(SetupComm);
+ ATTACH(TransmitCommChar);
+ ATTACH(WaitCommEvent);
+ ATTACH(WriteFile);
+
+ return DetourTransactionCommit();
+}
+
+LONG DetachDetours(VOID)
+{
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+
+ DETACH(BuildCommDCBA);
+ DETACH(BuildCommDCBAndTimeoutsA);
+ DETACH(BuildCommDCBAndTimeoutsW);
+ DETACH(BuildCommDCBW);
+ DETACH(ClearCommBreak);
+ DETACH(ClearCommError);
+ DETACH(CloseHandle);
+ DETACH(CreateFileA);
+ DETACH(CreateFileW);
+ DETACH(EscapeCommFunction);
+ DETACH(GetCommConfig);
+ DETACH(GetCommMask);
+ DETACH(GetCommModemStatus);
+ DETACH(GetCommProperties);
+ DETACH(GetCommState);
+ DETACH(GetCommTimeouts);
+ DETACH(GetCurrentThreadId);
+ DETACH(GetModuleFileNameW);
+ DETACH(GetOverlappedResult);
+ DETACH(PurgeComm);
+ DETACH(ReadFile);
+ DETACH(SetCommBreak);
+ DETACH(SetCommConfig);
+ DETACH(SetCommMask);
+ DETACH(SetCommState);
+ DETACH(SetCommTimeouts);
+ DETACH(SetupComm);
+ DETACH(TransmitCommChar);
+ DETACH(WaitCommEvent);
+ DETACH(WriteFile);
+
+ return DetourTransactionCommit();
+}
+
+/////////////////////////////////////////////////////////////
+// Detours
+//
+
+VOID _PrintDump(HANDLE h, PCHAR pszData, INT cbData)
+{
+ if (pszData && cbData > 0) {
+ CHAR szBuffer[256];
+ PCHAR pszBuffer = szBuffer;
+ INT cbBuffer = 0;
+ INT nLines = 0;
+
+ while (cbData > 0) {
+ if (nLines > 20) {
+ *pszBuffer++ = '.';
+ *pszBuffer++ = '.';
+ *pszBuffer++ = '.';
+ cbBuffer += 3;
+ break;
+ }
+
+ if (*pszData == '\t') {
+ *pszBuffer++ = '\\';
+ *pszBuffer++ = 't';
+ cbBuffer += 2;
+ pszData++;
+ cbData--;
+ continue;
+ }
+ if (*pszData == '\r') {
+ *pszBuffer++ = '\\';
+ *pszBuffer++ = 'r';
+ cbBuffer += 2;
+ pszData++;
+ cbData--;
+ continue;
+ }
+ else if (*pszData == '\n') {
+ *pszBuffer++ = '\\';
+ *pszBuffer++ = 'n';
+ cbBuffer += 2;
+ *pszBuffer++ = '\0';
+ _Print("%p: %hs\n", h, szBuffer);
+ nLines++;
+ pszBuffer = szBuffer;
+ cbBuffer = 0;
+ pszData++;
+ cbData--;
+ continue;
+ }
+ else if (cbBuffer >= 80) {
+ *pszBuffer++ = '\0';
+ _Print("%p: %hs\n", h, szBuffer);
+ nLines++;
+ pszBuffer = szBuffer;
+ cbBuffer = 0;
+ }
+
+ if (*pszData < ' ' || *pszData >= 127) {
+ *pszBuffer++ = '\\';
+ *pszBuffer++ = 'x';
+ *pszBuffer++ = "0123456789ABCDEF"[(*pszData & 0xf0) >> 4];
+ *pszBuffer++ = "0123456789ABCDEF"[(*pszData & 0x0f)];
+ cbBuffer += 4;
+ }
+ else {
+ *pszBuffer++ = *pszData;
+ }
+ cbBuffer++;
+ pszData++;
+ cbData--;
+ }
+
+ if (cbBuffer > 0) {
+ *pszBuffer++ = '\0';
+ _Print("%p: %hs\n", h, szBuffer);
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////// Logging System.
+//
+static BOOL s_bLog = 1;
+static LONG s_nTlsIndent = -1;
+static LONG s_nTlsThread = -1;
+static LONG s_nThreadCnt = 0;
+
+VOID _PrintEnter(const CHAR *psz, ...)
+{
+ DWORD dwErr = GetLastError();
+
+ LONG nIndent = 0;
+ LONG nThread = 0;
+ if (s_nTlsIndent >= 0) {
+ nIndent = (LONG)(LONG_PTR)TlsGetValue(s_nTlsIndent);
+ TlsSetValue(s_nTlsIndent, (PVOID)(LONG_PTR)(nIndent + 1));
+ }
+ if (s_nTlsThread >= 0) {
+ nThread = (LONG)(LONG_PTR)TlsGetValue(s_nTlsThread);
+ }
+
+ if (s_bLog && psz) {
+ CHAR szBuf[1024];
+ PCHAR pszBuf = szBuf;
+ PCHAR pszEnd = szBuf + ARRAYSIZE(szBuf) - 1;
+ LONG nLen = (nIndent > 0) ? (nIndent < 35 ? nIndent * 2 : 70) : 0;
+ *pszBuf++ = (CHAR)('0' + ((nThread / 100) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 10) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 1) % 10));
+ *pszBuf++ = ' ';
+ while (nLen-- > 0) {
+ *pszBuf++ = ' ';
+ }
+
+ va_list args;
+ va_start(args, psz);
+
+ while ((*pszBuf++ = *psz++) != 0 && pszBuf < pszEnd) {
+ // Copy characters.
+ }
+ *pszEnd = '\0';
+ SyelogV(SYELOG_SEVERITY_INFORMATION,
+ szBuf, args);
+
+ va_end(args);
+ }
+ SetLastError(dwErr);
+}
+
+VOID _PrintExit(const CHAR *psz, ...)
+{
+ DWORD dwErr = GetLastError();
+
+ LONG nIndent = 0;
+ LONG nThread = 0;
+ if (s_nTlsIndent >= 0) {
+ nIndent = (LONG)(LONG_PTR)TlsGetValue(s_nTlsIndent) - 1;
+ ASSERT(nIndent >= 0);
+ TlsSetValue(s_nTlsIndent, (PVOID)(LONG_PTR)nIndent);
+ }
+ if (s_nTlsThread >= 0) {
+ nThread = (LONG)(LONG_PTR)TlsGetValue(s_nTlsThread);
+ }
+
+ if (s_bLog && psz) {
+ CHAR szBuf[1024];
+ PCHAR pszBuf = szBuf;
+ PCHAR pszEnd = szBuf + ARRAYSIZE(szBuf) - 1;
+ LONG nLen = (nIndent > 0) ? (nIndent < 35 ? nIndent * 2 : 70) : 0;
+ *pszBuf++ = (CHAR)('0' + ((nThread / 100) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 10) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 1) % 10));
+ *pszBuf++ = ' ';
+ while (nLen-- > 0) {
+ *pszBuf++ = ' ';
+ }
+
+ va_list args;
+ va_start(args, psz);
+
+ while ((*pszBuf++ = *psz++) != 0 && pszBuf < pszEnd) {
+ // Copy characters.
+ }
+ *pszEnd = '\0';
+ SyelogV(SYELOG_SEVERITY_INFORMATION,
+ szBuf, args);
+
+ va_end(args);
+ }
+ SetLastError(dwErr);
+}
+
+VOID _Print(const CHAR *psz, ...)
+{
+ DWORD dwErr = GetLastError();
+
+ LONG nIndent = 0;
+ LONG nThread = 0;
+ if (s_nTlsIndent >= 0) {
+ nIndent = (LONG)(LONG_PTR)TlsGetValue(s_nTlsIndent);
+ }
+ if (s_nTlsThread >= 0) {
+ nThread = (LONG)(LONG_PTR)TlsGetValue(s_nTlsThread);
+ }
+
+ if (s_bLog && psz) {
+ CHAR szBuf[1024];
+ PCHAR pszBuf = szBuf;
+ PCHAR pszEnd = szBuf + ARRAYSIZE(szBuf) - 1;
+ LONG nLen = (nIndent > 0) ? (nIndent < 35 ? nIndent * 2 : 70) : 0;
+ *pszBuf++ = (CHAR)('0' + ((nThread / 100) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 10) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 1) % 10));
+ *pszBuf++ = ' ';
+ while (nLen-- > 0) {
+ *pszBuf++ = ' ';
+ }
+
+ va_list args;
+ va_start(args, psz);
+
+ while ((*pszBuf++ = *psz++) != 0 && pszBuf < pszEnd) {
+ // Copy characters.
+ }
+ *pszEnd = '\0';
+ SyelogV(SYELOG_SEVERITY_INFORMATION,
+ szBuf, args);
+
+ va_end(args);
+ }
+
+ SetLastError(dwErr);
+}
+
+VOID AssertMessage(CONST PCHAR pszMsg, CONST PCHAR pszFile, ULONG nLine)
+{
+ Syelog(SYELOG_SEVERITY_FATAL,
+ "ASSERT(%s) failed in %s, line %d.\n", pszMsg, pszFile, nLine);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// DLL module information
+//
+BOOL ThreadAttach(HMODULE hDll)
+{
+ (void)hDll;
+
+ if (s_nTlsIndent >= 0) {
+ TlsSetValue(s_nTlsIndent, (PVOID)0);
+ }
+ if (s_nTlsThread >= 0) {
+ LONG nThread = InterlockedIncrement(&s_nThreadCnt);
+ TlsSetValue(s_nTlsThread, (PVOID)(LONG_PTR)nThread);
+ }
+ return TRUE;
+}
+
+BOOL ThreadDetach(HMODULE hDll)
+{
+ (void)hDll;
+
+ if (s_nTlsIndent >= 0) {
+ TlsSetValue(s_nTlsIndent, (PVOID)0);
+ }
+ if (s_nTlsThread >= 0) {
+ TlsSetValue(s_nTlsThread, (PVOID)0);
+ }
+ return TRUE;
+}
+
+BOOL ProcessAttach(HMODULE hDll)
+{
+ s_bLog = FALSE;
+ s_nTlsIndent = TlsAlloc();
+ s_nTlsThread = TlsAlloc();
+
+ WCHAR wzExePath[MAX_PATH];
+
+ s_hInst = hDll;
+ Real_GetModuleFileNameA(s_hInst, s_szDllPath, ARRAYSIZE(s_szDllPath));
+ Real_GetModuleFileNameW(NULL, wzExePath, ARRAYSIZE(wzExePath));
+
+ SyelogOpen("trcser" DETOURS_STRINGIFY(DETOURS_BITS), SYELOG_FACILITY_APPLICATION);
+ Syelog(SYELOG_SEVERITY_INFORMATION,
+ "##################################################################\n");
+ Syelog(SYELOG_SEVERITY_INFORMATION,
+ "### %ls\n", wzExePath);
+ LONG error = AttachDetours();
+ if (error != NO_ERROR) {
+ Syelog(SYELOG_SEVERITY_FATAL, "### Error attaching detours: %d\n", error);
+ }
+
+ ThreadAttach(hDll);
+
+ s_bLog = TRUE;
+ return TRUE;
+}
+
+BOOL ProcessDetach(HMODULE hDll)
+{
+ ThreadDetach(hDll);
+ s_bLog = FALSE;
+
+ LONG error = DetachDetours();
+ if (error != NO_ERROR) {
+ Syelog(SYELOG_SEVERITY_FATAL, "### Error detaching detours: %d\n", error);
+ }
+
+ Syelog(SYELOG_SEVERITY_NOTICE, "### Closing.\n");
+ SyelogClose(FALSE);
+
+ if (s_nTlsIndent >= 0) {
+ TlsFree(s_nTlsIndent);
+ }
+ if (s_nTlsThread >= 0) {
+ TlsFree(s_nTlsThread);
+ }
+ return TRUE;
+}
+
+BOOL APIENTRY DllMain(HINSTANCE hModule, DWORD dwReason, PVOID lpReserved)
+{
+ (void)hModule;
+ (void)lpReserved;
+
+ if (DetourIsHelperProcess()) {
+ return TRUE;
+ }
+
+ switch (dwReason) {
+ case DLL_PROCESS_ATTACH:
+ DetourRestoreAfterWith();
+ return ProcessAttach(hModule);
+ case DLL_PROCESS_DETACH:
+ return ProcessDetach(hModule);
+ case DLL_THREAD_ATTACH:
+ return ThreadAttach(hModule);
+ case DLL_THREAD_DETACH:
+ return ThreadDetach(hModule);
+ }
+ return TRUE;
+}
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/traceser/trcser.rc b/ext/detours/samples/traceser/trcser.rc
new file mode 100644
index 0000000..78f9b0e
--- /dev/null
+++ b/ext/detours/samples/traceser/trcser.rc
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Version information for trcser.rc.
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include "detver.h"
+
+#define VER_INTERNALNAME_STR "trcser" DETOURS_STRINGIFY(DETOURS_BITS)
+#define VER_ORIGINALFILENAME_STR "trcsrc" DETOURS_STRINGIFY(DETOURS_BITS) ".dll"
+#define VER_FILEDESCRIPTION_STR "Detours Serial Trace Module"
+#define VER_COMPANYNAME_STR "Microsoft Corporation"
+
+#include "common.ver"
diff --git a/ext/detours/samples/tracessl/Makefile b/ext/detours/samples/tracessl/Makefile
new file mode 100644
index 0000000..8019256
--- /dev/null
+++ b/ext/detours/samples/tracessl/Makefile
@@ -0,0 +1,94 @@
+##############################################################################
+##
+## Utility to trace WinSock SSL APIs.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+LIBS=$(LIBS) kernel32.lib ws2_32.lib secur32.lib
+
+##############################################################################
+
+all: dirs \
+ $(BIND)\trcssl$(DETOURS_BITS).dll \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\trcssl$(DETOURS_BITS).bsc \
+!ENDIF
+ option
+
+##############################################################################
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+$(OBJD)\trcssl.obj : trcssl.cpp
+
+$(OBJD)\trcssl.res : trcssl.rc
+
+$(BIND)\trcssl$(DETOURS_BITS).dll : $(OBJD)\trcssl.obj $(OBJD)\trcssl.res $(DEPS)
+ cl /LD $(CFLAGS) /Fe$@ /Fd$(@R).pdb \
+ $(OBJD)\trcssl.obj $(OBJD)\trcssl.res \
+ /link $(LINKFLAGS) /subsystem:console \
+ /export:DetourFinishHelperProcess,@1,NONAME \
+ $(LIBS)
+
+$(OBJD)\trcssl$(DETOURS_BITS).bsc : $(OBJD)\trcssl.obj
+ bscmake /v /n /o $@ $(OBJD)\trcssl.sbr
+
+##############################################################################
+
+clean:
+ -del *~ test.txt 2>nul
+ -del $(BIND)\trcssl*.* 2>nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+############################################### Install non-bit-size binaries.
+
+!IF "$(DETOURS_OPTION_PROCESSOR)" != ""
+
+$(OPTD)\trcssl$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\trcssl$(DETOURS_OPTION_BITS).pdb:
+
+$(BIND)\trcssl$(DETOURS_OPTION_BITS).dll : $(OPTD)\trcssl$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\trcssl$(DETOURS_OPTION_BITS).pdb : $(OPTD)\trcssl$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+
+option: \
+ $(BIND)\trcssl$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\trcssl$(DETOURS_OPTION_BITS).pdb \
+
+!ELSE
+
+option:
+
+!ENDIF
+
+##############################################################################
+
+test: all
+ @echo -------- Logging output to test.txt ------------
+ start $(BIND)\syelogd.exe /o test.txt
+ $(BIND)\sleep5.exe 1
+ @echo -------- Should load trcssl$(DETOURS_BITS).dll dynamically using withdll.exe ------------
+ @echo.
+ @echo ** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE **
+ @echo **
+ @echo ** Close the Internet Explorer window to continue test.
+ @echo **
+ @echo ** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE **
+ @echo.
+ $(BIND)\withdll -d:$(BIND)\trcssl$(DETOURS_BITS).dll \
+ "c:\program files\Internet Explorer\iexplore.exe" "https://www.microsoft.com"
+ @echo -------- Log from syelog -------------
+ type test.txt
+
+################################################################# End of File.
diff --git a/ext/detours/samples/tracessl/trcssl.cpp b/ext/detours/samples/tracessl/trcssl.cpp
new file mode 100644
index 0000000..ffc4439
--- /dev/null
+++ b/ext/detours/samples/tracessl/trcssl.cpp
@@ -0,0 +1,1782 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (trcssl.cpp of trcssl.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#define _WIN32_WINNT 0x0400
+#define WIN32
+#define NT
+#define SECURITY_WIN32
+#define _WINSOCK_DEPRECATED_NO_WARNINGS
+
+#define DBG_TRACE 0
+
+#if _MSC_VER >= 1300
+#include <winsock2.h>
+#endif
+#include <windows.h>
+#include <security.h>
+#include <stdio.h>
+#include "detours.h"
+#include "syelog.h"
+
+#define PULONG_PTR PVOID
+#define PLONG_PTR PVOID
+#define ULONG_PTR PVOID
+#define ENUMRESNAMEPROCA PVOID
+#define ENUMRESNAMEPROCW PVOID
+#define ENUMRESLANGPROCA PVOID
+#define ENUMRESLANGPROCW PVOID
+#define ENUMRESTYPEPROCA PVOID
+#define ENUMRESTYPEPROCW PVOID
+#define STGOPTIONS PVOID
+
+//////////////////////////////////////////////////////////////////////////////
+#pragma warning(disable:4127) // Many of our asserts are constants.
+
+#define ASSERT_ALWAYS(x) \
+ do { \
+ if (!(x)) { \
+ AssertMessage(#x, __FILE__, __LINE__); \
+ DebugBreak(); \
+ } \
+ } while (0)
+
+#ifndef NDEBUG
+#define ASSERT(x) ASSERT_ALWAYS(x)
+#else
+#define ASSERT(x)
+#endif
+
+#define UNUSED(c) (c) = (c)
+
+//////////////////////////////////////////////////////////////////////////////
+static HMODULE s_hInst = NULL;
+static WCHAR s_wzDllPath[MAX_PATH];
+
+VOID _PrintDump(SOCKET socket, PCHAR pszData, INT cbData);
+VOID _PrintEnter(PCSTR psz, ...);
+VOID _PrintExit(PCSTR psz, ...);
+VOID _Print(PCSTR psz, ...);
+
+VOID AssertMessage(CONST PCHAR pszMsg, CONST PCHAR pszFile, ULONG nLine);
+
+//////////////////////////////////////////////////////////////////////////////
+//
+extern "C" {
+ HANDLE (WINAPI * Real_CreateFileW)(LPCWSTR a0,
+ DWORD a1,
+ DWORD a2,
+ LPSECURITY_ATTRIBUTES a3,
+ DWORD a4,
+ DWORD a5,
+ HANDLE a6)
+ = CreateFileW;
+
+ BOOL (WINAPI * Real_WriteFile)(HANDLE hFile,
+ LPCVOID lpBuffer,
+ DWORD nNumberOfBytesToWrite,
+ LPDWORD lpNumberOfBytesWritten,
+ LPOVERLAPPED lpOverlapped)
+ = WriteFile;
+
+ BOOL (WINAPI * Real_FlushFileBuffers)(HANDLE hFile)
+ = FlushFileBuffers;
+
+ BOOL (WINAPI * Real_CloseHandle)(HANDLE hObject)
+ = CloseHandle;
+
+ BOOL (WINAPI * Real_WaitNamedPipeW)(LPCWSTR lpNamedPipeName, DWORD nTimeOut)
+ = WaitNamedPipeW;
+
+ BOOL (WINAPI * Real_SetNamedPipeHandleState)(HANDLE hNamedPipe,
+ LPDWORD lpMode,
+ LPDWORD lpMaxCollectionCount,
+ LPDWORD lpCollectDataTimeout)
+ = SetNamedPipeHandleState;
+
+ DWORD (WINAPI * Real_GetCurrentProcessId)(VOID)
+ = GetCurrentProcessId;
+
+ VOID (WINAPI * Real_GetSystemTimeAsFileTime)(LPFILETIME lpSystemTimeAsFileTime)
+ = GetSystemTimeAsFileTime;
+
+ VOID (WINAPI * Real_InitializeCriticalSection)(LPCRITICAL_SECTION lpSection)
+ = InitializeCriticalSection;
+
+ VOID (WINAPI * Real_EnterCriticalSection)(LPCRITICAL_SECTION lpSection)
+ = EnterCriticalSection;
+
+ VOID (WINAPI * Real_LeaveCriticalSection)(LPCRITICAL_SECTION lpSection)
+ = LeaveCriticalSection;
+}
+
+DWORD (WINAPI * Real_GetModuleFileNameW)(HMODULE a0,
+ LPWSTR a1,
+ DWORD a2)
+ = GetModuleFileNameW;
+
+BOOL (WINAPI * Real_CreateProcessW)(LPCWSTR a0,
+ LPWSTR a1,
+ LPSECURITY_ATTRIBUTES a2,
+ LPSECURITY_ATTRIBUTES a3,
+ BOOL a4,
+ DWORD a5,
+ LPVOID a6,
+ LPCWSTR a7,
+ LPSTARTUPINFOW a8,
+ LPPROCESS_INFORMATION a9)
+ = CreateProcessW;
+
+#if _MSC_VER < 1300
+SOCKET (WINAPI * Real_WSAAccept)(SOCKET a0,
+ sockaddr* a1,
+ LPINT a2,
+ LPCONDITIONPROC a3,
+ DWORD a4)
+ = WSAAccept;
+#else
+SOCKET (WINAPI * Real_WSAAccept)(SOCKET a0,
+ sockaddr* a1,
+ LPINT a2,
+ LPCONDITIONPROC a3,
+ DWORD_PTR a4)
+ = WSAAccept;
+#endif
+
+INT (WINAPI * Real_WSAAddressToStringA)(LPSOCKADDR a0,
+ DWORD a1,
+ LPWSAPROTOCOL_INFOA a2,
+ LPSTR a3,
+ LPDWORD a4)
+ = WSAAddressToStringA;
+
+INT (WINAPI * Real_WSAAddressToStringW)(LPSOCKADDR a0,
+ DWORD a1,
+ LPWSAPROTOCOL_INFOW a2,
+ LPWSTR a3,
+ LPDWORD a4)
+ = WSAAddressToStringW;
+
+HANDLE (WINAPI * Real_WSAAsyncGetHostByAddr)(HWND a0,
+ u_int a1,
+ CONST char* a2,
+ int a3,
+ int a4,
+ char* a5,
+ int a6)
+ = WSAAsyncGetHostByAddr;
+
+HANDLE (WINAPI * Real_WSAAsyncGetHostByName)(HWND a0,
+ u_int a1,
+ CONST char* a2,
+ char* a3,
+ int a4)
+ = WSAAsyncGetHostByName;
+
+HANDLE (WINAPI * Real_WSAAsyncGetProtoByName)(HWND a0,
+ u_int a1,
+ CONST char* a2,
+ char* a3,
+ int a4)
+ = WSAAsyncGetProtoByName;
+
+HANDLE (WINAPI * Real_WSAAsyncGetProtoByNumber)(HWND a0,
+ u_int a1,
+ int a2,
+ char* a3,
+ int a4)
+ = WSAAsyncGetProtoByNumber;
+
+HANDLE (WINAPI * Real_WSAAsyncGetServByName)(HWND a0,
+ u_int a1,
+ CONST char* a2,
+ CONST char* a3,
+ char* a4,
+ int a5)
+ = WSAAsyncGetServByName;
+
+HANDLE (WINAPI * Real_WSAAsyncGetServByPort)(HWND a0,
+ u_int a1,
+ int a2,
+ CONST char* a3,
+ char* a4,
+ int a5)
+ = WSAAsyncGetServByPort;
+
+int (WINAPI * Real_WSACancelAsyncRequest)(HANDLE a0)
+ = WSACancelAsyncRequest;
+
+int (WINAPI * Real_WSACancelBlockingCall)(void)
+ = WSACancelBlockingCall;
+
+int (WINAPI * Real_WSACleanup)(void)
+ = WSACleanup;
+
+BOOL (WINAPI * Real_WSACloseEvent)(HANDLE a0)
+ = WSACloseEvent;
+
+int (WINAPI * Real_WSAConnect)(SOCKET a0,
+ CONST sockaddr* a1,
+ int a2,
+ LPWSABUF a3,
+ LPWSABUF a4,
+ LPQOS a5,
+ LPQOS a6)
+ = WSAConnect;
+
+HANDLE (WINAPI * Real_WSACreateEvent)(void)
+ = WSACreateEvent;
+
+int (WINAPI * Real_WSADuplicateSocketA)(SOCKET a0,
+ DWORD a1,
+ LPWSAPROTOCOL_INFOA a2)
+ = WSADuplicateSocketA;
+
+int (WINAPI * Real_WSADuplicateSocketW)(SOCKET a0,
+ DWORD a1,
+ LPWSAPROTOCOL_INFOW a2)
+ = WSADuplicateSocketW;
+
+INT (WINAPI * Real_WSAEnumNameSpaceProvidersA)(LPDWORD a0,
+ LPWSANAMESPACE_INFOA a1)
+ = WSAEnumNameSpaceProvidersA;
+
+INT (WINAPI * Real_WSAEnumNameSpaceProvidersW)(LPDWORD a0,
+ LPWSANAMESPACE_INFOW a1)
+ = WSAEnumNameSpaceProvidersW;
+
+int (WINAPI * Real_WSAEnumNetworkEvents)(SOCKET a0,
+ HANDLE a1,
+ LPWSANETWORKEVENTS a2)
+ = WSAEnumNetworkEvents;
+
+int (WINAPI * Real_WSAEnumProtocolsA)(LPINT a0,
+ LPWSAPROTOCOL_INFOA a1,
+ LPDWORD a2)
+ = WSAEnumProtocolsA;
+
+int (WINAPI * Real_WSAEnumProtocolsW)(LPINT a0,
+ LPWSAPROTOCOL_INFOW a1,
+ LPDWORD a2)
+ = WSAEnumProtocolsW;
+
+BOOL (WINAPI * Real_WSAGetOverlappedResult)(SOCKET a0,
+ LPWSAOVERLAPPED a1,
+ LPDWORD a2,
+ BOOL a3,
+ LPDWORD a4)
+ = WSAGetOverlappedResult;
+
+BOOL (WINAPI * Real_WSAIsBlocking)(void)
+ = WSAIsBlocking;
+
+SOCKET (WINAPI * Real_WSAJoinLeaf)(SOCKET a0,
+ CONST sockaddr* a1,
+ int a2,
+ LPWSABUF a3,
+ LPWSABUF a4,
+ LPQOS a5,
+ LPQOS a6,
+ DWORD a7)
+ = WSAJoinLeaf;
+
+INT (WINAPI * Real_WSAProviderConfigChange)(LPHANDLE a0,
+ LPWSAOVERLAPPED a1,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a2)
+ = WSAProviderConfigChange;
+
+int (WINAPI * Real_WSARecv)(SOCKET a0,
+ LPWSABUF a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPWSAOVERLAPPED a5,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a6)
+ = WSARecv;
+
+int (WINAPI * Real_WSARecvDisconnect)(SOCKET a0,
+ LPWSABUF a1)
+ = WSARecvDisconnect;
+
+int (WINAPI * Real_WSARecvFrom)(SOCKET a0,
+ LPWSABUF a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ sockaddr* a5,
+ LPINT a6,
+ LPWSAOVERLAPPED a7,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a8)
+ = WSARecvFrom;
+
+BOOL (WINAPI * Real_WSAResetEvent)(HANDLE a0)
+ = WSAResetEvent;
+
+int (WINAPI * Real_WSASend)(SOCKET a0,
+ LPWSABUF a1,
+ DWORD a2,
+ LPDWORD a3,
+ DWORD a4,
+ LPWSAOVERLAPPED a5,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a6)
+ = WSASend;
+
+int (WINAPI * Real_WSASendDisconnect)(SOCKET a0,
+ LPWSABUF a1)
+ = WSASendDisconnect;
+
+int (WINAPI * Real_WSASendTo)(SOCKET a0,
+ LPWSABUF a1,
+ DWORD a2,
+ LPDWORD a3,
+ DWORD a4,
+ CONST sockaddr* a5,
+ int a6,
+ LPWSAOVERLAPPED a7,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a8)
+ = WSASendTo;
+
+INT (WINAPI * Real_WSAStringToAddressA)(LPSTR a0,
+ INT a1,
+ LPWSAPROTOCOL_INFOA a2,
+ LPSOCKADDR a3,
+ LPINT a4)
+ = WSAStringToAddressA;
+
+INT (WINAPI * Real_WSAStringToAddressW)(LPWSTR a0,
+ INT a1,
+ LPWSAPROTOCOL_INFOW a2,
+ LPSOCKADDR a3,
+ LPINT a4)
+ = WSAStringToAddressW;
+
+DWORD (WINAPI * Real_WSAWaitForMultipleEvents)(DWORD a0,
+ CONST HANDLE * a1,
+ BOOL a2,
+ DWORD a3,
+ BOOL a4)
+ = WSAWaitForMultipleEvents;
+
+SOCKET (WINAPI * Real_accept)(SOCKET a0,
+ sockaddr* a1,
+ int* a2)
+ = accept;
+
+int (WINAPI * Real_closesocket)(SOCKET a0)
+ = closesocket;
+
+int (WINAPI * Real_connect)(SOCKET a0,
+ CONST sockaddr* a1,
+ int a2)
+ = connect;
+
+int (WINAPI * Real_listen)(SOCKET a0,
+ int a1)
+ = listen;
+
+int (WINAPI * Real_recv)(SOCKET a0,
+ char* a1,
+ int a2,
+ int a3)
+ = recv;
+
+int (WINAPI * Real_recvfrom)(SOCKET a0,
+ char* a1,
+ int a2,
+ int a3,
+ sockaddr* a4,
+ int* a5)
+ = recvfrom;
+
+int (WINAPI * Real_send)(SOCKET a0,
+ CONST char* a1,
+ int a2,
+ int a3)
+ = send;
+
+int (WINAPI * Real_sendto)(SOCKET a0,
+ CONST char* a1,
+ int a2,
+ int a3,
+ CONST sockaddr* a4,
+ int a5)
+ = sendto;
+
+int (WINAPI * Real_shutdown)(SOCKET a0,
+ int a1)
+ = shutdown;
+
+SECURITY_STATUS (SEC_ENTRY * Real_EncryptMessage)( PCtxtHandle phContext,
+ unsigned long fQOP,
+ PSecBufferDesc pMessage,
+ unsigned long MessageSeqNo)
+ = EncryptMessage;
+
+SECURITY_STATUS (SEC_ENTRY * Real_DecryptMessage)( PCtxtHandle phContext,
+ PSecBufferDesc pMessage,
+ unsigned long MessageSeqNo,
+ unsigned long * pfQOP)
+ = DecryptMessage;
+
+//////////////////////////////////////////////////////////////////////////////
+// Detours
+//
+BOOL WINAPI Mine_CreateProcessW(LPCWSTR lpApplicationName,
+ LPWSTR lpCommandLine,
+ LPSECURITY_ATTRIBUTES lpProcessAttributes,
+ LPSECURITY_ATTRIBUTES lpThreadAttributes,
+ BOOL bInheritHandles,
+ DWORD dwCreationFlags,
+ LPVOID lpEnvironment,
+ LPCWSTR lpCurrentDirectory,
+ LPSTARTUPINFOW lpStartupInfo,
+ LPPROCESS_INFORMATION lpProcessInformation)
+{
+ _PrintEnter("CreateProcessW(%ls,%ls,%p,%p,%x,%x,%p,%ls,%p,%p)\n",
+ lpApplicationName,
+ lpCommandLine,
+ lpProcessAttributes,
+ lpThreadAttributes,
+ bInheritHandles,
+ dwCreationFlags,
+ lpEnvironment,
+ lpCurrentDirectory,
+ lpStartupInfo,
+ lpProcessInformation);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CreateProcessW(lpApplicationName,
+ lpCommandLine,
+ lpProcessAttributes,
+ lpThreadAttributes,
+ bInheritHandles,
+ dwCreationFlags,
+ lpEnvironment,
+ lpCurrentDirectory,
+ lpStartupInfo,
+ lpProcessInformation);
+ } __finally {
+ _PrintExit("CreateProcessW(,,,,,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+#if _MSC_VER < 1300
+SOCKET WINAPI Mine_WSAAccept(SOCKET a0,
+ sockaddr* a1,
+ LPINT a2,
+ LPCONDITIONPROC a3,
+ DWORD a4)
+#else
+SOCKET WINAPI Mine_WSAAccept(SOCKET a0,
+ sockaddr* a1,
+ LPINT a2,
+ LPCONDITIONPROC a3,
+ DWORD_PTR a4)
+#endif
+{
+
+ SOCKET rv = 0;
+ __try {
+ rv = Real_WSAAccept(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintEnter("%p: WSAAccept(,%p,%p,%p,%p) -> %p\n", a0, a1, a2, a3, a4, rv);
+ _PrintExit(NULL);
+ };
+ return rv;
+}
+
+INT WINAPI Mine_WSAAddressToStringA(LPSOCKADDR a0,
+ DWORD a1,
+ LPWSAPROTOCOL_INFOA a2,
+ LPSTR a3,
+ LPDWORD a4)
+{
+ _PrintEnter("WSAAddressToStringA(%p,%x,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSAAddressToStringA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WSAAddressToStringA(,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+INT WINAPI Mine_WSAAddressToStringW(LPSOCKADDR a0,
+ DWORD a1,
+ LPWSAPROTOCOL_INFOW a2,
+ LPWSTR a3,
+ LPDWORD a4)
+{
+ _PrintEnter("WSAAddressToStringW(%p,%x,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSAAddressToStringW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WSAAddressToStringW(,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HANDLE WINAPI Mine_WSAAsyncGetHostByAddr(HWND a0,
+ u_int a1,
+ char* a2,
+ int a3,
+ int a4,
+ char* a5,
+ int a6)
+{
+ _PrintEnter("WSAAsyncGetHostByAddr(%p,%x,%p,%x,%x,%p,%x)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_WSAAsyncGetHostByAddr(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("WSAAsyncGetHostByAddr(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE WINAPI Mine_WSAAsyncGetHostByName(HWND a0,
+ u_int a1,
+ char* a2,
+ char* a3,
+ int a4)
+{
+ _PrintEnter("WSAAsyncGetHostByName(%p,%x,%p,%p,%x)\n", a0, a1, a2, a3, a4);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_WSAAsyncGetHostByName(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WSAAsyncGetHostByName(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE WINAPI Mine_WSAAsyncGetProtoByName(HWND a0,
+ u_int a1,
+ char* a2,
+ char* a3,
+ int a4)
+{
+ _PrintEnter("WSAAsyncGetProtoByName(%p,%x,%p,%p,%x)\n", a0, a1, a2, a3, a4);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_WSAAsyncGetProtoByName(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WSAAsyncGetProtoByName(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE WINAPI Mine_WSAAsyncGetProtoByNumber(HWND a0,
+ u_int a1,
+ int a2,
+ char* a3,
+ int a4)
+{
+ _PrintEnter("WSAAsyncGetProtoByNumber(%p,%x,%p,%p,%x)\n", a0, a1, a2, a3, a4);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_WSAAsyncGetProtoByNumber(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WSAAsyncGetProtoByNumber(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE WINAPI Mine_WSAAsyncGetServByName(HWND a0,
+ u_int a1,
+ char* a2,
+ char* a3,
+ char* a4,
+ int a5)
+{
+ _PrintEnter("WSAAsyncGetServByName(%p,%x,%p,%p,%p,%x)\n", a0, a1, a2, a3, a4, a5);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_WSAAsyncGetServByName(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("WSAAsyncGetServByName(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE WINAPI Mine_WSAAsyncGetServByPort(HWND a0,
+ u_int a1,
+ int a2,
+ char* a3,
+ char* a4,
+ int a5)
+{
+ _PrintEnter("WSAAsyncGetServByPort(%p,%x,%x,%p,%p,%x)\n", a0, a1, a2, a3, a4, a5);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_WSAAsyncGetServByPort(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("WSAAsyncGetServByPort(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSACancelAsyncRequest(HANDLE a0)
+{
+ _PrintEnter("WSACancelAsyncRequest(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSACancelAsyncRequest(a0);
+ } __finally {
+ _PrintExit("WSACancelAsyncRequest() -> %x\n", rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSACancelBlockingCall(void)
+{
+ _PrintEnter("WSACancelBlockingCall()\n");
+
+ int rv = 0;
+ __try {
+ rv = Real_WSACancelBlockingCall();
+ } __finally {
+ _PrintExit("WSACancelBlockingCall() -> %x\n", rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSACleanup(void)
+{
+ _PrintEnter("WSACleanup()\n");
+
+ int rv = 0;
+ __try {
+ rv = Real_WSACleanup();
+ } __finally {
+ _PrintExit("WSACleanup() -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_WSACloseEvent(HANDLE a0)
+{
+ _PrintEnter("WSACloseEvent(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WSACloseEvent(a0);
+ } __finally {
+ _PrintExit("WSACloseEvent() -> %x\n", rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSAConnect(SOCKET a0,
+ sockaddr* a1,
+ int a2,
+ LPWSABUF a3,
+ LPWSABUF a4,
+ LPQOS a5,
+ LPQOS a6)
+{
+ int rv = 0;
+ __try {
+ rv = Real_WSAConnect(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintEnter("%p: WSAConnect(,%p,%x,%p,%p,%p,%p) -> %x\n",
+ a0, a1, a2, a3, a4, a5, a6, rv);
+ _PrintExit(NULL);
+ };
+ return rv;
+}
+
+HANDLE WINAPI Mine_WSACreateEvent(void)
+{
+ _PrintEnter("WSACreateEvent()\n");
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_WSACreateEvent();
+ } __finally {
+ _PrintExit("WSACreateEvent() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSADuplicateSocketA(SOCKET a0,
+ DWORD a1,
+ LPWSAPROTOCOL_INFOA a2)
+{
+ _PrintEnter("%p: WSADuplicateSocketA(,%x,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSADuplicateSocketA(a0, a1, a2);
+ } __finally {
+ _PrintExit("%p: WSADuplicateSocketA(,,) -> %x\n", a0, rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSADuplicateSocketW(SOCKET a0,
+ DWORD a1,
+ LPWSAPROTOCOL_INFOW a2)
+{
+ _PrintEnter("%p: WSADuplicateSocketW(,%x,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSADuplicateSocketW(a0, a1, a2);
+ } __finally {
+ _PrintExit("%p: WSADuplicateSocketW(,,) -> %x\n", a0, rv);
+ };
+ return rv;
+}
+
+INT WINAPI Mine_WSAEnumNameSpaceProvidersA(LPDWORD a0,
+ LPWSANAMESPACE_INFOA a1)
+{
+ _PrintEnter("WSAEnumNameSpaceProvidersA(%p,%p)\n", a0, a1);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSAEnumNameSpaceProvidersA(a0, a1);
+ } __finally {
+ _PrintExit("WSAEnumNameSpaceProvidersA(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+INT WINAPI Mine_WSAEnumNameSpaceProvidersW(LPDWORD a0,
+ LPWSANAMESPACE_INFOW a1)
+{
+ _PrintEnter("WSAEnumNameSpaceProvidersW(%p,%p)\n", a0, a1);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSAEnumNameSpaceProvidersW(a0, a1);
+ } __finally {
+ _PrintExit("WSAEnumNameSpaceProvidersW(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSAEnumNetworkEvents(SOCKET a0,
+ HANDLE a1,
+ LPWSANETWORKEVENTS a2)
+{
+ _PrintEnter("%p: WSAEnumNetworkEvents(,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSAEnumNetworkEvents(a0, a1, a2);
+ } __finally {
+ _PrintExit("%p: WSAEnumNetworkEvents(,,) -> %x\n", a0, rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSAEnumProtocolsA(LPINT a0,
+ LPWSAPROTOCOL_INFOA a1,
+ LPDWORD a2)
+{
+ _PrintEnter("WSAEnumProtocolsA(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSAEnumProtocolsA(a0, a1, a2);
+ } __finally {
+ _PrintExit("WSAEnumProtocolsA(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSAEnumProtocolsW(LPINT a0,
+ LPWSAPROTOCOL_INFOW a1,
+ LPDWORD a2)
+{
+ _PrintEnter("WSAEnumProtocolsW(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSAEnumProtocolsW(a0, a1, a2);
+ } __finally {
+ _PrintExit("WSAEnumProtocolsW(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_WSAGetOverlappedResult(SOCKET a0,
+ LPWSAOVERLAPPED a1,
+ LPDWORD a2,
+ BOOL a3,
+ LPDWORD a4)
+{
+ _PrintEnter("%p: WSAGetOverlappedResult(,%p,%p,%x,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WSAGetOverlappedResult(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("%p: WSAGetOverlappedResult(,,,,) -> %x\n", a0, rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_WSAIsBlocking(void)
+{
+ _PrintEnter("WSAIsBlocking()\n");
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WSAIsBlocking();
+ } __finally {
+ _PrintExit("WSAIsBlocking() -> %x\n", rv);
+ };
+ return rv;
+}
+
+SOCKET WINAPI Mine_WSAJoinLeaf(SOCKET a0,
+ sockaddr* a1,
+ int a2,
+ LPWSABUF a3,
+ LPWSABUF a4,
+ LPQOS a5,
+ LPQOS a6,
+ DWORD a7)
+{
+ _PrintEnter("%p: WSAJoinLeaf(,%p,%x,%p,%p,%p,%p,%x)\n", a0, a1, a2, a3, a4, a5, a6, a7);
+
+ SOCKET rv = 0;
+ __try {
+ rv = Real_WSAJoinLeaf(a0, a1, a2, a3, a4, a5, a6, a7);
+ } __finally {
+ _PrintExit("%p: WSAJoinLeaf(,,,,,,,) -> %p\n", a0, rv);
+ };
+ return rv;
+}
+
+INT WINAPI Mine_WSAProviderConfigChange(LPHANDLE a0,
+ LPWSAOVERLAPPED a1,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a2)
+{
+ _PrintEnter("WSAProviderConfigChange(%p,%p,%p)\n", a0, a1, a2);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSAProviderConfigChange(a0, a1, a2);
+ } __finally {
+ _PrintExit("WSAProviderConfigChange(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSARecv(SOCKET a0,
+ LPWSABUF a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPWSAOVERLAPPED a5,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a6)
+{
+ int rv = -1;
+ __try {
+ rv = Real_WSARecv(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ if (rv == 0) {
+ _PrintEnter("%p: WSARecv(,%p,%x,%p,%p,%p,%p)\n",
+ a0, a1, a2, a3, a4, a5, a6);
+#if 0
+ _PrintDump(a0, a1[0].buf, a1[0].len < *a3 ? a1[0].len : *a3);
+#endif
+ _PrintExit("%p: WSARecv(,,,,,,) -> %x\n", a0, rv);
+ }
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSARecvDisconnect(SOCKET a0,
+ LPWSABUF a1)
+{
+ _PrintEnter("%p: WSARecvDisconnect(,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSARecvDisconnect(a0, a1);
+ } __finally {
+ _PrintExit("%p: WSARecvDisconnect(,) -> %x\n", a0, rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSARecvFrom(SOCKET a0,
+ LPWSABUF a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ sockaddr* a5,
+ LPINT a6,
+ LPWSAOVERLAPPED a7,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a8)
+{
+ _PrintEnter("%p: WSARecvFrom(,%p,%x,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSARecvFrom(a0, a1, a2, a3, a4, a5, a6, a7, a8);
+ } __finally {
+ _PrintExit("%p: WSARecvFrom(,,,,,,,,) -> %x\n", a0, rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_WSAResetEvent(HANDLE a0)
+{
+ _PrintEnter("WSAResetEvent(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WSAResetEvent(a0);
+ } __finally {
+ _PrintExit("WSAResetEvent() -> %x\n", rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSASend(SOCKET a0,
+ LPWSABUF a1,
+ DWORD a2,
+ LPDWORD a3,
+ DWORD a4,
+ LPWSAOVERLAPPED a5,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a6)
+{
+ _PrintEnter("%p: WSASend(,%p,%x,%p,%x,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSASend(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("%p: WSASend(,,,,,,) -> %x\n", a0, rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSASendDisconnect(SOCKET a0,
+ LPWSABUF a1)
+{
+ _PrintEnter("%p: WSASendDisconnect(,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSASendDisconnect(a0, a1);
+ } __finally {
+ _PrintExit("%p: WSASendDisconnect(,) -> %x\n", a0, rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSASendTo(SOCKET a0,
+ LPWSABUF a1,
+ DWORD a2,
+ LPDWORD a3,
+ DWORD a4,
+ sockaddr* a5,
+ int a6,
+ LPWSAOVERLAPPED a7,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a8)
+{
+ _PrintEnter("%p: WSASendTo(,%p,%x,%p,%x,%p,%x,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSASendTo(a0, a1, a2, a3, a4, a5, a6, a7, a8);
+ } __finally {
+ _PrintExit("%p: WSASendTo(,,,,,,,,) -> %x\n", a0, rv);
+ };
+ return rv;
+}
+
+INT WINAPI Mine_WSAStringToAddressA(LPSTR a0,
+ INT a1,
+ LPWSAPROTOCOL_INFOA a2,
+ LPSOCKADDR a3,
+ LPINT a4)
+{
+ _PrintEnter("WSAStringToAddressA(%p,%x,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSAStringToAddressA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WSAStringToAddressA(,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+INT WINAPI Mine_WSAStringToAddressW(LPWSTR a0,
+ INT a1,
+ LPWSAPROTOCOL_INFOW a2,
+ LPSOCKADDR a3,
+ LPINT a4)
+{
+ _PrintEnter("WSAStringToAddressW(%p,%x,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSAStringToAddressW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WSAStringToAddressW(,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+DWORD WINAPI Mine_WSAWaitForMultipleEvents(DWORD a0,
+ void** a1,
+ BOOL a2,
+ DWORD a3,
+ BOOL a4)
+{
+ _PrintEnter("WSAWaitForMultipleEvents(%x,%p,%x,%x,%x)\n", a0, a1, a2, a3, a4);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_WSAWaitForMultipleEvents(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WSAWaitForMultipleEvents(,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+SOCKET WINAPI Mine_accept(SOCKET a0,
+ sockaddr* a1,
+ int* a2)
+{
+ SOCKET rv = 0;
+ __try {
+ rv = Real_accept(a0, a1, a2);
+ } __finally {
+ WCHAR wzAddress[512] = L"";
+ int err = WSAGetLastError();
+ if (rv != INVALID_SOCKET) {
+ DWORD nAddress = ARRAYSIZE(wzAddress);
+ if (Real_WSAAddressToStringW(a1, *a2, NULL, wzAddress, &nAddress) != 0) {
+ wzAddress[0] = 0;
+ }
+ }
+ WSASetLastError(err);
+
+ if (wzAddress[0]) {
+ _PrintEnter("%p: accept(,%ls,%p) -> %p\n", a0, wzAddress, a2, rv);
+ }
+ else {
+ _PrintEnter("%p: accept(,%p,%p) -> %p\n", a0, a1, a2, rv);
+ }
+ _PrintExit(NULL);
+ };
+ return rv;
+}
+
+int WINAPI Mine_closesocket(SOCKET a0)
+{
+ int rv = 0;
+ __try {
+ rv = Real_closesocket(a0);
+ } __finally {
+ _PrintEnter("%p: closesocket() -> %x\n", a0, rv);
+ _PrintExit(NULL);
+ };
+ return rv;
+}
+
+int WINAPI Mine_connect(SOCKET a0,
+ sockaddr* name,
+ int namelen)
+{
+ int rv = 0;
+ __try {
+ rv = Real_connect(a0, name, namelen);
+ } __finally {
+ WCHAR wzAddress[512];
+ DWORD nAddress = ARRAYSIZE(wzAddress);
+ int err = WSAGetLastError();
+ if (Real_WSAAddressToStringW(name, namelen, NULL, wzAddress, &nAddress) == 0) {
+ if (rv == SOCKET_ERROR) {
+ _PrintEnter("%p: connect(,%p:%ls,%x) -> %x [%d]\n",
+ a0, name, wzAddress, namelen, rv, err);
+ }
+ else {
+ _PrintEnter("%p: connect(,%p:%ls,%x) -> %x\n",
+ a0, name, wzAddress, namelen, rv);
+ }
+ }
+ else {
+ if (rv == SOCKET_ERROR) {
+ _PrintEnter("%p: connect(,%p,%x) -> %x [%d]\n",
+ a0, name, namelen, rv, err);
+ }
+ else {
+ _PrintEnter("%p: connect(,%p,%x) -> %x\n",
+ a0, name, namelen, rv);
+ }
+ }
+ WSASetLastError(err);
+ _PrintExit(NULL);
+ };
+ return rv;
+}
+
+int WINAPI Mine_listen(SOCKET a0,
+ int a1)
+{
+ _PrintEnter("%p: listen(,%x)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_listen(a0, a1);
+ } __finally {
+ _PrintExit("%p: listen(,) -> %x\n", a0, rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_recv(SOCKET a0,
+ char* a1,
+ int a2,
+ int a3)
+{
+ _PrintEnter("%p: recv(,%p,%x,%x)\n", a0, a1, a2, a3);
+
+ int rv = 0;
+ __try {
+ rv = Real_recv(a0, a1, a2, a3);
+#if 0
+ _PrintDump(a0, a1, rv);
+#endif
+ } __finally {
+ _PrintExit("%p: recv(,%p,,) -> %x\n", a0, a1, rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_recvfrom(SOCKET a0,
+ char* a1,
+ int a2,
+ int a3,
+ sockaddr* a4,
+ int* a5)
+{
+ _PrintEnter("%p: recvfrom(,%p,%x,%x,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ int rv = 0;
+ __try {
+ rv = Real_recvfrom(a0, a1, a2, a3, a4, a5);
+#if 0
+ _PrintDump(a0, a1, rv);
+#endif
+ } __finally {
+ _PrintExit("%p: recvfrom(,%p,,,,) -> %x\n", a0, a1, rv);
+ };
+ return rv;
+}
+
+VOID _PrintDump(SOCKET socket, PCHAR pszData, INT cbData)
+{
+ if (pszData && cbData > 0) {
+ CHAR szBuffer[256];
+ PCHAR pszBuffer = szBuffer;
+ INT cbBuffer = 0;
+ INT nLines = 0;
+
+ while (cbData > 0) {
+#if ABBREVIATE
+ if (nLines > 20) {
+ *pszBuffer++ = '.';
+ *pszBuffer++ = '.';
+ *pszBuffer++ = '.';
+ cbBuffer += 3;
+ break;
+ }
+#endif
+
+ if (*pszData == '\t') {
+ *pszBuffer++ = '\\';
+ *pszBuffer++ = 't';
+ cbBuffer += 2;
+ pszData++;
+ cbData--;
+ continue;
+ }
+ if (*pszData == '\r') {
+ *pszBuffer++ = '\\';
+ *pszBuffer++ = 'r';
+ cbBuffer += 2;
+ pszData++;
+ cbData--;
+ continue;
+ }
+ else if (*pszData == '\n') {
+ *pszBuffer++ = '\\';
+ *pszBuffer++ = 'n';
+ cbBuffer += 2;
+ *pszBuffer++ = '\0';
+ _Print("%p: %hs\n", socket, szBuffer);
+ nLines++;
+ pszBuffer = szBuffer;
+ cbBuffer = 0;
+ pszData++;
+ cbData--;
+ continue;
+ }
+ else if (cbBuffer >= 80) {
+ *pszBuffer++ = '\0';
+ _Print("%p: %hs\n", socket, szBuffer);
+ nLines++;
+ pszBuffer = szBuffer;
+ cbBuffer = 0;
+ }
+
+ if (*pszData < ' ' || *pszData >= 127) {
+ *pszBuffer++ = '\\';
+ *pszBuffer++ = 'x';
+ *pszBuffer++ = "0123456789ABCDEF"[(*pszData & 0xf0) >> 4];
+ *pszBuffer++ = "0123456789ABCDEF"[(*pszData & 0x0f)];
+ cbBuffer += 4;
+ }
+ else {
+ *pszBuffer++ = *pszData;
+ }
+ cbBuffer++;
+ pszData++;
+ cbData--;
+ }
+
+ if (cbBuffer > 0) {
+ *pszBuffer++ = '\0';
+ _Print("%p: %hs\n", socket, szBuffer);
+ }
+ }
+}
+
+int WINAPI Mine_send(SOCKET a0,
+ char* a1,
+ int a2,
+ int a3)
+{
+ _PrintEnter("%p: send(,%p,%x,%x)\n", a0, a1, a2, a3);
+#if 0
+ _PrintDump(a0, a1, a2);
+#endif
+
+ int rv = 0;
+ __try {
+ rv = Real_send(a0, a1, a2, a3);
+ } __finally {
+ if (rv == SOCKET_ERROR) {
+ int err = WSAGetLastError();
+ _PrintExit("%p: send(,,,) -> %x (%d)\n", a0, rv, err);
+ }
+ else {
+ _PrintExit("%p: send(,,,) -> %x\n", a0, rv);
+ }
+ };
+ return rv;
+}
+
+int WINAPI Mine_sendto(SOCKET a0,
+ char* a1,
+ int a2,
+ int a3,
+ sockaddr* a4,
+ int a5)
+{
+ _PrintEnter("%p: sendto(,%s,%x,%x,%p,%x)\n", a0, a1, a2, a3, a4, a5);
+
+ int rv = 0;
+ __try {
+ rv = Real_sendto(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("%p: sendto(%ls,,,,,) -> %x\n", a0, a1, rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_shutdown(SOCKET a0,
+ int a1)
+{
+ _PrintEnter("%p: shutdown(,%x)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_shutdown(a0, a1);
+ } __finally {
+ _PrintExit("%p: shutdown(,) -> %x\n", a0, rv);
+ };
+ return rv;
+}
+
+SECURITY_STATUS SEC_ENTRY Mine_EncryptMessage( PCtxtHandle phContext,
+ unsigned long fQOP,
+ PSecBufferDesc pMessage,
+ unsigned long MessageSeqNo)
+{
+ _PrintEnter("%p: EncryptMessage(%x,%x,%x)\n", phContext, fQOP, pMessage, MessageSeqNo);
+
+ SECURITY_STATUS rv = 0;
+ __try {
+ if (pMessage != NULL) {
+ for (unsigned b = 0; b < pMessage->cBuffers; b++) {
+ PSecBuffer pBuffer = &pMessage->pBuffers[b];
+ if ((pBuffer->BufferType & 0xfff) == 1) {
+ _Print("%p: Type=%08x Size=%d\n", phContext,
+ pBuffer->BufferType,
+ pBuffer->cbBuffer);
+ _PrintDump((SOCKET)phContext, (PCHAR)pBuffer->pvBuffer, pBuffer->cbBuffer);
+ }
+ }
+ }
+ rv = Real_EncryptMessage(phContext, fQOP, pMessage, MessageSeqNo);
+ } __finally {
+ _PrintExit("%p: EncryptMessage(,) -> %x\n", phContext, rv);
+ };
+ return rv;
+}
+
+SECURITY_STATUS SEC_ENTRY Mine_DecryptMessage( PCtxtHandle phContext,
+ PSecBufferDesc pMessage,
+ unsigned long MessageSeqNo,
+ unsigned long * pfQOP)
+{
+ _PrintEnter("%p: DecryptMessage(%x,%x,%x)\n", phContext, pMessage, MessageSeqNo, pfQOP);
+
+ SECURITY_STATUS rv = 0;
+ __try {
+ rv = Real_DecryptMessage(phContext, pMessage, MessageSeqNo, pfQOP);
+ for (unsigned b = 0; b < pMessage->cBuffers; b++) {
+ PSecBuffer pBuffer = &pMessage->pBuffers[b];
+ if ((pBuffer->BufferType & 0xfff) == 1) {
+ _Print("%p: Type=%08x Size=%d\n", phContext,
+ pBuffer->BufferType,
+ pBuffer->cbBuffer);
+ _PrintDump((SOCKET)phContext, (PCHAR)pBuffer->pvBuffer, pBuffer->cbBuffer);
+ }
+ }
+ } __finally {
+ _PrintExit("%p: DecryptMessage(,) -> %x\n", phContext, rv);
+ };
+ return rv;
+}
+
+/////////////////////////////////////////////////////////////
+// AttachDetours
+//
+PCHAR DetRealName(PCHAR psz)
+{
+ PCHAR pszBeg = psz;
+ // Move to end of name.
+ while (*psz) {
+ psz++;
+ }
+ // Move back through A-Za-z0-9 names.
+ while (psz > pszBeg &&
+ ((psz[-1] >= 'A' && psz[-1] <= 'Z') ||
+ (psz[-1] >= 'a' && psz[-1] <= 'z') ||
+ (psz[-1] >= '0' && psz[-1] <= '9'))) {
+ psz--;
+ }
+ return psz;
+}
+
+VOID DetAttach(PVOID *ppbReal, PVOID pbMine, PCHAR psz)
+{
+ LONG l = DetourAttach(ppbReal, pbMine);
+ if (l != 0) {
+ Syelog(SYELOG_SEVERITY_NOTICE,
+ "Attach failed: `%s': error %d\n", DetRealName(psz), l);
+ }
+}
+
+VOID DetDetach(PVOID *ppbReal, PVOID pbMine, PCHAR psz)
+{
+ LONG l = DetourDetach(ppbReal, pbMine);
+ if (l != 0) {
+ Syelog(SYELOG_SEVERITY_NOTICE,
+ "Detach failed: `%s': error %d\n", DetRealName(psz), l);
+ }
+}
+
+#define ATTACH(x) DetAttach(&(PVOID&)Real_##x,Mine_##x,#x)
+#define DETACH(x) DetDetach(&(PVOID&)Real_##x,Mine_##x,#x)
+
+LONG AttachDetours(VOID)
+{
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+
+ ATTACH(CreateProcessW);
+ ATTACH(DecryptMessage);
+ ATTACH(EncryptMessage);
+ ATTACH(WSAAccept);
+ ATTACH(WSAAddressToStringA);
+ ATTACH(WSAAddressToStringW);
+ ATTACH(WSAAsyncGetHostByAddr);
+ ATTACH(WSAAsyncGetHostByName);
+ ATTACH(WSAAsyncGetProtoByName);
+ ATTACH(WSAAsyncGetProtoByNumber);
+ ATTACH(WSAAsyncGetServByName);
+ ATTACH(WSAAsyncGetServByPort);
+ ATTACH(WSACancelAsyncRequest);
+ ATTACH(WSACancelBlockingCall);
+ ATTACH(WSACleanup);
+ ATTACH(WSACloseEvent);
+ ATTACH(WSAConnect);
+ ATTACH(WSACreateEvent);
+ ATTACH(WSADuplicateSocketA);
+ ATTACH(WSADuplicateSocketW);
+ ATTACH(WSAEnumNameSpaceProvidersA);
+ ATTACH(WSAEnumNameSpaceProvidersW);
+ ATTACH(WSAEnumNetworkEvents);
+ ATTACH(WSAEnumProtocolsA);
+ ATTACH(WSAEnumProtocolsW);
+ ATTACH(WSAIsBlocking);
+ ATTACH(WSAJoinLeaf);
+ ATTACH(WSAProviderConfigChange);
+ ATTACH(WSARecv);
+ ATTACH(WSARecvDisconnect);
+ ATTACH(WSARecvFrom);
+ ATTACH(WSAResetEvent);
+ ATTACH(WSASend);
+ ATTACH(WSASendDisconnect);
+ ATTACH(WSASendTo);
+ ATTACH(WSAStringToAddressA);
+ ATTACH(WSAStringToAddressW);
+ ATTACH(WSAWaitForMultipleEvents);
+ ATTACH(accept);
+ ATTACH(closesocket);
+ ATTACH(connect);
+ ATTACH(listen);
+ ATTACH(recv);
+ ATTACH(recvfrom);
+ ATTACH(send);
+ ATTACH(sendto);
+ ATTACH(shutdown);
+
+ return DetourTransactionCommit();
+}
+
+LONG DetachDetours(VOID)
+{
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+
+ DETACH(CreateProcessW);
+ DETACH(DecryptMessage);
+ DETACH(EncryptMessage);
+ DETACH(WSAAccept);
+ DETACH(WSAAddressToStringA);
+ DETACH(WSAAddressToStringW);
+ DETACH(WSAAsyncGetHostByAddr);
+ DETACH(WSAAsyncGetHostByName);
+ DETACH(WSAAsyncGetProtoByName);
+ DETACH(WSAAsyncGetProtoByNumber);
+ DETACH(WSAAsyncGetServByName);
+ DETACH(WSAAsyncGetServByPort);
+ DETACH(WSACancelAsyncRequest);
+ DETACH(WSACancelBlockingCall);
+ DETACH(WSACleanup);
+ DETACH(WSACloseEvent);
+ DETACH(WSAConnect);
+ DETACH(WSACreateEvent);
+ DETACH(WSADuplicateSocketA);
+ DETACH(WSADuplicateSocketW);
+ DETACH(WSAEnumNameSpaceProvidersA);
+ DETACH(WSAEnumNameSpaceProvidersW);
+ DETACH(WSAEnumNetworkEvents);
+ DETACH(WSAEnumProtocolsA);
+ DETACH(WSAEnumProtocolsW);
+ DETACH(WSAIsBlocking);
+ DETACH(WSAJoinLeaf);
+ DETACH(WSAProviderConfigChange);
+ DETACH(WSARecv);
+ DETACH(WSARecvDisconnect);
+ DETACH(WSARecvFrom);
+ DETACH(WSAResetEvent);
+ DETACH(WSASend);
+ DETACH(WSASendDisconnect);
+ DETACH(WSASendTo);
+ DETACH(WSAStringToAddressA);
+ DETACH(WSAStringToAddressW);
+ DETACH(WSAWaitForMultipleEvents);
+ DETACH(accept);
+ DETACH(closesocket);
+ DETACH(connect);
+ DETACH(listen);
+ DETACH(recv);
+ DETACH(recvfrom);
+ DETACH(send);
+ DETACH(sendto);
+ DETACH(shutdown);
+
+ return DetourTransactionCommit();
+}
+
+//
+//////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////// Logging System.
+//
+static BOOL s_bLog = 1;
+static LONG s_nTlsIndent = -1;
+static LONG s_nTlsThread = -1;
+static LONG s_nThreadCnt = 0;
+
+VOID _PrintEnter(const CHAR *psz, ...)
+{
+ DWORD dwErr = GetLastError();
+
+ LONG nIndent = 0;
+ LONG nThread = 0;
+ if (s_nTlsIndent >= 0) {
+ nIndent = (LONG)(LONG_PTR)TlsGetValue(s_nTlsIndent);
+ TlsSetValue(s_nTlsIndent, (PVOID)(LONG_PTR)(nIndent + 1));
+ }
+ if (s_nTlsThread >= 0) {
+ nThread = (LONG)(LONG_PTR)TlsGetValue(s_nTlsThread);
+ }
+
+ if (s_bLog && psz) {
+ CHAR szBuf[1024];
+ PCHAR pszBuf = szBuf;
+ PCHAR pszEnd = szBuf + ARRAYSIZE(szBuf) - 1;
+ LONG nLen = (nIndent > 0) ? (nIndent < 35 ? nIndent * 2 : 70) : 0;
+ *pszBuf++ = (CHAR)('0' + ((nThread / 100) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 10) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 1) % 10));
+ *pszBuf++ = ' ';
+ while (nLen-- > 0) {
+ *pszBuf++ = ' ';
+ }
+
+ va_list args;
+ va_start(args, psz);
+
+ while ((*pszBuf++ = *psz++) != 0 && pszBuf < pszEnd) {
+ // Copy characters.
+ }
+ *pszEnd = '\0';
+ SyelogV(SYELOG_SEVERITY_INFORMATION,
+ szBuf, args);
+
+ va_end(args);
+ }
+ SetLastError(dwErr);
+}
+
+VOID _PrintExit(const CHAR *psz, ...)
+{
+ DWORD dwErr = GetLastError();
+
+ LONG nIndent = 0;
+ LONG nThread = 0;
+ if (s_nTlsIndent >= 0) {
+ nIndent = (LONG)(LONG_PTR)TlsGetValue(s_nTlsIndent) - 1;
+ ASSERT(nIndent >= 0);
+ TlsSetValue(s_nTlsIndent, (PVOID)(LONG_PTR)nIndent);
+ }
+ if (s_nTlsThread >= 0) {
+ nThread = (LONG)(LONG_PTR)TlsGetValue(s_nTlsThread);
+ }
+
+ if (s_bLog && psz) {
+ CHAR szBuf[1024];
+ PCHAR pszBuf = szBuf;
+ PCHAR pszEnd = szBuf + ARRAYSIZE(szBuf) - 1;
+ LONG nLen = (nIndent > 0) ? (nIndent < 35 ? nIndent * 2 : 70) : 0;
+ *pszBuf++ = (CHAR)('0' + ((nThread / 100) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 10) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 1) % 10));
+ *pszBuf++ = ' ';
+ while (nLen-- > 0) {
+ *pszBuf++ = ' ';
+ }
+
+ va_list args;
+ va_start(args, psz);
+
+ while ((*pszBuf++ = *psz++) != 0 && pszBuf < pszEnd) {
+ // Copy characters.
+ }
+ *pszEnd = '\0';
+ SyelogV(SYELOG_SEVERITY_INFORMATION,
+ szBuf, args);
+
+ va_end(args);
+ }
+ SetLastError(dwErr);
+}
+
+VOID _Print(const CHAR *psz, ...)
+{
+ DWORD dwErr = GetLastError();
+
+ LONG nIndent = 0;
+ LONG nThread = 0;
+ if (s_nTlsIndent >= 0) {
+ nIndent = (LONG)(LONG_PTR)TlsGetValue(s_nTlsIndent);
+ }
+ if (s_nTlsThread >= 0) {
+ nThread = (LONG)(LONG_PTR)TlsGetValue(s_nTlsThread);
+ }
+
+ if (s_bLog && psz) {
+ CHAR szBuf[1024];
+ PCHAR pszBuf = szBuf;
+ PCHAR pszEnd = szBuf + ARRAYSIZE(szBuf) - 1;
+ LONG nLen = (nIndent > 0) ? (nIndent < 35 ? nIndent * 2 : 70) : 0;
+ *pszBuf++ = (CHAR)('0' + ((nThread / 100) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 10) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 1) % 10));
+ *pszBuf++ = ' ';
+ while (nLen-- > 0) {
+ *pszBuf++ = ' ';
+ }
+
+ va_list args;
+ va_start(args, psz);
+
+ while ((*pszBuf++ = *psz++) != 0 && pszBuf < pszEnd) {
+ // Copy characters.
+ }
+ *pszEnd = '\0';
+ SyelogV(SYELOG_SEVERITY_INFORMATION,
+ szBuf, args);
+
+ va_end(args);
+ }
+
+ SetLastError(dwErr);
+}
+
+VOID AssertMessage(CONST PCHAR pszMsg, CONST PCHAR pszFile, ULONG nLine)
+{
+ Syelog(SYELOG_SEVERITY_FATAL,
+ "ASSERT(%s) failed in %s, line %d.\n", pszMsg, pszFile, nLine);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// DLL module information
+//
+BOOL ThreadAttach(HMODULE hDll)
+{
+ (void)hDll;
+
+ if (s_nTlsIndent >= 0) {
+ TlsSetValue(s_nTlsIndent, (PVOID)0);
+ }
+ if (s_nTlsThread >= 0) {
+ LONG nThread = InterlockedIncrement(&s_nThreadCnt);
+ TlsSetValue(s_nTlsThread, (PVOID)(LONG_PTR)nThread);
+ }
+ return TRUE;
+}
+
+BOOL ThreadDetach(HMODULE hDll)
+{
+ (void)hDll;
+
+ if (s_nTlsIndent >= 0) {
+ TlsSetValue(s_nTlsIndent, (PVOID)0);
+ }
+ if (s_nTlsThread >= 0) {
+ TlsSetValue(s_nTlsThread, (PVOID)0);
+ }
+ return TRUE;
+}
+
+BOOL ProcessAttach(HMODULE hDll)
+{
+ s_bLog = FALSE;
+ s_nTlsIndent = TlsAlloc();
+ s_nTlsThread = TlsAlloc();
+
+ WCHAR wzExeName[MAX_PATH];
+ s_hInst = hDll;
+
+ Real_GetModuleFileNameW(hDll, s_wzDllPath, ARRAYSIZE(s_wzDllPath));
+ Real_GetModuleFileNameW(NULL, wzExeName, ARRAYSIZE(wzExeName));
+
+ SyelogOpen("trcssl" DETOURS_STRINGIFY(DETOURS_BITS), SYELOG_FACILITY_APPLICATION);
+ Syelog(SYELOG_SEVERITY_INFORMATION,
+ "##################################################################\n");
+ Syelog(SYELOG_SEVERITY_INFORMATION,
+ "### %ls\n", wzExeName);
+ LONG error = AttachDetours();
+ if (error != NO_ERROR) {
+ Syelog(SYELOG_SEVERITY_FATAL, "### Error attaching detours: %d\n", error);
+ }
+
+ ThreadAttach(hDll);
+
+ s_bLog = TRUE;
+ return TRUE;
+}
+
+BOOL ProcessDetach(HMODULE hDll)
+{
+ ThreadDetach(hDll);
+ s_bLog = FALSE;
+
+ LONG error = DetachDetours();
+ if (error != NO_ERROR) {
+ Syelog(SYELOG_SEVERITY_FATAL, "### Error detaching detours: %d\n", error);
+ }
+
+ Syelog(SYELOG_SEVERITY_NOTICE, "### Closing.\n");
+ SyelogClose(FALSE);
+
+ if (s_nTlsIndent >= 0) {
+ TlsFree(s_nTlsIndent);
+ }
+ if (s_nTlsThread >= 0) {
+ TlsFree(s_nTlsThread);
+ }
+ return TRUE;
+}
+
+BOOL APIENTRY DllMain(HINSTANCE hModule, DWORD dwReason, PVOID lpReserved)
+{
+ (void)hModule;
+ (void)lpReserved;
+
+ if (DetourIsHelperProcess()) {
+ return TRUE;
+ }
+
+ switch (dwReason) {
+ case DLL_PROCESS_ATTACH:
+ DetourRestoreAfterWith();
+ return ProcessAttach(hModule);
+ case DLL_PROCESS_DETACH:
+ return ProcessDetach(hModule);
+ case DLL_THREAD_ATTACH:
+ return ThreadAttach(hModule);
+ case DLL_THREAD_DETACH:
+ return ThreadDetach(hModule);
+ }
+ return TRUE;
+}
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/tracessl/trcssl.rc b/ext/detours/samples/tracessl/trcssl.rc
new file mode 100644
index 0000000..1e52e48
--- /dev/null
+++ b/ext/detours/samples/tracessl/trcssl.rc
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Version information for trcssl.rc.
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include "detver.h"
+
+#define VER_INTERNALNAME_STR "trcssl" DETOURS_STRINGIFY(DETOURS_BITS)
+#define VER_ORIGINALFILENAME_STR "trcsll" DETOURS_STRINGIFY(DETOURS_BITS) ".dll"
+#define VER_FILEDESCRIPTION_STR "Detours SSL Trace Module"
+#define VER_COMPANYNAME_STR "Microsoft Corporation"
+
+#include "common.ver"
diff --git a/ext/detours/samples/tracetcp/Makefile b/ext/detours/samples/tracetcp/Makefile
new file mode 100644
index 0000000..61caaaa
--- /dev/null
+++ b/ext/detours/samples/tracetcp/Makefile
@@ -0,0 +1,98 @@
+##############################################################################
+##
+## Utility to trace WinSock TCP APIs.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+LIBS=$(LIBS) kernel32.lib ws2_32.lib
+
+##############################################################################
+
+all: dirs \
+ $(BIND)\trctcp$(DETOURS_BITS).dll \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\trctcp$(DETOURS_BITS).bsc \
+!ENDIF
+ option
+
+##############################################################################
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+$(OBJD)\trctcp.obj: trctcp.cpp
+
+$(OBJD)\trctcp.res: trctcp.rc
+
+$(BIND)\trctcp$(DETOURS_BITS).dll: $(OBJD)\trctcp.obj $(OBJD)\trctcp.res $(DEPS)
+ cl /LD $(CFLAGS) /Fe$@ /Fd$(@R).pdb \
+ $(OBJD)\trctcp.obj $(OBJD)\trctcp.res \
+ /link $(LINKFLAGS) /subsystem:console \
+ /export:DetourFinishHelperProcess,@1,NONAME \
+ $(LIBS)
+
+$(OBJD)\trctcp$(DETOURS_BITS).bsc : $(OBJD)\trctcp.obj
+ bscmake /v /n /o $@ $(OBJD)\trctcp.sbr
+
+##############################################################################
+
+clean:
+ -del *~ test.txt 2>nul
+ -del $(BIND)\trctcp*.* 2>nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+############################################### Install non-bit-size binaries.
+
+!IF "$(DETOURS_OPTION_PROCESSOR)" != ""
+
+$(OPTD)\trctcp$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\trctcp$(DETOURS_OPTION_BITS).pdb:
+
+$(BIND)\trctcp$(DETOURS_OPTION_BITS).dll : $(OPTD)\trctcp$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+$(BIND)\trctcp$(DETOURS_OPTION_BITS).pdb : $(OPTD)\trctcp$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul && echo $@ copied from $(DETOURS_OPTION_PROCESSOR).
+
+option: \
+ $(BIND)\trctcp$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\trctcp$(DETOURS_OPTION_BITS).pdb \
+
+!ELSE
+
+option:
+
+!ENDIF
+
+##############################################################################
+
+test: all
+ @echo -------- Logging output to test.txt ------------
+ start $(BIND)\syelogd.exe /o test.txt
+ $(BIND)\sleep5.exe 1
+ @echo -------- Should load trctcp$(DETOURS_BITS).dll dynamically using withdll.exe ------------
+ @echo.
+ @echo ** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE **
+ @echo **
+ @echo ** Close the Internet Explorer window to continue test.
+ @echo **
+ @echo ** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE **
+ @echo.
+ $(BIND)\withdll -d:$(BIND)\trctcp$(DETOURS_BITS).dll \
+ "c:\program files\Internet Explorer\iexplore.exe" "http://www.microsoft.com"
+ @echo -------- Log from syelog -------------
+ type test.txt
+
+debug: all
+ windbg -g -G -o $(BIND)\withdll -d:$(BIND)\trctcp$(DETOURS_BITS).dll \
+ "c:\program files\Internet Explorer\iexplore.exe" "http://www.microsoft.com"
+
+################################################################# End of File.
diff --git a/ext/detours/samples/tracetcp/trctcp.cpp b/ext/detours/samples/tracetcp/trctcp.cpp
new file mode 100644
index 0000000..9f2a879
--- /dev/null
+++ b/ext/detours/samples/tracetcp/trctcp.cpp
@@ -0,0 +1,1894 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (trctcp.cpp of trctcp.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#define _WIN32_WINNT 0x0400
+#define WIN32
+#define NT
+#define _WINSOCK_DEPRECATED_NO_WARNINGS
+
+#define DBG_TRACE 0
+
+#if _MSC_VER >= 1300
+#include <winsock2.h>
+#endif
+#include <windows.h>
+#include <stdio.h>
+#include "detours.h"
+#include "syelog.h"
+
+#define PULONG_PTR PVOID
+#define PLONG_PTR PVOID
+#define ULONG_PTR PVOID
+#define ENUMRESNAMEPROCA PVOID
+#define ENUMRESNAMEPROCW PVOID
+#define ENUMRESLANGPROCA PVOID
+#define ENUMRESLANGPROCW PVOID
+#define ENUMRESTYPEPROCA PVOID
+#define ENUMRESTYPEPROCW PVOID
+#define STGOPTIONS PVOID
+
+//////////////////////////////////////////////////////////////////////////////
+#pragma warning(disable:4127) // Many of our asserts are constants.
+
+#define ASSERT_ALWAYS(x) \
+ do { \
+ if (!(x)) { \
+ AssertMessage(#x, __FILE__, __LINE__); \
+ DebugBreak(); \
+ } \
+ } while (0)
+
+#ifndef NDEBUG
+#define ASSERT(x) ASSERT_ALWAYS(x)
+#else
+#define ASSERT(x)
+#endif
+
+#define UNUSED(c) (c) = (c)
+
+//////////////////////////////////////////////////////////////////////////////
+static HMODULE s_hInst = NULL;
+static WCHAR s_wzDllPath[MAX_PATH];
+
+VOID _PrintDump(SOCKET socket, PCHAR pszData, INT cbData);
+VOID _PrintEnter(PCSTR psz, ...);
+VOID _PrintExit(PCSTR psz, ...);
+VOID _Print(PCSTR psz, ...);
+
+VOID AssertMessage(CONST PCHAR pszMsg, CONST PCHAR pszFile, ULONG nLine);
+
+//////////////////////////////////////////////////////////////////////////////
+//
+extern "C" {
+ HANDLE (WINAPI * Real_CreateFileW)(LPCWSTR a0,
+ DWORD a1,
+ DWORD a2,
+ LPSECURITY_ATTRIBUTES a3,
+ DWORD a4,
+ DWORD a5,
+ HANDLE a6)
+ = CreateFileW;
+
+ BOOL (WINAPI * Real_WriteFile)(HANDLE hFile,
+ LPCVOID lpBuffer,
+ DWORD nNumberOfBytesToWrite,
+ LPDWORD lpNumberOfBytesWritten,
+ LPOVERLAPPED lpOverlapped)
+ = WriteFile;
+
+ BOOL (WINAPI * Real_FlushFileBuffers)(HANDLE hFile)
+ = FlushFileBuffers;
+
+ BOOL (WINAPI * Real_CloseHandle)(HANDLE hObject)
+ = CloseHandle;
+
+ BOOL (WINAPI * Real_WaitNamedPipeW)(LPCWSTR lpNamedPipeName, DWORD nTimeOut)
+ = WaitNamedPipeW;
+
+ BOOL (WINAPI * Real_SetNamedPipeHandleState)(HANDLE hNamedPipe,
+ LPDWORD lpMode,
+ LPDWORD lpMaxCollectionCount,
+ LPDWORD lpCollectDataTimeout)
+ = SetNamedPipeHandleState;
+
+ DWORD (WINAPI * Real_GetCurrentProcessId)(VOID)
+ = GetCurrentProcessId;
+
+ VOID (WINAPI * Real_GetSystemTimeAsFileTime)(LPFILETIME lpSystemTimeAsFileTime)
+ = GetSystemTimeAsFileTime;
+
+ VOID (WINAPI * Real_InitializeCriticalSection)(LPCRITICAL_SECTION lpSection)
+ = InitializeCriticalSection;
+
+ VOID (WINAPI * Real_EnterCriticalSection)(LPCRITICAL_SECTION lpSection)
+ = EnterCriticalSection;
+
+ VOID (WINAPI * Real_LeaveCriticalSection)(LPCRITICAL_SECTION lpSection)
+ = LeaveCriticalSection;
+}
+
+DWORD (WINAPI * Real_GetModuleFileNameW)(HMODULE a0,
+ LPWSTR a1,
+ DWORD a2)
+ = GetModuleFileNameW;
+
+BOOL (WINAPI * Real_CreateProcessW)(LPCWSTR a0,
+ LPWSTR a1,
+ LPSECURITY_ATTRIBUTES a2,
+ LPSECURITY_ATTRIBUTES a3,
+ BOOL a4,
+ DWORD a5,
+ LPVOID a6,
+ LPCWSTR a7,
+ LPSTARTUPINFOW a8,
+ LPPROCESS_INFORMATION a9)
+ = CreateProcessW;
+
+#if _MSC_VER < 1300
+SOCKET (WINAPI * Real_WSAAccept)(SOCKET a0,
+ sockaddr* a1,
+ LPINT a2,
+ LPCONDITIONPROC a3,
+ DWORD a4)
+ = WSAAccept;
+#else
+SOCKET (WINAPI * Real_WSAAccept)(SOCKET a0,
+ sockaddr* a1,
+ LPINT a2,
+ LPCONDITIONPROC a3,
+ DWORD_PTR a4)
+ = WSAAccept;
+#endif
+
+INT (WINAPI * Real_WSAAddressToStringA)(LPSOCKADDR a0,
+ DWORD a1,
+ LPWSAPROTOCOL_INFOA a2,
+ LPSTR a3,
+ LPDWORD a4)
+ = WSAAddressToStringA;
+
+INT (WINAPI * Real_WSAAddressToStringW)(LPSOCKADDR a0,
+ DWORD a1,
+ LPWSAPROTOCOL_INFOW a2,
+ LPWSTR a3,
+ LPDWORD a4)
+ = WSAAddressToStringW;
+
+HANDLE (WINAPI * Real_WSAAsyncGetHostByAddr)(HWND a0,
+ u_int a1,
+ CONST char* a2,
+ int a3,
+ int a4,
+ char* a5,
+ int a6)
+ = WSAAsyncGetHostByAddr;
+
+HANDLE (WINAPI * Real_WSAAsyncGetHostByName)(HWND a0,
+ u_int a1,
+ CONST char* a2,
+ char* a3,
+ int a4)
+ = WSAAsyncGetHostByName;
+
+HANDLE (WINAPI * Real_WSAAsyncGetProtoByName)(HWND a0,
+ u_int a1,
+ CONST char* a2,
+ char* a3,
+ int a4)
+ = WSAAsyncGetProtoByName;
+
+HANDLE (WINAPI * Real_WSAAsyncGetProtoByNumber)(HWND a0,
+ u_int a1,
+ int a2,
+ char* a3,
+ int a4)
+ = WSAAsyncGetProtoByNumber;
+
+HANDLE (WINAPI * Real_WSAAsyncGetServByName)(HWND a0,
+ u_int a1,
+ CONST char* a2,
+ CONST char* a3,
+ char* a4,
+ int a5)
+ = WSAAsyncGetServByName;
+
+HANDLE (WINAPI * Real_WSAAsyncGetServByPort)(HWND a0,
+ u_int a1,
+ int a2,
+ CONST char* a3,
+ char* a4,
+ int a5)
+ = WSAAsyncGetServByPort;
+
+int (WINAPI * Real_WSACancelAsyncRequest)(HANDLE a0)
+ = WSACancelAsyncRequest;
+
+int (WINAPI * Real_WSACancelBlockingCall)(void)
+ = WSACancelBlockingCall;
+
+int (WINAPI * Real_WSACleanup)(void)
+ = WSACleanup;
+
+BOOL (WINAPI * Real_WSACloseEvent)(HANDLE a0)
+ = WSACloseEvent;
+
+int (WINAPI * Real_WSAConnect)(SOCKET a0,
+ CONST sockaddr* a1,
+ int a2,
+ LPWSABUF a3,
+ LPWSABUF a4,
+ LPQOS a5,
+ LPQOS a6)
+ = WSAConnect;
+
+HANDLE (WINAPI * Real_WSACreateEvent)(void)
+ = WSACreateEvent;
+
+int (WINAPI * Real_WSADuplicateSocketA)(SOCKET a0,
+ DWORD a1,
+ LPWSAPROTOCOL_INFOA a2)
+ = WSADuplicateSocketA;
+
+int (WINAPI * Real_WSADuplicateSocketW)(SOCKET a0,
+ DWORD a1,
+ LPWSAPROTOCOL_INFOW a2)
+ = WSADuplicateSocketW;
+
+INT (WINAPI * Real_WSAEnumNameSpaceProvidersA)(LPDWORD a0,
+ LPWSANAMESPACE_INFOA a1)
+ = WSAEnumNameSpaceProvidersA;
+
+INT (WINAPI * Real_WSAEnumNameSpaceProvidersW)(LPDWORD a0,
+ LPWSANAMESPACE_INFOW a1)
+ = WSAEnumNameSpaceProvidersW;
+
+int (WINAPI * Real_WSAEnumNetworkEvents)(SOCKET a0,
+ HANDLE a1,
+ LPWSANETWORKEVENTS a2)
+ = WSAEnumNetworkEvents;
+
+int (WINAPI * Real_WSAEnumProtocolsA)(LPINT a0,
+ LPWSAPROTOCOL_INFOA a1,
+ LPDWORD a2)
+ = WSAEnumProtocolsA;
+
+int (WINAPI * Real_WSAEnumProtocolsW)(LPINT a0,
+ LPWSAPROTOCOL_INFOW a1,
+ LPDWORD a2)
+ = WSAEnumProtocolsW;
+
+BOOL (WINAPI * Real_WSAGetOverlappedResult)(SOCKET a0,
+ LPWSAOVERLAPPED a1,
+ LPDWORD a2,
+ BOOL a3,
+ LPDWORD a4)
+ = WSAGetOverlappedResult;
+
+BOOL (WINAPI * Real_WSAIsBlocking)(void)
+ = WSAIsBlocking;
+
+SOCKET (WINAPI * Real_WSAJoinLeaf)(SOCKET a0,
+ CONST sockaddr* a1,
+ int a2,
+ LPWSABUF a3,
+ LPWSABUF a4,
+ LPQOS a5,
+ LPQOS a6,
+ DWORD a7)
+ = WSAJoinLeaf;
+
+INT (WINAPI * Real_WSALookupServiceBeginA)(
+ LPWSAQUERYSETA lpqsRestrictions,
+ DWORD dwControlFlags,
+ LPHANDLE lphLookup
+ )
+ = WSALookupServiceBeginA;
+
+INT (WINAPI * Real_WSALookupServiceBeginW)(
+ LPWSAQUERYSETW lpqsRestrictions,
+ DWORD dwControlFlags,
+ LPHANDLE lphLookup
+ )
+ = WSALookupServiceBeginW;
+
+INT (WINAPI * Real_WSALookupServiceNextA)(
+ HANDLE hLookup,
+ DWORD dwControlFlags,
+ LPDWORD lpdwBufferLength,
+ LPWSAQUERYSETA lpqsResults
+ ) = WSALookupServiceNextA;
+
+INT (WINAPI * Real_WSALookupServiceNextW)(
+ HANDLE hLookup,
+ DWORD dwControlFlags,
+ LPDWORD lpdwBufferLength,
+ LPWSAQUERYSETW lpqsResults
+ ) = WSALookupServiceNextW;
+
+INT (WINAPI * Real_WSALookupServiceEnd)(
+ HANDLE hLookup
+ ) = WSALookupServiceEnd;
+
+INT (WINAPI * Real_WSAProviderConfigChange)(LPHANDLE a0,
+ LPWSAOVERLAPPED a1,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a2)
+ = WSAProviderConfigChange;
+
+int (WINAPI * Real_WSARecv)(SOCKET a0,
+ LPWSABUF a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPWSAOVERLAPPED a5,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a6)
+ = WSARecv;
+
+int (WINAPI * Real_WSARecvDisconnect)(SOCKET a0,
+ LPWSABUF a1)
+ = WSARecvDisconnect;
+
+int (WINAPI * Real_WSARecvFrom)(SOCKET a0,
+ LPWSABUF a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ sockaddr* a5,
+ LPINT a6,
+ LPWSAOVERLAPPED a7,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a8)
+ = WSARecvFrom;
+
+BOOL (WINAPI * Real_WSAResetEvent)(HANDLE a0)
+ = WSAResetEvent;
+
+int (WINAPI * Real_WSASend)(SOCKET a0,
+ LPWSABUF a1,
+ DWORD a2,
+ LPDWORD a3,
+ DWORD a4,
+ LPWSAOVERLAPPED a5,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a6)
+ = WSASend;
+
+int (WINAPI * Real_WSASendDisconnect)(SOCKET a0,
+ LPWSABUF a1)
+ = WSASendDisconnect;
+
+int (WINAPI * Real_WSASendTo)(SOCKET a0,
+ LPWSABUF a1,
+ DWORD a2,
+ LPDWORD a3,
+ DWORD a4,
+ CONST sockaddr* a5,
+ int a6,
+ LPWSAOVERLAPPED a7,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a8)
+ = WSASendTo;
+
+INT (WINAPI * Real_WSAStringToAddressA)(LPSTR a0,
+ INT a1,
+ LPWSAPROTOCOL_INFOA a2,
+ LPSOCKADDR a3,
+ LPINT a4)
+ = WSAStringToAddressA;
+
+INT (WINAPI * Real_WSAStringToAddressW)(LPWSTR a0,
+ INT a1,
+ LPWSAPROTOCOL_INFOW a2,
+ LPSOCKADDR a3,
+ LPINT a4)
+ = WSAStringToAddressW;
+
+DWORD (WINAPI * Real_WSAWaitForMultipleEvents)(DWORD a0,
+ CONST HANDLE * a1,
+ BOOL a2,
+ DWORD a3,
+ BOOL a4)
+ = WSAWaitForMultipleEvents;
+
+SOCKET (WINAPI * Real_accept)(SOCKET a0,
+ sockaddr* a1,
+ int* a2)
+ = accept;
+
+int (WINAPI * Real_closesocket)(SOCKET a0)
+ = closesocket;
+
+int (WINAPI * Real_connect)(SOCKET a0,
+ CONST sockaddr* a1,
+ int a2)
+ = connect;
+
+int (WINAPI * Real_listen)(SOCKET a0,
+ int a1)
+ = listen;
+
+int (WINAPI * Real_recv)(SOCKET a0,
+ char* a1,
+ int a2,
+ int a3)
+ = recv;
+
+int (WINAPI * Real_recvfrom)(SOCKET a0,
+ char* a1,
+ int a2,
+ int a3,
+ sockaddr* a4,
+ int* a5)
+ = recvfrom;
+
+int (WINAPI * Real_send)(SOCKET a0,
+ CONST char* a1,
+ int a2,
+ int a3)
+ = send;
+
+int (WINAPI * Real_sendto)(SOCKET a0,
+ CONST char* a1,
+ int a2,
+ int a3,
+ CONST sockaddr* a4,
+ int a5)
+ = sendto;
+
+int (WINAPI * Real_shutdown)(SOCKET a0,
+ int a1)
+ = shutdown;
+
+/////////////////////////////////////////////////////////////
+// Detours
+//
+BOOL WINAPI Mine_CreateProcessW(LPCWSTR lpApplicationName,
+ LPWSTR lpCommandLine,
+ LPSECURITY_ATTRIBUTES lpProcessAttributes,
+ LPSECURITY_ATTRIBUTES lpThreadAttributes,
+ BOOL bInheritHandles,
+ DWORD dwCreationFlags,
+ LPVOID lpEnvironment,
+ LPCWSTR lpCurrentDirectory,
+ LPSTARTUPINFOW lpStartupInfo,
+ LPPROCESS_INFORMATION lpProcessInformation)
+{
+ _PrintEnter("CreateProcessW(%ls,%ls,%p,%p,%x,%x,%p,%ls,%p,%p)\n",
+ lpApplicationName,
+ lpCommandLine,
+ lpProcessAttributes,
+ lpThreadAttributes,
+ bInheritHandles,
+ dwCreationFlags,
+ lpEnvironment,
+ lpCurrentDirectory,
+ lpStartupInfo,
+ lpProcessInformation);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_CreateProcessW(lpApplicationName,
+ lpCommandLine,
+ lpProcessAttributes,
+ lpThreadAttributes,
+ bInheritHandles,
+ dwCreationFlags,
+ lpEnvironment,
+ lpCurrentDirectory,
+ lpStartupInfo,
+ lpProcessInformation);
+ } __finally {
+ _PrintExit("CreateProcessW(,,,,,,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+#if _MSC_VER < 1300
+SOCKET WINAPI Mine_WSAAccept(SOCKET a0,
+ sockaddr* a1,
+ LPINT a2,
+ LPCONDITIONPROC a3,
+ DWORD a4)
+#else
+SOCKET WINAPI Mine_WSAAccept(SOCKET a0,
+ sockaddr* a1,
+ LPINT a2,
+ LPCONDITIONPROC a3,
+ DWORD_PTR a4)
+#endif
+{
+
+ SOCKET rv = 0;
+ __try {
+ rv = Real_WSAAccept(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintEnter("%p: WSAAccept(,%p,%p,%p,%p) -> %p\n", a0, a1, a2, a3, a4, rv);
+ _PrintExit(NULL);
+ };
+ return rv;
+}
+
+INT WINAPI Mine_WSAAddressToStringA(LPSOCKADDR a0,
+ DWORD a1,
+ LPWSAPROTOCOL_INFOA a2,
+ LPSTR a3,
+ LPDWORD a4)
+{
+ _PrintEnter("WSAAddressToStringA(%p,%x,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ INT rv = 0;
+ __try {
+ __try {
+ sockaddr_in *in = (sockaddr_in *)a0;
+ _Print("in=%d.%d.%d.%d\n",
+ in->sin_addr.S_un.S_un_b.s_b1,
+ in->sin_addr.S_un.S_un_b.s_b2,
+ in->sin_addr.S_un.S_un_b.s_b3,
+ in->sin_addr.S_un.S_un_b.s_b4);
+ }
+ __finally {
+ }
+
+ rv = Real_WSAAddressToStringA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WSAAddressToStringA(,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+INT WINAPI Mine_WSAAddressToStringW(LPSOCKADDR a0,
+ DWORD a1,
+ LPWSAPROTOCOL_INFOW a2,
+ LPWSTR a3,
+ LPDWORD a4)
+{
+ _PrintEnter("WSAAddressToStringW(%p,%x,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ INT rv = 0;
+ __try {
+ __try {
+ sockaddr_in *in = (sockaddr_in *)a0;
+ _Print("in=%d.%d.%d.%d\n",
+ in->sin_addr.S_un.S_un_b.s_b1,
+ in->sin_addr.S_un.S_un_b.s_b2,
+ in->sin_addr.S_un.S_un_b.s_b3,
+ in->sin_addr.S_un.S_un_b.s_b4);
+ }
+ __finally {
+ }
+ rv = Real_WSAAddressToStringW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WSAAddressToStringW(,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+HANDLE WINAPI Mine_WSAAsyncGetHostByAddr(HWND a0,
+ u_int a1,
+ char* a2,
+ int a3,
+ int a4,
+ char* a5,
+ int a6)
+{
+ _PrintEnter("WSAAsyncGetHostByAddr(%p,%x,%p,%x,%x,%p,%x)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_WSAAsyncGetHostByAddr(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("WSAAsyncGetHostByAddr(,,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE WINAPI Mine_WSAAsyncGetHostByName(HWND a0,
+ u_int a1,
+ char* a2,
+ char* a3,
+ int a4)
+{
+ _PrintEnter("WSAAsyncGetHostByName(%p,%x,%p,%p,%x)\n", a0, a1, a2, a3, a4);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_WSAAsyncGetHostByName(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WSAAsyncGetHostByName(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE WINAPI Mine_WSAAsyncGetProtoByName(HWND a0,
+ u_int a1,
+ char* a2,
+ char* a3,
+ int a4)
+{
+ _PrintEnter("WSAAsyncGetProtoByName(%p,%x,%p,%p,%x)\n", a0, a1, a2, a3, a4);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_WSAAsyncGetProtoByName(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WSAAsyncGetProtoByName(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE WINAPI Mine_WSAAsyncGetProtoByNumber(HWND a0,
+ u_int a1,
+ int a2,
+ char* a3,
+ int a4)
+{
+ _PrintEnter("WSAAsyncGetProtoByNumber(%p,%x,%p,%p,%x)\n", a0, a1, a2, a3, a4);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_WSAAsyncGetProtoByNumber(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WSAAsyncGetProtoByNumber(,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE WINAPI Mine_WSAAsyncGetServByName(HWND a0,
+ u_int a1,
+ char* a2,
+ char* a3,
+ char* a4,
+ int a5)
+{
+ _PrintEnter("WSAAsyncGetServByName(%p,%x,%p,%p,%p,%x)\n", a0, a1, a2, a3, a4, a5);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_WSAAsyncGetServByName(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("WSAAsyncGetServByName(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+HANDLE WINAPI Mine_WSAAsyncGetServByPort(HWND a0,
+ u_int a1,
+ int a2,
+ char* a3,
+ char* a4,
+ int a5)
+{
+ _PrintEnter("WSAAsyncGetServByPort(%p,%x,%x,%p,%p,%x)\n", a0, a1, a2, a3, a4, a5);
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_WSAAsyncGetServByPort(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("WSAAsyncGetServByPort(,,,,,) -> %p\n", rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSACancelAsyncRequest(HANDLE a0)
+{
+ _PrintEnter("WSACancelAsyncRequest(%p)\n", a0);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSACancelAsyncRequest(a0);
+ } __finally {
+ _PrintExit("WSACancelAsyncRequest() -> %x\n", rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSACancelBlockingCall(void)
+{
+ _PrintEnter("WSACancelBlockingCall()\n");
+
+ int rv = 0;
+ __try {
+ rv = Real_WSACancelBlockingCall();
+ } __finally {
+ _PrintExit("WSACancelBlockingCall() -> %x\n", rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSACleanup(void)
+{
+ _PrintEnter("WSACleanup()\n");
+
+ int rv = 0;
+ __try {
+ rv = Real_WSACleanup();
+ } __finally {
+ _PrintExit("WSACleanup() -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_WSACloseEvent(HANDLE a0)
+{
+ _PrintEnter("WSACloseEvent(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WSACloseEvent(a0);
+ } __finally {
+ _PrintExit("WSACloseEvent() -> %x\n", rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSAConnect(SOCKET a0,
+ sockaddr* a1,
+ int a2,
+ LPWSABUF a3,
+ LPWSABUF a4,
+ LPQOS a5,
+ LPQOS a6)
+{
+ int rv = 0;
+ __try {
+ rv = Real_WSAConnect(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintEnter("%p: WSAConnect(,%p,%x,%p,%p,%p,%p) -> %x\n",
+ a0, a1, a2, a3, a4, a5, a6, rv);
+ _PrintExit(NULL);
+ };
+ return rv;
+}
+
+HANDLE WINAPI Mine_WSACreateEvent(void)
+{
+ _PrintEnter("WSACreateEvent()\n");
+
+ HANDLE rv = 0;
+ __try {
+ rv = Real_WSACreateEvent();
+ } __finally {
+ _PrintExit("WSACreateEvent() -> %p\n", rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSADuplicateSocketA(SOCKET a0,
+ DWORD a1,
+ LPWSAPROTOCOL_INFOA a2)
+{
+ _PrintEnter("%p: WSADuplicateSocketA(,%x,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSADuplicateSocketA(a0, a1, a2);
+ } __finally {
+ _PrintExit("%p: WSADuplicateSocketA(,,) -> %x\n", a0, rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSADuplicateSocketW(SOCKET a0,
+ DWORD a1,
+ LPWSAPROTOCOL_INFOW a2)
+{
+ _PrintEnter("%p: WSADuplicateSocketW(,%x,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSADuplicateSocketW(a0, a1, a2);
+ } __finally {
+ _PrintExit("%p: WSADuplicateSocketW(,,) -> %x\n", a0, rv);
+ };
+ return rv;
+}
+
+INT WINAPI Mine_WSAEnumNameSpaceProvidersA(LPDWORD a0,
+ LPWSANAMESPACE_INFOA a1)
+{
+ _PrintEnter("WSAEnumNameSpaceProvidersA(%p,%p)\n", a0, a1);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSAEnumNameSpaceProvidersA(a0, a1);
+ } __finally {
+ _PrintExit("WSAEnumNameSpaceProvidersA(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+INT WINAPI Mine_WSAEnumNameSpaceProvidersW(LPDWORD a0,
+ LPWSANAMESPACE_INFOW a1)
+{
+ _PrintEnter("WSAEnumNameSpaceProvidersW(%p,%p)\n", a0, a1);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSAEnumNameSpaceProvidersW(a0, a1);
+ } __finally {
+ _PrintExit("WSAEnumNameSpaceProvidersW(,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSAEnumNetworkEvents(SOCKET a0,
+ HANDLE a1,
+ LPWSANETWORKEVENTS a2)
+{
+ _PrintEnter("%p: WSAEnumNetworkEvents(,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSAEnumNetworkEvents(a0, a1, a2);
+ } __finally {
+ _PrintExit("%p: WSAEnumNetworkEvents(,,) -> %x\n", a0, rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSAEnumProtocolsA(LPINT a0,
+ LPWSAPROTOCOL_INFOA a1,
+ LPDWORD a2)
+{
+ _PrintEnter("WSAEnumProtocolsA(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSAEnumProtocolsA(a0, a1, a2);
+ } __finally {
+ _PrintExit("WSAEnumProtocolsA(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSAEnumProtocolsW(LPINT a0,
+ LPWSAPROTOCOL_INFOW a1,
+ LPDWORD a2)
+{
+ _PrintEnter("WSAEnumProtocolsW(%p,%p,%p)\n", a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSAEnumProtocolsW(a0, a1, a2);
+ } __finally {
+ _PrintExit("WSAEnumProtocolsW(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_WSAGetOverlappedResult(SOCKET a0,
+ LPWSAOVERLAPPED a1,
+ LPDWORD a2,
+ BOOL a3,
+ LPDWORD a4)
+{
+ _PrintEnter("%p: WSAGetOverlappedResult(,%p,%p,%x,%p)\n", a0, a1, a2, a3, a4);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WSAGetOverlappedResult(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("%p: WSAGetOverlappedResult(,,,,) -> %x\n", a0, rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_WSAIsBlocking(void)
+{
+ _PrintEnter("WSAIsBlocking()\n");
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WSAIsBlocking();
+ } __finally {
+ _PrintExit("WSAIsBlocking() -> %x\n", rv);
+ };
+ return rv;
+}
+
+SOCKET WINAPI Mine_WSAJoinLeaf(SOCKET a0,
+ sockaddr* a1,
+ int a2,
+ LPWSABUF a3,
+ LPWSABUF a4,
+ LPQOS a5,
+ LPQOS a6,
+ DWORD a7)
+{
+ _PrintEnter("%p: WSAJoinLeaf(,%p,%x,%p,%p,%p,%p,%x)\n", a0, a1, a2, a3, a4, a5, a6, a7);
+
+ SOCKET rv = 0;
+ __try {
+ rv = Real_WSAJoinLeaf(a0, a1, a2, a3, a4, a5, a6, a7);
+ } __finally {
+ _PrintExit("%p: WSAJoinLeaf(,,,,,,,) -> %p\n", a0, rv);
+ };
+ return rv;
+}
+
+INT WINAPI Mine_WSALookupServiceBeginA(
+ LPWSAQUERYSETA lpqsRestrictions,
+ DWORD dwControlFlags,
+ LPHANDLE lphLookup
+ )
+{
+ _PrintEnter("WSALookupServiceBeginA(%p,%x,%p)\n",
+ lpqsRestrictions,
+ dwControlFlags,
+ lphLookup);
+
+ INT rv = 0;
+ __try {
+ __try {
+ _Print("service: [%hs]", lpqsRestrictions->lpszServiceInstanceName);
+ _Print("queries: [%hs]", lpqsRestrictions->lpszQueryString);
+ }
+ __finally {
+ }
+
+ rv = Real_WSALookupServiceBeginA(
+ lpqsRestrictions,
+ dwControlFlags,
+ lphLookup);
+ } __finally {
+ _PrintExit("WSALookupServiceBeginA(,,) -> %x\n", rv);
+ };
+ return rv;
+
+}
+
+INT WINAPI Mine_WSALookupServiceBeginW(
+ LPWSAQUERYSETW lpqsRestrictions,
+ DWORD dwControlFlags,
+ LPHANDLE lphLookup
+ )
+{
+ _PrintEnter("WSALookupServiceBeginW(%p,%p,%p)\n",
+ lpqsRestrictions,
+ dwControlFlags,
+ lphLookup);
+ __debugbreak();
+
+ INT rv = 0;
+ __try {
+ __try {
+ _Print("service: [%ls]", lpqsRestrictions->lpszServiceInstanceName);
+ _Print("queries: [%ls]", lpqsRestrictions->lpszQueryString);
+ }
+ __finally {
+ }
+
+ rv = Real_WSALookupServiceBeginW(
+ lpqsRestrictions,
+ dwControlFlags,
+ lphLookup);
+ } __finally {
+ _PrintExit("WSALookupServiceBeginW(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+INT WINAPI Mine_WSALookupServiceNextA(
+ HANDLE hLookup,
+ DWORD dwControlFlags,
+ LPDWORD lpdwBufferLength,
+ LPWSAQUERYSETA lpqsResults
+ )
+{
+ _PrintEnter("WSALookupServiceNextA(%p,%p,%p,%p)\n",
+ hLookup,
+ dwControlFlags,
+ lpdwBufferLength,
+ lpqsResults);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSALookupServiceNextA(
+ hLookup,
+ dwControlFlags,
+ lpdwBufferLength,
+ lpqsResults);
+ } __finally {
+ _PrintExit("WSALookupServiceNextA(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+INT WINAPI Mine_WSALookupServiceNextW(
+ HANDLE hLookup,
+ DWORD dwControlFlags,
+ LPDWORD lpdwBufferLength,
+ LPWSAQUERYSETW lpqsResults
+ )
+{
+ _PrintEnter("WSALookupServiceNextW(%p,%p,%p,%p)\n",
+ hLookup,
+ dwControlFlags,
+ lpdwBufferLength,
+ lpqsResults);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSALookupServiceNextW(
+ hLookup,
+ dwControlFlags,
+ lpdwBufferLength,
+ lpqsResults);
+ } __finally {
+ _PrintExit("WSALookupServiceNextW(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+INT WINAPI Mine_WSALookupServiceEnd(
+ HANDLE hLookup
+ )
+{
+ _PrintEnter("WSALookupServiceEnd(%p)\n", hLookup);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSALookupServiceEnd(hLookup);
+ } __finally {
+ _PrintExit("WSALookupServiceEnd(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+INT WINAPI Mine_WSAProviderConfigChange(LPHANDLE a0,
+ LPWSAOVERLAPPED a1,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a2)
+{
+ _PrintEnter("WSAProviderConfigChange(%p,%p,%p)\n", a0, a1, a2);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSAProviderConfigChange(a0, a1, a2);
+ } __finally {
+ _PrintExit("WSAProviderConfigChange(,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSARecv(SOCKET a0,
+ LPWSABUF a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ LPWSAOVERLAPPED a5,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a6)
+{
+ int rv = -1;
+ __try {
+ rv = Real_WSARecv(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ if (rv == 0) {
+ _PrintEnter("%p: WSARecv(,%p,%x,%p,%p,%p,%p)\n",
+ a0, a1, a2, a3, a4, a5, a6);
+ _PrintDump(a0, a1[0].buf, a1[0].len < *a3 ? a1[0].len : *a3);
+ _PrintExit("%p: WSARecv(,,,,,,) -> %x\n", a0, rv);
+ }
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSARecvDisconnect(SOCKET a0,
+ LPWSABUF a1)
+{
+ _PrintEnter("%p: WSARecvDisconnect(,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSARecvDisconnect(a0, a1);
+ } __finally {
+ _PrintExit("%p: WSARecvDisconnect(,) -> %x\n", a0, rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSARecvFrom(SOCKET a0,
+ LPWSABUF a1,
+ DWORD a2,
+ LPDWORD a3,
+ LPDWORD a4,
+ sockaddr* a5,
+ LPINT a6,
+ LPWSAOVERLAPPED a7,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a8)
+{
+ _PrintEnter("%p: WSARecvFrom(,%p,%x,%p,%p,%p,%p,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSARecvFrom(a0, a1, a2, a3, a4, a5, a6, a7, a8);
+ } __finally {
+ _PrintExit("%p: WSARecvFrom(,,,,,,,,) -> %x\n", a0, rv);
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_WSAResetEvent(HANDLE a0)
+{
+ _PrintEnter("WSAResetEvent(%p)\n", a0);
+
+ BOOL rv = 0;
+ __try {
+ rv = Real_WSAResetEvent(a0);
+ } __finally {
+ _PrintExit("WSAResetEvent() -> %x\n", rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSASend(SOCKET a0,
+ LPWSABUF a1,
+ DWORD a2,
+ LPDWORD a3,
+ DWORD a4,
+ LPWSAOVERLAPPED a5,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a6)
+{
+ _PrintEnter("%p: WSASend(,%p,%x,%p,%x,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSASend(a0, a1, a2, a3, a4, a5, a6);
+ } __finally {
+ _PrintExit("%p: WSASend(,,,,,,) -> %x\n", a0, rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSASendDisconnect(SOCKET a0,
+ LPWSABUF a1)
+{
+ _PrintEnter("%p: WSASendDisconnect(,%p)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSASendDisconnect(a0, a1);
+ } __finally {
+ _PrintExit("%p: WSASendDisconnect(,) -> %x\n", a0, rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_WSASendTo(SOCKET a0,
+ LPWSABUF a1,
+ DWORD a2,
+ LPDWORD a3,
+ DWORD a4,
+ sockaddr* a5,
+ int a6,
+ LPWSAOVERLAPPED a7,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE a8)
+{
+ _PrintEnter("%p: WSASendTo(,%p,%x,%p,%x,%p,%x,%p,%p)\n", a0, a1, a2, a3, a4, a5, a6, a7, a8);
+
+ int rv = 0;
+ __try {
+ rv = Real_WSASendTo(a0, a1, a2, a3, a4, a5, a6, a7, a8);
+ } __finally {
+ _PrintExit("%p: WSASendTo(,,,,,,,,) -> %x\n", a0, rv);
+ };
+ return rv;
+}
+
+INT WINAPI Mine_WSAStringToAddressA(LPSTR a0,
+ INT a1,
+ LPWSAPROTOCOL_INFOA a2,
+ LPSOCKADDR a3,
+ LPINT a4)
+{
+ _PrintEnter("WSAStringToAddressA(%p,%x,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSAStringToAddressA(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WSAStringToAddressA(,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+INT WINAPI Mine_WSAStringToAddressW(LPWSTR a0,
+ INT a1,
+ LPWSAPROTOCOL_INFOW a2,
+ LPSOCKADDR a3,
+ LPINT a4)
+{
+ _PrintEnter("WSAStringToAddressW(%p,%x,%p,%p,%p)\n", a0, a1, a2, a3, a4);
+
+ INT rv = 0;
+ __try {
+ rv = Real_WSAStringToAddressW(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WSAStringToAddressW(,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+DWORD WINAPI Mine_WSAWaitForMultipleEvents(DWORD a0,
+ void** a1,
+ BOOL a2,
+ DWORD a3,
+ BOOL a4)
+{
+ _PrintEnter("WSAWaitForMultipleEvents(%x,%p,%x,%x,%x)\n", a0, a1, a2, a3, a4);
+
+ DWORD rv = 0;
+ __try {
+ rv = Real_WSAWaitForMultipleEvents(a0, a1, a2, a3, a4);
+ } __finally {
+ _PrintExit("WSAWaitForMultipleEvents(,,,,) -> %x\n", rv);
+ };
+ return rv;
+}
+
+SOCKET WINAPI Mine_accept(SOCKET a0,
+ sockaddr* a1,
+ int* a2)
+{
+ SOCKET rv = 0;
+ __try {
+ rv = Real_accept(a0, a1, a2);
+ } __finally {
+ WCHAR wzAddress[512] = L"";
+ int err = WSAGetLastError();
+ if (rv != INVALID_SOCKET) {
+ DWORD nAddress = ARRAYSIZE(wzAddress);
+ if (Real_WSAAddressToStringW(a1, *a2, NULL, wzAddress, &nAddress) != 0) {
+ wzAddress[0] = 0;
+ }
+ }
+ WSASetLastError(err);
+
+ if (wzAddress[0]) {
+ _PrintEnter("%p: accept(,%ls,%p) -> %p\n", a0, wzAddress, a2, rv);
+ }
+ else {
+ _PrintEnter("%p: accept(,%p,%p) -> %p\n", a0, a1, a2, rv);
+ }
+ _PrintExit(NULL);
+ };
+ return rv;
+}
+
+int WINAPI Mine_closesocket(SOCKET a0)
+{
+ int rv = 0;
+ __try {
+ rv = Real_closesocket(a0);
+ } __finally {
+ _PrintEnter("%p: closesocket() -> %x\n", a0, rv);
+ _PrintExit(NULL);
+ };
+ return rv;
+}
+
+int WINAPI Mine_connect(SOCKET a0,
+ sockaddr* name,
+ int namelen)
+{
+ int rv = 0;
+ __try {
+ rv = Real_connect(a0, name, namelen);
+ } __finally {
+ WCHAR wzAddress[512];
+ DWORD nAddress = ARRAYSIZE(wzAddress);
+ int err = WSAGetLastError();
+ if (Real_WSAAddressToStringW(name, namelen, NULL, wzAddress, &nAddress) == 0) {
+ if (rv == SOCKET_ERROR) {
+ _PrintEnter("%p: connect(,%p:%ls,%x) -> %x [%d]\n",
+ a0, name, wzAddress, namelen, rv, err);
+ }
+ else {
+ _PrintEnter("%p: connect(,%p:%ls,%x) -> %x\n",
+ a0, name, wzAddress, namelen, rv);
+ }
+ }
+ else {
+ if (rv == SOCKET_ERROR) {
+ _PrintEnter("%p: connect(,%p,%x) -> %x [%d]\n",
+ a0, name, namelen, rv, err);
+ }
+ else {
+ _PrintEnter("%p: connect(,%p,%x) -> %x\n",
+ a0, name, namelen, rv);
+ }
+ }
+ WSASetLastError(err);
+ _PrintExit(NULL);
+ };
+ return rv;
+}
+
+int WINAPI Mine_listen(SOCKET a0,
+ int a1)
+{
+ _PrintEnter("%p: listen(,%x)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_listen(a0, a1);
+ } __finally {
+ _PrintExit("%p: listen(,) -> %x\n", a0, rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_recv(SOCKET a0,
+ char* a1,
+ int a2,
+ int a3)
+{
+ _PrintEnter("%p: recv(,%p,%x,%x)\n", a0, a1, a2, a3);
+
+ int rv = 0;
+ __try {
+ rv = Real_recv(a0, a1, a2, a3);
+ } __finally {
+ _PrintExit("%p: recv(,%s,,) -> %x\n", a0, a1, rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_recvfrom(SOCKET a0,
+ char* a1,
+ int a2,
+ int a3,
+ sockaddr* a4,
+ int* a5)
+{
+ _PrintEnter("%p: recvfrom(,%p,%x,%x,%p,%p)\n", a0, a1, a2, a3, a4, a5);
+
+ int rv = 0;
+ __try {
+ rv = Real_recvfrom(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("%p: recvfrom(,%s,,,,) -> %x\n", a0, a1, rv);
+ };
+ return rv;
+}
+
+VOID _PrintDump(SOCKET socket, PCHAR pszData, INT cbData)
+{
+ if (pszData && cbData > 0) {
+ CHAR szBuffer[256];
+ PCHAR pszBuffer = szBuffer;
+ INT cbBuffer = 0;
+ INT nLines = 0;
+
+ while (cbData > 0) {
+ if (nLines > 20) {
+ *pszBuffer++ = '.';
+ *pszBuffer++ = '.';
+ *pszBuffer++ = '.';
+ cbBuffer += 3;
+ break;
+ }
+
+ if (*pszData == '\t') {
+ *pszBuffer++ = '\\';
+ *pszBuffer++ = 't';
+ cbBuffer += 2;
+ pszData++;
+ cbData--;
+ continue;
+ }
+ if (*pszData == '\r') {
+ *pszBuffer++ = '\\';
+ *pszBuffer++ = 'r';
+ cbBuffer += 2;
+ pszData++;
+ cbData--;
+ continue;
+ }
+ else if (*pszData == '\n') {
+ *pszBuffer++ = '\\';
+ *pszBuffer++ = 'n';
+ cbBuffer += 2;
+ *pszBuffer++ = '\0';
+ _Print("%p: %hs\n", socket, szBuffer);
+ nLines++;
+ pszBuffer = szBuffer;
+ cbBuffer = 0;
+ pszData++;
+ cbData--;
+ continue;
+ }
+ else if (cbBuffer >= 80) {
+ *pszBuffer++ = '\0';
+ _Print("%p: %hs\n", socket, szBuffer);
+ nLines++;
+ pszBuffer = szBuffer;
+ cbBuffer = 0;
+ }
+
+ if (*pszData < ' ' || *pszData >= 127) {
+ *pszBuffer++ = '\\';
+ *pszBuffer++ = 'x';
+ *pszBuffer++ = "0123456789ABCDEF"[(*pszData & 0xf0) >> 4];
+ *pszBuffer++ = "0123456789ABCDEF"[(*pszData & 0x0f)];
+ cbBuffer += 4;
+ }
+ else {
+ *pszBuffer++ = *pszData;
+ }
+ cbBuffer++;
+ pszData++;
+ cbData--;
+ }
+
+ if (cbBuffer > 0) {
+ *pszBuffer++ = '\0';
+ _Print("%p: %hs\n", socket, szBuffer);
+ }
+ }
+}
+
+int WINAPI Mine_send(SOCKET a0,
+ char* a1,
+ int a2,
+ int a3)
+{
+ _PrintEnter("%p: send(,%p,%x,%x)\n", a0, a1, a2, a3);
+ _PrintDump(a0, a1, a2);
+
+ int rv = 0;
+ __try {
+ rv = Real_send(a0, a1, a2, a3);
+ } __finally {
+ if (rv == SOCKET_ERROR) {
+ int err = WSAGetLastError();
+ _PrintExit("%p: send(,,,) -> %x (%d)\n", a0, rv, err);
+ }
+ else {
+ _PrintExit("%p: send(,,,) -> %x\n", a0, rv);
+ }
+ };
+ return rv;
+}
+
+int WINAPI Mine_sendto(SOCKET a0,
+ char* a1,
+ int a2,
+ int a3,
+ sockaddr* a4,
+ int a5)
+{
+ _PrintEnter("%p: sendto(,%s,%x,%x,%p,%x)\n", a0, a1, a2, a3, a4, a5);
+
+ int rv = 0;
+ __try {
+ rv = Real_sendto(a0, a1, a2, a3, a4, a5);
+ } __finally {
+ _PrintExit("%p: sendto(%ls,,,,,) -> %x\n", a0, a1, rv);
+ };
+ return rv;
+}
+
+int WINAPI Mine_shutdown(SOCKET a0,
+ int a1)
+{
+ _PrintEnter("%p: shutdown(,%x)\n", a0, a1);
+
+ int rv = 0;
+ __try {
+ rv = Real_shutdown(a0, a1);
+ } __finally {
+ _PrintExit("%p: shutdown(,) -> %x\n", a0, rv);
+ };
+ return rv;
+}
+
+/////////////////////////////////////////////////////////////
+// AttachDetours
+//
+PCHAR DetRealName(PCHAR psz)
+{
+ PCHAR pszBeg = psz;
+ // Move to end of name.
+ while (*psz) {
+ psz++;
+ }
+ // Move back through A-Za-z0-9 names.
+ while (psz > pszBeg &&
+ ((psz[-1] >= 'A' && psz[-1] <= 'Z') ||
+ (psz[-1] >= 'a' && psz[-1] <= 'z') ||
+ (psz[-1] >= '0' && psz[-1] <= '9'))) {
+ psz--;
+ }
+ return psz;
+}
+
+VOID DetAttach(PVOID *ppbReal, PVOID pbMine, PCHAR psz)
+{
+ LONG l = DetourAttach(ppbReal, pbMine);
+ if (l != 0) {
+ Syelog(SYELOG_SEVERITY_NOTICE,
+ "Attach failed: `%s': error %d\n", DetRealName(psz), l);
+ }
+}
+
+VOID DetDetach(PVOID *ppbReal, PVOID pbMine, PCHAR psz)
+{
+ LONG l = DetourDetach(ppbReal, pbMine);
+ if (l != 0) {
+ Syelog(SYELOG_SEVERITY_NOTICE,
+ "Detach failed: `%s': error %d\n", DetRealName(psz), l);
+ }
+}
+
+#define ATTACH(x) DetAttach(&(PVOID&)Real_##x,Mine_##x,#x)
+#define DETACH(x) DetDetach(&(PVOID&)Real_##x,Mine_##x,#x)
+
+LONG AttachDetours(VOID)
+{
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+
+ ATTACH(CreateProcessW);
+ ATTACH(WSAAccept);
+ ATTACH(WSAAddressToStringA);
+ ATTACH(WSAAddressToStringW);
+ ATTACH(WSAAsyncGetHostByAddr);
+ ATTACH(WSAAsyncGetHostByName);
+ ATTACH(WSAAsyncGetProtoByName);
+ ATTACH(WSAAsyncGetProtoByNumber);
+ ATTACH(WSAAsyncGetServByName);
+ ATTACH(WSAAsyncGetServByPort);
+ ATTACH(WSACancelAsyncRequest);
+ ATTACH(WSACancelBlockingCall);
+ ATTACH(WSACleanup);
+ ATTACH(WSACloseEvent);
+ ATTACH(WSAConnect);
+ ATTACH(WSACreateEvent);
+ ATTACH(WSADuplicateSocketA);
+ ATTACH(WSADuplicateSocketW);
+ ATTACH(WSAEnumNameSpaceProvidersA);
+ ATTACH(WSAEnumNameSpaceProvidersW);
+ ATTACH(WSAEnumNetworkEvents);
+ ATTACH(WSAEnumProtocolsA);
+ ATTACH(WSAEnumProtocolsW);
+ ATTACH(WSAIsBlocking);
+ ATTACH(WSAJoinLeaf);
+ ATTACH(WSALookupServiceBeginA);
+ ATTACH(WSALookupServiceBeginW);
+ ATTACH(WSALookupServiceNextA);
+ ATTACH(WSALookupServiceNextW);
+ ATTACH(WSALookupServiceEnd);
+ ATTACH(WSAProviderConfigChange);
+ ATTACH(WSARecv);
+ ATTACH(WSARecvDisconnect);
+ ATTACH(WSARecvFrom);
+ ATTACH(WSAResetEvent);
+ ATTACH(WSASend);
+ ATTACH(WSASendDisconnect);
+ ATTACH(WSASendTo);
+ ATTACH(WSAStringToAddressA);
+ ATTACH(WSAStringToAddressW);
+ ATTACH(WSAWaitForMultipleEvents);
+ ATTACH(accept);
+ ATTACH(closesocket);
+ ATTACH(connect);
+ ATTACH(listen);
+ ATTACH(recv);
+ ATTACH(recvfrom);
+ ATTACH(send);
+ ATTACH(sendto);
+ ATTACH(shutdown);
+
+ return DetourTransactionCommit();
+}
+
+LONG DetachDetours(VOID)
+{
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+
+ DETACH(CreateProcessW);
+ DETACH(WSAAccept);
+ DETACH(WSAAddressToStringA);
+ DETACH(WSAAddressToStringW);
+ DETACH(WSAAsyncGetHostByAddr);
+ DETACH(WSAAsyncGetHostByName);
+ DETACH(WSAAsyncGetProtoByName);
+ DETACH(WSAAsyncGetProtoByNumber);
+ DETACH(WSAAsyncGetServByName);
+ DETACH(WSAAsyncGetServByPort);
+ DETACH(WSACancelAsyncRequest);
+ DETACH(WSACancelBlockingCall);
+ DETACH(WSACleanup);
+ DETACH(WSACloseEvent);
+ DETACH(WSAConnect);
+ DETACH(WSACreateEvent);
+ DETACH(WSADuplicateSocketA);
+ DETACH(WSADuplicateSocketW);
+ DETACH(WSAEnumNameSpaceProvidersA);
+ DETACH(WSAEnumNameSpaceProvidersW);
+ DETACH(WSAEnumNetworkEvents);
+ DETACH(WSAEnumProtocolsA);
+ DETACH(WSAEnumProtocolsW);
+ DETACH(WSAIsBlocking);
+ DETACH(WSAJoinLeaf);
+ DETACH(WSALookupServiceBeginA);
+ DETACH(WSALookupServiceBeginW);
+ DETACH(WSALookupServiceNextA);
+ DETACH(WSALookupServiceNextW);
+ DETACH(WSALookupServiceEnd);
+ DETACH(WSAProviderConfigChange);
+ DETACH(WSARecv);
+ DETACH(WSARecvDisconnect);
+ DETACH(WSARecvFrom);
+ DETACH(WSAResetEvent);
+ DETACH(WSASend);
+ DETACH(WSASendDisconnect);
+ DETACH(WSASendTo);
+ DETACH(WSAStringToAddressA);
+ DETACH(WSAStringToAddressW);
+ DETACH(WSAWaitForMultipleEvents);
+ DETACH(accept);
+ DETACH(closesocket);
+ DETACH(connect);
+ DETACH(listen);
+ DETACH(recv);
+ DETACH(recvfrom);
+ DETACH(send);
+ DETACH(sendto);
+ DETACH(shutdown);
+
+ return DetourTransactionCommit();
+}
+
+//
+//////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////// Logging System.
+//
+static BOOL s_bLog = 1;
+static LONG s_nTlsIndent = -1;
+static LONG s_nTlsThread = -1;
+static LONG s_nThreadCnt = 0;
+
+VOID _PrintEnter(const CHAR *psz, ...)
+{
+ DWORD dwErr = GetLastError();
+
+ LONG nIndent = 0;
+ LONG nThread = 0;
+ if (s_nTlsIndent >= 0) {
+ nIndent = (LONG)(LONG_PTR)TlsGetValue(s_nTlsIndent);
+ TlsSetValue(s_nTlsIndent, (PVOID)(LONG_PTR)(nIndent + 1));
+ }
+ if (s_nTlsThread >= 0) {
+ nThread = (LONG)(LONG_PTR)TlsGetValue(s_nTlsThread);
+ }
+
+ if (s_bLog && psz) {
+ CHAR szBuf[1024];
+ PCHAR pszBuf = szBuf;
+ PCHAR pszEnd = szBuf + ARRAYSIZE(szBuf) - 1;
+ LONG nLen = (nIndent > 0) ? (nIndent < 35 ? nIndent * 2 : 70) : 0;
+ *pszBuf++ = (CHAR)('0' + ((nThread / 100) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 10) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 1) % 10));
+ *pszBuf++ = ' ';
+ while (nLen-- > 0) {
+ *pszBuf++ = ' ';
+ }
+
+ va_list args;
+ va_start(args, psz);
+
+ while ((*pszBuf++ = *psz++) != 0 && pszBuf < pszEnd) {
+ // Copy characters.
+ }
+ *pszEnd = '\0';
+ SyelogV(SYELOG_SEVERITY_INFORMATION,
+ szBuf, args);
+
+ va_end(args);
+ }
+ SetLastError(dwErr);
+}
+
+VOID _PrintExit(const CHAR *psz, ...)
+{
+ DWORD dwErr = GetLastError();
+
+ LONG nIndent = 0;
+ LONG nThread = 0;
+ if (s_nTlsIndent >= 0) {
+ nIndent = (LONG)(LONG_PTR)TlsGetValue(s_nTlsIndent) - 1;
+ ASSERT(nIndent >= 0);
+ TlsSetValue(s_nTlsIndent, (PVOID)(LONG_PTR)nIndent);
+ }
+ if (s_nTlsThread >= 0) {
+ nThread = (LONG)(LONG_PTR)TlsGetValue(s_nTlsThread);
+ }
+
+ if (s_bLog && psz) {
+ CHAR szBuf[1024];
+ PCHAR pszBuf = szBuf;
+ PCHAR pszEnd = szBuf + ARRAYSIZE(szBuf) - 1;
+ LONG nLen = (nIndent > 0) ? (nIndent < 35 ? nIndent * 2 : 70) : 0;
+ *pszBuf++ = (CHAR)('0' + ((nThread / 100) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 10) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 1) % 10));
+ *pszBuf++ = ' ';
+ while (nLen-- > 0) {
+ *pszBuf++ = ' ';
+ }
+
+ va_list args;
+ va_start(args, psz);
+
+ while ((*pszBuf++ = *psz++) != 0 && pszBuf < pszEnd) {
+ // Copy characters.
+ }
+ *pszEnd = '\0';
+ SyelogV(SYELOG_SEVERITY_INFORMATION,
+ szBuf, args);
+
+ va_end(args);
+ }
+ SetLastError(dwErr);
+}
+
+VOID _Print(const CHAR *psz, ...)
+{
+ DWORD dwErr = GetLastError();
+
+ LONG nIndent = 0;
+ LONG nThread = 0;
+ if (s_nTlsIndent >= 0) {
+ nIndent = (LONG)(LONG_PTR)TlsGetValue(s_nTlsIndent);
+ }
+ if (s_nTlsThread >= 0) {
+ nThread = (LONG)(LONG_PTR)TlsGetValue(s_nTlsThread);
+ }
+
+ if (s_bLog && psz) {
+ CHAR szBuf[1024];
+ PCHAR pszBuf = szBuf;
+ PCHAR pszEnd = szBuf + ARRAYSIZE(szBuf) - 1;
+ LONG nLen = (nIndent > 0) ? (nIndent < 35 ? nIndent * 2 : 70) : 0;
+ *pszBuf++ = (CHAR)('0' + ((nThread / 100) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 10) % 10));
+ *pszBuf++ = (CHAR)('0' + ((nThread / 1) % 10));
+ *pszBuf++ = ' ';
+ while (nLen-- > 0) {
+ *pszBuf++ = ' ';
+ }
+
+ va_list args;
+ va_start(args, psz);
+
+ while ((*pszBuf++ = *psz++) != 0 && pszBuf < pszEnd) {
+ // Copy characters.
+ }
+ *pszEnd = '\0';
+ SyelogV(SYELOG_SEVERITY_INFORMATION,
+ szBuf, args);
+
+ va_end(args);
+ }
+
+ SetLastError(dwErr);
+}
+
+VOID AssertMessage(CONST PCHAR pszMsg, CONST PCHAR pszFile, ULONG nLine)
+{
+ Syelog(SYELOG_SEVERITY_FATAL,
+ "ASSERT(%s) failed in %s, line %d.\n", pszMsg, pszFile, nLine);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// DLL module information
+//
+BOOL ThreadAttach(HMODULE hDll)
+{
+ (void)hDll;
+
+ if (s_nTlsIndent >= 0) {
+ TlsSetValue(s_nTlsIndent, (PVOID)0);
+ }
+ if (s_nTlsThread >= 0) {
+ LONG nThread = InterlockedIncrement(&s_nThreadCnt);
+ TlsSetValue(s_nTlsThread, (PVOID)(LONG_PTR)nThread);
+ }
+ return TRUE;
+}
+
+BOOL ThreadDetach(HMODULE hDll)
+{
+ (void)hDll;
+
+ if (s_nTlsIndent >= 0) {
+ TlsSetValue(s_nTlsIndent, (PVOID)0);
+ }
+ if (s_nTlsThread >= 0) {
+ TlsSetValue(s_nTlsThread, (PVOID)0);
+ }
+ return TRUE;
+}
+
+BOOL ProcessAttach(HMODULE hDll)
+{
+ s_bLog = FALSE;
+ s_nTlsIndent = TlsAlloc();
+ s_nTlsThread = TlsAlloc();
+
+ WCHAR wzExeName[MAX_PATH];
+ s_hInst = hDll;
+
+ Real_GetModuleFileNameW(hDll, s_wzDllPath, ARRAYSIZE(s_wzDllPath));
+ Real_GetModuleFileNameW(NULL, wzExeName, ARRAYSIZE(wzExeName));
+
+ SyelogOpen("trctcp" DETOURS_STRINGIFY(DETOURS_BITS), SYELOG_FACILITY_APPLICATION);
+ Syelog(SYELOG_SEVERITY_INFORMATION,
+ "##################################################################\n");
+ Syelog(SYELOG_SEVERITY_INFORMATION,
+ "### %ls\n", wzExeName);
+ LONG error = AttachDetours();
+ if (error != NO_ERROR) {
+ Syelog(SYELOG_SEVERITY_FATAL, "### Error attaching detours: %d\n", error);
+ }
+
+ ThreadAttach(hDll);
+
+ s_bLog = TRUE;
+ return TRUE;
+}
+
+BOOL ProcessDetach(HMODULE hDll)
+{
+ ThreadDetach(hDll);
+ s_bLog = FALSE;
+
+ LONG error = DetachDetours();
+ if (error != NO_ERROR) {
+ Syelog(SYELOG_SEVERITY_FATAL, "### Error detaching detours: %d\n", error);
+ }
+
+ Syelog(SYELOG_SEVERITY_NOTICE, "### Closing.\n");
+ SyelogClose(FALSE);
+
+ if (s_nTlsIndent >= 0) {
+ TlsFree(s_nTlsIndent);
+ }
+ if (s_nTlsThread >= 0) {
+ TlsFree(s_nTlsThread);
+ }
+ return TRUE;
+}
+
+BOOL APIENTRY DllMain(HINSTANCE hModule, DWORD dwReason, PVOID lpReserved)
+{
+ (void)hModule;
+ (void)lpReserved;
+
+ if (DetourIsHelperProcess()) {
+ return TRUE;
+ }
+
+ switch (dwReason) {
+ case DLL_PROCESS_ATTACH:
+ DetourRestoreAfterWith();
+ printf("trctcp" DETOURS_STRINGIFY(DETOURS_BITS) ".dll: Starting.\n");
+ fflush(stdout);
+ return ProcessAttach(hModule);
+ case DLL_PROCESS_DETACH:
+ return ProcessDetach(hModule);
+ case DLL_THREAD_ATTACH:
+ return ThreadAttach(hModule);
+ case DLL_THREAD_DETACH:
+ return ThreadDetach(hModule);
+ }
+ return TRUE;
+}
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/tracetcp/trctcp.rc b/ext/detours/samples/tracetcp/trctcp.rc
new file mode 100644
index 0000000..b3c6af5
--- /dev/null
+++ b/ext/detours/samples/tracetcp/trctcp.rc
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Version information for trctcp.rc.
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include "detver.h"
+
+#define VER_INTERNALNAME_STR "trctcp" DETOURS_STRINGIFY(DETOURS_BITS)
+#define VER_ORIGINALFILENAME_STR "trctcp" DETOURS_STRINGIFY(DETOURS_BITS) ".dll"
+#define VER_FILEDESCRIPTION_STR "Detours TCP Trace Module"
+#define VER_COMPANYNAME_STR "Microsoft Corporation"
+
+#include "common.ver"
diff --git a/ext/detours/samples/tryman/Makefile b/ext/detours/samples/tryman/Makefile
new file mode 100644
index 0000000..62d1582
--- /dev/null
+++ b/ext/detours/samples/tryman/Makefile
@@ -0,0 +1,248 @@
+##############################################################################
+##
+## Detours Test Program
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+BIND_X86=$(ROOT)\bin.x86
+BIND_X64=$(ROOT)\bin.x64
+
+LIBS = $(LIBS) kernel32.lib
+
+##############################################################################
+
+all: dirs \
+ $(BIND)\tstman$(DETOURS_BITS).dll \
+ $(BIND)\tryman$(DETOURS_BITS).exe \
+ $(BIND)\size$(DETOURS_BITS).exe \
+ \
+ $(BIND)\managed-x64.exe \
+ $(BIND)\managed-ia64.exe \
+ $(BIND)\managed-x86.exe \
+ $(BIND)\managed-any.exe \
+ $(BIND)\managed-any32.exe \
+ \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\tstman$(DETOURS_BITS).bsc \
+ $(OBJD)\tryman$(DETOURS_BITS).bsc \
+!ENDIF
+ option
+
+##############################################################################
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(BIND)
+
+$(OBJD)\tstman.obj : tstman.cpp
+
+$(OBJD)\tstman.res : tstman.rc
+
+$(BIND)\tstman$(DETOURS_BITS).dll $(BIND)\tstman$(DETOURS_BITS).lib: \
+ $(OBJD)\tstman.obj $(OBJD)\tstman.res $(DEPS)
+ cl /LD $(CFLAGS) /Fe$(@R).dll /Fd$(@R).pdb \
+ $(OBJD)\tstman.obj $(OBJD)\tstman.res \
+ /link $(LINKFLAGS) /subsystem:console \
+ /export:DetourFinishHelperProcess,@1,NONAME \
+ /export:Test3264 \
+ $(LIBS)
+
+$(OBJD)\tstman$(DETOURS_BITS).bsc : tstman.obj
+ bscmake /v /n /o $@ tstman.sbr
+
+$(OBJD)\tryman.obj : tryman.cpp
+
+$(BIND)\tryman$(DETOURS_BITS).exe : $(OBJD)\tryman.obj $(DEPS) $(BIND)\tstman$(DETOURS_BITS).lib
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb $(OBJD)\tryman.obj \
+ /link $(LINKFLAGS) $(LIBS) $(BIND)\tstman$(DETOURS_BITS).lib \
+ /subsystem:console
+
+$(OBJD)\tryman$(DETOURS_BITS).bsc : $(OBJD)\tryman.obj
+ bscmake /v /n /o $@ $(OBJD)\tryman.sbr
+
+$(OBJD)\size.obj : size.cpp
+
+$(BIND)\size$(DETOURS_BITS).exe : $(OBJD)\size.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb $(OBJD)\size.obj \
+ /link $(LINKFLAGS) $(LIBS) \
+ /subsystem:console /fixed:no
+
+$(OBJD)\size$(DETOURS_BITS).bsc : $(OBJD)\size.obj
+ bscmake /v /n /o $@ $(OBJD)\size.sbr
+
+$(BIND)\key.snk:
+ if not exist $(BIND)\key.snk sn -k $(BIND)\key.snk
+
+CSCFLAGS=/nowarn:1607 /unsafe- /optimize+ /debug+ /warnaserror
+
+$(BIND)\managed-x64.exe : $(BIND)\key.snk managed.cs
+ csc /nologo $(CSCFLAGS) /platform:x64 /keyfile:$(BIND)\key.snk \
+ /out:$(BIND)\managed-x64.exe managed.cs
+
+$(BIND)\managed-ia64.exe : $(BIND)\key.snk managed.cs
+ csc /nologo $(CSCFLAGS) /platform:itanium /keyfile:$(BIND)\key.snk \
+ /out:$(BIND)\managed-ia64.exe managed.cs
+
+$(BIND)\managed-x86.exe : $(BIND)\key.snk managed.cs
+ csc /nologo $(CSCFLAGS) /platform:x86 /keyfile:$(BIND)\key.snk \
+ /out:$(BIND)\managed-x86.exe managed.cs
+
+$(BIND)\managed-any.exe : $(BIND)\key.snk managed.cs
+ csc /nologo $(CSCFLAGS) /platform:anycpu /keyfile:$(BIND)\key.snk \
+ /out:$(BIND)\managed-any.exe managed.cs
+
+$(BIND)\managed-any32.exe : $(BIND)\key.snk managed.cs
+ -csc /nologo $(CSCFLAGS) /platform:anycpu32bitpreferred /keyfile:$(BIND)\key.snk \
+ /out:$(BIND)\managed-any32.exe managed.cs
+
+##############################################################################
+
+clean:
+ -del *~ 2>nul
+ -del $(BIND)\managed-*.* 2>nul
+ -del $(BIND)\tstman*.* 2>nul
+ -del $(BIND)\tryman*.* 2>nul
+ -del $(BIND)\size*.* 2>nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+############################################### Install non-bit-size binaries.
+
+!IF "$(DETOURS_OPTION_PROCESSOR)" != ""
+
+$(OPTD)\tstman$(DETOURS_OPTION_BITS).dll:
+$(OPTD)\tstman$(DETOURS_OPTION_BITS).pdb:
+$(OPTD)\tryman$(DETOURS_OPTION_BITS).exe:
+$(OPTD)\tryman$(DETOURS_OPTION_BITS).pdb:
+$(OPTD)\size$(DETOURS_OPTION_BITS).exe:
+$(OPTD)\size$(DETOURS_OPTION_BITS).pdb:
+
+$(BIND)\tstman$(DETOURS_OPTION_BITS).dll : $(OPTD)\tstman$(DETOURS_OPTION_BITS).dll
+ @if exist $? copy /y $? $(BIND) >nul >nul && echo. $@ copied.
+$(BIND)\tstman$(DETOURS_OPTION_BITS).pdb : $(OPTD)\tstman$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul >nul && echo. $@ copied.
+$(BIND)\tryman$(DETOURS_OPTION_BITS).exe : $(OPTD)\tryman$(DETOURS_OPTION_BITS).exe
+ @if exist $? copy /y $? $(BIND) >nul >nul && echo. $@ copied.
+$(BIND)\tryman$(DETOURS_OPTION_BITS).pdb : $(OPTD)\tryman$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul >nul && echo. $@ copied.
+$(BIND)\size$(DETOURS_OPTION_BITS).exe : $(OPTD)\size$(DETOURS_OPTION_BITS).exe
+ @if exist $? copy /y $? $(BIND) >nul >nul && echo. $@ copied.
+$(BIND)\size$(DETOURS_OPTION_BITS).pdb : $(OPTD)\size$(DETOURS_OPTION_BITS).pdb
+ @if exist $? copy /y $? $(BIND) >nul >nul && echo. $@ copied.
+
+option: \
+ $(BIND)\tstman$(DETOURS_OPTION_BITS).dll \
+ $(BIND)\tstman$(DETOURS_OPTION_BITS).pdb \
+ $(BIND)\tryman$(DETOURS_OPTION_BITS).exe \
+ $(BIND)\tryman$(DETOURS_OPTION_BITS).pdb \
+ $(BIND)\size$(DETOURS_OPTION_BITS).exe \
+ $(BIND)\size$(DETOURS_OPTION_BITS).pdb \
+
+!ELSE
+
+option:
+
+!ENDIF
+
+##############################################################################
+
+# !IF "$(DETOURS_TARGET_PROCESSOR)" == "X64"
+# #!MESSAGE Building for 64-bit X64.
+# DETOURS_SOURCE_BROWSING = 0
+# !ELSEIF "$(DETOURS_TARGET_PROCESSOR)" == "IA64"
+# #!MESSAGE Building for 64-bit IA64.
+# !ELSEIF "$(DETOURS_TARGET_PROCESSOR)" == "X86"
+# #!MESSAGE Building for 32-bit X86.
+# !ELSE
+
+!if "$(DETOURS_OPTION_PROCESSOR)" != ""
+test: all size32 size64
+!else
+test: all
+!endif
+ @echo ---- Trying native binary w/o test ----------------------
+ $(BIND)\tryman$(DETOURS_BITS).exe
+ @echo.
+ @echo ---- Trying native binary -------------------------------
+ $(BIND)\withdll.exe -d:$(BIND)\tstman$(DETOURS_BITS).dll $(BIND)\tryman$(DETOURS_BITS).exe
+ @echo.
+ @echo ---- Trying anycpu managed binary -----------------------
+ -$(BIND)\withdll.exe -d:$(BIND)\tstman$(DETOURS_BITS).dll $(BIND)\managed-any.exe
+ @echo.
+ @echo ---- Trying anycpu managed 32-bit preferrred binary -----
+ -if exist $(BIND)\managed-any32.exe $(BIND)\withdll.exe -d:$(BIND)\tstman$(DETOURS_BITS).dll $(BIND)\managed-any32.exe
+ @echo.
+ @echo ---- Trying x86 managed binary --------------------------
+ -$(BIND)\withdll.exe -d:$(BIND)\tstman$(DETOURS_BITS).dll $(BIND)\managed-x86.exe
+ @echo.
+ @echo ---- Trying x64 managed binary --------------------------
+ -$(BIND)\withdll.exe -d:$(BIND)\tstman$(DETOURS_BITS).dll $(BIND)\managed-x64.exe
+ @echo.
+ @echo ---- Trying ia64 managed binary -------------------------
+ -$(BIND)\withdll.exe -d:$(BIND)\tstman$(DETOURS_BITS).dll $(BIND)\managed-ia64.exe
+ @echo.
+
+testm: all
+ csc managed.cs
+ @echo.
+ $(BIND)\withdll.exe -d:$(BIND)\tstman$(DETOURS_BITS).dll $(BIND)\managed-any.exe
+ @echo.
+
+size: all
+ @echo.
+ $(BIND)\withdll.exe -d:$(BIND)\tstman$(DETOURS_BITS).dll $(BIND)\size$(DETOURS_BITS).exe 10
+ @echo.
+
+size32: all
+ @echo.
+ $(BIND)\withdll.exe -d:$(BIND)\tstman$(DETOURS_BITS).dll $(BIND)\size32.exe 10
+ @echo.
+
+size64: all
+ @echo.
+ $(BIND)\withdll.exe -d:$(BIND)\tstman$(DETOURS_BITS).dll $(BIND)\size64.exe 10
+ @echo.
+
+sizedbg: all
+ @echo.
+ windbg -o $(BIND)\withdll.exe -d:$(BIND)\tstman$(DETOURS_BITS).dll $(BIND)\size$(DETOURS_BITS).exe 10
+ @echo.
+
+tx: all
+ cd $(MAKEDIR)\..\..\src
+ nmake /nologo
+ cd $(MAKEDIR)\..\..\samples\withdll
+ nmake /nologo
+ cd $(MAKEDIR)
+ rem $(BIND)\withdll.exe -d:$(BIND)\tstman$(DETOURS_BITS).dll $(BIND)\managed.exe
+ windbg -g -o $(BIND)\withdll.exe -d:$(BIND)\tstman$(DETOURS_BITS).dll $(BIND)\managed-any.exe
+
+mx: all
+ cd $(MAKEDIR)\..\..\src
+ nmake /nologo
+ cd $(MAKEDIR)\..\..\samples\withdll
+ nmake /nologo
+ cd $(MAKEDIR)
+ $(BIND)\withdll.exe -d:$(BIND)\tstman$(DETOURS_BITS).dll $(BIND)\tryman$(DETOURS_BITS).exe
+
+test-managed: all
+ @echo ---- Trying anycpu managed binary -----------------------
+ -$(BIND)\withdll.exe -d:$(BIND)\tstman$(DETOURS_BITS).dll $(BIND)\managed-any.exe
+ @echo.
+ @echo ---- Trying x86 managed binary --------------------------
+ -$(BIND_X86)\withdll.exe -d:$(BIND_X86)\tstman32.dll $(BIND_X86)\managed-x86.exe
+ @echo.
+ @echo ---- Trying anycpu managed 32-bit preferrred binary -----
+ -if exist $(BIND_X86)\managed-any32.exe $(BIND_X86)\withdll.exe -d:$(BIND_X86)\tstman32.dll $(BIND_X86)\managed-any32.exe
+ @echo.
+ @echo ---- Trying x64 managed binary --------------------------
+ -$(BIND)\withdll.exe -d:$(BIND_X64)\tstman64.dll $(BIND)\managed-x64.exe
+
+################################################################# End of File.
diff --git a/ext/detours/samples/tryman/managed.cs b/ext/detours/samples/tryman/managed.cs
new file mode 100644
index 0000000..cf8481d
--- /dev/null
+++ b/ext/detours/samples/tryman/managed.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyProduct("Microsoft Research Detours")]
+[assembly: AssemblyCompany("Microsoft Corporation")]
+[assembly: AssemblyVersion("1.0.0.0")]
+
+public class Test
+{
+ // [DllImport("kernel32.dll", CharSet=CharSet.Auto, SetLastError=true)]
+ // static extern IntPtr LoadLibrary([In, MarshalAs(UnmanagedType.LPStr)] string lpFileName);
+
+ [DllImport("kernel32", CharSet=CharSet.Auto, SetLastError=true)]
+ static extern IntPtr LoadLibrary(string lpFileName);
+
+ public static int Main()
+ {
+ if (IntPtr.Size == 4) {
+ Console.WriteLine(" *** Managed code with 32-bit runtime ({0})",
+ Environment.Version);
+ }
+ else if (IntPtr.Size == 8) {
+ Console.WriteLine(" *** Managed code with 64-bit runtime ({0})",
+ Environment.Version);
+ }
+ else {
+ Console.WriteLine(" *** Managed code of unknown IntPtr.Size: {0}", IntPtr.Size);
+ }
+
+ if (IntPtr.Size == 4) {
+ if (LoadLibrary("tstman32.dll") == (IntPtr)0) {
+ Console.WriteLine("--------: managed code failed to load tstman32.dll");
+
+ }
+ }
+ else {
+ if (LoadLibrary("tstman64.dll") == (IntPtr)0) {
+ Console.WriteLine("--------: managed code failed to load tstman64.dll");
+
+ }
+ }
+
+ return 0;
+ }
+}
+
+
diff --git a/ext/detours/samples/tryman/size.cpp b/ext/detours/samples/tryman/size.cpp
new file mode 100644
index 0000000..f026750
--- /dev/null
+++ b/ext/detours/samples/tryman/size.cpp
@@ -0,0 +1,94 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detour Test Program (sleepold.cpp of sleepold.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#pragma warning(push)
+#if _MSC_VER > 1400
+#pragma warning(disable:6102 6103) // /analyze warnings
+#endif
+#include <strsafe.h>
+#pragma warning(pop)
+#include <detours.h>
+
+int __cdecl main(int argc, char **argv)
+{
+ STARTUPINFOA si;
+ PROCESS_INFORMATION pi;
+ CHAR szFullExe[MAX_PATH];
+ CHAR szCommand[MAX_PATH];
+ PCHAR pszFileExe;
+ PCHAR pszExe;
+
+ ZeroMemory(&si, sizeof(si));
+ ZeroMemory(&pi, sizeof(pi));
+ si.cb = sizeof(si);
+
+
+ if (argc != 2) {
+ printf("size" DETOURS_STRINGIFY(DETOURS_BITS) ".exe:"
+ " must take a single integer argument.\n");
+ fflush(stdout);
+ return 3;
+ }
+
+ int repeats = atoi(argv[1]);
+
+ if (repeats <= 0) {
+ printf("size" DETOURS_STRINGIFY(DETOURS_BITS) ".exe:"
+ " End of the road, repeats=0.\n");
+ fflush(stdout);
+ return 0;
+ }
+
+ if ((repeats % 2) == 0) {
+#ifdef DETOURS_OPTION_BITS
+ pszExe = "size" DETOURS_STRINGIFY(DETOURS_OPTION_BITS) ".exe";
+#else
+ pszExe = "size" DETOURS_STRINGIFY(DETOURS_BITS) ".exe";
+#endif
+ }
+ else {
+ pszExe = "size" DETOURS_STRINGIFY(DETOURS_BITS) ".exe";
+ }
+
+ if (!SearchPathA(NULL, pszExe, ".exe", ARRAYSIZE(szFullExe), szFullExe, &pszFileExe)) {
+ pszExe = "size" DETOURS_STRINGIFY(DETOURS_BITS) ".exe";
+ SearchPathA(NULL, pszExe, ".exe", ARRAYSIZE(szFullExe), szFullExe, &pszFileExe);
+ }
+
+ StringCchPrintfA(szCommand, sizeof(szCommand), "%s %d", pszExe, repeats - 1);
+
+ printf("size" DETOURS_STRINGIFY(DETOURS_BITS) ".exe:"
+ " [%s]\n", szCommand);
+ fflush(stdout);
+
+ SetLastError(0);
+ if (!CreateProcessA(szFullExe[0] ? szFullExe : NULL, szCommand,
+ NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi)) {
+ DWORD dwError = GetLastError();
+ printf("size" DETOURS_STRINGIFY(DETOURS_BITS) ".exe:"
+ " CreateProcess failed: %ld\n", dwError);
+ return 1;
+ }
+
+ WaitForSingleObject(pi.hProcess, INFINITE);
+
+ DWORD dwResult = 0;
+ if (!GetExitCodeProcess(pi.hProcess, &dwResult)) {
+ printf("size" DETOURS_STRINGIFY(DETOURS_BITS) ".exe:"
+ " GetExitCodeProcess failed: %ld\n", GetLastError());
+ return 9010;
+ }
+
+ return 0;
+}
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/tryman/tryman.cpp b/ext/detours/samples/tryman/tryman.cpp
new file mode 100644
index 0000000..19a159b
--- /dev/null
+++ b/ext/detours/samples/tryman/tryman.cpp
@@ -0,0 +1,23 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (tryman.cpp of tryman.exe)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include <windows.h>
+
+extern int WINAPI Test3264(int arg);
+
+int __cdecl main(int argc, char ** argv)
+{
+ (void)argv;
+ int ret = 0;
+
+ ret = Test3264(argc);
+ return ret == 0 ? ret : 0;
+}
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/tryman/tstman.cpp b/ext/detours/samples/tryman/tstman.cpp
new file mode 100644
index 0000000..0ae169b
--- /dev/null
+++ b/ext/detours/samples/tryman/tstman.cpp
@@ -0,0 +1,334 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Detours Test Program (tstman.cpp of tstman.dll)
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+// This DLL doesn't detour any APIs, but it does enumerate the modules
+// loaded in a process and look at their size and processor target.
+//
+
+#include <stdio.h>
+#include <windows.h>
+#pragma warning(push)
+#if _MSC_VER > 1400
+#pragma warning(disable:6102 6103) // /analyze warnings
+#endif
+#include <strsafe.h>
+#pragma warning(pop)
+#include "detours.h"
+
+static HMODULE s_hInst = NULL;
+static CHAR s_szDllPath[MAX_PATH];
+
+static int (WINAPI * TrueEntryPoint)(VOID) = NULL;
+static int (WINAPI * RawEntryPoint)(VOID) = NULL;
+
+BOOL (WINAPI * Real_CreateProcessA)(LPCSTR a0,
+ LPSTR a1,
+ LPSECURITY_ATTRIBUTES a2,
+ LPSECURITY_ATTRIBUTES a3,
+ BOOL a4,
+ DWORD a5,
+ LPVOID a6,
+ LPCSTR a7,
+ struct _STARTUPINFOA* a8,
+ LPPROCESS_INFORMATION a9)
+ = CreateProcessA;
+
+BOOL (WINAPI * Real_CreateProcessW)(LPCWSTR a0,
+ LPWSTR a1,
+ LPSECURITY_ATTRIBUTES a2,
+ LPSECURITY_ATTRIBUTES a3,
+ BOOL a4,
+ DWORD a5,
+ LPVOID a6,
+ LPCWSTR a7,
+ struct _STARTUPINFOW* a8,
+ LPPROCESS_INFORMATION a9)
+ = CreateProcessW;
+
+
+BOOL WINAPI Mine_CreateProcessA(LPCSTR lpApplicationName,
+ LPSTR lpCommandLine,
+ LPSECURITY_ATTRIBUTES lpProcessAttributes,
+ LPSECURITY_ATTRIBUTES lpThreadAttributes,
+ BOOL bInheritHandles,
+ DWORD dwCreationFlags,
+ LPVOID lpEnvironment,
+ LPCSTR lpCurrentDirectory,
+ LPSTARTUPINFOA lpStartupInfo,
+ LPPROCESS_INFORMATION lpProcessInformation)
+{
+ BOOL rv = 0;
+ __try {
+ rv = DetourCreateProcessWithDllExA(lpApplicationName,
+ lpCommandLine,
+ lpProcessAttributes,
+ lpThreadAttributes,
+ bInheritHandles,
+ dwCreationFlags,
+ lpEnvironment,
+ lpCurrentDirectory,
+ lpStartupInfo,
+ lpProcessInformation,
+ s_szDllPath,
+ Real_CreateProcessA);
+ } __finally {
+ };
+ return rv;
+}
+
+BOOL WINAPI Mine_CreateProcessW(LPCWSTR lpApplicationName,
+ LPWSTR lpCommandLine,
+ LPSECURITY_ATTRIBUTES lpProcessAttributes,
+ LPSECURITY_ATTRIBUTES lpThreadAttributes,
+ BOOL bInheritHandles,
+ DWORD dwCreationFlags,
+ LPVOID lpEnvironment,
+ LPCWSTR lpCurrentDirectory,
+ LPSTARTUPINFOW lpStartupInfo,
+ LPPROCESS_INFORMATION lpProcessInformation)
+{
+ BOOL rv = 0;
+ __try {
+ rv = DetourCreateProcessWithDllExW(lpApplicationName,
+ lpCommandLine,
+ lpProcessAttributes,
+ lpThreadAttributes,
+ bInheritHandles,
+ dwCreationFlags,
+ lpEnvironment,
+ lpCurrentDirectory,
+ lpStartupInfo,
+ lpProcessInformation,
+ s_szDllPath,
+ Real_CreateProcessW);
+ } __finally {
+ };
+ return rv;
+}
+
+void DumpModuleInfo(HMODULE hModule)
+{
+ PBYTE pbModule = (PBYTE)hModule;
+ PIMAGE_DOS_HEADER pidh = (PIMAGE_DOS_HEADER)pbModule;
+ PIMAGE_NT_HEADERS pinh = (PIMAGE_NT_HEADERS)(pbModule + pidh->e_lfanew);
+ CHAR szFile[MAX_PATH] = "";
+
+ GetModuleFileNameA(hModule, szFile, sizeof(szFile));
+
+ CHAR szMagic[64];
+ CHAR szMachine[64];
+ CHAR szClr[64];
+
+ PIMAGE_DATA_DIRECTORY pdir
+ = (pinh->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)
+ ? ((PIMAGE_NT_HEADERS32)pinh)->OptionalHeader.DataDirectory
+ : ((PIMAGE_NT_HEADERS64)pinh)->OptionalHeader.DataDirectory;
+
+ if (pdir[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].VirtualAddress != 0 &&
+ pdir[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].Size != 0) {
+
+ PDETOUR_CLR_HEADER pch
+ = (PDETOUR_CLR_HEADER)
+ (pbModule + pdir[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].VirtualAddress);
+
+ if ((pch->Flags & 0x3) == 0x0) {
+ StringCchPrintfA(szClr, ARRAYSIZE(szClr), "clr "); // 32- or 64-bit.
+ }
+ else if ((pch->Flags & 0x3) == 0x1) {
+ StringCchPrintfA(szClr, ARRAYSIZE(szClr), "clri "); // IL-Only, 32- or 64-bit.
+ }
+ else if ((pch->Flags & 0x3) == 0x2) {
+ StringCchPrintfA(szClr, ARRAYSIZE(szClr), "clr32 "); // must be 32-bit.
+ }
+ else if ((pch->Flags & 0x3) == 0x3) {
+ StringCchPrintfA(szClr, ARRAYSIZE(szClr), "clr32i"); // IL-Only, must be 32-bit.
+ }
+ }
+ else {
+ StringCchPrintfA(szClr, ARRAYSIZE(szClr), " ");
+ }
+
+ if (pinh->OptionalHeader.Magic == 0x10b) {
+ StringCchPrintfA(szMagic, ARRAYSIZE(szMagic), "32");
+ }
+ else if (pinh->OptionalHeader.Magic == 0x20b) {
+ StringCchPrintfA(szMagic, ARRAYSIZE(szMagic), "64");
+ }
+ else {
+ StringCchPrintfA(szMagic, ARRAYSIZE(szMagic), "??");
+ }
+
+ if (pinh->FileHeader.Machine == 0x8664) {
+ StringCchPrintfA(szMachine, ARRAYSIZE(szMachine), "x64", pinh->FileHeader.Machine);
+ }
+ else if (pinh->FileHeader.Machine == 0x014c) {
+ StringCchPrintfA(szMachine, ARRAYSIZE(szMachine), "x86", pinh->FileHeader.Machine);
+ }
+ else if (pinh->FileHeader.Machine == 0x0200) {
+ StringCchPrintfA(szMachine, ARRAYSIZE(szMachine), "i64", pinh->FileHeader.Machine);
+ }
+ else if (pinh->FileHeader.Machine == 0x01c0) {
+ StringCchPrintfA(szMachine, ARRAYSIZE(szMachine), "arm", pinh->FileHeader.Machine);
+ }
+ else {
+ StringCchPrintfA(szMachine, ARRAYSIZE(szMachine), "%04x", pinh->FileHeader.Machine);
+ DWORD dwSize = DetourGetSizeOfPayloads(hModule);
+ if (dwSize > 0) {
+ StringCchPrintfA(szMachine, ARRAYSIZE(szMachine), " ");
+ StringCchPrintfA(szFile, ARRAYSIZE(szFile), "-- %d byte payload.", dwSize);
+ }
+ }
+
+ printf("%16I64x: %s %s %s %s\n", (ULONG64)hModule, szMagic, szMachine, szClr, szFile);
+}
+
+void DumpMemory(PBYTE pbData, DWORD cbData)
+{
+ for (DWORD i = 0; i < cbData; i += 16) {
+ printf(" %p:", pbData + i);
+ for (DWORD j = 0; j < 16; j++) {
+ if (i + j < cbData) {
+ printf("%02x", pbData[i+j]);
+ }
+ else {
+ printf(" ");
+ }
+ }
+ printf(" ");
+ for (DWORD j = 0; j < 16; j++) {
+ if (i + j < cbData) {
+ if ( pbData[i+j] >= ' ' && pbData[i+j] < 127) {
+ printf("%c", pbData[i+j]);
+ }
+ else {
+ printf(".");
+ }
+ }
+ else {
+ printf(" ");
+ }
+ }
+ printf("\n");
+ }
+}
+
+int WINAPI Test3264(int arg)
+{
+ return arg + 1;
+}
+
+int WINAPI TestEntryPoint(VOID)
+{
+#if DETOURS_64BIT
+ printf("----------------: ");
+#else
+ printf("--------: ");
+#endif
+
+ printf("Calling EntryPoint() from detour.\n");
+ fflush(stdout);
+
+ return TrueEntryPoint();
+}
+
+BOOL WINAPI DllMain(HINSTANCE hinst, DWORD dwReason, LPVOID reserved)
+{
+ (void)hinst;
+ (void)reserved;
+
+ if (DetourIsHelperProcess()) {
+ return TRUE;
+ }
+
+ if (dwReason == DLL_PROCESS_ATTACH) {
+ DetourRestoreAfterWith();
+
+ s_hInst = hinst;
+ GetModuleFileNameA(s_hInst, s_szDllPath, ARRAYSIZE(s_szDllPath));
+
+#if DETOURS_64BIT
+ printf("----------------: ");
+#else
+ printf("--------: ");
+#endif
+
+ SYSTEM_INFO si;
+ GetSystemInfo(&si);
+
+ if (si.wProcessorArchitecture == 9) {
+ printf("x64 Processor\n");
+ }
+ else if (si.wProcessorArchitecture == 0) {
+ printf("x86 Processor\n");
+ }
+ else if (si.wProcessorArchitecture == 6) {
+ printf("ia64 Processor\n");
+ }
+ else {
+ printf("%04x Processor\n", si.wProcessorArchitecture);
+ }
+
+ HMODULE hSelf = GetModuleHandle(NULL);
+ HMODULE hTest = (HMODULE)DetourGetContainingModule(DetourCodeFromPointer(Test3264, NULL));
+ HMODULE hKern = (HMODULE)DetourGetContainingModule(DetourCodeFromPointer(CreateProcessW, NULL));
+
+ DumpModuleInfo(hSelf);
+ DumpModuleInfo(hTest);
+ DumpModuleInfo(hKern);
+ for (HINSTANCE hInst = NULL; (hInst = DetourEnumerateModules(hInst)) != NULL;) {
+ if (hInst == hSelf || hInst == hTest || hInst == hKern) {
+ continue;
+ }
+
+ DumpModuleInfo(hInst);
+ }
+ fflush(stdout);
+
+ TrueEntryPoint = (int (WINAPI *)(VOID))DetourGetEntryPoint(NULL);
+ RawEntryPoint = TrueEntryPoint;
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourAttach(&(PVOID&)TrueEntryPoint, TestEntryPoint);
+ DetourAttach(&(PVOID&)Real_CreateProcessA, Mine_CreateProcessA);
+ DetourAttach(&(PVOID&)Real_CreateProcessW, Mine_CreateProcessW);
+ LONG error = DetourTransactionCommit();
+
+#if DETOURS_64BIT
+ printf("----------------: ");
+#else
+ printf("--------: ");
+#endif
+
+ if (error == NO_ERROR) {
+ printf("Detoured EntryPoint().\n");
+ }
+ else {
+ printf("Error detouring EntryPoint(): %ld (@ %p)\n", error, RawEntryPoint);
+ __debugbreak();
+ }
+ }
+ else if (dwReason == DLL_PROCESS_DETACH) {
+
+ DetourTransactionBegin();
+ DetourUpdateThread(GetCurrentThread());
+ DetourDetach(&(PVOID&)TrueEntryPoint, TestEntryPoint);
+ DetourDetach(&(PVOID&)Real_CreateProcessA, Mine_CreateProcessA);
+ DetourDetach(&(PVOID&)Real_CreateProcessW, Mine_CreateProcessW);
+ LONG error = DetourTransactionCommit();
+
+ if (error != NO_ERROR) {
+ printf("Error detach detours failed: %ld\n", error);
+ }
+ }
+
+ return TRUE;
+}
+
+//
+///////////////////////////////////////////////////////////////// End of File.
diff --git a/ext/detours/samples/tryman/tstman.rc b/ext/detours/samples/tryman/tstman.rc
new file mode 100644
index 0000000..7380844
--- /dev/null
+++ b/ext/detours/samples/tryman/tstman.rc
@@ -0,0 +1,17 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Version information for tstman.rc.
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+#include "detver.h"
+
+#define VER_INTERNALNAME_STR "tstman" DETOURS_STRINGIFY(DETOURS_BITS)
+#define VER_ORIGINALFILENAME_STR "tstman" DETOURS_STRINGIFY(DETOURS_BITS) ".dll"
+#define VER_FILEDESCRIPTION_STR "Detours 32/64-bit Test Module"
+#define VER_COMPANYNAME_STR "Microsoft Corporation"
+
+#include "common.ver"
diff --git a/ext/detours/samples/withdll/Makefile b/ext/detours/samples/withdll/Makefile
new file mode 100644
index 0000000..cafca4f
--- /dev/null
+++ b/ext/detours/samples/withdll/Makefile
@@ -0,0 +1,60 @@
+##############################################################################
+##
+## Makefile for Detours Test Programs.
+##
+## Microsoft Research Detours Package
+##
+## Copyright (c) Microsoft Corporation. All rights reserved.
+##
+
+!include ..\common.mak
+
+LIBS=$(LIBS) kernel32.lib
+
+##############################################################################
+
+all: dirs \
+ $(BIND)\withdll.exe \
+!IF $(DETOURS_SOURCE_BROWSING)==1
+ $(OBJD)\withdll.bsc \
+!ENDIF
+ option
+
+clean:
+ -del *~ 2>nul
+ -del $(BIND)\withdll.* 2>nul
+ -rmdir /q /s $(OBJD) 2>nul
+
+realclean: clean
+ -rmdir /q /s $(OBJDS) 2>nul
+
+##############################################################################
+
+dirs:
+ @if not exist $(BIND) mkdir $(BIND) && echo. Created $(BIND)
+ @if not exist $(OBJD) mkdir $(OBJD) && echo. Created $(OBJD)
+
+$(OBJD)\withdll.obj : withdll.cpp
+
+$(BIND)\withdll.exe : $(OBJD)\withdll.obj $(DEPS)
+ cl $(CFLAGS) /Fe$@ /Fd$(@R).pdb $(OBJD)\withdll.obj \
+ /link $(LINKFLAGS) $(LIBS) /subsystem:console
+
+$(OBJD)\withdll.bsc : $(OBJD)\withdll.obj
+ bscmake /v /n /o $@ $(OBJD)\withdll.sbr
+
+############################################### Install non-bit-size binaries.
+
+option:
+
+##############################################################################
+
+test: all
+ $(BIND)\withdll.exe -d:$(BIND)\slept$(DETOURS_BITS).dll $(BIND)\sleepold.exe
+ $(BIND)\withdll.exe -v -d:$(BIND)\slept$(DETOURS_BITS).dll $(BIND)\sleepold.exe
+
+debug: all
+ windbg -c ".srcfix;l+s;l+t" -o \
+ $(BIND)\withdll.exe -d:$(BIND)\slept$(DETOURS_BITS).dll $(BIND)\sleepold.exe
+
+################################################################# End of File.
diff --git a/ext/detours/samples/withdll/withdll.cpp b/ext/detours/samples/withdll/withdll.cpp
new file mode 100644
index 0000000..4704573
--- /dev/null
+++ b/ext/detours/samples/withdll/withdll.cpp
@@ -0,0 +1,540 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// Test DetourCreateProcessWithDll function (withdll.cpp).
+//
+// Microsoft Research Detours Package
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+#include <stdio.h>
+#include <windows.h>
+#include <detours.h>
+#pragma warning(push)
+#if _MSC_VER > 1400
+#pragma warning(disable:6102 6103) // /analyze warnings
+#endif
+#include <strsafe.h>
+#pragma warning(pop)
+
+//////////////////////////////////////////////////////////////////////////////
+//
+void PrintUsage(void)
+{
+ printf("Usage:\n"
+ " withdll.exe [options] [command line]\n"
+ "Options:\n"
+ " /d:file.dll : Start the process with file.dll.\n"
+ " /v : Verbose, display memory at start.\n"
+ " /? : This help screen.\n");
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// This code verifies that the named DLL has been configured correctly
+// to be imported into the target process. DLLs must export a function with
+// ordinal #1 so that the import table touch-up magic works.
+//
+struct ExportContext
+{
+ BOOL fHasOrdinal1;
+ ULONG nExports;
+};
+
+static BOOL CALLBACK ExportCallback(_In_opt_ PVOID pContext,
+ _In_ ULONG nOrdinal,
+ _In_opt_ LPCSTR pszSymbol,
+ _In_opt_ PVOID pbTarget)
+{
+ (void)pContext;
+ (void)pbTarget;
+ (void)pszSymbol;
+
+ ExportContext *pec = (ExportContext *)pContext;
+
+ if (nOrdinal == 1) {
+ pec->fHasOrdinal1 = TRUE;
+ }
+ pec->nExports++;
+
+ return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+
+//////////////////////////////////////////////////////////////////////////////
+//
+
+void TypeToString(DWORD Type, char *pszBuffer, size_t cBuffer)
+{
+ if (Type == MEM_IMAGE) {
+ StringCchPrintfA(pszBuffer, cBuffer, "img");
+ }
+ else if (Type == MEM_MAPPED) {
+ StringCchPrintfA(pszBuffer, cBuffer, "map");
+ }
+ else if (Type == MEM_PRIVATE) {
+ StringCchPrintfA(pszBuffer, cBuffer, "pri");
+ }
+ else {
+ StringCchPrintfA(pszBuffer, cBuffer, "%x", Type);
+ }
+}
+
+void StateToString(DWORD State, char *pszBuffer, size_t cBuffer)
+{
+ if (State == MEM_COMMIT) {
+ StringCchPrintfA(pszBuffer, cBuffer, "com");
+ }
+ else if (State == MEM_FREE) {
+ StringCchPrintfA(pszBuffer, cBuffer, "fre");
+ }
+ else if (State == MEM_RESERVE) {
+ StringCchPrintfA(pszBuffer, cBuffer, "res");
+ }
+ else {
+ StringCchPrintfA(pszBuffer, cBuffer, "%x", State);
+ }
+}
+
+void ProtectToString(DWORD Protect, char *pszBuffer, size_t cBuffer)
+{
+ if (Protect == 0) {
+ StringCchPrintfA(pszBuffer, cBuffer, "");
+ }
+ else if (Protect == PAGE_EXECUTE) {
+ StringCchPrintfA(pszBuffer, cBuffer, "--x");
+ }
+ else if (Protect == PAGE_EXECUTE_READ) {
+ StringCchPrintfA(pszBuffer, cBuffer, "r-x");
+ }
+ else if (Protect == PAGE_EXECUTE_READWRITE) {
+ StringCchPrintfA(pszBuffer, cBuffer, "rwx");
+ }
+ else if (Protect == PAGE_EXECUTE_WRITECOPY) {
+ StringCchPrintfA(pszBuffer, cBuffer, "rcx");
+ }
+ else if (Protect == PAGE_NOACCESS) {
+ StringCchPrintfA(pszBuffer, cBuffer, "---");
+ }
+ else if (Protect == PAGE_READONLY) {
+ StringCchPrintfA(pszBuffer, cBuffer, "r--");
+ }
+ else if (Protect == PAGE_READWRITE) {
+ StringCchPrintfA(pszBuffer, cBuffer, "rw-");
+ }
+ else if (Protect == PAGE_WRITECOPY) {
+ StringCchPrintfA(pszBuffer, cBuffer, "rc-");
+ }
+ else if (Protect == (PAGE_GUARD | PAGE_EXECUTE)) {
+ StringCchPrintfA(pszBuffer, cBuffer, "g--x");
+ }
+ else if (Protect == (PAGE_GUARD | PAGE_EXECUTE_READ)) {
+ StringCchPrintfA(pszBuffer, cBuffer, "gr-x");
+ }
+ else if (Protect == (PAGE_GUARD | PAGE_EXECUTE_READWRITE)) {
+ StringCchPrintfA(pszBuffer, cBuffer, "grwx");
+ }
+ else if (Protect == (PAGE_GUARD | PAGE_EXECUTE_WRITECOPY)) {
+ StringCchPrintfA(pszBuffer, cBuffer, "grcx");
+ }
+ else if (Protect == (PAGE_GUARD | PAGE_NOACCESS)) {
+ StringCchPrintfA(pszBuffer, cBuffer, "g---");
+ }
+ else if (Protect == (PAGE_GUARD | PAGE_READONLY)) {
+ StringCchPrintfA(pszBuffer, cBuffer, "gr--");
+ }
+ else if (Protect == (PAGE_GUARD | PAGE_READWRITE)) {
+ StringCchPrintfA(pszBuffer, cBuffer, "grw-");
+ }
+ else if (Protect == (PAGE_GUARD | PAGE_WRITECOPY)) {
+ StringCchPrintfA(pszBuffer, cBuffer, "grc-");
+ }
+ else {
+ StringCchPrintfA(pszBuffer, cBuffer, "%x", Protect);
+ }
+}
+
+typedef union
+{
+ struct
+ {
+ DWORD Signature;
+ IMAGE_FILE_HEADER FileHeader;
+ } ih;
+
+ IMAGE_NT_HEADERS32 ih32;
+ IMAGE_NT_HEADERS64 ih64;
+} IMAGE_NT_HEADER;
+
+struct SECTIONS
+{
+ PBYTE pbBeg;
+ PBYTE pbEnd;
+ CHAR szName[16];
+} Sections[256];
+DWORD SectionCount = 0;
+DWORD Bitness = 0;
+
+PCHAR FindSectionName(PBYTE pbBase, PBYTE& pbEnd)
+{
+ for (DWORD n = 0; n < SectionCount; n++) {
+ if (Sections[n].pbBeg == pbBase) {
+ pbEnd = Sections[n].pbEnd;
+ return Sections[n].szName;
+ }
+ }
+ pbEnd = NULL;
+ return NULL;
+}
+
+ULONG PadToPage(ULONG Size)
+{
+ return (Size & 0xfff)
+ ? Size + 0x1000 - (Size & 0xfff)
+ : Size;
+}
+
+BOOL GetSections(HANDLE hp, PBYTE pbBase)
+{
+ DWORD beg = 0;
+ DWORD cnt = 0;
+ SIZE_T done;
+ IMAGE_DOS_HEADER idh;
+
+ if (!ReadProcessMemory(hp, pbBase, &idh, sizeof(idh), &done) || done != sizeof(idh)) {
+ return FALSE;
+ }
+
+ if (idh.e_magic != IMAGE_DOS_SIGNATURE) {
+ return FALSE;
+ }
+
+ IMAGE_NT_HEADER inh;
+ if (!ReadProcessMemory(hp, pbBase + idh.e_lfanew, &inh, sizeof(inh), &done) || done != sizeof(inh)) {
+ printf("No Read\n");
+ return FALSE;
+ }
+
+ if (inh.ih.Signature != IMAGE_NT_SIGNATURE) {
+ printf("No NT\n");
+ return FALSE;
+ }
+
+ beg = idh.e_lfanew
+ + FIELD_OFFSET( IMAGE_NT_HEADERS, OptionalHeader )
+ + inh.ih.FileHeader.SizeOfOptionalHeader;
+ cnt = inh.ih.FileHeader.NumberOfSections;
+ Bitness = (inh.ih32.OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC) ? 32 : 64;
+#if 0
+ printf("%d %d count=%d\n", beg, Bitness, cnt);
+#endif
+
+ IMAGE_SECTION_HEADER ish;
+ for (DWORD n = 0; n < cnt; n++) {
+ if (!ReadProcessMemory(hp, pbBase + beg + n * sizeof(ish), &ish, sizeof(ish), &done) || done != sizeof(ish)) {
+ printf("No Read\n");
+ return FALSE;
+ }
+ Sections[n].pbBeg = pbBase + ish.VirtualAddress;
+ Sections[n].pbEnd = pbBase + ish.VirtualAddress + PadToPage(ish.Misc.VirtualSize);
+ memcpy(Sections[n].szName, ish.Name, sizeof(ish.Name));
+ Sections[n].szName[sizeof(ish.Name)] = '\0';
+#if 0
+ printf("--- %p %s\n", Sections[n].pbBeg, Sections[n].szName);
+#endif
+ }
+ SectionCount = cnt;
+
+ return TRUE;
+}
+
+BOOL DumpProcess(HANDLE hp)
+{
+ ULONG64 base;
+ ULONG64 next;
+
+ MEMORY_BASIC_INFORMATION mbi;
+
+ printf(" %12s %8s %8s: %3s %3s %4s %3s : %8s\n", "Address", "Offset", "Size", "Typ", "Sta", "Prot", "Ini", "Contents");
+ printf(" %12s %8s %8s: %3s %3s %4s %3s : %8s\n", "------------", "--------", "--------", "---", "---", "----", "---", "-----------------");
+
+ for (next = 0;;) {
+ base = next;
+ ZeroMemory(&mbi, sizeof(mbi));
+ if (VirtualQueryEx(hp, (PVOID)base, &mbi, sizeof(mbi)) == 0) {
+ break;
+ }
+ if ((mbi.RegionSize & 0xfff) == 0xfff) {
+ break;
+ }
+
+ next = (ULONG64)mbi.BaseAddress + mbi.RegionSize;
+
+ if (mbi.State == MEM_FREE) {
+ continue;
+ }
+
+ CHAR szType[16];
+ TypeToString(mbi.Type, szType, ARRAYSIZE(szType));
+ CHAR szState[16];
+ StateToString(mbi.State, szState, ARRAYSIZE(szState));
+ CHAR szProtect[16];
+ ProtectToString(mbi.Protect, szProtect, ARRAYSIZE(szProtect));
+ CHAR szAllocProtect[16];
+ ProtectToString(mbi.AllocationProtect, szAllocProtect, ARRAYSIZE(szAllocProtect));
+
+ CHAR szFile[MAX_PATH];
+ szFile[0] = '\0';
+ DWORD cb = 0;
+ PCHAR pszFile = szFile;
+
+ if (base == (ULONG64)mbi.AllocationBase) {
+#if 0
+ cb = pfGetMappedFileName(hp, (PVOID)mbi.AllocationBase, szFile, ARRAYSIZE(szFile));
+#endif
+ if (GetSections(hp, (PBYTE)mbi.AllocationBase)) {
+ next = base + 0x1000;
+ StringCchPrintfA(szFile, ARRAYSIZE(szFile), "%d-bit PE", Bitness);
+ }
+ }
+ if (cb > 0) {
+ for (DWORD c = 0; c < cb; c++) {
+ szFile[c] = (szFile[c] >= 'a' && szFile[c] <= 'z')
+ ? szFile[c] - 'a' + 'A' : szFile[c];
+ }
+ szFile[cb] = '\0';
+ }
+
+ if ((pszFile = strrchr(szFile, '\\')) == NULL) {
+ pszFile = szFile;
+ }
+ else {
+ pszFile++;
+ }
+
+ PBYTE pbEnd;
+ PCHAR pszSect = FindSectionName((PBYTE)base, pbEnd);
+ if (pszSect != NULL) {
+ pszFile = pszSect;
+ if (next > (ULONG64)pbEnd) {
+ next = (ULONG64)pbEnd;
+ }
+ }
+
+ CHAR szDesc[128];
+ ZeroMemory(&szDesc, ARRAYSIZE(szDesc));
+ if (base == (ULONG64)mbi.AllocationBase) {
+ StringCchPrintfA(szDesc, ARRAYSIZE(szDesc), " %12I64x %8I64x %8I64x: %3s %3s %4s %3s : %s",
+ (ULONG64)base,
+ (ULONG64)base - (ULONG64)mbi.AllocationBase,
+ (ULONG64)next - (ULONG64)base,
+ szType,
+ szState,
+ szProtect,
+ szAllocProtect,
+ pszFile);
+
+
+ }
+ else {
+ StringCchPrintfA(szDesc, ARRAYSIZE(szDesc), " %12s %8I64x %8I64x: %3s %3s %4s %3s : %s",
+ "-",
+ (ULONG64)base - (ULONG64)mbi.AllocationBase,
+ (ULONG64)next - (ULONG64)base,
+ szType,
+ szState,
+ szProtect,
+ szAllocProtect,
+ pszFile);
+ }
+ printf("%s\n", szDesc);
+ }
+ return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////// main.
+//
+int CDECL main(int argc, char **argv)
+{
+ BOOLEAN fNeedHelp = FALSE;
+ BOOLEAN fVerbose = FALSE;
+ LPCSTR rpszDllsRaw[256];
+ LPCSTR rpszDllsOut[256];
+ DWORD nDlls = 0;
+
+ for (DWORD n = 0; n < ARRAYSIZE(rpszDllsRaw); n++) {
+ rpszDllsRaw[n] = NULL;
+ rpszDllsOut[n] = NULL;
+ }
+
+ int arg = 1;
+ for (; arg < argc && (argv[arg][0] == '-' || argv[arg][0] == '/'); arg++) {
+
+ CHAR *argn = argv[arg] + 1;
+ CHAR *argp = argn;
+ while (*argp && *argp != ':' && *argp != '=')
+ argp++;
+ if (*argp == ':' || *argp == '=')
+ *argp++ = '\0';
+
+ switch (argn[0]) {
+ case 'd': // Set DLL Name
+ case 'D':
+ if (nDlls < ARRAYSIZE(rpszDllsRaw)) {
+ rpszDllsRaw[nDlls++] = argp;
+ }
+ else {
+ printf("withdll.exe: Too many DLLs.\n");
+ fNeedHelp = TRUE;
+ break;
+ }
+ break;
+
+ case 'v': // Verbose
+ case 'V':
+ fVerbose = TRUE;
+ break;
+
+ case '?': // Help
+ fNeedHelp = TRUE;
+ break;
+
+ default:
+ fNeedHelp = TRUE;
+ printf("withdll.exe: Bad argument: %s\n", argv[arg]);
+ break;
+ }
+ }
+
+ if (arg >= argc) {
+ fNeedHelp = TRUE;
+ }
+
+ if (nDlls == 0) {
+ fNeedHelp = TRUE;
+ }
+
+ if (fNeedHelp) {
+ PrintUsage();
+ return 9001;
+ }
+
+ /////////////////////////////////////////////////////////// Validate DLLs.
+ //
+ for (DWORD n = 0; n < nDlls; n++) {
+ CHAR szDllPath[1024];
+ PCHAR pszFilePart = NULL;
+
+ if (!GetFullPathNameA(rpszDllsRaw[n], ARRAYSIZE(szDllPath), szDllPath, &pszFilePart)) {
+ printf("withdll.exe: Error: %s is not a valid path name..\n",
+ rpszDllsRaw[n]);
+ return 9002;
+ }
+
+ DWORD c = (DWORD)strlen(szDllPath) + 1;
+ PCHAR psz = new CHAR [c];
+ StringCchCopyA(psz, c, szDllPath);
+ rpszDllsOut[n] = psz;
+
+ HMODULE hDll = LoadLibraryExA(rpszDllsOut[n], NULL, DONT_RESOLVE_DLL_REFERENCES);
+ if (hDll == NULL) {
+ printf("withdll.exe: Error: %s failed to load (error %ld).\n",
+ rpszDllsOut[n],
+ GetLastError());
+ return 9003;
+ }
+
+ ExportContext ec;
+ ec.fHasOrdinal1 = FALSE;
+ ec.nExports = 0;
+ DetourEnumerateExports(hDll, &ec, ExportCallback);
+ FreeLibrary(hDll);
+
+ if (!ec.fHasOrdinal1) {
+ printf("withdll.exe: Error: %s does not export ordinal #1.\n",
+ rpszDllsOut[n]);
+ printf(" See help entry DetourCreateProcessWithDllEx in Detours.chm.\n");
+ return 9004;
+ }
+ }
+
+ //////////////////////////////////////////////////////////////////////////
+ STARTUPINFOA si;
+ PROCESS_INFORMATION pi;
+ CHAR szCommand[2048];
+ CHAR szExe[1024];
+ CHAR szFullExe[1024] = "\0";
+ PCHAR pszFileExe = NULL;
+
+ ZeroMemory(&si, sizeof(si));
+ ZeroMemory(&pi, sizeof(pi));
+ si.cb = sizeof(si);
+
+ szCommand[0] = L'\0';
+
+ StringCchCopyA(szExe, sizeof(szExe), argv[arg]);
+ for (; arg < argc; arg++) {
+ if (strchr(argv[arg], ' ') != NULL || strchr(argv[arg], '\t') != NULL) {
+ StringCchCatA(szCommand, sizeof(szCommand), "\"");
+ StringCchCatA(szCommand, sizeof(szCommand), argv[arg]);
+ StringCchCatA(szCommand, sizeof(szCommand), "\"");
+ }
+ else {
+ StringCchCatA(szCommand, sizeof(szCommand), argv[arg]);
+ }
+
+ if (arg + 1 < argc) {
+ StringCchCatA(szCommand, sizeof(szCommand), " ");
+ }
+ }
+ printf("withdll.exe: Starting: `%s'\n", szCommand);
+ for (DWORD n = 0; n < nDlls; n++) {
+ printf("withdll.exe: with `%s'\n", rpszDllsOut[n]);
+ }
+ fflush(stdout);
+
+ DWORD dwFlags = CREATE_DEFAULT_ERROR_MODE | CREATE_SUSPENDED;
+
+ SetLastError(0);
+ SearchPathA(NULL, szExe, ".exe", ARRAYSIZE(szFullExe), szFullExe, &pszFileExe);
+ if (!DetourCreateProcessWithDllsA(szFullExe[0] ? szFullExe : NULL, szCommand,
+ NULL, NULL, TRUE, dwFlags, NULL, NULL,
+ &si, &pi, nDlls, rpszDllsOut, NULL)) {
+ DWORD dwError = GetLastError();
+ printf("withdll.exe: DetourCreateProcessWithDllEx failed: %ld\n", dwError);
+ if (dwError == ERROR_INVALID_HANDLE) {
+#if DETOURS_64BIT
+ printf("withdll.exe: Can't detour a 32-bit target process from a 64-bit parent process.\n");
+#else
+ printf("withdll.exe: Can't detour a 64-bit target process from a 32-bit parent process.\n");
+#endif
+ }
+ ExitProcess(9009);
+ }
+
+ if (fVerbose) {
+ DumpProcess(pi.hProcess);
+ }
+
+ ResumeThread(pi.hThread);
+
+ WaitForSingleObject(pi.hProcess, INFINITE);
+
+ DWORD dwResult = 0;
+ if (!GetExitCodeProcess(pi.hProcess, &dwResult)) {
+ printf("withdll.exe: GetExitCodeProcess failed: %ld\n", GetLastError());
+ return 9010;
+ }
+
+ for (DWORD n = 0; n < nDlls; n++) {
+ if (rpszDllsOut[n] != NULL) {
+ delete[] rpszDllsOut[n];
+ rpszDllsOut[n] = NULL;
+ }
+ }
+
+ return dwResult;
+}
+//
+///////////////////////////////////////////////////////////////// End of File.