1
0
Fork 0

PROJECT: formatting

This commit is contained in:
Mr. eXoDia 2014-08-06 10:27:13 +02:00
parent ae8a5a1de1
commit 4122202a66
6 changed files with 33 additions and 32 deletions

View File

@ -107,9 +107,9 @@ static void _getcallstack(DBGCALLSTACK* callstack)
stackgetcallstack(GetContextDataEx(hActiveThread, UE_CSP), (CALLSTACK*)callstack);
}
static bool _getjitauto(bool * jit_auto)
static bool _getjitauto(bool* jit_auto)
{
return dbggetjitauto( jit_auto, notfound, NULL );
return dbggetjitauto(jit_auto, notfound, NULL);
}
static bool _getjit(char* jit, bool jit64)

View File

@ -54,7 +54,7 @@ typedef void (*MEMUPDATEMAP)(HANDLE hProcess);
typedef void (*GETCALLSTACK)(DBGCALLSTACK* callstack);
typedef void (*SYMBOLDOWNLOADALLSYMBOLS)(const char* szSymbolStore);
typedef bool (*GETJIT)(char* jit, bool x64);
typedef bool (*GETJITAUTO)(bool *);
typedef bool (*GETJITAUTO)(bool*);
typedef bool (*GETDEFJIT)(char*);
typedef bool (*GETPROCESSLIST)(DBGPROCESSINFO** entries, int* count);

View File

@ -1487,17 +1487,17 @@ void cbDetach()
return;
}
bool _readwritejitkey( char * jit_key_value, DWORD * jit_key_vale_size, char * key, arch arch_in, arch* arch_out, readwritejitkey_error_t * error, bool write)
bool _readwritejitkey(char* jit_key_value, DWORD* jit_key_vale_size, char* key, arch arch_in, arch* arch_out, readwritejitkey_error_t* error, bool write)
{
DWORD key_flags;
DWORD lRv;
HKEY hKey;
DWORD dwDisposition;
if ( error != NULL )
if(error != NULL)
* error = ERROR_RW;
if (write)
if(write)
key_flags = KEY_WRITE;
else
key_flags = KEY_READ;
@ -1533,13 +1533,13 @@ bool _readwritejitkey( char * jit_key_value, DWORD * jit_key_vale_size, char * k
#endif
}
if (write)
if(write)
{
lRv = RegCreateKeyEx(HKEY_LOCAL_MACHINE, JIT_REG_KEY, 0, NULL, REG_OPTION_NON_VOLATILE, key_flags, NULL, &hKey, &dwDisposition);
if(lRv != ERROR_SUCCESS)
return false;
lRv = RegSetValueExA(hKey, key, 0, REG_SZ, (BYTE*) jit_key_value, (DWORD) (* jit_key_vale_size) + 1);
lRv = RegSetValueExA(hKey, key, 0, REG_SZ, (BYTE*) jit_key_value, (DWORD)(* jit_key_vale_size) + 1);
RegCloseKey(hKey);
}
else
@ -1547,7 +1547,7 @@ bool _readwritejitkey( char * jit_key_value, DWORD * jit_key_vale_size, char * k
lRv = RegOpenKeyEx(HKEY_LOCAL_MACHINE, JIT_REG_KEY, 0, key_flags, &hKey);
if(lRv != ERROR_SUCCESS)
{
if ( error != NULL )
if(error != NULL)
* error = ERROR_RW_FILE_NOT_FOUND;
return false;
@ -1562,22 +1562,22 @@ bool _readwritejitkey( char * jit_key_value, DWORD * jit_key_vale_size, char * k
return true;
}
bool dbggetjitauto(bool * auto_on, arch arch_in, arch* arch_out)
bool dbggetjitauto(bool* auto_on, arch arch_in, arch* arch_out)
{
char jit_entry[4];
DWORD jit_entry_size = sizeof(jit_entry) - 1;
readwritejitkey_error_t rw_error;
if ( _readwritejitkey(jit_entry, & jit_entry_size, "Auto", arch_in, arch_out, & rw_error, false ) == false )
if(_readwritejitkey(jit_entry, & jit_entry_size, "Auto", arch_in, arch_out, & rw_error, false) == false)
{
if ( rw_error = ERROR_RW_FILE_NOT_FOUND )
if(rw_error = ERROR_RW_FILE_NOT_FOUND)
return true;
return false;
}
if ( _strcmpi( jit_entry, "1") == 0 )
if(_strcmpi(jit_entry, "1") == 0)
* auto_on = true;
else if ( _strcmpi( jit_entry, "0") == 0 )
else if(_strcmpi(jit_entry, "0") == 0)
* auto_on = false;
else
return false;
@ -1589,7 +1589,7 @@ bool dbgsetjitauto(bool auto_on, arch arch_in, arch* arch_out)
{
DWORD auto_string_size = sizeof("1");
return _readwritejitkey( auto_on ? "1" : "0", & auto_string_size, "Auto", arch_in, arch_out, NULL, true );
return _readwritejitkey(auto_on ? "1" : "0", & auto_string_size, "Auto", arch_in, arch_out, NULL, true);
}
bool dbggetjit(char** jit_entry_out, arch arch_in, arch* arch_out)
@ -1597,7 +1597,7 @@ bool dbggetjit(char** jit_entry_out, arch arch_in, arch* arch_out)
char jit_entry[512];
DWORD jit_entry_size = sizeof(jit_entry);
if ( _readwritejitkey(jit_entry, & jit_entry_size, "Debugger", arch_in, arch_out, NULL, false ) == false )
if(_readwritejitkey(jit_entry, & jit_entry_size, "Debugger", arch_in, arch_out, NULL, false) == false)
return false;
* jit_entry_out = (char*) emalloc(jit_entry_size, "dbggetjit:*jit_entry_out");
@ -1620,8 +1620,8 @@ bool dbggetdefjit(char* jit_entry)
bool dbgsetjit(char* jit_cmd, arch arch_in, arch* arch_out)
{
DWORD jit_cmd_size = strlen( jit_cmd );
return _readwritejitkey(jit_cmd, & jit_cmd_size, "Debugger", arch_in, arch_out, NULL, true );
DWORD jit_cmd_size = strlen(jit_cmd);
return _readwritejitkey(jit_cmd, & jit_cmd_size, "Debugger", arch_in, arch_out, NULL, true);
}
bool dbglistprocesses(std::vector<PROCESSENTRY32>* list)

View File

@ -10,9 +10,10 @@
#define JIT_ENTRY_DEF_SIZE (MAX_PATH + sizeof(ATTACH_CMD_LINE) + 2)
#define JIT_REG_KEY TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug")
typedef enum {
typedef enum
{
ERROR_RW = 0,
ERROR_RW_FILE_NOT_FOUND
ERROR_RW_FILE_NOT_FOUND
} readwritejitkey_error_t;
//structures
@ -61,8 +62,8 @@ bool dbgcmddel(const char* name);
bool dbggetjit(char** jit_entry_out, arch arch_in, arch* arch_out);
bool dbgsetjit(char* jit_cmd, arch arch_in, arch* arch_out);
bool dbggetdefjit(char* jit_entry);
bool _readwritejitkey( char *, DWORD *, char *, arch, arch*, readwritejitkey_error_t *, bool );
bool dbggetjitauto(bool *, arch, arch*);
bool _readwritejitkey(char*, DWORD*, char*, arch, arch*, readwritejitkey_error_t*, bool);
bool dbggetjitauto(bool*, arch, arch*);
bool dbgsetjitauto(bool, arch, arch*);
bool dbglistprocesses(std::vector<PROCESSENTRY32>* list);

View File

@ -1394,13 +1394,13 @@ CMDRESULT cbDebugGetJITAuto(int argc, char* argv[])
if(argc == 1)
{
if(!dbggetjitauto( &jit_auto, notfound, & actual_arch))
if(!dbggetjitauto(&jit_auto, notfound, & actual_arch))
{
dprintf("Error getting JIT auto %s\n", (actual_arch == x64) ? "x64" : "x32");
return STATUS_ERROR;
}
}
else if ( argc == 2 )
else if(argc == 2)
{
if(_strcmpi(argv[1], "x64") == 0)
{
@ -1431,7 +1431,7 @@ CMDRESULT cbDebugGetJITAuto(int argc, char* argv[])
dputs("Unkown jit auto entry type use x64 or x32 parameter");
}
dprintf(" JIT auto %s: %s\n", (actual_arch == x64) ? "x64" : "x32", jit_auto ? "ON" : "OFF" );
dprintf(" JIT auto %s: %s\n", (actual_arch == x64) ? "x64" : "x32", jit_auto ? "ON" : "OFF");
return STATUS_CONTINUE;
}
@ -1447,9 +1447,9 @@ CMDRESULT cbDebugSetJITAuto(int argc, char* argv[])
}
else if(argc == 2)
{
if (_strcmpi(argv[1], "1") == 0 || _strcmpi(argv[1], "ON") == 0 )
if(_strcmpi(argv[1], "1") == 0 || _strcmpi(argv[1], "ON") == 0)
set_jit_auto = true;
else if (_strcmpi(argv[1], "0") == 0 || _strcmpi(argv[1], "OFF") == 0 )
else if(_strcmpi(argv[1], "0") == 0 || _strcmpi(argv[1], "OFF") == 0)
set_jit_auto = false;
else
{
@ -1483,9 +1483,9 @@ CMDRESULT cbDebugSetJITAuto(int argc, char* argv[])
return STATUS_ERROR;
}
if (_strcmpi(argv[2], "1") == 0 || _strcmpi(argv[2], "ON") == 0 )
if(_strcmpi(argv[2], "1") == 0 || _strcmpi(argv[2], "ON") == 0)
set_jit_auto = true;
else if (_strcmpi(argv[2], "0") == 0 || _strcmpi(argv[2], "OFF") == 0 )
else if(_strcmpi(argv[2], "0") == 0 || _strcmpi(argv[2], "OFF") == 0)
set_jit_auto = false;
else
{
@ -1505,7 +1505,7 @@ CMDRESULT cbDebugSetJITAuto(int argc, char* argv[])
return STATUS_ERROR;
}
dprintf("New JIT auto %s: %s\n", (actual_arch == x64) ? "x64" : "x32", set_jit_auto ? "ON" : "OFF" );
dprintf("New JIT auto %s: %s\n", (actual_arch == x64) ? "x64" : "x32", set_jit_auto ? "ON" : "OFF");
return STATUS_CONTINUE;
}

View File

@ -182,9 +182,9 @@ void SettingsDialog::LoadSettings()
ui->chkSetJIT->setCheckState(bool2check(settings.eventSetJIT));
if ( DbgFunctions()->GetJitAuto(&jit_auto_on) )
if(DbgFunctions()->GetJitAuto(&jit_auto_on))
{
if (jit_auto_on)
if(jit_auto_on)
settings.eventSetJITAuto = true;
else
settings.eventSetJITAuto = false;