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

import KernelEx-4.0-RC2

This commit is contained in:
UzixLS
2018-11-03 16:19:29 +03:00
parent d4e0420295
commit 339353cce8
299 changed files with 682 additions and 165 deletions

40
apilibs/CORE.INI Normal file → Executable file
View File

@ -17,8 +17,6 @@ noshow=1
[DCFG1.names.98]
KERNEL32.GetVersion=std
KERNEL32.GetVersionExA=std
KERNEL32.GetVersionExW=std
GDI32.SetWorldTransform=kexbases.0
GDI32.GetRandomRgn=std
GDI32.SetGraphicsMode=std
@ -28,8 +26,6 @@ KERNEL32.VerifyVersionInfoW=none
[DCFG1.names.Me]
KERNEL32.GetVersion=std
KERNEL32.GetVersionExA=std
KERNEL32.GetVersionExW=std
GDI32.SetWorldTransform=kexbases.0
GDI32.GetRandomRgn=std
GDI32.SetGraphicsMode=std
@ -46,8 +42,8 @@ desc=Windows 95
[WIN95.names]
KERNEL32.GetVersion=kexbases.0
KERNEL32.GetVersionExA=kexbases.0
KERNEL32.GetVersionExW=kexbases.0
KERNEL32.GetVersionExA=kexbases.1
KERNEL32.GetVersionExW=kexbases.1
[WIN98]
inherit=WIN95
@ -55,8 +51,8 @@ desc=Windows 98 SE
[WIN98.names]
KERNEL32.GetVersion=kexbases.1
KERNEL32.GetVersionExA=kexbases.1
KERNEL32.GetVersionExW=kexbases.1
KERNEL32.GetVersionExA=kexbases.2
KERNEL32.GetVersionExW=kexbases.2
[WINME]
inherit=WIN98
@ -64,8 +60,8 @@ desc=Windows Millennium
[WINME.names]
KERNEL32.GetVersion=kexbases.2
KERNEL32.GetVersionExA=kexbases.2
KERNEL32.GetVersionExW=kexbases.2
KERNEL32.GetVersionExA=kexbases.3
KERNEL32.GetVersionExW=kexbases.3
[NT40]
inherit=WIN95
@ -73,8 +69,8 @@ desc=Windows NT 4.0 SP6
[NT40.names]
KERNEL32.GetVersion=kexbases.3
KERNEL32.GetVersionExA=kexbases.3
KERNEL32.GetVersionExW=kexbases.3
KERNEL32.GetVersionExA=kexbases.4
KERNEL32.GetVersionExW=kexbases.4
[NT2K]
inherit=NT40
@ -82,8 +78,8 @@ desc=Windows 2000 SP4
[NT2K.names]
KERNEL32.GetVersion=kexbases.4
KERNEL32.GetVersionExA=kexbases.4
KERNEL32.GetVersionExW=kexbases.4
KERNEL32.GetVersionExA=kexbases.5
KERNEL32.GetVersionExW=kexbases.5
GDI32.SetWorldTransform=kexbases.1
GDI32.GetRandomRgn=kexbases.0
GDI32.SetGraphicsMode=kexbases.0
@ -97,8 +93,8 @@ desc=Windows XP SP2
[WINXP.names]
KERNEL32.GetVersion=kexbases.5
KERNEL32.GetVersionExA=kexbases.5
KERNEL32.GetVersionExW=kexbases.5
KERNEL32.GetVersionExA=kexbases.6
KERNEL32.GetVersionExW=kexbases.6
KERNEL32.VerifyVersionInfoA=kexbases.1
KERNEL32.VerifyVersionInfoW=kexbases.1
@ -108,8 +104,8 @@ desc=Windows 2003 SP1
[WIN2K3.names]
KERNEL32.GetVersion=kexbases.6
KERNEL32.GetVersionExA=kexbases.6
KERNEL32.GetVersionExW=kexbases.6
KERNEL32.GetVersionExA=kexbases.7
KERNEL32.GetVersionExW=kexbases.7
KERNEL32.VerifyVersionInfoA=kexbases.2
KERNEL32.VerifyVersionInfoW=kexbases.2
@ -119,8 +115,8 @@ desc=Windows Vista
[VISTA.names]
KERNEL32.GetVersion=kexbases.7
KERNEL32.GetVersionExA=kexbases.7
KERNEL32.GetVersionExW=kexbases.7
KERNEL32.GetVersionExA=kexbases.8
KERNEL32.GetVersionExW=kexbases.8
KERNEL32.VerifyVersionInfoA=kexbases.3
KERNEL32.VerifyVersionInfoW=kexbases.3
@ -130,7 +126,7 @@ desc=Windows 2008 SP1
[WIN2K8.names]
KERNEL32.GetVersion=kexbases.8
KERNEL32.GetVersionExA=kexbases.8
KERNEL32.GetVersionExW=kexbases.8
KERNEL32.GetVersionExA=kexbases.9
KERNEL32.GetVersionExW=kexbases.9
KERNEL32.VerifyVersionInfoA=kexbases.4
KERNEL32.VerifyVersionInfoW=kexbases.4

