diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/memory.cpp | 156 | ||||
-rw-r--r-- | src/core/miranda.cpp | 240 | ||||
-rw-r--r-- | src/core/miranda.h | 166 | ||||
-rw-r--r-- | src/core/modules.cpp | 448 | ||||
-rw-r--r-- | src/core/modules.h | 4 |
5 files changed, 509 insertions, 505 deletions
diff --git a/src/core/memory.cpp b/src/core/memory.cpp index 8dbb7b2ecc..3cab040efe 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -26,34 +26,34 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define BLOCK_ALLOCED 0xABBABABA
#define BLOCK_FREED 0xDEADBEEF
-static int CheckBlock( void* blk )
+static int CheckBlock(void* blk)
{
int result = FALSE;
- char* p = ( char* )blk - sizeof(DWORD)*2;
+ char* p = (char*)blk - sizeof(DWORD)*2;
DWORD size, *b, *e;
__try
{
- size = *( DWORD* )p;
- b = ( DWORD* )&p[ sizeof( DWORD ) ];
- e = ( DWORD* )&p[ sizeof( DWORD )*2 + size ];
+ size = *(DWORD*)p;
+ b = (DWORD*)&p[ sizeof(DWORD) ];
+ e = (DWORD*)&p[ sizeof(DWORD)*2 + size ];
- if ( *b != BLOCK_ALLOCED || *e != BLOCK_ALLOCED )
+ if (*b != BLOCK_ALLOCED || *e != BLOCK_ALLOCED)
{
- if ( *b == BLOCK_FREED && *e == BLOCK_FREED )
- OutputDebugStringA( "memory block is already deleted\n" );
+ if (*b == BLOCK_FREED && *e == BLOCK_FREED)
+ OutputDebugStringA("memory block is already deleted\n");
else
- OutputDebugStringA( "memory block is corrupted\n" );
- #if defined( _DEBUG )
+ OutputDebugStringA("memory block is corrupted\n");
+ #if defined(_DEBUG)
DebugBreak();
#endif
}
else result = TRUE;
}
- __except( EXCEPTION_EXECUTE_HANDLER )
+ __except(EXCEPTION_EXECUTE_HANDLER)
{
- OutputDebugStringA( "access violation during checking memory block\n" );
- #if defined( _DEBUG )
+ OutputDebugStringA("access violation during checking memory block\n");
+ #if defined(_DEBUG)
DebugBreak();
#endif
}
@@ -63,91 +63,91 @@ static int CheckBlock( void* blk ) /******************************************************************************/
-void* mir_alloc( size_t size )
+void* mir_alloc(size_t size)
{
- if ( size == 0 )
+ if (size == 0)
return NULL;
{
- char* p = (char*)malloc( size + sizeof(DWORD)*3 );
- if ( p == NULL ) {
- OutputDebugStringA( "memory overflow\n" );
- #if defined( _DEBUG )
+ char* p = (char*)malloc(size + sizeof(DWORD)*3);
+ if (p == NULL) {
+ OutputDebugStringA("memory overflow\n");
+ #if defined(_DEBUG)
DebugBreak();
#endif
return NULL;
}
- *( DWORD* )p = ( DWORD )size;
- *( DWORD* )&p[ sizeof(DWORD) ] = BLOCK_ALLOCED;
- *( DWORD* )&p[ size + sizeof(DWORD)*2 ] = BLOCK_ALLOCED;
- return p + sizeof( DWORD )*2;
+ *(DWORD*)p = (DWORD)size;
+ *(DWORD*)&p[ sizeof(DWORD) ] = BLOCK_ALLOCED;
+ *(DWORD*)&p[ size + sizeof(DWORD)*2 ] = BLOCK_ALLOCED;
+ return p + sizeof(DWORD)*2;
} }
/******************************************************************************/
-void* mir_calloc( size_t size )
+void* mir_calloc(size_t size)
{
- void* p = mir_alloc( size );
- if ( p != NULL )
- memset( p, 0, size );
+ void* p = mir_alloc(size);
+ if (p != NULL)
+ memset(p, 0, size);
return p;
}
/******************************************************************************/
-void* mir_realloc( void* ptr, size_t size )
+void* mir_realloc(void* ptr, size_t size)
{
char* p;
- if ( ptr != NULL ) {
- if ( !CheckBlock( ptr ))
+ if (ptr != NULL) {
+ if ( !CheckBlock(ptr))
return NULL;
- p = ( char* )ptr - sizeof(DWORD)*2;
+ p = (char*)ptr - sizeof(DWORD)*2;
}
else p = NULL;
- p = ( char* )realloc( p, size + sizeof(DWORD)*3 );
- if ( p == NULL ) {
- OutputDebugStringA( "memory overflow\n" );
- #if defined( _DEBUG )
+ p = (char*)realloc(p, size + sizeof(DWORD)*3);
+ if (p == NULL) {
+ OutputDebugStringA("memory overflow\n");
+ #if defined(_DEBUG)
DebugBreak();
#endif
return NULL;
}
- *( DWORD* )p = ( DWORD )size;
- *( DWORD* )&p[ sizeof(DWORD) ] = BLOCK_ALLOCED;
- *( DWORD* )&p[ size + sizeof(DWORD)*2 ] = BLOCK_ALLOCED;
- return p + sizeof( DWORD )*2;
+ *(DWORD*)p = (DWORD)size;
+ *(DWORD*)&p[ sizeof(DWORD) ] = BLOCK_ALLOCED;
+ *(DWORD*)&p[ size + sizeof(DWORD)*2 ] = BLOCK_ALLOCED;
+ return p + sizeof(DWORD)*2;
}
/******************************************************************************/
-void mir_free( void* ptr )
+void mir_free(void* ptr)
{
char* p;
DWORD size;
- if ( ptr == NULL )
+ if (ptr == NULL)
return;
- if ( !CheckBlock( ptr ))
+ if ( !CheckBlock(ptr))
return;
- p = ( char* )ptr - sizeof(DWORD)*2;
- size = *( DWORD* )p;
- *( DWORD* )&p[ sizeof(DWORD) ] = BLOCK_FREED;
- *( DWORD* )&p[ size + sizeof(DWORD)*2 ] = BLOCK_FREED;
- free( p );
+ p = (char*)ptr - sizeof(DWORD)*2;
+ size = *(DWORD*)p;
+ *(DWORD*)&p[ sizeof(DWORD) ] = BLOCK_FREED;
+ *(DWORD*)&p[ size + sizeof(DWORD)*2 ] = BLOCK_FREED;
+ free(p);
}
/******************************************************************************/
-char* mir_strdup( const char* str )
+char* mir_strdup(const char* str)
{
- if ( str != NULL ) {
- char* p = ( char* )mir_alloc( strlen( str )+1 );
- if ( p )
- strcpy( p, str );
+ if (str != NULL) {
+ char* p = (char*)mir_alloc(strlen(str)+1);
+ if (p)
+ strcpy(p, str);
return p;
}
return NULL;
@@ -155,12 +155,12 @@ char* mir_strdup( const char* str ) /******************************************************************************/
-char* mir_strndup( const char* str, size_t len )
+char* mir_strndup(const char* str, size_t len)
{
- if ( str != NULL && len != 0 ) {
- char* p = ( char* )mir_alloc( len + 1 );
- if ( !p ) {
- memcpy( p, str, len );
+ if (str != NULL && len != 0) {
+ char* p = (char*)mir_alloc(len + 1);
+ if ( !p) {
+ memcpy(p, str, len);
p[ len ] = 0;
}
return p;
@@ -170,12 +170,12 @@ char* mir_strndup( const char* str, size_t len ) /******************************************************************************/
-WCHAR* mir_wstrdup( const WCHAR* str )
+WCHAR* mir_wstrdup(const WCHAR* str)
{
- if ( str != NULL ) {
- WCHAR* p = ( WCHAR* )mir_alloc( sizeof( WCHAR )*( wcslen( str )+1 ));
- if ( p )
- wcscpy( p, str );
+ if (str != NULL) {
+ WCHAR* p = (WCHAR*)mir_alloc(sizeof(WCHAR)*(wcslen(str)+1));
+ if (p)
+ wcscpy(p, str);
return p;
}
return NULL;
@@ -233,48 +233,48 @@ int mir_vsntprintf(TCHAR *buffer, size_t count, const TCHAR* fmt, va_list va) /******************************************************************************/
-wchar_t* mir_a2u_cp( const char* src, int codepage )
+wchar_t* mir_a2u_cp(const char* src, int codepage)
{
- if ( src == NULL )
+ if (src == NULL)
return NULL;
- int cbLen = MultiByteToWideChar( codepage, 0, src, -1, NULL, 0 );
- wchar_t* result = ( wchar_t* )mir_alloc( sizeof( wchar_t )*(cbLen+1));
- if ( result == NULL )
+ int cbLen = MultiByteToWideChar(codepage, 0, src, -1, NULL, 0);
+ wchar_t* result = (wchar_t*)mir_alloc(sizeof(wchar_t)*(cbLen+1));
+ if (result == NULL)
return NULL;
- MultiByteToWideChar( codepage, 0, src, -1, result, cbLen );
+ MultiByteToWideChar(codepage, 0, src, -1, result, cbLen);
result[ cbLen ] = 0;
return result;
}
/******************************************************************************/
-wchar_t* mir_a2u( const char* src )
+wchar_t* mir_a2u(const char* src)
{
- return mir_a2u_cp( src, LangPackGetDefaultCodePage());
+ return mir_a2u_cp(src, LangPackGetDefaultCodePage());
}
/******************************************************************************/
-char* mir_u2a_cp( const wchar_t* src, int codepage )
+char* mir_u2a_cp(const wchar_t* src, int codepage)
{
- if ( src == NULL )
+ if (src == NULL)
return NULL;
- int cbLen = WideCharToMultiByte( codepage, 0, src, -1, NULL, 0, NULL, NULL );
- char* result = ( char* )mir_alloc( cbLen+1 );
- if ( result == NULL )
+ int cbLen = WideCharToMultiByte(codepage, 0, src, -1, NULL, 0, NULL, NULL);
+ char* result = (char*)mir_alloc(cbLen+1);
+ if (result == NULL)
return NULL;
- WideCharToMultiByte( codepage, 0, src, -1, result, cbLen, NULL, NULL );
+ WideCharToMultiByte(codepage, 0, src, -1, result, cbLen, NULL, NULL);
result[ cbLen ] = 0;
return result;
}
/******************************************************************************/
-char* mir_u2a( const wchar_t* src )
+char* mir_u2a(const wchar_t* src)
{
- return mir_u2a_cp( src, LangPackGetDefaultCodePage());
+ return mir_u2a_cp(src, LangPackGetDefaultCodePage());
}
diff --git a/src/core/miranda.cpp b/src/core/miranda.cpp index 3798a54710..8678524411 100644 --- a/src/core/miranda.cpp +++ b/src/core/miranda.cpp @@ -35,7 +35,7 @@ void UnloadNewPluginsModule(void); void UnloadDefaultModules(void);
void RecalculateTime(void);
-HINSTANCE GetInstByAddress( void* codePtr );
+HINSTANCE GetInstByAddress(void* codePtr);
pfnMyMonitorFromPoint MyMonitorFromPoint;
pfnMyMonitorFromRect MyMonitorFromRect;
@@ -99,24 +99,24 @@ int hLangpack = 0; /////////////////////////////////////////////////////////////////////////////////////////
// exception handling
-static DWORD __cdecl sttDefaultFilter( DWORD, EXCEPTION_POINTERS* )
+static DWORD __cdecl sttDefaultFilter(DWORD, EXCEPTION_POINTERS*)
{
return EXCEPTION_EXECUTE_HANDLER;
}
pfnExceptionFilter pMirandaExceptFilter = sttDefaultFilter;
-static INT_PTR GetExceptionFilter( WPARAM, LPARAM )
+static INT_PTR GetExceptionFilter(WPARAM, LPARAM)
{
- return ( INT_PTR )pMirandaExceptFilter;
+ return (INT_PTR)pMirandaExceptFilter;
}
-static INT_PTR SetExceptionFilter( WPARAM, LPARAM lParam )
+static INT_PTR SetExceptionFilter(WPARAM, LPARAM lParam)
{
pfnExceptionFilter oldOne = pMirandaExceptFilter;
- if ( lParam != 0 )
- pMirandaExceptFilter = ( pfnExceptionFilter )lParam;
- return ( INT_PTR )oldOne;
+ if (lParam != 0)
+ pMirandaExceptFilter = (pfnExceptionFilter)lParam;
+ return (INT_PTR)oldOne;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -132,7 +132,7 @@ typedef struct }
THREAD_WAIT_ENTRY;
-static LIST<THREAD_WAIT_ENTRY> threads( 10, NumericKeySortT );
+static LIST<THREAD_WAIT_ENTRY> threads(10, NumericKeySortT);
struct FORK_ARG {
HANDLE hEvent;
@@ -155,9 +155,9 @@ void __cdecl forkthread_r(void * arg) {
callercode(cookie);
}
- __except( pMirandaExceptFilter( GetExceptionCode(), GetExceptionInformation()))
+ __except(pMirandaExceptFilter(GetExceptionCode(), GetExceptionInformation()))
{
- Netlib_Logf( NULL, "Unhandled exception in thread %x", GetCurrentThreadId());
+ Netlib_Logf(NULL, "Unhandled exception in thread %x", GetCurrentThreadId());
}
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
@@ -186,7 +186,7 @@ UINT_PTR forkthread ( static INT_PTR ForkThreadService(WPARAM wParam, LPARAM lParam)
{
- return (INT_PTR)forkthread(( pThreadFunc )wParam, 0, ( void* )lParam );
+ return (INT_PTR)forkthread((pThreadFunc)wParam, 0, (void*)lParam);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -196,7 +196,7 @@ unsigned __stdcall forkthreadex_r(void * arg) {
struct FORK_ARG *fa = (struct FORK_ARG *)arg;
pThreadFuncEx threadcode = fa->threadcodeex;
- pThreadFuncOwner threadcodeex = ( pThreadFuncOwner )fa->threadcodeex;
+ pThreadFuncOwner threadcodeex = (pThreadFuncOwner)fa->threadcodeex;
void *cookie = fa->arg;
void *owner = fa->owner;
unsigned long rc = 0;
@@ -205,14 +205,14 @@ unsigned __stdcall forkthreadex_r(void * arg) SetEvent(fa->hEvent);
__try
{
- if ( owner )
- rc = threadcodeex( owner, cookie );
+ if (owner)
+ rc = threadcodeex(owner, cookie);
else
- rc = threadcode( cookie );
+ rc = threadcode(cookie);
}
- __except( pMirandaExceptFilter( GetExceptionCode(), GetExceptionInformation()))
+ __except(pMirandaExceptFilter(GetExceptionCode(), GetExceptionInformation()))
{
- Netlib_Logf( NULL, "Unhandled exception in thread %x", GetCurrentThreadId());
+ Netlib_Logf(NULL, "Unhandled exception in thread %x", GetCurrentThreadId());
}
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
@@ -226,7 +226,7 @@ UINT_PTR forkthreadex( unsigned (__stdcall *threadcode)(void*),
void* owner,
void *arg,
- unsigned *thraddr )
+ unsigned *thraddr)
{
UINT_PTR rc;
struct FORK_ARG fa = { 0 };
@@ -245,11 +245,11 @@ UINT_PTR forkthreadex( static INT_PTR ForkThreadServiceEx(WPARAM wParam, LPARAM lParam)
{
FORK_THREADEX_PARAMS* params = (FORK_THREADEX_PARAMS*)lParam;
- if ( params == NULL )
+ if (params == NULL)
return 0;
UINT threadID;
- return forkthreadex( NULL, params->iStackSize, params->pFunc, ( void* )wParam, params->arg, params->threadID ? params->threadID : &threadID );
+ return forkthreadex(NULL, params->iStackSize, params->pFunc, (void*)wParam, params->arg, params->threadID ? params->threadID : &threadID);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -266,70 +266,70 @@ static int MirandaWaitForMutex(HANDLE hEvent) for (;;) {
// will get WAIT_IO_COMPLETE for QueueUserAPC() which isnt a result
DWORD rc = MsgWaitForMultipleObjectsExWorkaround(1, &hEvent, INFINITE, QS_ALLINPUT, MWMO_ALERTABLE);
- if ( rc == WAIT_OBJECT_0 + 1 ) {
+ if (rc == WAIT_OBJECT_0 + 1) {
MSG msg;
- while ( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) ) {
- if ( IsDialogMessage(msg.hwnd, &msg) ) continue;
+ while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
+ if (IsDialogMessage(msg.hwnd, &msg)) continue;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
- } else if ( rc == WAIT_OBJECT_0 ) {
+ } else if (rc == WAIT_OBJECT_0) {
// got object
return 1;
- } else if ( rc == WAIT_ABANDONED_0 || rc == WAIT_FAILED ) return 0;
+ } else if (rc == WAIT_ABANDONED_0 || rc == WAIT_FAILED) return 0;
}
}
VOID CALLBACK KillAllThreads(HWND, UINT, UINT_PTR, DWORD)
{
- if ( MirandaWaitForMutex( hStackMutex )) {
- for ( int j=0; j < threads.getCount(); j++ ) {
+ if ( MirandaWaitForMutex(hStackMutex)) {
+ for (int j=0; j < threads.getCount(); j++) {
THREAD_WAIT_ENTRY* p = threads[j];
char szModuleName[ MAX_PATH ];
- GetModuleFileNameA( p->hOwner, szModuleName, sizeof(szModuleName));
- Netlib_Logf( NULL, "Thread %p was abnormally terminated because module '%s' didn't release it. Entry point: %p",
- p->hThread, szModuleName, p->addr );
- TerminateThread( p->hThread, 9999 );
+ GetModuleFileNameA(p->hOwner, szModuleName, sizeof(szModuleName));
+ Netlib_Logf(NULL, "Thread %p was abnormally terminated because module '%s' didn't release it. Entry point: %p",
+ p->hThread, szModuleName, p->addr);
+ TerminateThread(p->hThread, 9999);
CloseHandle(p->hThread);
- mir_free( p );
+ mir_free(p);
}
threads.destroy();
- ReleaseMutex( hStackMutex );
- SetEvent( hThreadQueueEmpty );
+ ReleaseMutex(hStackMutex);
+ SetEvent(hThreadQueueEmpty);
}
}
-void KillObjectThreads( void* owner )
+void KillObjectThreads(void* owner)
{
- if ( owner == NULL )
+ if (owner == NULL)
return;
- WaitForSingleObject( hStackMutex, INFINITE );
+ WaitForSingleObject(hStackMutex, INFINITE);
- HANDLE* threadPool = ( HANDLE* )alloca( threads.getCount()*sizeof( HANDLE ));
+ HANDLE* threadPool = (HANDLE*)alloca(threads.getCount()*sizeof(HANDLE));
int threadCount = 0;
- for ( int j = threads.getCount(); j--; ) {
+ for (int j = threads.getCount(); j--;) {
THREAD_WAIT_ENTRY* p = threads[j];
- if ( p->pObject == owner )
+ if (p->pObject == owner)
threadPool[ threadCount++ ] = p->hThread;
}
ReleaseMutex(hStackMutex);
// is there anything to kill?
- if ( threadCount > 0 ) {
- if ( WaitForMultipleObjects( threadCount, threadPool, TRUE, 5000 ) == WAIT_TIMEOUT ) {
+ if (threadCount > 0) {
+ if ( WaitForMultipleObjects(threadCount, threadPool, TRUE, 5000) == WAIT_TIMEOUT) {
// forcibly kill all remaining threads after 5 secs
- WaitForSingleObject( hStackMutex, INFINITE );
- for ( int j = threads.getCount()-1; j >= 0; j-- ) {
+ WaitForSingleObject(hStackMutex, INFINITE);
+ for (int j = threads.getCount()-1; j >= 0; j--) {
THREAD_WAIT_ENTRY* p = threads[j];
- if ( p->pObject == owner ) {
- TerminateThread( p->hThread, 9999 );
- CloseHandle( p->hThread );
- threads.remove( j );
- mir_free( p );
+ if (p->pObject == owner) {
+ TerminateThread(p->hThread, 9999);
+ CloseHandle(p->hThread);
+ threads.remove(j);
+ mir_free(p);
}
}
ReleaseMutex(hStackMutex);
@@ -340,15 +340,15 @@ void KillObjectThreads( void* owner ) static void UnwindThreadWait(void)
{
// acquire the list and wake up any alertable threads
- if ( MirandaWaitForMutex(hStackMutex) ) {
+ if ( MirandaWaitForMutex(hStackMutex)) {
int j;
- for ( j=0; j < threads.getCount(); j++ )
+ for (j=0; j < threads.getCount(); j++)
QueueUserAPC(DummyAPCFunc, threads[j]->hThread, 0);
ReleaseMutex(hStackMutex);
}
// give all unclosed threads 5 seconds to close
- SetTimer( NULL, 0, 5000, KillAllThreads );
+ SetTimer(NULL, 0, 5000, KillAllThreads);
// wait til the thread list is empty
MirandaWaitForMutex(hThreadQueueEmpty);
@@ -365,11 +365,11 @@ void* GetCurrentThreadEntryPoint() HANDLE hDupHandle, hCurrentProcess;
DWORD_PTR dwStartAddress;
- pNtQIT NtQueryInformationThread = (pNtQIT)GetProcAddress(GetModuleHandle(_T("ntdll.dll")), "NtQueryInformationThread" );
+ pNtQIT NtQueryInformationThread = (pNtQIT)GetProcAddress(GetModuleHandle(_T("ntdll.dll")), "NtQueryInformationThread");
if (NtQueryInformationThread == NULL) return 0;
hCurrentProcess = GetCurrentProcess();
- if (!DuplicateHandle(hCurrentProcess, GetCurrentThread(), hCurrentProcess, &hDupHandle, THREAD_QUERY_INFORMATION, FALSE, 0)) {
+ if ( !DuplicateHandle(hCurrentProcess, GetCurrentThread(), hCurrentProcess, &hDupHandle, THREAD_QUERY_INFORMATION, FALSE, 0)) {
SetLastError(ERROR_ACCESS_DENIED);
return NULL;
}
@@ -377,14 +377,13 @@ void* GetCurrentThreadEntryPoint() CloseHandle(hDupHandle);
if (ntStatus != ERROR_SUCCESS) return 0;
- return ( void* )dwStartAddress;
+ return (void*)dwStartAddress;
}
INT_PTR UnwindThreadPush(WPARAM wParam, LPARAM lParam)
{
ResetEvent(hThreadQueueEmpty); // thread list is not empty
- if (WaitForSingleObject(hStackMutex, INFINITE) == WAIT_OBJECT_0)
- {
+ if ( WaitForSingleObject(hStackMutex, INFINITE) == WAIT_OBJECT_0) {
THREAD_WAIT_ENTRY* p = (THREAD_WAIT_ENTRY*)mir_calloc(sizeof(THREAD_WAIT_ENTRY));
DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &p->hThread, 0, FALSE, DUPLICATE_SAME_ACCESS);
@@ -394,7 +393,7 @@ INT_PTR UnwindThreadPush(WPARAM wParam, LPARAM lParam) p->addr = (void*)lParam;
threads.insert(p);
- //Netlib_Logf( NULL, "*** pushing thread %x[%x] (%d)", hThread, GetCurrentThreadId(), threads.count );
+ //Netlib_Logf(NULL, "*** pushing thread %x[%x] (%d)", hThread, GetCurrentThreadId(), threads.count);
ReleaseMutex(hStackMutex);
} //if
return 0;
@@ -402,22 +401,21 @@ INT_PTR UnwindThreadPush(WPARAM wParam, LPARAM lParam) INT_PTR UnwindThreadPop(WPARAM, LPARAM)
{
- if (WaitForSingleObject(hStackMutex, INFINITE) == WAIT_OBJECT_0)
- {
+ if ( WaitForSingleObject(hStackMutex, INFINITE) == WAIT_OBJECT_0) {
DWORD dwThreadId=GetCurrentThreadId();
int j;
- //Netlib_Logf( NULL, "*** popping thread %x, %d threads left", dwThreadId, threads.count);
- for ( j=0; j < threads.getCount(); j++ ) {
+ //Netlib_Logf(NULL, "*** popping thread %x, %d threads left", dwThreadId, threads.count);
+ for (j=0; j < threads.getCount(); j++) {
THREAD_WAIT_ENTRY* p = threads[j];
- if ( p->dwThreadId == dwThreadId ) {
- SetThreadPriority( GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL );
- CloseHandle( p->hThread );
- threads.remove( j );
- mir_free( p );
+ if (p->dwThreadId == dwThreadId) {
+ SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
+ CloseHandle(p->hThread);
+ threads.remove(j);
+ mir_free(p);
if ( !threads.getCount()) {
threads.destroy();
- ReleaseMutex( hStackMutex );
+ ReleaseMutex(hStackMutex);
SetEvent(hThreadQueueEmpty); // thread list is empty now
return 0;
}
@@ -438,7 +436,7 @@ INT_PTR MirandaIsTerminated(WPARAM, LPARAM) static void __cdecl compactHeapsThread(void*)
{
- while (!Miranda_Terminated())
+ while ( !Miranda_Terminated())
{
HANDLE hHeaps[256];
DWORD hc;
@@ -483,7 +481,7 @@ void checkIdle(MSG * msg) static INT_PTR SystemGetIdle(WPARAM, LPARAM lParam)
{
- if ( lParam ) *(DWORD*)lParam = dwEventTime;
+ if (lParam) *(DWORD*)lParam = dwEventTime;
return 0;
}
@@ -491,10 +489,10 @@ static DWORD MsgWaitForMultipleObjectsExWorkaround(DWORD nCount, const HANDLE *p DWORD dwMsecs, DWORD dwWakeMask, DWORD dwFlags)
{
DWORD rc;
- if ( msgWaitForMultipleObjectsEx != NULL )
+ if (msgWaitForMultipleObjectsEx != NULL)
return msgWaitForMultipleObjectsEx(nCount, pHandles, dwMsecs, dwWakeMask, dwFlags);
rc=MsgWaitForMultipleObjects(nCount, pHandles, FALSE, 50, QS_ALLINPUT);
- if ( rc == WAIT_TIMEOUT ) rc=WaitForMultipleObjectsEx(nCount, pHandles, FALSE, 20, TRUE);
+ if (rc == WAIT_TIMEOUT) rc=WaitForMultipleObjectsEx(nCount, pHandles, FALSE, 20, TRUE);
return rc;
}
@@ -512,7 +510,7 @@ static INT_PTR CALLBACK WaitForProcessDlgProc(HWND hwnd, UINT msg, WPARAM wParam switch (msg)
{
case WM_INITDIALOG:
- TranslateDialogDefault( hwnd );
+ TranslateDialogDefault(hwnd);
SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
SendDlgItemMessage(hwnd, IDC_PROGRESSBAR, PBM_SETRANGE, 0, MAKELPARAM(0, MIRANDA_PROCESS_WAIT_STEPS));
SendDlgItemMessage(hwnd, IDC_PROGRESSBAR, PBM_SETSTEP, 1, 0);
@@ -520,9 +518,9 @@ static INT_PTR CALLBACK WaitForProcessDlgProc(HWND hwnd, UINT msg, WPARAM wParam break;
case WM_TIMER:
- if (SendDlgItemMessage(hwnd, IDC_PROGRESSBAR, PBM_STEPIT, 0, 0) == MIRANDA_PROCESS_WAIT_STEPS)
+ if ( SendDlgItemMessage(hwnd, IDC_PROGRESSBAR, PBM_STEPIT, 0, 0) == MIRANDA_PROCESS_WAIT_STEPS)
EndDialog(hwnd, 0);
- if (WaitForSingleObject((HANDLE)GetWindowLongPtr(hwnd, GWLP_USERDATA), 1) != WAIT_TIMEOUT)
+ if ( WaitForSingleObject((HANDLE)GetWindowLongPtr(hwnd, GWLP_USERDATA), 1) != WAIT_TIMEOUT)
{
SendDlgItemMessage(hwnd, IDC_PROGRESSBAR, PBM_SETPOS, MIRANDA_PROCESS_WAIT_STEPS, 0);
EndDialog(hwnd, 0);
@@ -530,7 +528,7 @@ static INT_PTR CALLBACK WaitForProcessDlgProc(HWND hwnd, UINT msg, WPARAM wParam break;
case WM_COMMAND:
- if (HIWORD(wParam) == IDCANCEL)
+ if ( HIWORD(wParam) == IDCANCEL)
{
SendDlgItemMessage(hwnd, IDC_PROGRESSBAR, PBM_SETPOS, MIRANDA_PROCESS_WAIT_STEPS, 0);
EndDialog(hwnd, 0);
@@ -543,17 +541,17 @@ static INT_PTR CALLBACK WaitForProcessDlgProc(HWND hwnd, UINT msg, WPARAM wParam void ParseCommandLine()
{
char* cmdline = GetCommandLineA();
- char* p = strstr( cmdline, "/restart:" );
- if ( p ) {
- HANDLE hProcess = OpenProcess( SYNCHRONIZE, FALSE, atol( p+9 ));
- if ( hProcess ) {
+ char* p = strstr(cmdline, "/restart:");
+ if (p) {
+ HANDLE hProcess = OpenProcess(SYNCHRONIZE, FALSE, atol(p+9));
+ if (hProcess) {
DialogBoxParam(hMirandaInst, MAKEINTRESOURCE(IDD_WAITRESTART), NULL, WaitForProcessDlgProc, (LPARAM)hProcess);
- CloseHandle( hProcess );
+ CloseHandle(hProcess);
}
}
}
-int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int )
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
{
DWORD myPid=0;
int messageloop=1;
@@ -565,7 +563,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int ) setlocale(LC_ALL, "");
#ifdef _DEBUG
- _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
+ _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif
hUser32 = GetModuleHandleA("user32");
@@ -583,8 +581,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int ) hShFolder = GetModuleHandleA("shell32");
shGetSpecialFolderPathA = (pfnSHGetSpecialFolderPathA)GetProcAddress(hShFolder, "SHGetSpecialFolderPathA");
shGetSpecialFolderPathW = (pfnSHGetSpecialFolderPathW)GetProcAddress(hShFolder, "SHGetSpecialFolderPathW");
- if (shGetSpecialFolderPathA == NULL)
- {
+ if (shGetSpecialFolderPathA == NULL) {
hShFolder = LoadLibraryA("ShFolder.dll");
shGetSpecialFolderPathA = (pfnSHGetSpecialFolderPathA)GetProcAddress(hShFolder, "SHGetSpecialFolderPathA");
shGetSpecialFolderPathW = (pfnSHGetSpecialFolderPathW)GetProcAddress(hShFolder, "SHGetSpecialFolderPathW");
@@ -592,7 +589,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int ) shAutoComplete = (pfnSHAutoComplete)GetProcAddress(GetModuleHandleA("shlwapi"), "SHAutoComplete");
- if (IsWinVerXPPlus()) {
+ if ( IsWinVerXPPlus()) {
hThemeAPI = LoadLibraryA("uxtheme.dll");
if (hThemeAPI) {
openThemeData = (pfnOpenThemeData)GetProcAddress(hThemeAPI, "OpenThemeData");
@@ -616,7 +613,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int ) }
}
- if (IsWinVerVistaPlus()) {
+ if ( IsWinVerVistaPlus()) {
hDwmApi = LoadLibraryA("dwmapi.dll");
if (hDwmApi) {
dwmExtendFrameIntoClientArea = (pfnDwmExtendFrameIntoClientArea)GetProcAddress(hDwmApi, "DwmExtendFrameIntoClientArea");
@@ -630,17 +627,18 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int ) MyWSAStringToAddress = (LPFN_WSASTRINGTOADDRESSA)GetProcAddress(hWinSock, "WSAStringToAddressA");
MyWSAAddressToString = (LPFN_WSAADDRESSTOSTRINGA)GetProcAddress(hWinSock, "WSAAddressToStringA");
- if (bufferedPaintInit) bufferedPaintInit();
+ if (bufferedPaintInit)
+ bufferedPaintInit();
OleInitialize(NULL);
- if (IsWinVer7Plus())
+ if ( IsWinVer7Plus())
CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_ALL, IID_ITaskbarList3, (void**)&pTaskbarInterface);
InitialiseModularEngine();
// ParseCommandLine();
- if (LoadDefaultModules()) {
+ if ( LoadDefaultModules()) {
NotifyEventHooks(hShutdownEvent, 0, 0);
UnloadDefaultModules();
@@ -662,27 +660,26 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int ) DWORD rc;
BOOL dying=FALSE;
rc=MsgWaitForMultipleObjectsExWorkaround(waitObjectCount, hWaitObjects, INFINITE, QS_ALLINPUT, MWMO_ALERTABLE);
- if ( rc >= WAIT_OBJECT_0 && rc < WAIT_OBJECT_0 + waitObjectCount) {
+ if (rc >= WAIT_OBJECT_0 && rc < WAIT_OBJECT_0 + waitObjectCount) {
rc -= WAIT_OBJECT_0;
CallService(pszWaitServices[rc], (WPARAM) hWaitObjects[rc], 0);
}
//
- while ( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) ) {
- if ( msg.message != WM_QUIT ) {
+ while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
+ if (msg.message != WM_QUIT) {
HWND h=GetForegroundWindow();
DWORD pid = 0;
checkIdle(&msg);
- if ( h != NULL && GetWindowThreadProcessId(h, &pid) && pid == myPid &&
- GetClassLongPtr(h, GCW_ATOM) == 32770 )
- {
- if ( IsDialogMessage(h, &msg) )
+ if (h != NULL && GetWindowThreadProcessId(h, &pid) && pid == myPid && GetClassLongPtr(h, GCW_ATOM) == 32770)
+ if (IsDialogMessage(h, &msg))
continue;
- }
+
TranslateMessage(&msg);
DispatchMessage(&msg);
- if ( SetIdleCallback != NULL )
+ if (SetIdleCallback != NULL)
SetIdleCallback();
- } else if ( !dying ) {
+ }
+ else if ( !dying) {
dying++;
SetEvent(hMirandaShutdown);
NotifyEventHooks(hPreShutdownEvent, 0, 0);
@@ -692,10 +689,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int ) NotifyEventHooks(hShutdownEvent, 0, 0);
// if the hooks generated any messages, it'll get processed before the second WM_QUIT
PostQuitMessage(0);
- } else if ( dying ) {
- messageloop=0;
}
- } // while
+ else if (dying)
+ messageloop=0;
+ }
}
exit:
@@ -761,10 +758,10 @@ static INT_PTR GetMirandaVersionText(WPARAM wParam, LPARAM lParam) pVerInfo=mir_alloc(verInfoSize);
GetFileVersionInfo(filename, 0, verInfoSize, pVerInfo);
VerQueryValue(pVerInfo, _T("\\StringFileInfo\\000004b0\\ProductVersion"), (LPVOID*)&productVersion, &blockSize);
- #if defined( _WIN64 )
- mir_snprintf(( char* )lParam, wParam, "%S x64 Unicode", productVersion );
+ #if defined(_WIN64)
+ mir_snprintf((char*)lParam, wParam, "%S x64 Unicode", productVersion);
#else
- mir_snprintf(( char* )lParam, wParam, "%S Unicode", productVersion );
+ mir_snprintf((char*)lParam, wParam, "%S Unicode", productVersion);
#endif
mir_free(pVerInfo);
return 0;
@@ -772,9 +769,11 @@ static INT_PTR GetMirandaVersionText(WPARAM wParam, LPARAM lParam) INT_PTR WaitOnHandle(WPARAM wParam, LPARAM lParam)
{
- if (waitObjectCount>=MAXIMUM_WAIT_OBJECTS-1) return 1;
- hWaitObjects[waitObjectCount]=(HANDLE)wParam;
- pszWaitServices[waitObjectCount]=(char*)lParam;
+ if (waitObjectCount>=MAXIMUM_WAIT_OBJECTS-1)
+ return 1;
+
+ hWaitObjects[waitObjectCount] = (HANDLE)wParam;
+ pszWaitServices[waitObjectCount] = (char*)lParam;
waitObjectCount++;
return 0;
}
@@ -786,7 +785,10 @@ static INT_PTR RemoveWait(WPARAM wParam, LPARAM) for (i=0;i<waitObjectCount;i++)
if (hWaitObjects[i] == (HANDLE)wParam)
break;
- if (i == waitObjectCount) return 1;
+
+ if (i == waitObjectCount)
+ return 1;
+
waitObjectCount--;
MoveMemory(&hWaitObjects[i], &hWaitObjects[i+1], sizeof(HANDLE)*(waitObjectCount-i));
MoveMemory(&pszWaitServices[i], &pszWaitServices[i+1], sizeof(char*)*(waitObjectCount-i));
@@ -796,14 +798,14 @@ static INT_PTR RemoveWait(WPARAM wParam, LPARAM) INT_PTR GetMemoryManagerInterface(WPARAM, LPARAM lParam)
{
struct MM_INTERFACE *mmi = (struct MM_INTERFACE*) lParam;
- if ( mmi == NULL )
+ if (mmi == NULL)
return 1;
mmi->mmi_malloc = mir_alloc;
mmi->mmi_realloc = mir_realloc;
mmi->mmi_free = mir_free;
- switch( mmi->cbSize ) {
+ switch(mmi->cbSize) {
case sizeof(struct MM_INTERFACE):
mmi->mir_snprintf = mir_snprintf;
mmi->mir_sntprintf = mir_sntprintf;
@@ -825,7 +827,7 @@ INT_PTR GetMemoryManagerInterface(WPARAM, LPARAM lParam) break;
default:
-#if defined( _DEBUG )
+#if defined(_DEBUG)
DebugBreak();
#endif
return 1;
@@ -837,7 +839,7 @@ INT_PTR GetMemoryManagerInterface(WPARAM, LPARAM lParam) INT_PTR GetListInterface(WPARAM, LPARAM lParam)
{
struct LIST_INTERFACE *li = (struct LIST_INTERFACE*) lParam;
- if ( li == NULL )
+ if (li == NULL)
return 1;
switch(li->cbSize) {
@@ -865,13 +867,13 @@ INT_PTR GetListInterface(WPARAM, LPARAM lParam) INT_PTR GetUtfInterface(WPARAM, LPARAM lParam)
{
struct UTF8_INTERFACE *utfi = (struct UTF8_INTERFACE*) lParam;
- if ( utfi == NULL )
+ if (utfi == NULL)
return 1;
- switch( utfi->cbSize ) {
+ switch(utfi->cbSize) {
case UTF8_INTERFACE_SIZEOF_V1:
case UTF8_INTERFACE_SIZEOF_V2:
- case sizeof( struct UTF8_INTERFACE ):
+ case sizeof(struct UTF8_INTERFACE):
break;
default:
@@ -898,7 +900,7 @@ int LoadSystemModule(void) icce.dwICC = ICC_WIN95_CLASSES | ICC_USEREX_CLASSES;
InitCommonControlsEx(&icce);
- if (IsWinVerXPPlus()) {
+ if ( IsWinVerXPPlus()) {
hAPCWindow=CreateWindowEx(0, _T("ComboLBox"), NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
SetClassLongPtr(hAPCWindow, GCL_STYLE, GetClassLongPtr(hAPCWindow, GCL_STYLE) | CS_DROPSHADOW);
DestroyWindow(hAPCWindow);
diff --git a/src/core/miranda.h b/src/core/miranda.h index 3488c4ddd7..8f747ee86b 100644 --- a/src/core/miranda.h +++ b/src/core/miranda.h @@ -21,6 +21,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#define OPTIONPAGE_OLD_SIZE offsetof(OPTIONSDIALOGPAGE,hLangpack)
+
#define NEWSTR_ALLOCA(A) (A == NULL)?NULL:strcpy((char*)alloca(strlen(A)+1), A)
#define NEWTSTR_ALLOCA(A) (A == NULL)?NULL:_tcscpy((TCHAR*)alloca((_tcslen(A)+1)* sizeof(TCHAR)), A)
@@ -39,8 +41,8 @@ extern pfnMyGetMonitorInfo MyGetMonitorInfo; typedef HRESULT (STDAPICALLTYPE *pfnSHAutoComplete)(HWND, DWORD);
extern pfnSHAutoComplete shAutoComplete;
-typedef HRESULT (STDAPICALLTYPE *pfnSHGetSpecialFolderPathA)(HWND, LPSTR, int, BOOL );
-typedef HRESULT (STDAPICALLTYPE *pfnSHGetSpecialFolderPathW)(HWND, LPWSTR, int, BOOL );
+typedef HRESULT (STDAPICALLTYPE *pfnSHGetSpecialFolderPathA)(HWND, LPSTR, int, BOOL);
+typedef HRESULT (STDAPICALLTYPE *pfnSHGetSpecialFolderPathW)(HWND, LPWSTR, int, BOOL);
extern pfnSHGetSpecialFolderPathA shGetSpecialFolderPathA;
extern pfnSHGetSpecialFolderPathW shGetSpecialFolderPathW;
@@ -58,19 +60,19 @@ extern pfnAnimateWindow animateWindow; typedef BOOL (WINAPI * pfnSetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD);
extern pfnSetLayeredWindowAttributes setLayeredWindowAttributes;
-typedef HTHEME ( STDAPICALLTYPE *pfnOpenThemeData )( HWND, LPCWSTR );
-typedef HRESULT ( STDAPICALLTYPE *pfnIsThemeBackgroundPartiallyTransparent )( HTHEME, int, int );
-typedef HRESULT ( STDAPICALLTYPE *pfnDrawThemeParentBackground )( HWND, HDC, const RECT * );
-typedef HRESULT ( STDAPICALLTYPE *pfnDrawThemeBackground )( HTHEME, HDC, int, int, const RECT *, const RECT * );
-typedef HRESULT ( STDAPICALLTYPE *pfnDrawThemeText)( HTHEME, HDC, int, int, LPCWSTR, int, DWORD, DWORD, const RECT *);
-typedef HRESULT ( STDAPICALLTYPE *pfnDrawThemeTextEx)( HTHEME, HDC, int, int, LPCWSTR, int, DWORD, LPRECT, const struct _DTTOPTS * );
-typedef HRESULT ( STDAPICALLTYPE *pfnGetThemeBackgroundContentRect)( HTHEME, HDC, int, int, LPCRECT, LPRECT );
-typedef HRESULT ( STDAPICALLTYPE *pfnGetThemeFont)( HTHEME, HDC, int, int, int, LOGFONT * );
-typedef HRESULT ( STDAPICALLTYPE *pfnCloseThemeData )( HTHEME );
-typedef HRESULT ( STDAPICALLTYPE *pfnEnableThemeDialogTexture )( HWND hwnd, DWORD dwFlags );
-typedef HRESULT ( STDAPICALLTYPE *pfnSetWindowTheme )( HWND, LPCWSTR, LPCWSTR );
-typedef HRESULT ( STDAPICALLTYPE *pfnSetWindowThemeAttribute )( HWND, enum WINDOWTHEMEATTRIBUTETYPE, PVOID, DWORD );
-typedef BOOL ( STDAPICALLTYPE *pfnIsThemeActive )();
+typedef HTHEME (STDAPICALLTYPE *pfnOpenThemeData)(HWND, LPCWSTR);
+typedef HRESULT (STDAPICALLTYPE *pfnIsThemeBackgroundPartiallyTransparent)(HTHEME, int, int);
+typedef HRESULT (STDAPICALLTYPE *pfnDrawThemeParentBackground)(HWND, HDC, const RECT *);
+typedef HRESULT (STDAPICALLTYPE *pfnDrawThemeBackground)(HTHEME, HDC, int, int, const RECT *, const RECT *);
+typedef HRESULT (STDAPICALLTYPE *pfnDrawThemeText)(HTHEME, HDC, int, int, LPCWSTR, int, DWORD, DWORD, const RECT *);
+typedef HRESULT (STDAPICALLTYPE *pfnDrawThemeTextEx)(HTHEME, HDC, int, int, LPCWSTR, int, DWORD, LPRECT, const struct _DTTOPTS *);
+typedef HRESULT (STDAPICALLTYPE *pfnGetThemeBackgroundContentRect)(HTHEME, HDC, int, int, LPCRECT, LPRECT);
+typedef HRESULT (STDAPICALLTYPE *pfnGetThemeFont)(HTHEME, HDC, int, int, int, LOGFONT *);
+typedef HRESULT (STDAPICALLTYPE *pfnCloseThemeData)(HTHEME);
+typedef HRESULT (STDAPICALLTYPE *pfnEnableThemeDialogTexture)(HWND hwnd, DWORD dwFlags);
+typedef HRESULT (STDAPICALLTYPE *pfnSetWindowTheme)(HWND, LPCWSTR, LPCWSTR);
+typedef HRESULT (STDAPICALLTYPE *pfnSetWindowThemeAttribute)(HWND, enum WINDOWTHEMEATTRIBUTETYPE, PVOID, DWORD);
+typedef BOOL (STDAPICALLTYPE *pfnIsThemeActive)();
typedef HRESULT (STDAPICALLTYPE *pfnBufferedPaintInit)(void);
typedef HRESULT (STDAPICALLTYPE *pfnBufferedPaintUninit)(void);
typedef HANDLE (STDAPICALLTYPE *pfnBeginBufferedPaint)(HDC, RECT *, BP_BUFFERFORMAT, BP_PAINTPARAMS *, HDC *);
@@ -98,8 +100,8 @@ extern pfnGetBufferedPaintBits getBufferedPaintBits; extern ITaskbarList3 * pTaskbarInterface;
-typedef HRESULT ( STDAPICALLTYPE *pfnDwmExtendFrameIntoClientArea )( HWND hwnd, const MARGINS *margins );
-typedef HRESULT ( STDAPICALLTYPE *pfnDwmIsCompositionEnabled )( BOOL * );
+typedef HRESULT (STDAPICALLTYPE *pfnDwmExtendFrameIntoClientArea)(HWND hwnd, const MARGINS *margins);
+typedef HRESULT (STDAPICALLTYPE *pfnDwmIsCompositionEnabled)(BOOL *);
extern pfnDwmExtendFrameIntoClientArea dwmExtendFrameIntoClientArea;
extern pfnDwmIsCompositionEnabled dwmIsCompositionEnabled;
@@ -111,18 +113,18 @@ extern LPFN_WSAADDRESSTOSTRINGA MyWSAAddressToString; /**** file.c ***************************************************************************/
-void PushFileEvent( HANDLE hContact, HANDLE hdbe, LPARAM lParam );
+void PushFileEvent(HANDLE hContact, HANDLE hdbe, LPARAM lParam);
/**** memory.c *************************************************************************/
#ifdef _STATIC
-void* mir_alloc( size_t );
-void* mir_calloc( size_t );
-void* mir_realloc( void* ptr, size_t );
-void mir_free( void* ptr );
-char* mir_strdup( const char* str );
-WCHAR* mir_wstrdup( const WCHAR* str );
-char* mir_strndup( const char* str, size_t len );
+void* mir_alloc(size_t);
+void* mir_calloc(size_t);
+void* mir_realloc(void* ptr, size_t);
+void mir_free(void* ptr);
+char* mir_strdup(const char* str);
+WCHAR* mir_wstrdup(const WCHAR* str);
+char* mir_strndup(const char* str, size_t len);
int mir_snprintf(char *buffer, size_t count, const char* fmt, ...);
int mir_sntprintf(TCHAR *buffer, size_t count, const TCHAR* fmt, ...);
@@ -132,7 +134,7 @@ int mir_vsntprintf(TCHAR *buffer, size_t count, const TCHAR* fmt, va_list va) WCHAR* mir_a2u_cp(const char* src, int codepage);
WCHAR* mir_a2u(const char* src);
char* mir_u2a_cp(const wchar_t* src, int codepage);
-char* mir_u2a( const wchar_t* src);
+char* mir_u2a(const wchar_t* src);
#endif
/**** miranda.c ************************************************************************/
@@ -144,19 +146,19 @@ extern pfnExceptionFilter pMirandaExceptFilter; /**** modules.c ************************************************************************/
int CallPluginEventHook(HINSTANCE hInst, HANDLE hEvent, WPARAM wParam, LPARAM lParam);
-void KillModuleEventHooks( HINSTANCE );
-void KillModuleServices( HINSTANCE );
+void KillModuleEventHooks(HINSTANCE);
+void KillModuleServices(HINSTANCE);
-void KillObjectEventHooks( void* pObject );
-void KillObjectServices( void* pObject );
-void KillObjectThreads( void* pObject );
+void KillObjectEventHooks(void* pObject);
+void KillObjectServices(void* pObject);
+void KillObjectThreads(void* pObject);
/**** utf.c ****************************************************************************/
-char* Utf8Decode( char* str, wchar_t** ucs2 );
-char* Utf8DecodeCP( char* str, int codepage, wchar_t** ucs2 );
+char* Utf8Decode(char* str, wchar_t** ucs2);
+char* Utf8DecodeCP(char* str, int codepage, wchar_t** ucs2);
-wchar_t* Utf8DecodeUcs2( const char* str );
+wchar_t* Utf8DecodeUcs2(const char* str);
__forceinline char* Utf8DecodeA(const char* src)
{
@@ -166,10 +168,10 @@ __forceinline char* Utf8DecodeA(const char* src) }
-char* Utf8Encode( const char* str );
-char* Utf8EncodeCP( const char* src, int codepage );
+char* Utf8Encode(const char* str);
+char* Utf8EncodeCP(const char* src, int codepage);
-char* Utf8EncodeUcs2( const wchar_t* str );
+char* Utf8EncodeUcs2(const wchar_t* str);
int Ucs2toUtf8Len(const wchar_t *src);
@@ -180,13 +182,13 @@ int Ucs2toUtf8Len(const wchar_t *src); int LangPackGetDefaultCodePage();
int LangPackGetDefaultLocale();
-TCHAR* LangPackPcharToTchar( const char* pszStr );
+TCHAR* LangPackPcharToTchar(const char* pszStr);
char* LangPackTranslateString(struct LangPackMuuid* pUuid, const char *szEnglish, const int W);
TCHAR* LangPackTranslateStringT(int hLangpack, const TCHAR* tszEnglish);
unsigned int __fastcall hash(const void * key, unsigned int len);
-#pragma optimize( "gt", on )
+#pragma optimize("gt", on)
__inline unsigned int hashstr(const char * key)
{
if (key == NULL) return 0;
@@ -200,14 +202,14 @@ __inline unsigned int hashstr(const wchar_t * key) const unsigned int len = (unsigned int)wcslen((const wchar_t*)key);
return hash(key, len * sizeof(wchar_t));
}
-#pragma optimize( "", on )
+#pragma optimize("", on)
/**** path.c ***************************************************************************/
int pathToAbsolute(const char *pSrc, char *pOut, char* base);
-void CreatePathToFile( char* wszFilePath );
+void CreatePathToFile(char* wszFilePath);
int CreateDirectoryTree(const char *szDir);
-void CreatePathToFileW( WCHAR* wszFilePath );
+void CreatePathToFileW(WCHAR* wszFilePath);
int CreateDirectoryTreeW(const WCHAR *szDir);
int pathToAbsoluteW(const TCHAR *pSrc, TCHAR *pOut, TCHAR* base);
#define pathToAbsoluteT pathToAbsoluteW
@@ -216,17 +218,17 @@ int pathToAbsoluteW(const TCHAR *pSrc, TCHAR *pOut, TCHAR* base); /**** skin2icons.c *********************************************************************/
-HANDLE IcoLib_AddNewIcon( SKINICONDESC* sid );
-HICON IcoLib_GetIcon( const char* pszIconName, bool big );
-HICON IcoLib_GetIconByHandle( HANDLE hItem, bool big );
-HANDLE IcoLib_IsManaged( HICON hIcon );
-int IcoLib_ReleaseIcon( HICON hIcon, char* szIconName, bool big );
+HANDLE IcoLib_AddNewIcon(SKINICONDESC* sid);
+HICON IcoLib_GetIcon(const char* pszIconName, bool big);
+HICON IcoLib_GetIconByHandle(HANDLE hItem, bool big);
+HANDLE IcoLib_IsManaged(HICON hIcon);
+int IcoLib_ReleaseIcon(HICON hIcon, char* szIconName, bool big);
/**** skinicons.c **********************************************************************/
-HICON LoadSkinProtoIcon( const char* szProto, int status, bool big = false );
-HICON LoadSkinIcon( int idx, bool big = false );
-HANDLE GetSkinIconHandle( int idx );
+HICON LoadSkinProtoIcon(const char* szProto, int status, bool big = false);
+HICON LoadSkinIcon(int idx, bool big = false);
+HANDLE GetSkinIconHandle(int idx);
HICON LoadIconEx(HINSTANCE hInstance, LPCTSTR lpIconName, BOOL bShared);
int ImageList_AddIcon_NotShared(HIMAGELIST hIml, LPCTSTR szResource);
@@ -255,7 +257,7 @@ extern const int statusModeList[ MAX_STATUS_COUNT ]; extern const int skinIconStatusList[ MAX_STATUS_COUNT ];
extern const int skinIconStatusFlags[ MAX_STATUS_COUNT ];
-int TryProcessDoubleClick( HANDLE hContact );
+int TryProcessDoubleClick(HANDLE hContact);
/**** protocols.c ***********************************************************************/
@@ -266,31 +268,31 @@ int TryProcessDoubleClick( HANDLE hContact ); extern LIST<PROTOACCOUNT> accounts;
-PROTOACCOUNT* __fastcall Proto_GetAccount( const char* accName );
-PROTOACCOUNT* __fastcall Proto_GetAccount( HANDLE hContact );
-PROTOCOLDESCRIPTOR* __fastcall Proto_IsProtocolLoaded( const char* szProtoName );
+PROTOACCOUNT* __fastcall Proto_GetAccount(const char* accName);
+PROTOACCOUNT* __fastcall Proto_GetAccount(HANDLE hContact);
+PROTOCOLDESCRIPTOR* __fastcall Proto_IsProtocolLoaded(const char* szProtoName);
-bool __fastcall Proto_IsAccountEnabled( PROTOACCOUNT* pa );
-bool __fastcall Proto_IsAccountLocked( PROTOACCOUNT* pa );
+bool __fastcall Proto_IsAccountEnabled(PROTOACCOUNT* pa);
+bool __fastcall Proto_IsAccountLocked(PROTOACCOUNT* pa);
-PROTO_INTERFACE* AddDefaultAccount( const char* szProtoName );
-int FreeDefaultAccount( PROTO_INTERFACE* ppi );
+PROTO_INTERFACE* AddDefaultAccount(const char* szProtoName);
+int FreeDefaultAccount(PROTO_INTERFACE* ppi);
-BOOL ActivateAccount( PROTOACCOUNT* pa );
-void EraseAccount( const char* pszProtoName );
-void DeactivateAccount( PROTOACCOUNT* pa, bool bIsDynamic, bool bErase );
-void UnloadAccount( PROTOACCOUNT* pa, bool bIsDynamic, bool bErase );
-void OpenAccountOptions( PROTOACCOUNT* pa );
+BOOL ActivateAccount(PROTOACCOUNT* pa);
+void EraseAccount(const char* pszProtoName);
+void DeactivateAccount(PROTOACCOUNT* pa, bool bIsDynamic, bool bErase);
+void UnloadAccount(PROTOACCOUNT* pa, bool bIsDynamic, bool bErase);
+void OpenAccountOptions(PROTOACCOUNT* pa);
-void LoadDbAccounts( void );
-void WriteDbAccounts( void );
+void LoadDbAccounts(void);
+void WriteDbAccounts(void);
-INT_PTR CallProtoServiceInt( HANDLE hContact, const char* szModule, const char* szService, WPARAM, LPARAM );
-INT_PTR CallContactService( HANDLE hContact, const char *szProtoService, WPARAM, LPARAM );
+INT_PTR CallProtoServiceInt(HANDLE hContact, const char* szModule, const char* szService, WPARAM, LPARAM);
+INT_PTR CallContactService(HANDLE hContact, const char *szProtoService, WPARAM, LPARAM);
-__inline static INT_PTR CallProtoService( const char* szModule, const char* szService, WPARAM wParam, LPARAM lParam )
+__inline static INT_PTR CallProtoService(const char* szModule, const char* szService, WPARAM wParam, LPARAM lParam)
{
- return CallProtoServiceInt( NULL, szModule, szService, wParam, lParam );
+ return CallProtoServiceInt(NULL, szModule, szService, wParam, lParam);
}
/**** utils.c **************************************************************************/
@@ -305,7 +307,7 @@ __inline char* lrtrimp(char* str) { return ltrimp(rtrim(str)); }; bool __fastcall wildcmp(char * name, char * mask);
void HotkeyToName(TCHAR *buf, int size, BYTE shift, BYTE key);
-WORD GetHotkeyValue( INT_PTR idHotkey );
+WORD GetHotkeyValue(INT_PTR idHotkey);
HBITMAP ConvertIconToBitmap(HICON hIcon, HIMAGELIST hIml, int iconId);
@@ -315,10 +317,10 @@ private: wchar_t* m_body;
public:
- StrConvUT( const char* pSrc ) :
- m_body( mir_a2u( pSrc )) {}
+ StrConvUT(const char* pSrc) :
+ m_body(mir_a2u(pSrc)) {}
- ~StrConvUT() { mir_free( m_body ); }
+ ~StrConvUT() { mir_free(m_body); }
operator const wchar_t* () const { return m_body; }
};
@@ -328,18 +330,18 @@ private: char* m_body;
public:
- StrConvAT( const wchar_t* pSrc ) :
- m_body( mir_u2a( pSrc )) {}
+ StrConvAT(const wchar_t* pSrc) :
+ m_body(mir_u2a(pSrc)) {}
- ~StrConvAT() { mir_free( m_body ); }
+ ~StrConvAT() { mir_free(m_body); }
operator const char* () const { return m_body; }
- operator const wchar_t* () const { return ( wchar_t* )m_body; } // type cast to fake the interface definition
- operator const LPARAM () const { return ( LPARAM )m_body; }
+ operator const wchar_t* () const { return (wchar_t*)m_body; } // type cast to fake the interface definition
+ operator const LPARAM () const { return (LPARAM)m_body; }
};
-#define StrConvT( x ) StrConvUT( x )
-#define StrConvTu( x ) x
-#define StrConvA( x ) StrConvAT( x )
-#define StrConvU( x ) x
+#define StrConvT(x) StrConvUT(x)
+#define StrConvTu(x) x
+#define StrConvA(x) StrConvAT(x)
+#define StrConvU(x) x
diff --git a/src/core/modules.cpp b/src/core/modules.cpp index 43ac51ce78..ba846d0fd4 100644 --- a/src/core/modules.cpp +++ b/src/core/modules.cpp @@ -25,12 +25,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // list of hooks
-static int compareHooks( const THook* p1, const THook* p2 )
+static int compareHooks(const THook* p1, const THook* p2)
{
- return strcmp( p1->name, p2->name );
+ return strcmp(p1->name, p2->name);
}
-static LIST<THook> hooks( 50, compareHooks );
+static LIST<THook> hooks(50, compareHooks);
struct THookToMainThreadItem
{
@@ -59,7 +59,7 @@ struct TService char name[1];
};
-LIST<TService> services( 100, NumericKeySortT );
+LIST<TService> services(100, NumericKeySortT);
typedef struct
{
@@ -80,9 +80,9 @@ static HANDLE hMainThread; static HANDLE hMissingService;
static THook *pLastHook = NULL;
-HINSTANCE GetInstByAddress( void* codePtr );
+HINSTANCE GetInstByAddress(void* codePtr);
-void LangPackDropUnusedItems( void );
+void LangPackDropUnusedItems(void);
void ParseCommandLine(); // core: IDD_WAITRESTART
int LoadSystemModule(void); // core: m_system.h services
@@ -152,23 +152,23 @@ int LoadDescButtonModule(); int LoadDefaultModules(void)
{
//load order is very important for these
- if (LoadSystemModule()) return 1;
- if (LoadLangPackModule()) return 1; // langpack will be a system module in the new order so this is moved here
+ if ( LoadSystemModule()) return 1;
+ if ( LoadLangPackModule()) return 1; // langpack will be a system module in the new order so this is moved here
ParseCommandLine(); // IDD_WAITRESTART need langpack so this is moved here
- if (LoadUtilsModule()) return 1; //order not important for this, but no dependencies and no point in pluginising
- if (LoadIcoTabsModule()) return 1;
- if (LoadHeaderbarModule()) return 1;
- if (LoadNewPluginsModuleInfos()) return 1;
+ if ( LoadUtilsModule()) return 1; //order not important for this, but no dependencies and no point in pluginising
+ if ( LoadIcoTabsModule()) return 1;
+ if ( LoadHeaderbarModule()) return 1;
+ if ( LoadNewPluginsModuleInfos()) return 1;
// database is available here
- if (LoadButtonModule()) return 1;
- if (LoadIcoLibModule()) return 1;
- if (LoadSkinIcons()) return 1;
+ if ( LoadButtonModule()) return 1;
+ if ( LoadIcoLibModule()) return 1;
+ if ( LoadSkinIcons()) return 1;
-// if (LoadErrorsModule()) return 1;
+// if ( LoadErrorsModule()) return 1;
bServiceMode = LoadServiceModePlugin();
- switch ( bServiceMode )
+ switch (bServiceMode)
{
case 1: return 0; // stop loading here
case 0: break;
@@ -178,43 +178,43 @@ int LoadDefaultModules(void) //this info will be available at LoadNewPluginsModule()
INT_PTR *disableDefaultModule=(INT_PTR*)CallService(MS_PLUGINS_GETDISABLEDEFAULTARRAY, 0, 0);
- if (LoadSkinSounds()) return 1;
- if (LoadSkinHotkeys()) return 1;
- if (LoadFontserviceModule()) return 1;
+ if ( LoadSkinSounds()) return 1;
+ if ( LoadSkinHotkeys()) return 1;
+ if ( LoadFontserviceModule()) return 1;
- if (LoadDescButtonModule()) return 1;
- if (LoadOptionsModule()) return 1;
- if (LoadNetlibModule()) return 1;
- if (LoadProtocolsModule()) return 1;
+ if ( LoadDescButtonModule()) return 1;
+ if ( LoadOptionsModule()) return 1;
+ if ( LoadNetlibModule()) return 1;
+ if ( LoadProtocolsModule()) return 1;
LoadDbAccounts(); // retrieves the account array from a database
- if (LoadContactsModule()) return 1;
- if (LoadContactListModule()) return 1;
- if (LoadAddContactModule()) return 1;
- if (LoadNewPluginsModule()) return 1; // will call Load() on everything, clist will load first
+ if ( LoadContactsModule()) return 1;
+ if ( LoadContactListModule()) return 1;
+ if ( LoadAddContactModule()) return 1;
+ if ( LoadNewPluginsModule()) return 1; // will call Load() on everything, clist will load first
LangPackDropUnusedItems();
- if (!disableDefaultModule[DEFMOD_SSL]) if (LoadSslModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_SSL]) if (LoadSslModule()) return 1;
NetlibInitSsl();
if (LoadAccountsModule()) return 1;
//order becomes less important below here
- if (!disableDefaultModule[DEFMOD_UIFINDADD]) if (LoadFindAddModule()) return 1;
- if (!disableDefaultModule[DEFMOD_UIUSERINFO]) if (LoadUserInfoModule()) return 1;
- if (!disableDefaultModule[DEFMOD_SRURL]) if (LoadSendRecvUrlModule()) return 1;
- if (!disableDefaultModule[DEFMOD_SREMAIL]) if (LoadSendRecvEMailModule()) return 1;
- if (!disableDefaultModule[DEFMOD_SRAUTH]) if (LoadSendRecvAuthModule()) return 1;
- if (!disableDefaultModule[DEFMOD_SRFILE]) if (LoadSendRecvFileModule()) return 1;
- if (!disableDefaultModule[DEFMOD_UIHELP]) if (LoadHelpModule()) return 1;
- if (!disableDefaultModule[DEFMOD_UIHISTORY]) if (LoadHistoryModule()) return 1;
- if (!disableDefaultModule[DEFMOD_RNDIDLE]) if (LoadIdleModule()) return 1;
- if (!disableDefaultModule[DEFMOD_RNDAUTOAWAY]) if (LoadAutoAwayModule()) return 1;
- if (!disableDefaultModule[DEFMOD_RNDUSERONLINE]) if (LoadUserOnlineModule()) return 1;
- if (!disableDefaultModule[DEFMOD_SRAWAY]) if (LoadAwayMsgModule()) return 1;
- if (!disableDefaultModule[DEFMOD_RNDIGNORE]) if (LoadIgnoreModule()) return 1;
- if (!disableDefaultModule[DEFMOD_UIVISIBILITY]) if (LoadVisibilityModule()) return 1;
- if (!disableDefaultModule[DEFMOD_UPDATENOTIFY]) if (LoadUpdateNotifyModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_UIFINDADD]) if (LoadFindAddModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_UIUSERINFO]) if (LoadUserInfoModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_SRURL]) if (LoadSendRecvUrlModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_SREMAIL]) if (LoadSendRecvEMailModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_SRAUTH]) if (LoadSendRecvAuthModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_SRFILE]) if (LoadSendRecvFileModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_UIHELP]) if (LoadHelpModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_UIHISTORY]) if (LoadHistoryModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_RNDIDLE]) if (LoadIdleModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_RNDAUTOAWAY]) if (LoadAutoAwayModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_RNDUSERONLINE]) if (LoadUserOnlineModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_SRAWAY]) if (LoadAwayMsgModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_RNDIGNORE]) if (LoadIgnoreModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_UIVISIBILITY]) if (LoadVisibilityModule()) return 1;
+ if ( !disableDefaultModule[DEFMOD_UPDATENOTIFY]) if (LoadUpdateNotifyModule()) return 1;
return 0;
}
@@ -255,26 +255,26 @@ void DestroyModularEngine(void) {
int i;
THook* p;
- EnterCriticalSection( &csHooks );
- for ( i=0; i < hooks.getCount(); i++ ) {
+ EnterCriticalSection(&csHooks);
+ for (i=0; i < hooks.getCount(); i++) {
p = hooks[i];
- if ( p->subscriberCount )
- mir_free( p->subscriber );
- DeleteCriticalSection( &p->csHook );
- mir_free( p );
+ if (p->subscriberCount)
+ mir_free(p->subscriber);
+ DeleteCriticalSection(&p->csHook);
+ mir_free(p);
}
hooks.destroy();
- LeaveCriticalSection( &csHooks );
- DeleteCriticalSection( &csHooks );
+ LeaveCriticalSection(&csHooks);
+ DeleteCriticalSection(&csHooks);
- EnterCriticalSection( &csServices );
- for ( i=0; i < services.getCount(); i++ )
- mir_free( services[i] );
+ EnterCriticalSection(&csServices);
+ for (i=0; i < services.getCount(); i++)
+ mir_free(services[i]);
services.destroy();
- LeaveCriticalSection( &csServices );
- DeleteCriticalSection( &csServices );
- CloseHandle( hMainThread );
+ LeaveCriticalSection(&csServices);
+ DeleteCriticalSection(&csServices);
+ CloseHandle(hMainThread);
}
///////////////////////////////HOOKS
@@ -284,61 +284,61 @@ HANDLE CreateHookableEvent(const char *name) THook* ret;
int idx;
- if ( name == NULL )
+ if (name == NULL)
return NULL;
- EnterCriticalSection( &csHooks );
- if (( idx = hooks.getIndex(( THook* )name )) != -1 ) {
- LeaveCriticalSection( &csHooks );
+ EnterCriticalSection(&csHooks);
+ if ((idx = hooks.getIndex((THook*)name)) != -1) {
+ LeaveCriticalSection(&csHooks);
return NULL;
}
- ret = ( THook* )mir_alloc( sizeof( THook ));
- strncpy( ret->name, name, sizeof( ret->name )); ret->name[ MAXMODULELABELLENGTH-1 ] = 0;
+ ret = (THook*)mir_alloc(sizeof(THook));
+ strncpy(ret->name, name, sizeof(ret->name)); ret->name[ MAXMODULELABELLENGTH-1 ] = 0;
ret->id = hookId++;
ret->subscriberCount = 0;
ret->subscriber = NULL;
ret->pfnHook = NULL;
- InitializeCriticalSection( &ret->csHook );
- hooks.insert( ret );
+ InitializeCriticalSection(&ret->csHook);
+ hooks.insert(ret);
- LeaveCriticalSection( &csHooks );
- return ( HANDLE )ret;
+ LeaveCriticalSection(&csHooks);
+ return (HANDLE)ret;
}
-int DestroyHookableEvent( HANDLE hEvent )
+int DestroyHookableEvent(HANDLE hEvent)
{
int idx;
THook* p;
- EnterCriticalSection( &csHooks );
- if ( pLastHook == ( THook* )hEvent )
+ EnterCriticalSection(&csHooks);
+ if (pLastHook == (THook*)hEvent)
pLastHook = NULL;
- if (( idx = hooks.getIndex(( THook* )hEvent )) == -1 ) {
+ if ((idx = hooks.getIndex((THook*)hEvent)) == -1) {
LeaveCriticalSection(&csHooks);
return 1;
}
p = hooks[idx];
- if ( p->subscriberCount ) {
- mir_free( p->subscriber );
+ if (p->subscriberCount) {
+ mir_free(p->subscriber);
p->subscriber = NULL;
p->subscriberCount = 0;
}
- hooks.remove( idx );
- DeleteCriticalSection( &p->csHook );
- mir_free( p );
+ hooks.remove(idx);
+ DeleteCriticalSection(&p->csHook);
+ mir_free(p);
- LeaveCriticalSection( &csHooks );
+ LeaveCriticalSection(&csHooks);
return 0;
}
int SetHookDefaultForHookableEvent(HANDLE hEvent, MIRANDAHOOK pfnHook)
{
- THook* p = ( THook* )hEvent;
+ THook* p = (THook*)hEvent;
EnterCriticalSection(&csHooks);
- if ( hooks.getIndex( p ) != -1 )
+ if (hooks.getIndex(p) != -1)
p->pfnHook = pfnHook;
LeaveCriticalSection(&csHooks);
return 0;
@@ -347,125 +347,125 @@ int SetHookDefaultForHookableEvent(HANDLE hEvent, MIRANDAHOOK pfnHook) int CallPluginEventHook(HINSTANCE hInst, HANDLE hEvent, WPARAM wParam, LPARAM lParam)
{
int returnVal = 0;
- THook* p = ( THook* )hEvent;
- if ( p == NULL )
+ THook* p = (THook*)hEvent;
+ if (p == NULL)
return -1;
- EnterCriticalSection( &p->csHook );
- for ( int i = 0; i < p->subscriberCount; i++ ) {
+ EnterCriticalSection(&p->csHook);
+ for (int i = 0; i < p->subscriberCount; i++) {
THookSubscriber* s = &p->subscriber[i];
- if ( s->hOwner != hInst )
+ if (s->hOwner != hInst)
continue;
- switch ( s->type ) {
- case 1: returnVal = s->pfnHook( wParam, lParam ); break;
- case 2: returnVal = s->pfnHookParam( wParam, lParam, s->lParam ); break;
- case 3: returnVal = s->pfnHookObj( s->object, wParam, lParam ); break;
- case 4: returnVal = s->pfnHookObjParam( s->object, wParam, lParam, s->lParam ); break;
- case 5: returnVal = SendMessage( s->hwnd, s->message, wParam, lParam ); break;
+ switch (s->type) {
+ case 1: returnVal = s->pfnHook(wParam, lParam); break;
+ case 2: returnVal = s->pfnHookParam(wParam, lParam, s->lParam); break;
+ case 3: returnVal = s->pfnHookObj(s->object, wParam, lParam); break;
+ case 4: returnVal = s->pfnHookObjParam(s->object, wParam, lParam, s->lParam); break;
+ case 5: returnVal = SendMessage(s->hwnd, s->message, wParam, lParam); break;
default: continue;
}
- if ( returnVal )
+ if (returnVal)
break;
}
- if ( p->subscriberCount == 0 && p->pfnHook != 0 )
- returnVal = p->pfnHook( wParam, lParam );
+ if (p->subscriberCount == 0 && p->pfnHook != 0)
+ returnVal = p->pfnHook(wParam, lParam);
- LeaveCriticalSection( &p->csHook );
+ LeaveCriticalSection(&p->csHook);
return returnVal;
}
int CallHookSubscribers(HANDLE hEvent, WPARAM wParam, LPARAM lParam)
{
int returnVal = 0;
- THook* p = ( THook* )hEvent;
- if ( p == NULL )
+ THook* p = (THook*)hEvent;
+ if (p == NULL)
return -1;
- EnterCriticalSection( &p->csHook );
+ EnterCriticalSection(&p->csHook);
// NOTE: We've got the critical section while all this lot are called. That's mostly safe, though.
- for ( int i = 0; i < p->subscriberCount; i++ ) {
+ for (int i = 0; i < p->subscriberCount; i++) {
THookSubscriber* s = &p->subscriber[i];
- switch ( s->type ) {
- case 1: returnVal = s->pfnHook( wParam, lParam ); break;
- case 2: returnVal = s->pfnHookParam( wParam, lParam, s->lParam ); break;
- case 3: returnVal = s->pfnHookObj( s->object, wParam, lParam ); break;
- case 4: returnVal = s->pfnHookObjParam( s->object, wParam, lParam, s->lParam ); break;
- case 5: returnVal = SendMessage( s->hwnd, s->message, wParam, lParam ); break;
+ switch (s->type) {
+ case 1: returnVal = s->pfnHook(wParam, lParam); break;
+ case 2: returnVal = s->pfnHookParam(wParam, lParam, s->lParam); break;
+ case 3: returnVal = s->pfnHookObj(s->object, wParam, lParam); break;
+ case 4: returnVal = s->pfnHookObjParam(s->object, wParam, lParam, s->lParam); break;
+ case 5: returnVal = SendMessage(s->hwnd, s->message, wParam, lParam); break;
default: continue;
}
- if ( returnVal )
+ if (returnVal)
break;
}
// check for no hooks and call the default hook if any
- if ( p->subscriberCount == 0 && p->pfnHook != 0 )
- returnVal = p->pfnHook( wParam, lParam );
+ if (p->subscriberCount == 0 && p->pfnHook != 0)
+ returnVal = p->pfnHook(wParam, lParam);
- LeaveCriticalSection( &p->csHook );
+ LeaveCriticalSection(&p->csHook);
return returnVal;
}
-static int checkHook( HANDLE hHook )
+static int checkHook(HANDLE hHook)
{
- if ( hHook == NULL )
+ if (hHook == NULL)
return -1;
- EnterCriticalSection( &csHooks );
- if ( pLastHook != hHook || !pLastHook ) {
- if ( hooks.getIndex(( THook* )hHook ) == -1 ) {
- LeaveCriticalSection( &csHooks );
+ EnterCriticalSection(&csHooks);
+ if (pLastHook != hHook || !pLastHook) {
+ if (hooks.getIndex((THook*)hHook) == -1) {
+ LeaveCriticalSection(&csHooks);
return -1;
}
- pLastHook = ( THook* )hHook;
+ pLastHook = (THook*)hHook;
}
- LeaveCriticalSection( &csHooks );
+ LeaveCriticalSection(&csHooks);
return 0;
}
static void CALLBACK HookToMainAPCFunc(ULONG_PTR dwParam)
{
- THookToMainThreadItem* item = ( THookToMainThreadItem* )dwParam;
+ THookToMainThreadItem* item = (THookToMainThreadItem*)dwParam;
- if ( checkHook( item->hook ) == -1 )
+ if (checkHook(item->hook) == -1)
item->result = -1;
else
- item->result = CallHookSubscribers( item->hook, item->wParam, item->lParam );
- SetEvent( item->hDoneEvent );
+ item->result = CallHookSubscribers(item->hook, item->wParam, item->lParam);
+ SetEvent(item->hDoneEvent);
}
-int NotifyEventHooks( HANDLE hEvent, WPARAM wParam, LPARAM lParam )
+int NotifyEventHooks(HANDLE hEvent, WPARAM wParam, LPARAM lParam)
{
extern HWND hAPCWindow;
- if ( GetCurrentThreadId() != mainThreadId ) {
+ if ( GetCurrentThreadId() != mainThreadId) {
THookToMainThreadItem item;
item.hDoneEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- item.hook = ( THook* )hEvent;
+ item.hook = (THook*)hEvent;
item.wParam = wParam;
item.lParam = lParam;
- QueueUserAPC( HookToMainAPCFunc, hMainThread, ( ULONG_PTR )&item );
- PostMessage( hAPCWindow, WM_NULL, 0, 0 ); // let it process APC even if we're in a common dialog
- WaitForSingleObject( item.hDoneEvent, INFINITE );
- CloseHandle( item.hDoneEvent );
+ QueueUserAPC(HookToMainAPCFunc, hMainThread, (ULONG_PTR)&item);
+ PostMessage(hAPCWindow, WM_NULL, 0, 0); // let it process APC even if we're in a common dialog
+ WaitForSingleObject(item.hDoneEvent, INFINITE);
+ CloseHandle(item.hDoneEvent);
return item.result;
}
- return ( checkHook( hEvent ) == -1 ) ? -1 : CallHookSubscribers( hEvent, wParam, lParam );
+ return (checkHook(hEvent) == -1) ? -1 : CallHookSubscribers(hEvent, wParam, lParam);
}
-static HANDLE HookEventInt( int type, const char* name, MIRANDAHOOK hookProc, void* object, LPARAM lParam )
+static HANDLE HookEventInt(int type, const char* name, MIRANDAHOOK hookProc, void* object, LPARAM lParam)
{
int idx;
THook* p;
HANDLE ret;
- EnterCriticalSection( &csHooks );
- if (( idx = hooks.getIndex(( THook* )name )) == -1 ) {
+ EnterCriticalSection(&csHooks);
+ if ((idx = hooks.getIndex((THook*)name)) == -1) {
#ifdef _DEBUG
OutputDebugStringA("Attempt to hook: \t");
OutputDebugStringA(name);
@@ -476,47 +476,47 @@ static HANDLE HookEventInt( int type, const char* name, MIRANDAHOOK hookProc, vo }
p = hooks[ idx ];
- p->subscriber = ( THookSubscriber* )mir_realloc( p->subscriber, sizeof( THookSubscriber )*( p->subscriberCount+1 ));
+ p->subscriber = (THookSubscriber*)mir_realloc(p->subscriber, sizeof(THookSubscriber)*(p->subscriberCount+1));
p->subscriber[ p->subscriberCount ].type = type;
p->subscriber[ p->subscriberCount ].pfnHook = hookProc;
p->subscriber[ p->subscriberCount ].object = object;
p->subscriber[ p->subscriberCount ].lParam = lParam;
- p->subscriber[ p->subscriberCount ].hOwner = GetInstByAddress( hookProc );
+ p->subscriber[ p->subscriberCount ].hOwner = GetInstByAddress(hookProc);
p->subscriberCount++;
- ret = ( HANDLE )(( p->id << 16 ) | p->subscriberCount );
- LeaveCriticalSection( &csHooks );
+ ret = (HANDLE)((p->id << 16) | p->subscriberCount);
+ LeaveCriticalSection(&csHooks);
return ret;
}
-HANDLE HookEvent( const char* name, MIRANDAHOOK hookProc )
+HANDLE HookEvent(const char* name, MIRANDAHOOK hookProc)
{
- return HookEventInt( 1, name, hookProc, 0, 0 );
+ return HookEventInt(1, name, hookProc, 0, 0);
}
-HANDLE HookEventParam( const char* name, MIRANDAHOOKPARAM hookProc, LPARAM lParam )
+HANDLE HookEventParam(const char* name, MIRANDAHOOKPARAM hookProc, LPARAM lParam)
{
- return HookEventInt( 2, name, (MIRANDAHOOK)hookProc, 0, lParam );
+ return HookEventInt(2, name, (MIRANDAHOOK)hookProc, 0, lParam);
}
-HANDLE HookEventObj( const char* name, MIRANDAHOOKOBJ hookProc, void* object)
+HANDLE HookEventObj(const char* name, MIRANDAHOOKOBJ hookProc, void* object)
{
- return HookEventInt( 3, name, (MIRANDAHOOK)hookProc, object, 0 );
+ return HookEventInt(3, name, (MIRANDAHOOK)hookProc, object, 0);
}
-HANDLE HookEventObjParam( const char* name, MIRANDAHOOKOBJPARAM hookProc, void* object, LPARAM lParam )
+HANDLE HookEventObjParam(const char* name, MIRANDAHOOKOBJPARAM hookProc, void* object, LPARAM lParam)
{
- return HookEventInt( 4, name, (MIRANDAHOOK)hookProc, object, lParam );
+ return HookEventInt(4, name, (MIRANDAHOOK)hookProc, object, lParam);
}
-HANDLE HookEventMessage( const char* name, HWND hwnd, UINT message )
+HANDLE HookEventMessage(const char* name, HWND hwnd, UINT message)
{
int idx;
THook* p;
HANDLE ret;
- EnterCriticalSection( &csHooks );
- if (( idx = hooks.getIndex(( THook* )name )) == -1 ) {
+ EnterCriticalSection(&csHooks);
+ if ((idx = hooks.getIndex((THook*)name)) == -1) {
#ifdef _DEBUG
MessageBoxA(NULL, "Attempt to hook non-existant event", name, MB_OK);
#endif
@@ -525,93 +525,93 @@ HANDLE HookEventMessage( const char* name, HWND hwnd, UINT message ) }
p = hooks[ idx ];
- p->subscriber = ( THookSubscriber* )mir_realloc( p->subscriber, sizeof( THookSubscriber )*( p->subscriberCount+1 ));
+ p->subscriber = (THookSubscriber*)mir_realloc(p->subscriber, sizeof(THookSubscriber)*(p->subscriberCount+1));
p->subscriber[ p->subscriberCount ].type = 5;
p->subscriber[ p->subscriberCount ].hwnd = hwnd;
p->subscriber[ p->subscriberCount ].message = message;
p->subscriberCount++;
- ret = ( HANDLE )(( p->id << 16 ) | p->subscriberCount );
- LeaveCriticalSection( &csHooks );
+ ret = (HANDLE)((p->id << 16) | p->subscriberCount);
+ LeaveCriticalSection(&csHooks);
return ret;
}
-int UnhookEvent( HANDLE hHook )
+int UnhookEvent(HANDLE hHook)
{
int i;
THook* p = NULL;
- int hookId = ( int )hHook >> 16;
- int subscriberId = (( int )hHook & 0xFFFF ) - 1;
+ int hookId = (int)hHook >> 16;
+ int subscriberId = ((int)hHook & 0xFFFF) - 1;
- if (hHook == NULL) return 0;
+ if (hHook == NULL) return 0;
- EnterCriticalSection( &csHooks );
- for ( i = 0; i < hooks.getCount(); i++ ) {
- if ( hooks[i]->id == hookId ) {
+ EnterCriticalSection(&csHooks);
+ for (i = 0; i < hooks.getCount(); i++) {
+ if (hooks[i]->id == hookId) {
p = hooks[i];
break;
} }
- if ( p == NULL ) {
- LeaveCriticalSection( &csHooks );
+ if (p == NULL) {
+ LeaveCriticalSection(&csHooks);
return 1;
}
- if ( subscriberId >= p->subscriberCount || subscriberId < 0 ) {
- LeaveCriticalSection( &csHooks );
+ if (subscriberId >= p->subscriberCount || subscriberId < 0) {
+ LeaveCriticalSection(&csHooks);
return 1;
}
p->subscriber[subscriberId].type = 0;
p->subscriber[subscriberId].pfnHook = NULL;
p->subscriber[subscriberId].hOwner = NULL;
- while ( p->subscriberCount && p->subscriber[p->subscriberCount-1].type == 0 )
+ while (p->subscriberCount && p->subscriber[p->subscriberCount-1].type == 0)
p->subscriberCount--;
- if ( p->subscriberCount == 0 ) {
- if ( p->subscriber ) mir_free( p->subscriber );
+ if (p->subscriberCount == 0) {
+ if (p->subscriber) mir_free(p->subscriber);
p->subscriber = NULL;
}
- LeaveCriticalSection( &csHooks );
+ LeaveCriticalSection(&csHooks);
return 0;
}
-void KillModuleEventHooks( HINSTANCE hInst )
+void KillModuleEventHooks(HINSTANCE hInst)
{
int i, j;
EnterCriticalSection(&csHooks);
- for ( i = hooks.getCount()-1; i >= 0; i-- ) {
- if ( hooks[i]->subscriberCount == 0 )
+ for (i = hooks.getCount()-1; i >= 0; i--) {
+ if (hooks[i]->subscriberCount == 0)
continue;
- for ( j = hooks[i]->subscriberCount-1; j >= 0; j-- ) {
- if ( hooks[i]->subscriber[j].hOwner == hInst ) {
+ for (j = hooks[i]->subscriberCount-1; j >= 0; j--) {
+ if (hooks[i]->subscriber[j].hOwner == hInst) {
char szModuleName[ MAX_PATH ];
- GetModuleFileNameA( hooks[i]->subscriber[j].hOwner, szModuleName, sizeof(szModuleName));
- Netlib_Logf( NULL, "A hook %08x for event '%s' was abnormally deleted because module '%s' didn't released it",
- hooks[i]->subscriber[j].pfnHook, hooks[i]->name, szModuleName );
- UnhookEvent(( HANDLE )(( hooks[i]->id << 16 ) + j + 1 ));
- if ( hooks[i]->subscriberCount == 0 )
+ GetModuleFileNameA(hooks[i]->subscriber[j].hOwner, szModuleName, sizeof(szModuleName));
+ Netlib_Logf(NULL, "A hook %08x for event '%s' was abnormally deleted because module '%s' didn't released it",
+ hooks[i]->subscriber[j].pfnHook, hooks[i]->name, szModuleName);
+ UnhookEvent((HANDLE)((hooks[i]->id << 16) + j + 1));
+ if (hooks[i]->subscriberCount == 0)
break;
} } }
LeaveCriticalSection(&csHooks);
}
-void KillObjectEventHooks( void* pObject )
+void KillObjectEventHooks(void* pObject)
{
int i, j;
EnterCriticalSection(&csHooks);
- for ( i = hooks.getCount()-1; i >= 0; i-- ) {
- if ( hooks[i]->subscriberCount == 0 )
+ for (i = hooks.getCount()-1; i >= 0; i--) {
+ if (hooks[i]->subscriberCount == 0)
continue;
- for ( j = hooks[i]->subscriberCount-1; j >= 0; j-- ) {
- if ( hooks[i]->subscriber[j].object == pObject ) {
- UnhookEvent(( HANDLE )(( hooks[i]->id << 16 ) + j + 1 ));
- if ( hooks[i]->subscriberCount == 0 )
+ for (j = hooks[i]->subscriberCount-1; j >= 0; j--) {
+ if (hooks[i]->subscriber[j].object == pObject) {
+ UnhookEvent((HANDLE)((hooks[i]->id << 16) + j + 1));
+ if (hooks[i]->subscriberCount == 0)
break;
} } }
@@ -620,69 +620,69 @@ void KillObjectEventHooks( void* pObject ) /////////////////////SERVICES
-static __inline TService* FindServiceByName( const char *name )
+static __inline TService* FindServiceByName(const char *name)
{
- unsigned hash = hashstr( name );
- return services.find(( TService* )&hash );
+ unsigned hash = hashstr(name);
+ return services.find((TService*)&hash);
}
-static HANDLE CreateServiceInt( int type, const char *name, MIRANDASERVICE serviceProc, void* object, LPARAM lParam)
+static HANDLE CreateServiceInt(int type, const char *name, MIRANDASERVICE serviceProc, void* object, LPARAM lParam)
{
- if ( name == NULL )
+ if (name == NULL)
return NULL;
TService tmp;
- tmp.nameHash = hashstr( name );
+ tmp.nameHash = hashstr(name);
- EnterCriticalSection( &csServices );
+ EnterCriticalSection(&csServices);
- if ( services.getIndex( &tmp ) != -1 ) {
- LeaveCriticalSection( &csServices );
+ if (services.getIndex(&tmp) != -1) {
+ LeaveCriticalSection(&csServices);
return NULL;
}
- TService* p = ( TService* )mir_alloc( sizeof( *p ) + strlen( name ));
- strcpy( p->name, name );
+ TService* p = (TService*)mir_alloc(sizeof(*p) + strlen(name));
+ strcpy(p->name, name);
p->nameHash = tmp.nameHash;
p->pfnService = serviceProc;
- p->hOwner = GetInstByAddress( serviceProc );
+ p->hOwner = GetInstByAddress(serviceProc);
p->flags = type;
p->lParam = lParam;
p->object = object;
- services.insert( p );
+ services.insert(p);
- LeaveCriticalSection( &csServices );
- return ( HANDLE )tmp.nameHash;
+ LeaveCriticalSection(&csServices);
+ return (HANDLE)tmp.nameHash;
}
-HANDLE CreateServiceFunction( const char *name, MIRANDASERVICE serviceProc )
+HANDLE CreateServiceFunction(const char *name, MIRANDASERVICE serviceProc)
{
- return CreateServiceInt( 0, name, serviceProc, 0, 0 );
+ return CreateServiceInt(0, name, serviceProc, 0, 0);
}
HANDLE CreateServiceFunctionParam(const char *name, MIRANDASERVICEPARAM serviceProc, LPARAM lParam)
{
- return CreateServiceInt( 1, name, (MIRANDASERVICE)serviceProc, 0, lParam );
+ return CreateServiceInt(1, name, (MIRANDASERVICE)serviceProc, 0, lParam);
}
HANDLE CreateServiceFunctionObj(const char *name, MIRANDASERVICEOBJ serviceProc, void* object)
{
- return CreateServiceInt( 2, name, (MIRANDASERVICE)serviceProc, object, 0 );
+ return CreateServiceInt(2, name, (MIRANDASERVICE)serviceProc, object, 0);
}
HANDLE CreateServiceFunctionObjParam(const char *name, MIRANDASERVICEOBJPARAM serviceProc, void* object, LPARAM lParam)
{
- return CreateServiceInt( 3, name, (MIRANDASERVICE)serviceProc, object, lParam );
+ return CreateServiceInt(3, name, (MIRANDASERVICE)serviceProc, object, lParam);
}
int DestroyServiceFunction(HANDLE hService)
{
int idx;
- EnterCriticalSection( &csServices );
- if (( idx = services.getIndex(( TService* )&hService )) != -1 ) {
- mir_free( services[idx] );
- services.remove( idx );
+ EnterCriticalSection(&csServices);
+ if ((idx = services.getIndex((TService*)&hService)) != -1) {
+ mir_free(services[idx]);
+ services.remove(idx);
}
LeaveCriticalSection(&csServices);
@@ -691,12 +691,12 @@ int DestroyServiceFunction(HANDLE hService) int ServiceExists(const char *name)
{
- if ( name == NULL )
+ if (name == NULL)
return FALSE;
- EnterCriticalSection( &csServices );
- int ret = FindServiceByName( name ) != NULL;
- LeaveCriticalSection( &csServices );
+ EnterCriticalSection(&csServices);
+ int ret = FindServiceByName(name) != NULL;
+ LeaveCriticalSection(&csServices);
return ret;
}
@@ -735,7 +735,7 @@ INT_PTR CallService(const char *name, WPARAM wParam, LPARAM lParam) LPARAM fnParam = pService->lParam;
void* object = pService->object;
LeaveCriticalSection(&csServices);
- switch( flags ) {
+ switch(flags) {
case 1: return ((MIRANDASERVICEPARAM)pfnService)(wParam, lParam, fnParam);
case 2: return ((MIRANDASERVICEOBJ)pfnService)(object, wParam, lParam);
case 3: return ((MIRANDASERVICEOBJPARAM)pfnService)(object, wParam, lParam, fnParam);
@@ -773,39 +773,39 @@ INT_PTR CallServiceSync(const char *name, WPARAM wParam, LPARAM lParam) return CallService(name, wParam, lParam);
}
-int CallFunctionAsync( void (__stdcall *func)(void *), void *arg)
+int CallFunctionAsync(void (__stdcall *func)(void *), void *arg)
{
extern HWND hAPCWindow;
- int r = QueueUserAPC(( void (__stdcall *)( ULONG_PTR ))func, hMainThread, ( ULONG_PTR )arg );
+ int r = QueueUserAPC((void (__stdcall *)(ULONG_PTR))func, hMainThread, (ULONG_PTR)arg);
PostMessage(hAPCWindow, WM_NULL, 0, 0);
return r;
}
-void KillModuleServices( HINSTANCE hInst )
+void KillModuleServices(HINSTANCE hInst)
{
int i;
EnterCriticalSection(&csServices);
- for ( i = services.getCount()-1; i >= 0; i-- ) {
- if ( services[i]->hOwner == hInst ) {
+ for (i = services.getCount()-1; i >= 0; i--) {
+ if (services[i]->hOwner == hInst) {
char szModuleName[ MAX_PATH ];
- GetModuleFileNameA( services[i]->hOwner, szModuleName, sizeof(szModuleName));
- Netlib_Logf( NULL, "A service function '%s' was abnormally deleted because module '%s' didn't released it",
- services[i]->name, szModuleName );
- DestroyServiceFunction(( HANDLE )services[i]->nameHash );
+ GetModuleFileNameA(services[i]->hOwner, szModuleName, sizeof(szModuleName));
+ Netlib_Logf(NULL, "A service function '%s' was abnormally deleted because module '%s' didn't released it",
+ services[i]->name, szModuleName);
+ DestroyServiceFunction((HANDLE)services[i]->nameHash);
} }
LeaveCriticalSection(&csServices);
}
-void KillObjectServices( void* pObject )
+void KillObjectServices(void* pObject)
{
int i;
EnterCriticalSection(&csServices);
- for ( i = services.getCount()-1; i >= 0; i-- )
- if ( services[i]->object == pObject )
- DestroyServiceFunction(( HANDLE )services[i]->nameHash );
+ for (i = services.getCount()-1; i >= 0; i--)
+ if (services[i]->object == pObject)
+ DestroyServiceFunction((HANDLE)services[i]->nameHash);
LeaveCriticalSection(&csServices);
}
diff --git a/src/core/modules.h b/src/core/modules.h index dc993a97b1..a2e5429d5f 100644 --- a/src/core/modules.h +++ b/src/core/modules.h @@ -123,7 +123,7 @@ Works precisely like NotifyEventHooks, but without switching to the first thread It guarantees that the execution time for these events is always tiny
*/
-int CallHookSubscribers( HANDLE hEvent, WPARAM wParam, LPARAM lParam );
+int CallHookSubscribers(HANDLE hEvent, WPARAM wParam, LPARAM lParam);
/*
hEvent : a HANDLE which has been returned by CreateHookableEvent()
@@ -263,6 +263,6 @@ Returns nonzero on success, zero on failure added during 0.3.4+ (2004/08/14)
*/
-int CallFunctionAsync( void (__stdcall *func)(void *), void *arg);
+int CallFunctionAsync(void (__stdcall *func)(void *), void *arg);
#endif // MODULES_H_
|