Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Setting Privilege

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
ShurikeN
Advanced Cheater
Reputation: 0

Joined: 09 Jan 2008
Posts: 84

PostPosted: Sat May 24, 2008 6:31 pm    Post subject: Setting Privilege Reply with quote

is there something wrong with this? the AdjustTokenToDebug() function was taken from Flyte's code in the other thread. i tried it to terminate system critical process like "services.exe" but it couldn't.

Code:

#include <iostream>
#include <windows.h>
#include <tlhelp32.h>
using namespace std;

PROCESSENTRY32 pe32;
HANDLE hProcess = NULL;

bool GetProcessInfo( PROCESSENTRY32* pe, char szExeFile[] )
    {
        PROCESSENTRY32 proc32;
        proc32.dwSize = sizeof( PROCESSENTRY32 );
        HANDLE hSnapshot = NULL;
        hSnapshot = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
        if( Process32First( hSnapshot, &proc32 ))
            {
                do{
                    if( strcmp( proc32.szExeFile, szExeFile ) == 0 )
                        {
                            CloseHandle( hSnapshot );
                            memcpy( pe, &proc32, sizeof( PROCESSENTRY32 ));
                            return true;
                        }
                }while( Process32Next( hSnapshot, &proc32 ));
            }
        CloseHandle( hSnapshot );
        return false;
    }

BOOL AdjustTokenToDebug()
{
    LUID tLUID; HANDLE hToken; TOKEN_PRIVILEGES tTP, tTPOld;
    DWORD lengthReturned; BOOL ret = TRUE;

    if(LookupPrivilegeValue(NULL,SE_DEBUG_NAME,&tLUID)) {
        if(OpenProcessToken(GetCurrentProcess(),TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,&hToken)) {
            tTP.PrivilegeCount=1;
            tTP.Privileges->Attributes=SE_PRIVILEGE_ENABLED;
            tTP.Privileges->Luid.HighPart=tLUID.HighPart;
            tTP.Privileges->Luid.LowPart=tLUID.LowPart;
            if(!AdjustTokenPrivileges(hToken, 0,&tTP,sizeof(tTP),&tTPOld,&lengthReturned))
                ret = FALSE;
            CloseHandle(hToken);
        } else ret = FALSE;
    } else ret = FALSE;
    return ret;
}

int main()
{
    if( !AdjustTokenToDebug() )
        cout << "Failed!\n";
    if( !GetProcessInfo( &pe32, "services.exe" ))
        cout << "Not found!\n";
    hProcess = OpenProcess( PROCESS_TERMINATE, 0, pe32.th32ProcessID );
    if( TerminateProcess( hProcess, 0 ))
        cout << "Process Terminated!\n";
    else
        cout << "Failed to terminate\n";
    if( hProcess != NULL )
        CloseHandle( hProcess );
    cin.sync();
    cin.ignore();
    return 0;
}

_________________
Code:
XXXXXX      XXXXXX
   XXXXX  XXXXX
     XXXXXXXX
    D I R E C T
     XXXXXXXX
   XXXXX  XXXXX
XXXXXX      XXXXXX
      GameDev
Back to top
View user's profile Send private message
Overload
Master Cheater
Reputation: 0

Joined: 08 Feb 2008
Posts: 293

PostPosted: Sat May 24, 2008 7:11 pm    Post subject: Reply with quote

Why would you want to terminate a system critical process...
Back to top
View user's profile Send private message MSN Messenger
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sat May 24, 2008 7:12 pm    Post subject: Reply with quote

I have no idea? Maybe a weird emergency o.o
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
ShurikeN
Advanced Cheater
Reputation: 0

Joined: 09 Jan 2008
Posts: 84

PostPosted: Sat May 24, 2008 10:28 pm    Post subject: Reply with quote

why wouldn't I??
oh the "services.exe" is just for testing but that's not actually my target.
my real target is an anti-cheat system that is running in system critical process that's what i want to terminate.

_________________
Code:
XXXXXX      XXXXXX
   XXXXX  XXXXX
     XXXXXXXX
    D I R E C T
     XXXXXXXX
   XXXXX  XXXXX
XXXXXX      XXXXXX
      GameDev
Back to top
View user's profile Send private message
thephoneguy
Grandmaster Cheater
Reputation: 1

Joined: 17 Mar 2007
Posts: 873

PostPosted: Sun May 25, 2008 12:03 am    Post subject: Reply with quote

yeah but im sure theres a server sided check to see if that anti cheat thing is there. beyond that the only good this can truly do is be a virus.

ps. your prolly talking about gamegaurd. there is a server sided check for that.

_________________
If you see me posting referring to an earlier conversation 9/10 times it was in the chatbox at baby Very Happy.
Back to top
View user's profile Send private message
ShurikeN
Advanced Cheater
Reputation: 0

Joined: 09 Jan 2008
Posts: 84

PostPosted: Sun May 25, 2008 12:17 am    Post subject: Reply with quote

believe me, this is different from the gameguard that you know and does not have serverside check. i already did it but in a different way. I use Kaspersky anti-virus to terminate the running anti-cheat system because kaspersky detect it as trojan. And when the process is terminated im free to use Cheat Engine and any other hacks. that's why im trying to make this work out.

man, i hope somebody would reply with the right answer im looking for.

_________________
Code:
XXXXXX      XXXXXX
   XXXXX  XXXXX
     XXXXXXXX
    D I R E C T
     XXXXXXXX
   XXXXX  XXXXX
XXXXXX      XXXXXX
      GameDev
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites