From e84b97a0622a26fe474ccd840dcadb320520601c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 3 Feb 2014 20:11:26 +0000 Subject: - new helpers for reading db strings into static buffers; - MS_DB_CONTACT_GETSETTINGSTATIC died; - DBCONTACTGETSETTING is detouched from all services; - these service calls are rewritten using parameters git-svn-id: http://svn.miranda-ng.org/main/trunk@8035 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/delphi/m_core.inc | 7 ++++++ include/delphi/m_database.inc | 53 ++++++++++++++----------------------------- 2 files changed, 24 insertions(+), 36 deletions(-) (limited to 'include/delphi') diff --git a/include/delphi/m_core.inc b/include/delphi/m_core.inc index b02b09e61d..79bbe29b3f 100644 --- a/include/delphi/m_core.inc +++ b/include/delphi/m_core.inc @@ -280,6 +280,13 @@ function db_get_sa(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:p function db_get_wsa(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar):pWideChar; stdcall; external CoreDLL name 'db_get_wsa'; +function db_get_static(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; szDest:pAnsiChar; destLen:int):int; stdcall; + external CoreDLL name 'db_get_static'; +function db_get_static_utf(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; szDest:pAnsiChar; destLen:int):int; stdcall; + external CoreDLL name 'db_get_static_utf'; +function db_get_wstatic(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; szDest:pWideChar; destLen:int):int; stdcall; + external CoreDLL name 'db_get_wstatic'; + function db_set(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; dbv:PDBVARIANT):int_ptr; stdcall; external CoreDLL name 'db_set'; function db_set_b(hContact:THANDLE; const szModule:pAnsiChar; const szSetting:pAnsiChar; val:byte):int_ptr; stdcall; diff --git a/include/delphi/m_database.inc b/include/delphi/m_database.inc index ce6b56ac6e..f02c506806 100644 --- a/include/delphi/m_database.inc +++ b/include/delphi/m_database.inc @@ -58,44 +58,25 @@ type value : TDBVARIANT; // variant containing value to set end; -const - { - wParam : Handle for a contact to query a setting for - lParam : Pointer to a TDBCONTACTGETSETTING structure - affects: This service is almost the same as the one above, but it does - not return a dynamic copy (with malloc()) -- the caller - must do this for datatypes which require it, e.g. a string. - - This means the TDBCONTACTGETSETTING.pValue *has* to exist and be - allocated by the caller (doesn't have to be allocated from the heap) - the DBVARIANT structure has to be initalised with the type wanted - and enough buffer space around to return the info, do not - expect this service to be as fast as the one above. - - returns: 0 on success, non zero on failure. + wParam : Handle of a contact to enum settings for + lParam : Pointer to a TDBCONTACTENUMSETTINGS structure, must be initalised + affect : Enumerates all settings for a given contact under a module, + TDBCONTACTENUMSETTINGS must be filled with the function pointer to call + the TDBCONTACTENUMSETTINGS.lParam value to pass to it each time, + as well as the .szModule under which the contact is valid + returns: returns the value of the last call to the enum function, or -1 + if no settings could be enumerated + notes : the szSetting argument passed to the enumeration function is only + valid for the duration of that enumeration call, + it must be allocated dynamically if it is required after that call frame + has returned. + Also, deleting settings as they are enumerated has unpredictable results! + but writing a new value for a setting is okay. + it is unclear how you stop the enumeration once it is started, maybe + possible to return -1 to stop it. + vesion : only valid for 0.1.0.1+ } - MS_DB_CONTACT_GETSETTINGSTATIC:PAnsiChar = 'DB/Contact/GetSettingStatic'; - - { - wParam : Handle of a contact to enum settings for - lParam : Pointer to a TDBCONTACTENUMSETTINGS structure, must be initalised - affect : Enumerates all settings for a given contact under a module, - TDBCONTACTENUMSETTINGS must be filled with the function pointer to call - the TDBCONTACTENUMSETTINGS.lParam value to pass to it each time, - as well as the .szModule under which the contact is valid - returns: returns the value of the last call to the enum function, or -1 - if no settings could be enumerated - notes : the szSetting argument passed to the enumeration function is only - valid for the duration of that enumeration call, - it must be allocated dynamically if it is required after that call frame - has returned. - Also, deleting settings as they are enumerated has unpredictable results! - but writing a new value for a setting is okay. - it is unclear how you stop the enumeration once it is started, maybe - possible to return -1 to stop it. - vesion : only valid for 0.1.0.1+ - } type TDBSETTINGENUMPROC = function(const szSetting: PAnsiChar; lParam: LPARAM): int; cdecl; -- cgit v1.2.3