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

import KernelEx-4.5-Beta2

This commit is contained in:
UzixLS
2018-11-03 16:21:44 +03:00
parent 09929b2b7d
commit 2e7f4ba60c
47 changed files with 9203 additions and 8829 deletions

View File

@ -45,6 +45,7 @@ static const apilib_named_api advapi32_named_apis[] =
DECL_API("ConvertStringSidToSidA", ConvertStringSidToSidA_stub),
DECL_API("ConvertStringSidToSidW", ConvertStringSidToSidW_stub),
DECL_API("CopySid", CopySid_new),
DECL_API("CreateProcessWithLogonW", CreateProcessWithLogonW_stub),
DECL_API("CreateRestrictedToken", CreateRestrictedToken_new),
DECL_API("CreateWellKnownSid", CreateWellKnownSid_new),
DECL_API("CryptAcquireContextW", CryptAcquireContextW_stub),
@ -82,6 +83,8 @@ static const apilib_named_api advapi32_named_apis[] =
DECL_API("InitializeAcl", InitializeAcl_new),
DECL_API("InitializeSecurityDescriptor", InitializeSecurityDescriptor_new),
DECL_API("InitializeSid", InitializeSid_new),
DECL_API("InitiateSystemShutdownExA", InitiateSystemShutdownExA_stub),
DECL_API("InitiateSystemShutdownExW", InitiateSystemShutdownExW_stub),
DECL_API("IsValidSecurityDescriptor", IsValidSecurityDescriptor_new),
DECL_API("IsValidSid", IsValidSid_new),
DECL_API("IsWellKnownSid", IsWellKnownSid_stub),

View File

@ -58,6 +58,9 @@ STUB QueryWindows31FilesMigration_stub;
STUB SynchronizeWindows31FilesAndWindowsNTRegistry_stub;
STUB EnumServicesStatusExA_stub;
STUB EnumServicesStatusExW_stub;
STUB CreateProcessWithLogonW_stub;
STUB InitiateSystemShutdownExA_stub;
STUB InitiateSystemShutdownExW_stub;
BOOL WINAPI OpenProcessToken_new(HANDLE ProcessHandle, DWORD DesiredAccess, HANDLE *TokenHandle);
BOOL WINAPI OpenThreadToken_new(HANDLE ThreadHandle, DWORD DesiredAccess, BOOL OpenAsSelf, HANDLE *TokenHandle);
BOOL WINAPI DuplicateTokenEx_new(HANDLE ExistingTokenHandle, DWORD dwDesiredAccess, LPSECURITY_ATTRIBUTES lpTokenAttributes, SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, TOKEN_TYPE TokenType, PHANDLE DuplicateTokenHandle);

View File

@ -51,3 +51,7 @@ UNIMPL_FUNC(SynchronizeWindows31FilesAndWindowsNTRegistry,4);
UNIMPL_FUNC(EnumServicesStatusExA, 10);
UNIMPL_FUNC(EnumServicesStatusExW, 10);
UNIMPL_FUNC(CreateProcessWithLogonW, 11);
UNIMPL_FUNC(InitiateSystemShutdownExA, 6);
UNIMPL_FUNC(InitiateSystemShutdownExW, 6);

View File

@ -32,3 +32,18 @@ BOOL WINAPI RemoveFontResourceExA_new(LPCSTR str, DWORD fl, PVOID pdv)
{
return RemoveFontResourceA(str);
}
/* MAKE_EXPORT AddFontMemResourceEx_stub=AddFontMemResourceEx */
HANDLE WINAPI AddFontMemResourceEx_stub(PVOID pbFont, DWORD cbFont, PVOID pdv, DWORD *pcFonts)
{
if (!pbFont || !cbFont || !pcFonts)
return NULL;
*pcFonts = 1;
return (HANDLE) 0x10000;
}
/* MAKE_EXPORT RemoveFontMemResourceEx_stub=RemoveFontMemResourceEx */
BOOL WINAPI RemoveFontMemResourceEx_stub(HANDLE fh)
{
return (fh == (HANDLE) 0x10000) ? TRUE : FALSE;
}

View File

