1
0
mirror of https://github.com/UzixLS/KernelEx.git synced 2025-07-19 07:21:20 +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

200
verify/main.c Executable file
View File

@ -0,0 +1,200 @@
/*
* KernelEx
* Copyright (C) 2010, Xeno86
*
* This file is part of KernelEx source code.
*
* KernelEx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; version 2 of the License.
*
* KernelEx is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#define _WIN32_WINNT 0x0501
#define _WIN32_IE 0x0500
#include <windows.h>
#include <commctrl.h>
#include <stdio.h>
#include "resource.h"
/* Program used to verify KernelEx installation.
* If it annoys you add DWORD value "NoVerify"
* under HKLM\Software\KernelEx and set it to 1.
*/
HINSTANCE hInstance;
unsigned long core_version;
typedef unsigned long (*kexVersion_t)();
int snprintf(char*, size_t, const char*, ...);
void install_failure()
{
char msg[256];
char title[100];
LoadString(hInstance, IDS_FAILURETITLE, title, sizeof(title));
LoadString(hInstance, IDS_FAILURE, msg, sizeof(msg));
MessageBox(NULL, msg, title, MB_OK | MB_ICONERROR);
}
void erase_from_startup()
{
HKEY key;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Run",
0, KEY_ALL_ACCESS, &key) != ERROR_SUCCESS)
return;
RegDeleteValue(key, "KexVerify");
RegCloseKey(key);
}
int is_disable_verify()
{
HKEY key;
DWORD type;
DWORD data;
LONG ret;
DWORD size = sizeof(data);
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\KernelEx",
0, KEY_QUERY_VALUE, &key) != ERROR_SUCCESS)
return 0;
ret = RegQueryValueEx(key, "NoVerify", NULL, &type, (BYTE*) &data, &size);
RegCloseKey(key);
if (ret != ERROR_SUCCESS || type != REG_DWORD || size != sizeof(DWORD) || data == 0)
return 0;
return 1;
}
int test_core()
{
HMODULE h = GetModuleHandle("KERNELEX.DLL");
kexVersion_t getver = (kexVersion_t)GetProcAddress(h, "kexGetKEXVersion");
if (!getver)
return 0;
core_version = getver();
return 1;
}
int test_apis()
{
HMODULE h = GetModuleHandle("KERNEL32.DLL");
PROC proc = GetProcAddress(h, "GetSystemWindowsDirectoryA");
if (!proc)
return 0;
h = LoadLibrary("GDI32.DLL");
proc = GetProcAddress(h, "GetGlyphIndicesW");
FreeLibrary(h);
if (!proc)
return 0;
return 1;
}
BOOL CALLBACK DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_INITDIALOG:
{
char ver_s[32];
snprintf(ver_s, sizeof(ver_s), "v%d.%d.%d",
core_version>>24, (core_version>>16) & 0xff, core_version & 0xffff);
SendMessage(GetDlgItem(hwnd, IDC_VERSION), WM_SETTEXT, 0, (LPARAM) ver_s);
return TRUE;
}
case WM_COMMAND:
case WM_CLOSE:
EndDialog(hwnd, 0);
return TRUE;
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code)
{
case NM_CLICK:
case NM_RETURN:
{
PNMLINK pNMLink = (PNMLINK)lParam;
LITEM item = pNMLink->item;
if (((LPNMHDR)lParam)->idFrom == IDC_LINK)
{
ShellExecuteW(NULL, L"open", item.szUrl, NULL, NULL, SW_SHOW);
return TRUE;
}
break;
}
}
break;
}
return FALSE;
}
int are_extensions_enabled()
{
HKEY key;
DWORD type, data, size = sizeof(data);
LONG res;
res = RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\KernelEx", &key);
if (res != ERROR_SUCCESS)
return 1;
res = RegQueryValueEx(key, "DisableExtensions", NULL, &type, (char*)&data, &size);
if (res == ERROR_SUCCESS && type == REG_DWORD && size == sizeof(data) && data == 1)
return 0;
RegCloseKey(key);
return 1;
}
__declspec(noreturn)
void entrypoint()
{
INITCOMMONCONTROLSEX iccex;
hInstance = GetModuleHandle(NULL);
erase_from_startup();
if (!is_disable_verify())
{
int okay = 0;
if (test_core() && test_apis())
{
iccex.dwSize = sizeof(iccex);
iccex.dwICC = ICC_LINK_CLASS;
if (InitCommonControlsEx(&iccex))
{
int dialog;
if (are_extensions_enabled())
dialog = IDD_DIALOG1;
else
dialog = IDD_DIALOG2;
if (!DialogBoxParam(hInstance, MAKEINTRESOURCE(dialog), NULL, DlgProc, 0))
okay = 1;
}
}
if (!okay)
install_failure();
}
ExitProcess(0);
}

View File

@ -1,108 +0,0 @@
#include <windows.h>
#include "resource.h"
/* Program used to verify KernelEx installation.
* If it annoys you add DWORD value "NoVerify"
* under HKLM\Software\KernelEx and set it to 1.
*/
HINSTANCE hInstance;
void install_success()
{
char msg[256];
char title[100];
LoadString(hInstance, IDS_TITLE, title, sizeof(title));
LoadString(hInstance, IDS_SUCCESS, msg, sizeof(msg));
MessageBox(NULL, msg, title, MB_OK | MB_ICONINFORMATION);
}
void install_failure()
{
char msg[256];
char title[100];
LoadString(hInstance, IDS_TITLE, title, sizeof(title));
LoadString(hInstance, IDS_FAILURE, msg, sizeof(msg));
MessageBox(NULL, msg, title, MB_OK | MB_ICONERROR);
}
void erase_from_startup()
{
HKEY key;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Run",
0, KEY_ALL_ACCESS, &key) != ERROR_SUCCESS)
return;
RegDeleteValue(key, "KexVerify");
RegCloseKey(key);
}
bool is_disable_verify()
{
HKEY key;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\KernelEx",
0, KEY_QUERY_VALUE, &key) != ERROR_SUCCESS)
return false;
DWORD type;
DWORD data;
DWORD size = sizeof(data);
LONG ret = RegQueryValueEx(key, "NoVerify", NULL, &type, (BYTE*) &data, &size);
RegCloseKey(key);
if (ret != ERROR_SUCCESS || type != REG_DWORD || size != sizeof(DWORD) || data == 0)
return false;
return true;
}
bool test_core()
{
HMODULE h = LoadLibrary("KERNELEX.DLL");
PROC proc = GetProcAddress(h, "kexGetKEXVersion");
FreeLibrary(h);
if (!proc)
return false;
return true;
}
bool test_apis()
{
HMODULE h = GetModuleHandle("KERNEL32.DLL");
PROC proc = GetProcAddress(h, "GetSystemWindowsDirectoryA");
if (!proc)
return false;
h = LoadLibrary("GDI32.DLL");
proc = GetProcAddress(h, "GetGlyphIndicesW");
FreeLibrary(h);
if (!proc)
return false;
return true;
}
__declspec(noreturn)
void entrypoint()
{
hInstance = GetModuleHandle(NULL);
erase_from_startup();
if (!is_disable_verify())
{
if (test_core() && test_apis())
install_success();
else
install_failure();
}
ExitProcess(0);
}

View File

