Skip to content

Instantly share code, notes, and snippets.

@spacemeowx2
Created July 18, 2017 03:23
Show Gist options
  • Save spacemeowx2/f17dba507dd06bfd5529c5a065c0e246 to your computer and use it in GitHub Desktop.
Save spacemeowx2/f17dba507dd06bfd5529c5a065c0e246 to your computer and use it in GitHub Desktop.
package
{
import flash.display.MovieClip;
import TryCatchTest.MyError
import TryCatchTest.MyError2
import flash.system.ApplicationDomain
import flash.system.SecurityDomain
import flash.system.LoaderContext
import flash.net.URLRequest
import flash.display.Loader;
import flash.events.Event;
import flash.events.UncaughtErrorEvent;
import flash.events.TimerEvent;
import flash.utils.Timer;
public class test extends MovieClip
{
loader: Loader;
CModule: Object;
public static var times: int = 0;
public static var times2: int = 0;
public static function callback(a) {
var p1,p2,p3,i;
trace('from callback:', a, times);
switch (times) {
case 1:
trace('wtf', CModule.read32(a + 4))
trace('wtf', CModule.readString(CModule.read32(a), 128))
// CModule.write8(a + 4, 2)
break
case 2:
p1 = CModule.read32(a + 0)
p2 = CModule.read32(a + 4)
p3 = CModule.read32(a + 8)
/*trace(p1, CModule.read32(p1), CModule.read32(p1+4), CModule.read32(p1+8), CModule.read32(p1+12))
trace(p2, CModule.read32(p2), CModule.read32(p2+4), CModule.read32(p2+8), CModule.read32(p2+12))
trace(p3)
for(i=0; i<16; i++){
// CModule.write8(p2 + i, 2)
}*/
break
}
times++;
}
public static function callbackEnd(a) {
var p1,p2,p3,i;
trace('from callbackEnd:', a, times2);
switch (times2) {
case 1:
p1 = CModule.read32(a + 0)
p2 = CModule.read32(a + 4)
p3 = CModule.read32(a + 8)
trace(p1, CModule.read32(p1), CModule.read32(p1+4), CModule.read32(p1+8), CModule.read32(p1+12))
trace(p2, CModule.read32(p2), CModule.read32(p2+4), CModule.read32(p2+8), CModule.read32(p2+12))
trace(p3)
var tmp = ''
for (i=0; i<256; i++) {
tmp += CModule.read8(a + 256 - 2560 + i) + ' '
}
// trace(tmp)
break
}
times2++;
}
public function test()
{
var loaderContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
loader = new Loader();
loader.addEventListener(Event.COMPLETE, this.loadComplete);
loader.load(new URLRequest("3.swf"), loaderContext);
trace('load');
var timer:Timer = new Timer(500, 1);
timer.addEventListener(TimerEvent.TIMER, function () {
trace("good");
CModule = flash.utils.getDefinitionByName("sample.xx.CModule");
// CModule.callI()
var StreamSignDataPtr = CModule.malloc(4);
var obj = flash.utils.getDefinitionByName("xx");
var ret = obj.sub_13(24422,24806344,'048FAF1A9A1184F1E7058DF6EC1EA093',StreamSignDataPtr);
var sign = CModule.readString(CModule.read32(StreamSignDataPtr), 32)
trace(StreamSignDataPtr);
trace(sign);
});
timer.start();
}
public function loadComplete(e:Event):void{
trace('COMPLETE');
var obj:Object = this.loader.content;
trace(typeof obj);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment