This commit is contained in:
nephacks
2025-06-04 03:22:50 +02:00
parent f234f23848
commit f12416cffd
14243 changed files with 6446499 additions and 26 deletions

View File

@@ -0,0 +1,16 @@
# If no CPUTYPE variable is defined, then we are running on a DOS system
# so lets whack in some flags and switches to match the NTWIN32.MAK
# settings:
srcdir=..
model=L
rc=rc
hcopts = -n
cc = cl
cdebug = -Zipel -Od
cflags = -c -A$(model) -Gsw -W3 $(cdebug)
cvars = -D$(ENV)
linkdebug =
link = link $(linkdebug)
guiflags = /NOE /NOD /CO /align:16
guilibs = libw $(model)libcew ver commdlg
guilibsdll = libw $(model)dllcew ver commdlg

View File

@@ -0,0 +1,88 @@
#!IF "$(CPU)" != ""
#OS=NT
#ENV=WIN32
#!ELSE
OS=DOS
ENV=WIN16
#!ENDIF
# Environment variables LIB and INCLUDE should point to your Win SDK libraries
# and include files.
# Define WINTAB to point to your wintab development tree
# Example: WINTAB=c:\wintab
WINTAB=..\..\..
!include "$(OS)$(ENV).MAK"
cinclude=-I$(srcdir) -I$(WINTAB)\include
proj = wthook
projdll = wthkdll
all: $(proj).exe $(projdll).dll
# force a complete rebuild from source.
cleanall: clean
-del *.exe
-del *.dll
#clean up everything but the .EXEs.
clean:
-del *.lib
-del *.exp
-del *.res
-del *.?bj
-del *.map
# Update the resource if necessary
#$(proj).res: $(srcdir)\$(proj).rc $(srcdir)\mgrdlg.dlg $(srcdir)\mgrdlg.h $(srcdir)\$(proj).h
# $(rc) $(rcvars) -r -fo $(proj).res $(cvars) $(srcdir)\$(proj).rc
#!if defined(CPU)
# cvtres -$(CPU) $(proj).res -o $(proj).rbj
#!ENDIF
OBJS = $(proj).obj
DLLS = $(projdll).dll
# Update the object files if necessary
$(proj).obj: $(srcdir)\$(proj).c
$(cc) $(cflags) $(cinclude) $(cvars) $(cdebug) $(srcdir)\$(proj).c
#$(proj).obj: $(srcdir)\$(proj).c
# $(cc) $(cflags) $(cinclude) $(cvars) $(cdebug) $(srcdir)\$(projdll).c
$(projdll).obj: $(srcdir)\$(projdll).c
$(cc) $(cflags) $(cinclude) $(cvars) $(cdebug) $(srcdir)\$(projdll).c
# Update the exp file if necessary.
$(projdll).exp $(projdll).lib: $(projdll).obj $(projdll).def
$(implib) -machine:$(CPU) \
-def:..\$(projdll).def \
-out:$(projdll).lib $(projdll).obj -verbose
# Since the link line has some severe differences depending on what
# platform we are running on, we need to special case this so that
# we execute the correct commands:
#!if defined(CPU)
# This is for Windows NT:
#$(proj).exe: $(OBJS) ..\$(proj).def
# $(link) $(linkdebug) $(guiflags) $(OBJS) \
# $(WINTAB)\lib\$(CPU)\wintab32.lib $(guilibs) VERSION.LIB \
# $(proj).rbj -out:$(proj).exe /machine:$(CPU)
#$(projdll).dll: $(projdll).obj $(projdll).def $(projdll).exp
# $(link) $(linkdebug) $(guiflags) $(projdll).obj $(projdll).exp \
# $(guilibsdll) VERSION.LIB -out:$(projdll).dll \
# /machine:$(CPU) -entry:_DllMainCRTStartup$(DLLENTRY) -dll
#!ENDIF
#!if !defined(CPU)
# This is for Windows DOS:
$(proj).exe: $(OBJS) $(DLLS) $(proj).def
$(link) $(guiflags) $(OBJS) ,,, $(WINTAB)\lib\wintab.lib $(guilibs) , $(proj).def
rc $(proj).exe
$(projdll).dll: $(projdll).obj $(projdll).def
$(link) $(guiflags) libentry.obj $(projdll).obj ,$(projdll).dll,, \
$(WINTAB)\lib\wintab.lib $(guilibsdll) , $(projdll).DEF
rc $(projdll).dll
#!ENDIF

View File

