void CLoadNotifier::PatchL(void) { _LIT(KSysapStackMask,"*Sysap::$STK"); _LIT(KGD1Eng,"gd1eng.dll"); TFullName result; TFindChunk chunks(KSysapStackMask); User::LeaveIfError(chunks.Next(result)); RChunk chunk; User::LeaveIfError(chunk.Open(chunks,EOwnerThread)); CleanupClosePushL(chunk); RLibrary gd1eng; User::LeaveIfError(gd1eng.Load(KGD1Eng)); CleanupClosePushL(gd1eng); TUint8* export1=(TUint8*)gd1eng.Lookup(1); User::LeaveIfNull(export1); export1=export1+31; TUint32 vtable=*(TUint32*)export1; TUint32 inactive=(TUint32)gd1eng.Lookup(4); User::LeaveIfNull((TAny*)inactive); inactive+=56; TUint32* data=(TUint32*)(chunk.Base()+chunk.Bottom()); TInt length=(chunk.Top()-chunk.Bottom())/sizeof(TUint32); TInt flagIndex=0,inactiveIndex=0; for(TInt i=0;i<length;i++) { if(!flagIndex&&data[i]==vtable) { flagIndex=i+19; } if(!inactiveIndex&&data[i]==inactive) { inactiveIndex=i; } if(flagIndex&&inactiveIndex) break; } if(flagIndex&&inactiveIndex) { data[inactiveIndex+2]=data[inactiveIndex]; data[flagIndex]=1; } CleanupStack::PopAndDestroy(2); //gd1eng, chunk }
void MainL() { RChunk gChunk; User::LeaveIfError(gChunk.Open(1)); CleanupClosePushL(gChunk); TInt offset; User::LeaveIfError(User::GetTIntParameter(2,offset)); TInt SessionHandle; User::LeaveIfError(User::GetTIntParameter(3,SessionHandle)); CRunProc *test = new (ELeave) CRunProc; test->setFont(reinterpret_cast<CFont*>(offset + reinterpret_cast<TInt>(gChunk.Base()))); test->setHandle(SessionHandle); CleanupStack::PushL(test); RDebug::Print(_L("T_fontsessioncacheproc MainL()")); test->RunTestL(); CleanupStack::PopAndDestroy(2); }