1
0
Fork 0
This commit is contained in:
Nukem 2015-04-06 21:15:54 -04:00
commit 7e7f475995
9 changed files with 170 additions and 117 deletions

View File

@ -65,6 +65,7 @@ void ExceptionCodeInit()
ExceptionNames.insert(std::make_pair(0xC00002C9, "STATUS_REG_NAT_CONSUMPTION")); ExceptionNames.insert(std::make_pair(0xC00002C9, "STATUS_REG_NAT_CONSUMPTION"));
ExceptionNames.insert(std::make_pair(0xC0000409, "STATUS_STACK_BUFFER_OVERRUN")); ExceptionNames.insert(std::make_pair(0xC0000409, "STATUS_STACK_BUFFER_OVERRUN"));
ExceptionNames.insert(std::make_pair(0xC0000417, "STATUS_INVALID_CRUNTIME_PARAMETER")); ExceptionNames.insert(std::make_pair(0xC0000417, "STATUS_INVALID_CRUNTIME_PARAMETER"));
ExceptionNames.insert(std::make_pair(0xC000041D, "STATUS_USER_CALLBACK"));
ExceptionNames.insert(std::make_pair(0xC0000420, "STATUS_ASSERTION_FAILURE")); ExceptionNames.insert(std::make_pair(0xC0000420, "STATUS_ASSERTION_FAILURE"));
ExceptionNames.insert(std::make_pair(0xE0434352, "CLR_EXCEPTION")); ExceptionNames.insert(std::make_pair(0xE0434352, "CLR_EXCEPTION"));
ExceptionNames.insert(std::make_pair(0xE06D7363, "CPP_EH_EXCEPTION")); ExceptionNames.insert(std::make_pair(0xE06D7363, "CPP_EH_EXCEPTION"));

View File