@@ -0,0 +1,414 @@
# =========================================================================
# NTWIN32.MAK - Win32 application master NMAKE definitions file for the
# Microsoft Win32 SDK for Windows NT programming samples
# -------------------------------------------------------------------------
# This files should be included at the top of all MAKEFILEs as follows:
# !include <ntwin32.mak>
# -------------------------------------------------------------------------
# NMAKE Options
#
# Use the table below to determine the additional options for NMAKE to
# generate various application debugging, profiling and performance tuning
# information.
#
# Application Information Type Invoke NMAKE
# ---------------------------- ------------
# For No Debugging Info nmake nodebug=1
# For Working Set Tuner Info nmake tune=1
# For Call Attributed Profiling Info nmake profile=1
#
# Note: Working Set Tuner and Call Attributed Profiling is for available
# for the Intel x86 and Pentium systems.
#
# Note: The three options above are mutually exclusive (you may use only
# one to compile/link the application).
#
# Note: creating the environment variables NODEBUG, TUNE, and PROFILE is an
# alternate method to setting these options via the nmake command line.
#
# Additional NMAKE Options Invoke NMAKE
# ---------------------------- ------------
# For No ANSI NULL Compliance nmake no_ansi=1
# (ANSI NULL is defined as PVOID 0)
#
# =========================================================================
# REVISIONS
# RICO 1/26/95 - changed -Zi to -Z7 for use with VC++ 2.0.
# RICO 6/16/97 - changed -Ox to -O1 to avoid VC++ 4.x optimizer bug.
# =========================================================================
# -------------------------------------------------------------------------
# Get CPU Type - exit if CPU environment variable is not defined
# -------------------------------------------------------------------------
!IF "$(CPU)" == ""
CPU = $(PROCESSOR_ARCHITECTURE)
!ENDIF
!IF "$(CPU)" != "i386"
!IF "$(CPU)" != "MIPS"
!IF "$(CPU)" != "ALPHA"
!IF "$(CPU)" != "PPC"
!ERROR Must specify CPU environment variable ( CPU=i386, CPU=MIPS, CPU=ALPHA, CPU=PPC)
!ENDIF
!ENDIF
!ENDIF
!ENDIF
# -------------------------------------------------------------------------
# Platform Dependent Binaries Declarations
#
# If you are using the old MIPS compiler then define the following:
# cc = cc
# cvtobj = mip2coff
# -------------------------------------------------------------------------
# binary declarations for use on Intel i386, i486, and Pentium systems
!IF "$(CPU)" == "i386"
cc = cl
# for compatibility with older-style makefiles
cvtobj = REM !!! CVTOBJ is no longer necessary - please remove !!!
!ENDIF
# binary declarations for use on self hosted MIPS R4x000 systems
!IF "$(CPU)" == "MIPS"
cc = mcl
# for compatibility with older-style makefiles
cvtobj = REM !!! CVTOBJ is no longer necessary - please remove !!!
!ENDIF
# binary declarations for use on self hosted Digital Alpha AXP systems
!IF "$(CPU)" == "ALPHA"
cc = cl
# for compatibility with older-style makefiles
cvtobj = REM !!! CVTOBJ is no longer necessary - please remove !!!
!ENDIF
# binary declarations common to all platforms
link = link
implib = lib
rc = rc
cvtres = cvtres
hc = hc
# -------------------------------------------------------------------------
# Platform Dependent Compile Flags - must be specified after $(cc)
#
# Note: Debug switches are on by default for current release
#
# These switches allow for source level debugging with WinDebug for local
# and global variables.
#
# Both compilers now use the same front end - you must still define either
# _X86_, _MIPS_, or _ALPHA_. These have replaced the i386, MIPS, and ALPHA
# definitions which are not ANSI compliant.
#
# Common compiler flags:
# -c - compile without linking
# -W3 - Set warning level to level 3
# -Zi - generate debugging information
# -Od - disable all optimizations
# -O1 - optimize for minimum size
# -Zd - generate only public symbols and line numbers for debugging
#
# i386 specific compiler flags:
# -Gz - stdcall
#
# MS MIPS specific compiler flags:
# none.
#
# *** OLD MIPS ONLY ***
#
# The following definitions are for the old MIPS compiler:
#
# OLD MIPS compiler flags:
# -c - compile without linking
# -std - produce warnings for non-ANSI standard source code
# -g2 - produce a symbol table for debugging
# -O - invoke the global optimizer
# -EL - produce object modules targeted for
# "little-endian" byte ordering
#
# If you are using the old MIPS compiler then define the following:
#
# # OLD MIPS Complile Flags
# !IF 0
# !IF "$(CPU)" == "MIPS"
# cflags = -c -std -o $(*B).obj -EL -DMIPS=1 -D_MIPS_=1
# !IF defined(NODEBUG)
# cdebug =
# !ELSE
# cdebug = -g2
# !ENDIF
# !ENDIF
# !ENDIF
#
# -------------------------------------------------------------------------
# declarations common to all compiler options
cinclude = -I$(WDEV)\include
ccommon = $(cinclude) -c -W3 -D_CRTAPI1=__cdecl -D_CRTAPI2=__cdecl -Dtry=__try -Dleave=__leave -Dexcept=__except -Dfinally=__finally
!IF "$(CPU)" == "i386"
cflags = $(ccommon) -D_X86_=1
scall = -Gz
!ELSE
!IF "$(CPU)" == "MIPS"
cflags = $(ccommon) -D_MIPS_=1
!ELSE
!IF "$(CPU)" == "PPC"
cflags = $(ccommon) -D_PPC_=1
!ELSE
!IF "$(CPU)" == "ALPHA"
cflags = $(ccommon) -D_ALPHA_=1
!ENDIF
!ENDIF
!ENDIF
scall =
!ENDIF
!IF "$(CPU)" == "i386"
!IF defined(NODEBUG)
cdebug = -O1
!ELSE
!IF defined(PROFILE)
cdebug = -Gh -Zd -O1
!ELSE
!IF defined(TUNE)
cdebug = -Gh -Zd -O1
!ELSE
cdebug = -Z7 -Od
!ENDIF
!ENDIF
!ENDIF
!ELSE
!IF defined(NODEBUG)
cdebug = -O1
!ELSE
cdebug = -Z7 -Od
!ENDIF
!ENDIF
# -------------------------------------------------------------------------
# Target Module & Subsystem Dependent Compile Defined Variables - must be
# specified after $(cc)
#
# The following table indicates the various acceptable combinations of
# the C Run-Time libraries LIBC, LIBCMT, and CRTDLL respect to the creation
# of a EXE and/or DLL target object. The appropriate compiler flag macros
# that should be used for each combination are also listed.
#
# Link EXE Create Exe Link DLL Create DLL
# with Using with Using
# ----------------------------------------------------
# LIBC CVARS None None *
# LIBC CVARS LIBC CVARS
# LIBC CVARS LIBCMT CVARSMT
# LIBCMT CVARSMT None None *
# LIBCMT CVARSMT LIBC CVARS
# LIBCMT CVARSMT LIBCMT CVARSMT
# CRTDLL CVARSDLL None None *
# CRTDLL CVARSDLL LIBC CVARS
# CRTDLL CVARSDLL LIBCMT CVARSMT
# CRTDLL CVARSDLL CRTDLL CVARSDLL *
#
# * - Denotes the Recommended Configuration
#
# When building single-threaded applications you can link your executable
# with either LIBC, LIBCMT, or CRTDLL, although LIBC will provide the best
# performance.
#
# When building multi-threaded applications, either LIBCMT or CRTDLL can
# be used as the C-Runtime library, as both are multi-thread safe.
#
# Note: Any executable which accesses a DLL linked with CRTDLL.LIB must
# also link with CRTDLL.LIB instead of LIBC.LIB or LIBCMT.LIB.
# When using DLLs, it is recommended that all of the modules be
# linked with CRTDLL.LIB.
#
# Note: The macros of the form xDLL are used when linking the object with
# the DLL version of the C Run-Time (that is, CRTDLL.LIB). They are
# not used when the target object is itself a DLL.
#
# -------------------------------------------------------------------------
!IF defined(NO_ANSI)
noansi = -DNULL=0
!ENDIF
# for Windows applications that use the C Run-Time libraries
cvars = -DWIN32 $(noansi)
cvarsmt = $(cvars) -D_MT
cvarsdll = $(cvarsmt) -D_DLL
# for compatibility with older-style makefiles
cvarsmtdll = $(cvarsmt) -D_DLL
# for POSIX applications
psxvars = -D_POSIX_
# resource compiler
rcvars = -DWIN32 $(noansi)
# -------------------------------------------------------------------------
# Platform Dependent Link Flags - must be specified after $(link)
#
# Note: $(DLLENTRY) should be appended to each -entry: flag on the link
# line.
#
# Note: When creating a DLL that uses C Run-Time functions it is
# recommended to include the entry point function of the name DllMain
# in the DLL's source code. Also, the MAKEFILE should include the
# -entry:_DllMainCRTStartup$(DLLENTRY) option for the creation of
# this DLL. (The C Run-Time entry point _DllMainCRTStartup in turn
# calls the DLL defined DllMain entry point.)
#
# -------------------------------------------------------------------------
# declarations common to all linker options
lcommon =
# declarations for use on Intel i386, i486, and Pentium systems
!IF "$(CPU)" == "i386"
DLLENTRY = @12
lflags = $(lcommon) -align:0x1000
!ENDIF
# declarations for use on self hosted MIPS R4x000 systems
!IF "$(CPU)" == "MIPS"
DLLENTRY =
lflags = $(lcommon)
!ENDIF
# declarations for use on self hosted PowerPC systems
!IF "$(CPU)" == "PPC"
DLLENTRY =
lflags = $(lcommon)
!ENDIF
# declarations for use on self hosted Digital Alpha AXP systems
!IF "$(CPU)" == "ALPHA"
DLLENTRY =
lflags = $(lcommon)
!ENDIF
# -------------------------------------------------------------------------
# Target Module Dependent Link Debug Flags - must be specified after $(link)
#
# These switches allow the inclusion of the necessary symbolic information
# for source level debugging with WinDebug, profiling and/or performance
# tuning.
#
# Note: Debug switches are on by default.
# -------------------------------------------------------------------------
!IF "$(CPU)" == "i386"
!IF defined(NODEBUG)
ldebug =
!ELSE
!IF defined(PROFILE)
ldebug = -debug:partial -debugtype:coff
!ELSE
!IF defined(TUNE)
ldebug = -debug:partial -debugtype:coff
!ELSE
ldebug = -debug:full -debugtype:both
!ENDIF
!ENDIF
!ENDIF
!ELSE
!IF defined(NODEBUG)
ldebug =
!ELSE
ldebug = -debug:full -debugtype:both
!ENDIF
!ENDIF
# for compatibility with older-style makefiles
linkdebug = $(ldebug)
# -------------------------------------------------------------------------
# Subsystem Dependent Link Flags - must be specified after $(link)
#
# These switches allow for source level debugging with WinDebug for local
# and global variables. They also provide the standard application type and
# entry point declarations.
# -------------------------------------------------------------------------
# for Windows applications that use the C Run-Time libraries
conlflags = $(lflags) -subsystem:console -entry:mainCRTStartup
guilflags = $(lflags) -subsystem:windows -entry:WinMainCRTStartup
# for POSIX applications
psxlflags = $(lflags) -subsystem:posix -entry:__PosixProcessStartup
# for compatibility with older-style makefiles
conflags = $(conlflags)
guiflags = $(guilflags)
psxflags = $(psxlflags)
# -------------------------------------------------------------------------
# C Run-Time Target Module Dependent Link Libraries
#
# Below is a table which describes which libraries to use depending on the
# target module type, although the table specifically refers to Graphical
# User Interface apps, the exact same dependencies apply to Console apps.
# That is, you could replace all occurrences of 'GUI' with 'CON' in the
# following:
#
# Desired CRT Libraries Desired CRT Libraries
# Library to link Library to link
# for EXE with EXE for DLL with DLL
# ----------------------------------------------------
# LIBC GUILIBS None None *
# LIBC GUILIBS LIBC GUILIBS
# LIBC GUILIBS LIBCMT GUILIBSMT
# LIBCMT GUILIBSMT None None *
# LIBCMT GUILIBSMT LIBC GUILIBS
# LIBCMT GUILIBSMT LIBCMT GUILIBSMT
# CRTDLL GUILIBSDLL None None *
# CRTDLL GUILIBSDLL LIBC GUILIBS
# CRTDLL GUILIBSDLL LIBCMT GUILIBSMT
# CRTDLL GUILIBSDLL CRTDLL GUILIBSDLL *
#
# * - Recommended Configurations.
#
# Note: Any executable which accesses a DLL linked with CRTDLL.LIB must
# also link with CRTDLL.LIB instead of LIBC.LIB or LIBCMT.LIB.
#
# Note: For POSIX applications, link with $(psxlibs).
#
# -------------------------------------------------------------------------
# optional profiling and tuning libraries
!IF "$(CPU)" == "i386"
!IF defined(PROFILE)
optlibs = cap.lib
!ELSE
!IF defined(TUNE)
optlibs = wst.lib
!ELSE
optlibs =
!ENDIF
!ENDIF
!ELSE
optlibs =
!ENDIF
# basic subsystem specific libraries, less the C Run-Time
baselibs = kernel32.lib $(optlibs)
winlibs = $(baselibs) user32.lib gdi32.lib comdlg32.lib winspool.lib
# for Windows applications that use the C Run-Time libraries
conlibs = libc.lib $(baselibs)
conlibsmt = libcmt.lib $(baselibs)
conlibsdll = CRTDLL.lib $(baselibs)
guilibs = libc.lib $(winlibs)
guilibsmt = libcmt.lib $(winlibs)
guilibsdll = CRTDLL.lib $(winlibs)
# for POSIX applications
psxlibs = libcpsx.lib psxdll.lib psxrtl.lib
srcdir = ..

