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

import KernelEx-4.0-Final

This commit is contained in:
UzixLS
2018-11-03 16:20:02 +03:00
parent 339353cce8
commit 30df122aba
339 changed files with 11011 additions and 1945 deletions

18
sheet/KexLinkage.cpp Executable file → Normal file
View File

@ -28,6 +28,7 @@ KexLinkage KexLinkage::instance;
KexLinkage::KexLinkage()
{
disable_extensions = false;
m_ready = Prepare();
}
@ -44,7 +45,8 @@ bool KexLinkage::Prepare()
char core_conf_file[MAX_PATH];
HKEY key;
DWORD type;
DWORD len = sizeof(core_conf_file);
DWORD len;
DWORD data;
hKernelEx = LoadLibrary("KERNELEX.DLL");
if (!hKernelEx)
@ -56,8 +58,11 @@ bool KexLinkage::Prepare()
"kexSetModuleSettings");
m_kexGetKEXVersion = (kexGetKEXVersion_t) GetProcAddress(hKernelEx,
"kexGetKEXVersion");
m_kexIsDebugCore = (kexIsDebugCore_t) GetProcAddress(hKernelEx,
"kexIsDebugCore");
if (!m_kexGetModuleSettings || !m_kexSetModuleSettings || !m_kexGetKEXVersion)
if (!m_kexGetModuleSettings || !m_kexSetModuleSettings
|| !m_kexGetKEXVersion || !m_kexIsDebugCore)
return false;
//read config file location from registry
@ -66,11 +71,20 @@ bool KexLinkage::Prepare()
if (result != ERROR_SUCCESS)
return false;
len = sizeof(data);
result = RegQueryValueEx(key, "DisableExtensions", NULL, &type,
(BYTE*) &data, &len);
if (result == ERROR_SUCCESS && type == REG_DWORD && len == sizeof(data) && data == 1)
disable_extensions = true;
len = sizeof(core_conf_file);
result = RegQueryValueEx(key, "InstallDir", NULL, &type,
(BYTE*)core_conf_file, &len);
RegCloseKey(key);
if (result != ERROR_SUCCESS || type != REG_SZ || len == 0)
return false;
strcat(core_conf_file, "\\core.ini");
if (GetFileAttributes(core_conf_file) == 0xffffffff)
return false;

6
sheet/KexLinkage.h Executable file → Normal file
View File

@ -37,6 +37,9 @@ class KexLinkage
typedef void (*kexSetModuleSettings_t)(const char* module,
const char* conf_name, BYTE ldr_flags);
typedef unsigned long (*kexGetKEXVersion_t)(void);
typedef int (*kexIsDebugCore_t)(void);
public:
struct conf
{
@ -45,16 +48,17 @@ class KexLinkage
sstring desc;
};
public:
~KexLinkage();
bool IsReady();
static KexLinkage instance;
vector<conf> confs;
int default_index;
bool disable_extensions;
kexGetModuleSettings_t m_kexGetModuleSettings;
kexSetModuleSettings_t m_kexSetModuleSettings;
kexGetKEXVersion_t m_kexGetKEXVersion;
kexIsDebugCore_t m_kexIsDebugCore;
protected:
KexLinkage();

0
sheet/factory.cpp Executable file → Normal file
View File

0
sheet/factory.h Executable file → Normal file
View File

View File

@ -0,0 +1,5 @@
REGEDIT4
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\explorer\AlwaysUnloadDll]
@="1"

3
sheet/resource.h Executable file → Normal file
View File

@ -11,6 +11,7 @@
#define IDC_KEXVER 1005
#define IDC_GCOMPAT 1006
#define IDC_TCOMPAT 1007
#define IDC_LOG 1008
// Next default values for new objects
//
@ -18,7 +19,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1008
#define _APS_NEXT_CONTROL_VALUE 1009
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

0
sheet/server.cpp Executable file → Normal file
View File

0
sheet/server.def Executable file → Normal file
View File

0
sheet/server.h Executable file → Normal file
View File

31
sheet/sheet.cpp Executable file → Normal file
View File

