Results 1 to 1 of 1
  1. #1
    jin77un
    jin77un is offline
    Inactive
    Join Date
    2018 Feb
    Posts
    1
    Thanks Thanks Given 
    0
    Thanks Thanks Received 
    0
    Thanked in
    0 Posts
    Rep Power
    0

    Question Help How to Convert C to Delphi

    Code:
    #include <windows.h>
    #include <stdio.h>
    #include <tlhelp32.h>
    unsigned long _GetProcessId( char* szProcName )
    {
        PROCESSENTRY32 pe32;
        HANDLE hHandle;
     
        hHandle = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
        pe32.dwSize = sizeof( PROCESSENTRY32 );
     
        if( !Process32First( hHandle, &pe32 ) )
            return 0;
     
        while( Process32Next( hHandle, &pe32 ) )
        {
            if( strcmp( szProcName, pe32.szExeFile ) == 0 )
            {
                CloseHandle( hHandle );
                return pe32.th32ProcessID;
            }
        }
        CloseHandle( hHandle );
     
        return 0;
    }
     
    unsigned long _ScanForBytes( char* szProcess, char* szBytes )
      {
         HANDLE hHandle;
         SYSTEM_INFO sysInfo;
         MEMORY_BASIC_INFORMATION mbi;
         unsigned long dwMemAddr;
         unsigned long x;
     
         hHandle = OpenProcess( PROCESS_QUERY_INFORMATION|PROCESS_VM_OPERATION|PROCESS_VM_READ, FALSE, _GetProcessId( szProcess ) );
          if( hHandle == INVALID_HANDLE_VALUE || hHandle == NULL )
            return 0;   
         GetSystemInfo( &sysInfo );
         dwMemAddr = (unsigned long)sysInfo.lpMinimumApplicationAddress;
          while( dwMemAddr < (unsigned long)sysInfo.lpMaximumApplicationAddress )
         {
            if( VirtualQueryEx( hHandle, (unsigned long*)dwMemAddr, &mbi, sizeof(mbi) ) == sizeof(mbi) )
      {
                if( (mbi.Protect != PAGE_NOACCESS) && (mbi.State == MEM_COMMIT) )
                {
                    char* szMemDump = (char*)malloc(mbi.RegionSize+1);
                    
                    ReadProcessMemory( hHandle, (unsigned long*)dwMemAddr, szMemDump, mbi.RegionSize, NULL );
                    for( x=0; x<mbi.RegionSize; x++ )
              {
                        if( memcmp( (void*)(szMemDump+x), (void*)szBytes, strlen( szBytes ) ) == 0 )
                        {
                            free( szMemDump );
                            return (unsigned long)( dwMemAddr + x );
                        }
              }
                    free( szMemDump );
                }
            }
            dwMemAddr = (unsigned long)mbi.BaseAddress + mbi.RegionSize;
        }
        CloseHandle( hHandle );
     
        return 0;
    }

Similar Threads

  1. fry cry 4 bin convert to xml
    By lacek33 in forum Aika Bots, Hacks, Cheats
    Replies: 0
    Last Post: 2015-01-29, 08:25 PM
  2. [Delphi] Delphi elementclient inject
    By marcelo380 in forum Perfect World
    Replies: 0
    Last Post: 2012-06-08, 09:13 PM
  3. can someone convert that? c to delphi ?
    By kofmaster in forum Delphi
    Replies: 3
    Last Post: 2011-08-22, 01:39 AM
  4. Convert small function C to Delphi
    By [E]Key in forum Delphi
    Replies: 2
    Last Post: 2011-03-26, 01:46 PM
  5. [Delphi] Delphi Training Video
    By Dwar in forum Programming Tutorials
    Replies: 0
    Last Post: 2010-11-29, 04:10 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •