1
0
mirror of https://github.com/UzixLS/KernelEx.git synced 2025-07-18 23:11:19 +03:00

import KernelEx-4.5-Final

This commit is contained in:
UzixLS
2018-11-03 16:23:17 +03:00
parent 309977e788
commit 7571e3c60d
125 changed files with 11876 additions and 9943 deletions

View File

@ -23,6 +23,7 @@
#include <stdio.h>
#include <malloc.h>
#include "debug.h"
#include "SettingsDB.h"
#include "internals.h"
#include "resolver.h"
#include "apiconfmgr.h"
@ -174,6 +175,9 @@ __error:
DBGPRINTF(("Default api configuration is: %s\n", default_apiconf->get_name()));
DBGPRINTF(("API extensions are by default: %s\n",
disable_extensions ? "disabled" : "enabled"));
SettingsDB::instance.flush_all();
return true;
}

View File

@ -72,6 +72,24 @@ void ShowError(UINT id, ...)
MessageBox(NULL, out, "KernelEx Core", MB_OK | MB_ICONERROR);
}
bool rerun_setup()
{
char cmd[MAX_PATH];
STARTUPINFO si;
PROCESS_INFORMATION pi;
strcpy(cmd, "\"");
strcat(cmd, kernelex_dir);
strcat(cmd, "setupkex.exe\" /R");
GetStartupInfo(&si);
if (!CreateProcess(NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
return false;
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
return true;
}
DWORD* find_unique_pattern(void* start, int size, const short* pattern, int pat_len, const char* pat_name)
{
unsigned char* pos = (unsigned char*) start;

View File

@ -44,6 +44,7 @@ extern sstring kernelex_dir;
extern sstring own_path;
void ShowError(UINT id, ...);
bool rerun_setup();
bool isWinMe();
typedef MODREF* (__stdcall *MRFromHLib_t)(HMODULE);

View File

@ -1,6 +1,6 @@
/*
* KernelEx
* Copyright (C) 2008-2009, Xeno86
* Copyright (C) 2008-2010, Xeno86
*
* This file is part of KernelEx source code.
*
@ -53,12 +53,12 @@ int kexInit()
if (!internals_init())
goto __error1;
if (!apiconfmgr.load_api_configurations())
goto __error2;
if (!resolver_init())
goto __error2;
if (!apiconfmgr.load_api_configurations())
goto __error3;
resolver_hook();
#ifdef _DEBUG
@ -68,6 +68,8 @@ int kexInit()
DBGPRINTF(("Initialized successfully\n"));
return ++init_count;
__error3:
resolver_uninit();
__error2:
internals_uninit();
__error1:

View File

@ -879,7 +879,8 @@ int resolver_init()
if (!dseg)
{
DBGPRINTF(("Signature not found\n"));
ShowError(IDS_NOTREADY);
if (!rerun_setup())
ShowError(IDS_NOTREADY);
return 0;
}
else
@ -889,7 +890,8 @@ int resolver_init()
{
DBGPRINTF(("Wrong stub version, expected: %d, got: %d\n",
KEX_STUB_VER, dseg->version));
ShowError(IDS_STUBMISMATCH, KEX_STUB_VER, dseg->version);
if (!rerun_setup())
ShowError(IDS_STUBMISMATCH, KEX_STUB_VER, dseg->version);
return 0;
}
@ -899,8 +901,6 @@ int resolver_init()
system_path_len = GetSystemDirectory(system_path, sizeof(system_path));
RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\KernelEx\\KnownDLLs", &known_dlls_key);
SettingsDB::instance.flush_all();
return 1;
}