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

import KernelEx-4.5-Final

This commit is contained in:
UzixLS
2018-11-03 16:23:17 +03:00
parent 309977e788
commit 7571e3c60d
125 changed files with 11876 additions and 9943 deletions

View File

@ -104,7 +104,7 @@ static int strlenWW(LPWSTR strWW)
//misc
#define StrAllocA(size) (LPSTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,size)
#define StrFree(ptr) HeapFree(GetProcessHeap(),0,ptr)
#define StrFree(ptr) if (ptr) HeapFree(GetProcessHeap(),0,ptr)
BOOL WINAPI GetSaveFileNameA_fix(LPOPENFILENAMEA lpofn);
BOOL WINAPI GetOpenFileNameA_fix(LPOPENFILENAMEA lpofn);

View File

@ -0,0 +1,120 @@
/*
* KernelEx
* Copyright 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 <wintrust.h>
typedef struct {
DWORD dwSize;
HWND hwndParent;
DWORD dwFlags;
LPCWSTR szTitle;
PCCTL_CONTEXT pCtlContext;
DWORD unknown[6];
} CRYPTUI_VIEWCTL_STRUCTW; //size = 0x2C
typedef struct {
DWORD dwSize;
HWND hwndParent;
DWORD dwFlags;
LPCWSTR szTitle;
PCCRL_CONTEXT pCtlContext;
DWORD unknown[4];
} CRYPTUI_VIEWCRL_STRUCTW; //size = 0x24
typedef struct tagCRYPTUI_VIEWCERTIFICATE_STRUCTW {
DWORD dwSize;
HWND hwndParent;
DWORD dwFlags;
LPCWSTR szTitle;
PCCERT_CONTEXT pCertContext;
LPCSTR* rgszPurposes;
DWORD cPurposes;
union
{
CRYPT_PROVIDER_DATA const* pCryptProviderData;
HANDLE hWVTStateData;
};
BOOL fpCryptProviderDataTrustedUsage;
DWORD idxSigner;
DWORD idxCert;
BOOL fCounterSigner;
DWORD idxCounterSigner;
DWORD cStores;
HCERTSTORE* rghStores;
DWORD cPropSheetPages;
LPCPROPSHEETPAGEW rgPropSheetPages;
DWORD nStartPage;
} CRYPTUI_VIEWCERTIFICATE_STRUCTW,*PCRYPTUI_VIEWCERTIFICATE_STRUCTW;
typedef const CRYPTUI_VIEWCERTIFICATE_STRUCTW *PCCRYPTUI_VIEWCERTIFICATE_STRUCTW;
#ifdef __cplusplus
extern "C" {
#endif
BOOL WINAPI CryptUIDlgViewCertificateW(PCCRYPTUI_VIEWCERTIFICATE_STRUCTW, BOOL*);
BOOL WINAPI CryptUIDlgViewCTLW(CRYPTUI_VIEWCTL_STRUCTW*);
BOOL WINAPI CryptUIDlgViewCRLW(CRYPTUI_VIEWCRL_STRUCTW*);
#ifdef __cplusplus
}
#endif
/* MAKE_EXPORT CryptUIDlgViewContext_new=CryptUIDlgViewContext */
BOOL WINAPI CryptUIDlgViewContext_new( DWORD dwContextType, const void *pvContext,
HWND hwnd, LPCWSTR pwszTitle, DWORD dwFlags, void *pvReserved)
{
switch (dwContextType) {
case CERT_STORE_CERTIFICATE_CONTEXT:
{
CRYPTUI_VIEWCERTIFICATE_STRUCTW certW;
memset(&certW,0,sizeof(certW));
certW.dwSize = sizeof(certW);
certW.hwndParent = hwnd;
certW.szTitle = pwszTitle;
certW.pCertContext = (PCERT_CONTEXT)pvContext;
return CryptUIDlgViewCertificateW(&certW,NULL);
}
break;
case CERT_STORE_CTL_CONTEXT:
{
CRYPTUI_VIEWCTL_STRUCTW ctlW;
memset(&ctlW,0,sizeof(ctlW));
ctlW.dwSize = sizeof(ctlW);
ctlW.hwndParent = hwnd;
ctlW.szTitle = pwszTitle;
ctlW.pCtlContext = (PCCTL_CONTEXT)pvContext;
return CryptUIDlgViewCTLW(&ctlW);
}
break;
case CERT_STORE_CRL_CONTEXT:
{
CRYPTUI_VIEWCRL_STRUCTW crlW;
memset(&crlW,0,sizeof(crlW));
crlW.dwSize = sizeof(crlW);
crlW.hwndParent = hwnd;
crlW.szTitle = pwszTitle;
crlW.pCtlContext = (PCCRL_CONTEXT)pvContext;
return CryptUIDlgViewCRLW(&crlW);
}
break;
default:
return FALSE;
}
}

View File

