Sinisterly
[C++] Protect Process - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: Coding (https://sinister.ly/Forum-Coding--71)
+--- Thread: [C++] Protect Process (/Thread-C-Protect-Process)



[C++] Protect Process - 3rd_Power - 05-31-2015

First you need to include (Visual Studio IDE): 
#include "stdafx.h"
#include <Windows.h>
#include <Aclapi.h>
#include <Sddl.h>

Here is the code:


Code:
BOOL ProtectProcess() { HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, GetCurrentProcessId()); SECURITY_ATTRIBUTES sa; TCHAR * szSD = TEXT("D:P")  ;  TEXT("(D;OICI;GA;;;BG)");     // Deny access to                                       // built-in guests         TEXT("(D;OICI;GA;;;AN)") ;   // Deny access to                                       // anonymous logon sa.nLength = sizeof(SECURITY_ATTRIBUTES); sa.bInheritHandle = FALSE; if (!ConvertStringSecurityDescriptorToSecurityDescriptor(szSD, SDDL_REVISION_1, &(sa.lpSecurityDescriptor), NULL)) return FALSE; if (!SetKernelObjectSecurity(hProcess, DACL_SECURITY_INFORMATION, sa.lpSecurityDescriptor)) return FALSE; return TRUE; }
Just simply call: ProtectProcess() in your main.
NOTE: Admin accounts will be able to bypass this.


RE: [C++] Protect Process - Zodiac - 05-31-2015

Seems interesting! Thanks for sharing this! Smile


RE: [C++] Protect Process - Jasper - 05-31-2015

Nice of you to share this, keep it up.


RE: [C++] Protect Process - 3rd_Power - 05-31-2015

Thanks guys, I will be sharing more of my sources later. I hope people will find use for all my random codes Smile


RE: [C++] Protect Process - CoolixHD - 06-08-2015

Very nice, thanks for sharing! Smile


RE: [C++] Protect Process - bitm0de - 07-29-2015

I see this is reposted from forum to forum without anyone even aware of the redundancy here with those TEXT macro strings... And it's not even complete/proper; LocalFree() is never called to free the return buffer.


RE: [C++] Protect Process - Kotomi - 08-18-2015

(07-29-2015, 05:58 AM)bitm0de Wrote: I see this is reposted from forum to forum without anyone even aware of the redundancy here with those TEXT macro strings... And it's not even complete/proper; LocalFree() is never called to free the return buffer.

This is right. Reporting this thread.