0
apilibs/kexbasen/advapi32/_advapi32_apilist.c Normal file → Executable file
View File

0
apilibs/kexbasen/advapi32/_advapi32_apilist.h Normal file → Executable file
View File

0
apilibs/kexbasen/advapi32/uniadvapi32.c Normal file → Executable file
View File

0
apilibs/kexbasen/auxdecl.h Normal file → Executable file
View File

0
apilibs/kexbasen/comdlg32/_comdlg32_apilist.c Normal file → Executable file
View File

0
apilibs/kexbasen/comdlg32/_comdlg32_apilist.h Normal file → Executable file
View File

0
apilibs/kexbasen/comdlg32/unicomdlg32.c Normal file → Executable file
View File

0
apilibs/kexbasen/common.c Normal file → Executable file
View File

0
apilibs/kexbasen/common.h Normal file → Executable file
View File

0
apilibs/kexbasen/dirlist Normal file → Executable file
View File

0
apilibs/kexbasen/gdi32/UberGDI.c Normal file → Executable file
View File

0
apilibs/kexbasen/gdi32/_gdi32_apilist.c Normal file → Executable file
View File

0
apilibs/kexbasen/gdi32/_gdi32_apilist.h Normal file → Executable file
View File

0
apilibs/kexbasen/gdi32/unigdi32.c Normal file → Executable file
View File

0
apilibs/kexbasen/kernel32/_kernel32_apilist.c Normal file → Executable file
View File

0
apilibs/kexbasen/kernel32/_kernel32_apilist.h Normal file → Executable file
View File

0
apilibs/kexbasen/kernel32/unikernel32.c Normal file → Executable file
View File

0
apilibs/kexbasen/kexbasen.def Normal file → Executable file
View File

0
apilibs/kexbasen/kexbasen.dsp Normal file → Executable file
View File

8
apilibs/kexbasen/kexbasen.rc Normal file → Executable file
View File

@ -54,8 +54,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,0,1,0
PRODUCTVERSION 4,0,1,0
FILEVERSION 4,0,1,2
PRODUCTVERSION 4,0,1,2
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -73,14 +73,14 @@ BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "Xeno86\0"
VALUE "FileDescription", "KernelEx Base Non-shared Api Library\0"
VALUE "FileVersion", "4, 0, 1, 0\0"
VALUE "FileVersion", "4, 0, 1, 2\0"
VALUE "InternalName", "kexbasen\0"
VALUE "LegalCopyright", "Copyright <20> 2009, Xeno86\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "kexbasen.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "KernelEx\0"
VALUE "ProductVersion", "4, 0, 1, 0\0"
VALUE "ProductVersion", "4, 0, 1, 2\0"
VALUE "SpecialBuild", "\0"
END
END

0
apilibs/kexbasen/main.c Normal file → Executable file
View File

0
apilibs/kexbasen/resource.h Normal file → Executable file
View File

0
apilibs/kexbasen/shell32/SHGetFolderLocation.c Normal file → Executable file
View File

0
apilibs/kexbasen/shell32/SHGetFolderPath.c Normal file → Executable file
View File

0
apilibs/kexbasen/shell32/_shell32_apilist.c Normal file → Executable file
View File

0
apilibs/kexbasen/shell32/_shell32_apilist.h Normal file → Executable file
View File

0
apilibs/kexbasen/shell32/auxshlguid.h Normal file → Executable file
View File

0
apilibs/kexbasen/shell32/pidl.h Normal file → Executable file
View File

0
apilibs/kexbasen/shell32/unishell32.c Normal file → Executable file
View File

0
apilibs/kexbasen/shell32ord.def Normal file → Executable file
View File

0
apilibs/kexbasen/unifwd.c Normal file → Executable file
View File

0
apilibs/kexbasen/unifwd.h Normal file → Executable file
View File

1
apilibs/kexbasen/user32/_user32_apilist.c Normal file → Executable file
View File

@ -87,7 +87,6 @@ static const apilib_named_api user32_named_apis[] =
DECL_API("GetKeyboardLayoutNameW", GetKeyboardLayoutNameW_fwd),
DECL_API("GetMenuItemInfoW", GetMenuItemInfoW_fwd),
DECL_API("GetMenuStringW", GetMenuStringW_fwd),
DECL_API("GetMessageW", GetMessageW_fwd),
DECL_API("GetMonitorInfoW", GetMonitorInfoW_fwd),
DECL_API("GetPropW", GetPropW_fwd),
DECL_API("GetTabbedTextExtentW", GetTabbedTextExtentW_fwd),

1
apilibs/kexbasen/user32/_user32_apilist.h Normal file → Executable file
View File

@ -83,7 +83,6 @@ FWDPROC GetKeyboardLayoutNameW_fwd;
FWDPROC GetKeyNameTextW_fwd;
FWDPROC GetMenuItemInfoW_fwd;
FWDPROC GetMenuStringW_fwd;
FWDPROC GetMessageW_fwd;
FWDPROC GetMonitorInfoW_fwd;
FWDPROC GetPropW_fwd;
FWDPROC GetTabbedTextExtentW_fwd;

