public byte[] Execute(byte[] EA, int pointer_position) { if (HNDL == 0) { return(EA); } if (EA.Length < 1) { Execute(); return(EA); } int wrt = 0; int FP = EF.VirtualAllocEx(HNDL, 0, CD.LENGTH, 0x1000, 4); int OP = EF.VirtualAllocEx(HNDL, 0, EA.Length, 0x1000, 4); Copy(OP, pointer_position, 4); EF.WriteProcessMemory(HNDL, FP, CD.DATA, CD.LENGTH, ref wrt); EF.WriteProcessMemory(HNDL, OP, EA, EA.Length, ref wrt); int TH = EF.CreateRemoteThread(HNDL, 0, 0, FP, 0, 0, ref wrt); if (TH == -1) { EF.VirtualFreeEx(HNDL, FP, CD.LENGTH, 0x8); EF.VirtualFreeEx(HNDL, OP, EA.Length, 0x8); return(EA); } EF.WaitForSingleObject(TH, 0xFFFFFFFF); EF.ReadProcessMemory(HNDL, OP, EA, EA.Length, ref wrt); EF.CloseHandle(TH); EF.VirtualFreeEx(HNDL, FP, CD.LENGTH, 0x8); EF.VirtualFreeEx(HNDL, OP, EA.Length, 0x8); return(EA); }
public static int RD(int HNDL, int PTR) { byte[] buffer = new byte[4]; int read = 0; EF.ReadProcessMemory(HNDL, PTR, buffer, 4, ref read); return(BitConverter.ToInt32(buffer, 0)); }
public static float RF(int HNDL, int PTR) { byte[] buffer = new byte[4]; int read = 0; EF.ReadProcessMemory(HNDL, PTR, buffer, 4, ref read); float[] lc = new float[1]; Buffer.BlockCopy(buffer, 0, lc, 0, 4); return(lc[0]); }
public static String RS(int HNDL, int PTR, int size = 64, Boolean IsUnicode = true) { byte[] buffer = new byte[size]; int read = 0; EF.ReadProcessMemory(HNDL, PTR, buffer, size, ref read); if (!IsUnicode) { int c = 0; for (int i = 0; i < size; i++) { if (buffer[i] == 0) { break; } else { c++; } } byte[] cb = new byte[c]; Buffer.BlockCopy(buffer, 0, cb, 0, c); return(System.Text.Encoding.Default.GetString(cb)); } else { char[] cb = new char[size / 2]; Buffer.BlockCopy(buffer, 0, cb, 0, (int)size); int c = 0; for (int i = 0; i < size / 2; i++) { if (cb[i] == 0) { break; } else { c++; } } char[] str = new char[c]; Buffer.BlockCopy(cb, 0, str, 0, c * 2); return(new String(str)); } }
public void LoadInventory() { BIL.Clear(); int rr = -1; int BIB = Memory.RD(CHR.HNDL, MBO + OFS.GetInt("BS_InventoryBegin")); int BIE = Memory.RD(CHR.HNDL, MBO + OFS.GetInt("BS_InventoryEnd")); while (BIB < BIE) { byte[] buffer = new byte[OFS.GetInt("BS_InventoryItemSize")]; EF.ReadProcessMemory(CHR.HNDL, BIB, buffer, buffer.Length, ref rr); int[] oa = new int[buffer.Length / 4]; Buffer.BlockCopy(buffer, 0, oa, 0, buffer.Length); BeastItem NBI = new BeastItem(CHR); NBI.id = oa[OFS.GetInt("BS_BI_ID") / 4]; NBI.count = oa[OFS.GetInt("BS_BI_Count") / 4]; BIL.Add(NBI.id, NBI); BIB += OFS.GetInt("BS_InventoryItemSize"); } }
public void LoadEnemy() { ENEMY.Clear(); int rr = -1; int EAB = Memory.RD(CHR.HNDL, MBO + OFS.GetInt("BS_EnemyArrayBegin")); int EAE = Memory.RD(CHR.HNDL, MBO + OFS.GetInt("BS_EnemyArrayEnd")); while (EAB < EAE) { byte[] buffer = new byte[OFS.GetInt("BS_ArrayItemSize")]; EF.ReadProcessMemory(CHR.HNDL, EAB, buffer, buffer.Length, ref rr); uint[] oa = new uint[buffer.Length / 4]; Buffer.BlockCopy(buffer, 0, oa, 0, buffer.Length); Beast NB = Beast.Parse(oa, CHR); if (NB != null && !ENEMY.ContainsKey(NB.ID)) { ENEMY.Add(NB.ID, NB); } EAB += OFS.GetInt("BS_ArrayItemSize"); } }
public void LoadMyDynamic() { int rr = -1; int DSB = Memory.RD(CHR.HNDL, CHR.CSP, "PL_BS_Struct+PL_BS_P1+PL_BS_P2+PL_BS_Begin"); int DSE = Memory.RD(CHR.HNDL, CHR.CSP, "PL_BS_Struct+PL_BS_P1+PL_BS_P2+PL_BS_End"); int DSL = OFS.GetInt("PL_BS_Length"); while (DSB < DSE) { byte[] buffer = new byte[DSL]; EF.ReadProcessMemory(CHR.HNDL, DSB, buffer, buffer.Length, ref rr); uint[] oa = new uint[buffer.Length / 4]; Buffer.BlockCopy(buffer, 0, oa, 0, buffer.Length); int ID1 = (int)oa[OFS.GetInt("PL_BS_Item_ID1") / 4]; int ID2 = (int)oa[OFS.GetInt("PL_BS_Item_ID2") / 4]; if (MY.ContainsKey(ID1)) { MY[ID1].ID2 = ID2; } DSB += DSL; } }