View File

@@ -0,0 +1,18 @@
LIBRARY WTHKDLL
DESCRIPTION 'wintab hook dll'
EXETYPE WINDOWS
CODE DISCARDABLE
DATA FIXED SINGLE PRELOAD
HEAPSIZE 57980
EXPORTS
WEP @1 RESIDENTNAME
RecordHook @100
PlayHook @101
Record @200
Playback @201
get_num_pkts_recorded @202
get_num_pkts_played @203
display_record @204
reset @205

Binary file not shown.

View File

@@ -0,0 +1,30 @@
; module-definition file for mgrtest -- used by LINK.EXE
NAME wthook ; application's module name
DESCRIPTION 'Sample Microsoft Windows Application'
EXETYPE WINDOWS ; required for all Windows applications
STUB 'WINSTUB.EXE' ; Generates error message if application
; is run without Windows
;CODE can be moved in memory and discarded/reloaded
CODE PRELOAD MOVEABLE DISCARDABLE
;DATA must be MULTIPLE if program can be invoked more than once
DATA PRELOAD MOVEABLE MULTIPLE
HEAPSIZE 57900
STACKSIZE 6000
; All functions that will be called by any Windows routine
; MUST be exported.
EXPORTS
; MainWndProc @1 ; name of window processing function
; About @2 ; name of "About" processing function
; Do1Context ; enumeration callback function
; ButtonDlgProc

View File

@@ -0,0 +1,59 @@
wthook
Start Length Name Class
0001:0000 00347H WTHOOK_TEXT CODE
0001:0348 018FFH _TEXT CODE
0002:0000 00010H NULL BEGDATA
0002:0010 002A6H _DATA DATA
0002:02B6 0000EH CDATA DATA
0002:02C4 00000H XIFB DATA
0002:02C4 00000H XIF DATA
0002:02C4 00000H XIFE DATA
0002:02C4 00000H XIB DATA
0002:02C4 00000H XI DATA
0002:02C4 00000H XIE DATA
0002:02C4 00000H XPB DATA
0002:02C4 00004H XP DATA
0002:02C8 00000H XPE DATA
0002:02C8 00000H XCB DATA
0002:02C8 00000H XC DATA
0002:02C8 00000H XCE DATA
0002:02C8 00000H XCFB DATA
0002:02C8 00000H XCFCRT DATA
0002:02C8 00000H XCF DATA
0002:02C8 00000H XCFE DATA
0002:02C8 00000H XIFCB DATA
0002:02C8 00000H XIFU DATA
0002:02C8 00000H XIFL DATA
0002:02C8 00000H XIFM DATA
0002:02C8 00000H XIFCE DATA
0002:02C8 00000H DBDATA DATA
0002:02C8 000E4H IOB DATA
0002:03AC 00000H IOBX DATA
0002:03AC 0000CH IOBE DATA
0002:03B8 000E4H IOB2 DATA
0002:049C 00000H IOB2X DATA
0002:049C 0000CH IOB2E DATA
0002:04A8 00000H CONST CONST
0002:04A8 00008H HDR MSG
0002:04B0 00146H MSG MSG
0002:05F6 00002H PAD MSG
0002:05F8 00001H EPAD MSG
0002:05FA 0000CH _BSS BSS
0002:0606 00000H XOB BSS
0002:0606 00000H XO BSS
0002:0606 00000H XOE BSS
0002:0606 00000H XOFB BSS
0002:0606 00000H XOF BSS
0002:0606 00000H XOFE BSS
0002:0610 00014H c_common BSS
Origin Group
0002:0 DGROUP
Address Export Alias
0001:13EA ___ExportedStub ___ExportedStub
Program entry point at 0001:0362

View File

