Skip to content

Commit

Permalink
CEffect and CEvent, decode eventScopes and clean up.
Browse files Browse the repository at this point in the history
  • Loading branch information
MattMills committed Aug 25, 2022
1 parent 260da0c commit 13a24e1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 23 deletions.
42 changes: 20 additions & 22 deletions src/dll/ceffect.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

#include "dll/ceffect.h"
#include "dll/hooking_common.h"
#include "dll/ceventscope.h"

extern CLog logger;

Expand All @@ -16,36 +17,33 @@ __declspec(noinline) void ceffect_executeactual_payload(void* ptr1, void* ptr2)
logger << "ptr1(" << ptr1 << ") ptr2(" << ptr2 << ") ";
#endif

uint8_t buf[0x20 + 1]; // CString size
memset(buf, 0x00, sizeof(buf));
memcpy(&buf, (void*)(((intptr_t)ptr1) + 0x20), sizeof(buf));
char charbuf[0x20 + 1];
charbuf[0x20] = 0;
for (unsigned int j = 0; j < 0x10; j++)
sprintf(&charbuf[2 * j], "%02X", buf[j]);
#if DBG_PTR == 1
logger << "ptr1 charbuf(" << charbuf << ") - ";
#endif
int32_t* escopetype = (int32_t*)(((intptr_t)ptr2) + 8);
uint32_t* objectid = (uint32_t*)(((intptr_t)ptr2) + 12);

void* file_location_desc = nullptr;
void* id = nullptr;
logger << " " << enum_to_string_escopetype(*escopetype) << " ObjectID(" << *objectid << ")";

char* strptr = nullptr;
memcpy(&strptr, &buf, 0x8);
//0x20 = CEvent::_FileLocationDesc
//0x40 = CEvent::_ID
std::string* strFileLocationDesc = (std::string*)((intptr_t)ptr1 + 0x20);
std::string* strID = (std::string*)((intptr_t)ptr1 + 0x40);

if (strptr != nullptr) {

if (strFileLocationDesc != nullptr) {
#if DBG_PTR == 1
logger << "strptr(" << (void*)strptr << ")";
logger << "strptr(" << (void*)strFileLocationDesc << ")";
#endif
logger << " " << strptr;
logger << " Desc(" << *strFileLocationDesc << ")";
}

if (strID != nullptr) {
#if DBG_PTR == 1
logger << "strptr(" << (void*)strID << ")";
#endif
logger << " ID(" << *strID << ")";
}

logger.endl();
/*memset(&buf, 0x00, sizeof(buf));
memcpy(&buf, ptr2, 136);
logger << buf;
logger.endl();
*/

void(*func_ptr)(void* ptr1, void* ptr2);;
PopAddress(uint64_t(&func_ptr));
return func_ptr(ptr1, ptr2);
Expand Down
10 changes: 9 additions & 1 deletion src/dll/cevent.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "dll/cevent.h"
#include "dll/ceventscope.h"

extern CLog logger;

Expand All @@ -13,10 +14,17 @@ __declspec(noinline) void cevent_execute_payload(void* ptr1) {
#if DBG_PTR == 1
logger << "ptr1(" << ptr1 << ") ";
#endif


int32_t* escopetype = (int32_t*)(((intptr_t)ptr1) + 0x30);
uint32_t* objectid = (uint32_t*)(((intptr_t)ptr1) + 0x34);

logger << " " << enum_to_string_escopetype(*escopetype) << " ObjectID(" << *objectid << ")";

std::string* str_event_id = nullptr;
str_event_id = (std::string*)(((intptr_t)ptr1) + 0x10);

logger << "Event ID (" << str_event_id->c_str() << ")";
logger << " EventID(" << str_event_id->c_str() << ")";
logger.endl();

void(*func_ptr)(void* ptr1);;
Expand Down

0 comments on commit 13a24e1

Please sign in to comment.