summaryrefslogtreecommitdiff
path: root/src/menu.h
blob: f728c73f8cdc6c9488d4da6dde13426195c4b026 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//|_   _   _.     _  ._  |_   _.  _ |
//| | (/_ (_| \/ (/_ | | | | (_| (_ |<

#pragma once

#include "process.h"
#include "util.h"

#include "syscall.h"
#include "csgo/csgo.h"

static void syscall_dump_to_file() {
  static VECTOR< SYSCALL_ENTRY > syscalls = syscall_dump();
  static VECTOR< SYSCALL_ENTRY > syscalls64 = syscall_dump64();
  static VECTOR< MODULE_EXPORT64 > nt64_exports = module_get_exports64( nt_get_address64() );
  char* syscall_str = (char*)malloc( 100000 );

  memset( syscall_str, 0, 100000 );
  
  char line_buf[256]{};
  for( auto& it : syscalls ) {
    sprintf_s<256>( line_buf, "%d %s -> %llx\n", it.idx, it.name.data, it.base );
    strcat( syscall_str, line_buf );
  }

  FILE* dump = fopen( "./syscalls_32.dump", "w" );
  fwrite( syscall_str, strlen( syscall_str ), 1, dump );
  fclose( dump );

  memset( syscall_str, 0, 100000 );
  
  for( auto& it : syscalls64 ) {
    sprintf_s<256>( line_buf, "%d %s -> %llx\n", it.idx, it.name.data, it.base );
    strcat( syscall_str, line_buf );
  }

  dump = fopen( "./syscalls_64.dump", "w" );
  fwrite( syscall_str, strlen( syscall_str ), 1, dump );
  fclose( dump );

  memset( syscall_str, 0, 100000 );
  
  for( auto& it : nt64_exports ) {
    sprintf_s<256>( line_buf, "%s -> %llx\n", it.name.data, it.base );
    strcat( syscall_str, line_buf );
  }

  dump = fopen( "./nt64.dump", "w" );
  fwrite( syscall_str, strlen( syscall_str ), 1, dump );
  fclose( dump ); 

  free( syscall_str );
}

static void csgo_dump_ifaces_to_file( CSGO* p ) {
  std::vector< IFACE_ENTRY > ifaces = srceng_get_interfaces( p );
  static char iface_str[999999]{};

  memset( iface_str, 0, sizeof( iface_str ) );
  char line_buf[256]{};
  for( auto& it : ifaces ) {
    sprintf( line_buf, "%s -> %08x in [%s]\n", it.name.data, it.ptr, it.module_name.data );
    strcat( iface_str, line_buf );
  }

  FILE* dump = fopen( "./interfaces.dump", "w" );
  fwrite( iface_str, strlen( iface_str ), 1, dump );
  fclose( dump ); 
}

void show_paging( U8 num );

typedef void(*CON_PAGE_FN)();

struct MENU_PAGE {
  const char* name;
  CON_PAGE_FN page_fn;
};

const I8 MENU_PAGE_MIN = 0;
const I8 MENU_PAGE_MAX = 2;

extern I8 menu_page;
extern MENU_PAGE menu_pages[MENU_PAGE_MAX - MENU_PAGE_MIN + 1];

extern void menu_show_ui( PROCESS32* p );