summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/m_core.h60
-rw-r--r--include/m_system.h155
-rw-r--r--include/m_system_cpp.h1
-rw-r--r--include/m_utils.h79
4 files changed, 57 insertions, 238 deletions
diff --git a/include/m_core.h b/include/m_core.h
index 0aeff8ae2f..d1122460d7 100644
--- a/include/m_core.h
+++ b/include/m_core.h
@@ -196,6 +196,24 @@ MIR_CORE_DLL(void) List_Copy(SortedList* s, SortedList* d, size_t itemSiz
MIR_CORE_DLL(void) List_ObjCopy(SortedList* s, SortedList* d, size_t itemSize);
///////////////////////////////////////////////////////////////////////////////
+// md5 functions
+
+/* Define the state of the MD5 Algorithm. */
+typedef unsigned char mir_md5_byte_t; /* 8-bit byte */
+typedef unsigned int mir_md5_word_t; /* 32-bit word */
+
+typedef struct mir_md5_state_s {
+ mir_md5_word_t count[2]; /* message length in bits, lsw first */
+ mir_md5_word_t abcd[4]; /* digest buffer */
+ mir_md5_byte_t buf[64]; /* accumulate block */
+} mir_md5_state_t;
+
+MIR_CORE_DLL(void) mir_md5_init(mir_md5_state_t *pms);
+MIR_CORE_DLL(void) mir_md5_append(mir_md5_state_t *pms, const mir_md5_byte_t *data, int nbytes);
+MIR_CORE_DLL(void) mir_md5_finish(mir_md5_state_t *pms, mir_md5_byte_t digest[16]);
+MIR_CORE_DLL(void) mir_md5_hash(const mir_md5_byte_t *data, int len, mir_md5_byte_t digest[16]);
+
+///////////////////////////////////////////////////////////////////////////////
// memory functions
MIR_CORE_DLL(void*) mir_alloc(size_t);
@@ -241,6 +259,26 @@ MIR_CORE_DLL(int) mir_vsnprintf(char *buffer, size_t count, const char* fmt,
MIR_CORE_DLL(int) mir_vsntprintf(TCHAR *buffer, size_t count, const TCHAR* fmt, va_list va);
///////////////////////////////////////////////////////////////////////////////
+// sha1 functions
+
+typedef unsigned char mir_sha1_byte_t;
+typedef unsigned long mir_sha1_long_t;
+
+#define MIR_SHA1_HASH_SIZE 20
+
+typedef struct {
+ mir_sha1_long_t H[5];
+ mir_sha1_long_t W[80];
+ int lenW;
+ mir_sha1_long_t sizeHi, sizeLo;
+} mir_sha1_ctx;
+
+MIR_CORE_DLL(void) mir_sha1_init(mir_sha1_ctx *ctx);
+MIR_CORE_DLL(void) mir_sha1_append(mir_sha1_ctx *ctx, mir_sha1_byte_t *dataIn, int len);
+MIR_CORE_DLL(void) mir_sha1_finish(mir_sha1_ctx *ctx, mir_sha1_byte_t hashout[20]);
+MIR_CORE_DLL(void) mir_sha1_hash(mir_sha1_byte_t *dataIn, int len, mir_sha1_byte_t hashout[20]);
+
+///////////////////////////////////////////////////////////////////////////////
// strings
MIR_CORE_DLL(char*) rtrim(char *str);
@@ -329,12 +367,28 @@ public:
///////////////////////////////////////////////////////////////////////////////
// threads
+typedef void (__cdecl *pThreadFunc)(void*);
+typedef unsigned (__stdcall *pThreadFuncEx)(void*);
+typedef unsigned (__cdecl *pThreadFuncOwner)(void *owner, void* param);
+
MIR_CORE_DLL(INT_PTR) UnwindThreadPush(WPARAM wParam, LPARAM lParam);
MIR_CORE_DLL(INT_PTR) UnwindThreadPop(WPARAM, LPARAM);
MIR_CORE_DLL(void) UnwindThreadWait(void);
-MIR_CORE_DLL(UINT_PTR) forkthread( void (__cdecl *threadcode)(void*), unsigned long stacksize, void *arg);
-MIR_CORE_DLL(UINT_PTR) forkthreadex(void *sec, unsigned stacksize, unsigned (__stdcall *threadcode)(void*), void* owner, void *arg, unsigned *thraddr);
+MIR_CORE_DLL(UINT_PTR) forkthread(pThreadFunc, unsigned long stacksize, void *arg);
+MIR_CORE_DLL(UINT_PTR) forkthreadex(void *sec, unsigned stacksize, pThreadFuncEx, void* owner, void *arg, unsigned *thraddr);
+
+_inline HANDLE mir_forkthread(pThreadFunc aFunc, void* arg)
+{ return (HANDLE)forkthread(aFunc, 0, arg);
+}
+
+__inline HANDLE mir_forkthreadex(pThreadFuncEx aFunc, void* arg, int stackSize, unsigned* pThreadID)
+{ return (HANDLE)forkthreadex(NULL, stackSize, aFunc, NULL, arg, pThreadID);
+}
+
+__inline HANDLE mir_forkthreadowner(pThreadFuncOwner aFunc, void* owner, void* arg, unsigned* pThreadID)
+{ return (HANDLE)forkthreadex(NULL, 0, (pThreadFuncEx)aFunc, owner, arg, pThreadID);
+}
MIR_CORE_DLL(void) KillObjectThreads(void* pObject);
@@ -386,7 +440,7 @@ __forceinline char* mir_utf8decodeA(const char* src)
#endif
#ifndef MIR_CORE_EXPORTS
- #if !defined( _WIN64 )
+ #if !defined( WIN64 )
#pragma comment(lib, "mir_core.lib")
#else
#pragma comment(lib, "mir_core64.lib")
diff --git a/include/m_system.h b/include/m_system.h
index ffca735b4a..e8c22a9124 100644
--- a/include/m_system.h
+++ b/include/m_system.h
@@ -132,121 +132,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//returns 0 on success or nonzero on failure.
#define MS_SYSTEM_REMOVEWAIT "Miranda/System/RemoveWait"
-/* Returns Miranda's RTL/CRT function poiners to malloc() free() realloc() -- 0.1.2.2+
-This is useful for preallocation of memory for use with Miranda's services
-that Miranda can free -- or reallocation of a block of memory passed with a service.
-Do not use with memory unless it is explicitly expected the memory *can*
-or *shall* be used in this way. the passed structure is expected to have it's .cbSize initialised
-
-wParam=0, lParam = (LPARAM) &MM_INTERFACE
-*/
-
-struct MM_INTERFACE
-{
- size_t cbSize;
- void* (*mmi_malloc) (size_t);
- void* (*mmi_realloc) (void*, size_t);
- void (*mmi_free) (void*);
-
- void* (*mmi_calloc) (size_t);
- char* (*mmi_strdup) (const char *src);
- wchar_t* (*mmi_wstrdup) (const wchar_t *src);
- int (*mir_snprintf) (char *buffer, size_t count, const char* fmt, ...);
- int (*mir_sntprintf) (TCHAR *buffer, size_t count, const TCHAR* fmt, ...);
- int (*mir_vsnprintf) (char *buffer, size_t count, const char* fmt, va_list va);
- 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)(const char* src);
- char* (*mir_u2a_cp)(const wchar_t* src, int codepage);
- char* (*mir_u2a)(const wchar_t* src);
-};
-
-#define MS_SYSTEM_GET_MMI "Miranda/System/GetMMI"
-
-__forceinline INT_PTR mir_getMMI(struct MM_INTERFACE* dest)
-{
- return 0;
-}
-
-/* Returns the pointer to the simple lists manager.
-If the sortFunc member of the list gets assigned, the list becomes sorted
-
-wParam=0, lParam = (LPARAM)LIST_INTERFACE*
-*/
-
-struct LIST_INTERFACE
-{
- size_t cbSize;
-
- SortedList* (*List_Create)(int, int);
- void (*List_Destroy)(SortedList*);
-
- void* (*List_Find)(SortedList*, void*);
- int (*List_GetIndex)(SortedList*, void*, int*);
- int (*List_Insert)(SortedList*, void*, int);
- int (*List_Remove)(SortedList*, int);
- int (*List_IndexOf)(SortedList*, void*);
-
- int (*List_InsertPtr)(SortedList* list, void* p);
- int (*List_RemovePtr)(SortedList* list, void* p);
-
- void (*List_Copy)(SortedList* src, SortedList* dst, size_t);
- void (*List_ObjCopy)(SortedList* src, SortedList* dst, size_t);
-};
-
-#define MS_SYSTEM_GET_LI "Miranda/System/GetLI"
-
-__forceinline INT_PTR mir_getLI(struct LIST_INTERFACE* dest)
-{
- return 0;
-}
-
-/*
- UTF8 Manager interface. 0.5.2+
-
- Contains functions for utf8-strings encoding & decoding
-*/
-
-#define UTF8_INTERFACE_SIZEOF_V1 (sizeof(size_t)+5*sizeof(void*))
-#define UTF8_INTERFACE_SIZEOF_V2 (sizeof(size_t)+6*sizeof(void*))
-
-struct UTF8_INTERFACE
-{
- size_t cbSize;
-
- // decodes utf8 and places the result back into the same buffer.
- // if the second parameter is present, the additional wchar_t* string gets allocated,
- // and filled with the decoded utf8 content without any information loss.
- // this string should be freed using mir_free()
- char* (*utf8_decode)(char* str, wchar_t** ucs2);
- char* (*utf8_decodecp)(char* str, int codepage, wchar_t** ucs2);
-
- // encodes an ANSI string into a utf8 format using the current langpack code page,
- // or CP_ACP, if lanpack is missing
- // the resulting string should be freed using mir_free
- char* (*utf8_encode)(const char* src);
- char* (*utf8_encodecp)(const char* src, int codepage);
-
- // encodes an WCHAR string into a utf8 format
- // the resulting string should be freed using mir_free
- char* (*utf8_encodeW)(const wchar_t* src);
-
- // decodes utf8 and returns the result as wchar_t* that should be freed using mir_free()
- // the input buffer remains unchanged
- wchar_t* (*utf8_decodeW)(const char* str);
-
- // returns the predicted length of the utf-8 string
- int (*utf8_lenW)(const wchar_t* src);
-};
-
-#define MS_SYSTEM_GET_UTFI "Miranda/System/GetUTFI"
-
-__forceinline INT_PTR mir_getUTFI(struct UTF8_INTERFACE* dest)
-{
- return 0;
-}
-
/*
-- Thread Safety --
@@ -342,15 +227,8 @@ registers a thread in the core and forks it
*/
-typedef void (__cdecl *pThreadFunc)(void*);
-
#define MS_SYSTEM_FORK_THREAD "Miranda/Thread/Fork"
-__forceinline HANDLE mir_forkthread(pThreadFunc aFunc, void* arg)
-{
- return (HANDLE)CallService(MS_SYSTEM_FORK_THREAD, (WPARAM)aFunc, (LPARAM)arg);
-}
-
/* 0.5.2+
wParam=void* - thread owner object
lParam=FORK_THREADEX_PARAMS*
@@ -360,9 +238,6 @@ passes the extended parameters info and returns the thread id
*/
-typedef unsigned (__stdcall *pThreadFuncEx)(void* param);
-typedef unsigned (__cdecl *pThreadFuncOwner)(void *owner, void* param);
-
typedef struct
{
pThreadFuncEx pFunc;
@@ -374,36 +249,6 @@ typedef struct
#define MS_SYSTEM_FORK_THREAD_EX "Miranda/Thread/ForkEx"
-static __inline HANDLE mir_forkthreadex(pThreadFuncEx aFunc, void* arg, int stackSize, unsigned* pThreadID)
-{
- FORK_THREADEX_PARAMS params;
- params.pFunc = aFunc;
- params.arg = arg;
- params.iStackSize = stackSize;
- params.threadID = pThreadID;
- return (HANDLE)CallService(MS_SYSTEM_FORK_THREAD_EX, 0, (LPARAM)&params);
-}
-
-/* 0.8.0+
-wParam=(void*)owner
-lParam=FORK_THREADEX_PARAMS*
-
-registers a thread, owned by some object, in the core and forks it
-passes the owner info and extended parameters info and returns the thread id
-
-*/
-
-static __inline HANDLE mir_forkthreadowner(pThreadFuncOwner aFunc, void* owner, void* arg, unsigned* pThreadID)
-{
- FORK_THREADEX_PARAMS params;
- params.pFunc = (pThreadFuncEx)aFunc;
- params.arg = arg;
- params.iStackSize = 0;
- params.threadID = pThreadID;
- return (HANDLE)CallService(MS_SYSTEM_FORK_THREAD_EX, (WPARAM)owner, (LPARAM)&params);
-}
-
-
/*
wParam=0
lParam=0
diff --git a/include/m_system_cpp.h b/include/m_system_cpp.h
index 086eba0fc3..5815e410a4 100644
--- a/include/m_system_cpp.h
+++ b/include/m_system_cpp.h
@@ -32,7 +32,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
#if defined(__cplusplus)
-extern LIST_INTERFACE li;
#define NumericKeySortT -1
#define HandleKeySortT -2
diff --git a/include/m_utils.h b/include/m_utils.h
index ad8b99e46d..57cde573e4 100644
--- a/include/m_utils.h
+++ b/include/m_utils.h
@@ -432,85 +432,6 @@ __inline static TCHAR* Utils_ReplaceVarsT(const TCHAR *szData) {
#define MS_UTILS_GETBITMAPFILTERSTRINGST MS_UTILS_GETBITMAPFILTERSTRINGS
#endif
-/*
- MD5 interface. 0.7.0.12
-
- Contains functions for md5 handling
-*/
-/* Define the state of the MD5 Algorithm. */
-typedef unsigned char mir_md5_byte_t; /* 8-bit byte */
-typedef unsigned int mir_md5_word_t; /* 32-bit word */
-
-typedef struct mir_md5_state_s {
- mir_md5_word_t count[2]; /* message length in bits, lsw first */
- mir_md5_word_t abcd[4]; /* digest buffer */
- mir_md5_byte_t buf[64]; /* accumulate block */
-} mir_md5_state_t;
-
-struct MD5_INTERFACE
-{
- int cbSize;
- void (*md5_init) (mir_md5_state_t *pms);
- void (*md5_append) (mir_md5_state_t *pms, const mir_md5_byte_t *data, int nbytes);
- void (*md5_finish) (mir_md5_state_t *pms, mir_md5_byte_t digest[16]);
- void (*md5_hash) (const mir_md5_byte_t *data, int len, mir_md5_byte_t digest[16]);
-};
-
-#define MS_SYSTEM_GET_MD5I "Miranda/System/GetMD5I"
-
-static __inline INT_PTR mir_getMD5I(struct MD5_INTERFACE* dest)
-{
- dest->cbSize = sizeof(*dest);
- return CallService(MS_SYSTEM_GET_MD5I, 0, (LPARAM)dest);
-}
-
-extern struct MD5_INTERFACE md5i;
-
-#define mir_md5_init(A) md5i.md5_init(A)
-#define mir_md5_append(A,B,C) md5i.md5_append(A,B,C)
-#define mir_md5_finish(A,B) md5i.md5_finish(A,B)
-#define mir_md5_hash(A,B,C) md5i.md5_hash(A,B,C)
-
-/*
- SHA1 interface. 0.7.0.12
-
- Contains functions for SHA1 handling
-*/
-typedef unsigned char mir_sha1_byte_t;
-typedef unsigned long mir_sha1_long_t;
-#define MIR_SHA1_HASH_SIZE 20
-
-typedef struct {
- mir_sha1_long_t H[5];
- mir_sha1_long_t W[80];
- int lenW;
- mir_sha1_long_t sizeHi, sizeLo;
-} mir_sha1_ctx;
-
-struct SHA1_INTERFACE
-{
- int cbSize;
- void (*sha1_init) (mir_sha1_ctx *ctx);
- void (*sha1_append) (mir_sha1_ctx *ctx, mir_sha1_byte_t *dataIn, int len);
- void (*sha1_finish) (mir_sha1_ctx *ctx, mir_sha1_byte_t hashout[20]);
- void (*sha1_hash) (mir_sha1_byte_t *dataIn, int len, mir_sha1_byte_t hashout[20]);
-};
-
-#define MS_SYSTEM_GET_SHA1I "Miranda/System/GetSHA1I"
-
-static __inline INT_PTR mir_getSHA1I(struct SHA1_INTERFACE* dest)
-{
- dest->cbSize = sizeof(*dest);
- return CallService(MS_SYSTEM_GET_SHA1I, 0, (LPARAM)dest);
-}
-
-extern struct SHA1_INTERFACE sha1i;
-
-#define mir_sha1_init(A) sha1i.sha1_init(A)
-#define mir_sha1_append(A,B,C) sha1i.sha1_append(A,B,C)
-#define mir_sha1_finish(A,B) sha1i.sha1_finish(A,B)
-#define mir_sha1_hash(A,B,C) sha1i.sha1_hash(A,B,C)
-
// allows to include TCHAR* strings into mir_snprintf and NetLib_Logf calls
#if defined(_UNICODE)
#define TCHAR_STR_PARAM "%S"