[ASI] how to find phandle of the current process?

mistery

Well-known member
Joined
Apr 23, 2014
Messages
262
Reaction score
5
hi i'm creating an .asi that will load with asi loader
it's all good , but i want to write memory , and i need the process' phandle

i tried to find window , get pid and open process pid but it's not working (well it works , but only if i create the mod as .exe , but i want .asi to load with the game)

help lol
 

MasterZero

Member
Joined
Apr 20, 2013
Messages
22
Reaction score
1
https://msdn.microsoft.com/en-us/library/windows/desktop/ms683179(v=vs.85).aspx
 

mistery

Well-known member
Joined
Apr 23, 2014
Messages
262
Reaction score
5
supahdupahnubah said:
why would you get phandle if your dll is already in the game O_O

a , then , how to write a memory address to the current process?? lolll


MasterZero said:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms683179(v=vs.85).aspx

yess
tanks
 
Joined
Dec 31, 2015
Messages
712
Reaction score
27
mistery said:
supahdupahnubah said:
why would you get phandle if your dll is already in the game O_O

a , then , how to write a memory address to the current process?? lolll

*(type*)0xB00B135 = value
or
type var = 0xB00B135;
*var = value;
or
type& var = *(var*)0xB00B135;
var = value;
or etc etc etc

this one is unmanaged native way, it's faster than WriteProcessMemory
managed write\read (reinterpret_cast and others) is also faster than WPM(), slower than unmanaged, but most safest
 

mistery

Well-known member
Joined
Apr 23, 2014
Messages
262
Reaction score
5
[font=Monaco, Consolas, Courier, monospace]Ok , so i tried every single possible way to write memory with an int value , no effect[/font]

[font=Monaco, Consolas, Courier, monospace]tried direct writing , *(DWORD*)0xSAMPLE = 1[/font]
[font=Monaco, Consolas, Courier, monospace]also tried memcpy , memset , WriteProcessMemory[/font]
[font=Monaco, Consolas, Courier, monospace]tried setting virtualprotect to R/W , still no effect[/font]

[font=Monaco, Consolas, Courier, monospace]Nothing happens , no value is changed. I have a different version with WPM that is .exe , and that one is working fine.[/font]
[font=Monaco, Consolas, Courier, monospace]But as .asi it is not working. This is the last code i have tried before giving up lmaoe[/font]


Code:
#include <iostream>
#include <windows.h>
#include <string>
#include <stdlib.h>
#include <cstdlib>
#include <time.h>
#include <stdio.h>
#include <ctime>
#include <memory.h>
using namespace std;
void startasi()
{
DWORD *adr = (DWORD*)0xSAMPLE_ADRESS;
DWORD Prot;
VirtualProtect((LPVOID)(int)adr, 1, PAGE_EXECUTE_READWRITE, &Prot);
memset(adr, 5, 1);
}
BOOL APIENTRY DllMain( HINSTANCE hAsi,
                     DWORD  reason,
                     LPVOID lpReserved
    )
{
if (reason == DLL_PROCESS_ATTACH)
{
   DisableThreadLibraryCalls(hAsi);
   CreateThread(0, 0, (LPTHREAD_START_ROUTINE)startasi, 0, 0, 0);
}
return 1;
}


H
E
L
P
 
Top