Bypassing SAMPCAC's protection of the samp.dll module in a very hacky and basic way.
This project is meant for people who want to use the SAMP-UDF in their Autohotkey application.
First you need to copy the following code in your Autohotkey application BEFORE you include the SAMP-UDF.
❗ The sampcac-loader.exe and sampcac-loader.dll have to be in a folder called dll
❗ If you want to use another path or other file name then you have to modify and build the sampcac-loader yourself.
global sampcac_mode := false
global sampdll_base_address := 0
WinGetTitle, gta_title, ahk_exe gta_sa.exe
global gta_title
WinGet, gta_process, ProcessName, %gta_title%
WinGet, gta_path, ProcessPath, %gta_title%
WinGet, gta_pid, PID, %gta_title%
gta_folder := StrReplace(gta_path, gta_process, "", "Off")
Loop, Files, %gta_folder%*, F
{
if (RegExMatch(A_LoopFileName, "sampcac") && A_LoopFileExt == "asi") {
msgbox, 0x40044, Loader, sampcac found!`nDo you want to start with sampcac mode?
IfMsgBox Yes
init_sampcac()
}
}
init_sampcac() {
global
sampcac_mode := true
Run *RunAs %A_ScriptDir%\dll\sampcac-loader.exe
sleep 5000
FileReadLine, sampdll_base_address, %gta_folder%\samp.dat, 1
}
If you have your own SAMP-UDF or something similiar then you have to modify it in order to get this bypass to work.
Replace the following functions in your SAMP-UDF or copy and paste the additional code.
❗ Skip this step if you use the SAMP-UDF from the example
refreshGTA() {
newPID := getPID(gta_title) ; <--- modified
if (!newPID) {
if (hGTA) {
virtualFreeEx(hGTA, pMemory, 0, 0x8000)
closeProcess(hGTA)
hGTA := 0x0
}
dwGTAPID := 0
hGTA := 0x0
dwSAMP := 0x0
pMemory := 0x0
return false
}
if (!hGTA || (dwGTAPID != newPID)) {
hGTA := openProcess(newPID)
if (ErrorLevel) {
dwGTAPID := 0
hGTA := 0x0
dwSAMP := 0x0
pMemory := 0x0
return false
}
dwGTAPID := newPID
dwSAMP := 0x0
pMemory := 0x0
return true
}
return true
}
refreshSAMP() {
if (dwSAMP)
return true
;applying bypass
dwSAMP := sampcac_mode ? "0x" + sampdll_base_address : getModuleBaseAddress("samp.dll", hGTA)
if (!dwSAMP)
return false
versionByte := readMem(hGTA, dwSAMP + 0x1036, 1, "UChar")
sampVersion := versionByte == 0xD8 ? 1 : (versionByte == 0xA8 ? 2 : (versionByte == 0x78 ? 3 : 0))
if (!sampVersion)
return false
return true
}
If you have applied everything correctly then you should be able to use everything that is provided in the SAMP-UDF.
Any questions or problems?
Feel free to open an issue.
https://github.com/DarthTon/Blackbone
https://github.com/boostorg/algorithm