@ -0,0 +1,45 @@
/*
* 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"
#include "_cryptui_apilist.h"
BOOL init_cryptui()
{
return TRUE;
}
static const apilib_named_api cryptui_named_apis[] =
{
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
DECL_API("CryptUIDlgViewContext", CryptUIDlgViewContext_new),
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
};
#if 0
static const apilib_unnamed_api cryptui_ordinal_apis[] =
{
/*** AUTOGENERATED APILIST ORDINAL EXPORTS BEGIN ***/
/*** AUTOGENERATED APILIST ORDINAL EXPORTS END ***/
};
#endif
const apilib_api_table apitable_cryptui = DECL_TAB("CRYPTUI.DLL", cryptui_named_apis, 0 /*cryptui_ordinal_apis*/);

View File

@ -0,0 +1,34 @@
/*
* KernelEx
* Copyright (C) 2010, Tihiy
*
* This file is part of KernelEx source code.
*
* KernelEx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; version 2 of the License.
*
* KernelEx is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef _CRYPTUI_APILIST_H
#define _CRYPTUI_APILIST_H
#include "kexcoresdk.h"
BOOL init_cryptui();
extern const apilib_api_table apitable_cryptui;
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
BOOL WINAPI CryptUIDlgViewContext_new(DWORD dwContextType, const void *pvContext, HWND hwnd, LPCWSTR pwszTitle, DWORD dwFlags, void *pvReserved);
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
#endif

View File

@ -10,3 +10,4 @@ shfolder
winmm
ws2_32
ole32
cryptui

View File

@ -48,15 +48,15 @@ FONTUID GetHDCFontUID(HDC hdc)
/* MAKE_EXPORT GetGlyphIndicesW_new=GetGlyphIndicesW */
int WINAPI GetGlyphIndicesW_new(
HDC hdc, // handle to DC
LPWSTR lpstr, // string to convert
int c, // number of characters in string
LPWORD pgi, // array of glyph indices
DWORD fl // glyph options
HDC hdc, // handle to DC
LPWSTR lpstr, // string to convert
int c, // number of characters in string
LPWORD pgi, // array of glyph indices
DWORD fl // glyph options
)
{
HRESULT result;
if (!hdc || !pgi || (UINT)lpstr<0xFFFFu || !c) return GDI_ERROR;
if (!hdc || !pgi || (UINT)lpstr<0xFFFFu || c<=0) return GDI_ERROR;
ScriptCache::instance.Lock();
FONTUID hFont = GetHDCFontUID(hdc);
SCRIPT_CACHE cache = ScriptCache::instance.GetCache(hFont);
@ -110,41 +110,39 @@ static int WINAPI GdiGetCodePage( HDC hdc )
/* MAKE_EXPORT GetGlyphIndicesA_new=GetGlyphIndicesA */
int WINAPI GetGlyphIndicesA_new(
HDC hdc, // handle to DC
LPCSTR lpstr, // string to convert
int c, // number of characters in string
LPWORD pgi, // array of glyph indices
DWORD fl // glyph options
HDC hdc, // handle to DC
LPCSTR lpstr, // string to convert
int c, // number of characters in string
LPWORD pgi, // array of glyph indices
DWORD fl // glyph options
)
{
int result;
LPWSTR lpstrwide;
if (!hdc || !pgi || (UINT)lpstr<0xFFFF || c<=0) return GDI_ERROR;
lpstrwide = (LPWSTR)alloca(c*sizeof(WCHAR));
if (MultiByteToWideChar(GdiGetCodePage(hdc),0,lpstr,c,lpstrwide,c))
result = GetGlyphIndicesW_new(hdc,lpstrwide,c,pgi,fl);
else
result = GDI_ERROR;
return result;
c = MultiByteToWideChar(GdiGetCodePage(hdc),0,lpstr,c,lpstrwide,c);
if (!c)
return GDI_ERROR;
return GetGlyphIndicesW_new(hdc,lpstrwide,c,pgi,fl);
}
/* MAKE_EXPORT GetTextExtentExPointI_new=GetTextExtentExPointI */
BOOL WINAPI GetTextExtentExPointI_new(
HDC hdc, // handle to DC
LPWORD pgiIn, // array of glyph indices
int cgi, // number of glyphs in array
int nMaxExtent, // maximum width of formatted string
LPINT lpnFit, // maximum number of characters
LPINT alpDx, // array of partial string widths
LPSIZE lpSize // string dimensions
HDC hdc, // handle to DC
LPWORD pgiIn, // array of glyph indices
int cgi, // number of glyphs in array
int nMaxExtent, // maximum width of formatted string
LPINT lpnFit, // maximum number of characters
LPINT alpDx, // array of partial string widths
LPSIZE lpSize // string dimensions
)
{
ABC abc;
WORD* glyph = pgiIn;
int* dxs = alpDx;
int i;
int sum = 0;
int glyphwidth;
int glyphwidth;
int charextra = GetTextCharacterExtra(hdc);
ABC abc;
BOOL unfit = FALSE;
if ( !hdc || !pgiIn || cgi<=0 || !lpSize)
@ -152,25 +150,30 @@ BOOL WINAPI GetTextExtentExPointI_new(
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
ScriptCache::instance.Lock();
FONTUID hFont = GetHDCFontUID(hdc);
SCRIPT_CACHE cache = ScriptCache::instance.GetCache(hFont);
//in UberKern, ScriptPlace was used. However, it's too costly...
//so let's compute the info ourselves
if (lpnFit) *lpnFit = cgi;
for (i = 0; i < cgi; i++)
{
if ( ScriptGetGlyphABCWidth(hdc,&cache,*glyph,&abc) != S_OK ) break;
glyphwidth = abc.abcA + abc.abcB + abc.abcC;
sum += glyphwidth;
if ( ScriptGetGlyphABCWidth(hdc,&cache,*pgiIn,&abc) != S_OK ) break;
glyphwidth = abc.abcA + abc.abcB + abc.abcC + charextra;
sum += glyphwidth;
if ( !unfit )
{
unfit = ( sum > nMaxExtent );
if (alpDx) {*dxs = sum; dxs++;}
if (unfit && lpnFit) *lpnFit = i+1; //test test!
if (unfit)
{
if ( lpnFit ) *lpnFit = i;
}
else
{
if ( alpDx ) *alpDx++ = sum;
}
}
glyph++;
pgiIn++;
}
lpSize->cx = sum;
@ -183,22 +186,22 @@ BOOL WINAPI GetTextExtentExPointI_new(
/* MAKE_EXPORT GetTextExtentPointI_new=GetTextExtentPointI */
BOOL WINAPI GetTextExtentPointI_new(
HDC hdc, // handle to DC
LPWORD pgiIn, // glyph indices
int cgi, // number of indices in array
LPSIZE lpSize // string size
HDC hdc, // handle to DC
LPWORD pgiIn, // glyph indices
int cgi, // number of indices in array
LPSIZE lpSize // string size
)
{
return GetTextExtentExPointI_new(hdc,pgiIn,cgi,32768,0,0,lpSize);
return GetTextExtentExPointI_new(hdc,pgiIn,cgi,0,0,0,lpSize);
}
/* MAKE_EXPORT GetCharWidthI_new=GetCharWidthI */
BOOL WINAPI GetCharWidthI_new(
HDC hdc, // handle to DC
UINT giFirst, // first glyph index in range
UINT cgi, // number of glyph indices in range
WORD* pgi, // array of glyph indices
INT* lpBuffer // buffer for widths
HDC hdc, // handle to DC
UINT giFirst, // first glyph index in range
UINT cgi, // number of glyph indices in range
WORD* pgi, // array of glyph indices
INT* lpBuffer // buffer for widths
)
{
ABC abc;
@ -243,11 +246,11 @@ BOOL WINAPI GetCharWidthI_new(
/* MAKE_EXPORT GetCharABCWidthsI_new=GetCharABCWidthsI */
BOOL WINAPI GetCharABCWidthsI_new(
HDC hdc, // handle to DC
UINT giFirst, // first glyph index in range
UINT cgi, // count of glyph indices in range
LPWORD pgi, // array of glyph indices
LPABC lpabc // array of character widths
HDC hdc, // handle to DC
UINT giFirst, // first glyph index in range
UINT cgi, // count of glyph indices in range
LPWORD pgi, // array of glyph indices
LPABC lpabc // array of character widths
)
{
WORD glyph;
@ -283,15 +286,42 @@ BOOL WINAPI GetCharABCWidthsI_new(
return TRUE;
}
/* MAKE_EXPORT GetCharABCWidthsW_new=GetCharABCWidthsW */
BOOL WINAPI GetCharABCWidthsW_new(
HDC hdc, // handle to DC
UINT uFirstChar, // first character in range
UINT uLastChar, // last character in range
LPABC lpabc // array of character widths
)
{
if ( !hdc || !lpabc || uFirstChar>uLastChar )
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
UINT c = uLastChar-uFirstChar+1;
LPWORD glyphs = (LPWORD)alloca(c*sizeof(WORD));
LPWSTR chrW = (LPWSTR)alloca(c*sizeof(WCHAR));
LPWSTR strW = chrW;
for (int i = uFirstChar; i<=uLastChar; i++)
{
*chrW=(WCHAR)i;
chrW++;
}
if ( GetGlyphIndicesW_new(hdc,strW,c,glyphs,0) == GDI_ERROR )
return FALSE;
return GetCharABCWidthsI_new(hdc,0,c,glyphs,lpabc);
}
/* MAKE_EXPORT GetGlyphOutlineW_new=GetGlyphOutlineW */
DWORD WINAPI GetGlyphOutlineW_new(
HDC hdc, // handle to DC
UINT uChar, // character to query
UINT uFormat, // data format
LPGLYPHMETRICS lpgm, // glyph metrics
DWORD cbBuffer, // size of data buffer
LPVOID lpvBuffer, // data buffer
CONST MAT2 *lpmat2 // transformation matrix
HDC hdc, // handle to DC
UINT uChar, // character to query
UINT uFormat, // data format
LPGLYPHMETRICS lpgm, // glyph metrics
DWORD cbBuffer, // size of data buffer
LPVOID lpvBuffer, // data buffer
CONST MAT2 *lpmat2 // transformation matrix
)
{
UINT glyph = 0;
@ -327,7 +357,7 @@ DWORD WINAPI GetGlyphOutlineW_new(
lpgm->gmBlackBoxY = sz.cy;
lpgm->gmptGlyphOrigin.x = 0;
lpgm->gmptGlyphOrigin.y = sz.cy;
lpgm->gmCellIncX = sz.cx;
lpgm->gmCellIncX = (short) sz.cx;
lpgm->gmCellIncY = 0;
ret = 1;
}

View File

@ -43,10 +43,9 @@ static const apilib_named_api gdi32_named_apis[] =
DECL_API("CreateICW", CreateICW_fwd),
DECL_API("CreateMetaFileW", CreateMetaFileW_fwd),
DECL_API("CreateScalableFontResourceW", CreateScalableFontResourceW_fwd),
DECL_API("EnumFontsW", EnumFontsW_fwd),
DECL_API("EnumICMProfilesW", EnumICMProfilesW_fwd),
DECL_API("GetCharABCWidthsI", GetCharABCWidthsI_new),
DECL_API("GetCharABCWidthsW", GetCharABCWidthsW_fwd),
DECL_API("GetCharABCWidthsW", GetCharABCWidthsW_new),
DECL_API("GetCharWidthI", GetCharWidthI_new),
DECL_API("GetCharacterPlacementW", GetCharacterPlacementW_fwd),
DECL_API("GetEnhMetaFileDescriptionW", GetEnhMetaFileDescriptionW_fwd),

View File

@ -34,6 +34,7 @@ BOOL WINAPI GetTextExtentExPointI_new(HDC hdc, LPWORD pgiIn, int cgi, int nMaxEx
BOOL WINAPI GetTextExtentPointI_new(HDC hdc, LPWORD pgiIn, int cgi, LPSIZE lpSize);
BOOL WINAPI GetCharWidthI_new(HDC hdc, UINT giFirst, UINT cgi, WORD* pgi, INT* lpBuffer);
BOOL WINAPI GetCharABCWidthsI_new(HDC hdc, UINT giFirst, UINT cgi, LPWORD pgi, LPABC lpabc);
BOOL WINAPI GetCharABCWidthsW_new(HDC hdc, UINT uFirstChar, UINT uLastChar, LPABC lpabc);
DWORD WINAPI GetGlyphOutlineW_new(HDC hdc, UINT uChar, UINT uFormat, LPGLYPHMETRICS lpgm, DWORD cbBuffer, LPVOID lpvBuffer, CONST MAT2 *lpmat2);
FWDPROC CopyEnhMetaFileW_fwd;
FWDPROC CopyMetaFileW_fwd;
@ -45,9 +46,7 @@ FWDPROC CreateFontW_fwd;
FWDPROC CreateICW_fwd;
FWDPROC CreateMetaFileW_fwd;
FWDPROC CreateScalableFontResourceW_fwd;
FWDPROC EnumFontsW_fwd;
FWDPROC EnumICMProfilesW_fwd;
FWDPROC GetCharABCWidthsW_fwd;
FWDPROC GetCharacterPlacementW_fwd;
FWDPROC GetEnhMetaFileDescriptionW_fwd;
FWDPROC GetEnhMetaFileW_fwd;

View File

@ -31,9 +31,7 @@ FORWARD_TO_UNICOWS(CreateFontW);
FORWARD_TO_UNICOWS(CreateICW);
FORWARD_TO_UNICOWS(CreateMetaFileW);
FORWARD_TO_UNICOWS(CreateScalableFontResourceW);
FORWARD_TO_UNICOWS(EnumFontsW);
FORWARD_TO_UNICOWS(EnumICMProfilesW);
FORWARD_TO_UNICOWS(GetCharABCWidthsW);
FORWARD_TO_UNICOWS(GetCharacterPlacementW);
FORWARD_TO_UNICOWS(GetEnhMetaFileDescriptionW);
FORWARD_TO_UNICOWS(GetEnhMetaFileW);

View File

@ -39,8 +39,8 @@ typedef FARPROC (WINAPI* DLFH) (DWORD, PSHLWAPI_DELAYLOAD);
/* MAKE_EXPORT DelayLoadFailureHook_new=DelayLoadFailureHook */
FARPROC WINAPI DelayLoadFailureHook_new(
LPSTR pszDllName,
LPSTR pszProcName
LPSTR pszDllName,
LPSTR pszProcName
)
{
SHLWAPI_DELAYLOAD param;

View File

@ -48,13 +48,15 @@
#define TPS_EXECUTEIO 0x00000001
#define TPS_LONGEXECTIME 0x00000008
typedef BOOL (WINAPI* SHQueueUserWorkItem_API) (LPTHREAD_START_ROUTINE pfnCallback,
LPVOID pContext,
LONG lPriority,
PDWORD dwTag,
PDWORD * pdwId,
LPCSTR pszModule,
DWORD dwFlags);
typedef BOOL (WINAPI* SHQueueUserWorkItem_API) (
LPTHREAD_START_ROUTINE pfnCallback,
LPVOID pContext,
LONG lPriority,
PDWORD dwTag,
PDWORD * pdwId,
LPCSTR pszModule,
DWORD dwFlags
);
static SHQueueUserWorkItem_API SHQueueUserWorkItem;
@ -89,12 +91,12 @@ BOOL WINAPI QueueUserWorkItem_new( LPTHREAD_START_ROUTINE Function, PVOID Contex
typedef struct
{
HANDLE Object;
HANDLE TimerObject;
WAITORTIMERCALLBACK Callback;
PVOID Context;
ULONG Milliseconds;
ULONG Flags;
HANDLE Object;
HANDLE TimerObject;
WAITORTIMERCALLBACK Callback;
PVOID Context;
ULONG Milliseconds;
ULONG Flags;
PVOID waitThread;
LONG State;
LONG CallbacksPending;
@ -471,12 +473,12 @@ BOOL WINAPI UnregisterWait_new(HANDLE WaitHandle)
typedef struct
{
HANDLE TimerObject;
WAITORTIMERCALLBACK Callback;
PVOID Parameter;
ULONG DueTime;
HANDLE TimerObject;
WAITORTIMERCALLBACK Callback;
PVOID Parameter;
ULONG DueTime;
DWORD Period;
ULONG Flags;
ULONG Flags;
PVOID TimerQueue;
LONG State;
LONG CallbacksPending;

View File

@ -109,14 +109,8 @@ BOOL init_exttls(void)
void detach_exttls(void)
{
TDB98* tdb;
LPVOID* ext;
__asm mov eax, fs:18h;
__asm sub eax, 8;
__asm mov tdb, eax;
ext = (LPVOID*) tdb->TlsSlots[TLS_SIZE-1];
TDB98* tdb = get_tdb();
LPVOID ext = tdb->TlsSlots[TLS_SIZE-1];
if (ext)
{
HeapFree(GetProcessHeap(), 0, ext);
@ -176,38 +170,38 @@ DWORD WINAPI TlsAlloc_new(void)
/* MAKE_EXPORT TlsFree_new=TlsFree */
BOOL WINAPI TlsFree_new(DWORD dwTlsIndex)
{
int ret;
int ret = 0;
PDB98* pdb = get_pdb();
_EnterSysLevel(k32lock);
_EnterSysLevel(TlsLock);
if (dwTlsIndex < TLS_SIZE-1)
{
int rem = dwTlsIndex % (sizeof(DWORD) * 8);
int div = dwTlsIndex / (sizeof(DWORD) * 8);
pdb->tlsInUseBits[div] &= ~(1 << rem);
ret = 1;
if (pdb->tlsInUseBits[div] & (1 << rem))
{
pdb->tlsInUseBits[div] &= ~(1 << rem);
ret = 1;
}
}
else if (dwTlsIndex < TOTAL_TLS_SIZE)
{
dwTlsIndex -= TLS_SIZE-1;
int rem = dwTlsIndex % (sizeof(DWORD) * 8);
int div = dwTlsIndex / (sizeof(DWORD) * 8);
ExtTlsBitmap[div] &= ~(1 << rem);
ret = 2;
}
else
{
SetLastError(ERROR_INVALID_PARAMETER);
ret = 0;
if (ExtTlsBitmap[div] & (1 << rem))
{
ExtTlsBitmap[div] &= ~(1 << rem);
ret = 2;
}
}
if (ret)
{
const NODE* thread;
_EnterSysLevel(k32lock);
for (thread = pdb->ThreadList->firstNode ; thread != NULL ; thread = thread->next)
{
TDB98* tdb = (TDB98*) thread->data;
@ -220,13 +214,14 @@ BOOL WINAPI TlsFree_new(DWORD dwTlsIndex)
ext[dwTlsIndex] = 0;
}
}
_LeaveSysLevel(k32lock);
}
_LeaveSysLevel(TlsLock);
_LeaveSysLevel(k32lock);
return ret;
if (!ret)
SetLastError(ERROR_INVALID_PARAMETER);
return (ret != 0);
}
#ifdef __ASM_IS_L33T__
@ -315,11 +310,7 @@ static inline void SetLastError_fast(TDB98* tdb, DWORD error)
LPVOID WINAPI TlsGetValue_new2(DWORD dwTlsIndex)
{
TDB98* tdb;
__asm mov eax, fs:18h;
__asm sub eax, 8;
__asm mov tdb, eax;
TDB98* tdb = get_tdb();
if (dwTlsIndex < TLS_SIZE-1)
{
@ -344,11 +335,7 @@ LPVOID WINAPI TlsGetValue_new2(DWORD dwTlsIndex)
BOOL WINAPI TlsSetValue_new2(DWORD dwTlsIndex, LPVOID lpTlsValue)
{
TDB98* tdb;
__asm mov eax, fs:18h;
__asm sub eax, 8;
__asm mov tdb, eax;
TDB98* tdb = get_tdb();
if (dwTlsIndex < TLS_SIZE-1)
{

View File

@ -53,7 +53,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shlwapi.lib shell32.lib rpcrt4.lib usp10.lib winmm.lib ws2_32.lib ../../common/KernelEx.lib ../../kexcrt/kexcrt.lib libc.lib delayimp.lib /nologo /dll /map /machine:I386 /nodefaultlib /OPT:NOWIN98 /DELAYLOAD:shell32.dll /DELAYLOAD:rpcrt4.dll /DELAYLOAD:usp10.dll /DELAYLOAD:comdlg32.dll /DELAYLOAD:winspool.drv /DELAYLOAD:shlwapi.dll /DELAYLOAD:winmm.dll /DELAYLOAD:ws2_32.dll
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib cryptui.lib comdlg32.lib advapi32.lib shlwapi.lib shell32.lib rpcrt4.lib usp10.lib winmm.lib ws2_32.lib ../../common/KernelEx.lib ../../kexcrt/kexcrt.lib libc.lib delayimp.lib /nologo /dll /map /machine:I386 /nodefaultlib /OPT:NOWIN98 /DELAYLOAD:shell32.dll /DELAYLOAD:rpcrt4.dll /DELAYLOAD:usp10.dll /DELAYLOAD:comdlg32.dll /DELAYLOAD:winspool.drv /DELAYLOAD:shlwapi.dll /DELAYLOAD:winmm.dll /DELAYLOAD:ws2_32.dll /DELAYLOAD:cryptui.dll
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "KernelEx Base NonShared - Win32 Debug"
@ -80,7 +80,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shlwapi.lib shell32.lib rpcrt4.lib usp10.lib winmm.lib ws2_32.lib ../../common/KernelEx.lib ../../kexcrt/kexcrt.lib libc.lib delayimp.lib /nologo /dll /map /debug /machine:I386 /nodefaultlib /OPT:NOWIN98 /DELAYLOAD:shell32.dll /DELAYLOAD:rpcrt4.dll /DELAYLOAD:usp10.dll /DELAYLOAD:comdlg32.dll /DELAYLOAD:winspool.drv /DELAYLOAD:shlwapi.dll /DELAYLOAD:winmm.dll /DELAYLOAD:ws2_32.dll
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib cryptui.lib comdlg32.lib advapi32.lib shlwapi.lib shell32.lib rpcrt4.lib usp10.lib winmm.lib ws2_32.lib ../../common/KernelEx.lib ../../kexcrt/kexcrt.lib libc.lib delayimp.lib /nologo /dll /map /debug /machine:I386 /nodefaultlib /OPT:NOWIN98 /DELAYLOAD:shell32.dll /DELAYLOAD:rpcrt4.dll /DELAYLOAD:usp10.dll /DELAYLOAD:comdlg32.dll /DELAYLOAD:winspool.drv /DELAYLOAD:shlwapi.dll /DELAYLOAD:winmm.dll /DELAYLOAD:ws2_32.dll /DELAYLOAD:cryptui.dll
# SUBTRACT LINK32 /pdb:none
!ENDIF
@ -364,6 +364,22 @@ SOURCE=.\ole32\_ole32_apilist.h
SOURCE=.\ole32\CoWaitForMultipleHandles.c
# End Source File
# End Group
# Begin Group "cryptui"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\cryptui\_cryptui_apilist.c
# End Source File
# Begin Source File
SOURCE=.\cryptui\_cryptui_apilist.h
# End Source File
# Begin Source File
SOURCE=.\cryptui\CryptUIDlgViewContext.c
# End Source File
# End Group
# Begin Source File
SOURCE=..\..\common\common.c

View File

@ -34,9 +34,10 @@
#include "winmm/_winmm_apilist.h"
#include "ws2_32/_ws2_32_apilist.h"
#include "ole32/_ole32_apilist.h"
#include "cryptui/_cryptui_apilist.h"
//#include "/__apilist.h"
static apilib_api_table api_table[13];
static apilib_api_table api_table[14];
static void fill_apitable()
{
@ -52,6 +53,7 @@ static void fill_apitable()
api_table[9] = apitable_winmm;
api_table[10] = apitable_ws2_32;
api_table[11] = apitable_ole32;
api_table[12] = apitable_cryptui;
//last entry is null terminator
}

View File

@ -30,9 +30,9 @@ 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);
RPC_STATUS RPC_ENTRY RpcStringFreeW_new(IN OUT LPWSTR * String);
RPC_STATUS RPC_ENTRY UuidFromStringW_new(IN LPWSTR StringUuidW, OUT UUID * Uuid);
RPC_STATUS RPC_ENTRY UuidToStringW_new(IN UUID * Uuid, OUT LPWSTR * StringUuid);
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
#endif

View File

@ -25,7 +25,7 @@
/* MAKE_EXPORT RpcStringFreeW_new=RpcStringFreeW */
RPC_STATUS
RPC_ENTRY
RpcStringFreeW_new(IN OUT unsigned short ** String)
RpcStringFreeW_new(IN OUT LPWSTR * String)
{
HeapFree(GetProcessHeap(), 0, *String);
return RPC_S_OK;
@ -34,7 +34,7 @@ RpcStringFreeW_new(IN OUT unsigned short ** String)
/* MAKE_EXPORT UuidFromStringW_new=UuidFromStringW */
RPC_STATUS
RPC_ENTRY
UuidFromStringW_new(IN unsigned short * StringUuidW, OUT UUID * Uuid)
UuidFromStringW_new(IN LPWSTR StringUuidW, OUT UUID * Uuid)
{
ALLOC_WtoA(StringUuid);
return UuidFromStringA((unsigned char*) StringUuidA, Uuid);
@ -43,7 +43,7 @@ UuidFromStringW_new(IN unsigned short * StringUuidW, OUT UUID * Uuid)
/* MAKE_EXPORT UuidToStringW_new=UuidToStringW */
RPC_STATUS
RPC_ENTRY
UuidToStringW_new(IN UUID * Uuid, OUT unsigned short ** StringUuid)
UuidToStringW_new(IN UUID * Uuid, OUT LPWSTR * StringUuid)
{
RPC_STATUS ret;
unsigned char* uuidA;
@ -51,7 +51,7 @@ UuidToStringW_new(IN UUID * Uuid, OUT unsigned short ** StringUuid)
if (ret == RPC_S_OK)
{
int size = (strlen((char*) uuidA) + 1) * sizeof(short);
*StringUuid = (unsigned short*) HeapAlloc(GetProcessHeap(), 0, size);
*StringUuid = (LPWSTR) HeapAlloc(GetProcessHeap(), 0, size);
if (!*StringUuid)
{
RpcStringFreeA(&uuidA);

View File

@ -30,7 +30,7 @@
* SHCreateDirectoryEx is in ME shell but no security anyway.
*/
static inline SHCreateDirectoryA(HWND hwnd, LPCSTR pszPath)
static inline int SHCreateDirectoryA(HWND hwnd, LPCSTR pszPath)
{
return SHCreateDirectory(hwnd, (LPCWSTR)pszPath);
}

View File

@ -27,8 +27,8 @@
#include <pshpack1.h>
typedef struct
{
BYTE jmp;
DWORD func;
BYTE jmp;
DWORD func;
} LONGJMP, *PLONGJMP;
#include <poppack.h>

View File

@ -38,7 +38,7 @@ void uninit_shell32()
static const apilib_named_api shell32_named_apis[] =
{
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
DECL_API("DragQueryFileW", DragQueryFileW_fwd),
DECL_API("DragQueryFileW", DragQueryFileW_new),
DECL_API("ExtractIconExW", ExtractIconExW_fwd),
DECL_API("ExtractIconW", ExtractIconW_fwd),
DECL_API("FindExecutableW", FindExecutableW_fwd),

View File

@ -23,6 +23,7 @@
#define _SHELL32_APILIST_H
#include <shlobj.h>
#include <shellapi.h>
#include "kexcoresdk.h"
BOOL init_shell32();
@ -40,7 +41,6 @@ HRESULT WINAPI SHGetSpecialFolderLocation_fix(HWND hwndOwner, int nFolder, LPVOI
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;
FWDPROC ExtractIconW_fwd;
FWDPROC FindExecutableW_fwd;
@ -52,6 +52,7 @@ FWDPROC ShellExecuteW_fwd;
FWDPROC SHFileOperationW_fwd;
FWDPROC SHGetFileInfoW_fwd;
FWDPROC SHGetNewLinkInfoW_fwd;
UINT WINAPI DragQueryFileW_new(HDROP hDrop, UINT iFile, LPWSTR lpszFileW, UINT cch);
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
#endif

View File

@ -1,6 +1,6 @@
/*
* KernelEx
* Copyright (C) 2008, Xeno86
* Copyright (C) 2008, 2010 Xeno86
*
* This file is part of KernelEx source code.
*
@ -20,8 +20,34 @@
*/
#include "unifwd.h"
#include "common.h"
#include <shellapi.h>
#include <shlwapi.h>
/* MAKE_EXPORT DragQueryFileW_new=DragQueryFileW */
UINT WINAPI DragQueryFileW_new(HDROP hDrop, UINT iFile, LPWSTR lpszFileW, UINT cch)
{
UINT ret;
ALLOC_A(lpszFile, cch * 2);
ret = DragQueryFileA(hDrop, iFile, lpszFileA, cch);
if (ret && lpszFileA && iFile != 0xffffffff)
{
DWORD lasterr = GetLastError();
ret = AtoW(lpszFile, cch);
if (!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
ret = cch;
if (ret) ret--;
SetLastError(lasterr);
}
return ret;
}
FORWARD_TO_UNICOWS(DragQueryFileW);
FORWARD_TO_UNICOWS(ExtractIconExW);
FORWARD_TO_UNICOWS(ExtractIconW);
FORWARD_TO_UNICOWS(FindExecutableW);

View File

@ -42,58 +42,60 @@ static const DWORD pi_sizeof[] = {0, sizeof(PRINTER_INFO_1), sizeof(PRINTER_INFO
*/
static LPDEVMODEW DEVMODEdupAtoW(const DEVMODEA *dmA)
{
LPDEVMODEW dmW;
WORD size;
LPDEVMODEW dmW;
WORD size;
if (!dmA) return NULL;
size = dmA->dmSize + CCHDEVICENAME +
((dmA->dmSize > FIELD_OFFSET(DEVMODEA, dmFormName)) ? CCHFORMNAME : 0);
if (!dmA) return NULL;
size = dmA->dmSize + CCHDEVICENAME +
((dmA->dmSize > FIELD_OFFSET(DEVMODEA, dmFormName)) ? CCHFORMNAME : 0);
dmW = (LPDEVMODEW) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + dmA->dmDriverExtra);
if (!dmW) return NULL;
dmW = (LPDEVMODEW) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + dmA->dmDriverExtra);
if (!dmW) return NULL;
MultiByteToWideChar(CP_ACP, 0, (LPSTR)dmA->dmDeviceName, -1,
MultiByteToWideChar(CP_ACP, 0, (LPSTR)dmA->dmDeviceName, -1,
dmW->dmDeviceName, CCHDEVICENAME);
if (FIELD_OFFSET(DEVMODEA, dmFormName) >= dmA->dmSize) {
memcpy(&dmW->dmSpecVersion, &dmA->dmSpecVersion,
dmA->dmSize - FIELD_OFFSET(DEVMODEA, dmSpecVersion));
}
else
{
memcpy(&dmW->dmSpecVersion, &dmA->dmSpecVersion,
FIELD_OFFSET(DEVMODEA, dmFormName) - FIELD_OFFSET(DEVMODEA, dmSpecVersion));
if (FIELD_OFFSET(DEVMODEA, dmFormName) >= dmA->dmSize) {
memcpy(&dmW->dmSpecVersion, &dmA->dmSpecVersion,
dmA->dmSize - FIELD_OFFSET(DEVMODEA, dmSpecVersion));
}
else
{
memcpy(&dmW->dmSpecVersion, &dmA->dmSpecVersion,
FIELD_OFFSET(DEVMODEA, dmFormName) - FIELD_OFFSET(DEVMODEA, dmSpecVersion));
MultiByteToWideChar(CP_ACP, 0, (LPSTR)dmA->dmFormName, -1,
dmW->dmFormName, CCHFORMNAME);
memcpy(&dmW->dmLogPixels, &dmA->dmLogPixels, dmA->dmSize - FIELD_OFFSET(DEVMODEA, dmLogPixels));
}
memcpy(&dmW->dmLogPixels, &dmA->dmLogPixels, dmA->dmSize - FIELD_OFFSET(DEVMODEA, dmLogPixels));
}
dmW->dmSize = size;
memcpy((char *)dmW + dmW->dmSize, (const char *)dmA + dmA->dmSize, dmA->dmDriverExtra);
return dmW;
dmW->dmSize = size;
memcpy((char *)dmW + dmW->dmSize, (const char *)dmA + dmA->dmSize, dmA->dmDriverExtra);
return dmW;
}
static void convert_printerinfo_WtoA(LPBYTE outW, LPBYTE pPrintersA,
DWORD level, DWORD outlen, DWORD numentries)
{
DWORD id = 0;
LPWSTR ptr;
INT len;
DWORD id = 0;
LPWSTR ptr;
INT len;
len = pi_sizeof[level] * numentries;
ptr = (LPWSTR) (outW + len);
len = pi_sizeof[level] * numentries;
ptr = (LPWSTR) (outW + len);
/* first structures */
outlen -= len;
outlen -= len;
/* then text in unicode (we count in wchars from now on) */
outlen /= 2;
/* copy the numbers of all PRINTER_INFO_* first */
memcpy(outW, pPrintersA, len);
/* copy the numbers of all PRINTER_INFO_* first */
memcpy(outW, pPrintersA, len);
while (id < numentries) {
switch (level) {
case 1:
while (id < numentries)
{
switch (level)
{
case 1:
{
PRINTER_INFO_1W * piW = (PRINTER_INFO_1W *) outW;
PRINTER_INFO_1A * piA = (PRINTER_INFO_1A *) pPrintersA;
@ -122,7 +124,7 @@ static void convert_printerinfo_WtoA(LPBYTE outW, LPBYTE pPrintersA,
break;
}
case 2:
case 2:
{
PRINTER_INFO_2W * piW = (PRINTER_INFO_2W *) outW;
PRINTER_INFO_2A * piA = (PRINTER_INFO_2A *) pPrintersA;
@ -228,7 +230,7 @@ static void convert_printerinfo_WtoA(LPBYTE outW, LPBYTE pPrintersA,
break;
}
case 4:
case 4:
{
PRINTER_INFO_4W * piW = (PRINTER_INFO_4W *) outW;
PRINTER_INFO_4A * piA = (PRINTER_INFO_4A *) pPrintersA;
@ -250,7 +252,7 @@ static void convert_printerinfo_WtoA(LPBYTE outW, LPBYTE pPrintersA,
break;
}
case 5:
case 5:
{
PRINTER_INFO_5W * piW = (PRINTER_INFO_5W *) outW;
PRINTER_INFO_5A * piA = (PRINTER_INFO_5A *) pPrintersA;
@ -271,11 +273,11 @@ static void convert_printerinfo_WtoA(LPBYTE outW, LPBYTE pPrintersA,
}
break;
}
}
pPrintersA += pi_sizeof[level];
outW += pi_sizeof[level];
id++;
}
}
pPrintersA += pi_sizeof[level];
outW += pi_sizeof[level];
id++;
}
}
//AddForm - not supported