December 2007 - Posts

LeakDiag and Detours

Do you know how to detect a memory leak? One good tool is LeakDiag, it can give detail information about memory leaked inside a process. Nice to know the this tool is available at Microsoft FTP site (click to download) :

01

You can find many other tools, but LeakDiag is a flexible one. LeakDiag uses Microsoft Research Detours technology to intercept calls to the memory allocators. It is not relying on the OS support for recording memory allocation stack traces.

Detours is an innovative research tools with the ability to easily instrument and extend existing OS and application functionality. Detours is a library for instrumenting arbitrary Win32 functions on x86, x64, and IA64 machines. Detours intercepts Win32 functions by re-writing the in-memory code for target functions. The Detours package also contains utilities to attach arbitrary DLLs and data segments (called payloads) to any Win32 binary. This is a powerful tool for sure!.

Detours is a library for intercepting arbitrary Win32 binary functions on x86 machines. Interception code occurs dynamically at runtime. Detours replaces the first few instructions of the target function with an unconditional jump to the user-provided detour function. Instructions from the target function are preserved in a trampoline function. The trampoline function consists of the instructions removed from the target function and an unconditional branch to the remainder of the target function. The detour function can either replace the target function or extend its semantics by invoking the target function as a subroutine
through the trampoline.

Detours are inserted at execution time. The code of the target function is modified in memory, not on disk, thus facilitating interception of binary functions at a very fine granularity. Detours is reusable. You can develop your own application utilize its libraries.

#include <windows.h>
#include <detours.h>

VOID (*DynamicTrampoline)(VOID) = NULL;
DETOUR_TRAMPOLINE(VOID WINAPI SleepTrampoline(DWORD),Sleep);

VOID WINAPI SleepDetour(DWORD dw)
{
    return SleepTrampoline(dw);
}

VOID DynamicDetour(VOID)
{
    return DynamicTrampoline();
}

void main(void)
{
    VOID (*DynamicTarget)(VOID) = SomeFunction;
    DynamicTrampoline =(FUNCPTR)DetourFunction((PBYTE)DynamicTarget,(PBYTE)DynamicDetour);
    DetourFunctionWithTrampoline((PBYTE)SleepTrampoline,(PBYTE)SleepDetour);
    // Execute the remainder of program.
    DetourRemoveTrampoline(SleepTrampoline);
    DetourRemoveTrampoline(DynamicTrampoline);
}


Detours is used widely within Microsoft and within the industry !. If you like low level stuff, play with it and share with others.

Thx - RAM

Share this post: | | | |

Charles Simonyi and Me at SWA Magazine

I know him from his famous Hongarian naming convetion for C++ codes. Charles Simonyi is legend in computer industry:

- He is one of the greatest programmers of all time. Bill Gates
- The most richest and successfull developer in this planet (1B$) J
- A PhD who worked at Palo Alto Research Center (PARC)
- The first developer who visited moon J
- Creator of Microsoft Word and architect of Office

clip_image002

It is an honor for me to be at the same magazine with him. He is the real software legend.

clip_image006


Please buy SWA Magazine if you want to know more :).

 

Thx - Risman Adnan

Share this post: | | | |

iMULAI Gathering | Invitation

I would like to invite all INDC members who are interested to iMULAI and already registered in the portal (www.imulai.com) to attend iMULAI gathering that will be held :

Venue    :  Auditorium PT. Microsoft Indonesia
                 18th Floor, Tower 2, Jakarta Stock Exchange Bldg
                 Jln. Jenderal Sudirman Kav. 52-53
                 Jakarta 12190, Indonesia
Time       : Saturday, Dec 15, 2007 (09.30 – 12.30)  


Agenda :             

09.30 – 10.00 : Registration
10.00 – 11.00 : Business Proposal Completion, Farid Ma’ruf, SENADA
11.00 – 12.00 : Business Innovation with Software + Services , Risman Adnan, Microsoft Indonesia
12.00 – 12.30 : Closing and Lunch

For more information, please contact Satria at info@imulai.com.

Share this post: | | | |