2009-11-15 06:34 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* contrib/hbqt/hbqt_destruct.cpp
    ! Fixed the way windows.h is included.
    ! Fixed to exclude Windows stuff on non-Windows systems (in debug mode).
    ; PLEASE KEEP IT THIS WAY.
This commit is contained in:
Viktor Szakats
2009-11-15 05:35:50 +00:00
parent 75e90cbfa9
commit 7dc1d60d09
2 changed files with 26 additions and 13 deletions

View File

@@ -17,6 +17,12 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-11-15 06:34 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbqt/hbqt_destruct.cpp
! Fixed the way windows.h is included.
! Fixed to exclude Windows stuff on non-Windows systems (in debug mode).
; PLEASE KEEP IT THIS WAY.
2009-11-15 05:30 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbsms/Makefile
! Fixed dependency on tpathy headers.

View File

@@ -51,6 +51,10 @@
*/
/*----------------------------------------------------------------------*/
#if defined(__debug__)
#define HB_OS_WIN_USED
#endif
#include "hbapi.h"
#include "hbvm.h"
#include "hbapiitm.h"
@@ -100,11 +104,13 @@ void * hbqt_gcpointer( int iParam )
#if defined(__debug__)
#include <windows.h>
#include <Psapi.h>
#if defined( HB_OS_WIN )
#include <Psapi.h>
#endif
void just_debug( const char * sTraceMsg, ... )
{
#if defined( HB_OS_WIN )
if( sTraceMsg )
{
char buffer[ 1024 ];
@@ -116,27 +122,28 @@ void just_debug( const char * sTraceMsg, ... )
OutputDebugString( buffer );
}
#endif
}
int hb_getMemUsed( void )
{
int size = 0;
#if defined( HB_OS_WIN )
HANDLE hProcess;
PROCESS_MEMORY_COUNTERS pmc;
int size = 0;
hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
FALSE, GetCurrentProcessId() );
if ( NULL == hProcess )
return 0;
hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, GetCurrentProcessId() );
if( hProcess == NULL )
return 0;
if ( GetProcessMemoryInfo( hProcess, &pmc, sizeof(pmc)) )
{
size = ( int ) pmc.WorkingSetSize / 1024 ;
}
if( GetProcessMemoryInfo( hProcess, &pmc, sizeof( pmc ) ) )
size = ( int ) pmc.WorkingSetSize / 1024;
CloseHandle( hProcess );
return size;
CloseHandle( hProcess );
#endif
return size;
}
#endif
HB_FUNC( HB_GETMEMUSED )