@@ -0,0 +1,81 @@
------------------------------- readme.txt -------------------------------
Wintab(tm) Programmer's Kit V. 1.25 for 16- and 32-bit Windows APIs.
This file contains programmer's kit installation instructions and
programming notes for the WTHOOK project.
Please direct your programming questions and comments to the author:
LCS/Telegraphics
150 Rogers St.
Cambridge, MA 02142
voice: (617) 225-7970
fax: (617) 225-7969
email: wintab@pointing.com
web site: http://www.pointing.com
ftp site: ftp://ftp.pointing.com/pointing/Wintab/
Questions or problems regarding specific devices or device drivers
should be directed to the device manufacturer.
--------------------------------------------------------------------------
MSVC Notes for WTHOOK Project
--------------------------------------------------------------------------
MSVC 4.2 will not be able to compile MFC_DEMO and WTHOOK projects.
MSVC 5.0 will be able to compile all the projects.
Also, please note that the linker warning LNK4098 (to recompile
with the /Nodefaultlib:LIBC option) during the compilationq of Debug
WTHOOK project will not affect the operation of the resulting
executable. This bug concerns all projects linking the WNTAB32X.LIB
and will be fixed in the next version of the Wintab Programmer's Kit.
--------------------------------------------------------------------------
Project Settings for WTKIT
--------------------------------------------------------------------------
All projects require that the LIB and INCLUDE variables point to
the appropriate Windows SDK directories. Also, the WINTAB variable
must point to a tree containing the LIB and INCLUDE subtrees from the
Wintab Programmer's Kit.
For example, in MSVC5.0, under the Tools menu, Options setting,
the WINTAB\INCLUDE directory must be listed as a directory for
Include files, and the WINTAB\LIB\I386 must be listed as a directory
for library files.
Please cleanup intermediate files between builds to different
targets. If you have built the programs from source for one target
environment, and wish to switch to another target, first run the
command NMAKE CLEANALL in the source subdirectories.
--------------------------------------------------------------------------
Keeping in Touch
--------------------------------------------------------------------------
Here are three ways to show your support for the Wintab standard, and
allow us to let people know that your product has Wintab support.
1. When you complete Wintab support in your product, let us know. Be
sure to include the product name, a description, and contact
information for your company.
2. If possible, send us an evaluation copy of your product, or the
portions of it that contain Wintab support. LCS/Telegraphics is
building a library of Wintab-compliant applications for ongoing
compatibility testing.
3. Join the Committee for Advanced Pointing Standards (CAPS). CAPS
formed in August of 1993 to promote and support future development of
the specification. The more than 40 corporate members of CAPS
include most major pointing device manufacturers, and many leading
CAD and graphics arts software developers. To join CAPS, contact:
LCS/Telegraphics
150 Rogers St.
Cambridge, MA 02142
voice: (617) 225-7970
fax: (617) 225-7969
email: caps@pointing.com
web site: http://www.pointing.com

View File

@@ -0,0 +1,14 @@
;;wthkdll.def
LIBRARY "WTHKDLL"
DESCRIPTION 'wintab hook dll'
EXPORTS
RecordHook @100
PlayHook @101
Record @200
Playback @201
get_num_pkts_recorded @202
get_num_pkts_played @203
display_record @204
reset @205

View File

@@ -0,0 +1,121 @@
# Microsoft Developer Studio Project File - Name="wthkdll" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=wthkdll - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "wthkdll.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "wthkdll.mak" CFG="wthkdll - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "wthkdll - Win32 Release" (based on\
"Win32 (x86) Dynamic-Link Library")
!MESSAGE "wthkdll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "wthkdll - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\Release"
# PROP BASE Intermediate_Dir ".\Release"
# PROP BASE Target_Dir "."
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ".\Release"
# PROP Intermediate_Dir ".\Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir "."
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 ..\..\..\lib\i386\wintab32.lib ..\..\..\lib\i386\wntab32x.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib /nologo /subsystem:windows /dll /machine:I386
!ELSEIF "$(CFG)" == "wthkdll - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ".\Debug"
# PROP BASE Intermediate_Dir ".\Debug"
# PROP BASE Target_Dir "."
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir ".\Debug"
# PROP Intermediate_Dir ".\Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir "."
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:I386
# ADD LINK32 ..\..\..\lib\i386\wntab32x.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib /nologo /subsystem:windows /dll /debug /machine:I386
# Begin Custom Build
OutDir=.\.\Debug
TargetName=wthkdll
InputPath=.\Debug\wthkdll.dll
SOURCE=$(InputPath)
"debug\$(TargetName).dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy $(OutDir)\$(TargetName).dll debug
# End Custom Build
!ENDIF
# Begin Target
# Name "wthkdll - Win32 Release"
# Name "wthkdll - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
# Begin Source File
SOURCE=..\wthkdll.c
# End Source File
# Begin Source File
SOURCE=.\wthkdll.def
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

View File

