- memoryhooks_tool.zip
- bin
- CodeInjector.dll
- MemoryHooks.dll
- MemoryHooksUI.exe
- MemoryLeakExample.exe
- MemoryLeakExampleVB.exe
- examples
- MemoryLeakExample_CPP
- MemoryLeakExample_VB
- memoryhooks_src.zip
- src
- CodeInjector
- include
- lib
- dbghelp.dll
- dbghelp.lib
- detours.lib
- MemoryHooks.dsw
- MemoryHooks
- MemoryHooksUI
|
//////////////////////////////////////////////////////////
// Basic log writer implementation
//
// migo (2005)
//////////////////////////////////////////////////////////
#include "LogWriter.h"
#define PULONG_PTR LPVOID
#define ULONG_PTR LPVOID
#include "dbghelp.h"
/////////////////////////////////////////////////////////////
// WriteToLog
/////////////////////////////////////////////////////////////
BOOL WriteToLog( HANDLE hF, LPCTSTR strFormat, ... )
{
TCHAR buf[2048];
va_list args;
va_start( args, strFormat );
_vstprintf( buf, strFormat, args );
va_end( args );
DWORD dwWritten;
return ::WriteFile( hF, buf, _tcslen(buf), &dwWritten, NULL );
}
/////////////////////////////////////////////////////////////
// InitLogFile
/////////////////////////////////////////////////////////////
HANDLE InitLogFile( LPCTSTR strReportFileName )
{
SymInitialize( ::GetCurrentProcess(), NULL, TRUE );
HANDLE hF;
hF = ::CreateFile( strReportFileName, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );
if( INVALID_HANDLE_VALUE == hF )
return hF;
WriteToLog( hF, "Created by MemoryHooks" ENDL
"----------------------" ENDL );
return hF;
}
/////////////////////////////////////////////////////////////
// CloseLogFile
/////////////////////////////////////////////////////////////
BOOL CloseLogFile( HANDLE hF )
{
SymCleanup( ::GetCurrentProcess() );
return ::CloseHandle(hF);
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.