@ -2,17 +2,21 @@
// Microsoft Developer Studio generated include file.
// Used by verify.rc
//
#define IDS_SUCCESS 1
#define IDS_FAILURE 2
#define IDS_TITLE 3
#define IDS_FAILURE 1
#define IDS_FAILURETITLE 2
#define IDD_DIALOG1 101
#define IDD_DIALOG2 102
#define IDC_CHECK1 1000
#define IDC_LINK 1001
#define IDC_VERSION 1003
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_RESOURCE_VALUE 104
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_CONTROL_VALUE 1004
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -53,7 +53,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib advapi32.lib libc.lib /nologo /entry:"entrypoint" /subsystem:windows /machine:I386 /nodefaultlib /OPT:NOWIN98
# ADD LINK32 kernel32.lib user32.lib advapi32.lib comctl32.lib shell32.lib ..\kexcrt\kexcrt.lib libc.lib /nologo /entry:"entrypoint" /subsystem:windows /machine:I386 /nodefaultlib /OPT:NOWIN98
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "verify - Win32 Debug"
@ -80,7 +80,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib advapi32.lib libc.lib /nologo /entry:"entrypoint" /subsystem:windows /debug /machine:I386 /nodefaultlib /pdbtype:sept /OPT:NOWIN98
# ADD LINK32 kernel32.lib user32.lib advapi32.lib comctl32.lib shell32.lib ..\kexcrt\kexcrt.lib libc.lib /nologo /entry:"entrypoint" /subsystem:windows /debug /machine:I386 /nodefaultlib /pdbtype:sept /OPT:NOWIN98
# SUBTRACT LINK32 /pdb:none
!ENDIF
@ -94,20 +94,24 @@ LINK32=link.exe
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\main.cpp
# End Source File
# Begin Source File
SOURCE=.\verify.rc
SOURCE=.\main.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\resource.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\verify.rc
# End Source File
# End Group
# End Target
# End Project

View File

@ -21,6 +21,67 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#pragma code_page(1250)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 296, 78
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "KernelEx"
FONT 8, "MS Shell Dlg"
BEGIN
DEFPUSHBUTTON "OK",IDOK,122,57,50,14
ICON 32516,IDC_STATIC,7,7,20,20
LTEXT "KernelEx has been successfully installed and is now enabled for all applications.\nTo make newer applications run or fix old applications crash, you may need to go to the KernelEx tab in the properties of application executable or its shortcut.",
IDC_STATIC,36,7,253,34
CONTROL "To learn more about KernelEx, pay a visit to <a href=""http://kernelex.sourceforge.net/wiki/"">KernelEx Wiki</a>",
IDC_LINK,"SysLink",WS_TABSTOP,36,39,253,10
RTEXT "VERSIONSTR",IDC_VERSION,224,62,65,9,WS_DISABLED
END
IDD_DIALOG2 DIALOG DISCARDABLE 0, 0, 296, 78
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "KernelEx"
FONT 8, "MS Shell Dlg"
BEGIN
DEFPUSHBUTTON "OK",IDOK,122,57,50,14
ICON 32516,IDC_STATIC,7,7,20,20
LTEXT "KernelEx has been successfully installed but is disabled by default and only enabled for some applications. To enable KernelEx for newer applications, go to the KernelEx tab in the properties of application executable or its shortcut.",
IDC_STATIC,36,7,253,34
CONTROL "To learn more about KernelEx, pay a visit to <a href=""http://kernelex.sourceforge.net/wiki/"">KernelEx Wiki</a>",
IDC_LINK,"SysLink",WS_TABSTOP,36,39,253,10
RTEXT "VERSIONSTR",IDC_VERSION,224,62,65,9,WS_DISABLED
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_DIALOG1, DIALOG
BEGIN
LEFTMARGIN, 36
RIGHTMARGIN, 289
TOPMARGIN, 7
BOTTOMMARGIN, 71
END
IDD_DIALOG2, DIALOG
BEGIN
LEFTMARGIN, 36
RIGHTMARGIN, 289
TOPMARGIN, 7
BOTTOMMARGIN, 71
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// String Table
@ -28,9 +89,8 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
STRINGTABLE DISCARDABLE
BEGIN
IDS_SUCCESS "KernelEx installed successfully and functional."
IDS_FAILURE "KernelEx has not been properly installed."
IDS_TITLE "KernelEx installation verify"
IDS_FAILURETITLE "KernelEx installation error"
END
#endif // Neutral resources
@ -40,7 +100,7 @@ END
/////////////////////////////////////////////////////////////////////////////
// Polish resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_POL)
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_PLK)
#ifdef _WIN32
LANGUAGE LANG_POLISH, SUBLANG_DEFAULT
#pragma code_page(1250)