@ -17,15 +17,20 @@ bool ModLoad(uint Base, uint Size, const char* FullPath)
MODINFO info; MODINFO info;
// Copy the module path in the struct
strcpy_s(info.path, FullPath);
// Break the module path into a directory and file name // Break the module path into a directory and file name
char dir[deflen]; char dir[MAX_PATH] = "";
char* file; char file[MAX_MODULE_SIZE] = "";
strcpy_s(dir, FullPath);
if(GetFullPathNameA(FullPath, ARRAYSIZE(dir), dir, &file) == 0)
return false;
// Make everything lowercase
_strlwr(dir); _strlwr(dir);
char* fileStart = strrchr(dir, '\\');
if(fileStart)
{
strcpy_s(file, fileStart + 1);
*fileStart = '\0';
}
// Copy the extension into the module struct // Copy the extension into the module struct
{ {

View File

@ -1,55 +1,89 @@
/**
@file msgqueue.cpp
@brief Implements the msgqueue class.
*/
#include "msgqueue.h" #include "msgqueue.h"
#include <stdio.h>
// Allocate a message stack //allocate a message (internal)
static MESSAGE* msgalloc()
{
return (MESSAGE*)emalloc(sizeof(MESSAGE), "msgalloc:msg");
}
//free a message (internal)
static void msgfree(MESSAGE* msg)
{
efree(msg, "msgfree:msg");
}
//allocate a message stack
MESSAGE_STACK* MsgAllocStack() MESSAGE_STACK* MsgAllocStack()
{ {
// Allocate memory for the structure MESSAGE_STACK* msgstack = (MESSAGE_STACK*)emalloc(sizeof(MESSAGE_STACK), "msgallocstack:msgstack");
PVOID memoryBuffer = emalloc(sizeof(MESSAGE_STACK), "MsgAllocStack:memoryBuffer"); if(!msgstack)
return 0;
if(!memoryBuffer) memset(msgstack, 0, sizeof(MESSAGE_STACK));
return nullptr; InitializeCriticalSection(&msgstack->cr);
return msgstack;
// Use placement new to ensure all constructors are called correctly
return new(memoryBuffer) MESSAGE_STACK;
} }
// Free a message stack and all messages in the queue //free a message stack
void MsgFreeStack(MESSAGE_STACK* Stack) void MsgFreeStack(MESSAGE_STACK* msgstack)
{ {
// Destructor must be called manually due to placement new DeleteCriticalSection(&msgstack->cr);
Stack->FIFOStack.~unbounded_buffer(); int stackpos = msgstack->stackpos;
for(int i = 0; i < stackpos; i++) //free all messages left in stack
// Free memory msgfree(msgstack->msg[i]);
efree(Stack, "MsgFreeStack:Stack"); efree(msgstack, "msgfreestack:msgstack");
} }
// Add a message to the stack //add a message to the stack
bool MsgSend(MESSAGE_STACK* Stack, int Msg, uint Param1, uint Param2) bool MsgSend(MESSAGE_STACK* msgstack, int msg, uint param1, uint param2)
{ {
MESSAGE messageInfo; CRITICAL_SECTION* cr = &msgstack->cr;
messageInfo.msg = Msg; EnterCriticalSection(cr);
messageInfo.param1 = Param1; int stackpos = msgstack->stackpos;
messageInfo.param2 = Param2; if(stackpos >= MAX_MESSAGES)
{
// Asynchronous send. Return value doesn't matter. LeaveCriticalSection(cr);
concurrency::asend(Stack->FIFOStack, messageInfo); return false;
}
MESSAGE* newmsg = msgalloc();
if(!newmsg)
{
LeaveCriticalSection(cr);
return false;
}
newmsg->msg = msg;
newmsg->param1 = param1;
newmsg->param2 = param2;
msgstack->msg[stackpos] = newmsg;
msgstack->stackpos++; //increase stack pointer
LeaveCriticalSection(cr);
return true; return true;
} }
// Get a message from the stack (will return false when there are no messages) //get a message from the stack (will return false when there are no messages)
bool MsgGet(MESSAGE_STACK* Stack, MESSAGE* Message) bool MsgGet(MESSAGE_STACK* msgstack, MESSAGE* msg)
{ {
return concurrency::try_receive(Stack->FIFOStack, *Message); CRITICAL_SECTION* cr = &msgstack->cr;
EnterCriticalSection(cr);
int stackpos = msgstack->stackpos;
if(!msgstack->stackpos) //no messages to process
{
LeaveCriticalSection(cr);
return false;
}
msgstack->stackpos--; //current message is at stackpos-1
stackpos--;
MESSAGE* stackmsg = msgstack->msg[stackpos];
memcpy(msg, stackmsg, sizeof(MESSAGE));
msgfree(stackmsg);
msgstack->msg[stackpos] = 0;
LeaveCriticalSection(cr);
return true;
} }
// Wait for a message on the specified stack //wait for a message on the specified stack
void MsgWait(MESSAGE_STACK* Stack, MESSAGE* Message) void MsgWait(MESSAGE_STACK* msgstack, MESSAGE* msg)
{ {
*Message = concurrency::receive(Stack->FIFOStack); while(!MsgGet(msgstack, msg))
Sleep(1);
} }

View File

@ -3,9 +3,10 @@
#include "_global.h" #include "_global.h"
#include <windows.h> #include <windows.h>
#include <agents.h>
// Message structure #define MAX_MESSAGES 256
//message structure
struct MESSAGE struct MESSAGE
{ {
int msg; int msg;
@ -13,17 +14,19 @@ struct MESSAGE
uint param2; uint param2;
}; };
// Message stack structure. //message stack structure
// Supports an unlimited number of messages.
struct MESSAGE_STACK struct MESSAGE_STACK
{ {
concurrency::unbounded_buffer<MESSAGE> FIFOStack; CRITICAL_SECTION cr;
int stackpos;
MESSAGE* msg[MAX_MESSAGES];
}; };
//function definitions
MESSAGE_STACK* MsgAllocStack(); MESSAGE_STACK* MsgAllocStack();
void MsgFreeStack(MESSAGE_STACK* Stack); void MsgFreeStack(MESSAGE_STACK* msgstack);
bool MsgSend(MESSAGE_STACK* Stack, int Msg, uint Param1, uint Param2); bool MsgSend(MESSAGE_STACK* msgstack, int msg, uint param1, uint param2);
bool MsgGet(MESSAGE_STACK* Stack, MESSAGE* Message); bool MsgGet(MESSAGE_STACK* msgstack, MESSAGE* msg);
void MsgWait(MESSAGE_STACK* Stack, MESSAGE* Message); void MsgWait(MESSAGE_STACK* msgstack, MESSAGE* msg);
#endif // _MSGQUEUE_H #endif // _MSGQUEUE_H

View File

@ -27,6 +27,7 @@ AbstractTableView::AbstractTableView(QWidget* parent) : QAbstractScrollArea(pare
mGuiState = AbstractTableView::NoState; mGuiState = AbstractTableView::NoState;
mShouldReload = true; mShouldReload = true;
mAllowPainting = true;
// ScrollBar Init // ScrollBar Init
setVerticalScrollBar(new AbstractTableScrollBar(verticalScrollBar())); setVerticalScrollBar(new AbstractTableScrollBar(verticalScrollBar()));
@ -79,6 +80,8 @@ void AbstractTableView::fontsUpdated()
*/ */
void AbstractTableView::paintEvent(QPaintEvent* event) void AbstractTableView::paintEvent(QPaintEvent* event)
{ {
if(!mAllowPainting)
return;
if(getColumnCount()) //make sure the last column is never smaller than the window if(getColumnCount()) //make sure the last column is never smaller than the window
{ {
int totalWidth = 0; int totalWidth = 0;

View File

@ -187,6 +187,7 @@ protected:
QColor separatorColor; QColor separatorColor;
QColor headerTextColor; QColor headerTextColor;
QColor selectionColor; QColor selectionColor;
bool mAllowPainting;
}; };
#endif // ABSTRACTTABLEVIEW_H #endif // ABSTRACTTABLEVIEW_H

View File

@ -975,6 +975,7 @@ void HexDump::appendDescriptor(int width, QString title, bool clickable, ColumnD
//Clears the descriptors, append a new descriptor and fix the tableOffset (use this instead of clearDescriptors() //Clears the descriptors, append a new descriptor and fix the tableOffset (use this instead of clearDescriptors()
void HexDump::appendResetDescriptor(int width, QString title, bool clickable, ColumnDescriptor_t descriptor) void HexDump::appendResetDescriptor(int width, QString title, bool clickable, ColumnDescriptor_t descriptor)
{ {
mAllowPainting = false;
if(mDescriptor.size()) if(mDescriptor.size())
{ {
int_t wRVA = getTableOffset() * getBytePerRowCount() - mByteOffset; int_t wRVA = getTableOffset() * getBytePerRowCount() - mByteOffset;
@ -984,6 +985,7 @@ void HexDump::appendResetDescriptor(int width, QString title, bool clickable, Co
} }
else else
appendDescriptor(width, title, clickable, descriptor); appendDescriptor(width, title, clickable, descriptor);
mAllowPainting = true;
} }
void HexDump::clearDescriptors() void HexDump::clearDescriptors()

View File

@ -2229,7 +2229,7 @@ SIZE_T RegistersView::GetSizeRegister(const REGISTER_NAME reg_name)
else if(mFPUYMM.contains(reg_name)) else if(mFPUYMM.contains(reg_name))
size = 32; size = 32;
else if(reg_name == LastError) else if(reg_name == LastError)
return sizeof(LASTERROR); return sizeof(DWORD);
else else
size = 0; size = 0;

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>350</width> <width>383</width>
<height>250</height> <height>307</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -33,7 +33,7 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="tabEvents"> <widget class="QWidget" name="tabEvents">
<attribute name="title"> <attribute name="title">
@ -154,83 +154,87 @@
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_4"> <layout class="QVBoxLayout" name="verticalLayout_4">
<item> <item>
<widget class="QLabel" name="lblCalculationType"> <widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="title">
<string>Calculation Type:</string> <string>Calculation Type</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<layout class="QHBoxLayout" name="layoutCalulationType">
<property name="sizeConstraint">
<enum>QLayout::SetNoConstraint</enum>
</property>
<item>
<widget class="QRadioButton" name="radioSigned">
<property name="text">
<string>&amp;Signed</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioUnsigned">
<property name="text">
<string>&amp;Unsigned</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="layoutCalulationType"> <widget class="QGroupBox" name="groupBox">
<property name="sizeConstraint">
<enum>QLayout::SetNoConstraint</enum>
</property>
<item>
<widget class="QRadioButton" name="radioSigned">
<property name="text">
<string>&amp;Signed</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioUnsigned">
<property name="text">
<string>&amp;Unsigned</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="lblBreakpointType">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="title">
<string>Default Breakpoint Type:</string> <string>Default Breakpoint Type</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<layout class="QHBoxLayout" name="layoutBreakpointType">
<item>
<widget class="QRadioButton" name="radioInt3Short">
<property name="text">
<string>INT3</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioInt3Long">
<property name="text">
<string>Long INT3</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioUd2">
<property name="text">
<string>UD2</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget> </widget>
</item> </item>
<item>
<layout class="QHBoxLayout" name="layoutBreakpointType">
<item>
<widget class="QRadioButton" name="radioInt3Short">
<property name="text">
<string>INT3</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioInt3Long">
<property name="text">
<string>Long INT3</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioUd2">
<property name="text">
<string>UD2</string>
</property>
</widget>
</item>
</layout>
</item>
<item> <item>
<widget class="QCheckBox" name="chkUndecorateSymbolNames"> <widget class="QCheckBox" name="chkUndecorateSymbolNames">
<property name="text"> <property name="text">