blob: 61794b1293543d59ebdb689f02eda274e71e6b3b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
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.
|