mirror of
https://github.com/UzixLS/KernelEx.git
synced 2025-07-18 23:11:19 +03:00
import KernelEx-4.5-RC5
This commit is contained in:
@ -1,3 +1,35 @@
|
||||
KernelEx v4.5 RC 5 by Xeno86
|
||||
2010-11-02
|
||||
|
||||
font UID is used instead of handle to identify fonts in cache (UIDs are unique, handles may be reused),
|
||||
rewritten code to fix GDI objects leaking (improved stability, more leaks covered)
|
||||
RPC code is extended to support proxies with Win2k+ extensions (for MS Office 2007 converters)
|
||||
implemented OLE32.CoWaitForMultipleHandles with Wine code (for MS Office 2007 converters)
|
||||
use proper locking when accessing DC object in TextOut functions (improved stability)
|
||||
make GetTextExtentPoint32 threat negative string lengths as error (as NT does, fixes random Foxit Reader crashes during scrolling)
|
||||
make QueryInterface(CLSID_ShellLink,IID_IUnknown) prepare IShellLinkA interface for use (fixes "Easy Assembler Shell" installer)
|
||||
renamed "Compatibility" tab to "KernelEx" tab
|
||||
fix for USER32.LoadMenuA loading menus from LOAD_LIBRARY_AS_DATAFILE mmaped DLLs
|
||||
replaced MSLU USER32.LoadMenuIndirectW with direct call
|
||||
replaced buggy MSLU menu functions not checking flags with custom implementation: USER32.LoadMenuW, InsertMenuW, AppendMenuW, ChangeMenuW, ModifyMenuW
|
||||
fixed Akelpad incorrect national input + Office 2003 one-char-in-dialog-title ThUniLay bug
|
||||
fixed SetWindowTextW behaviour
|
||||
modified SHGetSpecialFolderPath fix for compatibility with win95 shell32
|
||||
added SHELL32.SHCreateDirectoryEx missing on Windows 98
|
||||
added KERNEL32.MapViewOfFile workaround for Word 2003
|
||||
added ADVAPI32 Lsa and DecryptFile/EncryptFile stubs (for Word 2003)
|
||||
added KERNEL32.SetDllDirectory stubs (for newer mpc-hc)
|
||||
Unicode applications receive Tahoma shell font (fixes Qt GUI problems)
|
||||
added protection against ExitProcess in DLL_PROCESS_DETACH which causes a crash on 9x
|
||||
set calling thread priority to the lowest possible in order to improve chance for thread which calls ExitProcess to finish latest and call dll process detach like NT (fixes OpenOffice.org shutdown crash)
|
||||
added a protection against SHFOLDER unloading by hostile programs (fixes VLC 1.1.4 DVD playback crash)
|
||||
terminate process if EnterCriticalSection is called on orphaned CS in DLL_PROCESS_DETACH - Vista behaviour (fixes OpenOffice.org shutdown crash)
|
||||
modified raw input stubs to return proper error codes and properly reset pointers
|
||||
replaced GetOpenFileNameW/GetSaveFileNameW MSLU wrapper with custom implementation
|
||||
fix: GetFileVersionInfoSizeW didn't return proper value on failure
|
||||
|
||||
---------------------------------------
|
||||
|
||||
KernelEx v4.5 RC 4 by Xeno86
|
||||
2010-09-21
|
||||
|
||||
|
11
COMPILE.TXT
11
COMPILE.TXT
@ -1,6 +1,13 @@
|
||||
To compile you need Microsoft Visual C++ 6.0 SP6 with Platform SDK 2003.
|
||||
First you need to compile KEXCRT project as other projects rely on it.
|
||||
To compile you need Microsoft Visual C++ 6.0 SP6
|
||||
with updated xtree header (http://www.dinkumware.com/xtree.txt)
|
||||
and supplied with Platform SDK 2003.
|
||||
|
||||
You can use batch build feature to automate builds.
|
||||
|
||||
If you build manually, you need to compile KEXCRT and PREP projects first as other projects rely on them.
|
||||
To build KEXCONTROL you have to build debug CORE first.
|
||||
KEXBASES and KEXBASEN projects rely on CORE be built first.
|
||||
|
||||
To build installer you need NSIS install system.
|
||||
|
||||
-Xeno86
|
||||
|
48
KernelEx.dsw
48
KernelEx.dsw
@ -3,6 +3,30 @@ Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "kexcrt"=.\kexcrt\kexcrt.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "prep"=.\util\prep\prep.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "Core"=.\core\core.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
@ -75,30 +99,6 @@ Package=<4>
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "kexcrt"=.\kexcrt\kexcrt.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "prep"=.\util\prep\prep.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "setup"=.\setup\setup.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
|
@ -1,4 +1,4 @@
|
||||
!define _VERSION '4.5 RC 4'
|
||||
!define _VERSION '4.5 RC 5'
|
||||
|
||||
!ifndef _DEBUG
|
||||
!define FLAVOUR 'Release'
|
||||
|
25
NEWS.txt
25
NEWS.txt
@ -1,3 +1,28 @@
|
||||
KernelEx v4.5 RC 5 by Xeno86
|
||||
2010-11-02
|
||||
|
||||
What's new:
|
||||
----------------------------------
|
||||
* KernelEx should now work better with Windows 95 shell
|
||||
* Fixed stability issues with GDI anti-leaking code
|
||||
|
||||
Apps fixed / now working:
|
||||
-------------------------
|
||||
* Fixed: OpenOffice.org often crashed on closing
|
||||
* Fixed: VLC 1.1.x crashed on DVD playback on windows 98 shell
|
||||
* Fixed: MAME insufficient memory error
|
||||
* Fixed: Inkscape 0.47 invisible save dialog problem
|
||||
* Fixed: Foxit Reader 3,4 resource leaks and random scrolling crashes
|
||||
* Fixed: Opera crashed in 'Windows 2000' mode when trying to save file
|
||||
* Fixed: Qt4 apps not showing interface fonts
|
||||
* Fixed: AkelPad had broken national input
|
||||
* Fixed: Easy Assembler Shell installer crash
|
||||
* Now working: Media Player Classic Home Cinema rev 2374+
|
||||
* Now working: MS Office 2003 Word/Excel + Viewers (experimental)
|
||||
* Now working: MS Office 2007 converters [docx only] (experimental)
|
||||
|
||||
#################################################
|
||||
|
||||
KernelEx v4.5 RC 4 by Xeno86
|
||||
2010-09-21
|
||||
|
||||
|
@ -36,9 +36,9 @@ static const apilib_named_api comdlg32_named_apis[] =
|
||||
DECL_API("FindTextW", FindTextW_fwd),
|
||||
DECL_API("GetFileTitleW", GetFileTitleW_fwd),
|
||||
DECL_API("GetOpenFileNameA", GetOpenFileNameA_fix),
|
||||
DECL_API("GetOpenFileNameW", GetOpenFileNameW_fwd),
|
||||
DECL_API("GetOpenFileNameW", GetOpenFileNameW_new),
|
||||
DECL_API("GetSaveFileNameA", GetSaveFileNameA_fix),
|
||||
DECL_API("GetSaveFileNameW", GetSaveFileNameW_fwd),
|
||||
DECL_API("GetSaveFileNameW", GetSaveFileNameW_new),
|
||||
DECL_API("PageSetupDlgW", PageSetupDlgW_fwd),
|
||||
DECL_API("PrintDlgW", PrintDlgW_fwd),
|
||||
DECL_API("ReplaceTextW", ReplaceTextW_fwd),
|
||||
|
@ -31,12 +31,12 @@ extern const apilib_api_table apitable_comdlg32;
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
|
||||
BOOL WINAPI GetOpenFileNameA_fix(LPOPENFILENAMEA lpofn);
|
||||
BOOL WINAPI GetSaveFileNameA_fix(LPOPENFILENAMEA lpofn);
|
||||
BOOL WINAPI GetSaveFileNameW_new(LPOPENFILENAMEW lpofn);
|
||||
BOOL WINAPI GetOpenFileNameW_new(LPOPENFILENAMEW lpofn);
|
||||
FWDPROC ChooseColorW_fwd;
|
||||
FWDPROC ChooseFontW_fwd;
|
||||
FWDPROC FindTextW_fwd;
|
||||
FWDPROC GetFileTitleW_fwd;
|
||||
FWDPROC GetOpenFileNameW_fwd;
|
||||
FWDPROC GetSaveFileNameW_fwd;
|
||||
FWDPROC PageSetupDlgW_fwd;
|
||||
FWDPROC PrintDlgW_fwd;
|
||||
FWDPROC ReplaceTextW_fwd;
|
||||
|
275
apilibs/kexbasen/comdlg32/opensavefile.c
Executable file
275
apilibs/kexbasen/comdlg32/opensavefile.c
Executable file
@ -0,0 +1,275 @@
|
||||
/*
|
||||
* 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 "opensavefile.h"
|
||||
|
||||
static UINT WM_HELPMSGSTRING;
|
||||
static UINT WM_FILEOKSTRING;
|
||||
static UINT WM_SHAREVISTRING;
|
||||
|
||||
//this procedure adapts unicode hook proc, both old and new
|
||||
static UINT_PTR CALLBACK OFNHookProcWAdapter(
|
||||
LPOFNHOOKPROC pfnhook, LPOPENFILENAMEW lpofnW, HWND hdlg, UINT uiMsg,
|
||||
WPARAM wParam, LPARAM lParam
|
||||
)
|
||||
{
|
||||
switch(uiMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
return pfnhook(hdlg,uiMsg,wParam,(LPARAM)lpofnW);
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
if (!lParam) return 0;
|
||||
LPOFNOTIFYA notif = (LPOFNOTIFYA)lParam;
|
||||
switch (notif->hdr.code)
|
||||
{
|
||||
case CDN_FILEOK:
|
||||
case CDN_FOLDERCHANGE:
|
||||
case CDN_HELP:
|
||||
case CDN_INCLUDEITEM:
|
||||
case CDN_INITDONE:
|
||||
case CDN_SELCHANGE:
|
||||
case CDN_SHAREVIOLATION:
|
||||
case CDN_TYPECHANGE:
|
||||
{
|
||||
if (notif->hdr.code == CDN_FILEOK || notif->hdr.code == CDN_SHAREVIOLATION)
|
||||
{
|
||||
//pszFile is updated
|
||||
if (notif->lpOFN->Flags & (OFN_EXPLORER|OFN_ALLOWMULTISELECT))
|
||||
{
|
||||
//many files could be selected, convert \0-separated list
|
||||
MultiByteToWideChar(CP_ACP, 0, notif->lpOFN->lpstrFile,
|
||||
strlenAA(notif->lpOFN->lpstrFile),
|
||||
lpofnW->lpstrFile, lpofnW->nMaxFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
MultiByteToWideChar(CP_ACP, 0, notif->lpOFN->lpstrFile,
|
||||
-1,lpofnW->lpstrFile,lpofnW->nMaxFile);
|
||||
}
|
||||
}
|
||||
lpofnW->nFilterIndex = notif->lpOFN->nFilterIndex;
|
||||
lpofnW->Flags = notif->lpOFN->Flags;
|
||||
((LPOFNOTIFYW)notif)->lpOFN = lpofnW;
|
||||
}
|
||||
default:
|
||||
return pfnhook(hdlg,uiMsg,wParam,lParam);
|
||||
}
|
||||
}
|
||||
//old style hooks messages
|
||||
default:
|
||||
if (uiMsg == WM_HELPMSGSTRING || uiMsg == WM_FILEOKSTRING || uiMsg == WM_SHAREVISTRING)
|
||||
{
|
||||
LPOPENFILENAMEA lpofnA = (LPOPENFILENAMEA)lParam;
|
||||
lpofnW->nFilterIndex = lpofnA->nFilterIndex;
|
||||
lpofnW->Flags = lpofnA->Flags;
|
||||
if (uiMsg == WM_FILEOKSTRING || uiMsg == WM_SHAREVISTRING)
|
||||
{
|
||||
//pszFile is updated
|
||||
if (lpofnW->Flags & (OFN_EXPLORER|OFN_ALLOWMULTISELECT))
|
||||
{
|
||||
//many files could be selected, convert \0-separated list
|
||||
MultiByteToWideChar(CP_ACP, 0, lpofnA->lpstrFile,
|
||||
strlenAA(lpofnA->lpstrFile),
|
||||
lpofnW->lpstrFile, lpofnW->nMaxFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
MultiByteToWideChar(CP_ACP, 0, lpofnA->lpstrFile, -1,
|
||||
lpofnW->lpstrFile,lpofnW->nMaxFile);
|
||||
}
|
||||
}
|
||||
lParam = (LPARAM)lpofnW;
|
||||
}
|
||||
return pfnhook(hdlg,uiMsg,wParam,lParam);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//this procedure handles unicode CDM_ messages. makes sense only to Explorer-style dlgs
|
||||
static INT_PTR CALLBACK OpenSaveDlgProcW(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
DLGPROC DlgProc = (DLGPROC)GetProp(hWnd,OLDDLGPROCPROP);
|
||||
if (!DlgProc) return 0;
|
||||
|
||||
switch(Msg)
|
||||
{
|
||||
case CDM_GETSPEC:
|
||||
case CDM_GETFILEPATH:
|
||||
case CDM_GETFOLDERPATH:
|
||||
{
|
||||
LPSTR bufA;
|
||||
ABUFFER_ALLOC(bufA,wParam);
|
||||
LRESULT ret = DlgProc(hWnd,Msg,wParam,(LPARAM)bufA);
|
||||
ABUFFER_toW(bufA,lParam,wParam);
|
||||
BUFFER_FREE(bufA);
|
||||
return ret;
|
||||
}
|
||||
case CDM_SETCONTROLTEXT:
|
||||
case CDM_SETDEFEXT:
|
||||
{
|
||||
LPSTR strA;
|
||||
STACK_WtoA(lParam,strA);
|
||||
return DlgProc(hWnd,Msg,wParam,(LPARAM)strA);
|
||||
}
|
||||
default:
|
||||
return DlgProc(hWnd,Msg,wParam,lParam);
|
||||
}
|
||||
}
|
||||
|
||||
static void CALLBACK WinCreateEvent(
|
||||
HWINEVENTHOOK hWinEventHook, DWORD event, HWND hwnd, LONG idObject,
|
||||
LONG idChild, DWORD dwEventThread, DWORD dwmsEventTime
|
||||
)
|
||||
{
|
||||
//catch "Open"(Save) button creation, since on dialog window creation no dlgproc set yet
|
||||
if (GetDlgCtrlID(hwnd) == IDOK)
|
||||
{
|
||||
hwnd = GetParent(hwnd);
|
||||
//mark dialog created as unicode. really, everything should be marked unicode
|
||||
//with thunilay but then dialog may choke on unicode common controls
|
||||
if (GetClassWord(hwnd,GCW_ATOM) == DIALOG_ATOM
|
||||
&& GetProp(hwnd,OLDDLGPROCPROP) == NULL)
|
||||
{
|
||||
SetWindowUnicode(hwnd,TRUE);
|
||||
HANDLE h = (HANDLE)SetWindowLongA(hwnd,DWL_DLGPROC,(LONG)OpenSaveDlgProcW);
|
||||
SetProp(hwnd,OLDDLGPROCPROP,h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL WINAPI GetOpenOrSaveFileNameW(LPOPENFILENAMEW lpofn, BOOL IsSave)
|
||||
{
|
||||
BOOL ret;
|
||||
OPENFILENAMEA ofnA;
|
||||
memcpy(&ofnA,lpofn,sizeof(OPENFILENAME));
|
||||
//File filters
|
||||
STACK_WWtoAA(lpofn->lpstrFilter,ofnA.lpstrFilter);
|
||||
//Custom filter [NOBODY USES LOL]
|
||||
ofnA.lpstrCustomFilter = NULL;
|
||||
if (lpofn->lpstrCustomFilter && lpofn->nMaxCustFilter)
|
||||
{
|
||||
ofnA.nMaxCustFilter = lpofn->nMaxCustFilter * 2;
|
||||
ofnA.lpstrCustomFilter = StrAllocA(ofnA.nMaxCustFilter);
|
||||
WideCharToMultiByte(CP_ACP, 0, lpofn->lpstrCustomFilter, -1,
|
||||
ofnA.lpstrCustomFilter, ofnA.nMaxCustFilter, NULL, NULL);
|
||||
}
|
||||
//File path buffer - nMaxFile is byte count
|
||||
if (lpofn->lpstrFile)
|
||||
{
|
||||
ofnA.nMaxFile = lpofn->nMaxFile * 2;
|
||||
ofnA.lpstrFile = StrAllocA(ofnA.nMaxFile);
|
||||
WideCharToMultiByte(CP_ACP, 0, lpofn->lpstrFile, -1,
|
||||
ofnA.lpstrFile, ofnA.nMaxFile, "_", NULL);
|
||||
}
|
||||
//File title buffer - same
|
||||
if (lpofn->lpstrFileTitle)
|
||||
{
|
||||
ofnA.nMaxFileTitle = lpofn->nMaxFileTitle * 2;
|
||||
ofnA.lpstrFileTitle = StrAllocA(ofnA.nMaxFileTitle);
|
||||
}
|
||||
//Misc stuff
|
||||
STACK_WtoA(lpofn->lpstrInitialDir, ofnA.lpstrInitialDir);
|
||||
STACK_WtoA(lpofn->lpstrTitle, ofnA.lpstrTitle);
|
||||
STACK_WtoA(lpofn->lpstrDefExt, ofnA.lpstrDefExt);
|
||||
if (ofnA.Flags & OFN_ENABLETEMPLATE)
|
||||
STACK_WtoA(lpofn->lpTemplateName, ofnA.lpTemplateName);
|
||||
//Hook: build hook thunk on stack
|
||||
if (ofnA.Flags & OFN_ENABLEHOOK)
|
||||
{
|
||||
POFN_THUNK thunk;
|
||||
WM_HELPMSGSTRING = RegisterWindowMessage(HELPMSGSTRING);
|
||||
WM_FILEOKSTRING = RegisterWindowMessage(FILEOKSTRING);
|
||||
WM_SHAREVISTRING = RegisterWindowMessage(SHAREVISTRING);
|
||||
ALLOC_OFNTHUNK(thunk, lpofn, lpofn->lpfnHook, OFNHookProcWAdapter);
|
||||
ofnA.lpfnHook = (LPOFNHOOKPROC)thunk;
|
||||
}
|
||||
//Set up eventhook to make dialog unicode
|
||||
HWINEVENTHOOK eventhook = SetWinEventHook(EVENT_OBJECT_CREATE,
|
||||
EVENT_OBJECT_CREATE, GetModuleHandle("USER32.DLL"),
|
||||
(WINEVENTPROC)WinCreateEvent, GetCurrentProcessId(),
|
||||
GetCurrentThreadId(), WINEVENT_INCONTEXT);
|
||||
|
||||
if (IsSave)
|
||||
ret = GetSaveFileNameA_fix(&ofnA);
|
||||
else
|
||||
ret = GetOpenFileNameA_fix(&ofnA);
|
||||
|
||||
UnhookWinEvent(eventhook);
|
||||
|
||||
if (ret)
|
||||
{
|
||||
//copy stuff back
|
||||
lpofn->nFilterIndex = ofnA.nFilterIndex;
|
||||
lpofn->Flags = ofnA.Flags;
|
||||
//translate buffers back
|
||||
if (ofnA.lpstrCustomFilter)
|
||||
MultiByteToWideChar(CP_ACP, 0, ofnA.lpstrCustomFilter, -1,
|
||||
lpofn->lpstrCustomFilter, lpofn->nMaxCustFilter);
|
||||
if (ofnA.lpstrFile)
|
||||
{
|
||||
if (ofnA.Flags & (OFN_EXPLORER|OFN_ALLOWMULTISELECT))
|
||||
{
|
||||
//many files could be selected, convert \0-separated list
|
||||
MultiByteToWideChar(CP_ACP, 0, ofnA.lpstrFile,
|
||||
strlenAA(ofnA.lpstrFile), lpofn->lpstrFile, lpofn->nMaxFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
MultiByteToWideChar(CP_ACP, 0, ofnA.lpstrFile, -1,
|
||||
lpofn->lpstrFile, lpofn->nMaxFile);
|
||||
}
|
||||
//translate buffer offsets
|
||||
lpofn->nFileOffset = MultiByteToWideChar(CP_ACP, 0, ofnA.lpstrFile,
|
||||
ofnA.nFileOffset, NULL, 0);
|
||||
lpofn->nFileExtension = MultiByteToWideChar(CP_ACP, 0, ofnA.lpstrFile,
|
||||
ofnA.nFileExtension, NULL, 0);
|
||||
}
|
||||
if (ofnA.lpstrFileTitle)
|
||||
MultiByteToWideChar(CP_ACP, 0, ofnA.lpstrFileTitle, -1,
|
||||
lpofn->lpstrFileTitle, lpofn->nMaxFileTitle);
|
||||
}
|
||||
else //function failed
|
||||
{
|
||||
//buffer too small? lpstrFile contains proper size
|
||||
if ( CommDlgExtendedError() == FNERR_BUFFERTOOSMALL )
|
||||
*(WORD*)lpofn->lpstrFile = *(WORD*)ofnA.lpstrFile;
|
||||
}
|
||||
//free buffers
|
||||
StrFree(ofnA.lpstrCustomFilter);
|
||||
StrFree(ofnA.lpstrFile);
|
||||
StrFree(ofnA.lpstrFileTitle);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetSaveFileNameW_new=GetSaveFileNameW */
|
||||
BOOL WINAPI GetSaveFileNameW_new(LPOPENFILENAMEW lpofn)
|
||||
{
|
||||
return GetOpenOrSaveFileNameW(lpofn,TRUE);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetOpenFileNameW_new=GetOpenFileNameW */
|
||||
BOOL WINAPI GetOpenFileNameW_new(LPOPENFILENAMEW lpofn)
|
||||
{
|
||||
return GetOpenOrSaveFileNameW(lpofn,FALSE);
|
||||
}
|
155
apilibs/kexbasen/comdlg32/opensavefile.h
Executable file
155
apilibs/kexbasen/comdlg32/opensavefile.h
Executable file
@ -0,0 +1,155 @@
|
||||
/*
|
||||
* 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 <malloc.h>
|
||||
#include "common.h"
|
||||
#include "kexcoresdk.h"
|
||||
|
||||
/*
|
||||
* stlenAA: returns length of string list, including terminators;
|
||||
* strings are separated by \0, terminated by \0\0.
|
||||
*/
|
||||
static int strlenAA(LPSTR strAA)
|
||||
{
|
||||
int len = 2;
|
||||
while (*(WORD*)strAA)
|
||||
{
|
||||
len++;
|
||||
strAA++;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
/*
|
||||
* stlenWW: same as for strlenAA, but for wide string list
|
||||
*/
|
||||
static int strlenWW(LPWSTR strWW)
|
||||
{
|
||||
int len = 2;
|
||||
while (*(DWORD*)strWW)
|
||||
{
|
||||
len++;
|
||||
strWW++;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
//W<->A macros
|
||||
#define MAX_STACK 512
|
||||
|
||||
//Out macros: allocate buffer, call W>-<A function, convert A<->W
|
||||
#define ABUFFER_ALLOC(buffer,len) \
|
||||
int buffer##size = ((len+1) * 2); \
|
||||
LPSTR buffer##heap = NULL; \
|
||||
if (buffer##size>MAX_STACK) \
|
||||
{ \
|
||||
buffer##heap = (LPSTR)HeapAlloc(GetProcessHeap(),0,buffer##size); \
|
||||
buffer = buffer##heap; \
|
||||
} \
|
||||
else \
|
||||
buffer = (LPSTR)alloca( buffer##size ); \
|
||||
buffer[0]='\0'; \
|
||||
buffer[len]='\0'; \
|
||||
buffer[buffer##size-1]='\0';
|
||||
|
||||
#define WBUFFER_ALLOC(buffer,len) \
|
||||
int buffer##size = ((len+1) * sizeof(WCHAR)); \
|
||||
LPWSTR buffer##heap = NULL; \
|
||||
if (buffer##size>MAX_STACK) \
|
||||
{ \
|
||||
buffer##heap = (LPWSTR)HeapAlloc(GetProcessHeap(),0,buffer##size); \
|
||||
buffer = buffer##heap; \
|
||||
} \
|
||||
else \
|
||||
buffer = (LPWSTR)alloca( buffer##size ); \
|
||||
buffer[0]='\0'; \
|
||||
buffer[len]='\0';
|
||||
|
||||
#define ABUFFER_toW(bufferA,bufferW,lenW) \
|
||||
MultiByteToWideChar(CP_ACP, 0, bufferA, -1, (LPWSTR)bufferW, lenW);
|
||||
#define WBUFFER_toA(bufferW,bufferA,lenA) \
|
||||
WideCharToMultiByte(CP_ACP, 0, bufferW, -1, (LPSTR)bufferA, lenA, NULL, NULL);
|
||||
|
||||
#define BUFFER_FREE(buffer) \
|
||||
if ( buffer##heap ) HeapFree(GetProcessHeap(),0,buffer##heap); \
|
||||
|
||||
//In macros: allocate buffer on stack, convert input
|
||||
#define STACK_WWtoAA(strWW,strAA) \
|
||||
strAA = (LPSTR)strWW; \
|
||||
if (HIWORD(strWW)) \
|
||||
{ \
|
||||
int c = strlenWW((LPWSTR)strWW); \
|
||||
strAA = (LPSTR)alloca(c*2); \
|
||||
WideCharToMultiByte(CP_ACP, 0, (LPWSTR)strWW, c, (LPSTR)strAA, c*2, NULL, NULL); \
|
||||
}
|
||||
|
||||
|
||||
//misc
|
||||
#define StrAllocA(size) (LPSTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,size)
|
||||
#define StrFree(ptr) HeapFree(GetProcessHeap(),0,ptr)
|
||||
|
||||
BOOL WINAPI GetSaveFileNameA_fix(LPOPENFILENAMEA lpofn);
|
||||
BOOL WINAPI GetOpenFileNameA_fix(LPOPENFILENAMEA lpofn);
|
||||
|
||||
#define DIALOG_ATOM (ATOM)0x8002
|
||||
|
||||
typedef void (* SWU) (HWND, BOOL);
|
||||
static SWU SetWindowUnicode_dld;
|
||||
|
||||
static void SetWindowUnicode(HWND hwnd, BOOL bUnicode)
|
||||
{
|
||||
if (!SetWindowUnicode_dld)
|
||||
SetWindowUnicode_dld = (SWU)kexGetProcAddress(GetModuleHandle("KEXBASES.DLL"),"SetWindowUnicode");
|
||||
SetWindowUnicode_dld(hwnd,bUnicode);
|
||||
}
|
||||
|
||||
#define OLDDLGPROCPROP "kex.dlgproc"
|
||||
|
||||
#define pop_eax_code 0x58
|
||||
#define push_eax_code 0x50
|
||||
#define push_func_code 0x68
|
||||
#define jmp_func_code 0xE9
|
||||
|
||||
#include <pshpack1.h>
|
||||
typedef struct
|
||||
{
|
||||
BYTE pop_eax; /* pop eax (return address) */
|
||||
BYTE push_param; /* push $param */
|
||||
LPOPENFILENAMEW lpofn;
|
||||
BYTE push_func; /* push $proc */
|
||||
LPOFNHOOKPROC proc;
|
||||
BYTE push_eax; /* push eax */
|
||||
BYTE jmp_func; /* jmp relay*/
|
||||
DWORD relay_offset; /* relative func addr */
|
||||
} OFN_THUNK, *POFN_THUNK;
|
||||
|
||||
#define ALLOC_OFNTHUNK(thunk,ofn,hook,func) \
|
||||
thunk = (POFN_THUNK)alloca(sizeof(OFN_THUNK)); \
|
||||
thunk->pop_eax = pop_eax_code; \
|
||||
thunk->push_param = push_func_code; \
|
||||
thunk->lpofn = ofn; \
|
||||
thunk->push_func = push_func_code; \
|
||||
thunk->proc = hook; \
|
||||
thunk->push_eax = push_eax_code; \
|
||||
thunk->jmp_func = jmp_func_code; \
|
||||
thunk->relay_offset = (DWORD)func - (DWORD)&thunk->relay_offset - sizeof(DWORD)
|
||||
|
||||
#include <poppack.h>
|
@ -25,8 +25,6 @@ FORWARD_TO_UNICOWS(ChooseColorW);
|
||||
FORWARD_TO_UNICOWS(ChooseFontW);
|
||||
FORWARD_TO_UNICOWS(FindTextW);
|
||||
FORWARD_TO_UNICOWS(GetFileTitleW);
|
||||
FORWARD_TO_UNICOWS(GetOpenFileNameW);
|
||||
FORWARD_TO_UNICOWS(GetSaveFileNameW);
|
||||
FORWARD_TO_UNICOWS(PageSetupDlgW);
|
||||
FORWARD_TO_UNICOWS(PrintDlgW);
|
||||
FORWARD_TO_UNICOWS(ReplaceTextW);
|
||||
|
@ -1,118 +0,0 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, 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 __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);
|
||||
|
||||
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
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define UNIMPL_FUNC(name,params) \
|
||||
__asm__( ".text\n" \
|
||||
".globl _" #name "_stub@0\n" \
|
||||
"_" #name "_stub@0:\n\t" \
|
||||
"xor %eax, %eax\n\t" \
|
||||
"movb $" #params ", %cl\n\t" \
|
||||
"jmp _CommonUnimpStub@0\n\t" \
|
||||
)
|
||||
#else
|
||||
#define UNIMPL_FUNC(name,params) \
|
||||
int __declspec(naked) __stdcall name##_stub() \
|
||||
{ \
|
||||
__asm xor eax,eax \
|
||||
__asm mov cl, params \
|
||||
__asm jmp CommonUnimpStub \
|
||||
}
|
||||
#endif
|
||||
|
||||
#define AtoW(str, bsize) MultiByteToWideChar(CP_ACP, 0, str##A, -1, str##W, bsize)
|
||||
#define WtoA(str, bsize) WideCharToMultiByte(CP_ACP, 0, str##W, -1, str##A, bsize, NULL, NULL)
|
||||
|
||||
#define _ALLOC_WtoA(str) \
|
||||
const WCHAR* p; \
|
||||
int c; \
|
||||
for (p = str##W ; *p ; p++); \
|
||||
c = p - str##W + 1; \
|
||||
c *= acp_mcs; \
|
||||
str##A = (char*) alloca(c); \
|
||||
WtoA(str, c)
|
||||
|
||||
|
||||
#define ALLOC_WtoA(str) \
|
||||
char* str##A; \
|
||||
if (str##W) \
|
||||
{ \
|
||||
_ALLOC_WtoA(str); \
|
||||
} \
|
||||
else str##A = NULL
|
||||
|
||||
#define ALLOC_A(str, cnt) \
|
||||
char* str##A = str##W ? ((char*) alloca(cnt)) : NULL
|
||||
|
||||
#define ABUFtoW(str, inbsize, outbsize) \
|
||||
MultiByteToWideChar(CP_ACP, 0, str##A, inbsize, str##W, outbsize)
|
||||
|
||||
#define file_GetCP() \
|
||||
UINT file_CP = AreFileApisANSI() ? CP_ACP : CP_OEMCP
|
||||
#define file_AtoW(str, bsize) MultiByteToWideChar(file_CP, 0, str##A, -1, str##W, bsize)
|
||||
#define file_WtoA(str, bsize) WideCharToMultiByte(file_CP, 0, str##W, -1, str##A, bsize, "_", NULL); \
|
||||
str##A = file_fixWprefix(str##A)
|
||||
|
||||
#define file_ALLOC_WtoA(str) \
|
||||
char* str##A; \
|
||||
if (str##W) \
|
||||
{ \
|
||||
const WCHAR* p; \
|
||||
int c; \
|
||||
for (p = str##W ; *p ; p++); \
|
||||
c = p - str##W + 1; \
|
||||
c *= acp_mcs; \
|
||||
str##A = (char*) alloca(c); \
|
||||
file_WtoA(str, c); \
|
||||
} \
|
||||
else str##A = NULL
|
||||
|
||||
#define file_ABUFtoW(str, cntsrc, bsize) \
|
||||
MultiByteToWideChar(file_CP, 0, str##A, cntsrc, str##W, bsize)
|
||||
|
||||
#endif
|
@ -9,3 +9,4 @@ winspool
|
||||
shfolder
|
||||
winmm
|
||||
ws2_32
|
||||
ole32
|
||||
|
@ -33,7 +33,7 @@ ScriptCache::~ScriptCache()
|
||||
DeleteCriticalSection(&cs);
|
||||
}
|
||||
|
||||
SCRIPT_CACHE ScriptCache::GetCache(HFONT hFont)
|
||||
SCRIPT_CACHE ScriptCache::GetCache(FONTUID hFont)
|
||||
{
|
||||
list<FONTCACHE>::const_iterator it;
|
||||
for (it = cache.begin(); it != cache.end(); it++)
|
||||
@ -44,7 +44,7 @@ SCRIPT_CACHE ScriptCache::GetCache(HFONT hFont)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ScriptCache::SetCache(HFONT hFont,SCRIPT_CACHE newcache)
|
||||
void ScriptCache::SetCache(FONTUID hFont,SCRIPT_CACHE newcache)
|
||||
{
|
||||
list<FONTCACHE>::iterator it;
|
||||
for (it = cache.begin(); it != cache.end(); it++)
|
||||
@ -73,22 +73,6 @@ void ScriptCache::SetCache(HFONT hFont,SCRIPT_CACHE newcache)
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptCache::ResetCache(HFONT hFont)
|
||||
{
|
||||
Lock();
|
||||
list<FONTCACHE>::iterator it;
|
||||
for (it = cache.begin(); it != cache.end(); it++)
|
||||
{
|
||||
if (it->hFont == hFont)
|
||||
{
|
||||
ScriptFreeCache(&it->cache);
|
||||
cache.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
Unlock();
|
||||
}
|
||||
|
||||
void ScriptCache::Lock()
|
||||
{
|
||||
EnterCriticalSection(&cs);
|
||||
|
@ -30,9 +30,11 @@
|
||||
|
||||
#define MAXSCRIPTCACHESIZE 10
|
||||
|
||||
typedef DWORD FONTUID;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HFONT hFont;
|
||||
FONTUID hFont;
|
||||
SCRIPT_CACHE cache;
|
||||
} FONTCACHE, *PFONTCACHE;
|
||||
|
||||
@ -43,9 +45,8 @@ class ScriptCache
|
||||
public:
|
||||
static ScriptCache instance;
|
||||
~ScriptCache();
|
||||
SCRIPT_CACHE GetCache(HFONT hFont);
|
||||
void SetCache(HFONT hFont, SCRIPT_CACHE newcache);
|
||||
void ResetCache(HFONT hFont);
|
||||
SCRIPT_CACHE GetCache(FONTUID hFont);
|
||||
void SetCache(FONTUID hFont, SCRIPT_CACHE newcache);
|
||||
void Lock();
|
||||
void Unlock();
|
||||
|
||||
|
@ -22,17 +22,28 @@
|
||||
|
||||
#include <malloc.h>
|
||||
#include <windows.h>
|
||||
#include "common.h"
|
||||
#include <usp10.h>
|
||||
#include "ScriptCache.h"
|
||||
#include "k32ord.h"
|
||||
#include "../../kexbases/Gdi32/GdiObjects.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
__declspec(dllexport)
|
||||
void DeleteUSPFontCache(HFONT hFont)
|
||||
static DWORD g_GdiBase;
|
||||
BOOL InitUberGDI(void)
|
||||
{
|
||||
ScriptCache::instance.ResetCache(hFont);
|
||||
g_GdiBase = MapSL( LoadLibrary16("gdi") << 16 );
|
||||
return (BOOL)g_GdiBase;
|
||||
}
|
||||
|
||||
//grab GDI object number to distinguish fonts
|
||||
//don't do strict validation or locking since
|
||||
//dc font can't move or vanish when selected
|
||||
FONTUID GetHDCFontUID(HDC hdc)
|
||||
{
|
||||
WORD wFont = (WORD)GetCurrentObject(hdc,OBJ_FONT);
|
||||
if (wFont < 0x80) return 0;
|
||||
DWORD* high = (DWORD*)(g_GdiBase + GDIHEAP32BASE + wFont);
|
||||
PGDIOBJ16 fntobj = (PGDIOBJ16)(g_GdiBase + *high);
|
||||
return fntobj->dwNumber;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetGlyphIndicesW_new=GetGlyphIndicesW */
|
||||
@ -47,7 +58,7 @@ int WINAPI GetGlyphIndicesW_new(
|
||||
HRESULT result;
|
||||
if (!hdc || !pgi || (UINT)lpstr<0xFFFFu || !c) return GDI_ERROR;
|
||||
ScriptCache::instance.Lock();
|
||||
HFONT hFont = (HFONT)GetCurrentObject(hdc,OBJ_FONT);
|
||||
FONTUID hFont = GetHDCFontUID(hdc);
|
||||
SCRIPT_CACHE cache = ScriptCache::instance.GetCache(hFont);
|
||||
result = ScriptGetCMap(hdc,&cache,lpstr,c,0,pgi);
|
||||
if ( !( result == S_OK || result == S_FALSE ) )
|
||||
@ -143,7 +154,7 @@ BOOL WINAPI GetTextExtentExPointI_new(
|
||||
}
|
||||
|
||||
ScriptCache::instance.Lock();
|
||||
HFONT hFont = (HFONT)GetCurrentObject(hdc,OBJ_FONT);
|
||||
FONTUID hFont = GetHDCFontUID(hdc);
|
||||
SCRIPT_CACHE cache = ScriptCache::instance.GetCache(hFont);
|
||||
|
||||
//in UberKern, ScriptPlace was used. However, it's too costly...
|
||||
@ -200,7 +211,7 @@ BOOL WINAPI GetCharWidthI_new(
|
||||
}
|
||||
|
||||
ScriptCache::instance.Lock();
|
||||
HFONT hFont = (HFONT)GetCurrentObject(hdc,OBJ_FONT);
|
||||
FONTUID hFont = GetHDCFontUID(hdc);
|
||||
SCRIPT_CACHE cache = ScriptCache::instance.GetCache(hFont);
|
||||
|
||||
if ( !pgi ) //cgi glyphs starting giFirst
|
||||
@ -247,7 +258,7 @@ BOOL WINAPI GetCharABCWidthsI_new(
|
||||
}
|
||||
|
||||
ScriptCache::instance.Lock();
|
||||
HFONT hFont = (HFONT)GetCurrentObject(hdc,OBJ_FONT);
|
||||
FONTUID hFont = GetHDCFontUID(hdc);
|
||||
SCRIPT_CACHE cache = ScriptCache::instance.GetCache(hFont);
|
||||
|
||||
if ( !pgi ) //cgi glyphs starting giFirst
|
||||
|
@ -23,9 +23,11 @@
|
||||
#include "kexcoresdk.h"
|
||||
#include "_gdi32_apilist.h"
|
||||
|
||||
BOOL InitUberGDI(void);
|
||||
|
||||
BOOL init_gdi32()
|
||||
{
|
||||
return TRUE;
|
||||
return InitUberGDI();
|
||||
}
|
||||
|
||||
static const apilib_named_api gdi32_named_apis[] =
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <windows.h>
|
||||
#include "k32ord.h"
|
||||
#include "kexcoresdk.h"
|
||||
#include "../../../core/structs.h"
|
||||
#include "kstructs.h"
|
||||
|
||||
/*
|
||||
* Design note:
|
||||
@ -62,15 +62,6 @@ static CRITICAL_SECTION* find_TlsLock()
|
||||
return *(CRITICAL_SECTION**)((DWORD) pTlsAlloc + 2);
|
||||
}
|
||||
|
||||
static inline
|
||||
PDB98* get_pdb(void)
|
||||
{
|
||||
TIB98* tib;
|
||||
__asm mov eax, fs:18h;
|
||||
__asm mov tib, eax;
|
||||
return tib->pProcess;
|
||||
}
|
||||
|
||||
/* initialization */
|
||||
BOOL init_exttls(void)
|
||||
{
|
||||
|
@ -201,6 +201,14 @@ SOURCE=.\comdlg32\openfilename_fix.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\comdlg32\opensavefile.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\comdlg32\opensavefile.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\comdlg32\unicomdlg32.c
|
||||
# End Source File
|
||||
# End Group
|
||||
@ -225,6 +233,10 @@ SOURCE=.\shell32\SHBindToParent.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\shell32\SHCreateDirectoryEx.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\shell32\SHGetFolderLocation.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -233,7 +245,7 @@ SOURCE=.\shell32\SHGetFolderPath.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\shell32\SHGetSpecialFolder_fix.c
|
||||
SOURCE=.\shell32\SHGetSpecialFolder.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@ -257,6 +269,10 @@ SOURCE=.\rpcrt4\_rpcrt4_apilist.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\rpcrt4\NdrDllGetClassObject.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\rpcrt4\unirpcrt4.c
|
||||
# End Source File
|
||||
# End Group
|
||||
@ -332,9 +348,25 @@ SOURCE=.\ws2_32\_ws2_32_apilist.h
|
||||
SOURCE=.\ws2_32\addinfo.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "ole32"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\common.c
|
||||
SOURCE=.\ole32\_ole32_apilist.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ole32\_ole32_apilist.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ole32\CoWaitForMultipleHandles.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\common\common.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@ -436,7 +468,7 @@ SOURCE=.\unifwd.c
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\common.h
|
||||
SOURCE=..\..\common\common.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
|
@ -33,9 +33,10 @@
|
||||
#include "shfolder/_shfolder_apilist.h"
|
||||
#include "winmm/_winmm_apilist.h"
|
||||
#include "ws2_32/_ws2_32_apilist.h"
|
||||
#include "ole32/_ole32_apilist.h"
|
||||
//#include "/__apilist.h"
|
||||
|
||||
static apilib_api_table api_table[12];
|
||||
static apilib_api_table api_table[13];
|
||||
|
||||
static void fill_apitable()
|
||||
{
|
||||
@ -50,6 +51,7 @@ static void fill_apitable()
|
||||
api_table[8] = apitable_shfolder;
|
||||
api_table[9] = apitable_winmm;
|
||||
api_table[10] = apitable_ws2_32;
|
||||
api_table[11] = apitable_ole32;
|
||||
//last entry is null terminator
|
||||
}
|
||||
|
||||
@ -65,12 +67,14 @@ static BOOL init()
|
||||
{
|
||||
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();
|
||||
&& init_winspool() && init_shfolder() && init_winmm() && init_ws2_32()
|
||||
&& init_ole32();
|
||||
}
|
||||
|
||||
static void uninit()
|
||||
{
|
||||
uninit_kernel32();
|
||||
uninit_shell32();
|
||||
}
|
||||
|
||||
static void detach()
|
||||
|
164
apilibs/kexbasen/ole32/CoWaitForMultipleHandles.c
Executable file
164
apilibs/kexbasen/ole32/CoWaitForMultipleHandles.c
Executable file
@ -0,0 +1,164 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright 2010, Tihiy
|
||||
*
|
||||
* Copyright 1995 Martin von Loewis
|
||||
* Copyright 1998 Justin Bradford
|
||||
* Copyright 1999 Francis Beaudet
|
||||
* Copyright 1999 Sylvain St-Germain
|
||||
* Copyright 2002 Marcus Meissner
|
||||
* Copyright 2004 Mike Hearn
|
||||
* Copyright 2005-2006 Robert Shearman (for CodeWeavers)
|
||||
*
|
||||
* 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 COBJMACROS
|
||||
#define CINTERFACE
|
||||
#include <windows.h>
|
||||
#include "kexcoresdk.h"
|
||||
|
||||
#define COFLAGS_APARTMENTTHREADED 0x80
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DWORD Unknown; //+0x00
|
||||
DWORD dwCOMFlags; //+0x04
|
||||
BYTE filler[0x40]; //+0x08
|
||||
IMessageFilter *filter; //+0x48
|
||||
} APARTMENT, *PAPARTMENT;
|
||||
|
||||
|
||||
static PAPARTMENT COM_CurrentApt()
|
||||
{
|
||||
DWORD** ppdwTlsIndex = (DWORD**)
|
||||
( (DWORD)kexGetProcAddress(GetModuleHandle("OLE32.DLL"),"CoGetState")+2 );
|
||||
return (PAPARTMENT)TlsGetValue(**ppdwTlsIndex);
|
||||
}
|
||||
|
||||
BOOL CALLBACK FindCOMWindow( HWND hwnd, LPARAM lParam )
|
||||
{
|
||||
char wndname[200];
|
||||
if ( GetWindowTextA(hwnd,wndname,200) && strcmp(wndname,"OleMainThreadWndName") == 0
|
||||
&& (HINSTANCE)GetWindowLongA(hwnd,GWL_HINSTANCE) == GetModuleHandle("OLE32.DLL") )
|
||||
{
|
||||
*(PHANDLE)lParam = hwnd;
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* processes COM messages, returns FALSE if thread quits */
|
||||
static BOOL COM_PumpMessages()
|
||||
{
|
||||
HWND comWindow = NULL;
|
||||
EnumThreadWindows(GetCurrentThreadId(),FindCOMWindow,(LPARAM)&comWindow);
|
||||
MSG msg;
|
||||
BOOL haveMsgs =
|
||||
PeekMessageA(&msg, comWindow, WM_USER, WM_APP - 1, PM_REMOVE|PM_NOYIELD) ||
|
||||
/* next retrieve other messages necessary for the app to remain responsive */
|
||||
PeekMessageA(&msg, NULL, WM_DDE_FIRST, WM_DDE_LAST, PM_REMOVE|PM_NOYIELD) ||
|
||||
PeekMessageA(&msg, NULL, 0, 0, PM_QS_PAINT|PM_QS_SENDMESSAGE|PM_REMOVE|PM_NOYIELD);
|
||||
if (haveMsgs)
|
||||
{
|
||||
DispatchMessage(&msg);
|
||||
if (msg.message == WM_QUIT) //resend
|
||||
{
|
||||
PostQuitMessage(msg.wParam);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* MAKE_EXPORT CoWaitForMultipleHandles_new=CoWaitForMultipleHandles */
|
||||
HRESULT WINAPI CoWaitForMultipleHandles_new(
|
||||
DWORD dwFlags,
|
||||
DWORD dwTimeout,
|
||||
ULONG cHandles,
|
||||
LPHANDLE pHandles,
|
||||
LPDWORD lpdwindex
|
||||
)
|
||||
{
|
||||
if (!pHandles || !lpdwindex)
|
||||
return E_INVALIDARG;
|
||||
|
||||
HRESULT hr = S_OK;
|
||||
DWORD start_time = GetTickCount();
|
||||
PAPARTMENT apt = COM_CurrentApt();
|
||||
BOOL message_loop = apt && (apt->dwCOMFlags & COFLAGS_APARTMENTTHREADED);
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
DWORD now = GetTickCount();
|
||||
DWORD res;
|
||||
if (now - start_time > dwTimeout)
|
||||
{
|
||||
hr = RPC_S_CALLPENDING;
|
||||
break;
|
||||
}
|
||||
if (message_loop)
|
||||
{
|
||||
DWORD wait_flags = ((dwFlags & COWAIT_WAITALL) ? MWMO_WAITALL : 0) |
|
||||
((dwFlags & COWAIT_ALERTABLE ) ? MWMO_ALERTABLE : 0);
|
||||
|
||||
res = MsgWaitForMultipleObjectsEx(cHandles,pHandles,
|
||||
(dwTimeout == INFINITE) ? INFINITE : start_time + dwTimeout - now,
|
||||
QS_ALLINPUT,wait_flags);
|
||||
|
||||
if (res == WAIT_OBJECT_0 + cHandles) /* messages available */
|
||||
{
|
||||
if (apt->filter) /* call message filter */
|
||||
{
|
||||
//don't know htask or pendingtype :(
|
||||
DWORD handled = IMessageFilter_MessagePending(apt->filter,0,
|
||||
now-start_time,PENDINGTYPE_TOPLEVEL);
|
||||
if (handled == PENDINGMSG_CANCELCALL)
|
||||
hr = RPC_E_CALL_CANCELED;
|
||||
}
|
||||
message_loop = COM_PumpMessages();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
res = WaitForMultipleObjectsEx(cHandles,pHandles,
|
||||
(dwFlags & COWAIT_WAITALL) ? TRUE : FALSE,
|
||||
(dwTimeout == INFINITE) ? INFINITE : start_time + dwTimeout - now,
|
||||
(dwFlags & COWAIT_ALERTABLE) ? TRUE : FALSE);
|
||||
|
||||
}
|
||||
if (res < WAIT_OBJECT_0 + cHandles)
|
||||
{
|
||||
/* handle signaled, store index */
|
||||
*lpdwindex = (res - WAIT_OBJECT_0);
|
||||
break;
|
||||
}
|
||||
else if (res == WAIT_TIMEOUT)
|
||||
{
|
||||
hr = RPC_S_CALLPENDING;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
hr = E_UNEXPECTED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return hr;
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
* Copyright (C) 2010, Tihiy
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
@ -20,39 +20,26 @@
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "_ole32_apilist.h"
|
||||
|
||||
int acp_mcs;
|
||||
|
||||
static int GetMaxCharSize(UINT CodePage)
|
||||
BOOL init_ole32()
|
||||
{
|
||||
CPINFO cpi;
|
||||
if (!GetCPInfo(CodePage, &cpi))
|
||||
return 2;
|
||||
return cpi.MaxCharSize;
|
||||
}
|
||||
|
||||
BOOL common_init(void)
|
||||
{
|
||||
acp_mcs = GetMaxCharSize(CP_ACP);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
char* file_fixWprefix(char* in)
|
||||
static const apilib_named_api ole32_named_apis[] =
|
||||
{
|
||||
if (*(int *)in == 0x5c3f5c5c) //if (!strncmp(in, "\\?\", 4))
|
||||
{
|
||||
in += 4;
|
||||
if (*(int *)in == 0x5c434e55) //if (!strncmp(in, "UNC\", 4))
|
||||
{
|
||||
in += 2;
|
||||
*in = '\\';
|
||||
}
|
||||
}
|
||||
return in;
|
||||
}
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
|
||||
DECL_API("CoWaitForMultipleHandles", CoWaitForMultipleHandles_new),
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
|
||||
};
|
||||
|
||||
void fatal_error(const char* msg)
|
||||
#if 0
|
||||
static const apilib_unnamed_api ole32_ordinal_apis[] =
|
||||
{
|
||||
MessageBox(NULL, msg, "KernelEx error", MB_OK | MB_ICONERROR);
|
||||
ExitProcess(1);
|
||||
}
|
||||
/*** AUTOGENERATED APILIST ORDINAL EXPORTS BEGIN ***/
|
||||
/*** AUTOGENERATED APILIST ORDINAL EXPORTS END ***/
|
||||
};
|
||||
#endif
|
||||
|
||||
const apilib_api_table apitable_ole32 = DECL_TAB("OLE32.DLL", ole32_named_apis, 0 /*ole32_ordinal_apis*/);
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2010, Tihiy
|
||||
*
|
||||
* Copyright (C) 2008, Tihiy
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
@ -19,12 +19,16 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#ifndef _OLE32_APILIST_H
|
||||
#define _OLE32_APILIST_H
|
||||
|
||||
/* MAKE_EXPORT DeleteCriticalSection_new=DeleteCriticalSection */
|
||||
void WINAPI DeleteCriticalSection_new(PCRITICAL_SECTION lpCriticalSection)
|
||||
{
|
||||
//make DeleteCriticalSection not fail on deleted section
|
||||
byte* deleted = (byte*) lpCriticalSection;
|
||||
if (*deleted != 0) DeleteCriticalSection(lpCriticalSection);
|
||||
}
|
||||
#include "kexcoresdk.h"
|
||||
|
||||
BOOL init_ole32();
|
||||
extern const apilib_api_table apitable_ole32;
|
||||
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
|
||||
HRESULT WINAPI CoWaitForMultipleHandles_new(DWORD dwFlags, DWORD dwTimeout, ULONG cHandles, LPHANDLE pHandles, LPDWORD lpdwindex);
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
|
||||
|
||||
#endif
|
104
apilibs/kexbasen/rpcrt4/NdrDllGetClassObject.c
Executable file
104
apilibs/kexbasen/rpcrt4/NdrDllGetClassObject.c
Executable file
@ -0,0 +1,104 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
//PITA to compile alltogether right
|
||||
#define CINTERFACE
|
||||
#include <windows.h>
|
||||
#include <RpcProxy.h>
|
||||
#ifdef LOAD_TLB_AS_64BIT
|
||||
#undef LOAD_TLB_AS_64BIT
|
||||
#endif
|
||||
#ifdef LOAD_TLB_AS_32BIT
|
||||
#undef LOAD_TLB_AS_32BIT
|
||||
#endif
|
||||
#include <ndrtypes.h>
|
||||
#include "kexcoresdk.h"
|
||||
|
||||
static DWORD PageProtect(LPVOID lpAddress, DWORD flNewProtect)
|
||||
{
|
||||
DWORD flOldProtect;
|
||||
VirtualProtect(lpAddress,32,flNewProtect,&flOldProtect);
|
||||
return flOldProtect;
|
||||
}
|
||||
|
||||
static WORD PatchFormatString(PFORMAT_STRING pFormat)
|
||||
{
|
||||
//this header is fixed (read rpctypes.h)
|
||||
NDR_DCOM_OI2_PROC_HEADER hdr2;
|
||||
memcpy(&hdr2,pFormat,sizeof(hdr2));
|
||||
if (hdr2.Oi2Flags.HasExtensions) //uses nt5 extensions?? cut them!
|
||||
{
|
||||
hdr2.Oi2Flags.HasExtensions = FALSE;
|
||||
PNDR_PROC_HEADER_EXTS exts = (PNDR_PROC_HEADER_EXTS)(pFormat + sizeof(hdr2));
|
||||
WORD cutsize = exts->Size;
|
||||
DWORD oldproc = PageProtect((PVOID)pFormat,PAGE_READWRITE);
|
||||
memcpy((PVOID)((DWORD)pFormat+(DWORD)cutsize),&hdr2,sizeof(hdr2));
|
||||
PageProtect((PVOID)pFormat,oldproc);
|
||||
return cutsize;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void CheckStubInfo(const MIDL_SERVER_INFO* pServerInfo, ULONG DispatchCount )
|
||||
{
|
||||
if (pServerInfo && pServerInfo->pStubDesc && pServerInfo->pStubDesc->Version > NDR_VERSION_2_0)
|
||||
{
|
||||
//unconst and change ndr version to 2.0 as max 9x supports
|
||||
MIDL_STUB_DESC* pStubDesc = (MIDL_STUB_DESC*)pServerInfo->pStubDesc;
|
||||
DWORD oldprot = PageProtect((PVOID)&pStubDesc->Version,PAGE_READWRITE);
|
||||
pStubDesc->Version = NDR_VERSION_2_0;
|
||||
PageProtect((PVOID)&pStubDesc->Version,oldprot);
|
||||
//correct all dispatches (0,1,2 are provided by IUnknown_Proxy)
|
||||
for (ULONG i=3;i<DispatchCount;i++)
|
||||
{
|
||||
PFORMAT_STRING pFormat = pServerInfo->ProcString + pServerInfo->FmtStringOffset[i];
|
||||
WORD offset = PatchFormatString(pFormat);
|
||||
if (offset) //shift offsets in entry table
|
||||
{
|
||||
DBGPRINTF(("PatchFormatString: entry %d uses extensions, size %d",i,offset));
|
||||
oldprot = PageProtect((PVOID)&pServerInfo->FmtStringOffset[i],PAGE_READWRITE);
|
||||
*(WORD*)&pServerInfo->FmtStringOffset[i] += offset;
|
||||
PageProtect((PVOID)&pServerInfo->FmtStringOffset[i],oldprot);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT NdrDllGetClassObject_new=NdrDllGetClassObject */
|
||||
HRESULT WINAPI NdrDllGetClassObject_new( REFCLSID rclsid, REFIID riid, void **ppv,
|
||||
PVOID pVoidProxyFileList, const CLSID *pclsid,
|
||||
PVOID pVoidPSFactoryBuffer)
|
||||
{
|
||||
CStdPSFactoryBuffer *pPSFactoryBuffer = (CStdPSFactoryBuffer *)pVoidPSFactoryBuffer;
|
||||
const ProxyFileInfo **pProxyFileList = (const ProxyFileInfo **)pVoidProxyFileList;
|
||||
const ProxyFileInfo **pProxyFileListWalker = pProxyFileList;
|
||||
while (pProxyFileListWalker && *pProxyFileListWalker)
|
||||
{
|
||||
const PCInterfaceStubVtblList *pstubVtblList = (*pProxyFileListWalker)->pStubVtblList;
|
||||
while (pstubVtblList && *pstubVtblList)
|
||||
{
|
||||
CheckStubInfo((*pstubVtblList)->header.pServerInfo,(*pstubVtblList)->header.DispatchTableCount);
|
||||
pstubVtblList++;
|
||||
}
|
||||
pProxyFileListWalker++;
|
||||
}
|
||||
return NdrDllGetClassObject(rclsid,riid,ppv,pProxyFileList,pclsid,pPSFactoryBuffer);
|
||||
}
|
@ -31,6 +31,7 @@ BOOL init_rpcrt4()
|
||||
static const apilib_named_api rpcrt4_named_apis[] =
|
||||
{
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
|
||||
DECL_API("NdrDllGetClassObject", NdrDllGetClassObject_new),
|
||||
DECL_API("RpcStringFreeW", RpcStringFreeW_new),
|
||||
DECL_API("UuidFromStringW", UuidFromStringW_new),
|
||||
DECL_API("UuidToStringW", UuidToStringW_new),
|
||||
|
@ -29,6 +29,7 @@ BOOL init_rpcrt4();
|
||||
extern const apilib_api_table apitable_rpcrt4;
|
||||
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
|
||||
HRESULT WINAPI NdrDllGetClassObject_new(REFCLSID rclsid, REFIID riid, void **ppv, PVOID pVoidProxyFileList, const CLSID *pclsid, PVOID pVoidPSFactoryBuffer);
|
||||
RPC_STATUS RPC_ENTRY RpcStringFreeW_new(IN OUT unsigned short ** String);
|
||||
RPC_STATUS RPC_ENTRY UuidFromStringW_new(IN unsigned short * StringUuidW, OUT UUID * Uuid);
|
||||
RPC_STATUS RPC_ENTRY UuidToStringW_new(IN UUID * Uuid, OUT unsigned short ** StringUuid);
|
||||
|
50
apilibs/kexbasen/shell32/SHCreateDirectoryEx.c
Executable file
50
apilibs/kexbasen/shell32/SHCreateDirectoryEx.c
Executable file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#if defined(_WIN32_IE) && _WIN32_IE != 0x0601
|
||||
#undef _WIN32_IE
|
||||
#endif
|
||||
#define _WIN32_IE 0x0601
|
||||
#include <shlobj.h>
|
||||
#include "common.h"
|
||||
|
||||
/* SHCreateDirectory exists since 95 and ofc ANSI;
|
||||
* SHCreateDirectoryEx is in ME shell but no security anyway.
|
||||
*/
|
||||
|
||||
static inline SHCreateDirectoryA(HWND hwnd, LPCSTR pszPath)
|
||||
{
|
||||
return SHCreateDirectory(hwnd, (LPCWSTR)pszPath);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT SHCreateDirectoryExA_new=SHCreateDirectoryExA */
|
||||
int WINAPI SHCreateDirectoryExA_new(HWND hwnd, LPCSTR pszPathA, SECURITY_ATTRIBUTES *psa)
|
||||
{
|
||||
return SHCreateDirectoryA(hwnd, pszPathA);
|
||||
}
|
||||
|
||||
|
||||
/* MAKE_EXPORT SHCreateDirectoryExW_new=SHCreateDirectoryExW */
|
||||
int WINAPI SHCreateDirectoryExW_new(HWND hwnd, LPCWSTR pszPathW, SECURITY_ATTRIBUTES *psa)
|
||||
{
|
||||
ALLOC_WtoA(pszPath);
|
||||
return SHCreateDirectoryA(hwnd, pszPathA);
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2009, Xeno86
|
||||
* Copyright (C) 2009-2010, Xeno86, Tihiy
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
@ -24,15 +24,79 @@
|
||||
#include "kexcoresdk.h"
|
||||
#include "folderfix.h"
|
||||
|
||||
#include <pshpack1.h>
|
||||
typedef struct
|
||||
{
|
||||
BYTE jmp;
|
||||
DWORD func;
|
||||
} LONGJMP, *PLONGJMP;
|
||||
#include <poppack.h>
|
||||
|
||||
typedef HRESULT (WINAPI *SHGetFolderPathA_t)(HWND, int, HANDLE, DWORD, LPSTR);
|
||||
typedef HRESULT (WINAPI *SHGetFolderPathW_t)(HWND, int, HANDLE, DWORD, LPWSTR);
|
||||
|
||||
static PROC LoadShfolderProc(const char* proc)
|
||||
static HMODULE hShfolder;
|
||||
static HMODULE hShell32;
|
||||
|
||||
static SHGetFolderPathA_t SHGetFolderPathA_pfn = (SHGetFolderPathA_t)-1;
|
||||
static SHGetFolderPathW_t SHGetFolderPathW_pfn = (SHGetFolderPathW_t)-1;
|
||||
|
||||
static BYTE prev_entry[sizeof(LONGJMP)];
|
||||
|
||||
static BOOL APIENTRY shfolder_entry(HINSTANCE inst, DWORD reason, BOOL load_static)
|
||||
{
|
||||
if (reason == DLL_PROCESS_DETACH)
|
||||
{
|
||||
DBGPRINTF(("kexbasen: shfolder detached\n"));
|
||||
SHGetFolderPathA_pfn = (SHGetFolderPathA_t)-1;
|
||||
SHGetFolderPathW_pfn = (SHGetFolderPathW_t)-1;
|
||||
hShfolder = NULL;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Protection against buggy apps which call FreeLibrary on
|
||||
* a DLL handle too many times.
|
||||
*/
|
||||
static void protect_shfolder()
|
||||
{
|
||||
DWORD fold;
|
||||
DWORD fnew;
|
||||
DWORD entry_addr;
|
||||
PLONGJMP ljmp;
|
||||
DWORD dwShfolder = (DWORD) hShfolder;
|
||||
IMAGE_DOS_HEADER* dosh = (IMAGE_DOS_HEADER*) hShfolder;
|
||||
IMAGE_NT_HEADERS* nth = (IMAGE_NT_HEADERS*) (dwShfolder + dosh->e_lfanew);
|
||||
|
||||
entry_addr = dwShfolder + nth->OptionalHeader.AddressOfEntryPoint;
|
||||
memcpy(prev_entry, (PVOID) entry_addr, sizeof(LONGJMP));
|
||||
VirtualProtect((PVOID) entry_addr, sizeof(LONGJMP), PAGE_READWRITE, &fold);
|
||||
ljmp = (PLONGJMP) entry_addr;
|
||||
ljmp->jmp = 0xe9; //jmp near rel
|
||||
ljmp->func = (DWORD) shfolder_entry - (entry_addr + sizeof(LONGJMP));
|
||||
VirtualProtect((PVOID) entry_addr, sizeof(LONGJMP), fold, &fnew);
|
||||
}
|
||||
|
||||
static void unprotect_shfolder()
|
||||
{
|
||||
DWORD fold;
|
||||
DWORD fnew;
|
||||
DWORD entry_addr;
|
||||
DWORD dwShfolder = (DWORD) hShfolder;
|
||||
IMAGE_DOS_HEADER* dosh = (IMAGE_DOS_HEADER*) hShfolder;
|
||||
IMAGE_NT_HEADERS* nth = (IMAGE_NT_HEADERS*) (dwShfolder + dosh->e_lfanew);
|
||||
|
||||
entry_addr = dwShfolder + nth->OptionalHeader.AddressOfEntryPoint;
|
||||
VirtualProtect((PVOID) entry_addr, sizeof(LONGJMP), PAGE_READWRITE, &fold);
|
||||
memcpy((PVOID) entry_addr, prev_entry, sizeof(LONGJMP));
|
||||
VirtualProtect((PVOID) entry_addr, sizeof(LONGJMP), fold, &fnew);
|
||||
}
|
||||
|
||||
static PROC LoadShProc(LPCSTR proc)
|
||||
{
|
||||
static const char ShfolderFn[] = "SHFOLDER.DLL";
|
||||
static const char Shell32Fn[] = "SHELL32.DLL";
|
||||
static HMODULE hShfolder;
|
||||
static HMODULE hShell32;
|
||||
PROC ret = NULL;
|
||||
DWORD lasterr = GetLastError();
|
||||
|
||||
@ -45,19 +109,32 @@ static PROC LoadShfolderProc(const char* proc)
|
||||
if (!ret)
|
||||
{
|
||||
if (!hShfolder)
|
||||
{
|
||||
hShfolder = LoadLibrary(ShfolderFn);
|
||||
if (hShfolder) ret = kexGetProcAddress(hShfolder, proc);
|
||||
if (hShfolder)
|
||||
protect_shfolder();
|
||||
}
|
||||
if (hShfolder)
|
||||
ret = kexGetProcAddress(hShfolder, proc);
|
||||
}
|
||||
SetLastError(lasterr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT SHGetFolderPathA_new=SHGetFolderPathA */
|
||||
HRESULT WINAPI SHGetFolderPathA_new(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPSTR pszPath)
|
||||
void uninit_SHGetFolderPath()
|
||||
{
|
||||
if (!hShfolder) return;
|
||||
|
||||
unprotect_shfolder();
|
||||
hShfolder = NULL;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT SHGetFolderPathA_new=SHGetFolderPathA */
|
||||
HRESULT WINAPI SHGetFolderPathA_new(
|
||||
HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPSTR pszPath)
|
||||
{
|
||||
static SHGetFolderPathA_t SHGetFolderPathA_pfn = (SHGetFolderPathA_t)-1;
|
||||
if (SHGetFolderPathA_pfn == (void*)-1)
|
||||
SHGetFolderPathA_pfn = (SHGetFolderPathA_t) LoadShfolderProc("SHGetFolderPathA");
|
||||
SHGetFolderPathA_pfn = (SHGetFolderPathA_t) LoadShProc("SHGetFolderPathA");
|
||||
if (SHGetFolderPathA_pfn == NULL)
|
||||
return E_NOTIMPL;
|
||||
nFolder = folder_fix(nFolder);
|
||||
@ -65,11 +142,11 @@ HRESULT WINAPI SHGetFolderPathA_new(HWND hwndOwner, int nFolder, HANDLE hToken,
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT SHGetFolderPathW_new=SHGetFolderPathW */
|
||||
HRESULT WINAPI SHGetFolderPathW_new(HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
|
||||
HRESULT WINAPI SHGetFolderPathW_new(
|
||||
HWND hwndOwner, int nFolder, HANDLE hToken, DWORD dwFlags, LPWSTR pszPath)
|
||||
{
|
||||
static SHGetFolderPathW_t SHGetFolderPathW_pfn = (SHGetFolderPathW_t)-1;
|
||||
if (SHGetFolderPathW_pfn == (void*)-1)
|
||||
SHGetFolderPathW_pfn = (SHGetFolderPathW_t) LoadShfolderProc("SHGetFolderPathW");
|
||||
SHGetFolderPathW_pfn = (SHGetFolderPathW_t) LoadShProc("SHGetFolderPathW");
|
||||
if (SHGetFolderPathW_pfn == NULL)
|
||||
return E_NOTIMPL;
|
||||
nFolder = folder_fix(nFolder);
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2009, Xeno86
|
||||
* Copyright (C) 2010, Tihiy
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
@ -21,6 +22,16 @@
|
||||
|
||||
#include <shlobj.h>
|
||||
#include "folderfix.h"
|
||||
#include "common.h"
|
||||
|
||||
/* Win95 shell doesn't support SHGetSpecialFolderPathA/W so we don't use it;
|
||||
* it has SHGetSpecialFolderPath (@175) however which we link to.
|
||||
*/
|
||||
#ifdef SHGetSpecialFolderPath
|
||||
#undef SHGetSpecialFolderPath
|
||||
#endif
|
||||
SHSTDAPI_(BOOL) SHGetSpecialFolderPath(HWND hwndOwner, LPSTR lpszPath, int nFolder, BOOL fCreate);
|
||||
|
||||
|
||||
/* MAKE_EXPORT SHGetSpecialFolderLocation_fix=SHGetSpecialFolderLocation */
|
||||
HRESULT WINAPI SHGetSpecialFolderLocation_fix(HWND hwndOwner, int nFolder, LPVOID *_ppidl)
|
||||
@ -32,16 +43,23 @@ HRESULT WINAPI SHGetSpecialFolderLocation_fix(HWND hwndOwner, int nFolder, LPVOI
|
||||
return SHGetSpecialFolderLocation(hwndOwner, nFolder, ppidl);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT SHGetSpecialFolderPathA_fix=SHGetSpecialFolderPathA */
|
||||
BOOL WINAPI SHGetSpecialFolderPathA_fix(HWND hwndOwner, LPSTR lpszPath, int nFolder, BOOL fCreate)
|
||||
/* MAKE_EXPORT SHGetSpecialFolderPathA_new=SHGetSpecialFolderPathA */
|
||||
BOOL WINAPI SHGetSpecialFolderPathA_new(HWND hwndOwner, LPSTR lpszPath, int nFolder, BOOL fCreate)
|
||||
{
|
||||
nFolder = folder_fix(nFolder);
|
||||
return SHGetSpecialFolderPathA(hwndOwner, lpszPath, nFolder, fCreate);
|
||||
return SHGetSpecialFolderPath(hwndOwner, lpszPath, nFolder, fCreate);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT SHGetSpecialFolderPathW_fix=SHGetSpecialFolderPathW */
|
||||
BOOL WINAPI SHGetSpecialFolderPathW_fix(HWND hwndOwner, LPWSTR lpszPath, int nFolder, BOOL fCreate)
|
||||
/* MAKE_EXPORT SHGetSpecialFolderPathW_new=SHGetSpecialFolderPathW */
|
||||
BOOL WINAPI SHGetSpecialFolderPathW_new(HWND hwndOwner, LPWSTR lpszPathW, int nFolder, BOOL fCreate)
|
||||
{
|
||||
nFolder = folder_fix(nFolder);
|
||||
return SHGetSpecialFolderPathW(hwndOwner, lpszPath, nFolder, fCreate);
|
||||
char pathA[MAX_PATH];
|
||||
LPSTR lpszPathA = pathA;
|
||||
if (!lpszPathW)
|
||||
return E_INVALIDARG;
|
||||
*lpszPathW = L'\0';
|
||||
BOOL ret = SHGetSpecialFolderPathA_new(hwndOwner,lpszPathA,nFolder,fCreate);
|
||||
if (ret)
|
||||
AtoW(lpszPath,MAX_PATH);
|
||||
return ret;
|
||||
}
|
@ -23,11 +23,18 @@
|
||||
#include "kexcoresdk.h"
|
||||
#include "_shell32_apilist.h"
|
||||
|
||||
extern void uninit_SHGetFolderPath();
|
||||
|
||||
BOOL init_shell32()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void uninit_shell32()
|
||||
{
|
||||
uninit_SHGetFolderPath();
|
||||
}
|
||||
|
||||
static const apilib_named_api shell32_named_apis[] =
|
||||
{
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
|
||||
@ -37,6 +44,8 @@ static const apilib_named_api shell32_named_apis[] =
|
||||
DECL_API("FindExecutableW", FindExecutableW_fwd),
|
||||
DECL_API("SHBindToParent", SHBindToParent_new),
|
||||
DECL_API("SHBrowseForFolderW", SHBrowseForFolderW_fwd),
|
||||
DECL_API("SHCreateDirectoryExA", SHCreateDirectoryExA_new),
|
||||
DECL_API("SHCreateDirectoryExW", SHCreateDirectoryExW_new),
|
||||
DECL_API("SHFileOperationW", SHFileOperationW_fwd),
|
||||
DECL_API("SHGetFileInfoW", SHGetFileInfoW_fwd),
|
||||
DECL_API("SHGetFolderLocation", SHGetFolderLocation_new),
|
||||
@ -44,8 +53,8 @@ static const apilib_named_api shell32_named_apis[] =
|
||||
DECL_API("SHGetFolderPathW", SHGetFolderPathW_new),
|
||||
DECL_API("SHGetNewLinkInfoW", SHGetNewLinkInfoW_fwd),
|
||||
DECL_API("SHGetSpecialFolderLocation", SHGetSpecialFolderLocation_fix),
|
||||
DECL_API("SHGetSpecialFolderPathA", SHGetSpecialFolderPathA_fix),
|
||||
DECL_API("SHGetSpecialFolderPathW", SHGetSpecialFolderPathW_fix),
|
||||
DECL_API("SHGetSpecialFolderPathA", SHGetSpecialFolderPathA_new),
|
||||
DECL_API("SHGetSpecialFolderPathW", SHGetSpecialFolderPathW_new),
|
||||
DECL_API("SHParseDisplayName", SHParseDisplayName_new),
|
||||
DECL_API("ShellAboutW", ShellAboutW_fwd),
|
||||
DECL_API("ShellExecuteExW", ShellExecuteExW_fwd),
|
||||
|
@ -26,16 +26,19 @@
|
||||
#include "kexcoresdk.h"
|
||||
|
||||
BOOL init_shell32();
|
||||
void uninit_shell32();
|
||||
extern const apilib_api_table apitable_shell32;
|
||||
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
|
||||
HRESULT WINAPI SHBindToParent_new(LPCITEMIDLIST pidl, REFIID riid, VOID **ppv, LPCITEMIDLIST *ppidlLast);
|
||||
int WINAPI SHCreateDirectoryExA_new(HWND hwnd, LPCSTR pszPathA, SECURITY_ATTRIBUTES *psa);
|
||||
int WINAPI SHCreateDirectoryExW_new(HWND hwnd, LPCWSTR pszPathW, SECURITY_ATTRIBUTES *psa);
|
||||
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);
|
||||
HRESULT WINAPI SHGetSpecialFolderLocation_fix(HWND hwndOwner, int nFolder, LPVOID *_ppidl);
|
||||
BOOL WINAPI SHGetSpecialFolderPathA_fix(HWND hwndOwner, LPSTR lpszPath, int nFolder, BOOL fCreate);
|
||||
BOOL WINAPI SHGetSpecialFolderPathW_fix(HWND hwndOwner, LPWSTR lpszPath, int nFolder, BOOL fCreate);
|
||||
BOOL WINAPI SHGetSpecialFolderPathA_new(HWND hwndOwner, LPSTR lpszPath, int nFolder, BOOL fCreate);
|
||||
BOOL WINAPI SHGetSpecialFolderPathW_new(HWND hwndOwner, LPWSTR lpszPathW, int nFolder, BOOL fCreate);
|
||||
HRESULT WINAPI SHParseDisplayName_new(PCWSTR pszName, IBindCtx *pbc, LPITEMIDLIST *ppidl, SFGAOF sfgaoIn, SFGAOF *psfgaoOut);
|
||||
FWDPROC DragQueryFileW_fwd;
|
||||
FWDPROC ExtractIconExW_fwd;
|
||||
|
@ -31,11 +31,9 @@ BOOL init_user32()
|
||||
static const apilib_named_api user32_named_apis[] =
|
||||
{
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
|
||||
DECL_API("AppendMenuW", AppendMenuW_fwd),
|
||||
DECL_API("BroadcastSystemMessageW", BroadcastSystemMessageW_fwd),
|
||||
DECL_API("ChangeDisplaySettingsExW", ChangeDisplaySettingsExW_fwd),
|
||||
DECL_API("ChangeDisplaySettingsW", ChangeDisplaySettingsW_fwd),
|
||||
DECL_API("ChangeMenuW", ChangeMenuW_fwd),
|
||||
DECL_API("DdeCreateStringHandleW", DdeCreateStringHandleW_fwd),
|
||||
DECL_API("DdeInitializeW", DdeInitializeW_fwd),
|
||||
DECL_API("DdeQueryStringW", DdeQueryStringW_fwd),
|
||||
@ -65,7 +63,6 @@ static const apilib_named_api user32_named_apis[] =
|
||||
DECL_API("GetTabbedTextExtentW", GetTabbedTextExtentW_fwd),
|
||||
DECL_API("GrayStringW", GrayStringW_fwd),
|
||||
DECL_API("InsertMenuItemW", InsertMenuItemW_fwd),
|
||||
DECL_API("InsertMenuW", InsertMenuW_fwd),
|
||||
DECL_API("LoadAcceleratorsW", LoadAcceleratorsW_fwd),
|
||||
DECL_API("LoadBitmapW", LoadBitmapW_fwd),
|
||||
DECL_API("LoadCursorFromFileW", LoadCursorFromFileW_fwd),
|
||||
@ -73,12 +70,9 @@ static const apilib_named_api user32_named_apis[] =
|
||||
DECL_API("LoadIconW", LoadIconW_fwd),
|
||||
DECL_API("LoadImageW", LoadImageW_fwd),
|
||||
DECL_API("LoadKeyboardLayoutW", LoadKeyboardLayoutW_fwd),
|
||||
DECL_API("LoadMenuIndirectW", LoadMenuIndirectW_fwd),
|
||||
DECL_API("LoadMenuW", LoadMenuW_fwd),
|
||||
DECL_API("MapVirtualKeyExW", MapVirtualKeyExW_fwd),
|
||||
DECL_API("MapVirtualKeyW", MapVirtualKeyW_fwd),
|
||||
DECL_API("MessageBoxIndirectW", MessageBoxIndirectW_fwd),
|
||||
DECL_API("ModifyMenuW", ModifyMenuW_fwd),
|
||||
DECL_API("RegisterClipboardFormatW", RegisterClipboardFormatW_fwd),
|
||||
DECL_API("RegisterDeviceNotificationW", RegisterDeviceNotificationW_fwd),
|
||||
DECL_API("RegisterWindowMessageW", RegisterWindowMessageW_fwd),
|
||||
|
@ -28,11 +28,9 @@ BOOL init_user32();
|
||||
extern const apilib_api_table apitable_user32;
|
||||
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
|
||||
FWDPROC AppendMenuW_fwd;
|
||||
FWDPROC BroadcastSystemMessageW_fwd;
|
||||
FWDPROC ChangeDisplaySettingsExW_fwd;
|
||||
FWDPROC ChangeDisplaySettingsW_fwd;
|
||||
FWDPROC ChangeMenuW_fwd;
|
||||
FWDPROC DdeCreateStringHandleW_fwd;
|
||||
FWDPROC DdeInitializeW_fwd;
|
||||
FWDPROC DdeQueryStringW_fwd;
|
||||
@ -62,7 +60,6 @@ FWDPROC GetPropW_fwd;
|
||||
FWDPROC GetTabbedTextExtentW_fwd;
|
||||
FWDPROC GrayStringW_fwd;
|
||||
FWDPROC InsertMenuItemW_fwd;
|
||||
FWDPROC InsertMenuW_fwd;
|
||||
FWDPROC LoadAcceleratorsW_fwd;
|
||||
FWDPROC LoadBitmapW_fwd;
|
||||
FWDPROC LoadCursorFromFileW_fwd;
|
||||
@ -70,12 +67,9 @@ FWDPROC LoadCursorW_fwd;
|
||||
FWDPROC LoadIconW_fwd;
|
||||
FWDPROC LoadImageW_fwd;
|
||||
FWDPROC LoadKeyboardLayoutW_fwd;
|
||||
FWDPROC LoadMenuIndirectW_fwd;
|
||||
FWDPROC LoadMenuW_fwd;
|
||||
FWDPROC MapVirtualKeyExW_fwd;
|
||||
FWDPROC MapVirtualKeyW_fwd;
|
||||
FWDPROC MessageBoxIndirectW_fwd;
|
||||
FWDPROC ModifyMenuW_fwd;
|
||||
FWDPROC RegisterClipboardFormatW_fwd;
|
||||
FWDPROC RegisterDeviceNotificationW_fwd;
|
||||
FWDPROC RegisterWindowMessageW_fwd;
|
||||
|
@ -23,11 +23,9 @@
|
||||
#include <commctrl.h>
|
||||
#include "unifwd.h"
|
||||
|
||||
FORWARD_TO_UNICOWS(AppendMenuW);
|
||||
FORWARD_TO_UNICOWS(BroadcastSystemMessageW);
|
||||
FORWARD_TO_UNICOWS(ChangeDisplaySettingsExW);
|
||||
FORWARD_TO_UNICOWS(ChangeDisplaySettingsW);
|
||||
FORWARD_TO_UNICOWS(ChangeMenuW);
|
||||
FORWARD_TO_UNICOWS(DdeCreateStringHandleW);
|
||||
FORWARD_TO_UNICOWS(DdeInitializeW);
|
||||
FORWARD_TO_UNICOWS(DdeQueryStringW);
|
||||
@ -57,7 +55,6 @@ FORWARD_TO_UNICOWS(GetPropW);
|
||||
FORWARD_TO_UNICOWS(GetTabbedTextExtentW);
|
||||
FORWARD_TO_UNICOWS(GrayStringW);
|
||||
FORWARD_TO_UNICOWS(InsertMenuItemW);
|
||||
FORWARD_TO_UNICOWS(InsertMenuW);
|
||||
FORWARD_TO_UNICOWS(LoadAcceleratorsW);
|
||||
FORWARD_TO_UNICOWS(LoadBitmapW);
|
||||
FORWARD_TO_UNICOWS(LoadCursorFromFileW);
|
||||
@ -65,12 +62,9 @@ FORWARD_TO_UNICOWS(LoadCursorW);
|
||||
FORWARD_TO_UNICOWS(LoadIconW);
|
||||
FORWARD_TO_UNICOWS(LoadImageW);
|
||||
FORWARD_TO_UNICOWS(LoadKeyboardLayoutW);
|
||||
FORWARD_TO_UNICOWS(LoadMenuIndirectW);
|
||||
FORWARD_TO_UNICOWS(LoadMenuW);
|
||||
FORWARD_TO_UNICOWS(MapVirtualKeyExW);
|
||||
FORWARD_TO_UNICOWS(MapVirtualKeyW);
|
||||
FORWARD_TO_UNICOWS(MessageBoxIndirectW);
|
||||
FORWARD_TO_UNICOWS(ModifyMenuW);
|
||||
FORWARD_TO_UNICOWS(RegisterClipboardFormatW);
|
||||
FORWARD_TO_UNICOWS(RegisterDeviceNotificationW);
|
||||
FORWARD_TO_UNICOWS(RegisterWindowMessageW);
|
||||
|
@ -56,9 +56,13 @@ static const apilib_named_api advapi32_named_apis[] =
|
||||
DECL_API("CryptSetProviderW", CryptSetProviderW_stub),
|
||||
DECL_API("CryptSignHashW", CryptSignHashW_stub),
|
||||
DECL_API("CryptVerifySignatureW", CryptVerifySignatureW_stub),
|
||||
DECL_API("DecryptFileA", DecryptFileA_stub),
|
||||
DECL_API("DecryptFileW", DecryptFileW_stub),
|
||||
DECL_API("DeleteAce", DeleteAce_new),
|
||||
DECL_API("DuplicateToken", DuplicateToken_new),
|
||||
DECL_API("DuplicateTokenEx", DuplicateTokenEx_new),
|
||||
DECL_API("EncryptFileA", EncryptFileA_stub),
|
||||
DECL_API("EncryptFileW", EncryptFileW_stub),
|
||||
DECL_API("EnumServicesStatusExA", EnumServicesStatusExA_stub),
|
||||
DECL_API("EnumServicesStatusExW", EnumServicesStatusExW_stub),
|
||||
DECL_API("EqualPrefixSid", EqualPrefixSid_new),
|
||||
@ -94,6 +98,11 @@ static const apilib_named_api advapi32_named_apis[] =
|
||||
DECL_API("LookupAccountSidW", LookupAccountSidW_new),
|
||||
DECL_API("LookupPrivilegeValueA", LookupPrivilegeValueA_new),
|
||||
DECL_API("LookupPrivilegeValueW", LookupPrivilegeValueW_new),
|
||||
DECL_API("LsaClose", LsaClose_new),
|
||||
DECL_API("LsaNtStatusToWinError", LsaNtStatusToWinError_new),
|
||||
DECL_API("LsaOpenPolicy", LsaOpenPolicy_new),
|
||||
DECL_API("LsaRetrievePrivateData", LsaRetrievePrivateData_new),
|
||||
DECL_API("LsaStorePrivateData", LsaStorePrivateData_new),
|
||||
DECL_API("MakeSelfRelativeSD", MakeSelfRelativeSD_new),
|
||||
DECL_API("NotifyBootConfigStatus", NotifyBootConfigStatus_stub),
|
||||
DECL_API("OpenProcessToken", OpenProcessToken_new),
|
||||
|
@ -63,6 +63,15 @@ STUB InitiateSystemShutdownExA_stub;
|
||||
STUB InitiateSystemShutdownExW_stub;
|
||||
STUB FileEncryptionStatusA_stub;
|
||||
STUB FileEncryptionStatusW_stub;
|
||||
STUB EncryptFileA_stub;
|
||||
STUB EncryptFileW_stub;
|
||||
STUB DecryptFileA_stub;
|
||||
STUB DecryptFileW_stub;
|
||||
DWORD WINAPI LsaClose_new(IN HANDLE ObjectHandle);
|
||||
ULONG WINAPI LsaNtStatusToWinError_new(LONG Status);
|
||||
DWORD WINAPI LsaOpenPolicy_new(IN PVOID SystemName, IN PVOID ObjectAttributes, IN DWORD DesiredAccess, IN OUT PHANDLE PolicyHandle);
|
||||
DWORD WINAPI LsaRetrievePrivateData_new(IN HANDLE PolicyHandle, IN PVOID KeyName, OUT HANDLE* PrivateData);
|
||||
DWORD WINAPI LsaStorePrivateData_new(IN HANDLE PolicyHandle, IN PVOID KeyName, IN PVOID PrivateData);
|
||||
BOOL WINAPI OpenProcessToken_new(HANDLE ProcessHandle, DWORD DesiredAccess, HANDLE *TokenHandle);
|
||||
BOOL WINAPI OpenThreadToken_new(HANDLE ThreadHandle, DWORD DesiredAccess, BOOL OpenAsSelf, HANDLE *TokenHandle);
|
||||
BOOL WINAPI DuplicateTokenEx_new(HANDLE ExistingTokenHandle, DWORD dwDesiredAccess, LPSECURITY_ATTRIBUTES lpTokenAttributes, SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, TOKEN_TYPE TokenType, PHANDLE DuplicateTokenHandle);
|
||||
|
@ -59,3 +59,9 @@ UNIMPL_FUNC(InitiateSystemShutdownExW, 6);
|
||||
|
||||
UNIMPL_FUNC(FileEncryptionStatusA, 2);
|
||||
UNIMPL_FUNC(FileEncryptionStatusW, 2);
|
||||
|
||||
UNIMPL_FUNC(EncryptFileA, 1);
|
||||
UNIMPL_FUNC(EncryptFileW, 1);
|
||||
|
||||
UNIMPL_FUNC(DecryptFileA, 2);
|
||||
UNIMPL_FUNC(DecryptFileW, 2);
|
||||
|
72
apilibs/kexbases/Advapi32/lsa.c
Executable file
72
apilibs/kexbases/Advapi32/lsa.c
Executable file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* 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 <ntstatus.h>
|
||||
#define WIN32_NO_STATUS
|
||||
#include <windows.h>
|
||||
#include "k32ord.h"
|
||||
|
||||
typedef LONG NTSTATUS;
|
||||
|
||||
/* MAKE_EXPORT LsaClose_new=LsaClose */
|
||||
DWORD WINAPI LsaClose_new(IN HANDLE ObjectHandle)
|
||||
{
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/* MAKE_EXPORT LsaNtStatusToWinError_new=LsaNtStatusToWinError */
|
||||
ULONG WINAPI LsaNtStatusToWinError_new(LONG Status)
|
||||
{
|
||||
return K32_RtlNtStatusToDosError(Status);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT LsaOpenPolicy_new=LsaOpenPolicy */
|
||||
DWORD WINAPI LsaOpenPolicy_new(
|
||||
IN PVOID SystemName,
|
||||
IN PVOID ObjectAttributes,
|
||||
IN DWORD DesiredAccess,
|
||||
IN OUT PHANDLE PolicyHandle)
|
||||
{
|
||||
if (PolicyHandle)
|
||||
*PolicyHandle = (HANDLE)0xCAFE;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/* MAKE_EXPORT LsaRetrievePrivateData_new=LsaRetrievePrivateData */
|
||||
DWORD WINAPI LsaRetrievePrivateData_new(
|
||||
IN HANDLE PolicyHandle,
|
||||
IN PVOID KeyName,
|
||||
OUT HANDLE* PrivateData)
|
||||
{
|
||||
return STATUS_OBJECT_NAME_NOT_FOUND;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT LsaStorePrivateData_new=LsaStorePrivateData */
|
||||
DWORD WINAPI LsaStorePrivateData_new(
|
||||
IN HANDLE PolicyHandle,
|
||||
IN PVOID KeyName,
|
||||
IN PVOID PrivateData)
|
||||
{
|
||||
return STATUS_OBJECT_NAME_NOT_FOUND;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* KernelEx
|
||||
*
|
||||
* Copyright (C) 2009, Tihiy
|
||||
* Copyright (C) 2009-2010, Tihiy
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
@ -24,22 +24,20 @@
|
||||
#include "GdiObjects.h"
|
||||
#include "k32ord.h"
|
||||
#include "kexcoresdk.h"
|
||||
#include "Orhpans.h"
|
||||
|
||||
static WORD g_GDILH_addr;
|
||||
static DWORD g_GdiBase;
|
||||
static int script_cache_psidx;
|
||||
static int orphan_class_psidx;
|
||||
|
||||
#define REBASEGDI(x) ((PVOID)( g_GdiBase + LOWORD((DWORD)(x)) ))
|
||||
#define REBASEGDIHIGH(x) ( g_GdiBase + (DWORD)(x) )
|
||||
|
||||
#define GDIHEAP32BASE 0x10000
|
||||
#define GDIHEAP32TOP 0x20000
|
||||
|
||||
BOOL InitGDIObjects(void)
|
||||
{
|
||||
g_GdiBase = MapSL( LoadLibrary16("gdi") << 16 );
|
||||
g_GDILH_addr = ((PINSTANCE16)g_GdiBase)->pLocalHeap;
|
||||
script_cache_psidx = kexPsAllocIndex();
|
||||
orphan_class_psidx = kexPsAllocIndex();
|
||||
return (BOOL)g_GdiBase;
|
||||
}
|
||||
|
||||
@ -62,7 +60,7 @@ PGDIOBJ16 GetGDIObjectPtr( HGDIOBJ hgdiobj )
|
||||
return (PGDIOBJ16)REBASEGDI(entry->wBlock);
|
||||
}
|
||||
}
|
||||
else //high heap
|
||||
else //high heap (not moveable)
|
||||
__try
|
||||
{
|
||||
if ( wHandle < 0x80 ) return NULL; //high heap handles start with 0x80
|
||||
@ -120,36 +118,39 @@ static DWORD SwitchGDIObjectType( PGDIOBJ16 obj )
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* MAKE_EXPORT GetObjectType_fix=GetObjectType */
|
||||
DWORD WINAPI GetObjectType_fix( HGDIOBJ 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 );
|
||||
DWORD result = 0;
|
||||
if ( obj )
|
||||
if (hgdiobj)
|
||||
{
|
||||
PGDIOBJ16 obj;
|
||||
GrabWin16Lock();
|
||||
obj = GetGDIObjectPtr( hgdiobj );
|
||||
if ( obj )
|
||||
result = SwitchGDIObjectType( obj );
|
||||
ReleaseWin16Lock();
|
||||
}
|
||||
else //still, can be metafile selector
|
||||
if ( !obj ) //still, can be metafile selector
|
||||
{
|
||||
WORD wHandle = (WORD)hgdiobj;
|
||||
if ( (wHandle & 6) == 6 ) //test for ldt selector
|
||||
{
|
||||
LDT_ENTRY selector;
|
||||
GetThreadSelectorEntry( GetCurrentThread(), wHandle, &selector );
|
||||
if ( selector.HighWord.Bits.Type == 3 )
|
||||
if ( selector.HighWord.Bits.Type == 3 ) //read/write usermode?
|
||||
result = GetObjectType(hgdiobj); //resort to gdi32
|
||||
}
|
||||
}
|
||||
if ( !result ) SetLastError( ERROR_INVALID_HANDLE );
|
||||
}
|
||||
if ( !result )
|
||||
SetLastError( ERROR_INVALID_HANDLE );
|
||||
return result;
|
||||
}
|
||||
|
||||
__declspec(naked)
|
||||
static inline
|
||||
WORD GetCurrentTDB()
|
||||
{
|
||||
__asm
|
||||
@ -160,98 +161,110 @@ WORD GetCurrentTDB()
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
The purpose of GdiObjects is to simulate NT GDI object rules, which
|
||||
allows deleting object handles while selected into DCs.
|
||||
|
||||
To do this, we set up an array of those handles which are checked up
|
||||
and destroyed if unselected in FIFO order when some time passes or
|
||||
array (list+map) is big enough.
|
||||
************************************************************************/
|
||||
|
||||
//those have to be under w16lock
|
||||
static inline
|
||||
GdiOrphans* GetOrphans()
|
||||
{
|
||||
return (GdiOrphans*)kexPsGetValue(orphan_class_psidx);
|
||||
}
|
||||
|
||||
static inline
|
||||
GdiOrphans* CreateOrphans()
|
||||
{
|
||||
GdiOrphans* orphans = GetOrphans();
|
||||
if (orphans == NULL)
|
||||
{
|
||||
orphans = new GdiOrphans;
|
||||
kexPsSetValue(orphan_class_psidx,orphans);
|
||||
}
|
||||
return orphans;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT DeleteObject_fix=DeleteObject */
|
||||
BOOL WINAPI DeleteObject_fix( HGDIOBJ hObject )
|
||||
{
|
||||
PGDIOBJ16 obj = GetGDIObjectPtr( hObject );
|
||||
if ( !obj || !SwitchGDIObjectType(obj) ) return FALSE;
|
||||
DWORD violated = 0;
|
||||
PGDIOBJ16 obj;
|
||||
GdiOrphans* orphans = NULL;
|
||||
DWORD dwNumber = 0;
|
||||
if (!hObject) return FALSE;
|
||||
GrabWin16Lock();
|
||||
obj = GetGDIObjectPtr( hObject );
|
||||
if ( !obj || !SwitchGDIObjectType(obj) )
|
||||
{
|
||||
ReleaseWin16Lock();
|
||||
return FALSE;
|
||||
}
|
||||
//check if object is selected
|
||||
if ( obj->wOwner == GetCurrentTDB() ) //not system or foreign objects
|
||||
{
|
||||
if (obj->wType == GDI_TYPE_FONT)
|
||||
if (obj->wType == GDI_TYPE_FONT || obj->wType == GDI_TYPE_PEN )
|
||||
{
|
||||
typedef void (*DeleteUSPFontCache_fn)(HFONT hFont);
|
||||
DeleteUSPFontCache_fn DeleteUSPFontCache = (DeleteUSPFontCache_fn) kexPsGetValue(script_cache_psidx);
|
||||
if (!DeleteUSPFontCache)
|
||||
if ( obj->wRefCount >= GDI_REFCOUNT_ONCE )
|
||||
{
|
||||
DeleteUSPFontCache = (DeleteUSPFontCache_fn)kexGetProcAddress(LoadLibrary("KEXBASEN.DLL"), "DeleteUSPFontCache");
|
||||
kexPsSetValue(script_cache_psidx, DeleteUSPFontCache);
|
||||
DBGPRINTF(("Attempt to delete selected %s %p\n",
|
||||
obj->wType == GDI_TYPE_FONT ? "font":"pen",hObject));
|
||||
dwNumber = obj->dwNumber;
|
||||
}
|
||||
if (DeleteUSPFontCache)
|
||||
DeleteUSPFontCache((HFONT)hObject);
|
||||
}
|
||||
if (obj->wType == GDI_TYPE_FONT && ((PFONTOBJ16)obj)->wSelCount >= SEL_FONT_ONCE )
|
||||
if (obj->wType == GDI_TYPE_BITMAP) //can be selected into one DC
|
||||
{
|
||||
DBGPRINTF(("somebody is trying to delete selected font %p\n",hObject));
|
||||
violated = GDI_TYPE_FONT;
|
||||
}
|
||||
if (obj->wType == GDI_TYPE_BITMAP && ((PBITMAPOBJ16)obj)->wSelCount == SEL_BITMAP_ONCE )
|
||||
PBITMAPOBJ16 bmpobj = (PBITMAPOBJ16)obj;
|
||||
if ( bmpobj->wSelCount )
|
||||
{
|
||||
DBGPRINTF(("somebody is trying to delete selected bitmap %p\n",hObject));
|
||||
violated = GDI_TYPE_BITMAP;
|
||||
DBGPRINTF(("Attempt to delete selected bitmap %p\n",
|
||||
hObject));
|
||||
dwNumber = obj->dwNumber;
|
||||
}
|
||||
}
|
||||
BOOL ret = DeleteObject( hObject );
|
||||
if ( violated == GDI_TYPE_FONT )
|
||||
((PFONTOBJ16)obj)->wSelCount |= SEL_FONT_DEL;
|
||||
else if ( violated == GDI_TYPE_BITMAP )
|
||||
((PBITMAPOBJ16)obj)->wSelCount |= SEL_BITMAP_DEL;
|
||||
return ret;
|
||||
//if there is sth to record, initialize orphans class
|
||||
orphans = (dwNumber) ? CreateOrphans() : GetOrphans();
|
||||
}
|
||||
ReleaseWin16Lock();
|
||||
if (orphans)
|
||||
{
|
||||
if ( dwNumber )
|
||||
orphans->RecordOrphan(hObject,dwNumber);
|
||||
else
|
||||
if ( orphans->ForgetOrphan(hObject) )
|
||||
DBGPRINTF(("WARNING: deleted handle %p is destroyed!!!\n",hObject));
|
||||
}
|
||||
return DeleteObject( hObject );
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT SelectObject_fix=SelectObject */
|
||||
HGDIOBJ WINAPI SelectObject_fix( HDC hdc, HGDIOBJ hgdiobj )
|
||||
{
|
||||
//9x should do this
|
||||
//validation 9x should do
|
||||
if ( !hdc ) SetLastError(ERROR_INVALID_HANDLE);
|
||||
if ( !hdc || !hgdiobj ) return NULL;
|
||||
HGDIOBJ ret;
|
||||
ret = SelectObject( hdc, hgdiobj );
|
||||
PGDIOBJ16 obj = GetGDIObjectPtr( ret );
|
||||
if ( obj && obj->wOwner )
|
||||
//if object was deleted, don't let it be reselected
|
||||
GrabWin16Lock();
|
||||
PGDIOBJ16 obj = GetGDIObjectPtr( hgdiobj );
|
||||
GdiOrphans* orphans = NULL;
|
||||
DWORD dwNumber;
|
||||
if ( obj && obj->wOwner == GetCurrentTDB() )
|
||||
{
|
||||
if ( obj->wType == GDI_TYPE_FONT && ((PFONTOBJ16)obj)->wSelCount == SEL_FONT_DEL )
|
||||
orphans = GetOrphans();
|
||||
dwNumber = obj->dwNumber;
|
||||
}
|
||||
ReleaseWin16Lock();
|
||||
if ( orphans && orphans->IsOrphan(hgdiobj, dwNumber) )
|
||||
{
|
||||
DBGPRINTF(("deleting font %p on unselecting\n",ret));
|
||||
DeleteObject(ret);
|
||||
DBGPRINTF(("WARNING: Attempt to select deleted handle %p\n",hgdiobj));
|
||||
return NULL;
|
||||
}
|
||||
if ( obj->wType == GDI_TYPE_BITMAP && ((PBITMAPOBJ16)obj)->wSelCount == SEL_BITMAP_DEL )
|
||||
{
|
||||
((PBITMAPOBJ16)obj)->wSelCount = 0;
|
||||
DBGPRINTF(("deleting bitmap %p on unselecting\n",ret));
|
||||
DeleteObject(ret);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
return SelectObject( hdc, hgdiobj );
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT DeleteDC_fix=DeleteDC */
|
||||
BOOL WINAPI DeleteDC_fix( HDC hdc )
|
||||
{
|
||||
BOOL ret;
|
||||
PGDIOBJ16 obj = GetGDIObjectPtr( hdc );
|
||||
if ( !obj || !SwitchGDIObjectType(obj) ) return FALSE;
|
||||
HGDIOBJ fnt = GetCurrentObject(hdc,OBJ_FONT);
|
||||
HGDIOBJ bmp = GetCurrentObject(hdc,OBJ_BITMAP);
|
||||
ret = DeleteDC(hdc);
|
||||
if (ret)
|
||||
{
|
||||
PFONTOBJ16 fntobj = (PFONTOBJ16)GetGDIObjectPtr(fnt);
|
||||
PBITMAPOBJ16 bitmapobj = (PBITMAPOBJ16)GetGDIObjectPtr(bmp);
|
||||
if (fntobj && fntobj->wOwner && fntobj->wType == GDI_TYPE_FONT && fntobj->wSelCount == SEL_FONT_DEL)
|
||||
{
|
||||
DBGPRINTF(("deleting font %p on dc cleanup\n",fnt));
|
||||
DeleteObject(fnt);
|
||||
}
|
||||
if (bitmapobj && bitmapobj->header.wOwner && bitmapobj->header.wType == GDI_TYPE_BITMAP && bitmapobj->wSelCount == SEL_BITMAP_DEL)
|
||||
{
|
||||
bitmapobj->wSelCount = 0;
|
||||
DBGPRINTF(("deleting bitmap %p on dc cleanup\n",bmp));
|
||||
DeleteObject(bmp);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT CreateDIBSection_fix=CreateDIBSection */
|
||||
HBITMAP WINAPI CreateDIBSection_fix(
|
||||
@ -265,5 +278,19 @@ HBITMAP WINAPI CreateDIBSection_fix(
|
||||
{
|
||||
if (pbmi && pbmi->bmiHeader.biSize == sizeof(BITMAPINFO)) //9x does not forgive
|
||||
pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); //9x does not forget
|
||||
return CreateDIBSection(hdc,pbmi,iUsage,ppvBits,hSection,dwOffset);
|
||||
HBITMAP ret = CreateDIBSection(hdc,pbmi,iUsage,ppvBits,hSection,dwOffset);
|
||||
GdiOrphans* orphans = GetOrphans();
|
||||
if (orphans)
|
||||
orphans->RunCleanup();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT CreateFontIndirectA_fix=CreateFontIndirectA */
|
||||
HFONT WINAPI CreateFontIndirectA_fix( CONST LOGFONT* lplf )
|
||||
{
|
||||
HFONT ret = CreateFontIndirectA(lplf);
|
||||
GdiOrphans* orphans = GetOrphans();
|
||||
if (orphans)
|
||||
orphans->RunCleanup();
|
||||
return ret;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* KernelEx
|
||||
*
|
||||
* Copyright (C) 2009, Tihiy
|
||||
* Copyright (C) 2009-2010, Tihiy
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
@ -26,6 +26,9 @@
|
||||
void GrabWin16Lock();
|
||||
void ReleaseWin16Lock();
|
||||
|
||||
#define GDIHEAP32BASE 0x10000
|
||||
#define GDIHEAP32TOP 0x20000
|
||||
|
||||
#define LHE_DISCARDED 0x40
|
||||
#define LHE_MUTATED 0x80
|
||||
#define LHE_FREEHANDLE 0xFF
|
||||
@ -43,10 +46,7 @@ void ReleaseWin16Lock();
|
||||
#define GDI_TYPE_METADC 0x4F51
|
||||
#define GDI_TYPE_ENHMETA 0x4F52
|
||||
|
||||
#define SEL_FONT_ONCE 0x4
|
||||
#define SEL_FONT_DEL 0x2
|
||||
#define SEL_BITMAP_ONCE 0x01
|
||||
#define SEL_BITMAP_DEL 0x10
|
||||
#define GDI_REFCOUNT_ONCE 0x4
|
||||
|
||||
#define ResetMapMode( hdc ) SetMapMode( hdc, GetMapMode(hdc) )
|
||||
|
||||
@ -70,6 +70,17 @@ typedef struct
|
||||
BYTE bLocks;
|
||||
} LHENTRY, *PLHENTRY;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
WORD wZero; //+0 zero
|
||||
WORD wType; //+2 object type | flags
|
||||
DWORD dwNumber; //+4 number++
|
||||
WORD wReserved; //+8 sth specific
|
||||
WORD wRefCount; //+A number of DCs selected into * GDI_REFCOUNT_ONCE
|
||||
WORD wOwner; //+C HTASK (TDB16) of process or library owning
|
||||
} GDIOBJ16, *PGDIOBJ16;
|
||||
|
||||
//bitmaps and DCs have special headers
|
||||
typedef struct
|
||||
{
|
||||
WORD wZero; //+0
|
||||
@ -77,32 +88,17 @@ typedef struct
|
||||
DWORD dwNumber; //+4
|
||||
DWORD dwSpecific; //+8
|
||||
WORD wOwner; //+C
|
||||
} GDIOBJ16, *PGDIOBJ16;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GDIOBJ16 header;
|
||||
WORD wGlobalBitmap; //+14
|
||||
WORD wSelCount; //+16
|
||||
WORD wHDC; //+18
|
||||
WORD wGlobalBitmapInfo; //+20
|
||||
DWORD dwReservedShit; //+22
|
||||
WORD wBitmapStuff; //+26
|
||||
WORD wDeviceStuff; //+28
|
||||
WORD wBitmapType; //+30
|
||||
WORD wLogColorSpace; //+32
|
||||
WORD wGlobalBitmap; //+E
|
||||
WORD wSelCount; //+10
|
||||
WORD wHDC; //+12
|
||||
WORD wGlobalBitmapInfo; //+14
|
||||
DWORD dwReservedShit; //+16
|
||||
WORD wBitmapStuff; //+1A
|
||||
WORD wDeviceStuff; //+1C
|
||||
WORD wBitmapType; //+1E
|
||||
WORD wLogColorSpace; //+20
|
||||
} BITMAPOBJ16, *PBITMAPOBJ16;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
WORD wZero; //+0
|
||||
WORD wType; //+2
|
||||
DWORD dwStuff; //+4
|
||||
WORD wReserved; //+8 (not used?)
|
||||
WORD wSelCount; //+A
|
||||
WORD wOwner; //+C
|
||||
} FONTOBJ16, *PFONTOBJ16;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
WORD wZero; //+0
|
||||
|
44
apilibs/kexbases/Gdi32/GetTextExtentPoint32_fix.c
Executable file
44
apilibs/kexbases/Gdi32/GetTextExtentPoint32_fix.c
Executable file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
/* MAKE_EXPORT GetTextExtentPoint32A_fix=GetTextExtentPoint32A */
|
||||
BOOL WINAPI GetTextExtentPoint32A_fix(HDC hdc, LPCSTR str, int count, LPSIZE size)
|
||||
{
|
||||
if (count < 0)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
return GetTextExtentPoint32A(hdc, str, count, size);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetTextExtentPoint32W_fix=GetTextExtentPoint32W */
|
||||
BOOL WINAPI GetTextExtentPoint32W_fix(HDC hdc, LPCWSTR str, int count, LPSIZE size)
|
||||
{
|
||||
if (count < 0)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
return GetTextExtentPoint32W(hdc, str, count, size);
|
||||
}
|
155
apilibs/kexbases/Gdi32/Orhpans.cpp
Executable file
155
apilibs/kexbases/Gdi32/Orhpans.cpp
Executable file
@ -0,0 +1,155 @@
|
||||
/*
|
||||
* 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 "Orhpans.h"
|
||||
#include "GdiObjects.h"
|
||||
#include "kexcoresdk.h"
|
||||
|
||||
|
||||
GdiOrphans::GdiOrphans()
|
||||
{
|
||||
InitializeCriticalSection(&cs);
|
||||
dwTickLastRecord = GetTickCount();
|
||||
}
|
||||
|
||||
GdiOrphans::~GdiOrphans()
|
||||
{
|
||||
DeleteCriticalSection(&cs);
|
||||
}
|
||||
|
||||
//returns TRUE if handle is found and it's not hijacked
|
||||
BOOL GdiOrphans::IsOrphan(HGDIOBJ hObject, DWORD dwNumber)
|
||||
{
|
||||
EnterCriticalSection(&cs);
|
||||
BOOL ret;
|
||||
map<HGDIOBJ,PGDIORPHAN>::iterator it = handle_map.find(hObject);
|
||||
if (it == handle_map.end())
|
||||
ret = FALSE;
|
||||
else
|
||||
ret = (it->second->dwNumber == dwNumber) ? TRUE : FALSE;
|
||||
LeaveCriticalSection(&cs);
|
||||
return ret;
|
||||
}
|
||||
|
||||
//removes handle, returns TRUE if it was there
|
||||
BOOL GdiOrphans::ForgetOrphan(HGDIOBJ hObject)
|
||||
{
|
||||
EnterCriticalSection(&cs);
|
||||
BOOL ret;
|
||||
map<HGDIOBJ,PGDIORPHAN>::iterator it = handle_map.find(hObject);
|
||||
if (it == handle_map.end())
|
||||
ret = FALSE;
|
||||
else
|
||||
{
|
||||
delete it->second;
|
||||
handle_list.remove(it->second);
|
||||
handle_map.erase(it);
|
||||
ret = TRUE;
|
||||
}
|
||||
LeaveCriticalSection(&cs);
|
||||
return ret;
|
||||
}
|
||||
|
||||
//adds handle into our records if it's not already there
|
||||
void GdiOrphans::RecordOrphan(HGDIOBJ hObject, DWORD dwNumber)
|
||||
{
|
||||
EnterCriticalSection(&cs);
|
||||
map<HGDIOBJ,PGDIORPHAN>::iterator it = handle_map.find(hObject);
|
||||
if (it == handle_map.end()) //not found
|
||||
{
|
||||
PGDIORPHAN neworphan = new GDIORPHAN;
|
||||
if (neworphan)
|
||||
{
|
||||
neworphan->hObject = hObject;
|
||||
neworphan->dwNumber = dwNumber;
|
||||
handle_map.insert(pair<HGDIOBJ,PGDIORPHAN>(hObject,neworphan));
|
||||
handle_list.push_back(neworphan);
|
||||
if (handle_map.size() >= MAXGDIORPHANS)
|
||||
{
|
||||
DBGPRINTF(("Too many handles (%d), cleaning up!\n",handle_map.size()));
|
||||
CleanupOrphan();
|
||||
}
|
||||
}
|
||||
}
|
||||
else //found
|
||||
{
|
||||
it->second->dwNumber = dwNumber;
|
||||
}
|
||||
LeaveCriticalSection(&cs);
|
||||
dwTickLastRecord = GetTickCount();
|
||||
}
|
||||
|
||||
//finds one handle which is hijacked or unselected and removes it
|
||||
void GdiOrphans::CleanupOrphan()
|
||||
{
|
||||
int cleanup = 0;
|
||||
list<PGDIORPHAN>::iterator it;
|
||||
for (it = handle_list.begin(); it != handle_list.end(); it++)
|
||||
{
|
||||
GrabWin16Lock();
|
||||
PGDIORPHAN orphan = *it;
|
||||
PGDIOBJ16 obj = GetGDIObjectPtr(orphan->hObject);
|
||||
//handle somehow got destroyed without us knowing?
|
||||
if (!obj || obj->dwNumber != orphan->dwNumber)
|
||||
{
|
||||
DBGPRINTF(("WARNING: Handle %p invalidated!!!",orphan->hObject));
|
||||
cleanup = 1;
|
||||
}
|
||||
else //was object unselected?
|
||||
{
|
||||
if ( (obj->wType == GDI_TYPE_FONT || obj->wType == GDI_TYPE_PEN)
|
||||
&& obj->wRefCount < GDI_REFCOUNT_ONCE )
|
||||
{
|
||||
DBGPRINTF(("Cleaning up unselected deleted %s %p\n",
|
||||
obj->wType == GDI_TYPE_FONT ? "font":"pen",orphan->hObject));
|
||||
cleanup = 2;
|
||||
}
|
||||
if ( obj->wType == GDI_TYPE_BITMAP && ((PBITMAPOBJ16)obj)->wSelCount == 0 )
|
||||
{
|
||||
DBGPRINTF(("Cleaning up unselected deleted bitmap %p\n",orphan->hObject));
|
||||
cleanup = 2;
|
||||
}
|
||||
}
|
||||
ReleaseWin16Lock();
|
||||
if (cleanup)
|
||||
{
|
||||
if (cleanup == 2)
|
||||
DeleteObject(orphan->hObject);
|
||||
handle_list.erase(it);
|
||||
handle_map.erase(orphan->hObject);
|
||||
delete orphan;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//public version of cleanup
|
||||
void GdiOrphans::RunCleanup()
|
||||
{
|
||||
if (GetTickCount() - dwTickLastRecord < ORPHANTTL) return;
|
||||
EnterCriticalSection(&cs);
|
||||
CleanupOrphan();
|
||||
LeaveCriticalSection(&cs);
|
||||
//don't run cleanup too often either
|
||||
dwTickLastRecord = GetTickCount();
|
||||
}
|
60
apilibs/kexbases/Gdi32/Orhpans.h
Executable file
60
apilibs/kexbases/Gdi32/Orhpans.h
Executable file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __ORPHANS_H
|
||||
#define __ORPHANS_H
|
||||
|
||||
#pragma warning(disable:4530) //we don't do exception handling
|
||||
#pragma warning(disable:4786) //don't care about this either
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
||||
#define MAXGDIORPHANS 6 //threshold size which triggers cleanup
|
||||
#define ORPHANTTL 2000 //msecs to try give for objects to live
|
||||
|
||||
//gdi object handle and its gdi number for consistency check
|
||||
typedef struct _GDIORPHAN
|
||||
{
|
||||
HGDIOBJ hObject;
|
||||
DWORD dwNumber;
|
||||
} GDIORPHAN, *PGDIORPHAN;
|
||||
|
||||
using namespace std;
|
||||
|
||||
class GdiOrphans
|
||||
{
|
||||
public:
|
||||
GdiOrphans();
|
||||
~GdiOrphans();
|
||||
void RecordOrphan(HGDIOBJ hObject, DWORD dwNumber);
|
||||
BOOL IsOrphan(HGDIOBJ hObject, DWORD dwNumber);
|
||||
BOOL ForgetOrphan(HGDIOBJ hObject);
|
||||
void RunCleanup();
|
||||
private:
|
||||
map<HGDIOBJ,PGDIORPHAN> handle_map;
|
||||
list<PGDIORPHAN> handle_list;
|
||||
CRITICAL_SECTION cs;
|
||||
void CleanupOrphan();
|
||||
DWORD dwTickLastRecord;
|
||||
};
|
||||
|
||||
#endif
|
@ -6,7 +6,7 @@
|
||||
* Copyright 2002,2003 Shachar Shemesh
|
||||
* Copyright 2003 CodeWeavers Inc. (Ulrich Czekalla)
|
||||
*
|
||||
* Copyright (C) 2008, Tihiy
|
||||
* Copyright (C) 2008, 2010, Tihiy
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
@ -110,6 +110,7 @@ BOOL WINAPI SetWorldTransform_NT(
|
||||
CONST XFORM *lpXform // transformation data
|
||||
)
|
||||
{
|
||||
GrabWin16Lock();
|
||||
PDCOBJ dcobj = GetDCObj(hdc);
|
||||
WORD savemapmode;
|
||||
int wx;
|
||||
@ -119,6 +120,7 @@ BOOL WINAPI SetWorldTransform_NT(
|
||||
if ( !dcobj || !lpXform || !almostzero(lpXform->eM12) || !almostzero(lpXform->eM21)
|
||||
|| almostzero(lpXform->eM11) || almostzero(lpXform->eM22) )
|
||||
{
|
||||
ReleaseWin16Lock();
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE; //no rotating for you
|
||||
}
|
||||
@ -132,6 +134,7 @@ BOOL WINAPI SetWorldTransform_NT(
|
||||
SetViewportOrgEx(hdc,(int)lpXform->eDx,(int)lpXform->eDy,NULL);
|
||||
//set it back
|
||||
dcobj->mapmode = savemapmode;
|
||||
ReleaseWin16Lock();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -156,17 +159,24 @@ BOOL WINAPI GetTextMetricsA_NT(
|
||||
LPTEXTMETRIC lptm // text metrics
|
||||
)
|
||||
{
|
||||
GrabWin16Lock();
|
||||
PDCOBJ dcobj = GetDCObj(hdc);
|
||||
int saved = 0;
|
||||
BOOL retval;
|
||||
if ( !dcobj ) return FALSE;
|
||||
if ( !dcobj )
|
||||
{
|
||||
ReleaseWin16Lock();
|
||||
return FALSE;
|
||||
}
|
||||
if ( dcobj->ViewportExtX != 1 || dcobj->ViewportExtY != 1 || dcobj->WindowExtX != 1 || dcobj->WindowExtY != 1 )
|
||||
{
|
||||
saved = SaveDC(hdc);
|
||||
ResetMapMode(hdc);
|
||||
}
|
||||
retval = GetTextMetricsA(hdc,lptm);
|
||||
if ( saved ) RestoreDC(hdc,-1);
|
||||
if ( saved )
|
||||
RestoreDC(hdc,-1);
|
||||
ReleaseWin16Lock();
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -286,7 +296,6 @@ BOOL WINAPI ExtTextOutW_new(
|
||||
{
|
||||
BOOL result;
|
||||
int* buffer = NULL;
|
||||
PDCOBJ dcobj = GetDCObj( hdc );
|
||||
WORD savemapmode = 0;
|
||||
|
||||
if ( HIWORD(lpString) )
|
||||
@ -309,6 +318,9 @@ BOOL WINAPI ExtTextOutW_new(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GrabWin16Lock();
|
||||
PDCOBJ dcobj = GetDCObj( hdc );
|
||||
if ( dcobj && dcobj->mapmode == MM_TEXT &&
|
||||
( dcobj->ViewportExtX!=1 || dcobj->ViewportExtY!=1
|
||||
|| dcobj->WindowExtX!=1 || dcobj->WindowExtY!=1) )
|
||||
@ -319,6 +331,7 @@ BOOL WINAPI ExtTextOutW_new(
|
||||
result = ExtTextOutW(hdc,X,Y,fuOptions,lprc,lpString,cbCount,lpDx);
|
||||
if ( savemapmode )
|
||||
dcobj->mapmode = savemapmode;
|
||||
ReleaseWin16Lock();
|
||||
|
||||
if ( buffer && cbCount>128 )
|
||||
HeapFree(GetProcessHeap(),0,buffer);
|
||||
|
@ -42,7 +42,7 @@ static const apilib_named_api gdi32_named_apis[] =
|
||||
DECL_API("AddFontResourceExW", AddFontResourceExW_new),
|
||||
DECL_API("AddFontResourceW", AddFontResourceW_new),
|
||||
DECL_API("CreateDIBSection", CreateDIBSection_fix),
|
||||
DECL_API("DeleteDC", DeleteDC_fix),
|
||||
DECL_API("CreateFontIndirectA", CreateFontIndirectA_fix),
|
||||
DECL_API("DeleteObject", DeleteObject_fix),
|
||||
DECL_API("EnumFontFamiliesExA", EnumFontFamiliesExA_new),
|
||||
DECL_API("EnumFontFamiliesExW", EnumFontFamiliesExW_new),
|
||||
@ -59,6 +59,8 @@ static const apilib_named_api gdi32_named_apis[] =
|
||||
DECL_API("GetObjectType", GetObjectType_fix),
|
||||
DECL_API("GetObjectW", GetObjectW_new),
|
||||
DECL_API("GetRandomRgn", GetRandomRgn_NT),
|
||||
DECL_API("GetTextExtentPoint32A", GetTextExtentPoint32A_fix),
|
||||
DECL_API("GetTextExtentPoint32W", GetTextExtentPoint32W_fix),
|
||||
DECL_API("GetTextMetricsA", GetTextMetricsA_NT),
|
||||
DECL_API("GetWorldTransform", GetWorldTransform_NT),
|
||||
DECL_API("ModifyWorldTransform", ModifyWorldTransform_NT),
|
||||
|
@ -35,9 +35,11 @@ BOOL WINAPI RemoveFontMemResourceEx_stub(HANDLE fh);
|
||||
DWORD WINAPI GetObjectType_fix(HGDIOBJ hgdiobj);
|
||||
BOOL WINAPI DeleteObject_fix(HGDIOBJ hObject);
|
||||
HGDIOBJ WINAPI SelectObject_fix(HDC hdc, HGDIOBJ hgdiobj);
|
||||
BOOL WINAPI DeleteDC_fix(HDC hdc);
|
||||
HBITMAP WINAPI CreateDIBSection_fix(HDC hdc, BITMAPINFO *pbmi, UINT iUsage, VOID **ppvBits, HANDLE hSection, DWORD dwOffset);
|
||||
HFONT WINAPI CreateFontIndirectA_fix(CONST LOGFONT* lplf);
|
||||
DWORD WINAPI GetGlyphOutlineA_fix(HDC hdc, UINT uChar, UINT uFormat, LPGLYPHMETRICS lpgm, DWORD cbBuffer, LPVOID lpvBuffer, CONST MAT2 *lpmat2);
|
||||
BOOL WINAPI GetTextExtentPoint32A_fix(HDC hdc, LPCSTR str, int count, LPSIZE size);
|
||||
BOOL WINAPI GetTextExtentPoint32W_fix(HDC hdc, LPCWSTR str, int count, LPSIZE size);
|
||||
DWORD WINAPI GetFontUnicodeRanges_new(HDC hdc, LPGLYPHSET lpgs);
|
||||
int WINAPI SetGraphicsMode_NT(HDC hdc, int iMode);
|
||||
BOOL WINAPI SetWorldTransform_9x(HDC hdc, CONST XFORM *lpXform);
|
||||
|
@ -229,6 +229,9 @@ int WINAPI GetObjectW_new(
|
||||
LOGFONTW fontW = {0};
|
||||
if (!GetObjectA(hgdiobj,sizeof(LOGFONTA),&fontA)) return 0; //err not font
|
||||
memcpy(&fontW,&fontA,FIELD_OFFSET(LOGFONTA,lfFaceName));
|
||||
if (hgdiobj == GetStockObject(DEFAULT_GUI_FONT)) //unicode apps get Tahoma
|
||||
lstrcpyW(fontW.lfFaceName,L"Tahoma");
|
||||
else
|
||||
MultiByteToWideChar(CP_ACP,0,fontA.lfFaceName,-1,fontW.lfFaceName,LF_FACESIZE);
|
||||
memcpy(lpvObject,&fontW,cbBuffer);
|
||||
return cbBuffer;
|
||||
|
69
apilibs/kexbases/Kernel32/CriticalSection_fix.c
Executable file
69
apilibs/kexbases/Kernel32/CriticalSection_fix.c
Executable file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* KernelEx
|
||||
*
|
||||
* Copyright (C) 2010, Xeno86
|
||||
* Copyright (C) 2008, 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 "kstructs.h"
|
||||
|
||||
/* MAKE_EXPORT DeleteCriticalSection_fix=DeleteCriticalSection */
|
||||
void WINAPI DeleteCriticalSection_fix(PCRITICAL_SECTION lpCriticalSection)
|
||||
{
|
||||
//make DeleteCriticalSection not fail on deleted section
|
||||
byte* deleted = (byte*) lpCriticalSection;
|
||||
if (*deleted != 0) DeleteCriticalSection(lpCriticalSection);
|
||||
}
|
||||
|
||||
/*
|
||||
* Terminate process if EnterCriticalSection is called on orphaned CS
|
||||
* in DLL_PROCESS_DETACH - Vista behaviour.
|
||||
* refer: http://blogs.msdn.com/b/oldnewthing/archive/2010/01/22/9951750.aspx
|
||||
*/
|
||||
|
||||
static void orphaned_cs_handler();
|
||||
|
||||
__declspec(naked)
|
||||
/* MAKE_EXPORT EnterCriticalSection_fix=EnterCriticalSection */
|
||||
void WINAPI EnterCriticalSection_fix(LPCRITICAL_SECTION lpCriticalSection)
|
||||
{
|
||||
__asm {
|
||||
mov eax, [esp+4]
|
||||
cmp byte ptr [eax], WIN98_K32OBJ_CRITICAL_SECTION
|
||||
jnz __error
|
||||
jmp dword ptr [EnterCriticalSection]
|
||||
__error:
|
||||
jmp orphaned_cs_handler
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
void orphaned_cs_handler()
|
||||
{
|
||||
PDB98* pdb = get_pdb();
|
||||
DWORD want_flags = fSendDllNotifications | fTerminating;
|
||||
//if process is in dll detach - terminate silently
|
||||
if ((pdb->Flags & want_flags) == want_flags)
|
||||
{
|
||||
SetErrorMode(SEM_NOGPFAULTERRORBOX | SEM_FAILCRITICALERRORS);
|
||||
}
|
||||
//throw exception
|
||||
RaiseException(EXCEPTION_ACCESS_VIOLATION, 0, 0, NULL);
|
||||
}
|
43
apilibs/kexbases/Kernel32/ExitProcess_fix.c
Executable file
43
apilibs/kexbases/Kernel32/ExitProcess_fix.c
Executable file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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 "kstructs.h"
|
||||
|
||||
/* MAKE_EXPORT ExitProcess_fix=ExitProcess */
|
||||
VOID WINAPI ExitProcess_fix( UINT uExitCode )
|
||||
{
|
||||
PDB98* pdb = get_pdb();
|
||||
|
||||
//process is already terminating. we would badly crash
|
||||
if (pdb->Flags & fTerminating)
|
||||
{
|
||||
//so instead silently fail
|
||||
SetErrorMode(SEM_NOGPFAULTERRORBOX | SEM_FAILCRITICALERRORS);
|
||||
RaiseException(EXCEPTION_ACCESS_VIOLATION, 0, 0, NULL);
|
||||
}
|
||||
|
||||
//set calling thread priority to the lowest possible. this way
|
||||
//we greatly improve chance for thread which calls ExitProcess
|
||||
//to finish latest and call dll process detach like NT
|
||||
SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_IDLE);
|
||||
ExitProcess(uExitCode);
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2010, Tihiy
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
@ -20,6 +21,73 @@
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include "kexcoresdk.h"
|
||||
#include "kstructs.h"
|
||||
#include "k32ord.h"
|
||||
|
||||
#define RELTOABS(x) ( (DWORD)(x) + *(DWORD*)(x) + 4 )
|
||||
#define MAPHANDLE_MAPPED 0x1000
|
||||
|
||||
/*
|
||||
* A bit of mapping file 9x rules:
|
||||
* copy-on-write access is possible to file mappings created with
|
||||
* PAGE_WRITECOPY. Note that it makes sense only to real files.
|
||||
* If you CreateFileMapping on INVALID_HANDLE_VALUE with PAGE_WRITECOPY
|
||||
* you will get mapping handle which can be only mapped with FILE_MAP_READ
|
||||
* PAGE_READONLY can be mapped only with FILE_MAP_READ, end of story
|
||||
* PAGE_READWRITE can be mapped with any FILE_MAP_READ or FILE_MAP_WRITE
|
||||
* but not FILE_MAP_COPY; however FILE_MAP_ALL_ACCESS is fine
|
||||
* kernel checks exactly for it, other masks with FILE_MAP_COPY will fail.
|
||||
*
|
||||
* Office 2003 workaround is hack for specific access mask which breaks
|
||||
* that FILE_MAP_COPY rule
|
||||
*/
|
||||
|
||||
#define FILE_MAP_OFFICE2003 (SECTION_QUERY | SECTION_MAP_WRITE | \
|
||||
SECTION_MAP_READ | SECTION_MAP_EXECUTE | \
|
||||
SECTION_EXTEND_SIZE | READ_CONTROL)
|
||||
|
||||
//MapHandle: maps kernel handle to object
|
||||
static PVOID MapHandle(HANDLE hObject, DWORD dwFlags, DWORD dwReserved)
|
||||
{
|
||||
typedef PDWORD (WINAPI *MapHandle_t)(HANDLE,DWORD,DWORD);
|
||||
static MapHandle_t KernelMapHandle;
|
||||
if (!KernelMapHandle)
|
||||
KernelMapHandle = (MapHandle_t)RELTOABS((DWORD)kexGetProcAddress(
|
||||
GetModuleHandle("KERNEL32.DLL"),"OpenVxDHandle")+0xC);
|
||||
return KernelMapHandle(hObject,dwFlags,dwReserved);
|
||||
}
|
||||
|
||||
static LPVOID GetMapViewAddress(HANDLE hFileMapping)
|
||||
{
|
||||
PVOID ret = (PVOID)-1;
|
||||
PFILEMAPPING mapobj;
|
||||
static CRITICAL_SECTION* k32lock;
|
||||
if (!k32lock)
|
||||
k32lock = (CRITICAL_SECTION*) kexGetK32Lock();
|
||||
_EnterSysLevel(k32lock);
|
||||
mapobj = (PFILEMAPPING)MapHandle(hFileMapping,MAPHANDLE_MAPPED,0);
|
||||
if (mapobj && mapobj->type == WIN98_K32OBJ_MEM_MAPPED_FILE)
|
||||
ret = mapobj->mapaddr;
|
||||
_LeaveSysLevel(k32lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static DWORD FindSharedMem64K(DWORD StartAddress)
|
||||
{
|
||||
MEMORY_BASIC_INFORMATION mbi;
|
||||
DWORD TryAddress = StartAddress;
|
||||
while (true)
|
||||
{
|
||||
if (TryAddress & 0x0FFFF) //64K align
|
||||
TryAddress = (TryAddress & 0xFFFF0000) + 0x10000;
|
||||
if ( !VirtualQuery((PVOID)TryAddress,&mbi,sizeof(mbi)) ) return NULL;
|
||||
if (mbi.State == MEM_FREE)
|
||||
return TryAddress;
|
||||
TryAddress = (DWORD)mbi.BaseAddress + (DWORD)mbi.RegionSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* MAKE_EXPORT MapViewOfFileEx_new=MapViewOfFileEx */
|
||||
LPVOID WINAPI MapViewOfFileEx_new(
|
||||
@ -39,6 +107,57 @@ LPVOID WINAPI MapViewOfFileEx_new(
|
||||
{
|
||||
lpBaseAddress = 0;
|
||||
}
|
||||
return MapViewOfFileEx(hFileMappingObject, dwDesiredAccess, dwFileOffsetHigh,
|
||||
|
||||
LPVOID ret = NULL;
|
||||
if ( dwDesiredAccess == FILE_MAP_OFFICE2003 )
|
||||
{
|
||||
DBGPRINTF(("KEX: Using 64K align workaround on memmap handle %p\n",
|
||||
hFileMappingObject));
|
||||
//was it already mapped?
|
||||
LPVOID oldmapaddr = GetMapViewAddress(hFileMappingObject);
|
||||
if (oldmapaddr == (LPVOID)-1)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return NULL;
|
||||
}
|
||||
if (oldmapaddr) //if it was, try that address first
|
||||
ret = MapViewOfFileEx(hFileMappingObject,FILE_MAP_ALL_ACCESS,
|
||||
dwFileOffsetHigh,dwFileOffsetLow,dwNumberOfBytesToMap,oldmapaddr);
|
||||
//search shared memory piece, skipping 64K to not deadloop
|
||||
DWORD mem64K = 0x81000000;
|
||||
while (!ret)
|
||||
{
|
||||
mem64K = FindSharedMem64K(mem64K + 0x10000);
|
||||
if (!mem64K)
|
||||
{
|
||||
DBGPRINTF(("KEX: Failed to find memory for mapping handle %p!",
|
||||
hFileMappingObject));
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return NULL;
|
||||
}
|
||||
DWORD gle = GetLastError();
|
||||
SetLastError(0);
|
||||
ret = MapViewOfFileEx(hFileMappingObject,FILE_MAP_ALL_ACCESS,dwFileOffsetHigh,
|
||||
dwFileOffsetLow,dwNumberOfBytesToMap,(LPVOID)mem64K);
|
||||
if ( GetLastError() == ERROR_INVALID_PARAMETER ) //not according to plan
|
||||
return NULL;
|
||||
else
|
||||
SetLastError(gle);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = MapViewOfFileEx(hFileMappingObject, dwDesiredAccess, dwFileOffsetHigh,
|
||||
dwFileOffsetLow, dwNumberOfBytesToMap, lpBaseAddress);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT MapViewOfFile_new=MapViewOfFile */
|
||||
LPVOID WINAPI MapViewOfFile_new( HANDLE hFileMappingObject, DWORD dwDesiredAccess,
|
||||
DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap )
|
||||
{
|
||||
return MapViewOfFileEx_new(hFileMappingObject, dwDesiredAccess,
|
||||
dwFileOffsetHigh, dwFileOffsetLow, dwNumberOfBytesToMap, NULL);
|
||||
}
|
||||
|
@ -67,12 +67,14 @@ static const apilib_named_api kernel32_named_apis[] =
|
||||
DECL_API("DecodePointer", XorPointer),
|
||||
DECL_API("DecodeSystemPointer", XorPointer),
|
||||
DECL_API("DefineDosDeviceW", DefineDosDeviceW_new),
|
||||
DECL_API("DeleteCriticalSection", DeleteCriticalSection_new),
|
||||
DECL_API("DeleteCriticalSection", DeleteCriticalSection_fix),
|
||||
DECL_API("DeleteFileW", DeleteFileW_new),
|
||||
DECL_API("EncodePointer", XorPointer),
|
||||
DECL_API("EncodeSystemPointer", XorPointer),
|
||||
DECL_API("EnterCriticalSection", EnterCriticalSection_fix),
|
||||
DECL_API("EnumUILanguagesA", EnumUILanguagesA_new),
|
||||
DECL_API("EnumUILanguagesW", EnumUILanguagesW_new),
|
||||
DECL_API("ExitProcess", ExitProcess_fix),
|
||||
DECL_API("FindAtomW", FindAtomW_new),
|
||||
DECL_API("FindFirstChangeNotificationW", FindFirstChangeNotificationW_new),
|
||||
DECL_API("FindFirstFileExW", FindFirstFileExW_stub),
|
||||
@ -170,6 +172,7 @@ static const apilib_named_api kernel32_named_apis[] =
|
||||
DECL_API("LoadLibraryExW", LoadLibraryExW_new),
|
||||
DECL_API("LoadLibraryW", LoadLibraryW_new),
|
||||
DECL_API("LockFileEx", LockFileEx_new),
|
||||
DECL_API("MapViewOfFile", MapViewOfFile_new),
|
||||
DECL_API("MapViewOfFileEx", MapViewOfFileEx_new),
|
||||
DECL_API("Module32FirstW", Module32FirstW_new),
|
||||
DECL_API("Module32NextW", Module32NextW_new),
|
||||
@ -199,6 +202,8 @@ static const apilib_named_api kernel32_named_apis[] =
|
||||
DECL_API("SearchPathW", SearchPathW_new),
|
||||
DECL_API("SetConsoleTitleW", SetConsoleTitleW_new),
|
||||
DECL_API("SetCurrentDirectoryW", SetCurrentDirectoryW_new),
|
||||
DECL_API("SetDllDirectoryA", SetDllDirectoryA_stub),
|
||||
DECL_API("SetDllDirectoryW", SetDllDirectoryW_stub),
|
||||
DECL_API("SetFileAttributesW", SetFileAttributesW_new),
|
||||
DECL_API("SetFilePointerEx", SetFilePointerEx_new),
|
||||
DECL_API("SetInformationJobObject", SetInformationJobObject_new),
|
||||
|
@ -35,7 +35,9 @@ BOOL WINAPI PostQueuedCompletionStatus_new(HANDLE CompletionPort, DWORD dwNumber
|
||||
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);
|
||||
void WINAPI DeleteCriticalSection_fix(PCRITICAL_SECTION lpCriticalSection);
|
||||
void WINAPI EnterCriticalSection_fix(LPCRITICAL_SECTION lpCriticalSection);
|
||||
VOID WINAPI ExitProcess_fix(UINT uExitCode);
|
||||
HANDLE WINAPI CreateFileA_fix(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDistribution, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
|
||||
BOOL WINAPI ReadFile_fix(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped);
|
||||
BOOL WINAPI WriteFile_fix(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped);
|
||||
@ -67,6 +69,7 @@ BOOL WINAPI IsProcessInJob_new(HANDLE process, HANDLE job, PBOOL result);
|
||||
void WINAPI KEXVersion(char* out);
|
||||
BOOL WINAPI LockFileEx_new(HANDLE hFile, DWORD dwFlags, DWORD dwReserved, DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh, LPOVERLAPPED lpOverlapped);
|
||||
LPVOID WINAPI MapViewOfFileEx_new(HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap, LPVOID lpBaseAddress);
|
||||
LPVOID WINAPI MapViewOfFile_new(HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap);
|
||||
BOOL WINAPI MoveFileExA_new(LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWORD dwFlags);
|
||||
BOOL WINAPI MoveFileWithProgressA_new(LPCSTR lpExistingFileName, LPCSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, DWORD dwFlags);
|
||||
HANDLE WINAPI OpenThread_new(DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwThreadId);
|
||||
@ -88,6 +91,8 @@ STUB GetProcessIoCounters_stub;
|
||||
STUB RtlCaptureStackBackTrace_stub;
|
||||
STUB GetComputerNameExA_stub;
|
||||
STUB GetComputerNameExW_stub;
|
||||
STUB SetDllDirectoryA_stub;
|
||||
STUB SetDllDirectoryW_stub;
|
||||
INT WINAPI CompareStringW_new(LCID lcid, DWORD style, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2);
|
||||
BOOL WINAPI GetStringTypeW_new(DWORD type, LPCWSTR src, INT count, LPWORD chartype);
|
||||
BOOL WINAPI GetStringTypeExW_new(LCID locale, DWORD type, LPCWSTR src, INT count, LPWORD chartype);
|
||||
|
@ -32,3 +32,5 @@ UNIMPL_FUNC(GetProcessIoCounters, 2);
|
||||
UNIMPL_FUNC(RtlCaptureStackBackTrace, 4);
|
||||
UNIMPL_FUNC(GetComputerNameExA, 3);
|
||||
UNIMPL_FUNC(GetComputerNameExW, 3);
|
||||
UNIMPL_FUNC(SetDllDirectoryA, 1);
|
||||
UNIMPL_FUNC(SetDllDirectoryW, 1);
|
||||
|
99
apilibs/kexbases/User32/Menu.c
Executable file
99
apilibs/kexbases/User32/Menu.c
Executable file
@ -0,0 +1,99 @@
|
||||
/*
|
||||
* 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 "common.h"
|
||||
|
||||
#define MF_TYPEMASK (MF_STRING | MF_OWNERDRAW | MF_BITMAP | MF_SEPARATOR)
|
||||
|
||||
/* MAKE_EXPORT LoadMenuIndirectA=LoadMenuIndirectW */
|
||||
|
||||
/* MAKE_EXPORT LoadMenuA_fix=LoadMenuA */
|
||||
HMENU WINAPI LoadMenuA_fix(HINSTANCE hInstance, LPCSTR lpMenuName)
|
||||
{
|
||||
//9x can't load resources from mmaped libraries (LOAD_LIBRARY_AS_DATAFILE)
|
||||
HMENU ret = NULL;
|
||||
//in case of mmaped dll the lowest bit in hInstance will be set to 1
|
||||
if ((DWORD) hInstance & 1)
|
||||
{
|
||||
HRSRC fnd = FindResource(hInstance, lpMenuName,RT_MENU);
|
||||
if (fnd)
|
||||
{
|
||||
LPMENUTEMPLATE lpMenuTemplate = LoadResource(hInstance, fnd);
|
||||
if (lpMenuTemplate)
|
||||
ret = LoadMenuIndirect(lpMenuTemplate);
|
||||
}
|
||||
}
|
||||
else
|
||||
ret = LoadMenuA(hInstance, lpMenuName);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT LoadMenuW_new=LoadMenuW */
|
||||
HMENU WINAPI LoadMenuW_new(HINSTANCE hInstance, LPCWSTR lpMenuNameW)
|
||||
{
|
||||
LPSTR lpMenuNameA;
|
||||
STACK_WtoA(lpMenuNameW, lpMenuNameA);
|
||||
return LoadMenuA_fix(hInstance, lpMenuNameA);
|
||||
}
|
||||
|
||||
//Append/Insert/Modify are not handled right by MSLU
|
||||
/* MAKE_EXPORT InsertMenuW_new=InsertMenuW */
|
||||
BOOL WINAPI InsertMenuW_new(HMENU hMenu, UINT uPosition, UINT uFlags,
|
||||
UINT_PTR uIDNewItem, LPCWSTR lpNewItemW)
|
||||
{
|
||||
LPSTR lpNewItemA = (LPSTR)lpNewItemW;
|
||||
if ((uFlags & MF_TYPEMASK) == MF_STRING)
|
||||
{
|
||||
STACK_WtoA(lpNewItemW, lpNewItemA);
|
||||
}
|
||||
return InsertMenuA(hMenu, uPosition, uFlags, uIDNewItem, lpNewItemA);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT AppendMenuW_new=AppendMenuW */
|
||||
BOOL WINAPI AppendMenuW_new(HMENU hMenu, UINT uFlags,
|
||||
UINT_PTR uIDNewItem, LPCWSTR lpNewItem)
|
||||
{
|
||||
return InsertMenuW_new(hMenu, -1, uFlags | MF_BYPOSITION, uIDNewItem, lpNewItem);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT ChangeMenuW_new=ChangeMenuW */
|
||||
BOOL WINAPI ChangeMenuW_new(HMENU hMenu, UINT cmd, LPCWSTR lpNewItemW,
|
||||
UINT uIDNewItem, UINT uFlags)
|
||||
{
|
||||
LPSTR lpNewItemA = (LPSTR) lpNewItemW;
|
||||
if ((uFlags & MF_TYPEMASK) == MF_STRING)
|
||||
{
|
||||
STACK_WtoA(lpNewItemW, lpNewItemA);
|
||||
}
|
||||
return ChangeMenuA(hMenu, cmd, lpNewItemA, uIDNewItem, uFlags);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT ModifyMenuW_new=ModifyMenuW */
|
||||
BOOL WINAPI ModifyMenuW_new(HMENU hMenu, UINT uPosition, UINT uFlags,
|
||||
UINT_PTR uIDNewItem, LPCWSTR lpNewItemW)
|
||||
{
|
||||
LPSTR lpNewItemA = (LPSTR) lpNewItemW;
|
||||
if ((uFlags & MF_TYPEMASK) == MF_STRING)
|
||||
{
|
||||
STACK_WtoA(lpNewItemW, lpNewItemA);
|
||||
}
|
||||
return ModifyMenuA(hMenu, uPosition, uFlags, uIDNewItem, lpNewItemA);
|
||||
}
|
76
apilibs/kexbases/User32/RawInput.c
Executable file
76
apilibs/kexbases/User32/RawInput.c
Executable file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008-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 <windows.h>
|
||||
|
||||
/* Raw input functions should reset output size buffers to zero.
|
||||
* While (UINT)-1 is "total failure" return, programs (e.g. mpc-hc)
|
||||
* don't check for it, and fail hard thinking it's returned buffer size.
|
||||
*/
|
||||
#define RAWNOTIMPLEMETED(intptr) \
|
||||
if (intptr) *intptr = 0; \
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED); \
|
||||
return 0;
|
||||
|
||||
|
||||
/* MAKE_EXPORT DefRawInputProc_new=DefRawInputProc */
|
||||
LRESULT WINAPI DefRawInputProc_new(PVOID paRawInput, INT nInput, UINT cbSizeHeader)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetRawInputBuffer_new=GetRawInputBuffer */
|
||||
UINT WINAPI GetRawInputBuffer_new(PVOID pData, PUINT pcbSize, UINT cbSizeHeader)
|
||||
{
|
||||
RAWNOTIMPLEMETED(pcbSize);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetRawInputData_new=GetRawInputData */
|
||||
UINT WINAPI GetRawInputData_new(PVOID hRawInput, UINT uiCommand, LPVOID pData, PUINT pcbSize, UINT cbSizeHeader)
|
||||
{
|
||||
RAWNOTIMPLEMETED(pcbSize);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetRawInputDeviceList_new=GetRawInputDeviceList */
|
||||
UINT WINAPI GetRawInputDeviceList_new(PVOID pRawInputDeviceList, PUINT puiNumDevices, UINT cbSize)
|
||||
{
|
||||
RAWNOTIMPLEMETED(puiNumDevices);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetRawInputDeviceInfo_new=GetRawInputDeviceInfoA */
|
||||
/* MAKE_EXPORT GetRawInputDeviceInfo_new=GetRawInputDeviceInfoW */
|
||||
UINT WINAPI GetRawInputDeviceInfo_new(HANDLE hDevice, UINT uiCommand, LPVOID pData, PUINT pcbSize)
|
||||
{
|
||||
RAWNOTIMPLEMETED(pcbSize);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetRegisteredRawInputDevices_new=GetRegisteredRawInputDevices */
|
||||
UINT WINAPI GetRegisteredRawInputDevices_new(PVOID pRawInputDevices, PUINT puiNumDevices, UINT cbSize)
|
||||
{
|
||||
RAWNOTIMPLEMETED(puiNumDevices);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT RegisterRawInputDevices_new=RegisterRawInputDevices */
|
||||
BOOL WINAPI RegisterRawInputDevices_new(PVOID pRawInputDevices, UINT uiNumDevices, UINT cbSize)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return FALSE;
|
||||
}
|
@ -64,9 +64,11 @@ static const apilib_named_api user32_named_apis[] =
|
||||
{
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
|
||||
DECL_API("AllowSetForegroundWindow", AllowSetForegroundWindow_98),
|
||||
DECL_API("AppendMenuW", AppendMenuW_new),
|
||||
DECL_API("CallMsgFilterW", CallMsgFilterA),
|
||||
DECL_API("CallWindowProcA", CallWindowProcA_fix),
|
||||
DECL_API("CallWindowProcW", CallWindowProcW_new),
|
||||
DECL_API("ChangeMenuW", ChangeMenuW_new),
|
||||
DECL_API("CharLowerBuffW", CharLowerBuffW_new),
|
||||
DECL_API("CharLowerW", CharLowerW_new),
|
||||
DECL_API("CharNextExW", CharNextExW_new),
|
||||
@ -87,7 +89,7 @@ static const apilib_named_api user32_named_apis[] =
|
||||
DECL_API("DefDlgProcW", DefDlgProcW_NEW),
|
||||
DECL_API("DefFrameProcW", DefFrameProcW_NEW),
|
||||
DECL_API("DefMDIChildProcW", DefMDIChildProcW_NEW),
|
||||
DECL_API("DefRawInputProc", DefRawInputProc_stub),
|
||||
DECL_API("DefRawInputProc", DefRawInputProc_new),
|
||||
DECL_API("DefWindowProcW", DefWindowProcW_NEW),
|
||||
DECL_API("DeregisterShellHookWindow", IsWindow),
|
||||
DECL_API("DialogBoxIndirectParamW", DialogBoxIndirectParamW_NEW),
|
||||
@ -107,16 +109,17 @@ static const apilib_named_api user32_named_apis[] =
|
||||
DECL_API("GetMessageW", GetMessageW_NEW),
|
||||
DECL_API("GetMouseMovePointsEx", GetMouseMovePointsEx_98),
|
||||
DECL_API("GetNextDlgTabItem", GetNextDlgTabItem_fix),
|
||||
DECL_API("GetRawInputBuffer", GetRawInputBuffer_stub),
|
||||
DECL_API("GetRawInputData", GetRawInputData_stub),
|
||||
DECL_API("GetRawInputDeviceInfoA", GetRawInputDeviceInfoA_stub),
|
||||
DECL_API("GetRawInputDeviceInfoW", GetRawInputDeviceInfoW_stub),
|
||||
DECL_API("GetRawInputDeviceList", GetRawInputDeviceList_stub),
|
||||
DECL_API("GetRegisteredRawInputDevices", GetRegisteredRawInputDevices_stub),
|
||||
DECL_API("GetRawInputBuffer", GetRawInputBuffer_new),
|
||||
DECL_API("GetRawInputData", GetRawInputData_new),
|
||||
DECL_API("GetRawInputDeviceInfoA", GetRawInputDeviceInfo_new),
|
||||
DECL_API("GetRawInputDeviceInfoW", GetRawInputDeviceInfo_new),
|
||||
DECL_API("GetRawInputDeviceList", GetRawInputDeviceList_new),
|
||||
DECL_API("GetRegisteredRawInputDevices", GetRegisteredRawInputDevices_new),
|
||||
DECL_API("GetWindowLongA", GetWindowLongA_NEW),
|
||||
DECL_API("GetWindowLongW", GetWindowLongW_NEW),
|
||||
DECL_API("GetWindowTextLengthW", GetWindowTextLengthW_NEW),
|
||||
DECL_API("GetWindowTextW", GetWindowTextW_NEW),
|
||||
DECL_API("InsertMenuW", InsertMenuW_new),
|
||||
DECL_API("IsCharAlphaNumericW", IsCharAlphaNumericW_new),
|
||||
DECL_API("IsCharAlphaW", IsCharAlphaW_new),
|
||||
DECL_API("IsCharLowerW", IsCharLowerW_new),
|
||||
@ -124,11 +127,15 @@ static const apilib_named_api user32_named_apis[] =
|
||||
DECL_API("IsDialogMessageW", IsDialogMessageA),
|
||||
DECL_API("IsHungAppWindow", IsHungAppWindow_new),
|
||||
DECL_API("IsWindowUnicode", IsWindowUnicode_NEW),
|
||||
DECL_API("LoadMenuA", LoadMenuA_fix),
|
||||
DECL_API("LoadMenuIndirectW", LoadMenuIndirectA),
|
||||
DECL_API("LoadMenuW", LoadMenuW_new),
|
||||
DECL_API("LoadStringW", LoadStringW_new),
|
||||
DECL_API("LockSetForegroundWindow", LockSetForegroundWindow_98),
|
||||
DECL_API("LockWorkStation", LockWorkStation_new),
|
||||
DECL_API("MapVirtualKeyA", MapVirtualKeyA_new),
|
||||
DECL_API("MapVirtualKeyExA", MapVirtualKeyExA_new),
|
||||
DECL_API("ModifyMenuW", ModifyMenuW_new),
|
||||
DECL_API("OemToCharBuffW", OemToCharBuffW_new),
|
||||
DECL_API("OemToCharW", OemToCharW_new),
|
||||
DECL_API("PeekMessageA", PeekMessageA_NEW),
|
||||
@ -140,7 +147,7 @@ static const apilib_named_api user32_named_apis[] =
|
||||
DECL_API("RealGetWindowClassW", RealGetWindowClassW_new),
|
||||
DECL_API("RegisterClassExW", RegisterClassExW_NEW),
|
||||
DECL_API("RegisterClassW", RegisterClassW_NEW),
|
||||
DECL_API("RegisterRawInputDevices", RegisterRawInputDevices_stub),
|
||||
DECL_API("RegisterRawInputDevices", RegisterRawInputDevices_new),
|
||||
DECL_API("RegisterShellHookWindow", IsWindow),
|
||||
DECL_API("SendDlgItemMessageW", SendDlgItemMessageW_NEW),
|
||||
DECL_API("SendMessageA", SendMessageA_fix),
|
||||
|
@ -57,19 +57,24 @@ BOOL WINAPI IsHungAppWindow_new(HWND hWnd);
|
||||
BOOL WINAPI LockWorkStation_new(void);
|
||||
UINT WINAPI MapVirtualKeyA_new(UINT uCode, UINT uMapType);
|
||||
UINT WINAPI MapVirtualKeyExA_new(UINT uCode, UINT uMapType, HKL dwhkl);
|
||||
HMENU WINAPI LoadMenuA_fix(HINSTANCE hInstance, LPCSTR lpMenuName);
|
||||
HMENU WINAPI LoadMenuW_new(HINSTANCE hInstance, LPCWSTR lpMenuNameW);
|
||||
BOOL WINAPI InsertMenuW_new(HMENU hMenu, UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCWSTR lpNewItemW);
|
||||
BOOL WINAPI AppendMenuW_new(HMENU hMenu, UINT uFlags, UINT_PTR uIDNewItem, LPCWSTR lpNewItem);
|
||||
BOOL WINAPI ChangeMenuW_new(HMENU hMenu, UINT cmd, LPCWSTR lpNewItemW, UINT uIDNewItem, UINT uFlags);
|
||||
BOOL WINAPI ModifyMenuW_new(HMENU hMenu, UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCWSTR lpNewItemW);
|
||||
LRESULT WINAPI DefRawInputProc_new(PVOID paRawInput, INT nInput, UINT cbSizeHeader);
|
||||
UINT WINAPI GetRawInputBuffer_new(PVOID pData, PUINT pcbSize, UINT cbSizeHeader);
|
||||
UINT WINAPI GetRawInputData_new(PVOID hRawInput, UINT uiCommand, LPVOID pData, PUINT pcbSize, UINT cbSizeHeader);
|
||||
UINT WINAPI GetRawInputDeviceList_new(PVOID pRawInputDeviceList, PUINT puiNumDevices, UINT cbSize);
|
||||
UINT WINAPI GetRawInputDeviceInfo_new(HANDLE hDevice, UINT uiCommand, LPVOID pData, PUINT pcbSize);
|
||||
UINT WINAPI GetRegisteredRawInputDevices_new(PVOID pRawInputDevices, PUINT puiNumDevices, UINT cbSize);
|
||||
BOOL WINAPI RegisterRawInputDevices_new(PVOID pRawInputDevices, UINT uiNumDevices, UINT cbSize);
|
||||
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;
|
||||
STUB GetRawInputBuffer_stub;
|
||||
STUB GetRawInputData_stub;
|
||||
STUB GetRawInputDeviceList_stub;
|
||||
STUB GetRawInputDeviceInfoA_stub;
|
||||
STUB GetRawInputDeviceInfoW_stub;
|
||||
STUB GetRegisteredRawInputDevices_stub;
|
||||
STUB RegisterRawInputDevices_stub;
|
||||
STUB PrintWindow_stub;
|
||||
LPWSTR WINAPI CharNextExW_new(WORD codepage, LPCWSTR ptr, DWORD flags);
|
||||
LPWSTR WINAPI CharNextW_new(LPCWSTR x);
|
||||
|
@ -22,14 +22,4 @@
|
||||
#include "common.h"
|
||||
|
||||
UNIMPL_FUNC(SetLayeredWindowAttributes, 4);
|
||||
//raw input APIs
|
||||
UNIMPL_FUNC(DefRawInputProc, 3);
|
||||
UNIMPL_FUNC(GetRawInputBuffer, 3);
|
||||
UNIMPL_FUNC(GetRawInputData, 5);
|
||||
UNIMPL_FUNC(GetRawInputDeviceList, 3);
|
||||
UNIMPL_FUNC(GetRawInputDeviceInfoA, 4);
|
||||
UNIMPL_FUNC(GetRawInputDeviceInfoW, 4);
|
||||
UNIMPL_FUNC(GetRegisteredRawInputDevices, 3);
|
||||
UNIMPL_FUNC(RegisterRawInputDevices, 3);
|
||||
//
|
||||
UNIMPL_FUNC(PrintWindow, 3);
|
@ -2,7 +2,7 @@
|
||||
* KernelEx
|
||||
* Copyright 1995 Martin von Loewis
|
||||
* Copyright 1996 Alexandre Julliard
|
||||
* Copyright 2009 Tihiy
|
||||
* Copyright 2009-2010 Tihiy
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
@ -306,6 +306,10 @@ LRESULT WINAPI CallProcAnsiWithUnicode( WNDPROC callback, HWND hwnd, UINT msg, W
|
||||
case WM_IME_CHAR:
|
||||
wParam = wparam_WtoA( msg, wParam );
|
||||
break;
|
||||
case WM_NOTIFYFORMAT:
|
||||
/* for default window procedures */
|
||||
if ( IS_SHARED(callback) && lParam == NF_QUERY && IsWindowUnicode_NEW((HWND)wParam) )
|
||||
return NFR_UNICODE;
|
||||
}
|
||||
return CallWindowProcA(callback,hwnd,msg,wParam,lParam);
|
||||
}
|
||||
@ -319,8 +323,12 @@ LRESULT WINAPI CallProcUnicodeWithAnsi( WNDPROC callback, HWND hwnd, UINT msg, W
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case WM_CREATE:
|
||||
case WM_NCCREATE:
|
||||
/* unicode window is being created? mark it before event fires */
|
||||
if (IsWindowReallyUnicode(hwnd))
|
||||
SetWindowUnicode(hwnd,TRUE);
|
||||
//fall down
|
||||
case WM_CREATE:
|
||||
{
|
||||
if (!VALID_PTR(lParam)) return CallWindowProc_stdcall(callback,hwnd,msg,wParam,lParam);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* KernelEx Thunking Unicode Layer
|
||||
*
|
||||
* Copyright (C) 2009, Tihiy
|
||||
* Copyright (C) 2009-2010, Tihiy
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
@ -35,7 +35,8 @@ static CRITICAL_SECTION wndproc_cs;
|
||||
|
||||
static HMODULE g_hUser32;
|
||||
|
||||
#define SetWinCreateEvent(proc) SetWinEventHook(EVENT_OBJECT_CREATE, EVENT_OBJECT_CREATE, g_hUser32, (WINEVENTPROC)(proc), GetCurrentProcessId(), GetCurrentThreadId(), WINEVENT_INCONTEXT)
|
||||
#define SetWinCreateEvent(proc) SetWinEventHook(EVENT_OBJECT_CREATE, EVENT_OBJECT_CREATE, g_hUser32, \
|
||||
(WINEVENTPROC)(proc), GetCurrentProcessId(), GetCurrentThreadId(), WINEVENT_INCONTEXT)
|
||||
|
||||
BOOL InitUniThunkLayer()
|
||||
{
|
||||
@ -100,8 +101,11 @@ BOOL IsWindowReallyUnicode(HWND hwnd)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* maybe we'll export this for comdlg32 */
|
||||
void WINAPI SetWindowUnicode(HWND hWnd, BOOL bUnicode)
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
__declspec(dllexport)
|
||||
void SetWindowUnicode(HWND hWnd, BOOL bUnicode)
|
||||
{
|
||||
GrabWin16Lock();
|
||||
_SetWindowUnicode( HWNDtoPWND(hWnd), bUnicode );
|
||||
@ -253,7 +257,6 @@ LONG WINAPI GetWindowLongW_NEW(HWND hWnd, int nIndex)
|
||||
SetLastError(ERROR_ACCESS_DENIED);
|
||||
return 0L;
|
||||
}
|
||||
DBGPRINTF(("GetWindowProcW: %p(A) -> %p(W)\n",ret,ConvertWndProcAToW((WNDPROC)ret)));
|
||||
ret = (LONG)ConvertWndProcAToW( (WNDPROC)ret );
|
||||
}
|
||||
return ret;
|
||||
@ -270,7 +273,6 @@ LONG WINAPI SetWindowLongW_NEW(HWND hWnd, int nIndex, LONG dwNewLong)
|
||||
SetLastError(ERROR_ACCESS_DENIED);
|
||||
return 0L;
|
||||
}
|
||||
DBGPRINTF(("SetWindowProcW[(%p)new]: %p(W) => %p(A)\n",hWnd,dwNewLong,ConvertWndProcWToA((WNDPROC)dwNewLong)));
|
||||
dwNewLong = (LONG)ConvertWndProcWToA( (WNDPROC)dwNewLong );
|
||||
}
|
||||
|
||||
@ -278,7 +280,6 @@ LONG WINAPI SetWindowLongW_NEW(HWND hWnd, int nIndex, LONG dwNewLong)
|
||||
|
||||
if ( nIndex == GWL_WNDPROC && ret ) //oh, you're unicode subclassed!
|
||||
{
|
||||
DBGPRINTF(("SetWindowProcW[(%p)old]: %p(A) => %p(W)\n",hWnd,ret,ConvertWndProcAToW((WNDPROC)ret)));
|
||||
SetWindowUnicode( hWnd, TRUE );
|
||||
ret = (LONG)ConvertWndProcAToW( (WNDPROC)ret );
|
||||
}
|
||||
@ -406,7 +407,7 @@ static void CALLBACK UnicodeEvent( HWINEVENTHOOK hWinEventHook, DWORD event, HWN
|
||||
else
|
||||
{
|
||||
THUNKPROC proc = (THUNKPROC)_GetWindowProc32( pwnd );
|
||||
if ( (DWORD)proc & 0x80000000 || (proc && proc->sign == wtoa_code && IsValidThunk(proc)) ) //shared control or Unicode thunk
|
||||
if ( IS_SHARED(proc) || (proc && proc->sign == wtoa_code && IsValidThunk(proc)) ) //shared control or Unicode thunk
|
||||
isUnicode = TRUE;
|
||||
}
|
||||
if ( isUnicode ) _SetWindowUnicode( pwnd, TRUE );
|
||||
@ -463,9 +464,7 @@ HWND WINAPI CreateDialogParamW_NEW( HINSTANCE hInstance, LPCTSTR lpTemplateName,
|
||||
|
||||
STACK_WtoA(lpTemplateName, lpTemplateNameA);
|
||||
uniEvent = SetWinCreateEvent(UnicodeEvent);
|
||||
DBGPRINTF(("CreateDialogParamW started (proc %p), eventhook %p\n",lpDialogFunc,uniEvent));
|
||||
ret = CreateDialogParamA( hInstance, lpTemplateNameA, hWndParent, lpDialogFunc, dwInitParam );
|
||||
DBGPRINTF(("CreateDialogParamW finished: %p\n",ret));
|
||||
UnhookWinEvent(uniEvent);
|
||||
return ret;
|
||||
}
|
||||
@ -477,7 +476,6 @@ HWND WINAPI CreateDialogIndirectParamW_NEW( HINSTANCE hInstance, LPCDLGTEMPLATE
|
||||
HWND ret;
|
||||
|
||||
uniEvent = SetWinCreateEvent(UnicodeEvent);
|
||||
DBGPRINTF(("CreateDialogIndirectParamW started (proc %p), eventhook %p\n",lpDialogFunc,uniEvent));
|
||||
ret = CreateDialogIndirectParamA( hInstance, lpTemplate, hWndParent, lpDialogFunc, lParamInit );
|
||||
UnhookWinEvent(uniEvent);
|
||||
return ret;
|
||||
@ -492,7 +490,6 @@ INT_PTR WINAPI DialogBoxParamW_NEW( HINSTANCE hInstance, LPCWSTR lpTemplateName
|
||||
|
||||
STACK_WtoA( lpTemplateName, lpTemplateNameA );
|
||||
uniEvent = SetWinCreateEvent(UnicodeEvent);
|
||||
DBGPRINTF(("DialogBoxParamW started (proc %p), eventhook %p\n",lpDialogFunc,uniEvent));
|
||||
ret = DialogBoxParamA( hInstance, lpTemplateNameA, hWndParent, lpDialogFunc, dwInitParam );
|
||||
UnhookWinEvent(uniEvent);
|
||||
return ret;
|
||||
@ -506,7 +503,6 @@ INT_PTR WINAPI DialogBoxIndirectParamW_NEW( HINSTANCE hInstance, LPCDLGTEMPLATE
|
||||
|
||||
|
||||
uniEvent = SetWinCreateEvent(UnicodeEvent);
|
||||
DBGPRINTF(("DialogBoxIndirectParamW started (proc %p), eventhook %p\n",lpDialogFunc,uniEvent));
|
||||
ret = DialogBoxIndirectParamA( hInstance, hDialogTemplate, hWndParent, lpDialogFunc, dwInitParam );
|
||||
UnhookWinEvent(uniEvent);
|
||||
return ret;
|
||||
@ -552,12 +548,11 @@ LRESULT WINAPI DefWindowProcW_NEW( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lP
|
||||
BOOL WINAPI SetWindowTextW_NEW( HWND hWnd, LPCWSTR lpString)
|
||||
{
|
||||
if ( !hWnd || !lpString ) return FALSE;
|
||||
if ( !ISOURPROCESSHWND(hWnd) )
|
||||
{
|
||||
SetLastError(ERROR_ACCESS_DENIED);
|
||||
return FALSE;
|
||||
}
|
||||
if ( ISOURPROCESSHWND(hWnd) )
|
||||
return SendMessageW_NEW( hWnd, WM_SETTEXT, 0, (LPARAM)lpString );
|
||||
else
|
||||
return DefWindowProcW_NEW( hWnd, WM_SETTEXT, 0, (LPARAM)lpString );
|
||||
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT SetDlgItemTextW_NEW=SetDlgItemTextW */
|
||||
|
@ -11,6 +11,7 @@ static DWORD GetWindowProcessId( HWND hwnd )
|
||||
}
|
||||
|
||||
#define ISOURPROCESSHWND(hwnd) ( GetWindowProcessId(hwnd) == GetCurrentProcessId() )
|
||||
#define IS_SHARED(x) (((DWORD)x) & 0x80000000)
|
||||
|
||||
#define WS_EX_UNICODE 0x80000000
|
||||
#define WF_EX_WIN32 0x02000000
|
||||
@ -37,7 +38,14 @@ LRESULT WINAPI DefWindowProcW_NEW( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lP
|
||||
LRESULT WINAPI DefDlgProcW_NEW( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT WINAPI DefMDIChildProcW_NEW( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||
BOOL IsWindowReallyUnicode(HWND hwnd);
|
||||
BOOL WINAPI IsWindowUnicode_NEW( HWND hWnd );
|
||||
|
||||
LRESULT WINAPI SendMessageA_fix(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
BOOL InitUniThunkLayer();
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
__declspec(dllexport)
|
||||
void SetWindowUnicode(HWND hWnd, BOOL bUnicode);
|
||||
|
@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
#include <malloc.h>
|
||||
#include "common.h"
|
||||
#include "kexcoresdk.h"
|
||||
|
||||
#ifndef __THUNIMACRO_H
|
||||
@ -30,27 +31,6 @@
|
||||
|
||||
#define MAX_STACK 512
|
||||
|
||||
//In macroses: convert A<->W on stack
|
||||
#define STACK_WtoA(strW,strA) \
|
||||
strA = (LPSTR)strW; \
|
||||
if HIWORD(strW) \
|
||||
{ \
|
||||
int c = lstrlenW((LPWSTR)strW); \
|
||||
c = (c+1)*2; \
|
||||
strA = (LPSTR)alloca(c); \
|
||||
WideCharToMultiByte(CP_ACP, 0, (LPWSTR)strW, -1, (LPSTR)strA, c, NULL, NULL); \
|
||||
}
|
||||
|
||||
#define STACK_AtoW(strA,strW) \
|
||||
strW = (LPWSTR)strA; \
|
||||
if (HIWORD(strA)) \
|
||||
{ \
|
||||
int c = lstrlenA((LPSTR)strA); \
|
||||
c++; \
|
||||
strW = (LPWSTR)alloca(c*sizeof(WCHAR)); \
|
||||
MultiByteToWideChar(CP_ACP, 0, (LPSTR)strA, -1, (LPWSTR)strW, c); \
|
||||
}
|
||||
|
||||
//Out macroses: allocate buffer, call W>-<A function, convert A<->W
|
||||
#define ABUFFER_ALLOC(buffer,len) \
|
||||
int buffer##size = ((len+1) * 2); \
|
||||
|
@ -43,7 +43,7 @@ RSC=rc.exe
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "KERNELEXBASESHARED_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /O2 /I "." /I "../../common" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D _WIN32_WINNT=0x0500 /YX /FD /TP /GF /c
|
||||
# ADD CPP /nologo /W3 /O2 /I "." /I "../../common" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D _WIN32_WINNT=0x0500 /YX /FD /TP /GF /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x415 /d "NDEBUG"
|
||||
@ -70,7 +70,7 @@ LINK32=link.exe
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "KERNELEXBASESHARED_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /Zi /Od /I "." /I "../../common" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D _WIN32_WINNT=0x0500 /YX /FD /TP /GZ /GF /c
|
||||
# ADD CPP /nologo /W3 /Gm /Zi /Od /I "." /I "../../common" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D _WIN32_WINNT=0x0500 /YX /FD /TP /GZ /GF /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x415 /d "_DEBUG"
|
||||
@ -125,7 +125,11 @@ SOURCE=.\Kernel32\CreateThread_fix.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\DeleteCriticalSection.c
|
||||
SOURCE=.\Kernel32\CriticalSection_fix.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\ExitProcess_fix.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@ -333,6 +337,14 @@ SOURCE=.\User32\MapVirtualKey_fix.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\User32\Menu.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\User32\RawInput.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\User32\SendMessage_fix.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -413,6 +425,18 @@ SOURCE=.\Gdi32\GetGlyphOutlineA_fix.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Gdi32\GetTextExtentPoint32_fix.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Gdi32\Orhpans.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Gdi32\Orhpans.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Gdi32\TextOut.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -437,6 +461,10 @@ SOURCE=.\Advapi32\_advapi32_stubs.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Advapi32\lsa.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Advapi32\OpenSCManager_stub.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -542,7 +570,7 @@ SOURCE=.\comctl32\syslink.c
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\common.c
|
||||
SOURCE=..\..\common\common.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@ -636,7 +664,7 @@ SOURCE=.\main.c
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\common.h
|
||||
SOURCE=..\..\common\common.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
|
@ -31,6 +31,8 @@ DWORD WINAPI GetFileVersionInfoSizeW_new(LPWSTR filenameW, LPDWORD handle)
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(filename);
|
||||
size = GetFileVersionInfoSizeA(filenameA, handle);
|
||||
if (size == 0)
|
||||
return size;
|
||||
return size * (1 + sizeof(WCHAR)) + 4;
|
||||
}
|
||||
|
||||
|
@ -13,10 +13,12 @@ REGEDIT4
|
||||
"*\\FIREFOX*PRE*.INSTALLER.EXE"="WINXP"
|
||||
"*\\XUL.DLL"="NT2K"
|
||||
"*\\FIREFOX.EXE"="DCFG1"
|
||||
"*\\SEAMONKEY SETUP 2*.EXE"="WINXP"
|
||||
"*\\SEAMONKEY.EXE"="DCFG1"
|
||||
;-Java
|
||||
"*\\JAVA.EXE"="DCFG1"
|
||||
"*\\JAVAW.EXE"="DCFG1"
|
||||
"*\\JVM.DLL"="DCFG1"
|
||||
;-GIMP
|
||||
"*\\BIN\\GIMP-2.6.EXE"="NT2K"
|
||||
"*\\GIMP-2.6*-SETUP.EXE"="NT2K"
|
||||
@ -35,6 +37,12 @@ REGEDIT4
|
||||
"*\\BIN\\WIZARDGRAPHICALCLIENT.EXE"="NOHEAP"
|
||||
;-MPC Home Cinema Setup
|
||||
"*\\MPC-HOMECINEMA.1.*.EXE"="WINXP"
|
||||
;-Office 2003
|
||||
"*\\OFFICE11\\MSO.DLL"="NT2K"
|
||||
"*\\OFFICE11\\WORDVIEW.EXE"="NT2K"
|
||||
;-Office 2007
|
||||
"*\\OFFICE12\\MSO.DLL"="NT2K"
|
||||
"*\\OFFICE12\\WORDCONV.EXE"="NT2K"
|
||||
|
||||
[HKEY_LOCAL_MACHINE\Software\KernelEx\AppSettings\Flags]
|
||||
;DISABLE KERNELEX FOR:
|
||||
|
@ -56,3 +56,31 @@ void fatal_error(const char* msg)
|
||||
MessageBox(NULL, msg, "KernelEx error", MB_OK | MB_ICONERROR);
|
||||
ExitProcess(1);
|
||||
}
|
||||
|
||||
size_t lstrlenAnull(LPCSTR s)
|
||||
{
|
||||
__try
|
||||
{
|
||||
LPCSTR ss = s;
|
||||
while (*ss) ss++;
|
||||
return ss - s + 1;
|
||||
}
|
||||
__except (EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
size_t lstrlenWnull(LPCWSTR s)
|
||||
{
|
||||
__try
|
||||
{
|
||||
LPCWSTR ss = s;
|
||||
while (*ss) ss++;
|
||||
return ss - s + 1;
|
||||
}
|
||||
__except (EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -26,6 +26,7 @@
|
||||
#include <windows.h>
|
||||
#include <malloc.h>
|
||||
#include "kexcoresdk.h"
|
||||
#include "k32ord.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -38,10 +39,12 @@ typedef int __stdcall FWDPROC(void);
|
||||
|
||||
extern int acp_mcs;
|
||||
BOOL common_init(void);
|
||||
int WINAPI CommonUnimpStub(void);
|
||||
char* file_fixWprefix(char* in);
|
||||
void fatal_error(const char* msg);
|
||||
|
||||
size_t lstrlenAnull(LPCSTR s);
|
||||
size_t lstrlenWnull(LPCWSTR s);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
@ -61,7 +64,7 @@ void fatal_error(const char* msg);
|
||||
{ \
|
||||
__asm xor eax,eax \
|
||||
__asm mov cl, params \
|
||||
__asm jmp CommonUnimpStub \
|
||||
__asm jmp dword ptr [CommonUnimpStub] \
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -115,4 +118,29 @@ void fatal_error(const char* msg);
|
||||
#define file_ABUFtoW(str, cntsrc, bsize) \
|
||||
MultiByteToWideChar(file_CP, 0, str##A, cntsrc, str##W, bsize)
|
||||
|
||||
//In macros: convert A<->W on stack
|
||||
#define STACK_WtoA(strW,strA) \
|
||||
strA = (LPSTR)strW; \
|
||||
if (HIWORD(strW)) \
|
||||
{ \
|
||||
int c = lstrlenWnull((LPCWSTR)strW); \
|
||||
if (c) \
|
||||
{ \
|
||||
strA = (LPSTR)alloca(c*2); \
|
||||
WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)strW, -1, (LPSTR)strA, c, NULL, NULL); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define STACK_AtoW(strA,strW) \
|
||||
strW = (LPWSTR)strA; \
|
||||
if (HIWORD(strA)) \
|
||||
{ \
|
||||
int c = lstrlenAnull((LPCSTR)strA); \
|
||||
if (c) \
|
||||
{ \
|
||||
strW = (LPWSTR)alloca(c*sizeof(WCHAR)); \
|
||||
MultiByteToWideChar(CP_ACP, 0, (LPCSTR)strA, -1, (LPWSTR)strW, c); \
|
||||
} \
|
||||
}
|
||||
|
||||
#endif
|
@ -16,3 +16,4 @@ EXPORTS
|
||||
MakeCriticalSectionGlobal
|
||||
MapSL
|
||||
LoadLibrary16 @35 NONAME
|
||||
K32_RtlNtStatusToDosError
|
||||
|
@ -62,6 +62,7 @@ MAKE_HEADER(ULONG __stdcall CommonUnimpStub())
|
||||
|
||||
MAKE_HEADER(DWORD __stdcall MapSL(DWORD addr16))
|
||||
MAKE_HEADER(DWORD __stdcall LoadLibrary16(LPSTR libname))
|
||||
MAKE_HEADER(ULONG __stdcall K32_RtlNtStatusToDosError(LONG status))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef __STRUCTS_H
|
||||
#define __STRUCTS_H
|
||||
#ifndef __KSTRUCTS_H
|
||||
#define __KSTRUCTS_H
|
||||
|
||||
// Kernel32 Objects (WIN98)
|
||||
#define WIN98_K32OBJ_SEMAPHORE 0x1
|
||||
#define WIN98_K32OBJ_EVENT 0x2
|
||||
#define WIN98_K32OBJ_MUTEX 0x3
|
||||
@ -94,7 +95,8 @@ typedef struct _MODREF { // Size = 0x1C + 4*cImportedModules
|
||||
|
||||
// IMTE
|
||||
typedef struct _IMTE { // Size = 0x3C
|
||||
DWORD unknown1; // 00
|
||||
WORD unknown1; // 00
|
||||
WORD unknown1A; // 02
|
||||
IMAGE_NT_HEADERS* pNTHdr; // 04 pointer to shared PE header for module
|
||||
DWORD unknown2; // 08
|
||||
PSTR pszFileName; // 0C long path name
|
||||
@ -282,6 +284,39 @@ typedef struct _TDBX98 {
|
||||
DWORD BlockedOnID; // 54
|
||||
} TDBX98, *PTDBX98;
|
||||
|
||||
// File mapping object
|
||||
typedef struct _FILEMAPPING { // Size = 0x28 (from Kernel32)
|
||||
WORD type; // 00 WIN98_K32OBJ_MEM_MAPPED_FILE
|
||||
WORD refCount; // 02 object reference count
|
||||
PVOID kernObj; // 04 some kernel heap object
|
||||
DWORD Unknown1; // 08
|
||||
PVOID mapaddr; // 0C current mapped address
|
||||
DWORD Unknown2[6]; // 10
|
||||
} FILEMAPPING, *PFILEMAPPING;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif
|
||||
#pragma warning (disable:4035) // turn off no return code warning
|
||||
|
||||
static inline
|
||||
PDB98* get_pdb(void)
|
||||
{
|
||||
__asm mov eax, fs:30h
|
||||
}
|
||||
|
||||
static inline
|
||||
TIB98* get_tib(void)
|
||||
{
|
||||
__asm mov eax, fs:18h
|
||||
}
|
||||
|
||||
static inline
|
||||
TDB98* get_tdb(void)
|
||||
{
|
||||
get_tib();
|
||||
__asm sub eax, 8h
|
||||
}
|
||||
|
||||
#pragma warning (default:4035) // turn on no return code warning
|
||||
|
||||
#endif /* __KSTRUCTS_H */
|
@ -22,9 +22,9 @@
|
||||
#ifndef __VERSION_H
|
||||
#define __VERSION_H
|
||||
|
||||
#define VERSION_STR "4.5 RC 4"
|
||||
#define VERSION_CODE 0x0405000E
|
||||
#define RCVERSION 4, 5, 1, 4
|
||||
#define _RCVERSION_ "4, 5, 1, 4"
|
||||
#define VERSION_STR "4.5 RC 5"
|
||||
#define VERSION_CODE 0x0405000F
|
||||
#define RCVERSION 4, 5, 1, 5
|
||||
#define _RCVERSION_ "4, 5, 1, 5"
|
||||
|
||||
#endif
|
||||
|
@ -22,7 +22,7 @@
|
||||
#ifndef __MODINIT_H
|
||||
#define __MODINIT_H
|
||||
|
||||
#include "structs.h"
|
||||
#include "kstructs.h"
|
||||
|
||||
bool ModuleInitializer_init();
|
||||
|
||||
|
@ -294,6 +294,10 @@ SOURCE=..\common\kexcoresdk.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\common\kstructs.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ModInit.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -322,10 +326,6 @@ SOURCE=..\common\sstring.hpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\structs.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\thunks.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -22,7 +22,7 @@
|
||||
#ifndef __INTERNALS_H
|
||||
#define __INTERNALS_H
|
||||
|
||||
#include "structs.h"
|
||||
#include "kstructs.h"
|
||||
#include "sharedmem.h"
|
||||
#include "sstring.hpp"
|
||||
#include "resource.h"
|
||||
|
@ -22,7 +22,7 @@
|
||||
#ifndef __RESOLVER_H
|
||||
#define __RESOLVER_H
|
||||
|
||||
#include "structs.h"
|
||||
#include "kstructs.h"
|
||||
#include "apilib.h"
|
||||
|
||||
/***** loader flags *****/
|
||||
|
@ -70,80 +70,71 @@ HRESULT STDMETHODCALLTYPE CShellLink::QueryInterface(
|
||||
/* [in] */ REFIID riid,
|
||||
/* [iid_is][out] */ void **ppvObject)
|
||||
{
|
||||
HRESULT hr;
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
if (riid == IID_IUnknown)
|
||||
{
|
||||
hr = S_OK;
|
||||
if (!m_ShellLinkA)
|
||||
hr = m_Unknown->QueryInterface(IID_IShellLinkA, (void**) &m_ShellLinkA);
|
||||
*ppvObject = static_cast<IUnknown*>(static_cast<IShellLinkA*>(this));
|
||||
}
|
||||
else if (riid == IID_IShellLinkA)
|
||||
{
|
||||
if (m_ShellLinkA)
|
||||
m_ShellLinkA->Release();
|
||||
if (!m_ShellLinkA)
|
||||
hr = m_Unknown->QueryInterface(IID_IShellLinkA, (void**) &m_ShellLinkA);
|
||||
*ppvObject = static_cast<IShellLinkA*>(this);
|
||||
}
|
||||
else if (riid == IID_IShellLinkW)
|
||||
{
|
||||
if (m_ShellLinkA)
|
||||
m_ShellLinkA->Release();
|
||||
if (!m_ShellLinkA)
|
||||
hr = m_Unknown->QueryInterface(IID_IShellLinkA, (void**) &m_ShellLinkA);
|
||||
*ppvObject = static_cast<IShellLinkW*>(this);
|
||||
}
|
||||
else if (riid == IID_IPersistFile)
|
||||
{
|
||||
if (m_PersistFile)
|
||||
m_PersistFile->Release();
|
||||
if (!m_PersistFile)
|
||||
hr = m_Unknown->QueryInterface(IID_IPersistFile, (void**) &m_PersistFile);
|
||||
*ppvObject = static_cast<IPersistFile*>(this);
|
||||
}
|
||||
else if (riid == IID_IPersistStream)
|
||||
{
|
||||
if (m_PersistStream)
|
||||
m_PersistStream->Release();
|
||||
if (!m_PersistStream)
|
||||
hr = m_Unknown->QueryInterface(IID_IPersistStream, (void**) &m_PersistStream);
|
||||
*ppvObject = static_cast<IPersistStream*>(this);
|
||||
}
|
||||
else if (riid == IID_IShellExtInit)
|
||||
{
|
||||
if (m_ShellExtInit)
|
||||
m_ShellExtInit->Release();
|
||||
if (!m_ShellExtInit)
|
||||
hr = m_Unknown->QueryInterface(IID_IShellExtInit, (void**) &m_ShellExtInit);
|
||||
*ppvObject = static_cast<IShellExtInit*>(this);
|
||||
}
|
||||
else if (riid == IID_IContextMenu)
|
||||
{
|
||||
if (m_ContextMenu)
|
||||
m_ContextMenu->Release();
|
||||
if (!m_ContextMenu)
|
||||
hr = m_Unknown->QueryInterface(IID_IContextMenu, (void**) &m_ContextMenu);
|
||||
*ppvObject = static_cast<IContextMenu*>(this);
|
||||
}
|
||||
else if (riid == IID_IContextMenu2)
|
||||
{
|
||||
if (m_ContextMenu2)
|
||||
m_ContextMenu2->Release();
|
||||
if (!m_ContextMenu2)
|
||||
hr = m_Unknown->QueryInterface(IID_IContextMenu2, (void**) &m_ContextMenu2);
|
||||
*ppvObject = static_cast<IContextMenu2*>(this);
|
||||
}
|
||||
else if (riid == IID_IDropTarget)
|
||||
{
|
||||
if (m_DropTarget)
|
||||
m_DropTarget->Release();
|
||||
if (!m_DropTarget)
|
||||
hr = m_Unknown->QueryInterface(IID_IDropTarget, (void**) &m_DropTarget);
|
||||
*ppvObject = static_cast<IDropTarget*>(this);
|
||||
}
|
||||
else if (riid == IID_IExtractIconA)
|
||||
{
|
||||
if (m_ExtractIconA)
|
||||
m_ExtractIconA->Release();
|
||||
if (!m_ExtractIconA)
|
||||
hr = m_Unknown->QueryInterface(IID_IExtractIconA, (void**) &m_ExtractIconA);
|
||||
*ppvObject = static_cast<IExtractIconA*>(this);
|
||||
}
|
||||
else if (riid == IID_IExtractIconW)
|
||||
{
|
||||
if (m_ExtractIconA)
|
||||
m_ExtractIconA->Release();
|
||||
if (!m_ExtractIconA)
|
||||
hr = m_Unknown->QueryInterface(IID_IExtractIconA, (void**) &m_ExtractIconA);
|
||||
*ppvObject = static_cast<IExtractIconW*>(this);
|
||||
}
|
||||
|
@ -54,8 +54,8 @@ END
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,0,5
|
||||
PRODUCTVERSION 1,0,0,5
|
||||
FILEVERSION 1,0,0,6
|
||||
PRODUCTVERSION 1,0,0,6
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@ -73,14 +73,14 @@ BEGIN
|
||||
VALUE "Comments", "\0"
|
||||
VALUE "CompanyName", "Xeno86\0"
|
||||
VALUE "FileDescription", "sheet\0"
|
||||
VALUE "FileVersion", "1, 0, 0, 4\0"
|
||||
VALUE "FileVersion", "1, 0, 0, 6\0"
|
||||
VALUE "InternalName", "sheet\0"
|
||||
VALUE "LegalCopyright", "Copyright <20> 2009-2010, Xeno86\0"
|
||||
VALUE "LegalTrademarks", "\0"
|
||||
VALUE "OriginalFilename", "sheet.dll\0"
|
||||
VALUE "PrivateBuild", "\0"
|
||||
VALUE "ProductName", "KernelEx\0"
|
||||
VALUE "ProductVersion", "1, 0, 0, 5\0"
|
||||
VALUE "ProductVersion", "1, 0, 0, 6\0"
|
||||
VALUE "SpecialBuild", "\0"
|
||||
END
|
||||
END
|
||||
@ -112,8 +112,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
|
||||
IDD_PROPPAGE DIALOG DISCARDABLE 0, 0, 232, 191
|
||||
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||
CAPTION "Compatibility"
|
||||
FONT 8, "MS Sans Serif"
|
||||
CAPTION "KernelEx"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
GROUPBOX "Basic options",IDC_GCOMPAT,7,30,218,78
|
||||
CONTROL "Use default compatibility options [%s]",IDC_DEFAULT,
|
||||
|
Reference in New Issue
Block a user