From 65e002b63efdb00571d0ba4ec1a73b14e1d7d3a0 Mon Sep 17 00:00:00 2001 From: Alexey Kulakov Date: Wed, 4 Jul 2012 20:10:29 +0000 Subject: Pascal headers moved to include\delphi directory (with small updates) removed deprecated m_mwclc.h file and link on it in AutoShutdown plugin git-svn-id: http://svn.miranda-ng.org/main/trunk@763 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/delphi/m_system.inc | 364 +++++++++++++++++++++++++------------------- 1 file changed, 205 insertions(+), 159 deletions(-) (limited to 'include/delphi/m_system.inc') diff --git a/include/delphi/m_system.inc b/include/delphi/m_system.inc index dff5909c86..8347495e03 100644 --- a/include/delphi/m_system.inc +++ b/include/delphi/m_system.inc @@ -1,170 +1,216 @@ -(* - -Miranda IM: the free IM client for Microsoft* Windows* - -Copyright 2000-2003 Miranda ICQ/IM project, -all portions of this codebase are copyrighted to the people -listed in contributors.txt. +{ + Miranda IM: the free IM client for Microsoft Windows + + Copyright 2000-2003 Miranda ICQ/IM project, + all portions of this codebase are copyrighted to the people + listed in contributors.txt. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +} +{$IFNDEF M_SYSTEM} +{$DEFINE M_SYSTEM} -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. +{$IFNDEF MIRANDANAME} +{$DEFINE MIRANDANAME} +const + MIRANDANAME = 'Miranda IM'; +{$ENDIF} +{$IFNDEF MIRANDACLASS} +{$DEFINE MIRANDACLASS} +const + MIRANDACLASS = 'Miranda'; +{$ENDIF} -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. +// set the default compatibility lever for Miranda 0.4.x +{$IFNDEF MIRANDA_VER} +{$DEFINE MIRANDA_VER} +const + MIRANDA_VER = $0400; +{$ENDIF} -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + { miranda/system/modulesloaded + called after all modules have been successfully initialised + wParam=lParam=0 + used to resolve double-dependencies in the module load order + } +const + ME_SYSTEM_MODULESLOADED:PAnsiChar = 'Miranda/System/ModulesLoaded'; + + { miranda/system/shutdown event + called just before the application terminates + the database is still guaranteed to be running during this hook. + wParam=lParam=0 + } + ME_SYSTEM_SHUTDOWN:PAnsiChar = 'Miranda/System/Shutdown'; + + { restarts miranda ( 0.8+ ) + wParam=lParam=0 + } + MS_SYSTEM_RESTART:PAnsiChar = 'Miranda/System/Restart'; + + { miranda/system/oktoexit event + called before the app goes into shutdown routine to make sure everyone is + happy to exit + wParam=lParam=0 + return nonzero to stop the exit cycle + } + ME_SYSTEM_OKTOEXIT:PAnsiChar = 'Miranda/System/OkToExitEvent'; + + { miranda/system/oktoexit service + Check if everyone is happy to exit + wParam=lParam=0 + if everyone acknowleges OK to exit then returns true, otherwise false + } + MS_SYSTEM_OKTOEXIT:PAnsiChar = 'Miranda/System/OkToExit'; + + { gets the version number of Miranda encoded as a DWORD v0.1.0.1+ + wParam=lParam=0 + returns the version number, encoded as one version per byte, therefore + version 1.2.3.10 is 0x0102030a + } + MS_SYSTEM_GETVERSION:PAnsiChar = 'Miranda/System/GetVersion'; + + { gets the version of Miranda encoded as text v0.1.0.1+ + wParam=cch + lParam=(LPARAM)(AnsiChar*)pszVersion + cch is the size of the buffer pointed to by pszVersion, in bytes + may return a build qualifier, such as "0.1.0.1 alpha" + returns 0 on success, nonzero on failure + } + MS_SYSTEM_GETVERSIONTEXT:PAnsiChar = 'Miranda/System/GetVersionText'; + + { Adds a HANDLE to the list to be checked in the main message loop v0.1.2.0+ + wParam=(WPARAM)(HANDLE)hObject + lParam=(LPARAM)(const AnsiChar*)pszService + returns 0 on success or nonzero on failure + Causes pszService to be CallService()d (wParam=hObject,lParam=0) from the + main thread whenever hObject is signalled. + The Miranda message loop has a MsgWaitForMultipleObjects() call in it to + implement this feature. See the documentation for that function for + information on what objects are supported. + There is a limit of MAXIMUM_WAIT_OBJECTS minus one (MWO is defined in winnt.h + to be 64) on the number of handles MSFMO() can process. This service will + return nonzero if that many handles are already being waited on. + As of writing, the following parts of Miranda are thread-safe, so can be + called from any thread: + All of modules.h except NotifyEventHooks() + Read-only parts of m_database.h (since the write parts will call hooks) + All of m_langpack.h + for all other routines your mileage may vary, but I would strongly recommend + that you call them from the main thread, or ask about it on plugin-dev if you + think it really ought to work. + Update during 0.1.2.0 development, 16/10/01: + NotifyEventHooks() now translates all calls into the context of the main + thread, which means that all of m_database.h is now completely safe. + Update during 0.1.2.2 development, 17/4/02: + The main thread's message loop now also deals with asynchronous procedure + calls. Loop up QueueUserAPC() for a neater way to accomplish a lot of the + things that used to require ms_system_waitonhandle. + Miranda is compiled with the multithreaded runtime - don't forget to do the + same with your plugin. + } + MS_SYSTEM_WAITONHANDLE:PAnsiChar = 'Miranda/System/WaitOnHandle'; + + {Removes a HANDLE from the wait list v0.1.2.0+ } + {wParam=(WPARAM)(HANDLE)hObject } + {lParam=0 } + {returns 0 on success or nonzero on failure. } + MS_SYSTEM_REMOVEWAIT:PAnsiChar = 'Miranda/System/RemoveWait'; + + { + wParam=0 + lParam=0 + + This hook is fired just before the thread unwind stack is used, + it allows MT plugins to shutdown threads if they have any special + processing to do, etc. + } + ME_SYSTEM_PRESHUTDOWN:PAnsiChar = 'Miranda/System/PShutdown'; + + { + wParam=0 + lParam=0 + + Returns TRUE when Miranda has got WM_QUIT and is in the process + of shutting down + } + MS_SYSTEM_TERMINATED:PAnsiChar = 'Miranda/SysTerm'; + + { + wParam : 0 + lParam : (address) void (__cdecl callback) (void) + Affect : Setup a function pointer to be called after main loop iterations, it allows for + idle processing, See notes + Returns: 1 on success, 0 on failure + + Notes : This service will only allow one function to be registered, if one is registered, 0 will be returned + Remember that this uses __cdecl. + Version: Added during 0.3.4+ + } + MS_SYSTEM_SETIDLECALLBACK:PAnsiChar = 'Miranda/SetIdleCallback'; + + { + wParam : 0 + lParam : &tick + Affect : return the last window tick where a monitored event was seen, currently WM_CHAR/WM_MOUSEMOVE + Returns: Always returns 0 + Version: Added during 0.3.4+ (2004/09/12) + } + MS_SYSTEM_GETIDLE:PAnsiChar = 'Miranda/GetIdle'; + + { + wParam: cchMax (max length of buffer) + lParam: pointer to buffer to fill + Affect: Returns the build timestamp of the core, as a string of YYYYMMDDhhmmss, this service might + not exist and therefore the build is before 2004-09-30 + Returns: zero on success, non zero on failure + Version: 0.3.4a+ (2004/09/30) + DEFUNCT: This service was removed on 0.3.4.3+ (2004/11/19) use APILEVEL + } + MS_SYSTEM_GETBUILDSTRING:PAnsiChar = 'Miranda/GetBuildString'; + + { + Missing service catcher + Is being called when one calls the non-existent service. + All parameters are stored in the special structure + + The event handler takes 0 as wParam and TMissingServiceParams* as lParam. + + 0.4.3+ addition (2006/03/27) + } +type + PTMissingServiceParams = ^TMissingServiceParams; + TMissingServiceParams = record + name :PAnsiChar; + wParam:WPARAM; + lParam:LPARAM; + end; -*) -{$IFNDEF M_SYSTEM} -{$DEFINE M_SYSTEM} +const + ME_SYSTEM_MISSINGSERVICE:PAnsiChar = 'System/MissingService'; -type +{ Unhandled exceptions filter +Is being called inside any thread launched via mir_forkthread, including the main thread. +If a plugin's author executes a large piece of code inside __try/__except, he should +obtain this filter and call it inside the __except section - TMM_INTERFACE = record - cbSize: int; - _malloc: function(cbSize: Integer): Pointer; cdecl; - _realloc: function (pb: Pointer; cbSize: Integer): Pointer; cdecl; - _free: procedure(pb: Pointer); cdecl; - end; +0.8.0+ addition (2008/07/20) +} const + MS_SYSTEM_GETEXCEPTFILTER:PAnsiChar = 'System/GetExceptFilter'; - MIRANDANAME = 'Miranda'; - - { - wParam : 0 - lParam : 0 - affect : called after all modules have been successfully initialised - used to resolve double-dependencies in the module load order, see notes - return : 0 - notes : Can be used to call services, etc that have not yet loaded - when your module has. - } - ME_SYSTEM_MODULESLOADED = 'Miranda/System/ModulesLoaded'; - - { - wParam : 0 - lParam : 0 - affect : called just before Miranda terminates, the database is still running - during this hook - return : 0 - } - ME_SYSTEM_SHUTDOWN = 'Miranda/System/Shutdown'; - - { - wParam : 0 - lParam : 0 - affect : called before Miranda actually shuts down -- everyone has to agree - or it is not shut down. - return : non zero to stop the shutdown - } - ME_SYSTEM_OKTOEXIT = 'Miranda/System/OkToExitEvent'; - - { - wParam : 0 - lParam : 0 - affect : service which sends everyone the ME_SYSTEM_OKTOEXIT event - return : true if everyone is okay to exit, otherwise false - } - MS_SYSTEM_OKTOEXIT = 'Miranda/System/OkToExit'; - - { - wParam : 0 - lParam : 0 - return : returns the version number -- each byte set with version index, - e.g. 1.2.3.4 $01020304 - } - MS_SYSTEM_GETVERSION = 'Miranda/System/GetVersion'; - - { - wParam : size in bytes of the buffer to be filled - lParam : pointer to the buffer to be filled - affect : returns Miranda's version as text with build type such as '1.2.3.4 alpha' - return : 0 on success -- non zero on failure - } - MS_SYSTEM_GETVERSIONTEXT = 'Miranda/System/GetVersionText'; - - { - wParam : Handle of a wait object to be used - lParam : pointer to service name - affect : causes the service name to be called whenever the wait object - is signalled with CallService(Service, wParam=hWaitObjeect, lParam=0) - return : 0 on success, non zero on failure, will always fail if - more than 64 event objects are already being waited on because - of the limit imposed by Windows. - version: implemented after v0.1.2.0+ - other : QueueUserAPC() can be used instead of this service to wait - for notifications, BUT *only* after v0.1.2.2+ since that deals - with APC's - } - MS_SYSTEM_WAITONHANDLE = 'Miranda/System/WaitOnHandle'; - - { - wParam : hWaitObject to be removed - lParam : 0 - affect : removes the wait object from the list, see above. - returns: 0 on success, nonzero on failure - version: implemented after v0.1.2.0+ - } - MS_SYSTEM_REMOVEWAIT = 'Miranda/System/RemoveWait'; - - { - wParam : 0 - lParam : Pointer to an initialised TMM_INTERFACE - affect : Get function pointers to, malloc(), free() and realloc() used by Miranda - note : this should only be used carefully, make sure .cbSize is initialised with sizeof(TMM_INTERFACE) - version: 0.1.2.2+ - } - MS_SYSTEM_GET_MMI = 'Miranda/System/GetMMI'; - - { - wParam=0 - lParam=0 - - Add a thread to the unwind wait stack that Miranda will poll on - when it is tearing down modules. - - This must be called in the context of the thread that is to be pushed - i.e. there are no args, it works out what thread is being called - and gets itself a handle to the calling thread. - } - MS_SYSTEM_THREAD_PUSH = 'Miranda/Thread/Push'; - - { - wParam=0 - lParam=0 - - Remove a thread from the unwind wait stack -- it is expected - that the call be made in the context of the thread to be removed. - - Miranda will begin to tear down modules and plugins if/when the - last thread from the unwind stack is removed. - } - MS_SYSTEM_THREAD_POP = 'Miranda/Thread/Pop'; - - { - wParam=0 - lParam=0 - - This hook is fired just before the thread unwind stack is used, - it allows MT plugins to shutdown threads if they have any special - processing to do, etc. - } - ME_SYSTEM_PRESHUTDOWN = 'Miranda/System/PShutdown'; - - { - wParam=0 - lParam=0 - - Returns TRUE when Miranda has got WM_QUIT and is in the process - of shutting down - } - MS_SYSTEM_TERMINATED = 'Miranda/SysTerm'; {$ENDIF} -- cgit v1.2.3