From 8ac8b7393cc59b2a4b993c6387ca3d72cf535c23 Mon Sep 17 00:00:00 2001 From: Alexey Kulakov Date: Wed, 18 Mar 2015 07:51:44 +0000 Subject: pascal version of miranda api update git-svn-id: http://svn.miranda-ng.org/main/trunk@12428 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/delphi/m_core.inc | 290 ----------------------------------------- include/delphi/m_database.inc | 293 ++++++++++++++++++++++++++++++++++++++++++ include/delphi/m_helpers.inc | 6 +- include/delphi/m_imgsrvc.inc | 75 ++++++----- 4 files changed, 337 insertions(+), 327 deletions(-) (limited to 'include') diff --git a/include/delphi/m_core.inc b/include/delphi/m_core.inc index 983cbb903d..8d770fe9b9 100644 --- a/include/delphi/m_core.inc +++ b/include/delphi/m_core.inc @@ -60,296 +60,6 @@ const type TMEVENT = dword; - PDBVARIANT = ^TDBVARIANT; - TDBVARIANT = record - _type: byte; - case LongInt of - 0: (bVal: byte); - 1: (cVal: AnsiChar); - 2: (wVal: word); - 3: (sVal: ShortInt); - 4: (dVal: dword); - 5: (lVal: long); - 6: ( - szVal : TChar; - cchVal: word; - ); - 7: ( - cpbVal: word; - pbVal : PByte; - ); - end; - -const - DBEF_SENT = 2; // if set, the event was sent by the user, otherwise it was received - DBEF_READ = 4; // event has been read by the user -- only needed for history - DBEF_RTL = 8; // event contains the right-to-left aligned text - DBEF_UTF = 16; // event contains a text in utf-8 - DBEF_ENCRYPTED = 32; // event is encrypted (never reported outside a driver) - -const - EVENTTYPE_MESSAGE = 0; - EVENTTYPE_URL = 1; - EVENTTYPE_CONTACTS = 2; // v0.1.2.2+ - EVENTTYPE_ADDED = 1000; // v0.1.1.0+: these used to be module- - EVENTTYPE_AUTHREQUEST = 1001; // specific codes, hence the module- - EVENTTYPE_FILE = 1002; // specific limit has been raised to 2000 - -type - PDBEVENTINFO = ^TDBEVENTINFO; - TDBEVENTINFO = record - cbSize : int; // size of the structure - szModule : PAnsiChar; // module that 'owns' this event and controls the data format - timestamp: dword; // timestamp in UNIX time - flags : dword; // the DBEF_* flags above - eventType: word; // event type, such as message, can be module defined - cbBlob : dword; // size in bytes of pBlob^ - pBlob : PByte; // pointer to buffer containing the module defined event data - end; - -(****************************************************************************** - * DATABASE EVENTS - *) - -{ -Adds a new event to a contact's event list -Returns a handle to the newly added event, or NULL on failure -Triggers a db/event/added event just before it returns. -Events are sorted chronologically as they are entered, so you cannot guarantee -that the new hEvent is the last event in the chain, however if a new event is -added that has a timestamp less than 90 seconds *before* the event that should -be after it, it will be added afterwards, to allow for protocols that only -store times to the nearest minute, and slight delays in transports. -There are a few predefined eventTypes below for easier compatibility, but -modules are free to define their own, beginning at 2000 -DBEVENTINFO.timestamp is in GMT, as returned by time(). There are services -db/time/x below with useful stuff for dealing with it. -} -function db_event_add(hContact:TMCONTACT; dbei:PDBEVENTINFO):TMEVENT; stdcall; - external CoreDLL name 'db_event_add'; - -{ -Gets the number of events in the chain belonging to a contact in the database. -Returns the number of events in the chain owned by hContact or -1 if hContact -is invalid. They can be retrieved using the db_event_first/last() services. -Returns 0 for Subcontacts (use db_event_last to recognize empty history) -} -function db_event_count(hContact:TMCONTACT):int; stdcall; - external CoreDLL name 'db_event_count'; - -{ -Removes a single event from the database -hDbEvent should have been returned by db_event_add/first/last/next/prev() -Returns 0 on success, or nonzero if hDbEvent was invalid -Triggers a db/event/deleted event just *before* the event is deleted -} -function db_event_delete(hContact:TMCONTACT; hDbEvent:TMEVENT):int; stdcall; - external CoreDLL name 'db_event_delete'; - -{ -Retrieves a handle to the first event in the chain for hContact -Returns the handle, or NULL if hContact is invalid or has no events -Events in a chain are sorted chronologically automatically -} -function db_event_first(hContact:TMCONTACT):TMEVENT; stdcall; - external CoreDLL name 'db_event_first'; - -{ -Retrieves a handle to the first unread event in the chain for hContact -Returns the handle, or NULL if hContact is invalid or all its events have been -read - -Events in a chain are sorted chronologically automatically, but this does not -necessarily mean that all events after the first unread are unread too. They -should be checked individually with db_event_next() and db_event_get() -This service is designed for startup, reloading all the events that remained -unread from last time -} -function db_event_firstUnread(hContact:TMCONTACT):TMEVENT; stdcall; - external CoreDLL name 'db_event_firstUnread'; - -{ -Retrieves all the information stored in hDbEvent -hDbEvent should have been returned by db_event_add/first/last/next/prev() -Returns 0 on success or nonzero if hDbEvent is invalid -Don't forget to set dbe.cbSize, dbe.pBlob and dbe.cbBlob before calling this -service -The correct value dbe.cbBlob can be got using db/event/getblobsize -If successful, all the fields of dbe are filled. dbe.cbBlob is set to the -actual number of bytes retrieved and put in dbe.pBlob -If dbe.cbBlob is too small, dbe.pBlob is filled up to the size of dbe.cbBlob -and then dbe.cbBlob is set to the required size of data to go in dbe.pBlob -On return, dbe.szModule is a pointer to the database module's own internal list -of modules. Look but don't touch. -} -function db_event_get(hDbEvent:TMEVENT; dbei:PDBEVENTINFO):int; stdcall; - external CoreDLL name 'db_event_get'; - -{ -Retrieves the space in bytes required to store the blob in hDbEvent -hDbEvent should have been returned by db_event_add/first/last/next/prev() -Returns the space required in bytes, or -1 if hDbEvent is invalid -} -function db_event_getBlobSize(hDbEvent:TMEVENT):int; stdcall; - external CoreDLL name 'db_event_getBlobSize'; - -{ -Retrieves a handle to the contact that owns hDbEvent. -hDbEvent should have been returned by db_event_add/first/last/next/prev() -NULL is a valid return value, meaning, as usual, the user. -Returns (HANDLE)(-1) if hDbEvent is invalid, or the handle to the contact on -success -This service is exceptionally slow. Use only when you have no other choice at -all. -} -function db_event_getContact(hDbEvent:TMEVENT):TMCONTACT; stdcall; - external CoreDLL name 'db_event_getContact'; - -{ -Retrieves a handle to the last event in the chain for hContact -Returns the handle, or NULL if hContact is invalid or has no events -Events in a chain are sorted chronologically automatically -} -function db_event_last(hContact:TMCONTACT):TMEVENT; stdcall; - external CoreDLL name 'db_event_last'; - -{ -Changes the flags for an event to mark it as read. -hDbEvent should have been returned by db_event_add/first/last/next/prev() -Returns the entire flag dword for the event after the change, or -1 if hDbEvent -is invalid. -This is the one database write operation that does not trigger an event. -Modules should not save flags states for any length of time. -} -function db_event_markRead(hContact:TMCONTACT; hDbEvent:TMEVENT):int; stdcall; - external CoreDLL name 'db_event_markRead'; - -{ -Retrieves a handle to the next event in a chain after hDbEvent -Returns the handle, or NULL if hDbEvent is invalid or is the last event -Events in a chain are sorted chronologically automatically -} -function db_event_next(hContact:TMCONTACT; hDbEvent:TMEVENT):THANDLE; stdcall; - external CoreDLL name 'db_event_next'; - -{ -Retrieves a handle to the previous event in a chain before hDbEvent -Returns the handle, or NULL if hDbEvent is invalid or is the first event -Events in a chain are sorted chronologically automatically -} -function db_event_prev(hContact:TMCONTACT; hDbEvent:TMEVENT):THANDLE; stdcall; - external CoreDLL name 'db_event_prev'; - -function db_free(dbv:PDBVARIANT):int_ptr; stdcall; - external CoreDLL name 'db_free'; - -(****************************************************************************** - * DATABASE CONTACTS - *) - -{ -Gets the handle of the first contact in the database. This handle can be used -with loads of functions. It does not need to be closed. -You can specify szProto to find only its contacts -Returns a handle to the first contact in the db on success, or NULL if there -are no contacts in the db. -} -function db_find_first(const szModule:PAnsiChar=nil):TMCONTACT; stdcall; - external CoreDLL name 'db_find_first'; - -{ -Gets the handle of the next contact after hContact in the database. This handle -can be used with loads of functions. It does not need to be closed. -You can specify szProto to find only its contacts -Returns a handle to the contact after hContact in the db on success or NULL if -hContact was the last contact in the db or hContact was invalid. -} -function db_find_next(hContact:TMCONTACT; const szModule:PAnsiChar=nil):TMCONTACT; stdcall; - external CoreDLL name 'db_find_next'; - -(****************************************************************************** - * DATABASE SETTINGS - *) - -function db_get(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; dbv:PDBVARIANT):int_ptr; stdcall; - external CoreDLL name 'db_get'; -function db_get_b(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; errorValue:int):int; stdcall; - external CoreDLL name 'db_get_b'; -function db_get_w(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; errorValue:int):int; stdcall; - external CoreDLL name 'db_get_w'; -function db_get_dw(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; errorValue:dword):dword; stdcall; - external CoreDLL name 'db_get_dw'; -function db_get_s(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; dbv:PDBVARIANT; const nType:int=DBVT_ASCIIZ):int_ptr; stdcall; - external CoreDLL name 'db_get_s'; -function db_get_sa(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar):PAnsiChar; stdcall; - external CoreDLL name 'db_get_sa'; -function db_get_wsa(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar):PWideChar; stdcall; - external CoreDLL name 'db_get_wsa'; - -function db_get_static(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; szDest:PAnsiChar; destLen:int):int; stdcall; - external CoreDLL name 'db_get_static'; -function db_get_static_utf(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; szDest:PAnsiChar; destLen:int):int; stdcall; - external CoreDLL name 'db_get_static_utf'; -function db_get_wstatic(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; szDest:PWideChar; destLen:int):int; stdcall; - external CoreDLL name 'db_get_wstatic'; - -function db_set(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; dbv:PDBVARIANT):int_ptr; stdcall; - external CoreDLL name 'db_set'; -function db_set_b(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; val:byte):int_ptr; stdcall; - external CoreDLL name 'db_set_b'; -function db_set_w(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; val:word):int_ptr; stdcall; - external CoreDLL name 'db_set_w'; -function db_set_dw(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; val:dword):int_ptr; stdcall; - external CoreDLL name 'db_set_dw'; -function db_set_s(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; const val:PAnsiChar):int_ptr; stdcall; - external CoreDLL name 'db_set_s'; -function db_set_ws(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; const val:PWideChar):int_ptr; stdcall; - external CoreDLL name 'db_set_ws'; -function db_set_utf(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; const val:PAnsiChar):int_ptr; stdcall; - external CoreDLL name 'db_set_utf'; -function db_set_blob(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; val:pointer; len:uint):int_ptr; stdcall; - external CoreDLL name 'db_set_blob'; - -function db_unset(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar):int_ptr; stdcall; - external CoreDLL name 'db_unset'; - -function db_set_resident(const szModule:PAnsiChar; const szSetting:PAnsiChar; bEnable:int):int; stdcall; - external CoreDLL name 'db_set_resident'; - -// deprecated Aliases -function DBFreeVariant(dbv:PDBVARIANT):int_ptr; stdcall; - external CoreDLL name 'db_free'; -function DBDeleteContactSetting(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar):int_ptr; stdcall; - external CoreDLL name 'db_unset'; -function DBGetContactSettingByte(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; errorValue:int):int; stdcall; - external CoreDLL name 'db_get_b'; -function DBGetContactSettingWord(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; errorValue:int):int; stdcall; - external CoreDLL name 'db_get_w'; -function DBGetContactSettingDWord(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; errorValue:dword):dword; stdcall; - external CoreDLL name 'db_get_dw'; -function DBGetContactSetting(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; dbv:PDBVARIANT):int_ptr; stdcall; - external CoreDLL name 'db_get'; -function DBGetContactSettingStr(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; dbv:PDBVARIANT; const nType:int=DBVT_ASCIIZ):int_ptr; stdcall; - external CoreDLL name 'db_get_s'; -function DBGetContactSettingString(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar):PAnsiChar; stdcall; - external CoreDLL name 'db_get_sa'; -function DBGetContactSettingWString(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar):PWideChar; stdcall; - external CoreDLL name 'db_get_wsa'; - -function DBWriteContactSettingByte(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; val:byte):int_ptr; stdcall; - external CoreDLL name 'db_set_b'; -function DBWriteContactSettingWord(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; val:word):int_ptr; stdcall; - external CoreDLL name 'db_set_w'; -function DBWriteContactSettingDWord(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; val:dword):int_ptr; stdcall; - external CoreDLL name 'db_set_dw'; -function DBWriteContactSettingString(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; const val:PAnsiChar):int_ptr; stdcall; - external CoreDLL name 'db_set_s'; -function DBWriteContactSettingWString(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; const val:PWideChar):int_ptr; stdcall; - external CoreDLL name 'db_set_ws'; -function DBWriteContactSettingUTF8String(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; const val:PAnsiChar):int_ptr; stdcall; - external CoreDLL name 'db_set_utf'; -function DBWriteContactSettingBlob(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; val:pointer; len:uint):int_ptr; stdcall; - external CoreDLL name 'db_set_blob'; /////////////////////////////////////////////////////////////////////////////// // events, hooks & services diff --git a/include/delphi/m_database.inc b/include/delphi/m_database.inc index 0ca504eec1..8036b42a7d 100644 --- a/include/delphi/m_database.inc +++ b/include/delphi/m_database.inc @@ -1,6 +1,299 @@ {$IFNDEF M_DATABASE} {$DEFINE M_DATABASE} +type + PDBVARIANT = ^TDBVARIANT; + TDBVARIANT = record + _type: byte; + case LongInt of + 0: (bVal: byte); + 1: (cVal: AnsiChar); + 2: (wVal: word); + 3: (sVal: ShortInt); + 4: (dVal: dword); + 5: (lVal: long); + 6: ( + szVal : TChar; + cchVal: word; + ); + 7: ( + cpbVal: word; + pbVal : PByte; + ); + end; + +const + DBEF_SENT = 2; // if set, the event was sent by the user, otherwise it was received + DBEF_READ = 4; // event has been read by the user -- only needed for history + DBEF_RTL = 8; // event contains the right-to-left aligned text + DBEF_UTF = 16; // event contains a text in utf-8 + DBEF_ENCRYPTED = 32; // event is encrypted (never reported outside a driver) + +const + EVENTTYPE_MESSAGE = 0; + EVENTTYPE_URL = 1; + EVENTTYPE_CONTACTS = 2; // v0.1.2.2+ + EVENTTYPE_ADDED = 1000; // v0.1.1.0+: these used to be module- + EVENTTYPE_AUTHREQUEST = 1001; // specific codes, hence the module- + EVENTTYPE_FILE = 1002; // specific limit has been raised to 2000 + +type + PDBEVENTINFO = ^TDBEVENTINFO; + TDBEVENTINFO = record + cbSize : int; // size of the structure + szModule : PAnsiChar; // module that 'owns' this event and controls the data format + timestamp: dword; // timestamp in UNIX time + flags : dword; // the DBEF_* flags above + eventType: word; // event type, such as message, can be module defined + cbBlob : dword; // size in bytes of pBlob^ + pBlob : PByte; // pointer to buffer containing the module defined event data + end; + +(****************************************************************************** + * DATABASE EVENTS + *) + +{ +Adds a new event to a contact's event list +Returns a handle to the newly added event, or NULL on failure +Triggers a db/event/added event just before it returns. +Events are sorted chronologically as they are entered, so you cannot guarantee +that the new hEvent is the last event in the chain, however if a new event is +added that has a timestamp less than 90 seconds *before* the event that should +be after it, it will be added afterwards, to allow for protocols that only +store times to the nearest minute, and slight delays in transports. +There are a few predefined eventTypes below for easier compatibility, but +modules are free to define their own, beginning at 2000 +DBEVENTINFO.timestamp is in GMT, as returned by time(). There are services +db/time/x below with useful stuff for dealing with it. +} +function db_event_add(hContact:TMCONTACT; dbei:PDBEVENTINFO):TMEVENT; stdcall; + external CoreDLL name 'db_event_add'; + +{ +Gets the number of events in the chain belonging to a contact in the database. +Returns the number of events in the chain owned by hContact or -1 if hContact +is invalid. They can be retrieved using the db_event_first/last() services. +Returns 0 for Subcontacts (use db_event_last to recognize empty history) +} +function db_event_count(hContact:TMCONTACT):int; stdcall; + external CoreDLL name 'db_event_count'; + +{ +Removes a single event from the database +hDbEvent should have been returned by db_event_add/first/last/next/prev() +Returns 0 on success, or nonzero if hDbEvent was invalid +Triggers a db/event/deleted event just *before* the event is deleted +} +function db_event_delete(hContact:TMCONTACT; hDbEvent:TMEVENT):int; stdcall; + external CoreDLL name 'db_event_delete'; + +{ +Retrieves a handle to the first event in the chain for hContact +Returns the handle, or NULL if hContact is invalid or has no events +Events in a chain are sorted chronologically automatically +} +function db_event_first(hContact:TMCONTACT):TMEVENT; stdcall; + external CoreDLL name 'db_event_first'; + +{ +Retrieves a handle to the first unread event in the chain for hContact +Returns the handle, or NULL if hContact is invalid or all its events have been +read + +Events in a chain are sorted chronologically automatically, but this does not +necessarily mean that all events after the first unread are unread too. They +should be checked individually with db_event_next() and db_event_get() +This service is designed for startup, reloading all the events that remained +unread from last time +} +function db_event_firstUnread(hContact:TMCONTACT):TMEVENT; stdcall; + external CoreDLL name 'db_event_firstUnread'; + +{ +Retrieves all the information stored in hDbEvent +hDbEvent should have been returned by db_event_add/first/last/next/prev() +Returns 0 on success or nonzero if hDbEvent is invalid +Don't forget to set dbe.cbSize, dbe.pBlob and dbe.cbBlob before calling this +service +The correct value dbe.cbBlob can be got using db/event/getblobsize +If successful, all the fields of dbe are filled. dbe.cbBlob is set to the +actual number of bytes retrieved and put in dbe.pBlob +If dbe.cbBlob is too small, dbe.pBlob is filled up to the size of dbe.cbBlob +and then dbe.cbBlob is set to the required size of data to go in dbe.pBlob +On return, dbe.szModule is a pointer to the database module's own internal list +of modules. Look but don't touch. +} +function db_event_get(hDbEvent:TMEVENT; dbei:PDBEVENTINFO):int; stdcall; + external CoreDLL name 'db_event_get'; + +{ +Retrieves the space in bytes required to store the blob in hDbEvent +hDbEvent should have been returned by db_event_add/first/last/next/prev() +Returns the space required in bytes, or -1 if hDbEvent is invalid +} +function db_event_getBlobSize(hDbEvent:TMEVENT):int; stdcall; + external CoreDLL name 'db_event_getBlobSize'; + +{ +Retrieves a handle to the contact that owns hDbEvent. +hDbEvent should have been returned by db_event_add/first/last/next/prev() +NULL is a valid return value, meaning, as usual, the user. +Returns (HANDLE)(-1) if hDbEvent is invalid, or the handle to the contact on +success +This service is exceptionally slow. Use only when you have no other choice at +all. +} +function db_event_getContact(hDbEvent:TMEVENT):TMCONTACT; stdcall; + external CoreDLL name 'db_event_getContact'; + +{ +Retrieves a handle to the last event in the chain for hContact +Returns the handle, or NULL if hContact is invalid or has no events +Events in a chain are sorted chronologically automatically +} +function db_event_last(hContact:TMCONTACT):TMEVENT; stdcall; + external CoreDLL name 'db_event_last'; + +{ +Changes the flags for an event to mark it as read. +hDbEvent should have been returned by db_event_add/first/last/next/prev() +Returns the entire flag dword for the event after the change, or -1 if hDbEvent +is invalid. +This is the one database write operation that does not trigger an event. +Modules should not save flags states for any length of time. +} +function db_event_markRead(hContact:TMCONTACT; hDbEvent:TMEVENT):int; stdcall; + external CoreDLL name 'db_event_markRead'; + +{ +Retrieves a handle to the next event in a chain after hDbEvent +Returns the handle, or NULL if hDbEvent is invalid or is the last event +Events in a chain are sorted chronologically automatically +} +function db_event_next(hContact:TMCONTACT; hDbEvent:TMEVENT):THANDLE; stdcall; + external CoreDLL name 'db_event_next'; + +{ +Retrieves a handle to the previous event in a chain before hDbEvent +Returns the handle, or NULL if hDbEvent is invalid or is the first event +Events in a chain are sorted chronologically automatically +} +function db_event_prev(hContact:TMCONTACT; hDbEvent:TMEVENT):THANDLE; stdcall; + external CoreDLL name 'db_event_prev'; + +function db_free(dbv:PDBVARIANT):int_ptr; stdcall; + external CoreDLL name 'db_free'; + +(****************************************************************************** + * DATABASE CONTACTS + *) + +{ +Gets the handle of the first contact in the database. This handle can be used +with loads of functions. It does not need to be closed. +You can specify szProto to find only its contacts +Returns a handle to the first contact in the db on success, or NULL if there +are no contacts in the db. +} +function db_find_first(const szModule:PAnsiChar=nil):TMCONTACT; stdcall; + external CoreDLL name 'db_find_first'; + +{ +Gets the handle of the next contact after hContact in the database. This handle +can be used with loads of functions. It does not need to be closed. +You can specify szProto to find only its contacts +Returns a handle to the contact after hContact in the db on success or NULL if +hContact was the last contact in the db or hContact was invalid. +} +function db_find_next(hContact:TMCONTACT; const szModule:PAnsiChar=nil):TMCONTACT; stdcall; + external CoreDLL name 'db_find_next'; + +(****************************************************************************** + * DATABASE SETTINGS + *) + +function db_get(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; dbv:PDBVARIANT):int_ptr; stdcall; + external CoreDLL name 'db_get'; +function db_get_b(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; errorValue:int):int; stdcall; + external CoreDLL name 'db_get_b'; +function db_get_w(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; errorValue:int):int; stdcall; + external CoreDLL name 'db_get_w'; +function db_get_dw(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; errorValue:dword):dword; stdcall; + external CoreDLL name 'db_get_dw'; +function db_get_s(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; dbv:PDBVARIANT; const nType:int=DBVT_ASCIIZ):int_ptr; stdcall; + external CoreDLL name 'db_get_s'; +function db_get_sa(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar):PAnsiChar; stdcall; + external CoreDLL name 'db_get_sa'; +function db_get_wsa(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar):PWideChar; stdcall; + external CoreDLL name 'db_get_wsa'; + +function db_get_static(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; szDest:PAnsiChar; destLen:int):int; stdcall; + external CoreDLL name 'db_get_static'; +function db_get_static_utf(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; szDest:PAnsiChar; destLen:int):int; stdcall; + external CoreDLL name 'db_get_static_utf'; +function db_get_wstatic(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; szDest:PWideChar; destLen:int):int; stdcall; + external CoreDLL name 'db_get_wstatic'; + +function db_set(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; dbv:PDBVARIANT):int_ptr; stdcall; + external CoreDLL name 'db_set'; +function db_set_b(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; val:byte):int_ptr; stdcall; + external CoreDLL name 'db_set_b'; +function db_set_w(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; val:word):int_ptr; stdcall; + external CoreDLL name 'db_set_w'; +function db_set_dw(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; val:dword):int_ptr; stdcall; + external CoreDLL name 'db_set_dw'; +function db_set_s(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; const val:PAnsiChar):int_ptr; stdcall; + external CoreDLL name 'db_set_s'; +function db_set_ws(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; const val:PWideChar):int_ptr; stdcall; + external CoreDLL name 'db_set_ws'; +function db_set_utf(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; const val:PAnsiChar):int_ptr; stdcall; + external CoreDLL name 'db_set_utf'; +function db_set_blob(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; val:pointer; len:uint):int_ptr; stdcall; + external CoreDLL name 'db_set_blob'; + +function db_unset(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar):int_ptr; stdcall; + external CoreDLL name 'db_unset'; + +function db_set_resident(const szModule:PAnsiChar; const szSetting:PAnsiChar; bEnable:int):int; stdcall; + external CoreDLL name 'db_set_resident'; + +// deprecated Aliases +function DBFreeVariant(dbv:PDBVARIANT):int_ptr; stdcall; + external CoreDLL name 'db_free'; +function DBDeleteContactSetting(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar):int_ptr; stdcall; + external CoreDLL name 'db_unset'; +function DBGetContactSettingByte(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; errorValue:int):int; stdcall; + external CoreDLL name 'db_get_b'; +function DBGetContactSettingWord(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; errorValue:int):int; stdcall; + external CoreDLL name 'db_get_w'; +function DBGetContactSettingDWord(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; errorValue:dword):dword; stdcall; + external CoreDLL name 'db_get_dw'; +function DBGetContactSetting(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; dbv:PDBVARIANT):int_ptr; stdcall; + external CoreDLL name 'db_get'; +function DBGetContactSettingStr(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; dbv:PDBVARIANT; const nType:int=DBVT_ASCIIZ):int_ptr; stdcall; + external CoreDLL name 'db_get_s'; +function DBGetContactSettingString(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar):PAnsiChar; stdcall; + external CoreDLL name 'db_get_sa'; +function DBGetContactSettingWString(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar):PWideChar; stdcall; + external CoreDLL name 'db_get_wsa'; + +function DBWriteContactSettingByte(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; val:byte):int_ptr; stdcall; + external CoreDLL name 'db_set_b'; +function DBWriteContactSettingWord(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; val:word):int_ptr; stdcall; + external CoreDLL name 'db_set_w'; +function DBWriteContactSettingDWord(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; val:dword):int_ptr; stdcall; + external CoreDLL name 'db_set_dw'; +function DBWriteContactSettingString(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; const val:PAnsiChar):int_ptr; stdcall; + external CoreDLL name 'db_set_s'; +function DBWriteContactSettingWString(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; const val:PWideChar):int_ptr; stdcall; + external CoreDLL name 'db_set_ws'; +function DBWriteContactSettingUTF8String(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; const val:PAnsiChar):int_ptr; stdcall; + external CoreDLL name 'db_set_utf'; +function DBWriteContactSettingBlob(hContact:TMCONTACT; const szModule:PAnsiChar; const szSetting:PAnsiChar; val:pointer; len:uint):int_ptr; stdcall; + external CoreDLL name 'db_set_blob'; + + const { wParam : size of the buffer to be filled diff --git a/include/delphi/m_helpers.inc b/include/delphi/m_helpers.inc index 87a56d34c9..2eb70b9478 100644 --- a/include/delphi/m_helpers.inc +++ b/include/delphi/m_helpers.inc @@ -400,15 +400,15 @@ end; function CreateProtoServiceFunction(const szModule, szService: PAnsiChar; serviceProc: TMIRANDASERVICE): int_ptr; var - szStr: array[0..MAXMODULELABELLENGTH*2] of AnsiChar; + szStr: array [0..MAXMODULELABELLENGTH*2] of AnsiChar; begin if (szModule=nil) or (szService=nil) then begin result:=0; exit; end; - lstrcpya(szStr, szModule); - lstrcata(szStr, szService); + lstrcpya(@szStr, szModule); + lstrcata(@szStr, szService); Result := CreateServiceFunction(szStr, @serviceProc); end; diff --git a/include/delphi/m_imgsrvc.inc b/include/delphi/m_imgsrvc.inc index 374e39b869..66440fe525 100644 --- a/include/delphi/m_imgsrvc.inc +++ b/include/delphi/m_imgsrvc.inc @@ -402,42 +402,49 @@ const memory mapped files). } -type +//type //!! // FREE_IMAGE_FORMAT = type integer; -{( - FIF_UNKNOWN = -1, - FIF_BMP = 0, - FIF_ICO = 1, - FIF_JPEG = 2, - FIF_JNG = 3, - FIF_KOALA = 4, - FIF_LBM = 5, - FIF_IFF = FIF_LBM, - FIF_MNG = 6, - FIF_PBM = 7, - FIF_PBMRAW = 8, - FIF_PCD = 9, - FIF_PCX = 10, - FIF_PGM = 11, - FIF_PGMRAW = 12, - FIF_PNG = 13, - FIF_PPM = 14, - FIF_PPMRAW = 15, - FIF_RAS = 16, - FIF_TARGA = 17, - FIF_TIFF = 18, - FIF_WBMP = 19, - FIF_PSD = 20, - FIF_CUT = 21, - FIF_XBM = 22, - FIF_XPM = 23, - FIF_DDS = 24, - FIF_GIF = 25, - FIF_HDR = 26, - FIF_FAXG3 = 27, - FIF_SGI = 28 -);} +const + FIF_UNKNOWN = -1; + FIF_BMP = 0; + FIF_ICO = 1; + FIF_JPEG = 2; + FIF_JNG = 3; + FIF_KOALA = 4; + FIF_LBM = 5; + FIF_IFF = FIF_LBM; + FIF_MNG = 6; + FIF_PBM = 7; + FIF_PBMRAW = 8; + FIF_PCD = 9; + FIF_PCX = 10; + FIF_PGM = 11; + FIF_PGMRAW = 12; + FIF_PNG = 13; + FIF_PPM = 14; + FIF_PPMRAW = 15; + FIF_RAS = 16; + FIF_TARGA = 17; + FIF_TIFF = 18; + FIF_WBMP = 19; + FIF_PSD = 20; + FIF_CUT = 21; + FIF_XBM = 22; + FIF_XPM = 23; + FIF_DDS = 24; + FIF_GIF = 25; + FIF_HDR = 26; + FIF_FAXG3 = 27; + FIF_SGI = 28; + FIF_EXR = 29; + FIF_J2K = 30; + FIF_JP2 = 31; + FIF_PFM = 32; + FIF_PICT = 33; + FIF_RAW = 34; + +type TIMGSRVC_MEMIO = record iLen:cardinal; // length of the buffer pBuf:pointer; // the buffer itself (you are responsible for allocating and free'ing it) -- cgit v1.2.3