@ -28,6 +28,7 @@
static BOOL blockkexgdiobj;
static WORD g_GDILH_addr;
static DWORD g_GdiBase;
static int script_cache_psidx;
#define REBASEGDI(x) ((PVOID)( g_GdiBase + LOWORD((DWORD)(x)) ))
#define REBASEGDIHIGH(x) ( g_GdiBase + (DWORD)(x) )
@ -40,6 +41,7 @@ BOOL InitGDIObjects(void)
g_GdiBase = MapSL( LoadLibrary16("gdi") << 16 );
g_GDILH_addr = ((PINSTANCE16)g_GdiBase)->pLocalHeap;
blockkexgdiobj = (BOOL)GetProcAddress(GetModuleHandle("rp10.dll"),"blockkexgdiobj");
script_cache_psidx = kexPsAllocIndex();
return (BOOL)g_GdiBase;
}
@ -159,6 +161,18 @@ BOOL WINAPI DeleteObject_fix( HGDIOBJ hObject )
DWORD violated = 0;
if ( obj->wOwner ) //not system objects
{
if (obj->wType == GDI_TYPE_FONT)
{
typedef void (*DeleteUSPFontCache_fn)(HFONT hFont);
DeleteUSPFontCache_fn DeleteUSPFontCache = (DeleteUSPFontCache_fn) kexPsGetValue(script_cache_psidx);
if (!DeleteUSPFontCache)
{
DeleteUSPFontCache = (DeleteUSPFontCache_fn)GetProcAddress(LoadLibrary("KEXBASEN.DLL"), "DeleteUSPFontCache");
kexPsSetValue(script_cache_psidx, DeleteUSPFontCache);
}
if (DeleteUSPFontCache)
DeleteUSPFontCache((HFONT)hObject);
}
if (obj->wType == GDI_TYPE_FONT && ((PFONTOBJ16)obj)->wSelCount >= SEL_FONT_ONCE )
{
DBGPRINTF(("somebody is trying to delete selected font %p\n",hObject));

View File

@ -30,6 +30,8 @@ extern const apilib_api_table apitable_gdi32;
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
INT WINAPI AddFontResourceExA_new(LPCSTR str, DWORD fl, PVOID pdv);
BOOL WINAPI RemoveFontResourceExA_new(LPCSTR str, DWORD fl, PVOID pdv);
HANDLE WINAPI AddFontMemResourceEx_stub(PVOID pbFont, DWORD cbFont, PVOID pdv, DWORD *pcFonts);
BOOL WINAPI RemoveFontMemResourceEx_stub(HANDLE fh);
DWORD WINAPI GetObjectType_fix(HGDIOBJ hgdiobj);
BOOL WINAPI DeleteObject_fix(HGDIOBJ hObject);
HGDIOBJ WINAPI SelectObject_fix(HDC hdc, HGDIOBJ hgdiobj);
@ -53,8 +55,6 @@ STUB SetDCBrushColor_stub;
STUB SetDCPenColor_stub;
STUB GetDCBrushColor_stub;
STUB GetDCPenColor_stub;
STUB AddFontMemResourceEx_stub;
STUB RemoveFontMemResourceEx_stub;
INT WINAPI AddFontResourceExW_new(LPCWSTR strW, DWORD fl, PVOID pdv);
INT WINAPI AddFontResourceW_new(LPCWSTR strW);
int WINAPI EnumFontFamiliesExA_new(HDC hdc, LPLOGFONTA pLogfontA, FONTENUMPROCA pEnumFontFamExProc, LPARAM lParam, DWORD dwFlags);

View File

@ -25,5 +25,3 @@ UNIMPL_FUNC(SetDCBrushColor, 2);
UNIMPL_FUNC(SetDCPenColor, 2);
UNIMPL_FUNC(GetDCBrushColor, 1);
UNIMPL_FUNC(GetDCPenColor, 1);
UNIMPL_FUNC(AddFontMemResourceEx, 4);
UNIMPL_FUNC(RemoveFontMemResourceEx, 1);

View File

@ -1,6 +1,6 @@
/*
* KernelEx
* Copyright (C) 2009, Xeno86
* Copyright (C) 2009-2010, Xeno86
* Copyright (C) 2009, Tihiy
*
* This file is part of KernelEx source code.
@ -107,11 +107,19 @@ static int CALLBACK EnumFontFamExConv(const LOGFONTA *plfA,
tmW->ntmTm.tmBreakChar = tmA->ntmTm.tmBreakChar;
#endif
tmW->ntmTm.ntmFlags = tmA->ntmTm.ntmFlags;
tmW->ntmTm.ntmSizeEM = tmA->ntmTm.ntmSizeEM;
tmW->ntmTm.ntmCellHeight = tmA->ntmTm.ntmCellHeight;
tmW->ntmTm.ntmAvgWidth = tmA->ntmTm.ntmAvgWidth;
memcpy(&tmW->ntmFontSig, &tmA->ntmFontSig, sizeof(FONTSIGNATURE));
if (FontType == TRUETYPE_FONTTYPE)
{
tmW->ntmTm.ntmFlags = tmA->ntmTm.ntmFlags;
tmW->ntmTm.ntmSizeEM = tmA->ntmTm.ntmSizeEM;
tmW->ntmTm.ntmCellHeight = tmA->ntmTm.ntmCellHeight;
tmW->ntmTm.ntmAvgWidth = tmA->ntmTm.ntmAvgWidth;
memset(&tmW->ntmFontSig, 0, sizeof(FONTSIGNATURE));
}
else
{
memset(&tmW->ntmTm.ntmFlags, 0, sizeof(NEWTEXTMETRICEXW)
- FIELD_OFFSET(NEWTEXTMETRICEXW, ntmTm.ntmFlags));
}
return pef->EnumProcW((LOGFONTW*) &elfeW, (TEXTMETRICW*) &ntmeW, FontType, pef->lParam);
}

View File

@ -128,12 +128,12 @@ BOOL WINAPI WriteFile_fix(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesTo
UINT WINAPI GetTempFileNameA_fix(LPCSTR lpPathName, LPCSTR lpPrefixString, UINT uUnique, LPTSTR lpTempFileName)
{
static int g_tempprefix = 0;
char temppref[2];
if (!lpPathName)
lpPathName = "\\";
if (!lpPrefixString)
{
char temppref[2];
g_tempprefix++;
g_tempprefix %= 5;
temppref[0] = '0' + g_tempprefix;

View File

@ -223,9 +223,9 @@ LRESULT WINAPI CallProcAnsiWithUnicode( WNDPROC callback, HWND hwnd, UINT msg, W
{
LPSTR textA;
int len = CallWindowProcA( callback, hwnd, msg == LB_GETTEXT ? LB_GETTEXTLEN : CB_GETLBTEXTLEN, wParam, 0 );
ABUFFER_ALLOC(textA,len);
ABUFFER_ALLOC(textA,len); //note that len does not include null
LRESULT ret = CallWindowProcA( callback, hwnd, msg, wParam,(LPARAM)textA );
ABUFFER_toW(textA,lParam,len);
ABUFFER_toW(textA,lParam,len+1);
BUFFER_FREE(textA);
return ret;
}

View File

@ -62,7 +62,9 @@
} \
else \
buffer = (LPSTR)alloca( buffer##size ); \
*buffer='\0';
buffer[0]='\0'; \
buffer[len]='\0'; \
buffer[buffer##size-1]='\0';
#define WBUFFER_ALLOC(buffer,len) \
int buffer##size = ((len+1) * sizeof(WCHAR)); \
@ -74,7 +76,8 @@
} \
else \
buffer = (LPWSTR)alloca( buffer##size ); \
*buffer='\0';
buffer[0]='\0'; \
buffer[len]='\0';
#define ABUFFER_toW(bufferA,bufferW,lenW) MultiByteToWideChar(CP_ACP, 0, bufferA, -1, (LPWSTR)bufferW, lenW);
#define WBUFFER_toA(bufferW,bufferA,lenA) WideCharToMultiByte(CP_ACP, 0, bufferW, -1, (LPSTR)bufferA, lenA, NULL, NULL);

View File

@ -365,7 +365,7 @@ SOURCE=.\Gdi32\_gdi32_stubs.c
# End Source File
# Begin Source File
SOURCE=.\Gdi32\FontResourceExA.c
SOURCE=.\Gdi32\FontResourceEx.c
# End Source File
# Begin Source File

View File

@ -35,7 +35,6 @@ static const apilib_named_api shell32_named_apis[] =
DECL_API("IsUserAnAdmin", IsUserAnAdmin_new),
DECL_API("SHCreateShellItem", SHCreateShellItem_stub),
DECL_API("SHOpenFolderAndSelectItems", SHOpenFolderAndSelectItems_stub),
DECL_API("SHParseDisplayName", SHParseDisplayName_stub),
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
};

View File

@ -30,7 +30,6 @@ extern const apilib_api_table apitable_shell32;
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
LPWSTR* WINAPI CommandLineToArgvW_new(LPCWSTR lpCmdline, int* numargs);
BOOL WINAPI IsUserAnAdmin_new(void);
STUB SHParseDisplayName_stub;
STUB SHCreateShellItem_stub;
STUB SHOpenFolderAndSelectItems_stub;
/*** AUTOGENERATED APILIST DECLARATIONS END ***/

View File

@ -21,6 +21,5 @@
#include "common.h"
UNIMPL_FUNC(SHParseDisplayName, 5);
UNIMPL_FUNC(SHCreateShellItem, 4);
UNIMPL_FUNC(SHOpenFolderAndSelectItems, 4);