@ -303,12 +303,14 @@ BOOL CALLBACK KexShlExt::DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
{
EnableWindow(GetDlgItem(hwnd, IDC_COMPAT), FALSE);
EnableWindow(GetDlgItem(hwnd, IDC_SYSTEM), FALSE);
EnableWindow(GetDlgItem(hwnd, IDC_LOG), FALSE);
}
else
{
EnableWindow(GetDlgItem(hwnd, IDC_COMPAT), TRUE);
EnableWindow(GetDlgItem(hwnd, IDC_SYSTEM),
IsDlgButtonChecked(hwnd, IDC_COMPAT));
EnableWindow(GetDlgItem(hwnd, IDC_LOG), TRUE);
}
PropSheet_Changed(GetParent(hwnd), hwnd);
break;
@ -318,6 +320,7 @@ BOOL CALLBACK KexShlExt::DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
PropSheet_Changed(GetParent(hwnd), hwnd);
break;
case IDC_SYSTEM:
case IDC_LOG:
PropSheet_Changed(GetParent(hwnd), hwnd);
break;
}
@ -336,10 +339,11 @@ void KexShlExt::OnInitDialog(HWND hwnd, ModuleSetting* ms)
for (it = KexLinkage::instance.confs.begin() ;
it != KexLinkage::instance.confs.end() ; it++)
SendMessage(GetDlgItem(hwnd, IDC_SYSTEM), CB_ADDSTRING,
0, (LPARAM) it->desc.get());
0, (LPARAM) (const char*) it->desc);
if (KexLinkage::instance.default_index >= 0
&& KexLinkage::instance.default_index < KexLinkage::instance.confs.size())
bool default_index_valid = KexLinkage::instance.default_index >= 0
&& KexLinkage::instance.default_index < KexLinkage::instance.confs.size();
if (default_index_valid)
SendMessage(GetDlgItem(hwnd, IDC_SYSTEM), CB_SETCURSEL,
KexLinkage::instance.default_index, 0);
else
@ -348,25 +352,36 @@ void KexShlExt::OnInitDialog(HWND hwnd, ModuleSetting* ms)
KexLinkage::instance.m_kexGetModuleSettings(ms->file, ms->conf, &ms->flags);
for (int i = 0 ; i < KexLinkage::instance.confs.size() ; i++)
if (!strcmp(ms->conf, KexLinkage::instance.confs[i].name.get()))
if (!strcmp(ms->conf, KexLinkage::instance.confs[i].name))
{
CheckDlgButton(hwnd, IDC_COMPAT, BST_CHECKED);
EnableWindow(GetDlgItem(hwnd, IDC_SYSTEM), TRUE);
SendMessage(GetDlgItem(hwnd, IDC_SYSTEM), CB_SETCURSEL, i, 0);
break;
}
if (!(ms->flags & 128) && (KexLinkage::instance.disable_extensions || !default_index_valid))
ms->flags |= 1;
if (ms->flags & 1)
{
CheckDlgButton(hwnd, IDC_DISABLE, BST_CHECKED);
EnableWindow(GetDlgItem(hwnd, IDC_COMPAT), FALSE);
EnableWindow(GetDlgItem(hwnd, IDC_SYSTEM), FALSE);
EnableWindow(GetDlgItem(hwnd, IDC_LOG), FALSE);
}
if (ms->flags & 4)
{
CheckDlgButton(hwnd, IDC_LOG, BST_CHECKED);
}
//set KernelEx version
unsigned long ver = KexLinkage::instance.m_kexGetKEXVersion();
int debug = KexLinkage::instance.m_kexIsDebugCore();
char ver_s[32];
sprintf(ver_s, "KernelEx Core v%d.%d.%d", ver>>24, (ver>>16) & 0xff, ver & 0xffff);
sprintf(ver_s, "KernelEx Core v%d.%d.%d %s",
ver>>24, (ver>>16) & 0xff, ver & 0xffff, debug ? "DEBUG" : "");
SendMessage(GetDlgItem(hwnd, IDC_KEXVER), WM_SETTEXT, 0, (LPARAM) ver_s);
ShowWindow(GetDlgItem(hwnd, IDC_LOG), debug ? SW_SHOW : SW_HIDE);
}
@ -374,12 +389,14 @@ void KexShlExt::OnApply(HWND hwnd)
{
ModuleSetting* ms = (ModuleSetting*) GetWindowLong(hwnd, GWL_USERDATA);
BYTE flags = 0;
const char* conf = "default";
const char* conf = "";
if (IsDlgButtonChecked(hwnd, IDC_DISABLE))
flags |= 1;
if (IsDlgButtonChecked(hwnd, IDC_COMPAT))
conf = KexLinkage::instance.confs[SendMessage(
GetDlgItem(hwnd, IDC_SYSTEM), CB_GETCURSEL, 0, 0)].name.get();
GetDlgItem(hwnd, IDC_SYSTEM), CB_GETCURSEL, 0, 0)].name;
if (IsDlgButtonChecked(hwnd, IDC_LOG))
flags |= 4;
if (flags != ms->flags || strcmp(conf, ms->conf) != 0)
KexLinkage::instance.m_kexSetModuleSettings(ms->file, conf, flags);

0
sheet/sheet.dsp Executable file → Normal file
View File

0
sheet/sheet.h Executable file → Normal file
View File

12
sheet/sheet.rc Executable file → Normal file
View File

@ -15,7 +15,7 @@
/////////////////////////////////////////////////////////////////////////////
// Polish resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_PLK)
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_POL)
#ifdef _WIN32
LANGUAGE LANG_POLISH, SUBLANG_DEFAULT
#pragma code_page(1250)
@ -54,8 +54,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,2
PRODUCTVERSION 1,0,0,2
FILEVERSION 1,0,0,3
PRODUCTVERSION 1,0,0,3
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -73,14 +73,14 @@ BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "Xeno86\0"
VALUE "FileDescription", "sheet\0"
VALUE "FileVersion", "1, 0, 0, 2\0"
VALUE "FileVersion", "1, 0, 0, 3\0"
VALUE "InternalName", "sheet\0"
VALUE "LegalCopyright", "Copyright <20> 2009, Xeno86\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "sheet.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "KernelEx\0"
VALUE "ProductVersion", "1, 0, 0, 2\0"
VALUE "ProductVersion", "1, 0, 0, 3\0"
VALUE "SpecialBuild", "\0"
END
END
@ -128,6 +128,8 @@ BEGIN
IDC_TCOMPAT,7,7,175,22
CONTROL "",IDC_HORIZ1,"Static",SS_BLACKFRAME | SS_SUNKEN,7,109,
176,1
CONTROL "Enable api logging",IDC_LOG,"Button",BS_AUTOCHECKBOX |
NOT WS_VISIBLE | WS_TABSTOP,15,96,74,10
END