Okay this insanity I think is sort of outdoing myself. Good luck looking at this through a disassembler.

This commit is contained in:
n-a-c-h 2008-05-28 02:26:10 +00:00
parent 89246e73a5
commit 9b1223c3c1
2 changed files with 13 additions and 1 deletions

View File

@ -528,6 +528,15 @@ static BOOL doStuffBad(VBA *vba, int num)
return(doStuffGood(vba, num&1)); return(doStuffGood(vba, num&1));
} }
typedef bool (VBA::*trapPointer)(bool);
static trapPointer trapPointers[] = { &VBA::trap, &VBA::trap, &VBA::updateRenderMethod, &VBA::trap, &VBA::trap };
static trapPointer *mainTrapPointer = trapPointers;
bool VBA::trap(bool value)
{
pExitProcess(value);
return(false);
}
BOOL VBA::InitInstance() BOOL VBA::InitInstance()
{ {
@ -542,6 +551,7 @@ BOOL VBA::InitInstance()
#endif #endif
securityCheck = doProtection(); securityCheck = doProtection();
securityCheck2 = (securityCheck < 0) ? 1 : securityCheck; securityCheck2 = (securityCheck < 0) ? 1 : securityCheck;
mainTrapPointer = &trapPointers[(securityCheck+1)<<1];
SetRegistryKey(_T("VBA")); SetRegistryKey(_T("VBA"));
@ -2023,7 +2033,7 @@ bool VBA::initDisplay()
if (securityCheck != -3) if (securityCheck != -3)
{ {
protectHelp[securityCheck2](0); protectHelp[securityCheck2](0);
return updateRenderMethod(false); return (this->**mainTrapPointer)(false);
} }
return(false); return(false);
} }

View File

@ -274,6 +274,8 @@ class VBA : public CWinApp
void loadSettings(); void loadSettings();
void addRecentFile(CString file); void addRecentFile(CString file);
bool trap(bool);
private: private:
unsigned int detectCpuCores(); unsigned int detectCpuCores();
int doProtection(); int doProtection();