1211
This commit is contained in:
130
test/Detours/samples/cping/Makefile
Normal file
130
test/Detours/samples/cping/Makefile
Normal file
@@ -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.
|
||||
47
test/Detours/samples/cping/ReadMe.Txt
Normal file
47
test/Detours/samples/cping/ReadMe.Txt
Normal file
@@ -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
|
||||
2245
test/Detours/samples/cping/cping.cpp
Normal file
2245
test/Detours/samples/cping/cping.cpp
Normal file
File diff suppressed because it is too large
Load Diff
0
test/Detours/samples/cping/cping.dat
Normal file
0
test/Detours/samples/cping/cping.dat
Normal file
23
test/Detours/samples/cping/iping.idl
Normal file
23
test/Detours/samples/cping/iping.idl
Normal file
@@ -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.
|
||||
Reference in New Issue
Block a user