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:
108
verify/main.cpp
Normal file
108
verify/main.cpp
Normal file
@ -0,0 +1,108 @@
|
||||
#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);
|
||||
}
|
18
verify/resource.h
Normal file
18
verify/resource.h
Normal file
@ -0,0 +1,18 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by verify.rc
|
||||
//
|
||||
#define IDS_SUCCESS 1
|
||||
#define IDS_FAILURE 2
|
||||
#define IDS_TITLE 3
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
113
verify/verify.dsp
Normal file
113
verify/verify.dsp
Normal file
@ -0,0 +1,113 @@
|
||||
# Microsoft Developer Studio Project File - Name="verify" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=verify - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "verify.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "verify.mak" CFG="verify - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "verify - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "verify - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "verify - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x415 /d "NDEBUG"
|
||||
# ADD RSC /l 0x415 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# 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
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "verify - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x415 /d "_DEBUG"
|
||||
# ADD RSC /l 0x415 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# 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
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "verify - Win32 Release"
|
||||
# Name "verify - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# 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
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
88
verify/verify.rc
Normal file
88
verify/verify.rc
Normal file
@ -0,0 +1,88 @@
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Neutral resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||
#pragma code_page(1250)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_SUCCESS "KernelEx installed successfully and functional."
|
||||
IDS_FAILURE "KernelEx has not been properly installed."
|
||||
IDS_TITLE "KernelEx installation verify"
|
||||
END
|
||||
|
||||
#endif // Neutral resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Polish resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_POL)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_POLISH, SUBLANG_DEFAULT
|
||||
#pragma code_page(1250)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // Polish resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
Reference in New Issue
Block a user