From 89c5b2369413025e1fe7dfe5c5d0bf3bedd8558d Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Mon, 23 Jul 2012 13:52:57 +0000 Subject: git-svn-id: http://svn.miranda-ng.org/main/trunk@1123 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SMS/AdditionalFunctions/BuffToLowerCase.h | 56 ---- plugins/SMS/AdditionalFunctions/DebugFunctions.h | 101 ------- .../SMS/AdditionalFunctions/InterlockedFunctions.h | 127 -------- plugins/SMS/AdditionalFunctions/ListMT.h | 328 --------------------- plugins/SMS/AdditionalFunctions/MemoryCompare.h | 177 ----------- plugins/SMS/AdditionalFunctions/MemoryFind.h | 81 ----- plugins/SMS/AdditionalFunctions/MemoryFindByte.h | 71 ----- 7 files changed, 941 deletions(-) delete mode 100644 plugins/SMS/AdditionalFunctions/BuffToLowerCase.h delete mode 100644 plugins/SMS/AdditionalFunctions/DebugFunctions.h delete mode 100644 plugins/SMS/AdditionalFunctions/InterlockedFunctions.h delete mode 100644 plugins/SMS/AdditionalFunctions/ListMT.h delete mode 100644 plugins/SMS/AdditionalFunctions/MemoryCompare.h delete mode 100644 plugins/SMS/AdditionalFunctions/MemoryFind.h delete mode 100644 plugins/SMS/AdditionalFunctions/MemoryFindByte.h (limited to 'plugins/SMS/AdditionalFunctions') diff --git a/plugins/SMS/AdditionalFunctions/BuffToLowerCase.h b/plugins/SMS/AdditionalFunctions/BuffToLowerCase.h deleted file mode 100644 index d2bb7a6671..0000000000 --- a/plugins/SMS/AdditionalFunctions/BuffToLowerCase.h +++ /dev/null @@ -1,56 +0,0 @@ -#if !defined(AFX_BUFFTOLOWERCASE__H__INCLUDED_) -#define AFX_BUFFTOLOWERCASE__H__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - - - -__inline DWORD BuffToLowerCase(LPCVOID lpcOutBuff,LPCVOID lpcBuff,SIZE_T dwLen) -{ - DWORD dwRetErrorCode=NO_ERROR; - - __asm - { - mov ecx,dwLen - test ecx,ecx - jz short end_func - - push ebx // сохраняем регистр - push edi // сохраняем регистр - push esi // сохраняем регистр - mov esi,lpcBuff - mov edi,lpcOutBuff - mov bl,'A' - mov bh,'Z' - mov ah,32 - cld - - lowcaseloop: - lodsb - cmp al,bl - jl short savebyte - cmp al,bh - jg short savebyte - or al,ah - - savebyte: - stosb - - dec ecx - jnz short lowcaseloop - - pop esi // восстанавливаем содержимое регистра - pop edi // восстанавливаем содержимое регистра - pop ebx // восстанавливаем содержимое регистра - end_func: - } - -return(dwRetErrorCode); -} - - - - -#endif // !defined(AFX_BUFFTOLOWERCASE__H__INCLUDED_) \ No newline at end of file diff --git a/plugins/SMS/AdditionalFunctions/DebugFunctions.h b/plugins/SMS/AdditionalFunctions/DebugFunctions.h deleted file mode 100644 index 8b21d1bc5a..0000000000 --- a/plugins/SMS/AdditionalFunctions/DebugFunctions.h +++ /dev/null @@ -1,101 +0,0 @@ -#if !defined(AFX_DEBUG_FUNCTIONS__H__INCLUDED_) -#define AFX_DEBUG_FUNCTIONS__H__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#ifndef szCRLF -#define szCRLF TEXT("\r\n") -#endif -////////////////////////////////////////////////////////////////////////// -////////////////////////////DebugPrint//////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -// DebugBuildPrint(Helo world); -// Отображение текста в Debug окне во время отладки -#ifdef _DEBUG - #define DebugPrintA(szText) OutputDebugStringA((szText)) - #define DebugPrintW(szText) OutputDebugStringW((szText)) - #define DebugPrintCRLFA(szText) OutputDebugStringA((szText));OutputDebugStringA("\r\n") - #define DebugPrintCRLFW(szText) OutputDebugStringW((szText));OutputDebugStringW(L"\r\n") -#else - #define DebugPrintA(szText) - #define DebugPrintW(szText) - #define DebugPrintCRLFA(szText) - #define DebugPrintCRLFW(szText) -#endif //_DEBUG - - -#ifdef UNICODE - #define DebugPrint DebugPrintW - #define DebugPrintCRLF DebugPrintCRLFW -#else - #define DebugPrint DebugPrintA - #define DebugPrintCRLF DebugPrintCRLFA -#endif -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// - - - - -////////////////////////////////////////////////////////////////////////// -////////////////////////////DebugBuildPrint/////////////////////////////// -////////////////////////////////////////////////////////////////////////// -// #pragma DebugBuildPrint(Helo world); -// Отображение сообщений в Build окне во время компиляции -#ifdef _DEBUG - #pragma warning(disable:4081) - #define chSTR2(x) #x - #define chSTR(x) chSTR2(x) - #define DebugBuildPrint(szText) message(__FILE__ "(" chSTR(__LINE__) "): " #szText) - #pragma warning(default:4081) -#else - #define DebugBuildPrint(szText) -#endif //_DEBUG -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// - - - - -////////////////////////////////////////////////////////////////////////// -////////////////////////////DebugBufferFill/////////////////////////////// -////////////////////////////////////////////////////////////////////////// -// DebugBufferFill(szString,sizeof(szString)); -// Полностью заполняет переданный буффер символом "A", применяется -// для выходного буффера на входе в функцию. -#ifdef _DEBUG - #define DebugBufferFill(lpBuffer,dwSize) memset(lpBuffer,'A',dwSize) -#else - #define DebugBufferFill(lpBuffer,dwSize) -#endif //_DEBUG -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// - - - - -////////////////////////////////////////////////////////////////////////// -////////////////////////////DebugBreak//////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -// DebugBreak(); -// Точка останова, более удобная альтернатива API -#if defined(_DEBUG) && defined(_X86_) - #define DebugBreak() _asm{int 3} -#else - #define DebugBreak() -#endif //_DEBUG -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// - - - - - - -#endif // !defined(AFX_DEBUG_FUNCTIONS__H__INCLUDED_) diff --git a/plugins/SMS/AdditionalFunctions/InterlockedFunctions.h b/plugins/SMS/AdditionalFunctions/InterlockedFunctions.h deleted file mode 100644 index 3fb008b216..0000000000 --- a/plugins/SMS/AdditionalFunctions/InterlockedFunctions.h +++ /dev/null @@ -1,127 +0,0 @@ -#if !defined(AFX_INTERLOCKED_FUNCTIONS__H__INCLUDED_) -#define AFX_INTERLOCKED_FUNCTIONS__H__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - - - - - -#ifdef InterlockedCompareExchange -#ifndef InterlockedAnd -LONG FORCEINLINE InterlockedAnd(LONG volatile *Destination,LONG Value) -{ - LONG Old; - - do - { - Old=*Destination; - }while(InterlockedCompareExchange(Destination,(Old&Value),Old)!=Old); -return(Old); -} -#endif //InterlockedAnd - - -#ifndef InterlockedOr -LONG FORCEINLINE InterlockedOr(LONG volatile *Destination,LONG Value) -{ - LONG Old; - - do - { - Old=*Destination; - }while(InterlockedCompareExchange(Destination,(Old|Value),Old)!=Old); -return(Old); -} -#endif //InterlockedOr - - -#ifndef InterlockedXor -LONG FORCEINLINE InterlockedXor(LONG volatile *Destination,LONG Value) -{ - LONG Old; - - do - { - Old=*Destination; - }while(InterlockedCompareExchange(Destination,(Old^Value),Old)!=Old); -return(Old); -} -#endif //InterlockedXor -#endif //InterlockedCompareExchange - - - - - -#ifdef InterlockedCompareExchange64 -#ifndef InterlockedAnd64 -LONGLONG FORCEINLINE InterlockedAnd64(LONGLONG volatile *Destination,LONGLONG Value) -{ - LONGLONG Old; - - do - { - Old=*Destination; - }while(InterlockedCompareExchange64(Destination,(Old&Value),Old)!=Old); -return(Old); -} -#endif //InterlockedAnd64 - - -#ifndef InterlockedOr64 -LONGLONG FORCEINLINE InterlockedOr64(LONGLONG volatile *Destination,LONGLONG Value) -{ - LONGLONG Old; - - do - { - Old=*Destination; - }while(InterlockedCompareExchange64(Destination,(Old|Value),Old)!=Old); -return(Old); -} -#endif //InterlockedOr64 - - -#ifndef InterlockedXor64 -LONGLONG FORCEINLINE InterlockedXor64(LONGLONG volatile *Destination,LONGLONG Value) -{ - LONGLONG Old; - - do - { - Old=*Destination; - }while(InterlockedCompareExchange64(Destination,(Old^Value),Old)!=Old); -return(Old); -} -#endif //InterlockedXor64 -#endif //InterlockedCompareExchange64 - - - - - -#ifndef InterlockedIncrementPointer -#if defined(_WIN64) -#define InterlockedIncrementPointer(lpAddend) (LPVOID)InterlockedIncrement64((LONGLONG volatile*)lpAddend) -#else -#define InterlockedIncrementPointer(lpAddend) (LPVOID)InterlockedIncrement((LONG volatile*)lpAddend) -#endif -#endif //InterlockedIncrementPointer - - -#ifndef InterlockedDecrementPointer -#if defined(_WIN64) -#define InterlockedDecrementPointer(lpAddend) (LPVOID)InterlockedDecrement64((LONGLONG volatile*)lpAddend) -#else -#define InterlockedDecrementPointer(lpAddend) (LPVOID)InterlockedDecrement((LONG volatile*)lpAddend) -#endif -#endif //InterlockedDecrementPointer - - - - - -#endif // !defined(AFX_INTERLOCKED_FUNCTIONS__H__INCLUDED_) diff --git a/plugins/SMS/AdditionalFunctions/ListMT.h b/plugins/SMS/AdditionalFunctions/ListMT.h deleted file mode 100644 index 7cf1e81808..0000000000 --- a/plugins/SMS/AdditionalFunctions/ListMT.h +++ /dev/null @@ -1,328 +0,0 @@ -#if !defined(AFX_LIST_MT__H__INCLUDED_) -#define AFX_LIST_MT__H__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - - -#include - -#if defined(_MSC_VER) -#if _MSC_VER >= 800 -#if _MSC_VER >= 1200 -#pragma warning(push) -#endif -#pragma warning(disable:4312) // warning C4312: 'type cast' : conversion from 'LONG' to 'PVOID' of greater size -#endif -#endif - - -// структура для работы со списком, элемент списка -typedef struct _LIST_MT_ITEM -{ -#ifdef __cplusplus - _LIST_MT_ITEM *plmtiPrev; // *предыдущий элемент в списке - _LIST_MT_ITEM *plmtiNext; // *следующий элемент в списке -#else - LPVOID *plmtiPrev; // *предыдущий элемент в списке - LPVOID *plmtiNext; // *следующий элемент в списке -#endif - LPVOID lpData; // указатель на данные, связанные с элементом списка - LPVOID lpListMT; // указатель на заголовок списка, см структуру ниже -}LIST_MT_ITEM, *PLIST_MT_ITEM, *LPLIST_MT_ITEM; -typedef CONST PLIST_MT_ITEM PCLIST_MT_ITEM, LPCLIST_MT_ITEM; - - -// структура для работы со списком, заголовок списка -typedef struct _LIST_MT -{ - SIZE_T nCount; // *колличество элементов в списке - PLIST_MT_ITEM plmtiFirst; // *указывает на первый элемент в списке - PLIST_MT_ITEM plmtiLast; // *указывает на последний элемент в списке - CRITICAL_SECTION cs; // *section for exclysive access to List -}LIST_MT, *PLIST_MT, *LPLIST_MT; -typedef CONST PLIST_MT PCLIST_MT, LPCLIST_MT; - - -// структура для работы с итератором -typedef struct _LIST_MT_ITERATOR -{ - PLIST_MT_ITEM plmtListMTItem; -}LIST_MT_ITERATOR, *PLIST_MT_ITERATOR, *LPLIST_MT_ITERATOR; -//typedef LIST_MT_ITEM LIST_MT_ITERATOR, *PLIST_MT_ITERATOR, *LPLIST_MT_ITERATOR; -typedef CONST PLIST_MT_ITERATOR PCLIST_MT_ITERATOR, LPCLIST_MT_ITERATOR; - - - - -__inline DWORD ListMTInitialize(PCLIST_MT pclmtListMT,DWORD dwSpinCount) -{ - DWORD dwRetErrorCode; - -#if (_WIN32_WINNT >= 0x0403) - if (InitializeCriticalSectionAndSpinCount(&pclmtListMT->cs,((dwSpinCount)? (dwSpinCount | 0x80000000):0L))) -#else - InitializeCriticalSection(&pclmtListMT->cs); - if (TRUE) -#endif - { - InterlockedExchangePointer(&pclmtListMT->nCount,NULL); - pclmtListMT->plmtiFirst=NULL; - pclmtListMT->plmtiLast=NULL; - dwRetErrorCode=NO_ERROR; - }else{ - dwRetErrorCode=GetLastError(); - } -return(dwRetErrorCode); -} - - -__inline void ListMTDestroy(PCLIST_MT pclmtListMT) -{ - InterlockedExchangePointer(&pclmtListMT->nCount,NULL); - pclmtListMT->plmtiFirst=NULL; - pclmtListMT->plmtiLast=NULL; - DeleteCriticalSection(&pclmtListMT->cs); -} - - -__inline BOOL ListMTTryLock(PCLIST_MT pclmtListMT) -{ -#if (_WIN32_WINNT >= 0x0400) - return(TryEnterCriticalSection(&pclmtListMT->cs)); -#else - return(FALSE); -#endif -} - - -__inline void ListMTLock(PCLIST_MT pclmtListMT) -{ - EnterCriticalSection(&pclmtListMT->cs); -} - - -__inline void ListMTUnLock(PCLIST_MT pclmtListMT) -{ - LeaveCriticalSection(&pclmtListMT->cs); -} - - -__inline SIZE_T ListMTGetCount(PCLIST_MT pclmtListMT) -{ - return((SIZE_T)InterlockedCompareExchangePointer((LPVOID*)&pclmtListMT->nCount,NULL,NULL)); -} - - -__inline SIZE_T ListMTItemAdd(PCLIST_MT pclmtListMT,PCLIST_MT_ITEM pclmtListMTItem,LPVOID lpData) -{ - SIZE_T dwRet=(SIZE_T)InterlockedIncrementPointer(&pclmtListMT->nCount);//pclmtListMT->nCount++; - pclmtListMTItem->lpData=lpData; - pclmtListMTItem->lpListMT=pclmtListMT; - - if (pclmtListMT->plmtiLast) - {// add node to end of list - pclmtListMTItem->plmtiPrev=pclmtListMT->plmtiLast; - pclmtListMTItem->plmtiNext=NULL; - pclmtListMT->plmtiLast->plmtiNext=pclmtListMTItem; - pclmtListMT->plmtiLast=pclmtListMTItem; - }else{// add the first node to the linked list - pclmtListMTItem->plmtiPrev=NULL; - pclmtListMTItem->plmtiNext=NULL; - pclmtListMT->plmtiFirst=pclmtListMTItem; - pclmtListMT->plmtiLast=pclmtListMTItem; - } - -return(dwRet); -} - - -__inline DWORD ListMTItemDelete(PCLIST_MT pclmtListMT,PCLIST_MT_ITEM pclmtListMTItem) -{ - DWORD dwRetErrorCode; - - if (pclmtListMTItem->lpListMT==pclmtListMT && pclmtListMT) - {// Данный элемент принадлежит к этому списку, можно удалить. - PLIST_MT_ITEM plmtiPrevNode=pclmtListMTItem->plmtiPrev,plmtiNextNode=pclmtListMTItem->plmtiNext; - - if (plmtiPrevNode || plmtiNextNode) - { - if (plmtiPrevNode && plmtiNextNode==NULL) - {// This is the start node in the list to delete - // отключился последний подключившийся - plmtiPrevNode->plmtiNext=NULL; - pclmtListMT->plmtiLast=plmtiPrevNode; - }else{ - if (plmtiPrevNode==NULL && plmtiNextNode) - {// This is the end node in the list to delete - // отключился первый подключившийся - plmtiNextNode->plmtiPrev=NULL; - pclmtListMT->plmtiFirst=plmtiNextNode; - }else{// оключился клиент не первый и не последний - //if (plmtiPrev && plmtiNext) - {// Neither start node nor end node in the list - plmtiPrevNode->plmtiNext=plmtiNextNode; - plmtiNextNode->plmtiPrev=plmtiPrevNode; - } - } - } - }else{// This is the only node in the list to delete - pclmtListMT->plmtiFirst=NULL; - pclmtListMT->plmtiLast=NULL; - } - - pclmtListMTItem->lpListMT=NULL; - InterlockedDecrementPointer(&pclmtListMT->nCount);// pclmtListMT->nCount--; - dwRetErrorCode=NO_ERROR; - }else{// попытались удалить элемент не относящийся к данному списку - dwRetErrorCode=ERROR_INVALID_HANDLE; - } -return(dwRetErrorCode); -} - - -__inline LPVOID ListMTItemDataGet(PCLIST_MT_ITEM pclmtListMTItem) -{ - return(pclmtListMTItem->lpData); -} - - -__inline void ListMTItemDataSet(PCLIST_MT_ITEM pclmtListMTItem, LPVOID lpData) -{ - pclmtListMTItem->lpData=lpData; -} - - -__inline DWORD ListMTItemGetFirst(PCLIST_MT pclmtListMT,PLIST_MT_ITEM *pplmtListMTItem,LPVOID *plpData) -{// если нужно гарантировать эксклюзивный доступ, то есть ListMTLock и ListMTUnLock - DWORD dwRetErrorCode; - - if (pclmtListMT->plmtiFirst) - { - if (pplmtListMTItem) (*pplmtListMTItem)=pclmtListMT->plmtiFirst; - if (plpData) (*plpData)=pclmtListMT->plmtiFirst->lpData; - dwRetErrorCode=NO_ERROR; - }else{ - dwRetErrorCode=ERROR_NO_MORE_ITEMS; - } -return(dwRetErrorCode); -} - - -__inline DWORD ListMTItemGetLast(PCLIST_MT pclmtListMT,PLIST_MT_ITEM *pplmtListMTItem,LPVOID *plpData) -{// если нужно гарантировать эксклюзивный доступ, то есть ListMTLock и ListMTUnLock - DWORD dwRetErrorCode; - - if (pclmtListMT->plmtiLast) - { - if (pplmtListMTItem) (*pplmtListMTItem)=pclmtListMT->plmtiLast; - if (plpData) (*plpData)=pclmtListMT->plmtiLast->lpData; - dwRetErrorCode=NO_ERROR; - }else{ - dwRetErrorCode=ERROR_NO_MORE_ITEMS; - } -return(dwRetErrorCode); -} - - - -__inline void ListMTItemSwap(PCLIST_MT pclmtListMT,PCLIST_MT_ITEM pclmtListMTItem1,PCLIST_MT_ITEM pclmtListMTItem2) -{// поменять два элемента списка местами, даже если они из разных списков - - if (pclmtListMTItem1!=pclmtListMTItem2) - {// это разные элементы списка - PLIST_MT_ITEM lpTemp; - - lpTemp=pclmtListMTItem1->plmtiPrev; - if ((pclmtListMTItem1->plmtiPrev=pclmtListMTItem2->plmtiPrev)==NULL) - {// pclmtListMTItem2 был первым, обновляем заголвок листа, теперь первый pclmtListMTItem1 - pclmtListMT->plmtiFirst=pclmtListMTItem1; - } - - if ((pclmtListMTItem2->plmtiPrev=lpTemp)==NULL) - {// pclmtListMTItem1 был первым, обновляем заголвок листа, теперь первый pclmtListMTItem2 - pclmtListMT->plmtiFirst=pclmtListMTItem2; - } - - - lpTemp=pclmtListMTItem1->plmtiNext; - if ((pclmtListMTItem1->plmtiNext=pclmtListMTItem2->plmtiNext)==NULL) - {// pclmtListMTItem2 был последним, обновляем заголвок листа, теперь последний pclmtListMTItem1 - pclmtListMT->plmtiLast=pclmtListMTItem1; - } - - if ((pclmtListMTItem2->plmtiNext=lpTemp)==NULL) - {// pclmtListMTItem1 был последним, обновляем заголвок листа, теперь последний pclmtListMTItem2 - pclmtListMT->plmtiLast=pclmtListMTItem2; - } - } -} - - -__inline BOOL ListMTIteratorMoveFirst(PCLIST_MT pclmtListMT,PCLIST_MT_ITERATOR pclmtiIterator) -{// если нужно гарантировать эксклюзивный доступ, то есть ListMTLock и ListMTUnLock - return((pclmtiIterator->plmtListMTItem=pclmtListMT->plmtiFirst)? TRUE:FALSE); -} - - -__inline BOOL ListMTIteratorMoveLast(PCLIST_MT pclmtListMT,PCLIST_MT_ITERATOR pclmtiIterator) -{// если нужно гарантировать эксклюзивный доступ, то есть ListMTLock и ListMTUnLock - return((pclmtiIterator->plmtListMTItem=pclmtListMT->plmtiLast)? TRUE:FALSE); -} - - -__inline BOOL ListMTIteratorMovePrev(PCLIST_MT_ITERATOR pclmtiIterator) -{// если нужно гарантировать эксклюзивный доступ, то есть ListMTLock и ListMTUnLock - BOOL bRet=FALSE; - - if (pclmtiIterator->plmtListMTItem) - { - if (pclmtiIterator->plmtListMTItem=pclmtiIterator->plmtListMTItem->plmtiPrev) bRet=TRUE; - } -return(bRet); -} - - -__inline BOOL ListMTIteratorMoveNext(PCLIST_MT_ITERATOR pclmtiIterator) -{// если нужно гарантировать эксклюзивный доступ, то есть ListMTLock и ListMTUnLock - BOOL bRet=FALSE; - - if (pclmtiIterator->plmtListMTItem) - { - if (pclmtiIterator->plmtListMTItem=pclmtiIterator->plmtListMTItem->plmtiNext) bRet=TRUE; - } -return(bRet); -} - - -__inline DWORD ListMTIteratorGet(PCLIST_MT_ITERATOR pclmtiIterator,PLIST_MT_ITEM *pplmtListMTItem,LPVOID *plpData) -{// если нужно гарантировать эксклюзивный доступ, то есть ListMTLock и ListMTUnLock - DWORD dwRetErrorCode; - - if (pclmtiIterator->plmtListMTItem) - { - if (pplmtListMTItem) (*pplmtListMTItem)=pclmtiIterator->plmtListMTItem; - if (plpData) (*plpData)=pclmtiIterator->plmtListMTItem->lpData; - dwRetErrorCode=NO_ERROR; - }else{ - dwRetErrorCode=ERROR_NO_MORE_ITEMS; - } -return(dwRetErrorCode); -} - - - -#if defined(_MSC_VER) -#if _MSC_VER >= 800 -#if _MSC_VER >= 1200 -#pragma warning(pop) -#else -#pragma warning(default:4312) // warning C4312: 'type cast' : conversion from 'LONG' to 'PVOID' of greater size -#endif -#endif -#endif - - - -#endif // !defined(AFX_LIST_MT__H__INCLUDED_) diff --git a/plugins/SMS/AdditionalFunctions/MemoryCompare.h b/plugins/SMS/AdditionalFunctions/MemoryCompare.h deleted file mode 100644 index de663c6d8a..0000000000 --- a/plugins/SMS/AdditionalFunctions/MemoryCompare.h +++ /dev/null @@ -1,177 +0,0 @@ -#if !defined(AFX_MEMORYCOMPARE__H__INCLUDED_) -#define AFX_MEMORYCOMPARE__H__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - - -// If the string pointed to by lpString1 is less than the string pointed -// to by lpString2, the return value is negative. -// If the string pointed to by lpString1 is greater than the string pointed -// to by lpString2, the return value is positive. -// If the strings are equal, the return value is zero. -// -// lpString1> ret=1=CSTR_LESS_THAN -// lpString1=lpString2 >> ret=2=CSTR_EQUAL -// lpString1>lpString2 >> ret=3=CSTR_GREATER_THAN - - -/*__inline DWORD MemoryCompare(LPCVOID lpcSource1,SIZE_T dwSource1Size,LPCVOID lpcSource2,SIZE_T dwSource2Size) -{ - DWORD dwRet; - - __asm - { - mov ecx,dwSource1Size //; ecx = Source string 1 Size - cmp ecx,dwSource2Size //; сверяем длинны участков памяти - jg short greater_than - jl short less_than - test ecx,ecx - jz short equal //; NULL=NULL - - mov esi,lpcSource1 //; edi = Source string 1 - mov edi,lpcSource2 //; esi = Source string 2 - cmp edi,esi //; сверяем указатели на участки памяти - je short equal //; это один и тотже участок, они естественно равны - - test esi,esi //; lpcSource1=NULL, lpcSource1lpcSource2 - jz short greater_than //; CSTR_GREATER_THAN - - //cld //; сканируя в прямом направлении - - repe cmpsb //; цикл сравнения. - cmp_loop: - //sub ecx,4 - //jz short equal - - //inc esi - //inc edi - //mov al,byte ptr [esi] - //cmpsd - //cmp al,byte ptr [edi] - //je short cmp_loop - jg short greater_than - jl short less_than - - equal: //; если мы попали сюда, значит, они - mov dwRet,CSTR_EQUAL //; совпадают (match) - jmp end_func - less_than: //; не совпадают - mov dwRet,CSTR_LESS_THAN - jmp end_func - greater_than: - mov dwRet,CSTR_GREATER_THAN - - end_func: - } -return(dwRet); -}//*/ - -__inline DWORD MemoryCompare(LPCVOID lpcSource1,SIZE_T dwSource1Size,LPCVOID lpcSource2,SIZE_T dwSource2Size) -{ - DWORD dwRet; - - if (dwSource1Size==dwSource2Size) - { - if (lpcSource1==lpcSource2) - { - dwRet=CSTR_EQUAL; - }else{ - if (lpcSource1 && lpcSource2) - { -#ifdef _INC_MEMORY - dwRet=(2+memcmp(lpcSource1,lpcSource2,dwSource1Size)); -#else - SIZE_T dwDiffPosition; - - //dwDiffPosition=RtlCompareMemory(lpcSource1,lpcSource2,dwSource1Size); - for(dwDiffPosition=0; (dwDiffPosition(*((BYTE*)(((SIZE_T)lpcSource2)+dwDiffPosition)))) - { - dwRet=CSTR_GREATER_THAN; - }else{ - dwRet=CSTR_LESS_THAN; - } - } -#endif - }else{ - if (lpcSource1) - {//lpcSource2==NULL - dwRet=CSTR_GREATER_THAN; - }else{//lpcSource1==NULL - dwRet=CSTR_LESS_THAN; - } - } - } - }else{ - if (dwSource1Size(*((BYTE*)(((SIZE_T)lpcSource2)+dwDiffPosition)))) - { - dwRet=CSTR_GREATER_THAN; - }else{ - dwRet=CSTR_LESS_THAN; - } - } - - if (pdwDiffPosition) (*pdwDiffPosition)=dwDiffPosition; - }else{ - if (lpcSource1) - {//lpcSource2==NULL - dwRet=CSTR_GREATER_THAN; - }else{//lpcSource1==NULL - dwRet=CSTR_LESS_THAN; - } - } - } - }else{ - if (dwSource1Size 1000 -#pragma once -#endif // _MSC_VER > 1000 - -__inline LPVOID MemoryFind(SIZE_T dwFrom,LPCVOID lpcSource,SIZE_T dwSourceSize,LPCVOID lpcWhatFind,SIZE_T dwWhatFindSize) -{ - LPVOID lpRet=NULL; - - __asm - { - push ebx // сохраняем регистр - push edi // сохраняем регистр - push esi // сохраняем регистр - - mov ecx,dwSourceSize //; ecx = Source string Size - test ecx,ecx // is size unknown? - jz short end_func - - mov edx,dwWhatFindSize //; edx = WhatFind string Size - test edx,edx // is size unknown? - jz short end_func - - mov ebx,dwFrom // ebx - start pos in Source string - mov edi,lpcSource //; edi = Source string - mov esi,lpcWhatFind //; esi = WhatFind string - - cmp ebx,ecx // проверка ecx(=len)=>ulFrom - jae short end_func - - add edi,ebx // сдвигаем начало на ulFrom(нач смещен) - sub ecx,ebx // уменьшаем длинну SourceSize на ulFrom(нач смещен) - - cmp ecx,edx // проверка NEWSourceSize ??? ulWhatFindSize - je short begin_memorycompare // NEWulSourceSize==ulWhatFindSize, Source ??? WhatFind - jl short end_func // NEWulSourceSize Source!=WhatFind - - sub ecx,edx // уменьшаем длинну SourceSize на ulWhatFindSize - inc ecx - - mov al,[esi] //; al=search byte - dec edi - cld //; сканируя в прямом направлении - - find_loop: - test ecx,ecx - jz short end_func - inc edi - repne scasb //; find that byte - dec edi //; di points to byte which stopped scan - - cmp [edi],al //; see if we have a hit - jne short end_func //; yes, point to byte - - begin_memorycompare: - push esi - push edi - push ecx - mov ecx,edx //; ulWhatFindSize байтов (CX используется в REPE), - repe cmpsb //; сравниваем их. - pop ecx - pop edi - pop esi - jne short find_loop //; признак ZF = 0, если сравниваемые - //; строки не совпадают (mismatch) match: - //; если мы попали сюда, значит, они - //; совпадают (match) - mov lpRet,edi //; ax=pointer to byte - end_func: - - pop esi // восстанавливаем содержимое регистра - pop edi // восстанавливаем содержимое регистра - pop ebx // восстанавливаем содержимое регистра - } -return(lpRet); -} - - -#endif // !defined(AFX_MEMORYFIND__H__INCLUDED_) diff --git a/plugins/SMS/AdditionalFunctions/MemoryFindByte.h b/plugins/SMS/AdditionalFunctions/MemoryFindByte.h deleted file mode 100644 index 0dcc1f91a6..0000000000 --- a/plugins/SMS/AdditionalFunctions/MemoryFindByte.h +++ /dev/null @@ -1,71 +0,0 @@ -#if !defined(AFX_MEMORYFINDBYTE__H__INCLUDED_) -#define AFX_MEMORYFINDBYTE__H__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - - - -__inline LPVOID MemoryFindByte(SIZE_T dwFrom,LPCVOID lpcSource,SIZE_T dwSourceSize,unsigned char chWhatFind) -{ - LPVOID lpRet=NULL; - - if (lpcSource && dwSourceSize) - { - if (dwFromdwFrom - jae short end_func - - std //; count 'up' on string this time - sub ecx,eax //; уменьшаем длинну на dwFrom(нач смещен) - add edi,ecx //; сдвигаем начало на dwSourceSize(на конец) - mov al,chWhatFind //; al=search byte - repne scasb //; find that byte - inc edi //; di points to byte which stopped scan - cmp [edi],al //; see if we have a hit - jne short end_func //; yes, point to byte - mov lpRet,edi //; ax=pointer to byte - end_func: - - cld - pop esi // восстанавливаем содержимое регистра - pop edi // восстанавливаем содержимое регистра - pop ebx // восстанавливаем содержимое регистра - } -return(lpRet); -} - - - -#endif // !defined(AFX_MEMORYFINDBYTE__H__INCLUDED_) -- cgit v1.2.3