aboutsummaryrefslogtreecommitdiffhomepage
path: root/ext/detours/samples/findfunc/target.cpp
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/findfunc/target.cpp
parentae950163cd05f7a2205740af0acc6e427f0ffd92 (diff)
parentdabc40cb19bf4e297c32284d26c74adbd6775e49 (diff)
downloadZLUDA-77523940b39d522adc26b18f00c3373407523c55.tar.gz
ZLUDA-77523940b39d522adc26b18f00c3373407523c55.zip
Merge commit 'dabc40cb19bf4e297c32284d26c74adbd6775e49' as 'ext/detours'
Diffstat (limited to 'ext/detours/samples/findfunc/target.cpp')
-rw-r--r--ext/detours/samples/findfunc/target.cpp41
1 files changed, 41 insertions, 0 deletions
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.