mirror of
https://github.com/UzixLS/KernelEx.git
synced 2025-07-18 23:11:19 +03:00
import KernelEx-4.5-RC4
This commit is contained in:
@ -1,3 +1,37 @@
|
||||
KernelEx v4.5 RC 4 by Xeno86
|
||||
2010-09-21
|
||||
|
||||
added kernel32.EncodePointer, DecodePointer, EncodeSystemPointer, DecodeSystemPointer
|
||||
SystemParametersInfo/SPI_GETHIGHCONTRAST call doesn't fail now when accessability pack is not installed or wrong uiParam parameter is passed (fixes Firefox 3.6.9/3.6.10)
|
||||
force usage of KernelEx's 'Known DLLs' when full system path is passed to LoadLibrary call
|
||||
fixed iGetProcAddress/kexGetProcAddress not taking into account relocation - fixes crashes revealed by RC 3
|
||||
|
||||
---------------------------------------
|
||||
|
||||
KernelEx v4.5 RC 3 by Xeno86
|
||||
2010-09-10
|
||||
|
||||
added fix to prevent DLL circular-references
|
||||
|
||||
---------------------------------------
|
||||
|
||||
KernelEx v4.5 RC 2 by Xeno86
|
||||
2010-09-08
|
||||
|
||||
ported SysLink COMCTL32 class (from Wine project, fixes Google Picasa options dialog)
|
||||
added kernel32.SystemTimeToTzSpecificLocalTime, TzSpecificLocalTimeToSystemTime (from Wine project, for Google Picasa 3.8)
|
||||
implemented shell32.SHBindToParent (needed by Maxthon 1.6.7) [Tihiy]
|
||||
fixed TlsExt pointer not zeroed after freeing
|
||||
added WS2_32.getaddrinfo, freeaddrinfo, getnameinfo implementation based on wspiapi.h
|
||||
added WINMM.waveInGetDevCapsW, waveOutGetDevCapsW (makes Flash Player 10.1 volume control work)
|
||||
added USER32.SetParent fix to forbid deadly circular references (fixes VLC 1.1.2 crash) [ported from RP9]
|
||||
fixed handling of lpOverlapped parameter in kernel32.PostQueuedCompletionStatus
|
||||
restricted completion ports to NT only
|
||||
added kernel32.GetProcessId, CreateFiberEx
|
||||
replaced kernel32.ReadConsoleInputW from MSLU with custom implementation due to bugs in the former [Tihiy]
|
||||
|
||||
---------------------------------------
|
||||
|
||||
KernelEx v4.5 RC 1 by Xeno86
|
||||
2010-07-30
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
!define _VERSION '4.5 RC 1'
|
||||
!define _VERSION '4.5 RC 4'
|
||||
|
||||
!ifndef _DEBUG
|
||||
!define FLAVOUR 'Release'
|
||||
|
40
NEWS.txt
40
NEWS.txt
@ -1,3 +1,41 @@
|
||||
KernelEx v4.5 RC 4 by Xeno86
|
||||
2010-09-21
|
||||
|
||||
What's new:
|
||||
-----------
|
||||
* Fixed: missing background colors and images in Mozilla Firefox 3.6.9/3.6.10
|
||||
* Fixed: MSIMG32 warning and menu icon transparency issues in Opera 10.62
|
||||
* Fixed: crashes introduced in RC 3
|
||||
* KernelEx auxiliary libraries weren't loaded when full path to system file was passed in call to LoadLibary
|
||||
|
||||
#################################################
|
||||
|
||||
KernelEx v4.5 RC 3 by Xeno86
|
||||
2010-09-10
|
||||
|
||||
hotfix to prevent DLL circular-references causing crashes on certain configurations
|
||||
|
||||
#################################################
|
||||
|
||||
KernelEx v4.5 RC 2 by Xeno86
|
||||
2010-09-08
|
||||
|
||||
What's new:
|
||||
-----------
|
||||
* Implemented SysLink common control class
|
||||
|
||||
Apps fixed / now working:
|
||||
-------------------------
|
||||
* Fixed: Google Picasa options dialog (empty tabs)
|
||||
* Fixed: Adobe Flash Player crashes (reported by mailcat via sf.net forum)
|
||||
* Fixed: Adobe Flash Player 10.1 volume control
|
||||
* Fixed: Wizard101 game crash (bug #3041092)
|
||||
* Fixed: Maxthon browser (freezing)
|
||||
* Now working: Maxthon 1.6.7
|
||||
* Now working: VLC 1.1.2 (without RP9)
|
||||
|
||||
#################################################
|
||||
|
||||
KernelEx v4.5 RC 1 by Xeno86
|
||||
2010-07-30
|
||||
|
||||
@ -18,7 +56,7 @@ Apps fixed / now working:
|
||||
* Fixed: VLC 1.0+ (UI)
|
||||
* Fixed: Firefox 3.6.4+ (high cpu usage)
|
||||
* Now working: Adobe Flash 10.1 plugin
|
||||
* Now working: Mozilla Firefox 4.0 Beta 1
|
||||
* Now working: Mozilla Firefox 4.0 Beta 2
|
||||
* Now working: Artweaver 1.0
|
||||
* Now working: MPC-HC (newer builds, svn build 1391+)
|
||||
|
||||
|
@ -28,6 +28,7 @@ GDI32.SetMapMode=std
|
||||
KERNEL32.VerSetConditionMask=none
|
||||
KERNEL32.VerifyVersionInfoA=none
|
||||
KERNEL32.VerifyVersionInfoW=none
|
||||
KERNEL32.CreateIoCompletionPort=std
|
||||
SHELL32.SHParseDisplayName=none
|
||||
|
||||
[DCFG1.names.Me]
|
||||
@ -42,6 +43,7 @@ GDI32.SetMapMode=std
|
||||
KERNEL32.VerSetConditionMask=none
|
||||
KERNEL32.VerifyVersionInfoA=none
|
||||
KERNEL32.VerifyVersionInfoW=none
|
||||
KERNEL32.CreateIoCompletionPort=std
|
||||
USER32.AllowSetForegroundWindow=std
|
||||
USER32.LockSetForegroundWindow=std
|
||||
USER32.GetMouseMovePointsEx=std
|
||||
@ -82,6 +84,7 @@ desc=Windows NT 4.0 SP6
|
||||
KERNEL32.GetVersion=kexbases.3
|
||||
KERNEL32.GetVersionExA=kexbases.4
|
||||
KERNEL32.GetVersionExW=kexbases.4
|
||||
KERNEL32.CreateIoCompletionPort=kexbases.0
|
||||
GDI32.GetRandomRgn=kexbases.0
|
||||
GDI32.SetGraphicsMode=kexbases.0
|
||||
GDI32.GetTextMetricsA=kexbases.0
|
||||
|
@ -23,6 +23,7 @@
|
||||
#define _COMDLG32_APILIST_H
|
||||
|
||||
#include "kexcoresdk.h"
|
||||
#include <commdlg.h>
|
||||
|
||||
BOOL init_comdlg32();
|
||||
extern const apilib_api_table apitable_comdlg32;
|
||||
|
@ -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);
|
||||
|
||||
|
@ -7,3 +7,5 @@ shell32
|
||||
rpcrt4
|
||||
winspool
|
||||
shfolder
|
||||
winmm
|
||||
ws2_32
|
||||
|
@ -19,7 +19,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include "common.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -52,7 +52,7 @@ FARPROC WINAPI DelayLoadFailureHook_new(
|
||||
hShlwapi = LoadLibrary("shlwapi.dll");
|
||||
}
|
||||
|
||||
DLFH ShlwapiDelayLoad = (DLFH) GetProcAddress(hShlwapi,"DelayLoadFailureHook");
|
||||
DLFH ShlwapiDelayLoad = (DLFH) kexGetProcAddress(hShlwapi,"DelayLoadFailureHook");
|
||||
if (!ShlwapiDelayLoad)
|
||||
return NULL;
|
||||
|
||||
|
@ -127,7 +127,10 @@ void detach_exttls(void)
|
||||
|
||||
ext = (LPVOID*) tdb->TlsSlots[TLS_SIZE-1];
|
||||
if (ext)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, ext);
|
||||
tdb->TlsSlots[TLS_SIZE-1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT TlsAlloc_new=TlsAlloc */
|
||||
|
@ -112,7 +112,6 @@ static const apilib_named_api kernel32_named_apis[] =
|
||||
DECL_API("PeekConsoleInputW", PeekConsoleInputW_fwd),
|
||||
DECL_API("QueryDosDeviceW", QueryDosDeviceW_fwd),
|
||||
DECL_API("QueueUserWorkItem", QueueUserWorkItem_new),
|
||||
DECL_API("ReadConsoleInputW", ReadConsoleInputW_fwd),
|
||||
DECL_API("ReadConsoleOutputCharacterW", ReadConsoleOutputCharacterW_fwd),
|
||||
DECL_API("ReadConsoleOutputW", ReadConsoleOutputW_fwd),
|
||||
DECL_API("ReadConsoleW", ReadConsoleW_fwd),
|
||||
|
@ -108,7 +108,6 @@ FWDPROC OpenSemaphoreW_fwd;
|
||||
FWDPROC OpenWaitableTimerW_fwd;
|
||||
FWDPROC PeekConsoleInputW_fwd;
|
||||
FWDPROC QueryDosDeviceW_fwd;
|
||||
FWDPROC ReadConsoleInputW_fwd;
|
||||
FWDPROC ReadConsoleOutputCharacterW_fwd;
|
||||
FWDPROC ReadConsoleOutputW_fwd;
|
||||
FWDPROC ReadConsoleW_fwd;
|
||||
|
@ -73,7 +73,6 @@ FORWARD_TO_UNICOWS(OpenSemaphoreW);
|
||||
FORWARD_TO_UNICOWS(OpenWaitableTimerW);
|
||||
FORWARD_TO_UNICOWS(PeekConsoleInputW);
|
||||
FORWARD_TO_UNICOWS(QueryDosDeviceW);
|
||||
FORWARD_TO_UNICOWS(ReadConsoleInputW);
|
||||
FORWARD_TO_UNICOWS(ReadConsoleOutputCharacterW);
|
||||
FORWARD_TO_UNICOWS(ReadConsoleOutputW);
|
||||
FORWARD_TO_UNICOWS(ReadConsoleW);
|
||||
|
@ -53,7 +53,7 @@ BSC32=bscmake.exe
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shlwapi.lib shell32.lib rpcrt4.lib usp10.lib ../../common/KernelEx.lib ../../kexcrt/kexcrt.lib libc.lib delayimp.lib /nologo /dll /map /machine:I386 /nodefaultlib /OPT:NOWIN98 /DELAYLOAD:shell32.dll /DELAYLOAD:rpcrt4.dll /DELAYLOAD:usp10.dll /DELAYLOAD:comdlg32.dll /DELAYLOAD:winspool.drv /DELAYLOAD:shlwapi.dll
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shlwapi.lib shell32.lib rpcrt4.lib usp10.lib winmm.lib ws2_32.lib ../../common/KernelEx.lib ../../kexcrt/kexcrt.lib libc.lib delayimp.lib /nologo /dll /map /machine:I386 /nodefaultlib /OPT:NOWIN98 /DELAYLOAD:shell32.dll /DELAYLOAD:rpcrt4.dll /DELAYLOAD:usp10.dll /DELAYLOAD:comdlg32.dll /DELAYLOAD:winspool.drv /DELAYLOAD:shlwapi.dll /DELAYLOAD:winmm.dll /DELAYLOAD:ws2_32.dll
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "KernelEx Base NonShared - Win32 Debug"
|
||||
@ -80,7 +80,7 @@ BSC32=bscmake.exe
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shlwapi.lib shell32.lib rpcrt4.lib usp10.lib ../../common/KernelEx.lib ../../kexcrt/kexcrt.lib libc.lib delayimp.lib /nologo /dll /map /debug /machine:I386 /nodefaultlib /OPT:NOWIN98 /DELAYLOAD:shell32.dll /DELAYLOAD:rpcrt4.dll /DELAYLOAD:usp10.dll /DELAYLOAD:comdlg32.dll /DELAYLOAD:winspool.drv /DELAYLOAD:shlwapi.dll
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shlwapi.lib shell32.lib rpcrt4.lib usp10.lib winmm.lib ws2_32.lib ../../common/KernelEx.lib ../../kexcrt/kexcrt.lib libc.lib delayimp.lib /nologo /dll /map /debug /machine:I386 /nodefaultlib /OPT:NOWIN98 /DELAYLOAD:shell32.dll /DELAYLOAD:rpcrt4.dll /DELAYLOAD:usp10.dll /DELAYLOAD:comdlg32.dll /DELAYLOAD:winspool.drv /DELAYLOAD:shlwapi.dll /DELAYLOAD:winmm.dll /DELAYLOAD:ws2_32.dll
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ENDIF
|
||||
@ -221,6 +221,10 @@ SOURCE=.\shell32\folderfix.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\shell32\SHBindToParent.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\shell32\SHGetFolderLocation.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -296,6 +300,38 @@ SOURCE=.\shfolder\_shfolder_apilist.h
|
||||
SOURCE=.\shfolder\shfolder.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "winmm"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\winmm\_winmm_apilist.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\winmm\_winmm_apilist.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\winmm\uniwinmm.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "ws2_32"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ws2_32\_ws2_32_apilist.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ws2_32\_ws2_32_apilist.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ws2_32\addinfo.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\common.c
|
||||
|
@ -31,9 +31,11 @@
|
||||
#include "rpcrt4/_rpcrt4_apilist.h"
|
||||
#include "winspool/_winspool_apilist.h"
|
||||
#include "shfolder/_shfolder_apilist.h"
|
||||
#include "winmm/_winmm_apilist.h"
|
||||
#include "ws2_32/_ws2_32_apilist.h"
|
||||
//#include "/__apilist.h"
|
||||
|
||||
static apilib_api_table api_table[10];
|
||||
static apilib_api_table api_table[12];
|
||||
|
||||
static void fill_apitable()
|
||||
{
|
||||
@ -46,6 +48,8 @@ static void fill_apitable()
|
||||
api_table[6] = apitable_rpcrt4;
|
||||
api_table[7] = apitable_winspool;
|
||||
api_table[8] = apitable_shfolder;
|
||||
api_table[9] = apitable_winmm;
|
||||
api_table[10] = apitable_ws2_32;
|
||||
//last entry is null terminator
|
||||
}
|
||||
|
||||
@ -59,7 +63,9 @@ const apilib_api_table* get_api_table()
|
||||
|
||||
static BOOL init()
|
||||
{
|
||||
return common_init() && init_kernel32() && init_gdi32() && init_user32() && init_advapi32() && init_comdlg32() && init_shell32() && init_rpcrt4() && init_winspool() && init_shfolder();
|
||||
return common_init() && init_kernel32() && init_gdi32() && init_user32()
|
||||
&& init_advapi32() && init_comdlg32() && init_shell32() && init_rpcrt4()
|
||||
&& init_winspool() && init_shfolder() && init_winmm() && init_ws2_32();
|
||||
}
|
||||
|
||||
static void uninit()
|
||||
|
@ -23,6 +23,7 @@
|
||||
#define _RPCRT4_APILIST_H
|
||||
|
||||
#include "kexcoresdk.h"
|
||||
#include <rpc.h>
|
||||
|
||||
BOOL init_rpcrt4();
|
||||
extern const apilib_api_table apitable_rpcrt4;
|
||||
|
55
apilibs/kexbasen/shell32/SHBindToParent.c
Executable file
55
apilibs/kexbasen/shell32/SHBindToParent.c
Executable file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#define CINTERFACE
|
||||
#include <shlobj.h>
|
||||
|
||||
/* MAKE_EXPORT SHBindToParent_new=SHBindToParent */
|
||||
HRESULT WINAPI SHBindToParent_new(LPCITEMIDLIST pidl, REFIID riid, VOID **ppv, LPCITEMIDLIST *ppidlLast)
|
||||
{
|
||||
HRESULT hres;
|
||||
LPITEMIDLIST pidlParent = ILClone(pidl);
|
||||
if (pidlParent)
|
||||
{
|
||||
ILRemoveLastID(pidlParent);
|
||||
IShellFolder *psf;
|
||||
hres = SHGetDesktopFolder(&psf);
|
||||
if (SUCCEEDED(hres))
|
||||
{
|
||||
if (pidl->mkid.cb == 0) //empty i.e. desktop
|
||||
hres = psf->lpVtbl->QueryInterface(psf,riid,ppv);
|
||||
else
|
||||
hres = psf->lpVtbl->BindToObject(psf,pidlParent,NULL,riid,ppv);
|
||||
psf->lpVtbl->Release(psf);
|
||||
}
|
||||
ILFree(pidlParent);
|
||||
|
||||
if (SUCCEEDED(hres) && (*ppv == NULL)) //no interface provided?
|
||||
hres = E_FAIL;
|
||||
}
|
||||
else
|
||||
hres = E_OUTOFMEMORY;
|
||||
|
||||
if (ppidlLast)
|
||||
*ppidlLast = ILFindLastID(pidl);
|
||||
|
||||
return hres;
|
||||
}
|
@ -67,7 +67,7 @@ static SHGetFolderLocation_t dld()
|
||||
{
|
||||
HMODULE h = GetModuleHandle("SHELL32");
|
||||
SHGetFolderLocation_t pfn = (SHGetFolderLocation_t)
|
||||
GetProcAddress(h, "SHGetFolderLocation");
|
||||
kexGetProcAddress(h, "SHGetFolderLocation");
|
||||
if (!pfn)
|
||||
pfn = SHGetFolderLocation_impl;
|
||||
return pfn;
|
||||
|
@ -19,6 +19,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define CINTERFACE
|
||||
#include <shlobj.h>
|
||||
#include <shlwapi.h>
|
||||
|
||||
@ -31,9 +32,9 @@ HRESULT WINAPI SHParseDisplayName_new(PCWSTR pszName, IBindCtx *pbc, LPITEMIDLIS
|
||||
{
|
||||
ULONG attrs = sfgaoIn;
|
||||
LPOLESTR pszNameCopyW = StrDupW(pszName);
|
||||
ret = psf->ParseDisplayName(NULL,pbc,pszNameCopyW,NULL,ppidl,&attrs);
|
||||
ret = psf->lpVtbl->ParseDisplayName(psf,NULL,pbc,pszNameCopyW,NULL,ppidl,&attrs);
|
||||
if (psfgaoOut) *psfgaoOut = attrs;
|
||||
psf->Release();
|
||||
psf->lpVtbl->Release(psf);
|
||||
LocalFree(pszNameCopyW);
|
||||
}
|
||||
return ret;
|
||||
|
@ -35,6 +35,7 @@ static const apilib_named_api shell32_named_apis[] =
|
||||
DECL_API("ExtractIconExW", ExtractIconExW_fwd),
|
||||
DECL_API("ExtractIconW", ExtractIconW_fwd),
|
||||
DECL_API("FindExecutableW", FindExecutableW_fwd),
|
||||
DECL_API("SHBindToParent", SHBindToParent_new),
|
||||
DECL_API("SHBrowseForFolderW", SHBrowseForFolderW_fwd),
|
||||
DECL_API("SHFileOperationW", SHFileOperationW_fwd),
|
||||
DECL_API("SHGetFileInfoW", SHGetFileInfoW_fwd),
|
||||
|
@ -29,6 +29,7 @@ BOOL init_shell32();
|
||||
extern const apilib_api_table apitable_shell32;
|
||||
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
|
||||
HRESULT WINAPI SHBindToParent_new(LPCITEMIDLIST pidl, REFIID riid, VOID **ppv, LPCITEMIDLIST *ppidlLast);
|
||||
HRESULT WINAPI SHGetFolderLocation_new(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwReserved, LPVOID *ppidl);
|
||||
HRESULT WINAPI SHGetFolderPathA_new(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPSTR pszPath);
|
||||
HRESULT WINAPI SHGetFolderPathW_new(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath);
|
||||
|
@ -41,7 +41,7 @@ PVOID WINAPI GetShlwapiProc(int funcnum)
|
||||
if (!hShlwapi)
|
||||
hShlwapi = LoadLibrary("shlwapi.dll");
|
||||
}
|
||||
PVOID proc = GetProcAddress(hShlwapi,(LPSTR)funcnum);
|
||||
PVOID proc = kexGetProcAddress(hShlwapi,(LPSTR)funcnum);
|
||||
if (!proc)
|
||||
shlwapi_fatal_error(funcnum);
|
||||
return proc;
|
||||
|
@ -59,7 +59,7 @@ unsigned long __stdcall GetUnicowsAddress(const char* name)
|
||||
{
|
||||
if (!hUnicows)
|
||||
unifwd_init();
|
||||
PROC addr = GetProcAddress(hUnicows, name);
|
||||
PROC addr = kexGetProcAddress(hUnicows, name);
|
||||
if (!addr)
|
||||
unicows_fatal_error(name);
|
||||
return (unsigned long) addr;
|
||||
|
47
apilibs/kexbasen/winmm/_winmm_apilist.c
Executable file
47
apilibs/kexbasen/winmm/_winmm_apilist.c
Executable file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2010, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "kexcoresdk.h"
|
||||
#include "_winmm_apilist.h"
|
||||
|
||||
BOOL init_winmm()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static const apilib_named_api winmm_named_apis[] =
|
||||
{
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
|
||||
DECL_API("waveInGetDevCapsW", waveInGetDevCapsW_new),
|
||||
DECL_API("waveOutGetDevCapsW", waveOutGetDevCapsW_new),
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
|
||||
};
|
||||
|
||||
#if 0
|
||||
static const apilib_unnamed_api winmm_ordinal_apis[] =
|
||||
{
|
||||
/*** AUTOGENERATED APILIST ORDINAL EXPORTS BEGIN ***/
|
||||
/*** AUTOGENERATED APILIST ORDINAL EXPORTS END ***/
|
||||
};
|
||||
#endif
|
||||
|
||||
const apilib_api_table apitable_winmm = DECL_TAB("WINMM.DLL", winmm_named_apis, 0 /*winmm_ordinal_apis*/);
|
36
apilibs/kexbasen/winmm/_winmm_apilist.h
Executable file
36
apilibs/kexbasen/winmm/_winmm_apilist.h
Executable file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2010, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _WINMM_APILIST_H
|
||||
#define _WINMM_APILIST_H
|
||||
|
||||
#include "kexcoresdk.h"
|
||||
#include <mmsystem.h>
|
||||
|
||||
BOOL init_winmm();
|
||||
extern const apilib_api_table apitable_winmm;
|
||||
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
|
||||
MMRESULT WINAPI waveInGetDevCapsW_new(UINT uDeviceID, LPWAVEINCAPSW pwicW, UINT cbwic);
|
||||
MMRESULT WINAPI waveOutGetDevCapsW_new(UINT uDeviceID, LPWAVEOUTCAPSW pwocW, UINT cbwoc);
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
|
||||
|
||||
#endif
|
88
apilibs/kexbasen/winmm/uniwinmm.c
Executable file
88
apilibs/kexbasen/winmm/uniwinmm.c
Executable file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2010, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include <mmsystem.h>
|
||||
|
||||
/* MAKE_EXPORT waveInGetDevCapsW_new=waveInGetDevCapsW */
|
||||
MMRESULT WINAPI waveInGetDevCapsW_new(
|
||||
UINT uDeviceID,
|
||||
LPWAVEINCAPSW pwicW,
|
||||
UINT cbwic
|
||||
)
|
||||
{
|
||||
MMRESULT ret;
|
||||
WAVEINCAPSA wicA;
|
||||
WAVEINCAPSW wicW;
|
||||
|
||||
if (pwicW == NULL)
|
||||
return MMSYSERR_INVALPARAM;
|
||||
|
||||
ret = waveInGetDevCapsA(uDeviceID, &wicA, sizeof(wicA));
|
||||
|
||||
if (ret == MMSYSERR_NOERROR)
|
||||
{
|
||||
wicW.wMid = wicA.wMid;
|
||||
wicW.wPid = wicA.wPid;
|
||||
wicW.vDriverVersion = wicA.vDriverVersion;
|
||||
MultiByteToWideChar(CP_ACP, 0, wicA.szPname, -1, wicW.szPname, sizeof(wicW.szPname));
|
||||
wicW.dwFormats = wicA.dwFormats;
|
||||
wicW.wChannels = wicA.wChannels;
|
||||
wicW.wReserved1 = wicA.wReserved1;
|
||||
|
||||
memcpy(pwicW, &wicW, min(sizeof(wicW), cbwic));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT waveOutGetDevCapsW_new=waveOutGetDevCapsW */
|
||||
MMRESULT WINAPI waveOutGetDevCapsW_new(
|
||||
UINT uDeviceID,
|
||||
LPWAVEOUTCAPSW pwocW,
|
||||
UINT cbwoc
|
||||
)
|
||||
{
|
||||
MMRESULT ret;
|
||||
WAVEOUTCAPSA wocA;
|
||||
WAVEOUTCAPSW wocW;
|
||||
|
||||
if (pwocW == NULL)
|
||||
return MMSYSERR_INVALPARAM;
|
||||
|
||||
ret = waveOutGetDevCapsA(uDeviceID, &wocA, sizeof(wocA));
|
||||
|
||||
if (ret == MMSYSERR_NOERROR)
|
||||
{
|
||||
wocW.wMid = wocA.wMid;
|
||||
wocW.wPid = wocA.wPid;
|
||||
wocW.vDriverVersion = wocA.vDriverVersion;
|
||||
MultiByteToWideChar(CP_ACP, 0, wocA.szPname, -1, wocW.szPname, sizeof(wocW.szPname));
|
||||
wocW.dwFormats = wocA.dwFormats;
|
||||
wocW.wChannels = wocA.wChannels;
|
||||
wocW.wReserved1 = wocA.wReserved1;
|
||||
wocW.dwSupport = wocA.dwSupport;
|
||||
|
||||
memcpy(pwocW, &wocW, min(sizeof(wocW), cbwoc));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
@ -20,9 +20,10 @@
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include <winspool.h>
|
||||
|
||||
/* MAKE_EXPORT GetDefaultPrinterA=GetDefaultPrinterA */
|
||||
BOOL WINAPI GetDefaultPrinterA(LPSTR buf, LPDWORD size)
|
||||
/* MAKE_EXPORT GetDefaultPrinterA_new=GetDefaultPrinterA */
|
||||
BOOL WINAPI GetDefaultPrinterA_new(LPSTR buf, LPDWORD size)
|
||||
{
|
||||
DWORD needed, returned;
|
||||
BOOL ret;
|
||||
@ -53,8 +54,8 @@ BOOL WINAPI GetDefaultPrinterA(LPSTR buf, LPDWORD size)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetDefaultPrinterW=GetDefaultPrinterW */
|
||||
BOOL WINAPI GetDefaultPrinterW(LPWSTR bufW, LPDWORD sizeW)
|
||||
/* MAKE_EXPORT GetDefaultPrinterW_new=GetDefaultPrinterW */
|
||||
BOOL WINAPI GetDefaultPrinterW_new(LPWSTR bufW, LPDWORD sizeW)
|
||||
{
|
||||
BOOL ret;
|
||||
DWORD sizeA = *sizeW;
|
||||
|
@ -48,8 +48,8 @@ static const apilib_named_api winspool_named_apis[] =
|
||||
DECL_API("DeviceCapabilitiesW", DeviceCapabilitiesW_fwd),
|
||||
DECL_API("DocumentPropertiesW", DocumentPropertiesW_fwd),
|
||||
DECL_API("EnumPrintersW", EnumPrintersW_new),
|
||||
DECL_API("GetDefaultPrinterA", GetDefaultPrinterA),
|
||||
DECL_API("GetDefaultPrinterW", GetDefaultPrinterW),
|
||||
DECL_API("GetDefaultPrinterA", GetDefaultPrinterA_new),
|
||||
DECL_API("GetDefaultPrinterW", GetDefaultPrinterW_new),
|
||||
DECL_API("GetPrintProcessorDirectoryW", GetPrintProcessorDirectoryW_fwd),
|
||||
DECL_API("GetPrinterDataExA", GetPrinterDataExA_stub),
|
||||
DECL_API("GetPrinterDataExW", GetPrinterDataExW_stub),
|
||||
|
@ -28,8 +28,8 @@ BOOL init_winspool();
|
||||
extern const apilib_api_table apitable_winspool;
|
||||
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
|
||||
BOOL WINAPI GetDefaultPrinterA(LPSTR buf, LPDWORD size);
|
||||
BOOL WINAPI GetDefaultPrinterW(LPWSTR bufW, LPDWORD sizeW);
|
||||
BOOL WINAPI GetDefaultPrinterA_new(LPSTR buf, LPDWORD size);
|
||||
BOOL WINAPI GetDefaultPrinterW_new(LPWSTR bufW, LPDWORD sizeW);
|
||||
STUB GetPrinterDataExA_stub;
|
||||
STUB GetPrinterDataExW_stub;
|
||||
STUB SetPrinterDataExA_stub;
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#include "common.h"
|
||||
#include "unifwd.h"
|
||||
#include <winspool.h>
|
||||
|
||||
static const DWORD pi_sizeof[] = {0, sizeof(PRINTER_INFO_1), sizeof(PRINTER_INFO_2),
|
||||
sizeof(PRINTER_INFO_3), sizeof(PRINTER_INFO_4),
|
||||
|
47
apilibs/kexbasen/ws2_32/_ws2_32_apilist.c
Executable file
47
apilibs/kexbasen/ws2_32/_ws2_32_apilist.c
Executable file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2010, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "_ws2_32_apilist.h"
|
||||
|
||||
BOOL init_ws2_32()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static const apilib_named_api ws2_32_named_apis[] =
|
||||
{
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
|
||||
DECL_API("freeaddrinfo", freeaddrinfo_new),
|
||||
DECL_API("getaddrinfo", getaddrinfo_new),
|
||||
DECL_API("getnameinfo", getnameinfo_new),
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
|
||||
};
|
||||
|
||||
#if 0
|
||||
static const apilib_unnamed_api ws2_32_ordinal_apis[] =
|
||||
{
|
||||
/*** AUTOGENERATED APILIST ORDINAL EXPORTS BEGIN ***/
|
||||
/*** AUTOGENERATED APILIST ORDINAL EXPORTS END ***/
|
||||
};
|
||||
#endif
|
||||
|
||||
const apilib_api_table apitable_ws2_32 = DECL_TAB("WS2_32.DLL", ws2_32_named_apis, 0 /*ws2_32_ordinal_apis*/);
|
39
apilibs/kexbasen/ws2_32/_ws2_32_apilist.h
Executable file
39
apilibs/kexbasen/ws2_32/_ws2_32_apilist.h
Executable file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2010, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _WS2_32_APILIST_H
|
||||
#define _WS2_32_APILIST_H
|
||||
|
||||
#include "kexcoresdk.h"
|
||||
#include <winsock2.h>
|
||||
#define _WSPIAPI_COUNTOF(_Array) (sizeof(_Array) / sizeof(_Array[0]))
|
||||
#include <ws2tcpip.h>
|
||||
|
||||
BOOL init_ws2_32();
|
||||
extern const apilib_api_table apitable_ws2_32;
|
||||
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
|
||||
int WINAPI getaddrinfo_new(const char* hostname, const char* servname, const struct addrinfo* hints, struct addrinfo** res);
|
||||
void WINAPI freeaddrinfo_new(struct addrinfo* ai);
|
||||
int WINAPI getnameinfo_new(const struct sockaddr* sa, socklen_t salen, char* host, size_t hostlen, char* serv, size_t servlen, int flags);
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
|
||||
|
||||
#endif
|
60
apilibs/kexbasen/ws2_32/addinfo.c
Executable file
60
apilibs/kexbasen/ws2_32/addinfo.c
Executable file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2010, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#define _WSPIAPI_COUNTOF(_Array) (sizeof(_Array) / sizeof(_Array[0]))
|
||||
#include <ws2tcpip.h>
|
||||
#include <wspiapi.h>
|
||||
|
||||
/* MAKE_EXPORT getaddrinfo_new=getaddrinfo */
|
||||
int WINAPI getaddrinfo_new(
|
||||
const char* hostname,
|
||||
const char* servname,
|
||||
const struct addrinfo* hints,
|
||||
struct addrinfo** res
|
||||
)
|
||||
{
|
||||
return WspiapiLegacyGetAddrInfo(hostname, servname, hints, res);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT freeaddrinfo_new=freeaddrinfo */
|
||||
void WINAPI freeaddrinfo_new(
|
||||
struct addrinfo* ai
|
||||
)
|
||||
{
|
||||
WspiapiLegacyFreeAddrInfo(ai);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT getnameinfo_new=getnameinfo */
|
||||
int WINAPI getnameinfo_new(
|
||||
const struct sockaddr* sa,
|
||||
socklen_t salen,
|
||||
char* host,
|
||||
size_t hostlen,
|
||||
char* serv,
|
||||
size_t servlen,
|
||||
int flags
|
||||
)
|
||||
{
|
||||
return WspiapiLegacyGetNameInfo(sa, salen, host, hostlen, serv, servlen, flags);
|
||||
}
|
@ -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)
|
||||
|
@ -25,12 +25,14 @@ REGEDIT4
|
||||
;-AbiWord
|
||||
"*\\BIN\\ABIWORD.EXE"="VISTA"
|
||||
;-Flash Player
|
||||
"*\\NPSWF32.DLL"="WINXP"
|
||||
"%WINDIR%\\SYSTEM\\MACROMED\\FLASH\\FLASH10*.OCX"="WINXP"
|
||||
"*\\NPSWF32.DLL"="NT2K"
|
||||
"%WINDIR%\\SYSTEM\\MACROMED\\FLASH\\FLASH10*.OCX"="NT2K"
|
||||
;-GTA:SA
|
||||
"*\\GTA_SA.EXE"="NOHEAP"
|
||||
;-Rally Championship '99
|
||||
"*\\RAL.EXE"="NOHEAP"
|
||||
;-Wizard101
|
||||
"*\\BIN\\WIZARDGRAPHICALCLIENT.EXE"="NOHEAP"
|
||||
;-MPC Home Cinema Setup
|
||||
"*\\MPC-HOMECINEMA.1.*.EXE"="WINXP"
|
||||
|
||||
|
@ -22,9 +22,9 @@
|
||||
#ifndef __VERSION_H
|
||||
#define __VERSION_H
|
||||
|
||||
#define VERSION_STR "4.5 RC 1"
|
||||
#define VERSION_CODE 0x0405000B
|
||||
#define RCVERSION 4, 5, 1, 1
|
||||
#define _RCVERSION_ "4, 5, 1, 1"
|
||||
#define VERSION_STR "4.5 RC 4"
|
||||
#define VERSION_CODE 0x0405000E
|
||||
#define RCVERSION 4, 5, 1, 4
|
||||
#define _RCVERSION_ "4, 5, 1, 4"
|
||||
|
||||
#endif
|
||||
|
@ -250,7 +250,7 @@ static IMTE*** find_mod_table()
|
||||
|
||||
IMTE*** ret;
|
||||
|
||||
DWORD* res = find_unique_pattern((void*) iGetProcAddress(h_kernel32, (LPSTR)23), 0x20, pat, pat_len, pat_name);
|
||||
DWORD* res = find_unique_pattern((void*) GetK32OrdinalAddress(23), 0x20, pat, pat_len, pat_name);
|
||||
|
||||
ret = (IMTE***)*res;
|
||||
DBGPRINTF(("%s @ 0x%08x\n", pat_name, ret));
|
||||
@ -265,7 +265,7 @@ static MRFromHLib_t find_MRFromHLib()
|
||||
|
||||
MRFromHLib_t ret;
|
||||
|
||||
DWORD* res = find_unique_pattern((void*) iGetProcAddress(h_kernel32, (LPSTR)23), 0x20, pat, pat_len, pat_name);
|
||||
DWORD* res = find_unique_pattern((void*) GetK32OrdinalAddress(23), 0x20, pat, pat_len, pat_name);
|
||||
if (!res)
|
||||
return NULL;
|
||||
|
||||
@ -441,9 +441,9 @@ int internals_init()
|
||||
DBGPRINTF(("internals_init()\n"));
|
||||
h_kernel32 = GetModuleHandle("kernel32");
|
||||
ppmteModTable = find_mod_table();
|
||||
MRFromHLib = find_MRFromHLib();
|
||||
krnl32lock = find_krnl32lock();
|
||||
pppdbCur = find_curPDB();
|
||||
MRFromHLib = find_MRFromHLib();
|
||||
pimteMax = find_pimteMax();
|
||||
TIDtoTDB = find_TIDtoTDB();
|
||||
MRLoadTree = find_MRLoadTree();
|
||||
@ -454,7 +454,7 @@ int internals_init()
|
||||
is_winme = (GetVersion() == 0xc0005a04);
|
||||
bool modinit_rslt = ModuleInitializer_init();
|
||||
|
||||
if (!h_kernel32 || !ppmteModTable || !krnl32lock || !pppdbCur || !MRFromHLib
|
||||
if (!h_kernel32 || !ppmteModTable || !MRFromHLib || !krnl32lock || !pppdbCur
|
||||
|| !pimteMax || !TIDtoTDB || !MRLoadTree || !FreeLibTree
|
||||
|| !FreeLibRemove || !AllocHandle || !instdir_rslt
|
||||
|| !modinit_rslt)
|
||||
|
@ -659,8 +659,8 @@ static BOOL WINAPI IsKnownKexDLL(char* name, const char* ext)
|
||||
{
|
||||
LONG res;
|
||||
DWORD type;
|
||||
char path[MAX_PATH];
|
||||
DWORD size = sizeof(path);
|
||||
char new_path[MAX_PATH];
|
||||
DWORD size = sizeof(new_path);
|
||||
|
||||
if (ext && strcmp(ext, "DLL") != 0)
|
||||
return FALSE;
|
||||
@ -670,12 +670,33 @@ static BOOL WINAPI IsKnownKexDLL(char* name, const char* ext)
|
||||
|
||||
if (are_extensions_enabled())
|
||||
{
|
||||
//workaround windows bug
|
||||
int pos = strlen(name) - 4;
|
||||
if (pos > 0 && name[pos] == '.')
|
||||
name[pos] = '\0';
|
||||
int len = strlen(name);
|
||||
|
||||
res = RegQueryValueEx(known_dlls_key, name, NULL, &type, (BYTE*) path, &size);
|
||||
//workaround windows bug
|
||||
int pos = len - 4;
|
||||
if (pos > 0 && name[pos] == '.')
|
||||
{
|
||||
name[pos] = '\0';
|
||||
len = pos;
|
||||
}
|
||||
|
||||
char* file = name;
|
||||
|
||||
//find where directory part ends
|
||||
while (len > 0)
|
||||
{
|
||||
len--;
|
||||
if (name[len] == '\\')
|
||||
{
|
||||
file = name + len + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!len || (len == system_path_len && !strncmp(name, system_path, len)))
|
||||
res = RegQueryValueEx(known_dlls_key, file, NULL, &type, (BYTE*) new_path, &size);
|
||||
else
|
||||
res = ERROR_INVALID_FUNCTION;
|
||||
}
|
||||
else
|
||||
res = ERROR_INVALID_FUNCTION;
|
||||
@ -683,7 +704,7 @@ static BOOL WINAPI IsKnownKexDLL(char* name, const char* ext)
|
||||
if (res == ERROR_SUCCESS && type == REG_SZ)
|
||||
{
|
||||
memcpy(name, (const char*) kernelex_dir, kernelex_dir.length());
|
||||
memcpy(name + kernelex_dir.length(), path, size);
|
||||
memcpy(name + kernelex_dir.length(), new_path, size);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
@ -725,13 +746,31 @@ static BOOL WINAPI KexResourceCheck(DWORD un0, DWORD un1, DWORD un2, DWORD* pNam
|
||||
return GetOrdinal(un0, un1, un2, pNameOrId, pResult, un3);
|
||||
}
|
||||
|
||||
/** Retrieves address of kernel32 function exported by ordinal.
|
||||
* @param [in] ord function ordinal number
|
||||
* @return function address or NULL if not found
|
||||
*/
|
||||
PROC WINAPI GetK32OrdinalAddress(WORD wOrd)
|
||||
{
|
||||
IMAGE_DOS_HEADER* dosh = (IMAGE_DOS_HEADER*) h_kernel32;
|
||||
IMAGE_NT_HEADERS* nth = (IMAGE_NT_HEADERS*)((LONG)dosh + dosh->e_lfanew);
|
||||
return OriExportFromOrdinal(nth, wOrd);
|
||||
}
|
||||
|
||||
/** GetProcAddress variant used to bypass CORE's resolver hook
|
||||
* (get real procedure address not overridden one).
|
||||
* @param [in] hModule module handle
|
||||
* @param [in] lpProcName procedure name or ordinal number (high word zeroed)
|
||||
* @return function address or NULL if not found
|
||||
*/
|
||||
PROC WINAPI iGetProcAddress(HMODULE hModule, LPCSTR lpProcName)
|
||||
{
|
||||
IMAGE_DOS_HEADER* dos_hdr;
|
||||
IMAGE_NT_HEADERS* nt_hdr;
|
||||
DBGASSERT(MRFromHLib != NULL);
|
||||
DBGASSERT(ppmteModTable != NULL);
|
||||
|
||||
dos_hdr = (IMAGE_DOS_HEADER*) hModule;
|
||||
nt_hdr = (IMAGE_NT_HEADERS*)((int)dos_hdr + dos_hdr->e_lfanew);
|
||||
MODREF* mr = MRFromHLib(hModule);
|
||||
IMTE* imte = (*ppmteModTable)[mr->mteIndex];
|
||||
IMAGE_NT_HEADERS* nt_hdr = imte->pNTHdr;
|
||||
|
||||
if ((DWORD)lpProcName < 0x10000)
|
||||
return OriExportFromOrdinal(nt_hdr, LOWORD(lpProcName));
|
||||
|
@ -90,6 +90,7 @@ extern LONG old_jtab[];
|
||||
bool are_extensions_enabled();
|
||||
bool are_extensions_enabled_module(const char* path);
|
||||
DWORD encode_address(DWORD addr, const ApiLibrary* apilib);
|
||||
PROC WINAPI GetK32OrdinalAddress(WORD wOrd);
|
||||
PROC WINAPI iGetProcAddress(HMODULE hModule, LPCSTR lpProcName);
|
||||
PROC WINAPI ExportFromOrdinal(IMTE_KEX* target, MODREF* caller, BOOL is_static, WORD ordinal);
|
||||
PROC WINAPI ExportFromName(IMTE_KEX* target, MODREF* caller, BOOL is_static, WORD hint, LPCSTR name);
|
||||
|
@ -294,12 +294,14 @@ void FileDeclParser::parse_forward_to_unicows(const string& line) throw(exceptio
|
||||
int FileDeclParser::find_matching_export(const string& s)
|
||||
{
|
||||
int count = 0;
|
||||
size_t pos;
|
||||
|
||||
//try named exports first
|
||||
vector<export_entry_named>::iterator itn = exports_named.begin();
|
||||
while (itn != exports_named.end())
|
||||
{
|
||||
if (s.find(itn->source_name) != string::npos)
|
||||
pos = s.find(itn->source_name);
|
||||
if (pos != string::npos && is_full_decl(s, pos, itn->source_name.length()))
|
||||
count++;
|
||||
itn++;
|
||||
}
|
||||
@ -307,13 +309,23 @@ int FileDeclParser::find_matching_export(const string& s)
|
||||
vector<export_entry_ordinal>::iterator ito = exports_ordinal.begin();
|
||||
while (ito != exports_ordinal.end())
|
||||
{
|
||||
if (s.find(ito->source_name) != string::npos)
|
||||
pos = s.find(ito->source_name);
|
||||
if (pos != string::npos && is_full_decl(s, pos, ito->source_name.length()))
|
||||
count++;
|
||||
ito++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
bool FileDeclParser::is_full_decl(const string& s, int beg, int len)
|
||||
{
|
||||
if (beg > 0 && (isalnum(s[beg-1]) || s[beg-1] == '_'))
|
||||
return false;
|
||||
if (beg + len < s.length() && (isalnum(s[beg+len]) || s[beg+len] == '_'))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void FileDeclParser::prefilter() throw(exception)
|
||||
{
|
||||
//erase C-style comments
|
||||
|
@ -101,6 +101,9 @@ protected:
|
||||
void parse_forward_to_unicows(const string& line) throw(exception);
|
||||
int find_matching_export(const string& s);
|
||||
void filter_declaration(string& s);
|
||||
|
||||
private:
|
||||
bool is_full_decl(const string& s, int beg, int len);
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
Reference in New Issue
Block a user