From 6237ecd17f99afdaca3c1cc6a30d0e04650bf568 Mon Sep 17 00:00:00 2001 From: Yosin-Lenheart Date: Tue, 15 Feb 2022 00:51:34 +0800 Subject: [PATCH] 1 --- test/pch.h | 6 ++++++ test/test.vcxproj | 2 +- test/函数块.cpp | 13 ++++++++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/test/pch.h b/test/pch.h index 950eb87..a08c429 100644 --- a/test/pch.h +++ b/test/pch.h @@ -124,9 +124,15 @@ static SQfopenFunc* SQfopen = (SQfopenFunc*)0x1355DC0; //SQfread typedef int(SQfreadFunc)(void* buffer, int a, int b, void* file); static SQfreadFunc* SQfread = (SQfreadFunc*)0x1355DD0; +//SQwrite +typedef int(SQwriteFunc)(void* buffer, int a, int b, void* file); +static SQwriteFunc* SQwrite = (SQwriteFunc*)0x1355DE0; //SQfseek typedef int(SQfseekFunc)(void* buffer, int a, int b); static SQfseekFunc* SQfseek = (SQfseekFunc*)0x1355DF0; +//SQftell +typedef int(SQftellFunc)(void* file); +static SQftellFunc* SQftell = (SQftellFunc*)0x1355E50; //SQ_File_read typedef int(SQ_File_readFunc)(void* file, void* afile, int a); static SQ_File_readFunc* SQ_File_read = (SQ_File_readFunc*)0x1356090; diff --git a/test/test.vcxproj b/test/test.vcxproj index b8941ac..2f56e9f 100644 --- a/test/test.vcxproj +++ b/test/test.vcxproj @@ -112,7 +112,7 @@ Use pch.h MultiThreaded - EditAndContinue + ProgramDatabase Console diff --git a/test/函数块.cpp b/test/函数块.cpp index 55780a9..17b369b 100644 --- a/test/函数块.cpp +++ b/test/函数块.cpp @@ -241,7 +241,6 @@ int GetEquAddr(int addr) static int SQloadfile(uint32_t v, const wchar_t* filename, bool printerror) { void* file = SQfopen(filename, L"rb"); - //void* file = (void*)"IIIAAA <- 66487"; int ret; unsigned short us; unsigned char uc; @@ -284,6 +283,18 @@ static int SQloadfile(uint32_t v, const wchar_t* filename, bool printerror) default: SQfseek(file, 0, 2); break; // ascii } + const char *add = "newstr"; + int prevpos = SQftell(file); + SQfseek(file, 0, 1); + int length = SQftell(file); + SQfseek(file, prevpos, 2); + char temp[256]; + SQwrite(&add, 1, sizeof(add), file); + SQfread(&temp, length + 10, sizeof(temp), file); + std::cout << temp << std::endl; + + + if (SQ_Compile(v, func, file, filename, printerror) >= 0) { SQ__Fclose(file);