Introduction
APISpy32 is a system-wide API spying utility
capable of intercepting API calls made by ALL active Windows
processes and their attached DLLs. While other API spying
utilities can only monitor one application at a time, APISpy32
uses several sophisticated low-level techniques in order to
intercept API calls made by EVERY process running on the
system, making it the most powerful utility of its kind.
New features offered by this version include:
Using APISpy32
Using APISpy32 is a simple matter of editing a text file (apispy32.api)
which contains a list of intercepted API functions. This file must be
located in the Windows directory (e.g. C:\WINNT) and should be saved in
ASCII format. Each entry in the file represents a single API function
along with the various parameters which comprise it.
Here is an example:
USER32.DLL:MessageBoxW(HWND, PWSTR, PWSTR, DWORD)
The parameter types which are recognized by APISpy32 are listed below:
Type |
Size |
C Type |
BYTE |
8 bits |
unsigned char |
WORD |
16 bits |
unsigned short |
DWORD |
32 bits |
unsigned int |
INT |
32 bits |
int |
HWND |
32 bits |
unsigned int |
HANDLE |
32 bits |
unsigned int |
BOOL |
32 bits |
unsigned int |
PBYTE |
32 bits |
unsigned char * |
PWORD |
32 bits |
unsigned short * |
PDWORD |
32 bits |
unsigned int * |
PSTR |
32 bits |
char * |
PWSTR |
32 bits |
wchar_t * |
I've provided a sample API declaration file (located in the root of the zip file) that can be used for testing APISpy32 functionality. Simply copy this file to your Windows directory and you're ready to go...
Known issues
If you need to intercept API calls made by a specific Windows application, rather than by all active processes, you might want to try a different approach such as the one offered by Matt Pietrek in his excellent book: "Windows 95 System Programming Secrets". There are several advantages (and disadvantages) to this technique which relies on patching the import table of the target application. Check out Matt's web site for additional information on this subject: http://www.tiac.net/users/mpietrek.
Bugs and other anomalies
Creating an API spying utility is far from being a
trivial programming task. Various low-level techniques must be
utilized in order to intercept the API calls without sacrificing
performance and usability. If you encounter bugs or other anomalies
in APISpy32, please send an email to yariv@internals.com
with a description of the problem and a list of the actions which
caused the software to malfunction. I will do my best to correct
all bugs and place fixed versions on my web site as soon as they
become available.
Legal Issues
The following terms apply to all files associated with the software unless explicitly disclaimed in individual files.
You may not distribute APISpy32 in any form, without the express written permission of Yariv Kaplan.
You may not use APISpy32 source code in a commercial or non-commercial product, without the express written permission of Yariv Kaplan.
In no event shall the author be liable to any party for direct, indirect, special, incidental, or consequential damages arising out of the use of this software, its documentation, or any derivatives thereof, even if the author has been advised of the possibility of such damage. The author specifically disclaim any warranties, including but not limited to, the implied warranties of merchantability, fitness for a particular purpose, and non-infringment. This software is provided on an "AS IS" basis, and the author has no obligation to provide maintenance, support, updates, enhancements, or modifications.
The code of InjectLib is Copyright 1995-1997 by Jeffrey Richter.
I can be reached at yariv@internals.com.
Yariv Kaplan