From 5c6a48b2ff362a70416a6a00fda7d06e0f276f2d Mon Sep 17 00:00:00 2001 From: Ash Wolf Date: Sat, 1 Jul 2023 02:43:29 +0100 Subject: i am in hell --- src/T2DLL/CResFile.cpp | 55 +++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 27 deletions(-) (limited to 'src/T2DLL/CResFile.cpp') diff --git a/src/T2DLL/CResFile.cpp b/src/T2DLL/CResFile.cpp index 3c31ec7..310e45d 100644 --- a/src/T2DLL/CResFile.cpp +++ b/src/T2DLL/CResFile.cpp @@ -1,3 +1,4 @@ +#define ATOI_KLUDGE #include "CPEFile.h" #include "CResFile.h" #include "GlobalFunc.h" @@ -41,19 +42,19 @@ BOOL CResFile::OpenResource(HINSTANCE inst, int name, const char* type) { BOOL CResFile::OpenResource(HINSTANCE inst, const char* name, const char* type) { HRSRC h = FindResource(inst, name, type); if (!h) { - CString strN; + CString theNameString; if (((DWORD) name) < 0x10000) - strN.Format("(%d)", ((DWORD) name) & 0xFFFF); + theNameString.Format("(%d)", ((DWORD) name) & 0xFFFF); else - strN = name; + theNameString = name; - CString strT; + CString theTypeString; if (((DWORD) type) < 0x10000) - strT.Format("(%d)", ((DWORD) type) & 0xFFFF); + theTypeString.Format("(%d)", ((DWORD) type) & 0xFFFF); else - strT = type; + theTypeString = type; - CString str = "CResFile::OpenResource ERROR : " + strN + "," + strT + " @" + GetModuleName(inst) + "\n"; + CString str = "CResFile::OpenResource ERROR : " + theNameString + "," + theTypeString + " @" + GetModuleName(inst) + "\n"; OutputDebugString(str); return false; @@ -69,16 +70,16 @@ BOOL CResFile::OpenResource(HINSTANCE inst, HRSRC rsrc) { mInstance = inst; mRsrc = rsrc; - HANDLE handle = LoadResource(inst, rsrc); - if (!handle) + HANDLE theHandle = LoadResource(inst, rsrc); + if (!theHandle) return false; - void *p = LockResource(handle); + void *theData = LockResource(theHandle); mRemaining = SizeofResource(inst, rsrc); mBuffer = (char *) malloc(mRemaining + 1); - memcpy(mBuffer, p, mRemaining); - UnlockResource(handle); - FreeResource(handle); + memcpy(mBuffer, theData, mRemaining); + UnlockResource(theHandle); + FreeResource(theHandle); SetupResource(); @@ -86,28 +87,28 @@ BOOL CResFile::OpenResource(HINSTANCE inst, HRSRC rsrc) { } BOOL CResFile::OpenResource(const char* path, int name, int type) { - CFile *theFile = new CFile; - if (!theFile->Open(path, CFile::modeRead)) { - delete theFile; + CFile *file = new CFile; + if (!file->Open(path, CFile::modeRead)) { + delete file; return false; } char magic[2]; - theFile->Read(magic, 2); - theFile->Close(); - delete theFile; + file->Read(magic, 2); + file->Close(); + delete file; if (memcmp(magic, "SP", 2) == 0) { SUBPLUGINFSENTRY entry; - CFile *f = OpenSubPluginFS(magic, name, type, &entry); - if (!f) + CFile *subPluginFile = OpenSubPluginFS(path, name, type, &entry); + if (!subPluginFile) return false; mRemaining = entry.spfse_mC; mBuffer = (char *) malloc(mRemaining + 1); - f->Read(mBuffer, mRemaining); - f->Close(); - delete f; + subPluginFile->Read(mBuffer, mRemaining); + subPluginFile->Close(); + delete subPluginFile; mIsSubPlugin = true; } else if (memcmp(magic, "PE", 2) == 0) { @@ -122,10 +123,10 @@ BOOL CResFile::OpenResource(const char* path, int name, int type) { buf[3] = ((char *) &type)[0]; buf[4] = 0; - CString str; + CString path; unsigned short langID = GetUserDefaultLangID(); - str.Format("\\.rsrc\\%s\\#%d\\#%d", buf, name, langID); - if (!pe.Seek(str)) + path.Format("\\.rsrc\\%s\\#%d\\#%d", buf, name, langID); + if (!pe.Seek(path)) return false; mRemaining = pe.GetLength(); -- cgit v1.2.3