1
apilibs/kexbasen/user32/uniuser32.c Normal file → Executable file
View File

@ -106,7 +106,6 @@ FORWARD_TO_UNICOWS(GetKeyboardLayoutNameW);
FORWARD_TO_UNICOWS(GetKeyNameTextW);
FORWARD_TO_UNICOWS(GetMenuItemInfoW);
FORWARD_TO_UNICOWS(GetMenuStringW);
FORWARD_TO_UNICOWS(GetMessageW);
FORWARD_TO_UNICOWS(GetMonitorInfoW);
FORWARD_TO_UNICOWS(GetPropW);
FORWARD_TO_UNICOWS(GetTabbedTextExtentW);

View File

@ -0,0 +1,36 @@
/*
* KernelEx
* Copyright (C) 2009, 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.
*
*/
#include <windows.h>
/* MAKE_EXPORT OpenSCManagerA_stub=OpenSCManagerA */
SC_HANDLE WINAPI OpenSCManagerA_stub(LPCSTR lpMachineName, LPCSTR lpDatabaseName,
DWORD dwDesiredAccess)
{
return (SC_HANDLE) 0xCAFE;
}
/* MAKE_EXPORT OpenSCManagerW_stub=OpenSCManagerW */
SC_HANDLE WINAPI OpenSCManagerW_stub(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName,
DWORD dwDesiredAccess)
{
return (SC_HANDLE) 0xCAFE;
}

0
apilibs/kexbases/Advapi32/RegDisablePredefinedCache.c Normal file → Executable file
View File

0
apilibs/kexbases/Advapi32/RegOpenCurrentUser.c Normal file → Executable file
View File

0
apilibs/kexbases/Advapi32/TraceMessage.c Normal file → Executable file
View File

2
apilibs/kexbases/Advapi32/_advapi32_apilist.c Normal file → Executable file
View File

@ -89,6 +89,8 @@ static const apilib_named_api advapi32_named_apis[] =
DECL_API("MakeSelfRelativeSD", MakeSelfRelativeSD_new),
DECL_API("NotifyBootConfigStatus", NotifyBootConfigStatus_new),
DECL_API("OpenProcessToken", OpenProcessToken_new),
DECL_API("OpenSCManagerA", OpenSCManagerA_stub),
DECL_API("OpenSCManagerW", OpenSCManagerW_stub),
DECL_API("OpenThreadToken", OpenThreadToken_new),
DECL_API("PrivilegeCheck", PrivilegeCheck_new),
DECL_API("QueryServiceStatusEx", QueryServiceStatusEx_stub),

2
apilibs/kexbases/Advapi32/_advapi32_apilist.h Normal file → Executable file
View File

@ -29,6 +29,8 @@ BOOL init_advapi32();
extern const apilib_api_table apitable_advapi32;
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
SC_HANDLE WINAPI OpenSCManagerA_stub(LPCSTR lpMachineName, LPCSTR lpDatabaseName, DWORD dwDesiredAccess);
SC_HANDLE WINAPI OpenSCManagerW_stub(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess);
BOOL WINAPI RegDisablePredefinedCache_new();
LONG WINAPI RegOpenCurrentUser_new(REGSAM access, PHKEY retkey);
ULONG CDECL TraceMessage_new(ULONG64 LoggerHandle, ULONG MessageFlags, LPGUID MessageGuid, USHORT MessageNumber, ...);

0
apilibs/kexbases/Advapi32/_advapi32_stubs.c Normal file → Executable file
View File

0
apilibs/kexbases/Advapi32/security.c Normal file → Executable file
View File

0
apilibs/kexbases/Advapi32/uniadvapi32.c Normal file → Executable file
View File

0
apilibs/kexbases/Gdi32/FontResourceExA.c Normal file → Executable file
View File

0
apilibs/kexbases/Gdi32/GetGlyphOutlineA_fix.c Normal file → Executable file
View File

0
apilibs/kexbases/Gdi32/TextOut.c Normal file → Executable file
View File

0
apilibs/kexbases/Gdi32/_gdi32_apilist.c Normal file → Executable file
View File

0
apilibs/kexbases/Gdi32/_gdi32_apilist.h Normal file → Executable file
View File

0
apilibs/kexbases/Gdi32/_gdi32_stubs.c Normal file → Executable file
View File

0
apilibs/kexbases/Gdi32/unigdi32.c Normal file → Executable file
View File

0
apilibs/kexbases/Kernel32/CopyFileEx.c Normal file → Executable file
View File

View File

