mirror of
https://github.com/UzixLS/KernelEx.git
synced 2025-07-19 07:21:20 +03:00
import KernelEx-4.5-RC4
This commit is contained in:
@ -25,7 +25,6 @@
|
||||
#include "k32ord.h"
|
||||
#include "kexcoresdk.h"
|
||||
|
||||
static BOOL blockkexgdiobj;
|
||||
static WORD g_GDILH_addr;
|
||||
static DWORD g_GdiBase;
|
||||
static int script_cache_psidx;
|
||||
@ -40,7 +39,6 @@ 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;
|
||||
}
|
||||
@ -126,7 +124,6 @@ static DWORD SwitchGDIObjectType( PGDIOBJ16 obj )
|
||||
/* MAKE_EXPORT GetObjectType_fix=GetObjectType */
|
||||
DWORD WINAPI GetObjectType_fix( HGDIOBJ hgdiobj )
|
||||
{
|
||||
if (blockkexgdiobj) return GetObjectType(hgdiobj);
|
||||
//GetObjectType is rewritten in order to boost it's correctness and speed:
|
||||
//constantly throwing page/segfaults is very bad on virtual machines.
|
||||
PGDIOBJ16 obj = GetGDIObjectPtr( hgdiobj );
|
||||
@ -166,7 +163,6 @@ WORD GetCurrentTDB()
|
||||
/* MAKE_EXPORT DeleteObject_fix=DeleteObject */
|
||||
BOOL WINAPI DeleteObject_fix( HGDIOBJ hObject )
|
||||
{
|
||||
if (blockkexgdiobj) return DeleteObject(hObject);
|
||||
PGDIOBJ16 obj = GetGDIObjectPtr( hObject );
|
||||
if ( !obj || !SwitchGDIObjectType(obj) ) return FALSE;
|
||||
DWORD violated = 0;
|
||||
@ -178,7 +174,7 @@ BOOL WINAPI DeleteObject_fix( HGDIOBJ hObject )
|
||||
DeleteUSPFontCache_fn DeleteUSPFontCache = (DeleteUSPFontCache_fn) kexPsGetValue(script_cache_psidx);
|
||||
if (!DeleteUSPFontCache)
|
||||
{
|
||||
DeleteUSPFontCache = (DeleteUSPFontCache_fn)GetProcAddress(LoadLibrary("KEXBASEN.DLL"), "DeleteUSPFontCache");
|
||||
DeleteUSPFontCache = (DeleteUSPFontCache_fn)kexGetProcAddress(LoadLibrary("KEXBASEN.DLL"), "DeleteUSPFontCache");
|
||||
kexPsSetValue(script_cache_psidx, DeleteUSPFontCache);
|
||||
}
|
||||
if (DeleteUSPFontCache)
|
||||
@ -206,7 +202,6 @@ BOOL WINAPI DeleteObject_fix( HGDIOBJ hObject )
|
||||
/* MAKE_EXPORT SelectObject_fix=SelectObject */
|
||||
HGDIOBJ WINAPI SelectObject_fix( HDC hdc, HGDIOBJ hgdiobj )
|
||||
{
|
||||
if (blockkexgdiobj) return SelectObject(hdc,hgdiobj);
|
||||
//9x should do this
|
||||
if ( !hdc ) SetLastError(ERROR_INVALID_HANDLE);
|
||||
if ( !hdc || !hgdiobj ) return NULL;
|
||||
@ -233,7 +228,6 @@ HGDIOBJ WINAPI SelectObject_fix( HDC hdc, HGDIOBJ hgdiobj )
|
||||
/* MAKE_EXPORT DeleteDC_fix=DeleteDC */
|
||||
BOOL WINAPI DeleteDC_fix( HDC hdc )
|
||||
{
|
||||
if (blockkexgdiobj) return DeleteDC(hdc);
|
||||
BOOL ret;
|
||||
PGDIOBJ16 obj = GetGDIObjectPtr( hdc );
|
||||
if ( !obj || !SwitchGDIObjectType(obj) ) return FALSE;
|
||||
|
@ -128,7 +128,7 @@ BOOL WINAPI PostQueuedCompletionStatus_new(
|
||||
{
|
||||
PCOMPLET_PORT port = (PCOMPLET_PORT)MapViewOfFile(CompletionPort,FILE_MAP_ALL_ACCESS,0,0,0);
|
||||
//kexDebugPrint("PostQueuedCompletionStatus queued from port %p: %p %p %p",port,dwNumberOfBytesTransferred,dwCompletionKey,lpOverlapped);
|
||||
if (!port || port->signature != PORT_SIGNATURE || !lpOverlapped)
|
||||
if (!port || port->signature != PORT_SIGNATURE)
|
||||
{
|
||||
UnmapViewOfFile(port);
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
|
34
apilibs/kexbases/Kernel32/CreateFiberEx.c
Executable file
34
apilibs/kexbases/Kernel32/CreateFiberEx.c
Executable file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2010, Tihiy
|
||||
*
|
||||
* 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 CreateFiberEx_new=CreateFiberEx */
|
||||
LPVOID WINAPI CreateFiberEx_new(
|
||||
SIZE_T dwStackCommitSize,
|
||||
SIZE_T dwStackReserveSize,
|
||||
DWORD dwFlags,
|
||||
LPFIBER_START_ROUTINE lpStartAddress,
|
||||
LPVOID lpParameter
|
||||
)
|
||||
{
|
||||
return CreateFiber( dwStackCommitSize ? dwStackCommitSize : dwStackReserveSize, lpStartAddress, lpParameter );
|
||||
}
|
46
apilibs/kexbases/Kernel32/GetProcessId.c
Executable file
46
apilibs/kexbases/Kernel32/GetProcessId.c
Executable file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2010, Tihiy
|
||||
*
|
||||
* 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>
|
||||
#include "common.h"
|
||||
|
||||
/* MAKE_EXPORT GetProcessId_new=GetProcessId */
|
||||
DWORD WINAPI GetProcessId_new(
|
||||
HANDLE hProcess
|
||||
)
|
||||
{
|
||||
typedef DWORD (WINAPI *MPH) (HANDLE hProcess);
|
||||
static MPH MapProcessHandle = 0;
|
||||
|
||||
if (!MapProcessHandle)
|
||||
{
|
||||
DWORD *faddr;
|
||||
DWORD addr;
|
||||
|
||||
faddr = (DWORD *) ( (DWORD)SetFilePointer + 0x1D ); //there is jmp _SetFilePointer
|
||||
addr = (DWORD) faddr + *faddr + 4 - 0x16; //0x16 bytes before _SetFilePointer there is MapProcessHandle, just what we need
|
||||
faddr = (DWORD *) addr;
|
||||
if (*faddr != 0x206A006A)
|
||||
fatal_error("GetProcessId: ASSERTION FAILED"); //push 0; push 0x20
|
||||
MapProcessHandle = (MPH) addr;
|
||||
}
|
||||
return MapProcessHandle(hProcess);
|
||||
}
|
@ -55,6 +55,7 @@ static const apilib_named_api kernel32_named_apis[] =
|
||||
DECL_API("CopyFileW", CopyFileW_new),
|
||||
DECL_API("CreateDirectoryExW", CreateDirectoryExW_new),
|
||||
DECL_API("CreateDirectoryW", CreateDirectoryW_new),
|
||||
DECL_API("CreateFiberEx", CreateFiberEx_new),
|
||||
DECL_API("CreateFileA", CreateFileA_fix),
|
||||
DECL_API("CreateFileW", CreateFileW_new),
|
||||
DECL_API("CreateHardLinkA", CreateHardLinkA_stub),
|
||||
@ -63,9 +64,13 @@ static const apilib_named_api kernel32_named_apis[] =
|
||||
DECL_API("CreateJobObjectA", CreateJobObjectA_new),
|
||||
DECL_API("CreateJobObjectW", CreateJobObjectW_new),
|
||||
DECL_API("CreateThread", CreateThread_fix),
|
||||
DECL_API("DecodePointer", XorPointer),
|
||||
DECL_API("DecodeSystemPointer", XorPointer),
|
||||
DECL_API("DefineDosDeviceW", DefineDosDeviceW_new),
|
||||
DECL_API("DeleteCriticalSection", DeleteCriticalSection_new),
|
||||
DECL_API("DeleteFileW", DeleteFileW_new),
|
||||
DECL_API("EncodePointer", XorPointer),
|
||||
DECL_API("EncodeSystemPointer", XorPointer),
|
||||
DECL_API("EnumUILanguagesA", EnumUILanguagesA_new),
|
||||
DECL_API("EnumUILanguagesW", EnumUILanguagesW_new),
|
||||
DECL_API("FindAtomW", FindAtomW_new),
|
||||
@ -99,6 +104,7 @@ static const apilib_named_api kernel32_named_apis[] =
|
||||
DECL_API("GetModuleHandleExW", GetModuleHandleExW_new),
|
||||
DECL_API("GetModuleHandleW", GetModuleHandleW_new),
|
||||
DECL_API("GetNativeSystemInfo", GetSystemInfo),
|
||||
DECL_API("GetProcessId", GetProcessId_new),
|
||||
DECL_API("GetProcessIoCounters", GetProcessIoCounters_stub),
|
||||
DECL_API("GetQueuedCompletionStatus", GetQueuedCompletionStatus_new),
|
||||
DECL_API("GetShortPathNameW", GetShortPathNameW_new),
|
||||
@ -182,6 +188,7 @@ static const apilib_named_api kernel32_named_apis[] =
|
||||
DECL_API("Process32NextW", Process32NextW_new),
|
||||
DECL_API("ProcessIdToSessionId", ProcessIdToSessionId_new),
|
||||
DECL_API("QueryInformationJobObject", QueryInformationJobObject_new),
|
||||
DECL_API("ReadConsoleInputW", ReadConsoleInputW_new),
|
||||
DECL_API("ReadFile", ReadFile_fix),
|
||||
DECL_API("RemoveDirectoryW", RemoveDirectoryW_new),
|
||||
DECL_API("ReplaceFileA", ReplaceFileA_stub),
|
||||
@ -195,8 +202,10 @@ static const apilib_named_api kernel32_named_apis[] =
|
||||
DECL_API("SetFileAttributesW", SetFileAttributesW_new),
|
||||
DECL_API("SetFilePointerEx", SetFilePointerEx_new),
|
||||
DECL_API("SetInformationJobObject", SetInformationJobObject_new),
|
||||
DECL_API("SystemTimeToTzSpecificLocalTime", SystemTimeToTzSpecificLocalTime_new),
|
||||
DECL_API("TerminateJobObject", TerminateJobObject_new),
|
||||
DECL_API("TryEnterCriticalSection", TryEnterCriticalSection_new),
|
||||
DECL_API("TzSpecificLocalTimeToSystemTime", TzSpecificLocalTimeToSystemTime_new),
|
||||
DECL_API("VerLanguageNameW", VerLanguageNameW_new),
|
||||
DECL_API("VerSetConditionMask", VerSetConditionMask_new),
|
||||
DECL_API("VerifyVersionInfoA", VerifyVersionInfoA_NT2K),
|
||||
|
@ -33,6 +33,7 @@ HANDLE WINAPI CreateIoCompletionPort_new(HANDLE FileHandle, HANDLE ExistingCompl
|
||||
BOOL WINAPI GetQueuedCompletionStatus_new(HANDLE CompletionPort, LPDWORD lpNumberOfBytes, PULONG_PTR lpCompletionKey, LPOVERLAPPED *lpOverlapped, DWORD dwMilliseconds);
|
||||
BOOL WINAPI PostQueuedCompletionStatus_new(HANDLE CompletionPort, DWORD dwNumberOfBytesTransferred, ULONG_PTR dwCompletionKey, LPOVERLAPPED lpOverlapped);
|
||||
BOOL WINAPI CopyFileExA_new(LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags);
|
||||
LPVOID WINAPI CreateFiberEx_new(SIZE_T dwStackCommitSize, SIZE_T dwStackReserveSize, DWORD dwFlags, LPFIBER_START_ROUTINE lpStartAddress, LPVOID lpParameter);
|
||||
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);
|
||||
@ -45,6 +46,7 @@ HWND WINAPI GetConsoleWindow_new();
|
||||
BOOL WINAPI GetFileSizeEx_new(HANDLE hFile, PLARGE_INTEGER lpFileSize);
|
||||
BOOL WINAPI GetModuleHandleExA_new(DWORD dwFlags, LPCSTR lpModuleName, HMODULE* phModule);
|
||||
BOOL WINAPI GetModuleHandleExW_new(DWORD dwFlags, LPCWSTR lpModuleNameW, HMODULE* phModule);
|
||||
DWORD WINAPI GetProcessId_new(HANDLE hProcess);
|
||||
BOOL WINAPI GlobalMemoryStatusEx_new(LPMEMORYSTATUSEX lpmemex);
|
||||
BOOL WINAPI HeapLock_new(HANDLE hHeap);
|
||||
BOOL WINAPI HeapUnlock_new(HANDLE hHeap);
|
||||
@ -94,6 +96,9 @@ INT WINAPI FoldStringW_new(DWORD dwFlags, LPCWSTR src, INT srclen, LPWSTR dst, I
|
||||
INT WINAPI FoldStringA_new(DWORD dwFlags, LPCSTR src, INT srclen, LPSTR dst, INT dstlen);
|
||||
int WINAPI lstrcmpW_new(LPCWSTR str1, LPCWSTR str2);
|
||||
int WINAPI lstrcmpiW_new(LPCWSTR str1, LPCWSTR str2);
|
||||
PVOID WINAPI XorPointer(PVOID ptr);
|
||||
BOOL WINAPI SystemTimeToTzSpecificLocalTime_new(const TIME_ZONE_INFORMATION *lpTimeZoneInformation, const SYSTEMTIME *lpUniversalTime, LPSYSTEMTIME lpLocalTime);
|
||||
BOOL WINAPI TzSpecificLocalTimeToSystemTime_new(const TIME_ZONE_INFORMATION *lpTimeZoneInformation, const SYSTEMTIME *lpLocalTime, LPSYSTEMTIME lpUniversalTime);
|
||||
LANGID WINAPI GetUserDefaultUILanguage_new(void);
|
||||
LANGID WINAPI GetSystemDefaultUILanguage_new(void);
|
||||
BOOL WINAPI EnumUILanguagesA_new(UILANGUAGE_ENUMPROCA pUILangEnumProc, DWORD dwFlags, LONG_PTR lParam);
|
||||
@ -151,6 +156,7 @@ BOOL WINAPI SetCurrentDirectoryW_new(LPCWSTR lpPathNameW);
|
||||
BOOL WINAPI SetFileAttributesW_new(LPCWSTR lpFileNameW, DWORD dwFileAttributes);
|
||||
DWORD WINAPI VerLanguageNameW_new(DWORD wLang, LPWSTR szLangW, DWORD nSize);
|
||||
LPWSTR WINAPI lstrcpynW_new(LPWSTR dst, LPCWSTR src, INT n);
|
||||
BOOL WINAPI ReadConsoleInputW_new(HANDLE hConsoleInput, PINPUT_RECORD lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsRead);
|
||||
ULONGLONG WINAPI VerSetConditionMask_new(ULONGLONG dwlConditionMask, DWORD dwTypeBitMask, BYTE dwConditionMask);
|
||||
DWORD WINAPI GetVersion_WIN95(void);
|
||||
DWORD WINAPI GetVersion_WIN98(void);
|
||||
|
@ -21,7 +21,7 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include "common.h"
|
||||
#include "locale_unicode.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
@ -140,7 +140,7 @@ BOOL WINAPI GetStringTypeW_new( DWORD type, LPCWSTR src, INT count, LPWORD chart
|
||||
return FALSE;
|
||||
}
|
||||
GetStringType3ExW = (BOOL (WINAPI*)(LPCWSTR, INT, LPWORD))
|
||||
GetProcAddress(hShlwapi, (LPSTR) 35);
|
||||
kexGetProcAddress(hShlwapi, (LPSTR) 35);
|
||||
return GetStringType3ExW(src, count, chartype);
|
||||
#endif
|
||||
}
|
||||
|
51
apilibs/kexbases/Kernel32/pointer.c
Executable file
51
apilibs/kexbases/Kernel32/pointer.c
Executable file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2010, Xeno86, Tihiy
|
||||
*
|
||||
* 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 "common.h"
|
||||
|
||||
BOOL WINAPI SystemFunction036_new(PVOID pbBuffer, ULONG dwLen);
|
||||
|
||||
static LONG get_pointer_obfuscator(void)
|
||||
{
|
||||
static LONG obfuscator;
|
||||
|
||||
if (obfuscator == 0)
|
||||
{
|
||||
LONG rand;
|
||||
SystemFunction036_new(&rand, sizeof(rand));
|
||||
rand |= 0xc0000000;
|
||||
InterlockedCompareExchange(&obfuscator, rand, 0);
|
||||
}
|
||||
|
||||
return obfuscator;
|
||||
}
|
||||
|
||||
/* FIXME: EncodePointer/DecodePointer should use per-process obfuscator */
|
||||
|
||||
/* MAKE_EXPORT XorPointer=EncodePointer */
|
||||
/* MAKE_EXPORT XorPointer=DecodePointer */
|
||||
/* MAKE_EXPORT XorPointer=EncodeSystemPointer */
|
||||
/* MAKE_EXPORT XorPointer=DecodeSystemPointer */
|
||||
PVOID WINAPI XorPointer(PVOID ptr)
|
||||
{
|
||||
LONG ptrval = (LONG) ptr;
|
||||
return (PVOID)(ptrval ^ get_pointer_obfuscator());
|
||||
}
|
314
apilibs/kexbases/Kernel32/time.c
Executable file
314
apilibs/kexbases/Kernel32/time.c
Executable file
@ -0,0 +1,314 @@
|
||||
/*
|
||||
* KernelEx
|
||||
*
|
||||
* Copyright (C) 2010, Xeno86
|
||||
* Copyright (C) 1995, Martin von Loewis, Cameron Heide (Wine project)
|
||||
*
|
||||
* 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 "common.h"
|
||||
|
||||
#define LL2FILETIME( ll, pft )\
|
||||
(pft)->dwLowDateTime = (UINT)(ll); \
|
||||
(pft)->dwHighDateTime = (UINT)((ll) >> 32);
|
||||
#define FILETIME2LL( pft, ll) \
|
||||
ll = (((LONGLONG)((pft)->dwHighDateTime))<<32) + (pft)-> dwLowDateTime ;
|
||||
|
||||
|
||||
static const int MonthLengths[2][12] =
|
||||
{
|
||||
{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
|
||||
{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
|
||||
};
|
||||
|
||||
static inline int IsLeapYear(int Year)
|
||||
{
|
||||
return Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* TIME_DayLightCompareDate
|
||||
*
|
||||
* Compares two dates without looking at the year.
|
||||
*
|
||||
* PARAMS
|
||||
* date [in] The local time to compare.
|
||||
* compareDate [in] The daylight savings begin or end date.
|
||||
*
|
||||
* RETURNS
|
||||
*
|
||||
* -1 if date < compareDate
|
||||
* 0 if date == compareDate
|
||||
* 1 if date > compareDate
|
||||
* -2 if an error occurs
|
||||
*/
|
||||
static int TIME_DayLightCompareDate( const SYSTEMTIME *date,
|
||||
const SYSTEMTIME *compareDate )
|
||||
{
|
||||
int limit_day, dayinsecs;
|
||||
|
||||
if (date->wMonth < compareDate->wMonth)
|
||||
return -1; /* We are in a month before the date limit. */
|
||||
|
||||
if (date->wMonth > compareDate->wMonth)
|
||||
return 1; /* We are in a month after the date limit. */
|
||||
|
||||
/* if year is 0 then date is in day-of-week format, otherwise
|
||||
* it's absolute date.
|
||||
*/
|
||||
if (compareDate->wYear == 0)
|
||||
{
|
||||
WORD First;
|
||||
/* compareDate->wDay is interpreted as number of the week in the month
|
||||
* 5 means: the last week in the month */
|
||||
int weekofmonth = compareDate->wDay;
|
||||
/* calculate the day of the first DayOfWeek in the month */
|
||||
First = ( 6 + compareDate->wDayOfWeek - date->wDayOfWeek + date->wDay
|
||||
) % 7 + 1;
|
||||
limit_day = First + 7 * (weekofmonth - 1);
|
||||
/* check needed for the 5th weekday of the month */
|
||||
if(limit_day > MonthLengths[date->wMonth==2 && IsLeapYear(date->wYear)]
|
||||
[date->wMonth - 1])
|
||||
limit_day -= 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
limit_day = compareDate->wDay;
|
||||
}
|
||||
|
||||
/* convert to seconds */
|
||||
limit_day = ((limit_day * 24 + compareDate->wHour) * 60 +
|
||||
compareDate->wMinute ) * 60;
|
||||
dayinsecs = ((date->wDay * 24 + date->wHour) * 60 +
|
||||
date->wMinute ) * 60 + date->wSecond;
|
||||
/* and compare */
|
||||
return dayinsecs < limit_day ? -1 :
|
||||
dayinsecs > limit_day ? 1 :
|
||||
0; /* date is equal to the date limit. */
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* TIME_CompTimeZoneID
|
||||
*
|
||||
* Computes the local time bias for a given time and time zone.
|
||||
*
|
||||
* PARAMS
|
||||
* pTZinfo [in] The time zone data.
|
||||
* lpFileTime [in] The system or local time.
|
||||
* islocal [in] it is local time.
|
||||
*
|
||||
* RETURNS
|
||||
* TIME_ZONE_ID_INVALID An error occurred
|
||||
* TIME_ZONE_ID_UNKNOWN There are no transition time known
|
||||
* TIME_ZONE_ID_STANDARD Current time is standard time
|
||||
* TIME_ZONE_ID_DAYLIGHT Current time is daylight savings time
|
||||
*/
|
||||
static DWORD TIME_CompTimeZoneID ( const TIME_ZONE_INFORMATION *pTZinfo,
|
||||
FILETIME *lpFileTime, BOOL islocal )
|
||||
{
|
||||
int ret;
|
||||
BOOL beforeStandardDate, afterDaylightDate;
|
||||
DWORD retval = TIME_ZONE_ID_INVALID;
|
||||
LONGLONG llTime = 0; /* initialized to prevent gcc complaining */
|
||||
SYSTEMTIME SysTime;
|
||||
FILETIME ftTemp;
|
||||
|
||||
if (pTZinfo->DaylightDate.wMonth != 0)
|
||||
{
|
||||
/* if year is 0 then date is in day-of-week format, otherwise
|
||||
* it's absolute date.
|
||||
*/
|
||||
if (pTZinfo->StandardDate.wMonth == 0 ||
|
||||
(pTZinfo->StandardDate.wYear == 0 &&
|
||||
(pTZinfo->StandardDate.wDay<1 ||
|
||||
pTZinfo->StandardDate.wDay>5 ||
|
||||
pTZinfo->DaylightDate.wDay<1 ||
|
||||
pTZinfo->DaylightDate.wDay>5)))
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return TIME_ZONE_ID_INVALID;
|
||||
}
|
||||
|
||||
if (!islocal) {
|
||||
FILETIME2LL( lpFileTime, llTime );
|
||||
llTime -= ( pTZinfo->Bias + pTZinfo->DaylightBias )
|
||||
* (LONGLONG)600000000;
|
||||
LL2FILETIME( llTime, &ftTemp)
|
||||
lpFileTime = &ftTemp;
|
||||
}
|
||||
|
||||
FileTimeToSystemTime(lpFileTime, &SysTime);
|
||||
|
||||
/* check for daylight savings */
|
||||
ret = TIME_DayLightCompareDate( &SysTime, &pTZinfo->StandardDate);
|
||||
if (ret == -2)
|
||||
return TIME_ZONE_ID_INVALID;
|
||||
|
||||
beforeStandardDate = ret < 0;
|
||||
|
||||
if (!islocal) {
|
||||
llTime -= ( pTZinfo->StandardBias - pTZinfo->DaylightBias )
|
||||
* (LONGLONG)600000000;
|
||||
LL2FILETIME( llTime, &ftTemp)
|
||||
FileTimeToSystemTime(lpFileTime, &SysTime);
|
||||
}
|
||||
|
||||
ret = TIME_DayLightCompareDate( &SysTime, &pTZinfo->DaylightDate);
|
||||
if (ret == -2)
|
||||
return TIME_ZONE_ID_INVALID;
|
||||
|
||||
afterDaylightDate = ret >= 0;
|
||||
|
||||
retval = TIME_ZONE_ID_STANDARD;
|
||||
if( pTZinfo->DaylightDate.wMonth < pTZinfo->StandardDate.wMonth ) {
|
||||
/* Northern hemisphere */
|
||||
if( beforeStandardDate && afterDaylightDate )
|
||||
retval = TIME_ZONE_ID_DAYLIGHT;
|
||||
} else /* Down south */
|
||||
if( beforeStandardDate || afterDaylightDate )
|
||||
retval = TIME_ZONE_ID_DAYLIGHT;
|
||||
} else
|
||||
/* No transition date */
|
||||
retval = TIME_ZONE_ID_UNKNOWN;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* TIME_GetTimezoneBias
|
||||
*
|
||||
* Calculates the local time bias for a given time zone.
|
||||
*
|
||||
* PARAMS
|
||||
* pTZinfo [in] The time zone data.
|
||||
* lpFileTime [in] The system or local time.
|
||||
* islocal [in] It is local time.
|
||||
* pBias [out] The calculated bias in minutes.
|
||||
*
|
||||
* RETURNS
|
||||
* TRUE when the time zone bias was calculated.
|
||||
*/
|
||||
static BOOL TIME_GetTimezoneBias( const TIME_ZONE_INFORMATION *pTZinfo,
|
||||
FILETIME *lpFileTime, BOOL islocal, LONG *pBias )
|
||||
{
|
||||
LONG bias = pTZinfo->Bias;
|
||||
DWORD tzid = TIME_CompTimeZoneID( pTZinfo, lpFileTime, islocal);
|
||||
|
||||
if( tzid == TIME_ZONE_ID_INVALID)
|
||||
return FALSE;
|
||||
if (tzid == TIME_ZONE_ID_DAYLIGHT)
|
||||
bias += pTZinfo->DaylightBias;
|
||||
else if (tzid == TIME_ZONE_ID_STANDARD)
|
||||
bias += pTZinfo->StandardBias;
|
||||
*pBias = bias;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* SystemTimeToTzSpecificLocalTime (KERNEL32.@)
|
||||
*
|
||||
* Convert a utc system time to a local time in a given time zone.
|
||||
*
|
||||
* PARAMS
|
||||
* lpTimeZoneInformation [in] The desired time zone.
|
||||
* lpUniversalTime [in] The utc time to base local time on.
|
||||
* lpLocalTime [out] The local time in the time zone.
|
||||
*
|
||||
* RETURNS
|
||||
* Success: TRUE. lpLocalTime contains the converted time
|
||||
* Failure: FALSE.
|
||||
*/
|
||||
|
||||
/* MAKE_EXPORT SystemTimeToTzSpecificLocalTime_new=SystemTimeToTzSpecificLocalTime */
|
||||
BOOL WINAPI SystemTimeToTzSpecificLocalTime_new(
|
||||
const TIME_ZONE_INFORMATION *lpTimeZoneInformation,
|
||||
const SYSTEMTIME *lpUniversalTime, LPSYSTEMTIME lpLocalTime )
|
||||
{
|
||||
FILETIME ft;
|
||||
LONG lBias;
|
||||
LONGLONG llTime;
|
||||
TIME_ZONE_INFORMATION tzinfo;
|
||||
|
||||
if (lpTimeZoneInformation != NULL)
|
||||
{
|
||||
tzinfo = *lpTimeZoneInformation;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetTimeZoneInformation(&tzinfo) == TIME_ZONE_ID_INVALID)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!SystemTimeToFileTime(lpUniversalTime, &ft))
|
||||
return FALSE;
|
||||
FILETIME2LL( &ft, llTime)
|
||||
if (!TIME_GetTimezoneBias(&tzinfo, &ft, FALSE, &lBias))
|
||||
return FALSE;
|
||||
/* convert minutes to 100-nanoseconds-ticks */
|
||||
llTime -= (LONGLONG)lBias * 600000000;
|
||||
LL2FILETIME( llTime, &ft)
|
||||
|
||||
return FileTimeToSystemTime(&ft, lpLocalTime);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* TzSpecificLocalTimeToSystemTime (KERNEL32.@)
|
||||
*
|
||||
* Converts a local time to a time in utc.
|
||||
*
|
||||
* PARAMS
|
||||
* lpTimeZoneInformation [in] The desired time zone.
|
||||
* lpLocalTime [in] The local time.
|
||||
* lpUniversalTime [out] The calculated utc time.
|
||||
*
|
||||
* RETURNS
|
||||
* Success: TRUE. lpUniversalTime contains the converted time.
|
||||
* Failure: FALSE.
|
||||
*/
|
||||
|
||||
/* MAKE_EXPORT TzSpecificLocalTimeToSystemTime_new=TzSpecificLocalTimeToSystemTime */
|
||||
BOOL WINAPI TzSpecificLocalTimeToSystemTime_new(
|
||||
const TIME_ZONE_INFORMATION *lpTimeZoneInformation,
|
||||
const SYSTEMTIME *lpLocalTime, LPSYSTEMTIME lpUniversalTime)
|
||||
{
|
||||
FILETIME ft;
|
||||
LONG lBias;
|
||||
LONGLONG t;
|
||||
TIME_ZONE_INFORMATION tzinfo;
|
||||
|
||||
if (lpTimeZoneInformation != NULL)
|
||||
{
|
||||
tzinfo = *lpTimeZoneInformation;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetTimeZoneInformation(&tzinfo) == TIME_ZONE_ID_INVALID)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!SystemTimeToFileTime(lpLocalTime, &ft))
|
||||
return FALSE;
|
||||
FILETIME2LL( &ft, t)
|
||||
if (!TIME_GetTimezoneBias(&tzinfo, &ft, TRUE, &lBias))
|
||||
return FALSE;
|
||||
/* convert minutes to 100-nanoseconds-ticks */
|
||||
t += (LONGLONG)lBias * 600000000;
|
||||
LL2FILETIME( t, &ft)
|
||||
return FileTimeToSystemTime(&ft, lpUniversalTime);
|
||||
}
|
@ -858,3 +858,27 @@ LPWSTR WINAPI lstrcpynW_new(LPWSTR dst, LPCWSTR src, INT n)
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//MAKE_EXPORT ReadConsoleInputW_new=ReadConsoleInputW
|
||||
BOOL WINAPI ReadConsoleInputW_new( HANDLE hConsoleInput, PINPUT_RECORD lpBuffer,
|
||||
DWORD nLength, LPDWORD lpNumberOfEventsRead)
|
||||
{
|
||||
BOOL ret = ReadConsoleInputA(hConsoleInput,lpBuffer,nLength,lpNumberOfEventsRead);
|
||||
if ( ret && lpBuffer && lpNumberOfEventsRead )
|
||||
{
|
||||
DWORD i;
|
||||
for (i=0;i<*lpNumberOfEventsRead;i++)
|
||||
{
|
||||
if (lpBuffer->EventType == KEY_EVENT)
|
||||
{
|
||||
WCHAR uniChar;
|
||||
if ( MultiByteToWideChar(CP_OEMCP,0,&lpBuffer->Event.KeyEvent.uChar.AsciiChar,1,&uniChar,1) )
|
||||
lpBuffer->Event.KeyEvent.uChar.UnicodeChar = uniChar;
|
||||
else //fallback
|
||||
lpBuffer->Event.KeyEvent.uChar.UnicodeChar = lpBuffer->Event.KeyEvent.uChar.AsciiChar;
|
||||
}
|
||||
lpBuffer++;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
106
apilibs/kexbases/User32/SetParent_fix.c
Executable file
106
apilibs/kexbases/User32/SetParent_fix.c
Executable file
@ -0,0 +1,106 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2010, Tihiy, 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>
|
||||
#include "k32ord.h"
|
||||
#include "hwnd9x.h"
|
||||
|
||||
static DWORD g_UserBase;
|
||||
static HTOP_API HWNDtoPWND;
|
||||
|
||||
//those are in thunilay
|
||||
void GrabWin16Lock();
|
||||
void ReleaseWin16Lock();
|
||||
|
||||
#define REBASEUSER(x) ((x) != 0 ? g_UserBase + (DWORD)(x) : 0)
|
||||
|
||||
BOOL SetParent_fix_init()
|
||||
{
|
||||
g_UserBase = MapSL(LoadLibrary16("user") << 16);
|
||||
/* IsWindow returns PWND */
|
||||
HWNDtoPWND = (HTOP_API)IsWindow;
|
||||
return (g_UserBase != 0 && HWNDtoPWND != 0);
|
||||
}
|
||||
|
||||
/* returns TRUE if hwnd is a parent of hwndNewParent */
|
||||
static BOOL WINAPI TestChild(HWND hwnd, HWND hwndNewParent)
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
PWND pwnd, pwndT;
|
||||
GrabWin16Lock();
|
||||
pwnd = HWNDtoPWND(hwnd);
|
||||
pwndT = HWNDtoPWND(hwndNewParent);
|
||||
if ( pwnd && pwndT )
|
||||
{
|
||||
for ( ; pwndT != NULL; pwndT = (PWND)REBASEUSER(pwndT->spwndParent))
|
||||
{
|
||||
if (pwnd == pwndT)
|
||||
{
|
||||
ret = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ReleaseWin16Lock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT SetParent_fix=SetParent */
|
||||
__declspec(naked)
|
||||
HWND WINAPI SetParent_fix(HWND hWndChild, HWND hWndNewParent)
|
||||
{
|
||||
__asm {
|
||||
|
||||
/* forbid changing parent of system windows */
|
||||
mov ecx, [esp+4] /* hWndChild */
|
||||
cmp ecx, 0x88
|
||||
ja __hwndok
|
||||
cmp ecx, 0x80
|
||||
jb __hwndok
|
||||
|
||||
/* hwnd is system one - disallow */
|
||||
push ERROR_ACCESS_DENIED
|
||||
jmp __error
|
||||
|
||||
__hwndok:
|
||||
/* test hwnds to avoid circular references */
|
||||
mov eax, [esp+8] /* hWndNewParent */
|
||||
push eax
|
||||
push ecx
|
||||
call TestChild
|
||||
test eax, eax
|
||||
jnz __childfail
|
||||
|
||||
/* return control to SetParent */
|
||||
jmp dword ptr [SetParent]
|
||||
|
||||
__childfail:
|
||||
/* circular reference detected - stop! */
|
||||
push ERROR_INVALID_PARAMETER
|
||||
|
||||
__error:
|
||||
/* return error */
|
||||
call dword ptr [SetLastError]
|
||||
xor eax, eax
|
||||
retn 8
|
||||
|
||||
}
|
||||
}
|
48
apilibs/kexbases/User32/SystemParametersInfo_fix.c
Executable file
48
apilibs/kexbases/User32/SystemParametersInfo_fix.c
Executable file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2010, Tihiy, 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 "common.h"
|
||||
|
||||
/* MAKE_EXPORT SystemParametersInfoA_fix=SystemParametersInfoA */
|
||||
BOOL WINAPI SystemParametersInfoA_fix(
|
||||
UINT uiAction,
|
||||
UINT uiParam,
|
||||
PVOID pvParam,
|
||||
UINT fWinIni
|
||||
)
|
||||
{
|
||||
BOOL ret;
|
||||
|
||||
if (uiAction == SPI_GETHIGHCONTRAST && uiParam == 0)
|
||||
{
|
||||
uiParam = sizeof(HIGHCONTRAST);
|
||||
}
|
||||
ret = SystemParametersInfoA(uiAction, uiParam, pvParam, fWinIni);
|
||||
if (!ret && uiAction == SPI_GETHIGHCONTRAST && pvParam)
|
||||
{
|
||||
LPHIGHCONTRAST hc = (LPHIGHCONTRAST) pvParam;
|
||||
hc->dwFlags = 0;
|
||||
hc->lpszDefaultScheme = NULL;
|
||||
ret = TRUE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
@ -27,15 +27,18 @@
|
||||
IsHungThread_t IsHungThread_pfn;
|
||||
DrawCaptionTempA_t DrawCaptionTempA_pfn;
|
||||
|
||||
BOOL SetParent_fix_init();
|
||||
|
||||
BOOL init_user32()
|
||||
{
|
||||
HMODULE hUser32 = GetModuleHandle("USER32.DLL");
|
||||
|
||||
IsHungThread_pfn = (IsHungThread_t)GetProcAddress(hUser32, "IsHungThread");
|
||||
DrawCaptionTempA_pfn = (DrawCaptionTempA_t)GetProcAddress(hUser32, "DrawCaptionTempA");
|
||||
GetMouseMovePoints_pfn = (GetMouseMovePoints_t)GetProcAddress(hUser32, "GetMouseMovePoints");
|
||||
IsHungThread_pfn = (IsHungThread_t)kexGetProcAddress(hUser32, "IsHungThread");
|
||||
DrawCaptionTempA_pfn = (DrawCaptionTempA_t)kexGetProcAddress(hUser32, "DrawCaptionTempA");
|
||||
GetMouseMovePoints_pfn = (GetMouseMovePoints_t)kexGetProcAddress(hUser32, "GetMouseMovePoints");
|
||||
|
||||
return IsHungThread_pfn && DrawCaptionTempA_pfn && GetMouseMovePoints_pfn && InitUniThunkLayer();
|
||||
return IsHungThread_pfn && DrawCaptionTempA_pfn && GetMouseMovePoints_pfn
|
||||
&& InitUniThunkLayer() && SetParent_fix_init();
|
||||
}
|
||||
|
||||
/* APIs which don't require Unicode implementations in thuni model
|
||||
@ -148,11 +151,13 @@ static const apilib_named_api user32_named_apis[] =
|
||||
DECL_API("SetClassLongW", SetClassLongW_NEW),
|
||||
DECL_API("SetDlgItemTextW", SetDlgItemTextW_NEW),
|
||||
DECL_API("SetLayeredWindowAttributes", SetLayeredWindowAttributes_stub),
|
||||
DECL_API("SetParent", SetParent_fix),
|
||||
DECL_API("SetWindowLongA", SetWindowLongA_NEW),
|
||||
DECL_API("SetWindowLongW", SetWindowLongW_NEW),
|
||||
DECL_API("SetWindowTextW", SetWindowTextW_NEW),
|
||||
DECL_API("SetWindowsHookExW", SetWindowsHookExA),
|
||||
DECL_API("SetWindowsHookW", SetWindowsHookA),
|
||||
DECL_API("SystemParametersInfoA", SystemParametersInfoA_fix),
|
||||
DECL_API("ToUnicode", ToUnicode_new),
|
||||
DECL_API("ToUnicodeEx", ToUnicodeEx_new),
|
||||
DECL_API("TranslateAcceleratorW", TranslateAcceleratorA),
|
||||
|
@ -58,6 +58,8 @@ BOOL WINAPI LockWorkStation_new(void);
|
||||
UINT WINAPI MapVirtualKeyA_new(UINT uCode, UINT uMapType);
|
||||
UINT WINAPI MapVirtualKeyExA_new(UINT uCode, UINT uMapType, HKL dwhkl);
|
||||
LRESULT WINAPI SendMessageA_fix(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||
HWND WINAPI SetParent_fix(HWND hWndChild, HWND hWndNewParent);
|
||||
BOOL WINAPI SystemParametersInfoA_fix(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni);
|
||||
BOOL WINAPI UpdateLayeredWindow_new(HWND hwnd, HDC hdcDst, POINT *pptDst, SIZE *psize, HDC hdcSrc, POINT *pptSrc, COLORREF crKey, BLENDFUNCTION *pblend, DWORD dwFlags);
|
||||
STUB SetLayeredWindowAttributes_stub;
|
||||
STUB DefRawInputProc_stub;
|
||||
|
@ -25,6 +25,8 @@
|
||||
#ifndef _HWND32_H
|
||||
#define _HWND32_H
|
||||
|
||||
#define IS_SYSTEM_HWND(hwnd) ((hwnd)>=(HWND)0x80 && (hwnd)<=(HWND)0x88)
|
||||
|
||||
#pragma pack (1)
|
||||
typedef struct _RECTS
|
||||
{
|
||||
@ -107,4 +109,6 @@ typedef struct _MSGQUEUE
|
||||
} MSGQUEUE, *PMSGQUEUE;
|
||||
#pragma pack()
|
||||
|
||||
typedef PWND (WINAPI *HTOP_API) (HWND hwnd);
|
||||
|
||||
#endif
|
||||
|
@ -20,7 +20,6 @@ static DWORD GetWindowProcessId( HWND hwnd )
|
||||
#define ISDIALOG(pwnd) (pwnd->moreFlags & WF_M_DIALOG)
|
||||
|
||||
typedef PMSGQUEUE (WINAPI *GCQ_API) ();
|
||||
typedef PWND (WINAPI *HTOP_API) (HWND hwnd);
|
||||
|
||||
#define RELTOABS(x) ( (DWORD)(x) + *(DWORD*)(x) + 4 )
|
||||
|
||||
|
46
apilibs/kexbases/comctl32/_comctl32_apilist.c
Executable file
46
apilibs/kexbases/comctl32/_comctl32_apilist.c
Executable file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2010, Xeno86, Tihiy
|
||||
*
|
||||
* 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 "common.h"
|
||||
#include "kexcoresdk.h"
|
||||
#include "_comctl32_apilist.h"
|
||||
|
||||
BOOL init_comctl32()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static const apilib_named_api comctl32_named_apis[] =
|
||||
{
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
|
||||
DECL_API("InitCommonControlsEx", InitCommonControlsEx_new),
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
|
||||
};
|
||||
|
||||
#if 0
|
||||
static const apilib_unnamed_api comctl32_ordinal_apis[] =
|
||||
{
|
||||
/*** AUTOGENERATED APILIST ORDINAL EXPORTS BEGIN ***/
|
||||
/*** AUTOGENERATED APILIST ORDINAL EXPORTS END ***/
|
||||
};
|
||||
#endif
|
||||
|
||||
const apilib_api_table apitable_comctl32 = DECL_TAB("COMCTL32.DLL", comctl32_named_apis, 0 /*comctl32_ordinal_apis*/);
|
35
apilibs/kexbases/comctl32/_comctl32_apilist.h
Executable file
35
apilibs/kexbases/comctl32/_comctl32_apilist.h
Executable file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2010, Xeno86, Tihiy
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _COMCTL32_APILIST_H
|
||||
#define _COMCTL32_APILIST_H
|
||||
|
||||
#include <commctrl.h>
|
||||
#include "kexcoresdk.h"
|
||||
|
||||
BOOL init_comctl32();
|
||||
extern const apilib_api_table apitable_comctl32;
|
||||
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
|
||||
BOOL WINAPI InitCommonControlsEx_new(LPINITCOMMONCONTROLSEX lpInitCtrls);
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
|
||||
|
||||
#endif
|
59
apilibs/kexbases/comctl32/newclassreg.c
Executable file
59
apilibs/kexbases/comctl32/newclassreg.c
Executable file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2010, Tihiy, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0600
|
||||
#undef _WIN32_WINNT
|
||||
#endif
|
||||
#define _WIN32_WINNT 0x0600
|
||||
|
||||
#include "common.h"
|
||||
#include <commctrl.h>
|
||||
|
||||
|
||||
typedef BOOL (WINAPI* ICCEX) (LPINITCOMMONCONTROLSEX);
|
||||
|
||||
VOID SYSLINK_Register(void);
|
||||
|
||||
/* MAKE_EXPORT InitCommonControlsEx_new=InitCommonControlsEx */
|
||||
BOOL WINAPI InitCommonControlsEx_new(LPINITCOMMONCONTROLSEX lpInitCtrls)
|
||||
{
|
||||
static ICCEX InitCommonControlsEx_dld;
|
||||
|
||||
//sanity check
|
||||
if (!lpInitCtrls || lpInitCtrls->dwSize != sizeof(INITCOMMONCONTROLSEX))
|
||||
return FALSE;
|
||||
|
||||
//register SysLink
|
||||
if (lpInitCtrls->dwICC & ICC_LINK_CLASS ||
|
||||
lpInitCtrls->dwICC == (ICC_WIN95_CLASSES|ICC_DATE_CLASSES|ICC_USEREX_CLASSES|ICC_COOL_CLASSES))
|
||||
{
|
||||
SYSLINK_Register();
|
||||
if (lpInitCtrls->dwICC == ICC_LINK_CLASS)
|
||||
return TRUE; //no other classes to register
|
||||
|
||||
//remove SysLink from list of classes to register - COMCTL32 will fail otherwise
|
||||
lpInitCtrls->dwICC &= ~ICC_LINK_CLASS;
|
||||
}
|
||||
if (!InitCommonControlsEx_dld)
|
||||
InitCommonControlsEx_dld = (ICCEX)kexGetProcAddress(GetModuleHandle("COMCTL32.DLL"),"InitCommonControlsEx");
|
||||
|
||||
return InitCommonControlsEx_dld(lpInitCtrls);
|
||||
}
|
1854
apilibs/kexbases/comctl32/syslink.c
Executable file
1854
apilibs/kexbases/comctl32/syslink.c
Executable file
File diff suppressed because it is too large
Load Diff
@ -19,7 +19,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <ole2.h>
|
||||
#include <commdlg.h>
|
||||
|
||||
/* MAKE_EXPORT PrintDlgEx_new=PrintDlgExA
|
||||
* MAKE_EXPORT PrintDlgEx_new=PrintDlgExW
|
||||
|
@ -23,6 +23,8 @@
|
||||
#define _COMDLG32_APILIST_H
|
||||
|
||||
#include "kexcoresdk.h"
|
||||
#include <ole2.h>
|
||||
#include <commdlg.h>
|
||||
|
||||
BOOL init_comdlg32();
|
||||
extern const apilib_api_table apitable_comdlg32;
|
||||
|
@ -50,3 +50,9 @@ char* file_fixWprefix(char* in)
|
||||
}
|
||||
return in;
|
||||
}
|
||||
|
||||
void fatal_error(const char* msg)
|
||||
{
|
||||
MessageBox(NULL, msg, "KernelEx error", MB_OK | MB_ICONERROR);
|
||||
ExitProcess(1);
|
||||
}
|
||||
|
@ -22,13 +22,17 @@
|
||||
#ifndef __COMMON_H
|
||||
#define __COMMON_H
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <malloc.h>
|
||||
#include "kexcoresdk.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void* __cdecl recalloc(void* ptr, size_t size);
|
||||
|
||||
typedef int __stdcall STUB(void);
|
||||
typedef int __stdcall FWDPROC(void);
|
||||
|
||||
@ -36,6 +40,7 @@ extern int acp_mcs;
|
||||
BOOL common_init(void);
|
||||
int WINAPI CommonUnimpStub(void);
|
||||
char* file_fixWprefix(char* in);
|
||||
void fatal_error(const char* msg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
|
@ -5,3 +5,4 @@ advapi32
|
||||
comdlg32
|
||||
shell32
|
||||
version
|
||||
comctl32
|
||||
|
@ -117,6 +117,10 @@ SOURCE=.\Kernel32\CopyFileEx.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\CreateFiberEx.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\CreateThread_fix.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -141,6 +145,10 @@ SOURCE=.\Kernel32\GetModuleHandleEx.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\GetProcessId.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\GlobalMemoryStatusEx.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -217,14 +225,26 @@ SOURCE=.\Kernel32\OpenThread.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\pointer.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\RemoteDesktop.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\RtlCaptureContext.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\SetFilePointerEx.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\time.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\TryEnterCriticalSection.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -317,6 +337,14 @@ SOURCE=.\User32\SendMessage_fix.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\User32\SetParent_fix.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\User32\SystemParametersInfo_fix.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\User32\thuni_conv.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -492,6 +520,26 @@ SOURCE=.\shell32\CommandLineToArgvW.c
|
||||
SOURCE=.\shell32\IsUserAnAdmin.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "comctl32"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\comctl32\_comctl32_apilist.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\comctl32\_comctl32_apilist.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\comctl32\newclassreg.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\comctl32\syslink.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\common.c
|
||||
@ -582,10 +630,6 @@ InputPath=.\kexbases.def
|
||||
|
||||
SOURCE=.\main.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\RtlCaptureContext.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
|
@ -28,10 +28,11 @@
|
||||
#include "comdlg32/_comdlg32_apilist.h"
|
||||
#include "shell32/_shell32_apilist.h"
|
||||
#include "version/_version_apilist.h"
|
||||
#include "comctl32/_comctl32_apilist.h"
|
||||
//#include "/__apilist.h"
|
||||
|
||||
static LONG inited = 0;
|
||||
static apilib_api_table api_table[8];
|
||||
static apilib_api_table api_table[9];
|
||||
|
||||
static void fill_apitable()
|
||||
{
|
||||
@ -42,6 +43,7 @@ static void fill_apitable()
|
||||
api_table[4] = apitable_comdlg32;
|
||||
api_table[5] = apitable_shell32;
|
||||
api_table[6] = apitable_version;
|
||||
api_table[7] = apitable_comctl32;
|
||||
//last entry is null terminator
|
||||
}
|
||||
|
||||
@ -55,7 +57,7 @@ const apilib_api_table* get_api_table()
|
||||
|
||||
BOOL init_once()
|
||||
{
|
||||
return common_init() && init_kernel32() && init_gdi32() && init_user32() && init_advapi32() && init_comdlg32() && init_shell32() && init_version();
|
||||
return common_init() && init_kernel32() && init_gdi32() && init_user32() && init_advapi32() && init_comdlg32() && init_shell32() && init_version() && init_comctl32();
|
||||
}
|
||||
|
||||
BOOL APIENTRY DllMain(HINSTANCE instance, DWORD reason, BOOL load_static)
|
||||
|
Reference in New Issue
Block a user