fixed warnings

This commit is contained in:
Mr. eXoDia 2014-07-08 02:55:56 +02:00
parent 4e4fd592d1
commit 978361df33
13 changed files with 43 additions and 53 deletions

View File

@ -116,7 +116,7 @@ void BreakPointPostReadFilter(ULONG_PTR lpBaseAddress, unsigned char* lpBuffer,
CriticalSectionLocker lock(LockBreakPointBuffer);
ULONG_PTR start=lpBaseAddress;
ULONG_PTR end=start+nSize;
int bpcount=BreakPointBuffer.size();
int bpcount=(int)BreakPointBuffer.size();
for(int i=0; i<bpcount; i++)
{
BreakPointDetail* curBp=&BreakPointBuffer.at(i);
@ -139,7 +139,7 @@ void BreakPointPreWriteFilter(ULONG_PTR lpBaseAddress, SIZE_T nSize, CriticalSec
{
ULONG_PTR start=lpBaseAddress;
ULONG_PTR end=start+nSize;
int bpcount=BreakPointBuffer.size();
int bpcount=(int)BreakPointBuffer.size();
for(int i=0; i<bpcount; i++)
{
BreakPointDetail* curBp=&BreakPointBuffer.at(i);
@ -165,7 +165,7 @@ void BreakPointPostWriteFilter(ULONG_PTR lpBaseAddress, SIZE_T nSize, CriticalSe
{
ULONG_PTR start=lpBaseAddress;
ULONG_PTR end=start+nSize;
int bpcount=BreakPointBuffer.size();
int bpcount=(int)BreakPointBuffer.size();
for(int i=0; i<bpcount; i++)
{
BreakPointDetail* curBp=&BreakPointBuffer.at(i);

View File

@ -265,7 +265,7 @@ bool EngineGetAPINameRemote(HANDLE hProcess, ULONG_PTR APIAddress, char* APIName
}
if(APINameSizeNeeded)
{
*APINameSizeNeeded=strlen(curName);
*APINameSizeNeeded=(DWORD)strlen(curName);
UnMapFileEx(FileHandle, FileSize, FileMap, FileMapVA);
return true;
}

View File

@ -678,7 +678,7 @@ bool EngineGetDependencyLocationW(wchar_t* szFileName, wchar_t* szDependencyForF
if(szDependencyForFile != NULL)
{
RtlZeroMemory(szTryFileName, sizeof(szTryFileName));
i = wcslen(szDependencyForFile);
i = (int)wcslen(szDependencyForFile);
while(i > 0 && szDependencyForFile[i] != L'\\')
{
i--;

View File

@ -5,7 +5,7 @@
bool IsStrEqual( const char* const a, const char* const b, bool considercase/*=true*/ )
{
const int stringlen = std::strlen(a);
const int stringlen = (int)std::strlen(a);
if(stringlen != std::strlen(b))
return false; //cheap

View File

@ -17,7 +17,7 @@ void GenericOEPVirtualProtectHit()
DWORD NewProtect = 0;
DWORD OldProtect = 0;
int bpcount=BreakPointBuffer.size();
int bpcount=(int)BreakPointBuffer.size();
for(int i=0; i<bpcount; i++)
{
BreakPointDetail curDetail=BreakPointBuffer.at(i);

View File

@ -30,7 +30,7 @@ __declspec(dllexport) bool TITCALL IsBPXEnabled(ULONG_PTR bpxAddress)
ULONG_PTR NumberOfBytesReadWritten = 0;
DWORD MaximumBreakPoints = 0;
BYTE ReadData[10] = {};
int bpcount=BreakPointBuffer.size();
int bpcount=(int)BreakPointBuffer.size();
for(int i=0; i<bpcount; i++)
{
if(BreakPointBuffer.at(i).BreakPointAddress == bpxAddress)
@ -66,7 +66,7 @@ __declspec(dllexport) bool TITCALL EnableBPX(ULONG_PTR bpxAddress)
DWORD MaximumBreakPoints = 0;
bool testWrite = false;
DWORD OldProtect;
int bpcount=BreakPointBuffer.size();
int bpcount=(int)BreakPointBuffer.size();
for(int i=0; i<bpcount; i++)
{
if(BreakPointBuffer.at(i).BreakPointAddress == bpxAddress)
@ -135,7 +135,7 @@ __declspec(dllexport) bool TITCALL DisableBPX(ULONG_PTR bpxAddress)
ULONG_PTR NumberOfBytesReadWritten = 0;
DWORD MaximumBreakPoints = 0;
DWORD OldProtect;
int bpcount=BreakPointBuffer.size();
int bpcount=(int)BreakPointBuffer.size();
for(int i=0; i<bpcount; i++)
{
if(BreakPointBuffer.at(i).BreakPointAddress == bpxAddress)
@ -181,7 +181,7 @@ __declspec(dllexport) bool TITCALL SetBPX(ULONG_PTR bpxAddress, DWORD bpxType, L
{
return false;
}
int bpcount=BreakPointBuffer.size();
int bpcount=(int)BreakPointBuffer.size();
//search for breakpoint
for(int i=0; i<bpcount; i++)
{
@ -272,7 +272,7 @@ __declspec(dllexport) bool TITCALL DeleteBPX(ULONG_PTR bpxAddress)
CriticalSectionLocker lock(LockBreakPointBuffer);
ULONG_PTR NumberOfBytesReadWritten = 0;
DWORD OldProtect;
int bpcount=BreakPointBuffer.size();
int bpcount=(int)BreakPointBuffer.size();
int found=-1;
for(int i=0; i<bpcount; i++)
{
@ -440,7 +440,7 @@ __declspec(dllexport) bool TITCALL SetMemoryBPXEx(ULONG_PTR MemoryStart, SIZE_T
CriticalSectionLocker lock(LockBreakPointBuffer);
MEMORY_BASIC_INFORMATION MemInfo;
ULONG_PTR NumberOfBytesReadWritten = 0;
int bpcount=BreakPointBuffer.size();
int bpcount=(int)BreakPointBuffer.size();
//search for breakpoint
for(int i=0; i<bpcount; i++)
{
@ -487,7 +487,7 @@ __declspec(dllexport) bool TITCALL RemoveMemoryBPX(ULONG_PTR MemoryStart, SIZE_T
CriticalSectionLocker lock(LockBreakPointBuffer);
MEMORY_BASIC_INFORMATION MemInfo;
ULONG_PTR NumberOfBytesReadWritten = 0;
int bpcount=BreakPointBuffer.size();
int bpcount=(int)BreakPointBuffer.size();
int found=-1;
//search for breakpoint
for(int i=0; i<bpcount; i++)
@ -817,7 +817,7 @@ __declspec(dllexport) bool TITCALL DeleteHardwareBreakPoint(DWORD IndexOfRegiste
__declspec(dllexport) bool TITCALL RemoveAllBreakPoints(DWORD RemoveOption)
{
CriticalSectionLocker lock(LockBreakPointBuffer);
int bpcount=BreakPointBuffer.size();
int bpcount=(int)BreakPointBuffer.size();
if(RemoveOption == UE_OPTION_REMOVEALL)
{
for(int i=bpcount-1; i>-1; i--)

View File

@ -8,7 +8,7 @@
__declspec(dllexport) void TITCALL ForceClose()
{
//manage process list
int processcount=hListProcess.size();
int processcount=(int)hListProcess.size();
for(int i=0; i<processcount; i++)
{
EngineCloseHandle(hListProcess.at(i).hFile);
@ -16,12 +16,12 @@ __declspec(dllexport) void TITCALL ForceClose()
}
ClearProcessList();
//manage thread list
int threadcount=hListThread.size();
int threadcount=(int)hListThread.size();
for(int i=0; i<threadcount; i++)
EngineCloseHandle(hListThread.at(i).hThread);
ClearThreadList();
//manage library list
int libcount=hListLibrary.size();
int libcount=(int)hListLibrary.size();
for(int i=0; i<libcount; i++)
{
if(hListLibrary.at(i).hFile != (HANDLE)-1)

View File

@ -346,7 +346,7 @@ __declspec(dllexport) void TITCALL DebugLoop()
WideCharToMultiByte(CP_ACP, NULL, NewLibraryData.szLibraryName, -1, szAnsiLibraryName, sizeof szAnsiLibraryName, NULL, NULL);
//library breakpoint
for(int i = LibrarianData.size() - 1; i >= 0; i--)
for(int i = (int)LibrarianData.size() - 1; i >= 0; i--)
{
ptrLibrarianData=&LibrarianData.at(i);
if(!_stricmp(ptrLibrarianData->szLibraryName, szAnsiLibraryName))
@ -415,7 +415,7 @@ __declspec(dllexport) void TITCALL DebugLoop()
RtlZeroMemory(szAnsiLibraryName, sizeof(szAnsiLibraryName));
WideCharToMultiByte(CP_ACP, NULL, hLoadedLibData->szLibraryName, -1, szAnsiLibraryName, sizeof szAnsiLibraryName, NULL, NULL);
for(int i= LibrarianData.size() - 1; i >= 0; i--)
for(int i= (int)LibrarianData.size() - 1; i >= 0; i--)
{
ptrLibrarianData = &LibrarianData.at(i);
if(!_stricmp(ptrLibrarianData->szLibraryName, szAnsiLibraryName))
@ -520,7 +520,7 @@ __declspec(dllexport) void TITCALL DebugLoop()
{
bool bFoundBreakPoint=false;
BreakPointDetail FoundBreakPoint;
int bpcount=BreakPointBuffer.size();
int bpcount=(int)BreakPointBuffer.size();
for(int i=0; i<bpcount; i++)
{
if(BreakPointBuffer.at(i).BreakPointAddress == (ULONG_PTR)DBGEvent.u.Exception.ExceptionRecord.ExceptionAddress - (BreakPointBuffer.at(i).BreakPointSize - 1) &&
@ -916,7 +916,7 @@ __declspec(dllexport) void TITCALL DebugLoop()
ULONG_PTR bpaddr;
bool bFoundBreakPoint=false;
BreakPointDetail FoundBreakPoint;
int bpcount=BreakPointBuffer.size();
int bpcount=(int)BreakPointBuffer.size();
for(int i=0; i<bpcount; i++)
{
ULONG_PTR addr=BreakPointBuffer.at(i).BreakPointAddress;
@ -1123,7 +1123,7 @@ __declspec(dllexport) void TITCALL DebugLoop()
//UD2 breakpoint
bool bFoundBreakPoint=false;
BreakPointDetail FoundBreakPoint;
int bpcount=BreakPointBuffer.size();
int bpcount=(int)BreakPointBuffer.size();
for(int i=0; i<bpcount; i++)
{
if(BreakPointBuffer.at(i).BreakPointAddress == (ULONG_PTR)DBGEvent.u.Exception.ExceptionRecord.ExceptionAddress &&

View File

@ -189,7 +189,7 @@ __declspec(dllexport) void* TITCALL InitDLLDebugW(wchar_t* szFileName, bool Rese
DebugReserveModuleBase = DebugModuleImageBase;
PPROCESS_INFORMATION ReturnValue = (PPROCESS_INFORMATION)InitDebugW(szDebuggerName, szCommandLine, szCurrentFolder);
wchar_t szName[256]=L"";
swprintf(szName, L"Global\\szLibraryName%X", (unsigned int)ReturnValue->dwProcessId);
swprintf(szName, 256, L"Global\\szLibraryName%X", (unsigned int)ReturnValue->dwProcessId);
DebugDLLFileMapping=CreateFileMappingW(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, 512*sizeof(wchar_t), szName);
if(DebugDLLFileMapping)
{
@ -294,7 +294,7 @@ __declspec(dllexport) bool TITCALL DetachDebugger(DWORD ProcessId)
__declspec(dllexport) bool TITCALL DetachDebuggerEx(DWORD ProcessId)
{
ThreaderPauseProcess();
int threadcount=hListThread.size();
int threadcount=(int)hListThread.size();
for(int i=0; i<threadcount; i++)
{
HANDLE hActiveThread = OpenThread(THREAD_GET_CONTEXT|THREAD_SET_CONTEXT, false, hListThread.at(i).dwThreadId);

View File

@ -12,7 +12,7 @@ _DecodeType DecodingType = Decode64Bits;
#endif
long IsBadReadPtrRemote(HANDLE hProcess, const VOID *lp, SIZE_T length)
SIZE_T IsBadReadPtrRemote(HANDLE hProcess, const VOID *lp, SIZE_T length)
{
MEMORY_BASIC_INFORMATION MemInfo = {0};
ULONG_PTR section = 0;
@ -67,7 +67,7 @@ __declspec(dllexport) void* TITCALL StaticDisassembleEx(ULONG_PTR DisassmStart,
_DecodedInst engineDecodedInstructions[1];
unsigned int DecodedInstructionsCount = 0;
long MaxDisassmSize = IsBadReadPtrRemote(GetCurrentProcess(), DisassmAddress, MAXIMUM_INSTRUCTION_SIZE);
int MaxDisassmSize = (int)IsBadReadPtrRemote(GetCurrentProcess(), DisassmAddress, MAXIMUM_INSTRUCTION_SIZE);
if(MaxDisassmSize)
{
if (distorm_decode((ULONG_PTR)DisassmStart, (const unsigned char*)DisassmAddress, MaxDisassmSize, DecodingType, engineDecodedInstructions, _countof(engineDecodedInstructions), &DecodedInstructionsCount) != DECRES_INPUTERR)
@ -100,21 +100,11 @@ __declspec(dllexport) void* TITCALL DisassembleEx(HANDLE hProcess, LPVOID Disass
if(hProcess != NULL)
{
long MaxDisassmSize = IsBadReadPtrRemote(hProcess,DisassmAddress, sizeof(readBuffer));
int MaxDisassmSize = (int)IsBadReadPtrRemote(hProcess,DisassmAddress, sizeof(readBuffer));
if(MaxDisassmSize)
{
bool isbp=false;
if(IsBPXEnabled((ULONG_PTR)DisassmAddress))
{
isbp=true;
DisableBPX((ULONG_PTR)DisassmAddress);
}
BOOL rpm = MemoryReadSafe(hProcess, DisassmAddress, readBuffer, MaxDisassmSize, 0);
if(isbp)
{
EnableBPX((ULONG_PTR)DisassmAddress);
}
if(rpm)
{
if (distorm_decode((ULONG_PTR)DisassmAddress, readBuffer, MaxDisassmSize, DecodingType, engineDecodedInstructions, _countof(engineDecodedInstructions), &DecodedInstructionsCount) != DECRES_INPUTERR)
@ -159,7 +149,7 @@ __declspec(dllexport) long TITCALL LengthDisassembleEx(HANDLE hProcess, LPVOID D
if(hProcess != NULL)
{
long MaxDisassmSize = IsBadReadPtrRemote(hProcess,DisassmAddress, sizeof(readBuffer));
int MaxDisassmSize = (int)IsBadReadPtrRemote(hProcess,DisassmAddress, sizeof(readBuffer));
if (MaxDisassmSize && MemoryReadSafe(hProcess, (LPVOID)DisassmAddress, readBuffer, MaxDisassmSize, 0))
{

View File

@ -29,7 +29,7 @@ __declspec(dllexport) bool TITCALL HooksSafeTransitionEx(LPVOID HookAddressArray
{
if(!TransitionStart || ThreaderImportRunningThreadData(GetCurrentProcessId()))
{
int threadcount=hListThread.size();
int threadcount=(int)hListThread.size();
for(int i=0; i<threadcount; i++)
{
PTHREAD_ITEM_DATA hListThreadPtr=&hListThread.at(i);

View File

@ -20,7 +20,7 @@ __declspec(dllexport) bool TITCALL LibrarianSetBreakPoint(char* szLibraryName, D
__declspec(dllexport) bool TITCALL LibrarianRemoveBreakPoint(char* szLibraryName, DWORD bpxType)
{
for(int i = LibrarianData.size() - 1; i >= 0; i--)
for(int i = (int)LibrarianData.size() - 1; i >= 0; i--)
{
if(!_stricmp(szLibraryName, LibrarianData.at(i).szLibraryName) && (LibrarianData.at(i).bpxType == bpxType || bpxType == UE_ON_LIB_ALL))
{

View File

@ -8,9 +8,9 @@
void updateThreadList( THREAD_ITEM_DATA* NewThreadData )
{
bool notInList = true;
unsigned int count = hListThread.size();
int count = (int)hListThread.size();
for (unsigned int i = 0; i < count; i++)
for (int i = 0; i < count; i++)
{
if (hListThread.at(i).dwThreadId == NewThreadData->dwThreadId)
{
@ -159,7 +159,7 @@ __declspec(dllexport) void* TITCALL ThreaderGetThreadInfo(HANDLE hThread, DWORD
return NULL;
static THREAD_ITEM_DATA ThreadData;
memset(&ThreadData, 0, sizeof(THREAD_ITEM_DATA));
int threadcount=hListThread.size();
int threadcount=(int)hListThread.size();
for(int i=0; i<threadcount; i++)
if(hListThread.at(i).hThread == hThread || hListThread.at(i).dwThreadId == ThreadId)
{
@ -173,7 +173,7 @@ __declspec(dllexport) void TITCALL ThreaderEnumThreadInfo(void* EnumCallBack)
{
typedef void(TITCALL *fEnumCallBack)(LPVOID fThreadDetail);
fEnumCallBack myEnumCallBack = (fEnumCallBack)EnumCallBack;
int threadcount=hListThread.size();
int threadcount=(int)hListThread.size();
for(int i=0; i<threadcount; i++)
{
__try
@ -189,7 +189,7 @@ __declspec(dllexport) void TITCALL ThreaderEnumThreadInfo(void* EnumCallBack)
__declspec(dllexport) bool TITCALL ThreaderPauseThread(HANDLE hThread)
{
int threadcount=hListThread.size();
int threadcount=(int)hListThread.size();
for(int i=0; i<threadcount; i++)
if(hListThread.at(i).hThread == hThread && SuspendThread(hThread) != -1)
return true;
@ -198,7 +198,7 @@ __declspec(dllexport) bool TITCALL ThreaderPauseThread(HANDLE hThread)
__declspec(dllexport) bool TITCALL ThreaderResumeThread(HANDLE hThread)
{
int threadcount=hListThread.size();
int threadcount=(int)hListThread.size();
for(int i=0; i<threadcount; i++)
if(hListThread.at(i).hThread == hThread && ResumeThread(hThread) != -1)
return true;
@ -207,7 +207,7 @@ __declspec(dllexport) bool TITCALL ThreaderResumeThread(HANDLE hThread)
__declspec(dllexport) bool TITCALL ThreaderTerminateThread(HANDLE hThread, DWORD ThreadExitCode)
{
int threadcount=hListThread.size();
int threadcount=(int)hListThread.size();
for(int i=0; i<threadcount; i++)
if(hListThread.at(i).hThread == hThread && TerminateThread(hThread, ThreadExitCode) != NULL)
{
@ -220,7 +220,7 @@ __declspec(dllexport) bool TITCALL ThreaderTerminateThread(HANDLE hThread, DWORD
__declspec(dllexport) bool TITCALL ThreaderPauseAllThreads(bool LeaveMainRunning)
{
bool ret=true;
int threadcount=hListThread.size();
int threadcount=(int)hListThread.size();
for(int i=0; i<threadcount; i++)
{
DWORD suspended;
@ -237,7 +237,7 @@ __declspec(dllexport) bool TITCALL ThreaderPauseAllThreads(bool LeaveMainRunning
__declspec(dllexport) bool TITCALL ThreaderResumeAllThreads(bool LeaveMainPaused)
{
bool ret=true;
int threadcount=hListThread.size();
int threadcount=(int)hListThread.size();
for(int i=0; i<threadcount; i++)
{
DWORD resumed;
@ -332,7 +332,7 @@ __declspec(dllexport) bool TITCALL ThreaderIsThreadActive(HANDLE hThread)
__declspec(dllexport) bool TITCALL ThreaderIsAnyThreadActive()
{
int threadcount=hListThread.size();
int threadcount=(int)hListThread.size();
for(int i=0; i<threadcount; i++)
if(ThreaderIsThreadActive(hListThread.at(i).hThread))
return true;
@ -351,7 +351,7 @@ __declspec(dllexport) bool TITCALL ThreaderExecuteOnlyInjectedThreads()
__declspec(dllexport) ULONG_PTR TITCALL ThreaderGetOpenHandleForThread(DWORD ThreadId)
{
int threadcount=hListThread.size();
int threadcount=(int)hListThread.size();
for(int i=0; i<threadcount; i++)
if(hListThread.at(i).dwThreadId == ThreadId)
return (ULONG_PTR)hListThread.at(i).hThread;