From 60de0a7702943a0764994e48d9c14d929a4091ab Mon Sep 17 00:00:00 2001 From: gyt4 <158863045+gyt4@users.noreply.github.com> Date: Thu, 28 Mar 2024 15:34:29 +0800 Subject: [PATCH 1/4] Update qr.cpp --- src/patches/qr.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/patches/qr.cpp b/src/patches/qr.cpp index 6924251..e522019 100644 --- a/src/patches/qr.cpp +++ b/src/patches/qr.cpp @@ -163,23 +163,15 @@ HOOK_DYNAMIC (i64, __fastcall, copy_data, i64, void *dest, int length) { } else if (gMode == Mode::Plugin) { FARPROC getQrEvent = GetProcAddress (gPlugin, "getQr"); if (getQrEvent) { - std::vector byteBuffer = ((GetQrEvent*) getQrEvent) (); - // std::vector byteBuffer = {0x53, 0x31, 0x32, 0x00, 0x01, 0x26, 0x7D, 0xA4, 0x3C, 0x34, 0xEC, 0x3E, 0x7F, 0xA9, 0x52, 0x34, 0xFF, 0xAF, 0x94, 0xA4, 0x99, 0xFE, 0xDD, 0x47, 0x22, 0xB3, 0xDF, 0xA4, 0x4C, 0x9D, 0xAB, 0x10, 0x22, 0x91, 0xDA, 0x16, 0xF1}; + // std::vector byteBuffer = ((GetQrEvent*) getQrEvent) (); + unsigned char tmp_data[37] = {0x53, 0x31, 0x32, 0x00, 0x01, 0x26, 0x7d, 0xa4, 0x3c, 0x34, 0xec, 0x3e, 0x7f, 0xa9, 0x52, 0x34, 0xff, 0xaf, 0x94, 0xa4, 0x99, 0xfe, 0xdd, 0x47, 0x22, 0xb3, 0xdf, 0xa4, 0x4c, 0x9d, 0xab, 0x10, 0x22, 0x91, 0xda, 0x16, 0xf1}; + - std::stringstream ss; - ss << std::hex << std::uppercase << std::setfill('0'); - for (const auto& byte : byteBuffer) { - ss << std::setw(2) << static_cast(byte) << " "; - } - - std::cout << "Plugin QR: " << ss.str() << std::endl; - auto dataSize = byteBuffer.size(); - - // memcpy (dest, byteBuffer.data(), dataSize); + memcpy (dest, tmp_data, 37); std::cout << "Data consumed! len = " << dataSize << std::endl; gState = State::Ready; gMode = Mode::Card; - return 0; + return 37; } else { gState = State::Ready; gMode = Mode::Card; From 7ede13e6269784f8f1e92c7224a100aa84e9ac0b Mon Sep 17 00:00:00 2001 From: gyt4 <158863045+gyt4@users.noreply.github.com> Date: Thu, 28 Mar 2024 15:44:41 +0800 Subject: [PATCH 2/4] Update qr.cpp --- src/patches/qr.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/patches/qr.cpp b/src/patches/qr.cpp index e522019..d9e2d67 100644 --- a/src/patches/qr.cpp +++ b/src/patches/qr.cpp @@ -168,7 +168,6 @@ HOOK_DYNAMIC (i64, __fastcall, copy_data, i64, void *dest, int length) { memcpy (dest, tmp_data, 37); - std::cout << "Data consumed! len = " << dataSize << std::endl; gState = State::Ready; gMode = Mode::Card; return 37; From b69726fa9bcc442c14bad47d485d16bcecbe8601 Mon Sep 17 00:00:00 2001 From: gyt4 <158863045+gyt4@users.noreply.github.com> Date: Thu, 28 Mar 2024 15:53:50 +0800 Subject: [PATCH 3/4] Update qr.cpp --- src/patches/qr.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/patches/qr.cpp b/src/patches/qr.cpp index d9e2d67..d038e8e 100644 --- a/src/patches/qr.cpp +++ b/src/patches/qr.cpp @@ -22,7 +22,7 @@ extern std::vector plugins; typedef void event (); typedef bool CheckQrEvent(); -typedef std::vector GetQrEvent(); +typedef int GetQrEvent(char *buf_); namespace patches::Qr { @@ -163,14 +163,12 @@ HOOK_DYNAMIC (i64, __fastcall, copy_data, i64, void *dest, int length) { } else if (gMode == Mode::Plugin) { FARPROC getQrEvent = GetProcAddress (gPlugin, "getQr"); if (getQrEvent) { - // std::vector byteBuffer = ((GetQrEvent*) getQrEvent) (); - unsigned char tmp_data[37] = {0x53, 0x31, 0x32, 0x00, 0x01, 0x26, 0x7d, 0xa4, 0x3c, 0x34, 0xec, 0x3e, 0x7f, 0xa9, 0x52, 0x34, 0xff, 0xaf, 0x94, 0xa4, 0x99, 0xfe, 0xdd, 0x47, 0x22, 0xb3, 0xdf, 0xa4, 0x4c, 0x9d, 0xab, 0x10, 0x22, 0x91, 0xda, 0x16, 0xf1}; - - - memcpy (dest, tmp_data, 37); + unsigned char plugin_data[10086] ; + int buf_len = ((GetQrEvent*) getQrEvent) (plugin_data); + memcpy (dest, plugin_data, buf_len); gState = State::Ready; gMode = Mode::Card; - return 37; + return buf_len; } else { gState = State::Ready; gMode = Mode::Card; From c72368f547a8ed2deb7302d6df424abb070b016e Mon Sep 17 00:00:00 2001 From: gyt4 <158863045+gyt4@users.noreply.github.com> Date: Thu, 28 Mar 2024 15:59:39 +0800 Subject: [PATCH 4/4] Update qr.cpp --- src/patches/qr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/patches/qr.cpp b/src/patches/qr.cpp index d038e8e..c9d61d2 100644 --- a/src/patches/qr.cpp +++ b/src/patches/qr.cpp @@ -22,7 +22,7 @@ extern std::vector plugins; typedef void event (); typedef bool CheckQrEvent(); -typedef int GetQrEvent(char *buf_); +typedef int GetQrEvent(unsigned char *buf_); namespace patches::Qr {