_ScriptProtect()
While 1
Sleep(100)
WEnd
Func _ScriptProtect()
If (IsAdmin()) Or (Not @Compiled) Then
Return 0
EndIf
Local $hProcess = _WinAPI_GetCurrentProcess()
Local $tACL = DllStructCreate('byte AclRevision;byte Sbz1;ushort AclSize;ushort AceCount;ushort Sbz2')
Local $pACL = DllStructGetPtr($tACL)
Local $tSD = DllStructCreate('byte[20]')
Local $pSD = DllStructGetPtr($tSD)
Local $Ret
$Ret = DllCall('advapi32.dll', 'int', 'InitializeSecurityDescriptor', 'ptr', $pSD, 'dword', 1)
If (@Error) Or (Not $Ret[0]) Then
Return 0
EndIf
$Ret = DllCall('advapi32.dll', 'int', 'InitializeAcl', 'ptr', $pACL, 'dword', DllStructGetSize($tACL), 'dword', 2)
If (@Error) Or (Not $Ret[0]) Then
Return 0
EndIf
$Ret = DllCall('advapi32.dll', 'int', 'SetSecurityDescriptorDacl', 'ptr', $pSD, 'int', 1, 'ptr', $pACL, 'int', 0)
If (@Error) Or (Not $Ret[0]) Then
Return 0
EndIf
$Ret = DllCall('advapi32.dll', 'int', 'SetKernelObjectSecurity', 'ptr', $hProcess, 'dword', 0x04, 'ptr', $pSD)
If (@Error) Or (Not $Ret[0]) Then
Return 0
EndIf
Return 1
EndFunc