Author Topic: ResGuard Version 2  (Read 3496 times)

Biterider

  • Moderator
  • Member
  • *****
  • Posts: 113
  • ObjAsm32
    • ObjAsm32
ResGuard Version 2
« on: August 27, 2012, 03:16:14 AM »
ResGuard is a DLL written in assembler using ObjAsm32. Its goal is to detect system resource leaks in Win32 applications. When the DLL is loaded at application startup, it hooks several system APIs which creates and destroys system resources. Monitoring for example the returned handles from the creation APIs and the arguments passed to the releasing APIs, it is possible to find out if a system resource was missed or the wrong API was used to free it.

ResGuard shows the call return address and the call sequence of the code that triggered the leak. In cases where the API failed, the main arguments are shown. When the API succeeds, the return value or the tracking argument is displayed.

Using simply 3 calls to the DLL (ResGuad_Start, ResGuad_Stop and ResGuad_Show), it is possible to inspect specific code blocks for leaks. In complex situations, this helps to track issues more efficiently. 
I coded the APIs I frequently use into the DLL, but many other additional APIs may be added on demand.

ResGuad Version 2 is now able to work on multithread Win32 applications. It has the necessary synchronization primitives to ensure a correct analysis without degrading in performance.

MASM written applications simply need to include ResGuard.inc and includelib ResGuard.lib and the 3 DLL calls mentioned above.
The ResGuard.dll should be placed in the %windir%\SYSTEM32\ directory.

To display the analysis results, ResGuard uses the DebugCenter application, which is a Debug Window used to visualize messages sent from multiple applications using IPC. It is necessary to run DebugCenter once to register itself before any other application can communicate with it.
 
All sources and binaries of these new releases are available from the last live update using the OA32_Updater, which is available from the ObjAsm32 homepage.

Note:
False positives may happen if a handle of, let’s say a menu, is passed to a window, which when destroyed, disposes by itself the allocated resource. In this case ResGuard shows a warning about an unreleased resource.

Biterider

Biterider

  • Moderator
  • Member
  • *****
  • Posts: 113
  • ObjAsm32
    • ObjAsm32
Re: ResGuard Version 2
« Reply #1 on: August 03, 2015, 12:45:23 AM »
Hi
I found some problems while installing ResGuard on my Win8.1 system.
On 64 bit systems the ResGuard.dll must be saved in the SysWOW64 directory and additionally you must have elevated privileges for this operation. The old batch files misbehaved in this regard since they were conceived for win32 systems.
The attached zip file includes 3 batch files to replace those from the “Projects/ResGuard” folder.
Please execute them on 64 bit systems from the "Run as administrator" context menu item.

Biterider

jj2007

  • Member
  • *****
  • Posts: 7554
  • Assembler is fun ;-)
    • MasmBasic
Re: ResGuard Version 2
« Reply #2 on: August 03, 2015, 03:51:47 AM »
Looks like an extremely useful tool :t

HSE

  • Member
  • ****
  • Posts: 532
  • <AMD>< 7-32>
Re: ResGuard Version 2
« Reply #3 on: August 03, 2015, 10:02:22 AM »
Absoluty perfect! All became red  ::)

I'm working in a 32 bit system but obviously I never actived the option, because Resguard never was compiled (no Resguard.lib).  In Windows\system32 there was a Resguard.dll (previous version)  and I thought nothing else was necesary.