Click here to Skip to main content
15,887,875 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
Hello Guys,

I'm sure many of you must have done it. This is what I need.
Count number of calls made to specific Windows API (Say ReplaceFile or ReadFile or Openfile) by any process running across the system. Also if possible keep a track of number of calls per process.

I'm planning to code this in VBScript(.vbs) But suggestions are welcome.

Regards,
Darshan

What I have tried:

I have tried Absolutely Nothing as I don't know what to start with.
Posted
Updated 25-Mar-16 7:25am
Comments
enhzflep 25-Mar-16 6:35am    
Search for API hooking
[no name] 25-Mar-16 8:34am    
I think this is a good hint, can't vote 5 here for this :(
enhzflep 26-Mar-16 1:23am    
Thanks mate, the points are irrelevant. My only interest is in obtaining a good outcome for the OP. :)
Hope you're enjoying the long-weekend.
Afzaal Ahmad Zeeshan 25-Mar-16 6:36am    
You would need to create a Windows service, that handles each and every command being executed. Then it would see if that is the action it needs to track and log... In other words, you need to modify the kernel to log the services, otherwise, you need to write a service that runs on the top of kernel and logs the code calls.
Darshan Parab 25-Mar-16 6:47am    
I was thinking something like that. A process running in the background and tracking the system calls. My problem is I'm totally unaware of how to do that. I mean how to grab a call made to Windows API by any running process.

1 solution

You cannot do this in VBScript.

You need an API hooking library, like Detours[^]. Get your checkbook out. You're going to need it.

There are alternatives[^], but in all cases, they are not going to work in VBScript.
 
Share this answer
 
Comments
F-ES Sitecore 25-Mar-16 14:18pm    
Agreed. The only way you could do this "from vbscript" is to write a COM object that does the hooking and you automate\query the COM object via VBScript.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900