@ -1,44 +0,0 @@
/*
* KernelEx
* Copyright (C) 2008-2009, 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.
*
*/
#include <windows.h>
/* MAKE_EXPORT CreateFileA_fix=CreateFileA */
HANDLE WINAPI CreateFileA_fix(LPCSTR lpFileName, DWORD dwDesiredAccess,
DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDistribution, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
{
/* translate NT-specific access rights to generic ones */
if (dwDesiredAccess & ~0xf0010100)
{
DWORD oldaccess = dwDesiredAccess;
dwDesiredAccess &= 0xf0010100;
if (oldaccess & FILE_READ_DATA)
dwDesiredAccess |= GENERIC_READ;
if (oldaccess & FILE_WRITE_DATA)
dwDesiredAccess |= GENERIC_WRITE;
if (oldaccess & FILE_EXECUTE)
dwDesiredAccess |= GENERIC_EXECUTE;
}
// hTemplate has to be NULL on 9x
return CreateFileA(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes,
dwCreationDistribution, dwFlagsAndAttributes, NULL);
}

0
apilibs/kexbases/Kernel32/CreateThread_fix.c Normal file → Executable file
View File

0
apilibs/kexbases/Kernel32/DeleteCriticalSection.c Normal file → Executable file
View File

View File

@ -0,0 +1,107 @@
/*
* KernelEx
* Copyright (C) 2008-2009, 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.
*
*/
#include <windows.h>
/* MAKE_EXPORT CreateFileA_fix=CreateFileA */
HANDLE WINAPI CreateFileA_fix(LPCSTR lpFileName, DWORD dwDesiredAccess,
DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDistribution, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
{
/* translate NT-specific access rights to generic ones */
if (dwDesiredAccess & ~0xf0010100)
{
DWORD oldaccess = dwDesiredAccess;
dwDesiredAccess &= 0xf0010100;
if (oldaccess & FILE_READ_DATA)
dwDesiredAccess |= GENERIC_READ;
if (oldaccess & FILE_WRITE_DATA)
dwDesiredAccess |= GENERIC_WRITE;
if (oldaccess & FILE_EXECUTE)
dwDesiredAccess |= GENERIC_EXECUTE;
}
// hTemplate has to be NULL on 9x
hTemplateFile = NULL;
// special case: overlapped I/O
if (dwFlagsAndAttributes & FILE_FLAG_OVERLAPPED)
{
DWORD lasterr = GetLastError();
HANDLE h;
h = CreateFileA(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes,
dwCreationDistribution, dwFlagsAndAttributes, hTemplateFile);
if (h != INVALID_HANDLE_VALUE)
return h;
SetLastError(lasterr);
dwFlagsAndAttributes &= ~FILE_FLAG_OVERLAPPED;
}
return CreateFileA(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes,
dwCreationDistribution, dwFlagsAndAttributes, hTemplateFile);
}
/* MAKE_EXPORT ReadFile_fix=ReadFile */
BOOL WINAPI ReadFile_fix(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped)
{
DWORD lasterr = GetLastError();
if (ReadFile(hFile, lpBuffer, nNumberOfBytesToRead, lpNumberOfBytesRead,
lpOverlapped))
return TRUE;
if (lpOverlapped && GetLastError() == ERROR_INVALID_PARAMETER)
{
LONG high = lpOverlapped->OffsetHigh;
DWORD nr;
SetLastError(lasterr);
if ((SetFilePointer(hFile, lpOverlapped->Offset, &high, FILE_BEGIN)
== (DWORD)-1 && GetLastError() != NO_ERROR) ||
(ReadFile(hFile, lpBuffer, nNumberOfBytesToRead, &nr, 0) && !nr))
{
SetLastError(ERROR_HANDLE_EOF);
return FALSE;
}
*lpNumberOfBytesRead = nr;
return TRUE;
}
return FALSE;
}
/* MAKE_EXPORT WriteFile_fix=WriteFile */
BOOL WINAPI WriteFile_fix(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,
LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped)
{
DWORD lasterr = GetLastError();
if (WriteFile(hFile, lpBuffer, nNumberOfBytesToWrite,
lpNumberOfBytesWritten, lpOverlapped))
return TRUE;
if (lpOverlapped && GetLastError() == ERROR_INVALID_PARAMETER)
{
LONG high = lpOverlapped->OffsetHigh;
SetLastError(lasterr);
if ((SetFilePointer(hFile, lpOverlapped->Offset, &high, FILE_BEGIN)
== (DWORD)-1 && GetLastError() != NO_ERROR))
return FALSE;
return WriteFile(hFile, lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, 0);
}
return FALSE;
}

View File

@ -0,0 +1,47 @@
/*
* KernelEx
* Copyright (C) 2009, 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.
*
*/
#include <windows.h>
BOOL CALLBACK GetConsoleWindowEnum(HWND hwnd, LPARAM lparam)
{
char name[5];
if (GetClassName(hwnd, name, sizeof(name)) == (sizeof("tty")-1)
&& !strcmp(name, "tty"))
{
DWORD pid;
GetWindowThreadProcessId(hwnd, &pid);
if (pid == GetCurrentProcessId())
{
*(HWND*) lparam = hwnd;
return FALSE;
}
}
return TRUE;
}
/* MAKE_EXPORT GetConsoleWindow_new=GetConsoleWindow */
HWND WINAPI GetConsoleWindow_new()
{
HWND window = NULL;
EnumWindows(GetConsoleWindowEnum, (LPARAM) &window);
return window;
}

0
apilibs/kexbases/Kernel32/GetFileSizeEx.c Normal file → Executable file
View File

0
apilibs/kexbases/Kernel32/GlobalMemoryStatusEx.c Normal file → Executable file
View File

0
apilibs/kexbases/Kernel32/HeapLocks.c Normal file → Executable file
View File

View File

View File

@ -0,0 +1,102 @@
/*
* Copyright 2009 Xeno86
* Copyright 1995,1997 Morten Welinder
* Copyright 1997-1998 Marcus Meissner
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <windows.h>
/* Processor feature flags. */
#define PF_FLOATING_POINT_PRECISION_ERRATA 0
#define PF_FLOATING_POINT_EMULATED 1
#define PF_COMPARE_EXCHANGE_DOUBLE 2
#define PF_MMX_INSTRUCTIONS_AVAILABLE 3
#define PF_PPC_MOVEMEM_64BIT_OK 4
#define PF_ALPHA_BYTE_INSTRUCTIONS 5
#define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
#define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
#define PF_RDTSC_INSTRUCTION_AVAILABLE 8
#define PF_PAE_ENABLED 9
#define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
#define PF_SSE_DAZ_MODE_AVAILABLE 11
#define PF_NX_ENABLED 12
#define PF_SSE3_INSTRUCTIONS_AVAILABLE 13
#define PF_COMPARE_EXCHANGE128 14
#define PF_COMPARE64_EXCHANGE128 15
#define PF_CHANNELS_ENABLED 16
#define AUTH 0x68747541 /* "Auth" */
#define ENTI 0x69746e65 /* "enti" */
#define CAMD 0x444d4163 /* "cAMD" */
static BYTE PF[17] = {0,};
static void do_cpuid(unsigned int _eax, unsigned int *p)
{
#ifdef __GNUC__
__asm__("cpuid"
: "=a" (p[0]), "=b" (p[1]), "=c" (p[2]), "=d" (p[3])
: "a" (_eax));
#else
__asm {
mov eax, _eax
mov edi, p
cpuid
mov [edi], eax
mov [edi+4], ebx
mov [edi+8], ecx
mov [edi+12], edx
}
#endif
}
void get_cpuinfo()
{
unsigned int regs[4], regs2[4];
do_cpuid(0x00000000, regs); /* get standard cpuid level and vendor name */
if (regs[0]>=0x00000001) /* Check for supported cpuid version */
{
do_cpuid(0x00000001, regs2); /* get cpu features */
PF[PF_FLOATING_POINT_EMULATED] = !(regs2[3] & 1);
PF[PF_RDTSC_INSTRUCTION_AVAILABLE] = (regs2[3] & (1 << 4 )) >> 4;
PF[PF_COMPARE_EXCHANGE_DOUBLE] = (regs2[3] & (1 << 8 )) >> 8;
PF[PF_MMX_INSTRUCTIONS_AVAILABLE] = (regs2[3] & (1 << 23)) >> 23;
PF[PF_XMMI_INSTRUCTIONS_AVAILABLE] = (regs2[3] & (1 << 25)) >> 25;
PF[PF_XMMI64_INSTRUCTIONS_AVAILABLE] = (regs2[3] & (1 << 26)) >> 26;
PF[PF_SSE3_INSTRUCTIONS_AVAILABLE] = (regs2[2] & 1);
if (regs[1] == AUTH &&
regs[3] == ENTI &&
regs[2] == CAMD) {
do_cpuid(0x80000000, regs); /* get vendor cpuid level */
if (regs[0]>=0x80000001) {
do_cpuid(0x80000001, regs2); /* get vendor features */
PF[PF_3DNOW_INSTRUCTIONS_AVAILABLE] = (regs2[3] & (1 << 31)) >> 31;
}
}
}
}
/* MAKE_EXPORT IsProcessorFeaturePresent_new=IsProcessorFeaturePresent */
BOOL WINAPI IsProcessorFeaturePresent_new(DWORD feature)
{
if (feature < 17)
return PF[feature];
else
return FALSE;
}

0
apilibs/kexbases/Kernel32/Jobs.c Normal file → Executable file
View File

0
apilibs/kexbases/Kernel32/KEXVersion.c Normal file → Executable file
View File

0
apilibs/kexbases/Kernel32/LockFileEx.c Normal file → Executable file
View File

0
apilibs/kexbases/Kernel32/MapViewOfFile.c Normal file → Executable file
View File

0
apilibs/kexbases/Kernel32/MoveFileExA.c Normal file → Executable file
View File

4
apilibs/kexbases/Kernel32/MoveFileWithProgressA.c Normal file → Executable file
View File

@ -20,9 +20,11 @@
*/
#include <windows.h>
#include <common.h>
#include "_kernel32_apilist.h"
/* MAKE_EXPORT MoveFileWithProgressA_new=MoveFileWithProgressA */
BOOL WINAPI MoveFileWithProgressA_new(LPCSTR lpExistingFileName, LPCSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, DWORD dwFlags)
{
return MoveFileExA(lpExistingFileName, lpNewFileName, dwFlags);
return MoveFileExA_new(lpExistingFileName, lpNewFileName, dwFlags);
}

0
apilibs/kexbases/Kernel32/OpenThread.c Normal file → Executable file
View File

0
apilibs/kexbases/Kernel32/SetFilePointerEx.c Normal file → Executable file
View File

0
apilibs/kexbases/Kernel32/ThreadPool.c Normal file → Executable file
View File

0
apilibs/kexbases/Kernel32/TryEnterCriticalSection.c Normal file → Executable file
View File

0
apilibs/kexbases/Kernel32/VirtualAllocEx.c Normal file → Executable file
View File

9
apilibs/kexbases/Kernel32/_kernel32_apilist.c Normal file → Executable file
View File

@ -28,11 +28,13 @@ http://17slon.com/blogs/gabr/2007/02/four-ways-to-detect-vista.html
#include "kexcoresdk.h"
#include "_kernel32_apilist.h"
void get_cpuinfo();
BOOL init_tryentercritsec();
BOOL init_openthread();
BOOL init_kernel32()
{
get_cpuinfo();
return init_tryentercritsec() && init_openthread();
}
@ -73,7 +75,7 @@ static const apilib_named_api kernel32_named_apis[] =
DECL_API("FindResourceExW", FindResourceExW_new),
DECL_API("FindResourceW", FindResourceW_new),
DECL_API("FreeEnvironmentStringsW", FreeEnvironmentStringsW_new),
DECL_API("GetConsoleWindow", GetConsoleWindow_stub),
DECL_API("GetConsoleWindow", GetConsoleWindow_new),
DECL_API("GetCurrentDirectoryW", GetCurrentDirectoryW_new),
DECL_API("GetDefaultCommConfigW", GetDefaultCommConfigW_new),
DECL_API("GetDiskFreeSpaceExW", GetDiskFreeSpaceExW_new),
@ -103,6 +105,7 @@ static const apilib_named_api kernel32_named_apis[] =
DECL_API("GetVersion", GetVersion_WIN2K3),
DECL_API("GetVersion", GetVersion_VISTA),
DECL_API("GetVersion", GetVersion_WIN2K8),
DECL_API("GetVersionExA", GetVersionExA_ORIG),
DECL_API("GetVersionExA", GetVersionExA_WIN95),
DECL_API("GetVersionExA", GetVersionExA_WIN98),
DECL_API("GetVersionExA", GetVersionExA_WINME),
@ -112,6 +115,7 @@ static const apilib_named_api kernel32_named_apis[] =
DECL_API("GetVersionExA", GetVersionExA_WIN2K3),
DECL_API("GetVersionExA", GetVersionExA_VISTA),
DECL_API("GetVersionExA", GetVersionExA_WIN2K8),
DECL_API("GetVersionExW", GetVersionExW_ORIG),
DECL_API("GetVersionExW", GetVersionExW_WIN95),
DECL_API("GetVersionExW", GetVersionExW_WIN98),
DECL_API("GetVersionExW", GetVersionExW_WINME),
@ -130,6 +134,7 @@ static const apilib_named_api kernel32_named_apis[] =
DECL_API("HeapUnlock", HeapUnlock_new),
DECL_API("InitializeCriticalSectionAndSpinCount", InitializeCriticalSectionAndSpinCount_new),
DECL_API("IsProcessInJob", IsProcessInJob_new),
DECL_API("IsProcessorFeaturePresent", IsProcessorFeaturePresent_new),
DECL_API("IsValidLanguageGroup", IsValidLanguageGroup_stub),
DECL_API("KEXVersion", KEXVersion),
DECL_API("LockFileEx", LockFileEx_new),
@ -149,6 +154,7 @@ static const apilib_named_api kernel32_named_apis[] =
DECL_API("Process32NextW", Process32NextW_new),
DECL_API("QueryInformationJobObject", QueryInformationJobObject_new),
DECL_API("QueueUserWorkItem", QueueUserWorkItem_stub),
DECL_API("ReadFile", ReadFile_fix),
DECL_API("RegisterWaitForSingleObject", RegisterWaitForSingleObject_new),
DECL_API("RegisterWaitForSingleObjectEx", RegisterWaitForSingleObjectEx_new),
DECL_API("RemoveDirectoryW", RemoveDirectoryW_new),
@ -179,6 +185,7 @@ static const apilib_named_api kernel32_named_apis[] =
DECL_API("VerifyVersionInfoW", VerifyVersionInfoW_WIN2K8),
DECL_API("VirtualAllocEx", VirtualAllocEx_new),
DECL_API("VirtualFreeEx", VirtualFreeEx_new),
DECL_API("WriteFile", WriteFile_fix),
DECL_API("lstrcpynW", lstrcpynW_new),
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
};

9
apilibs/kexbases/Kernel32/_kernel32_apilist.h Normal file → Executable file
View File

@ -31,14 +31,18 @@ extern const apilib_api_table apitable_kernel32;
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
BOOL WINAPI CopyFileExA_new(LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags);
HANDLE WINAPI CreateFileA_fix(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDistribution, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
HANDLE WINAPI CreateThread_fix(LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId);
void WINAPI DeleteCriticalSection_new(PCRITICAL_SECTION lpCriticalSection);
HANDLE WINAPI CreateFileA_fix(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDistribution, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
BOOL WINAPI ReadFile_fix(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped);
BOOL WINAPI WriteFile_fix(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped);
HWND WINAPI GetConsoleWindow_new();
BOOL WINAPI GetFileSizeEx_new(HANDLE hFile, PLARGE_INTEGER lpFileSize);
BOOL WINAPI GlobalMemoryStatusEx_new(LPMEMORYSTATUSEX lpmemex);
BOOL WINAPI HeapLock_new(HANDLE hHeap);
BOOL WINAPI HeapUnlock_new(HANDLE hHeap);
BOOL WINAPI InitializeCriticalSectionAndSpinCount_new(LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount);
BOOL WINAPI IsProcessorFeaturePresent_new(DWORD feature);
HANDLE WINAPI CreateJobObjectA_new(LPSECURITY_ATTRIBUTES sa, LPCSTR name);
HANDLE WINAPI CreateJobObjectW_new(LPSECURITY_ATTRIBUTES sa, LPCWSTR name);
BOOL WINAPI TerminateJobObject_new(HANDLE job, UINT exit_code);
@ -64,7 +68,6 @@ LPVOID WINAPI VirtualAllocEx_new(HANDLE hProcess, LPVOID lpAddress, DWORD dwSize
BOOL WINAPI VirtualFreeEx_new(HANDLE hProcess, LPVOID lpAddress, DWORD dwSize, DWORD dwFreeType);
STUB CreateHardLinkA_stub;
STUB CreateHardLinkW_stub;
STUB GetConsoleWindow_stub;
STUB IsValidLanguageGroup_stub;
STUB QueueUserWorkItem_stub;
STUB ReplaceFileA_stub;
@ -132,6 +135,8 @@ DWORD WINAPI GetVersion_WINXP(void);
DWORD WINAPI GetVersion_WIN2K3(void);
DWORD WINAPI GetVersion_VISTA(void);
DWORD WINAPI GetVersion_WIN2K8(void);
BOOL WINAPI GetVersionExA_ORIG(LPOSVERSIONINFOA lpVersionInfo);
BOOL WINAPI GetVersionExW_ORIG(LPOSVERSIONINFOW lpVersionInfo);
BOOL WINAPI GetVersionExA_WIN95(LPOSVERSIONINFOA lpVersionInfo);
BOOL WINAPI GetVersionExW_WIN95(LPOSVERSIONINFOW lpVersionInfo);
BOOL WINAPI GetVersionExA_WIN98(LPOSVERSIONINFOA lpVersionInfo);

1
apilibs/kexbases/Kernel32/_kernel32_stubs.c Normal file → Executable file
View File

@ -23,7 +23,6 @@
UNIMPL_FUNC(CreateHardLinkA, 3);
UNIMPL_FUNC(CreateHardLinkW, 3);
UNIMPL_FUNC(GetConsoleWindow, 0);
UNIMPL_FUNC(IsValidLanguageGroup, 2);
UNIMPL_FUNC(QueueUserWorkItem, 3);
UNIMPL_FUNC(ReplaceFileA, 6);

0
apilibs/kexbases/Kernel32/uilang.c Normal file → Executable file
View File

0
apilibs/kexbases/Kernel32/unikernel32.c Normal file → Executable file
View File

70
apilibs/kexbases/Kernel32/version.c Normal file → Executable file
View File

@ -109,6 +109,64 @@ static const OSVERSIONINFOEXA_PRIV VersionData[NB_WINDOWS_VERSIONS] =
}
};
static BOOL original_GetVersionEx(void* buf, BOOL unicode)
{
BOOL ret;
OSVERSIONINFOA* ver = (OSVERSIONINFOA*) buf;
DWORD structsize = ver->dwOSVersionInfoSize;
if (!unicode)
{
if (structsize != sizeof(OSVERSIONINFOA) && structsize != sizeof(OSVERSIONINFOEXA))
{
SetLastError(ERROR_INSUFFICIENT_BUFFER);
return FALSE;
}
}
else
{
if (structsize != sizeof(OSVERSIONINFOW) && structsize != sizeof(OSVERSIONINFOEXW))
{
SetLastError(ERROR_INSUFFICIENT_BUFFER);
return FALSE;
}
}
ver->dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
ret = GetVersionExA(ver);
if (ret)
{
char csdVer[128];
OSVERSIONINFOEXA* verexA = (OSVERSIONINFOEXA*) ver;
OSVERSIONINFOEXW* verexW = (OSVERSIONINFOEXW*) ver;
switch (structsize)
{
case sizeof(OSVERSIONINFOEXA):
verexA->wServicePackMajor = 0;
verexA->wServicePackMinor = 0;
verexA->wSuiteMask = 0;
verexA->wProductType = 0;
verexA->wReserved = 0;
case sizeof(OSVERSIONINFOA):
break;
case sizeof(OSVERSIONINFOEXW):
verexW->wServicePackMajor = 0;
verexW->wServicePackMinor = 0;
verexW->wSuiteMask = 0;
verexW->wProductType = 0;
verexW->wReserved = 0;
case sizeof(OSVERSIONINFOW):
strcpy(csdVer, ver->szCSDVersion);
MultiByteToWideChar(CP_ACP, 0, csdVer, -1, verexW->szCSDVersion,
sizeof(csdVer));
break;
}
}
ver->dwOSVersionInfoSize = structsize;
return ret;
}
static DWORD common_GetVersion(WINDOWS_VERSION version)
{
const OSVERSIONINFOEXA_PRIV* osv = &VersionData[version];
@ -404,6 +462,18 @@ DWORD WINAPI GetVersion_WIN2K8(void)
return common_GetVersion(WIN2K8);
}
/* MAKE_EXPORT GetVersionExA_ORIG=GetVersionExA */
BOOL WINAPI GetVersionExA_ORIG(LPOSVERSIONINFOA lpVersionInfo)
{
return original_GetVersionEx(lpVersionInfo, FALSE);
}
/* MAKE_EXPORT GetVersionExW_ORIG=GetVersionExW */
BOOL WINAPI GetVersionExW_ORIG(LPOSVERSIONINFOW lpVersionInfo)
{
return original_GetVersionEx(lpVersionInfo, TRUE);
}
/* MAKE_EXPORT GetVersionExA_WIN95=GetVersionExA */
BOOL WINAPI GetVersionExA_WIN95(LPOSVERSIONINFOA lpVersionInfo)
{

0
apilibs/kexbases/User32/CallWindowProcA_fix.c Normal file → Executable file
View File

View File

0
apilibs/kexbases/User32/EnableWindow.c Normal file → Executable file
View File

0
apilibs/kexbases/User32/ForegroundWindow.c Normal file → Executable file
View File

0
apilibs/kexbases/User32/GetAncestor.c Normal file → Executable file
View File

0
apilibs/kexbases/User32/GetMouseMovePointsEx.c Normal file → Executable file
View File

0
apilibs/kexbases/User32/IsHungAppWindow.c Normal file → Executable file
View File

0
apilibs/kexbases/User32/LockWorkStation.c Normal file → Executable file
View File

0
apilibs/kexbases/User32/MapVirtualKey_fix.c Normal file → Executable file
View File

0
apilibs/kexbases/User32/SendMessage_fix.c Normal file → Executable file
View File

0
apilibs/kexbases/User32/UberUSER.c Normal file → Executable file
View File

0
apilibs/kexbases/User32/UpdateLayeredWindow.c Normal file → Executable file
View File

0
apilibs/kexbases/User32/_user32_apilist.c Normal file → Executable file
View File

0
apilibs/kexbases/User32/_user32_apilist.h Normal file → Executable file
View File

0
apilibs/kexbases/User32/_user32_stubs.c Normal file → Executable file
View File

0
apilibs/kexbases/User32/uniuser32.c Normal file → Executable file
View File

8
apilibs/kexbases/auxdecl.h Normal file → Executable file
View File

@ -109,7 +109,6 @@ typedef void *LPMOUSEMOVEPOINT;
EXTERN_C int WINAPI GetRandomRgn(HDC hdc, HRGN hrgn, INT iNum);
EXTERN_C HRESULT WINAPI SHGetFolderPathA(HWND hwnd, int csidl, HANDLE hToken, DWORD dwFlags, LPSTR pszPath);
EXTERN_C HWND WINAPI GetAncestor(HWND hwnd, UINT gaFlags);
EXTERN_C UINT WINAPI RealGetWindowClass(HWND hwnd, LPTSTR pszType, UINT cchType);
#endif /* defined (_MSC_VER) && (WINVER < 0x0500) */
@ -131,6 +130,13 @@ typedef struct {
#endif /* __MINGW32_VERSION */
/* declarations for everyone */
#ifdef GetAltTabInfo
#undef GetAltTabInfo
#endif
EXTERN_C BOOL WINAPI GetAltTabInfo(HWND,int,PVOID,LPSTR,UINT);
#ifdef RealGetWindowClass
#undef RealGetWindowClass
#endif
EXTERN_C UINT WINAPI RealGetWindowClass(HWND hwnd, LPTSTR pszType, UINT cchType);
#endif /* __AUXDECL_H */

0
apilibs/kexbases/comdlg32/PrintDlgEx.c Normal file → Executable file
View File

0
apilibs/kexbases/comdlg32/_comdlg32_apilist.c Normal file → Executable file
View File

0
apilibs/kexbases/comdlg32/_comdlg32_apilist.h Normal file → Executable file
View File

Some files were not shown because too many files have changed in this diff Show More