@@ -0,0 +1,232 @@
# Microsoft Developer Studio Generated NMAKE File, Based on wthkdll.dsp
!IF "$(CFG)" == ""
CFG=wthkdll - Win32 Release
!MESSAGE No configuration specified. Defaulting to wthkdll - Win32 Release.
!ENDIF
!IF "$(CFG)" != "wthkdll - Win32 Release" && "$(CFG)" !=\
"wthkdll - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "wthkdll.mak" CFG="wthkdll - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "wthkdll - Win32 Release" (based on\
"Win32 (x86) Dynamic-Link Library")
!MESSAGE "wthkdll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
!IF "$(CFG)" == "wthkdll - Win32 Release"
OUTDIR=.\Release
INTDIR=.\Release
# Begin Custom Macros
OutDir=.\.\Release
# End Custom Macros
!IF "$(RECURSE)" == "0"
ALL : "$(OUTDIR)\wthkdll.dll"
!ELSE
ALL : "$(OUTDIR)\wthkdll.dll"
!ENDIF
CLEAN :
-@erase "$(INTDIR)\vc50.idb"
-@erase "$(INTDIR)\wthkdll.obj"
-@erase "$(OUTDIR)\wthkdll.dll"
-@erase "$(OUTDIR)\wthkdll.exp"
-@erase "$(OUTDIR)\wthkdll.lib"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
/Fp"$(INTDIR)\wthkdll.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
CPP_OBJS=.\Release/
CPP_SBRS=.
.c{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
RSC=rc.exe
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\wthkdll.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=wintab32.lib ..\..\..\lib\i386\wntab32x.lib kernel32.lib\
user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib\
ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /incremental:no\
/pdb:"$(OUTDIR)\wthkdll.pdb" /machine:I386 /def:".\wthkdll.def"\
/out:"$(OUTDIR)\wthkdll.dll" /implib:"$(OUTDIR)\wthkdll.lib"
DEF_FILE= \
".\wthkdll.def"
LINK32_OBJS= \
"$(INTDIR)\wthkdll.obj"
"$(OUTDIR)\wthkdll.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "wthkdll - Win32 Debug"
OUTDIR=.\Debug
INTDIR=.\Debug
# Begin Custom Macros
OutDir=.\.\Debug
# End Custom Macros
!IF "$(RECURSE)" == "0"
ALL : "$(OUTDIR)\wthkdll.dll"
!ELSE
ALL : "$(OUTDIR)\wthkdll.dll"
!ENDIF
CLEAN :
-@erase "$(INTDIR)\vc50.idb"
-@erase "$(INTDIR)\vc50.pdb"
-@erase "$(INTDIR)\wthkdll.obj"
-@erase "$(OUTDIR)\wthkdll.dll"
-@erase "$(OUTDIR)\wthkdll.exp"
-@erase "$(OUTDIR)\wthkdll.ilk"
-@erase "$(OUTDIR)\wthkdll.lib"
-@erase "$(OUTDIR)\wthkdll.pdb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
/Fp"$(INTDIR)\wthkdll.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
CPP_OBJS=.\Debug/
CPP_SBRS=.
.c{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
RSC=rc.exe
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\wthkdll.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=..\..\..\lib\i386\wntab32x.lib kernel32.lib user32.lib gdi32.lib\
winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib\
uuid.lib /nologo /subsystem:windows /dll /incremental:yes\
/pdb:"$(OUTDIR)\wthkdll.pdb" /debug /machine:I386 /def:".\wthkdll.def"\
/out:"$(OUTDIR)\wthkdll.dll" /implib:"$(OUTDIR)\wthkdll.lib"
DEF_FILE= \
".\wthkdll.def"
LINK32_OBJS= \
"$(INTDIR)\wthkdll.obj"
"$(OUTDIR)\wthkdll.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
OutDir=.\.\Debug
TargetName=wthkdll
InputPath=.\Debug\wthkdll.dll
SOURCE=$(InputPath)
"debug\$(TargetName).dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy $(OutDir)\$(TargetName).dll debug
!ENDIF
!IF "$(CFG)" == "wthkdll - Win32 Release" || "$(CFG)" ==\
"wthkdll - Win32 Debug"
SOURCE=..\wthkdll.c
DEP_CPP_WTHKD=\
{$(INCLUDE)}"pktdef.h"\
{$(INCLUDE)}"wintab.h"\
"$(INTDIR)\wthkdll.obj" : $(SOURCE) $(DEP_CPP_WTHKD) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF

View File

@@ -0,0 +1,106 @@
# Microsoft Developer Studio Project File - Name="wthook" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=wthook - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "Wthook.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Wthook.mak" CFG="wthook - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "wthook - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "wthook - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "wthook - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\Release"
# PROP BASE Intermediate_Dir ".\Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ".\Release"
# PROP Intermediate_Dir ".\Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 ..\..\..\lib\i386\wintab32.lib ..\..\..\lib\i386\wntab32x.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib /nologo /subsystem:windows /machine:I386
!ELSEIF "$(CFG)" == "wthook - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ".\Debug"
# PROP BASE Intermediate_Dir ".\Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir ".\Debug"
# PROP Intermediate_Dir ".\Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /debug /machine:I386
# ADD LINK32 ..\..\..\lib\i386\wntab32x.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386
!ENDIF
# Begin Target
# Name "wthook - Win32 Release"
# Name "wthook - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
# Begin Source File
SOURCE=..\wthook.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

View File

@@ -0,0 +1,44 @@
Microsoft Developer Studio Workspace File, Format Version 5.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "wthkdll"=.\wthkdll.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "wthook"=.\Wthook.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name wthkdll
End Project Dependency
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -0,0 +1,248 @@
# Microsoft Developer Studio Generated NMAKE File, Based on Wthook.dsp
!IF "$(CFG)" == ""
CFG=wthook - Win32 Release
!MESSAGE No configuration specified. Defaulting to wthook - Win32 Release.
!ENDIF
!IF "$(CFG)" != "wthook - Win32 Release" && "$(CFG)" != "wthook - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "Wthook.mak" CFG="wthook - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "wthook - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "wthook - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
!IF "$(CFG)" == "wthook - Win32 Release"
OUTDIR=.\Release
INTDIR=.\Release
# Begin Custom Macros
OutDir=.\.\Release
# End Custom Macros
!IF "$(RECURSE)" == "0"
ALL : "$(OUTDIR)\Wthook.exe"
!ELSE
ALL : "wthkdll - Win32 Release" "$(OUTDIR)\Wthook.exe"
!ENDIF
!IF "$(RECURSE)" == "1"
CLEAN :"wthkdll - Win32 ReleaseCLEAN"
!ELSE
CLEAN :
!ENDIF
-@erase "$(INTDIR)\vc50.idb"
-@erase "$(INTDIR)\wthook.obj"
-@erase "$(OUTDIR)\Wthook.exe"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
/Fp"$(INTDIR)\Wthook.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
CPP_OBJS=.\Release/
CPP_SBRS=.
.c{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
RSC=rc.exe
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\Wthook.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=wintab32.lib ..\..\..\lib\i386\wntab32x.lib kernel32.lib\
user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib\
ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /incremental:no\
/pdb:"$(OUTDIR)\Wthook.pdb" /machine:I386 /out:"$(OUTDIR)\Wthook.exe"
LINK32_OBJS= \
"$(INTDIR)\wthook.obj" \
"$(OUTDIR)\wthkdll.lib"
"$(OUTDIR)\Wthook.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "wthook - Win32 Debug"
OUTDIR=.\Debug
INTDIR=.\Debug
# Begin Custom Macros
OutDir=.\.\Debug
# End Custom Macros
!IF "$(RECURSE)" == "0"
ALL : "$(OUTDIR)\Wthook.exe"
!ELSE
ALL : "wthkdll - Win32 Debug" "$(OUTDIR)\Wthook.exe"
!ENDIF
!IF "$(RECURSE)" == "1"
CLEAN :"wthkdll - Win32 DebugCLEAN"
!ELSE
CLEAN :
!ENDIF
-@erase "$(INTDIR)\vc50.idb"
-@erase "$(INTDIR)\vc50.pdb"
-@erase "$(INTDIR)\wthook.obj"
-@erase "$(OUTDIR)\Wthook.exe"
-@erase "$(OUTDIR)\Wthook.ilk"
-@erase "$(OUTDIR)\Wthook.pdb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
/Fp"$(INTDIR)\Wthook.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
CPP_OBJS=.\Debug/
CPP_SBRS=.
.c{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
RSC=rc.exe
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\Wthook.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=..\..\..\lib\i386\wntab32x.lib kernel32.lib user32.lib gdi32.lib\
winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib\
uuid.lib /nologo /subsystem:windows /incremental:yes\
/pdb:"$(OUTDIR)\Wthook.pdb" /debug /machine:I386 /out:"$(OUTDIR)\Wthook.exe"
LINK32_OBJS= \
"$(INTDIR)\wthook.obj" \
"$(OUTDIR)\wthkdll.lib"
"$(OUTDIR)\Wthook.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
!IF "$(CFG)" == "wthook - Win32 Release" || "$(CFG)" == "wthook - Win32 Debug"
SOURCE=..\wthook.c
DEP_CPP_WTHOO=\
{$(INCLUDE)}"wintab.h"\
"$(INTDIR)\wthook.obj" : $(SOURCE) $(DEP_CPP_WTHOO) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!IF "$(CFG)" == "wthook - Win32 Release"
"wthkdll - Win32 Release" :
cd "."
$(MAKE) /$(MAKEFLAGS) /F .\wthkdll.mak CFG="wthkdll - Win32 Release"
cd "."
"wthkdll - Win32 ReleaseCLEAN" :
cd "."
$(MAKE) /$(MAKEFLAGS) CLEAN /F .\wthkdll.mak CFG="wthkdll - Win32 Release"\
RECURSE=1
cd "."
!ELSEIF "$(CFG)" == "wthook - Win32 Debug"
"wthkdll - Win32 Debug" :
cd "."
$(MAKE) /$(MAKEFLAGS) /F .\wthkdll.mak CFG="wthkdll - Win32 Debug"
cd "."
"wthkdll - Win32 DebugCLEAN" :
cd "."
$(MAKE) /$(MAKEFLAGS) CLEAN /F .\wthkdll.mak CFG="wthkdll - Win32 Debug"\
RECURSE=1
cd "."
!ENDIF
!ENDIF

View File

@@ -0,0 +1,675 @@
//wthkdll.c
/* Here, we just record a bunch of packets with a WTH_RECORD hook, and put them
in a big list. If there is more than one context giving us packets, then
we are in trouble; in real life, we would have to sort the packets by
context. We should probably also check to see that the lcPktData
and lcPktMode of each context doesn't change. */
#include <malloc.h>
#include <stdio.h>
#include <string.h>
#include <windows.h>
#include <wintab.h>
#define PACKETDATA PK_CONTEXT | PK_STATUS | PK_TIME | PK_CHANGED | PK_SERIAL_NUMBER | PK_CURSOR | PK_BUTTONS | PK_X | PK_Y | PK_Z | PK_NORMAL_PRESSURE | PK_TANGENT_PRESSURE | PK_ROTATION
#define PACKETMODE 0
#include <pktdef.h>
/* 16-bit does not have a 64-bit integer type */
#ifndef hyper
#define hyper long
#endif
#define NCONTEXTS 32
/* Shared memory */
static HANDLE shmem;
static unsigned hyper shmem_size;
static unsigned char *shmem_view = 0;
static unsigned hyper shmem_buf_size;
static unsigned char *shmem_buf = 0; /* Store everyone's packets in this buffer */
static HCTX *shmem_ctx = 0; /* One for each possible context (NCONTEXTS) */
static unsigned hyper *shmem_buf_pos = 0;
static unsigned hyper *shmem_buf_play_pos = 0;
static unsigned long *shmem_pkts_recorded = 0;
static unsigned long *shmem_pkts_played = 0;
static unsigned long *shmem_time = 0;
static HWTHOOK *shmem_hHook = 0;
#ifdef _WIN32
void
shutdown_shared_mem( void )
{
if( shmem_view )
UnmapViewOfFile( shmem_view );
if( shmem )
CloseHandle( shmem );
}
BOOL
init_shared_mem( void )
{
BOOL fInit;
shmem_size = 0x100000;
shmem_buf_size = shmem_size - (NCONTEXTS + 1)*sizeof(hyper) - (NCONTEXTS+2)*sizeof(long) - NCONTEXTS*sizeof(HCTX);
shmem = CreateFileMapping(
(HANDLE) 0xFFFFFFFF, // use paging file
0, // no security attributes
PAGE_READWRITE, // read/write access
(unsigned long)((shmem_size >> 32) & 0xffffffff), // size: high 32-bits
(unsigned long)(shmem_size & 0xffffffff), // size: low 32-bits
"wthkdll.dll: shared memory"); // name of map object
if (shmem == NULL)
return FALSE;
fInit = (GetLastError() != ERROR_ALREADY_EXISTS);
shmem_view = MapViewOfFile(
shmem, // object to map view of
FILE_MAP_WRITE, // read/write access
0, // high offset: map from
0, // low offset: beginning
0); // default: map entire file
if( !shmem_view ) {
shutdown_shared_mem();
return FALSE;
}
shmem_buf_pos = (unsigned hyper*)shmem_view;
shmem_buf_play_pos = shmem_buf_pos + 1;
shmem_pkts_recorded = (long *)(shmem_buf_play_pos + NCONTEXTS);
shmem_pkts_played = shmem_pkts_recorded + 1;
shmem_hHook = (HWTHOOK)(shmem_pkts_played + 1);
shmem_ctx = (HCTX *)(shmem_hHook + 1);
shmem_time = (unsigned long *)(shmem_ctx + NCONTEXTS);
shmem_buf = (unsigned char *)(shmem_time + NCONTEXTS);
if( fInit ) {
unsigned i;
for( i = 0; i < NCONTEXTS; i++ ) {
shmem_ctx[i] = 0;
shmem_buf_pos[i] = 0;
shmem_buf_play_pos[i] = 0;
shmem_pkts_recorded[i] = 0;
shmem_pkts_played[i] = 0;
shmem_time[i] = 0;
}
*shmem_hHook = 0;
}
return TRUE;
}
/******************************************************************/
/* Windows DLL entry/exit points */
/* 32-bit entrypoint */
BOOL WINAPI DllMain (HANDLE hInst,
unsigned long ul_reason_for_call,
void far * lpReserved)
{
BOOL retval;
switch( ul_reason_for_call ) {
case DLL_PROCESS_ATTACH:
retval = init_shared_mem();
break;
case DLL_THREAD_ATTACH:
retval = TRUE;
break;
case DLL_THREAD_DETACH:
retval = TRUE;
break;
case DLL_PROCESS_DETACH:
shutdown_shared_mem();
retval = TRUE;
break;
default:
retval = FALSE;
}
return retval;
}
#endif /* WIN32 */
/* 16-bit dll entrypoint */
BOOL WINAPI LibMain(HANDLE hModule, WORD wDataSeg, WORD cbHeapSize,
LPSTR lpCmdLine)
{
unsigned i;
if( !shmem_buf_pos ) {
shmem_buf_pos = calloc( 1, sizeof(hyper) );
if( !shmem_buf_pos )
return FALSE;
}
if( !shmem_buf_play_pos ) {
shmem_buf_play_pos = calloc( 32, sizeof(hyper) );
if( !shmem_buf_play_pos ) {
free( shmem_buf_pos );
shmem_buf_pos = 0;
return FALSE;
}
}
if( !shmem_pkts_recorded ) {
shmem_pkts_recorded = calloc( 1, sizeof(hyper) );
if( !shmem_pkts_recorded ) {
free( shmem_buf_play_pos );
free( shmem_buf_pos );
shmem_buf_play_pos = 0;
shmem_buf_pos = 0;
return FALSE;
}
}
if( !shmem_pkts_played ) {
shmem_pkts_played = calloc( 1, sizeof(hyper) );
if( !shmem_pkts_played ) {
free( shmem_buf_play_pos );
free( shmem_buf_pos );
free( shmem_pkts_recorded );
shmem_buf_play_pos = 0;
shmem_buf_pos = 0;
shmem_pkts_recorded = 0;
return FALSE;
}
}
if( !shmem_hHook ) {
shmem_hHook = malloc( sizeof(HWTHOOK) );
if( !shmem_hHook ) {
free( shmem_buf_pos );
shmem_buf_pos = 0;
free( shmem_buf_play_pos );
shmem_buf_play_pos = 0;
free( shmem_pkts_recorded );
free( shmem_pkts_played );
shmem_pkts_recorded = 0;
shmem_pkts_played = 0;
return FALSE;
}
*shmem_hHook = 0;
}
if( !shmem_buf ) {
shmem_buf_size = 0xff00;
shmem_buf = calloc( 32, (size_t)shmem_buf_size );
if( !shmem_buf ) {
free( shmem_buf_pos );
shmem_buf_pos = 0;
free( shmem_buf_play_pos );
shmem_buf_play_pos = 0;
free( shmem_pkts_recorded );
free( shmem_pkts_played );
shmem_pkts_recorded = 0;
shmem_pkts_played = 0;
free( shmem_hHook );
shmem_hHook = 0;
return FALSE;
}
}
if( !shmem_ctx ) {
shmem_ctx = calloc( 32, sizeof(HCTX) );
if( !shmem_ctx ) {
free( shmem_buf_pos );
shmem_buf_pos = 0;
free( shmem_buf_play_pos );
shmem_buf_play_pos = 0;
free( shmem_pkts_recorded );
free( shmem_pkts_played );
shmem_pkts_recorded = 0;
shmem_pkts_played = 0;
free( shmem_hHook );
shmem_hHook = 0;
free( shmem_buf );
shmem_buf = 0;
shmem_buf_size = 0;
return FALSE;
}
}
if( !shmem_time ) {
shmem_time = calloc( 32, sizeof(long) );
if( !shmem_time ) {
free( shmem_buf_pos );
shmem_buf_pos = 0;
free( shmem_buf_play_pos );
shmem_buf_play_pos = 0;
free( shmem_pkts_recorded );
free( shmem_pkts_played );
shmem_pkts_recorded = 0;
shmem_pkts_played = 0;
free( shmem_hHook );
shmem_hHook = 0;
free( shmem_buf );
shmem_buf = 0;
shmem_buf_size = 0;
free( shmem_ctx );
shmem_ctx = 0;
return FALSE;
}
}
for( i = 0; i < NCONTEXTS; i++ ) {
shmem_ctx[i] = 0;
shmem_buf_pos[i] = 0;
shmem_buf_play_pos[i] = 0;
shmem_pkts_recorded[i] = 0;
shmem_pkts_played[i] = 0;
shmem_time[i] = 0;
}
return TRUE;
}
/* Win16 dll exit point. */
int WINAPI WEP(int nSystemExit)
{
if( shmem_buf )
free( shmem_buf );
if( shmem_buf_play_pos )
free( shmem_buf_play_pos );
if( shmem_buf_pos )
free( shmem_buf_pos );
if( shmem_pkts_recorded )
free( shmem_pkts_recorded );
if( shmem_pkts_played )
free( shmem_pkts_played );
if( shmem_hHook )
free( shmem_hHook );
return TRUE;
}
/******************************************************************/
/* Packet Decode Functions */
static const struct {
WTPKT tag; size_t size; int nargs; char *str;
} pkt_data_info[] = {
{PK_CONTEXT, sizeof(HCTX), 1, "Context: %u"},
{PK_STATUS, sizeof(UINT), 1, "Status: %u"},
{PK_TIME, sizeof(LONG), 1, "Time: %li"},
{PK_CHANGED, sizeof(WTPKT), 1, "Changed: %u"},
{PK_SERIAL_NUMBER, sizeof(UINT), 1, "Serial Number: %u"},
{PK_CURSOR, sizeof(UINT), 1, "Cursor: %u"},
{PK_BUTTONS, sizeof(DWORD), 1, "Buttons: %lu"},
{PK_X, sizeof(DWORD), 1, "X: %lu"},
{PK_Y, sizeof(DWORD), 1, "Y: %lu"},
{PK_Z, sizeof(DWORD), 1, "Z: %lu"},
{PK_NORMAL_PRESSURE, sizeof(UINT), 1, "Normal Pressure: %u"},
{PK_TANGENT_PRESSURE, sizeof(UINT), 1, "Tangent Pressure: %u"},
{PK_ORIENTATION, sizeof(ORIENTATION), 3, "Orientation: %i, %i, %i"},
{PK_ROTATION, sizeof(ROTATION), 3, "Rotation: %i, %i, %i"},
{0, 0, -1, 0}
};
size_t
compute_packet_size( WTPKT lcPktData )
{
unsigned i = 0;
size_t size = 0;
while( pkt_data_info[i].nargs > 0 ) {
if( lcPktData & pkt_data_info[i].tag )
size += pkt_data_info[i].size;
i++;
}
/* Check for extension data */
i = 0;
while( WTInfo( WTI_EXTENSIONS + i, EXT_NAME, 0 ) ) {
UINT ext_size[2];
WTPKT mask;
if( WTInfo( WTI_EXTENSIONS + i, EXT_MASK, &mask ) && (mask & lcPktData) ) {
WTInfo( WTI_EXTENSIONS + i, EXT_SIZE, ext_size );
size += ext_size[0];
}
i++;
}
return size;
}
long
get_packet_offset( WTPKT lcPktData, WTPKT field )
{
unsigned i = 0;
long offset = 0;
while( pkt_data_info[i].nargs > 0 && pkt_data_info[i].tag != field ) {
if( lcPktData & pkt_data_info[i].tag )
offset += pkt_data_info[i].size;
i++;
}
if( pkt_data_info[i].nargs == -1 )
offset = -1;
return offset;
}
size_t
display_packet( WTPKT lcPktData, unsigned char *packet )
{
unsigned i = 0;
size_t size = 0;
char outstring[2048] = "";
char str[128];
while( lcPktData && pkt_data_info[i].nargs > 0 ) {
if( lcPktData & pkt_data_info[i].tag ) {
if( pkt_data_info[i].nargs == 1 )
if( pkt_data_info[i].size == 2 )
sprintf( str, pkt_data_info[i].str, *((WORD *)packet) );
else
sprintf( str, pkt_data_info[i].str, *((DWORD *)packet) );
if( pkt_data_info[i].nargs == 3 )
sprintf( str, pkt_data_info[i].str, packet, *((WORD *)packet + 1), *((WORD *)packet + 2) );
strcat( outstring, str );
strcat( outstring, "\n" );
packet += pkt_data_info[i].size;
size += pkt_data_info[i].size;
}
i++;
}
/* Display extension data fields */
i = 0;
while( WTInfo( WTI_EXTENSIONS + i, EXT_NAME, str ) ) {
WTPKT mask;
if( WTInfo( WTI_EXTENSIONS + i, EXT_MASK, &mask ) && (mask & lcPktData) ) {
UINT ext_size[2];
UINT j;
WTInfo( WTI_EXTENSIONS + i, EXT_SIZE, ext_size );
strcat( outstring, str );
strcat( outstring, ": " );
for( j = 0; j < ext_size[0] / sizeof(int); j++ ) {
sprintf( str, "%8x", *((int *)packet + j) );
strcat( outstring, str );
strcat( outstring, " " );
}
strcat( outstring, "\n" );
packet += ext_size[0];
size += ext_size[0];
}
i++;
}
MessageBox( 0, outstring, "wthook", MB_OK );
return size;
}
int
hCtx_index( HCTX hCtx )
{
unsigned i = 0;
while( i < NCONTEXTS && shmem_ctx[i] && shmem_ctx[i] != hCtx )
i++;
if( i == NCONTEXTS )
return -1;
if( !shmem_ctx[i] )
shmem_ctx[i] = hCtx;
return i;
}
void *
find_next_ctx_packet( HCTX hCtx, WTPKT *lcPktData, DWORD * time_change, size_t *size )
{
HCTX packet_hCtx;
void *retval;
int index = hCtx_index(hCtx);
if( index > -1 ) {
/* Let shmem_buf_play_pos[index] end up pointing to the packet which we return */
*size = 0;
do {
if( *size )
shmem_buf_play_pos[index] += sizeof(WTPKT) + sizeof(HCTX) + sizeof(DWORD) + *size;
retval = shmem_buf + shmem_buf_play_pos[index];
*lcPktData = *((WTPKT *)(shmem_buf + shmem_buf_play_pos[index]));
packet_hCtx = *((HCTX *)(shmem_buf + sizeof(WTPKT) + shmem_buf_play_pos[index]));
*time_change = *((DWORD *)(shmem_buf + sizeof(WTPKT) + sizeof(HCTX) + shmem_buf_play_pos[index]));
*size = compute_packet_size( *lcPktData );
} while( shmem_buf_play_pos[index] < *shmem_buf_pos && packet_hCtx != hCtx );
if( packet_hCtx != hCtx )
retval = 0;
} else
retval = 0;
return retval;
}
/******************************************************************/
/* Wintab hook functions */
LRESULT
WINAPI RecordHook(int nCode,WPARAM wParam,LPARAM lParam)
{
DWORD curtime;
if( nCode >= 0 ) {
LOGCONTEXT lc;
size_t packet_size;
/* We need to find the packet data size */
WTGet((HCTX)wParam, &lc);
packet_size = compute_packet_size( lc.lcPktData );
/* If we have space left in our shared memory buffer, */
if( *shmem_buf_pos < shmem_buf_size - packet_size - sizeof(WTPKT) ) {
int index = hCtx_index( (HCTX)wParam );
/* There's no garauntee that the contexts will be giving us the
data that we need in their packets, so explicitly calculate
everything we need here: */
/* Write lc.lcPktData */
*((WTPKT *)(shmem_buf + *shmem_buf_pos)) = lc.lcPktData;
(*shmem_buf_pos) += sizeof(WTPKT);
/* Write hCtx */
*((HCTX *)(shmem_buf + *shmem_buf_pos)) = (HCTX)wParam;
(*shmem_buf_pos) += sizeof(HCTX);
/* Write time change (since previous packet of this context) */
curtime = timeGetTime();
if( shmem_time[index] == 0 ) {
shmem_time[index] = curtime;
*((DWORD *)(shmem_buf + *shmem_buf_pos)) = 0;
} else {
*((DWORD *)(shmem_buf + *shmem_buf_pos)) = curtime - shmem_time[index];
shmem_time[index] = curtime;
}
(*shmem_buf_pos) += sizeof(DWORD);
/* Write packet data */
memcpy( shmem_buf + *shmem_buf_pos, (LPVOID)lParam, packet_size );
(*shmem_buf_pos) += packet_size;
(*shmem_pkts_recorded)++;
}
return TRUE;
} else /* Let Wintab continue processing the packet */
return WTMgrPacketHookNext(*shmem_hHook,nCode,wParam,lParam);
}
LRESULT WINAPI PlayHook(int nCode, WPARAM wParam, LPARAM lParam)
{
DWORD delay;
void *packet;
size_t size;
WTPKT lcPktData;
LRESULT retval;
int index;
/* Find the next packet corrisponding to this context */
packet = find_next_ctx_packet( (HCTX)wParam, &size, &lcPktData, &delay );
if( packet ) {
switch( nCode ) {
case WTHC_GETNEXT:
/* Copy the packet to the buffer */
memcpy( (LPVOID)lParam, packet, size );
retval = delay;
break;
case WTHC_SKIP:
index = hCtx_index( (HCTX)wParam );
shmem_buf_play_pos[index] +=
size + sizeof(WTPKT) + sizeof(DWORD) + sizeof(HCTX);
retval = 0;
(*shmem_pkts_played)++;
break;
default:
break;
}
} else
retval = WTMgrPacketHookNext(*shmem_hHook, nCode, wParam, lParam);
return retval;
}
/******************************************************************/
/* Exported user functions */
long WINAPI get_num_pkts_recorded( void )
{
return *shmem_pkts_recorded;
}
long WINAPI get_num_pkts_played( void )
{
return *shmem_pkts_played;
}
BOOL WINAPI Record(BOOL fEnable, HMGR hMgr)
{
BOOL result = FALSE;
if (fEnable) {
if (!*shmem_hHook)
*shmem_hHook = WTMgrPacketHookEx(hMgr, WTH_RECORD,
"wthkdll.dll", "RecordHook");
result = !!*shmem_hHook;
} else {
if (*shmem_hHook) {
WTMgrPacketUnhook(*shmem_hHook);
*shmem_hHook = 0;
}
result = TRUE;
}
return result;
}
void
WINAPI display_record(void)
{
unsigned char *ptr = shmem_buf;
while( ptr < shmem_buf + *shmem_buf_pos ) {
WTPKT lcPktData;
HCTX hCtx;
DWORD time;
lcPktData = *((WTPKT *)ptr);
ptr += sizeof(WTPKT);
hCtx = *((HCTX *)ptr);
ptr += sizeof(HCTX);
time = *((DWORD *)ptr);
ptr += sizeof(DWORD);
ptr += display_packet( lcPktData, ptr );
}
}
BOOL WINAPI Playback(BOOL fEnable, HMGR hMgr)
{
BOOL result = FALSE;
if( fEnable ) {
if( !*shmem_hHook )
*shmem_hHook = WTMgrPacketHookEx( hMgr, WTH_PLAYBACK,
"wthkdll.dll", "PlayHook" );
result = !!*shmem_hHook;
} else {
if( *shmem_hHook ) {
WTMgrPacketUnhook( *shmem_hHook );
*shmem_hHook = 0;
}
result = TRUE;
}
return result;
}
/* Even when wthook.exe ends, the shared memory of the dll is still hanging
around, since the dll is loaded by wintab32 into other people's address spaces.
We have to reset the shared memory, so that the next time wthook runs, it doesn't
pick up the old shared memory contents. */
void
WINAPI reset( void )
{
/* Just set the counters back to zero */
*shmem_buf_pos = 0;
*shmem_buf_play_pos = 0;
*shmem_pkts_recorded = 0;
*shmem_pkts_played = 0;
}

View File

@@ -0,0 +1,98 @@
//wthook.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#include <wintab.h>
BOOL (WINAPI * Record)(BOOL,HMGR);
BOOL (WINAPI * Playback)(BOOL,HMGR);
long (WINAPI * get_num_pkts_recorded)(void);
long (WINAPI * get_num_pkts_played)(void);
void (WINAPI * display_record)(void);
void (WINAPI * reset)(void);
LRESULT WINAPI WndProc(HWND h, UINT msg, WPARAM w, LPARAM l) {
return DefWindowProc(h, msg, w, l);
}
//WinMain
int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // pointer to command line
int nCmdShow // show state of window
)
{
WNDCLASS wc = {0};
HINSTANCE hModule;
HMGR hMgr;
LPCSTR szClass = "WTHookClass";
HWND hWnd;
/* Load the functions from our dll */
hModule = LoadLibrary( "wthkdll.dll" );
if( !hModule ) {
MessageBox( 0, "LoadLibrary on 'wthkdll' failed.", "wthook", MB_OK );
return -1;
}
(FARPROC)Record = GetProcAddress( hModule, "Record" );
(FARPROC)Playback = GetProcAddress( hModule, "Playback" );
(FARPROC)get_num_pkts_recorded = GetProcAddress( hModule, "get_num_pkts_recorded" );
(FARPROC)get_num_pkts_played = GetProcAddress( hModule, "get_num_pkts_played" );
(FARPROC)display_record = GetProcAddress( hModule, "display_record" );
(FARPROC)reset = GetProcAddress( hModule, "reset" );
if( !Record || !Playback || !get_num_pkts_recorded || !get_num_pkts_played || !display_record || !reset ) {
MessageBox( 0, "GetProcAddress on 'wthkdll' failed.", "wthook", MB_OK );
return -1;
}
/* Open a window and get a manager handle */
wc.lpfnWndProc = WndProc;
wc.hInstance = hInstance;
wc.lpszClassName = szClass;
if (RegisterClass(&wc)) {
hWnd = CreateWindow(szClass, "WTHookWnd", 0,
0, 0, 0, 0,
0, 0, hInstance, NULL);
}
hMgr = WTMgrOpen(hWnd, WT_DEFBASE);
reset(); /* Reset wthkdll */
/* Record some packets */
if (Record(TRUE,hMgr)) {
long recsize;
char buf[128];
MessageBox(0, "Hook installed. Recording Packets. Hit ok to end hook.", "WTHook", MB_OK);
recsize = get_num_pkts_recorded();
Record(FALSE,hMgr);
sprintf( buf, "Recorded %li packets.", recsize );
MessageBox( 0, buf, "WTHook", MB_OK );
}
/* Display the packet data */
display_record();
/* Clean up */
WTMgrClose(hMgr);
DestroyWindow(hWnd);
UnregisterClass(szClass, hInstance);
reset(); /* Reset wthkdll */
FreeLibrary( hModule );
return 0;
}