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

import KernelEx-4.0-Final

This commit is contained in:
UzixLS
2018-11-03 16:20:02 +03:00
parent 339353cce8
commit 30df122aba
339 changed files with 11011 additions and 1945 deletions

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

@ -20,6 +20,10 @@ KERNEL32.GetVersion=std
GDI32.SetWorldTransform=kexbases.0
GDI32.GetRandomRgn=std
GDI32.SetGraphicsMode=std
GDI32.GetTextMetricsA=std
GDI32.GetWorldTransform=std
GDI32.ModifyWorldTransform=std
GDI32.SetMapMode=std
KERNEL32.VerSetConditionMask=none
KERNEL32.VerifyVersionInfoA=none
KERNEL32.VerifyVersionInfoW=none
@ -29,6 +33,10 @@ KERNEL32.GetVersion=std
GDI32.SetWorldTransform=kexbases.0
GDI32.GetRandomRgn=std
GDI32.SetGraphicsMode=std
GDI32.GetTextMetricsA=std
GDI32.GetWorldTransform=std
GDI32.ModifyWorldTransform=std
GDI32.SetMapMode=std
KERNEL32.VerSetConditionMask=none
KERNEL32.VerifyVersionInfoA=none
KERNEL32.VerifyVersionInfoW=none
@ -71,6 +79,13 @@ desc=Windows NT 4.0 SP6
KERNEL32.GetVersion=kexbases.3
KERNEL32.GetVersionExA=kexbases.4
KERNEL32.GetVersionExW=kexbases.4
GDI32.GetRandomRgn=kexbases.0
GDI32.SetGraphicsMode=kexbases.0
GDI32.GetTextMetricsA=kexbases.0
GDI32.GetWorldTransform=kexbases.0
GDI32.ModifyWorldTransform=kexbases.0
GDI32.SetMapMode=kexbases.0
GDI32.SetWorldTransform=kexbases.1
[NT2K]
inherit=NT40
@ -80,9 +95,6 @@ desc=Windows 2000 SP4
KERNEL32.GetVersion=kexbases.4
KERNEL32.GetVersionExA=kexbases.5
KERNEL32.GetVersionExW=kexbases.5
GDI32.SetWorldTransform=kexbases.1
GDI32.GetRandomRgn=kexbases.0
GDI32.SetGraphicsMode=kexbases.0
KERNEL32.VerSetConditionMask=kexbases.0
KERNEL32.VerifyVersionInfoA=kexbases.0
KERNEL32.VerifyVersionInfoW=kexbases.0

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

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

@ -22,7 +22,6 @@
#ifndef _ADVAPI32_APILIST_H
#define _ADVAPI32_APILIST_H
#include "auxdecl.h"
#include "kexcoresdk.h"
BOOL init_advapi32();

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

View File

@ -1,132 +0,0 @@
/* This file contains required declarations missing from MINGW and MSVC6 without PSDK */
#ifndef __AUXDECL_H
#define __AUXDECL_H
#include <windows.h>
/* declarations for MSVC6 without PSDK */
#if defined (_MSC_VER) && (WINVER < 0x0500)
#define VER_MINORVERSION 0x0000001
#define VER_MAJORVERSION 0x0000002
#define VER_BUILDNUMBER 0x0000004
#define VER_PLATFORMID 0x0000008
#define VER_SERVICEPACKMINOR 0x0000010
#define VER_SERVICEPACKMAJOR 0x0000020
#define VER_SUITENAME 0x0000040
#define VER_PRODUCT_TYPE 0x0000080
#define VER_EQUAL 1
#define VER_GREATER 2
#define VER_GREATER_EQUAL 3
#define VER_LESS 4
#define VER_LESS_EQUAL 5
#define VER_AND 6
#define VER_OR 7
#define VER_NT_WORKSTATION 1
#define VER_NT_DOMAIN_CONTROLLER 2
#define VER_NT_SERVER 3
#define VER_SUITE_SMALLBUSINESS 1
#define VER_SUITE_ENTERPRISE 2
#define VER_SUITE_BACKOFFICE 4
#define VER_SUITE_TERMINAL 16
#define VER_SUITE_SMALLBUSINESS_RESTRICTED 32
#define VER_SUITE_EMBEDDEDNT 64
#define VER_SUITE_DATACENTER 128
#define VER_SUITE_SINGLEUSERTS 256
#define VER_SUITE_PERSONAL 512
#define VER_SUITE_BLADE 1024
#define VER_SUITE_STORAGE_SERVER 8192
#define VER_SUITE_COMPUTE_SERVER 16384
#define OSVERSIONINFOEXA __OSVERSIONINFOEXA
#define POSVERSIONINFOEXA __POSVERSIONINFOEXA
#define LPOSVERSIONINFOEXA __LPOSVERSIONINFOEXA
#define OSVERSIONINFOEXW __OSVERSIONINFOEXW
#define POSVERSIONINFOEXW __POSVERSIONINFOEXW
#define LPOSVERSIONINFOEXW __LPOSVERSIONINFOEXW
typedef struct {
DWORD dwOSVersionInfoSize;
DWORD dwMajorVersion;
DWORD dwMinorVersion;
DWORD dwBuildNumber;
DWORD dwPlatformId;
CHAR szCSDVersion[128];
WORD wServicePackMajor;
WORD wServicePackMinor;
WORD wSuiteMask;
BYTE wProductType;
BYTE wReserved;
} __OSVERSIONINFOEXA, *__POSVERSIONINFOEXA, *__LPOSVERSIONINFOEXA;
typedef struct {
DWORD dwOSVersionInfoSize;
DWORD dwMajorVersion;
DWORD dwMinorVersion;
DWORD dwBuildNumber;
DWORD dwPlatformId;
WCHAR szCSDVersion[128];
WORD wServicePackMajor;
WORD wServicePackMinor;
WORD wSuiteMask;
BYTE wProductType;
BYTE wReserved;
} __OSVERSIONINFOEXW, *__POSVERSIONINFOEXW, *__LPOSVERSIONINFOEXW;
typedef long LONG_PTR;
typedef BOOL (CALLBACK *UILANGUAGE_ENUMPROCA)(LPSTR, LONG_PTR);
typedef BOOL (CALLBACK *UILANGUAGE_ENUMPROCW)(LPWSTR, LONG_PTR);
#define MEMORYSTATUSEX __MEMORYSTATUSEX
#define PMEMORYSTATUSEX __PMEMORYSTATUSEX
#define LPMEMORYSTATUSEX __LPMEMORYSTATUSEX
typedef struct
{
DWORD dwLength;
DWORD dwMemoryLoad;
DWORDLONG ullTotalPhys;
DWORDLONG ullAvailPhys;
DWORDLONG ullTotalPageFile;
DWORDLONG ullAvailPageFile;
DWORDLONG ullTotalVirtual;
DWORDLONG ullAvailVirtual;
DWORDLONG ullAvailExtendedVirtual;
} __MEMORYSTATUSEX, *__PMEMORYSTATUSEX, *__LPMEMORYSTATUSEX;
typedef enum {
SHGFP_TYPE_CURRENT = 0,
SHGFP_TYPE_DEFAULT = 1,
} SHGFP_TYPE;
#define GA_ROOT 2
typedef void *LPPRINTDLGEX;
EXTERN_C int WINAPI GetRandomRgn(HDC hdc, HRGN hrgn, INT iNum);
EXTERN_C HRESULT WINAPI SHGetFolderPathA(HWND hwnd, int csidl, HANDLE hToken, DWORD dwFlags, LPSTR pszPath);
EXTERN_C HWND WINAPI GetAncestor(HWND hwnd, UINT gaFlags);
EXTERN_C UINT WINAPI RealGetWindowClass(HWND hwnd, LPTSTR pszType, UINT cchType);
#endif /* defined (_MSC_VER) && (WINVER < 0x0500) */
/* declarations for MINGW32 */
#ifdef __MINGW32_VERSION
/* The security descriptor structure */
typedef struct {
BYTE Revision;
BYTE Sbz1;
SECURITY_DESCRIPTOR_CONTROL Control;
DWORD Owner;
DWORD Group;
DWORD Sacl;
DWORD Dacl;
} SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE;
#endif /* __MINGW32_VERSION */
#endif /* __AUXDECL_H */

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

@ -35,7 +35,9 @@ static const apilib_named_api comdlg32_named_apis[] =
DECL_API("ChooseFontW", ChooseFontW_fwd),
DECL_API("FindTextW", FindTextW_fwd),
DECL_API("GetFileTitleW", GetFileTitleW_fwd),
DECL_API("GetOpenFileNameA", GetOpenFileNameA_fix),
DECL_API("GetOpenFileNameW", GetOpenFileNameW_fwd),
DECL_API("GetSaveFileNameA", GetSaveFileNameA_fix),
DECL_API("GetSaveFileNameW", GetSaveFileNameW_fwd),
DECL_API("PageSetupDlgW", PageSetupDlgW_fwd),
DECL_API("PrintDlgW", PrintDlgW_fwd),

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

@ -22,13 +22,14 @@
#ifndef _COMDLG32_APILIST_H
#define _COMDLG32_APILIST_H
#include "auxdecl.h"
#include "kexcoresdk.h"
BOOL init_comdlg32();
extern const apilib_api_table apitable_comdlg32;
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
BOOL WINAPI GetOpenFileNameA_fix(LPOPENFILENAMEA lpofn);
BOOL WINAPI GetSaveFileNameA_fix(LPOPENFILENAMEA lpofn);
FWDPROC ChooseColorW_fwd;
FWDPROC ChooseFontW_fwd;
FWDPROC FindTextW_fwd;

View File

@ -0,0 +1,51 @@
/*
* KernelEx
* Copyright (C) 2009, Xeno86
*
* This file is part of KernelEx source code.
*
* KernelEx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; version 2 of the License.
*
* KernelEx is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#define WINVER 0x0501
#include <windows.h>
/* MAKE_EXPORT GetOpenFileNameA_fix=GetOpenFileNameA */
BOOL WINAPI GetOpenFileNameA_fix(LPOPENFILENAMEA lpofn)
{
BOOL ret = GetOpenFileNameA(lpofn);
if (!ret && CommDlgExtendedError() == CDERR_STRUCTSIZE && lpofn
&& lpofn->lStructSize == sizeof(OPENFILENAME))
{
lpofn->lStructSize = OPENFILENAME_SIZE_VERSION_400A;
ret = GetOpenFileNameA(lpofn);
lpofn->lStructSize = sizeof(OPENFILENAME);
}
return ret;
}
/* MAKE_EXPORT GetSaveFileNameA_fix=GetSaveFileNameA */
BOOL WINAPI GetSaveFileNameA_fix(LPOPENFILENAMEA lpofn)
{
BOOL ret = GetSaveFileNameA(lpofn);
if (!ret && CommDlgExtendedError() == CDERR_STRUCTSIZE && lpofn
&& lpofn->lStructSize == sizeof(OPENFILENAME))
{
lpofn->lStructSize = OPENFILENAME_SIZE_VERSION_400A;
ret = GetSaveFileNameA(lpofn);
lpofn->lStructSize = sizeof(OPENFILENAME);
}
return ret;
}

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

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

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

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

@ -4,3 +4,5 @@ gdi32
advapi32
comdlg32
shell32
rpcrt4
winspool

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

@ -27,117 +27,7 @@
#include <malloc.h>
#include <windows.h>
#include "common.h"
//#include <usp10.h>
typedef void *SCRIPT_CACHE;
typedef struct {
int cBytes;
WORD wgBlank;
WORD wgDefault;
WORD wgInvalid;
WORD wgKashida;
int iKashidaWidth;
} SCRIPT_FONTPROPERTIES;
typedef HRESULT (WINAPI *PFNSCRIPTGETCMAP) (
HDC hdc,
SCRIPT_CACHE *psc,
const WCHAR *pwcInChars,
int cChars,
DWORD dwFlags,
WORD *pwOutGlyphs);
typedef HRESULT (WINAPI *PFNSFC) (SCRIPT_CACHE *psc);
typedef HRESULT (WINAPI *PFNCGH) ( HDC hdc, SCRIPT_CACHE *psc, long *tmHeight );
typedef HRESULT (WINAPI *PFNGFP) ( HDC hdc, SCRIPT_CACHE *psc, SCRIPT_FONTPROPERTIES *sfp );
typedef HRESULT (WINAPI *PFNGETGABCWIDTH) ( HDC hdc, SCRIPT_CACHE *psc, WORD wGlyph, ABC *pABC);
static HRESULT WINAPI ScriptGetCMap_dld(HDC hdc, SCRIPT_CACHE *psc, const WCHAR *pwcInChars, int cChars, DWORD dwFlags, WORD *pwOutGlyphs);
static HRESULT WINAPI ScriptFreeCache_dld(SCRIPT_CACHE *psc);
static HRESULT WINAPI ScriptCacheGetHeight_dld(HDC hdc, SCRIPT_CACHE *psc, long *tmHeight);
static HRESULT WINAPI ScriptGetFontProperties_dld(HDC hdc, SCRIPT_CACHE *psc, SCRIPT_FONTPROPERTIES *sfp);
static PFNSCRIPTGETCMAP ScriptGetCMap_pfn = ScriptGetCMap_dld;
static PFNSFC ScriptFreeCache_pfn = ScriptFreeCache_dld;
static PFNCGH ScriptCacheGetHeight_pfn = ScriptCacheGetHeight_dld;
static PFNGFP ScriptGetFontProperties_pfn = ScriptGetFontProperties_dld;
static PFNGETGABCWIDTH ScriptGetGlyphABCWidth_pfn = NULL;
/* delay-loaded Uniscribe start */
static const char c_szUsp10[]="usp10.dll";
static FARPROC WINAPI LoadUniscribeProc(LPCSTR proc)
{
static HMODULE usp10;
FARPROC ret;
DWORD lasterr = GetLastError();
if (!usp10)
{
usp10 = GetModuleHandleA(c_szUsp10);
if (!usp10) usp10 = LoadLibraryA(c_szUsp10);
if (!usp10)
fatal_error("kexbasen: Failed to load Uniscribe!");
}
ret = GetProcAddress(usp10,proc);
SetLastError(lasterr);
return ret;
}
static HRESULT WINAPI ScriptGetCMap_dld(
HDC hdc,
SCRIPT_CACHE *psc,
const WCHAR *pwcInChars,
int cChars,
DWORD dwFlags,
WORD *pwOutGlyphs
)
{
PFNSCRIPTGETCMAP pfn;
pfn = (PFNSCRIPTGETCMAP)LoadUniscribeProc("ScriptGetCMap");
if ( !pfn ) return E_FAIL;
ScriptGetCMap_pfn = pfn;
return pfn (hdc,psc,pwcInChars,cChars,dwFlags,pwOutGlyphs);
}
static HRESULT WINAPI ScriptFreeCache_dld(
SCRIPT_CACHE *psc
)
{
PFNSFC pfn;
pfn = (PFNSFC)LoadUniscribeProc("ScriptFreeCache");
if ( !pfn ) return E_FAIL;
ScriptFreeCache_pfn = pfn;
return pfn (psc);
}
static HRESULT WINAPI ScriptCacheGetHeight_dld(
HDC hdc,
SCRIPT_CACHE *psc,
long *tmHeight
)
{
PFNCGH pfn;
pfn = (PFNCGH)LoadUniscribeProc("ScriptCacheGetHeight");
if ( !pfn ) return E_FAIL;
ScriptCacheGetHeight_pfn = pfn;
return pfn (hdc,psc,tmHeight);
}
static HRESULT WINAPI ScriptGetFontProperties_dld(
HDC hdc,
SCRIPT_CACHE *psc,
SCRIPT_FONTPROPERTIES *sfp
)
{
PFNGFP pfn;
pfn = (PFNGFP)LoadUniscribeProc("ScriptGetFontProperties");
if ( !pfn ) return E_FAIL;
ScriptGetFontProperties_pfn = pfn;
return pfn (hdc,psc,sfp);
}
/* delay-loaded Uniscribe END */
#include <usp10.h>
/* MAKE_EXPORT GetGlyphIndicesW_new=GetGlyphIndicesW */
int WINAPI GetGlyphIndicesW_new(
@ -151,7 +41,7 @@ int WINAPI GetGlyphIndicesW_new(
HRESULT result;
SCRIPT_CACHE cache = 0;
if (!hdc || !pgi || (UINT)lpstr<0xFFFFu || !c) return GDI_ERROR;
result = ScriptGetCMap_pfn(hdc,&cache,lpstr,c,0,pgi);
result = ScriptGetCMap(hdc,&cache,lpstr,c,0,pgi);
if ( !( result == S_OK || result == S_FALSE ) ) return GDI_ERROR;
if ( fl && result == S_FALSE)
{
@ -159,14 +49,14 @@ int WINAPI GetGlyphIndicesW_new(
int i;
SCRIPT_FONTPROPERTIES fpr;
fpr.cBytes = sizeof(SCRIPT_FONTPROPERTIES);
if (FAILED(ScriptGetFontProperties_pfn(hdc,&cache,&fpr))) return GDI_ERROR;
if (FAILED(ScriptGetFontProperties(hdc,&cache,&fpr))) return GDI_ERROR;
for (i = 0; i < c; i++)
{
if (*checkglyph == fpr.wgDefault) *checkglyph = 0xFFFF;
checkglyph++;
}
}
ScriptFreeCache_pfn(&cache);
ScriptFreeCache(&cache);
return c;
}
@ -234,9 +124,7 @@ BOOL WINAPI GetTextExtentExPointI_new(
int glyphwidth;
BOOL unfit = FALSE;
if (!ScriptGetGlyphABCWidth_pfn)
ScriptGetGlyphABCWidth_pfn = (PFNGETGABCWIDTH)LoadUniscribeProc("ScriptGetGlyphABCWidth");
if ( !hdc || !pgiIn || cgi<=0 || !lpSize || !ScriptGetGlyphABCWidth_pfn)
if ( !hdc || !pgiIn || cgi<=0 || !lpSize)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
@ -245,7 +133,7 @@ BOOL WINAPI GetTextExtentExPointI_new(
//so let's compute the info ourselves
for (i = 0; i < cgi; i++)
{
if ( ScriptGetGlyphABCWidth_pfn(hdc,&cache,*glyph,&abc) != S_OK ) break;
if ( ScriptGetGlyphABCWidth(hdc,&cache,*glyph,&abc) != S_OK ) break;
glyphwidth = abc.abcA + abc.abcB + abc.abcC;
sum += glyphwidth;
if ( !unfit )
@ -257,8 +145,8 @@ BOOL WINAPI GetTextExtentExPointI_new(
glyph++;
}
lpSize->cx = sum;
ScriptCacheGetHeight_pfn(hdc,&cache,&lpSize->cy);
ScriptFreeCache_pfn(&cache);
ScriptCacheGetHeight(hdc,&cache,&lpSize->cy);
ScriptFreeCache(&cache);
return TRUE;
}
@ -286,9 +174,7 @@ BOOL WINAPI GetCharWidthI_new(
ABC abc;
WORD glyph;
if (!ScriptGetGlyphABCWidth_pfn)
ScriptGetGlyphABCWidth_pfn = (PFNGETGABCWIDTH)LoadUniscribeProc("ScriptGetGlyphABCWidth");
if ( !hdc || !lpBuffer || cgi<=0 || !ScriptGetGlyphABCWidth_pfn)
if ( !hdc || !lpBuffer || cgi<=0)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
@ -297,7 +183,7 @@ BOOL WINAPI GetCharWidthI_new(
{
for ( glyph = giFirst; glyph < giFirst+cgi; glyph++)
{
ScriptGetGlyphABCWidth_pfn(hdc,&cache,glyph,&abc);
ScriptGetGlyphABCWidth(hdc,&cache,glyph,&abc);
*lpBuffer = abc.abcA + abc.abcB + abc.abcC;
lpBuffer++;
}
@ -306,13 +192,13 @@ BOOL WINAPI GetCharWidthI_new(
{
for ( glyph = 0; glyph < cgi; glyph++)
{
ScriptGetGlyphABCWidth_pfn(hdc,&cache,*pgi,&abc);
ScriptGetGlyphABCWidth(hdc,&cache,*pgi,&abc);
*lpBuffer = abc.abcA + abc.abcB + abc.abcC;
pgi++;
lpBuffer++;
}
}
ScriptFreeCache_pfn(&cache);
ScriptFreeCache(&cache);
return TRUE;
}
@ -328,6 +214,13 @@ DWORD WINAPI GetGlyphOutlineW_new(
)
{
UINT glyph = 0;
//GetGlyphOutlineW must receive same fix GetGlyphOutlineA received since apilibs interlinking changed
MAT2 matr;
if ( lpmat2 )
{
memcpy( &matr, lpmat2, sizeof(MAT2) );
lpmat2 = &matr;
}
if (uFormat & GGO_GLYPH_INDEX)
return GetGlyphOutlineA( hdc, uChar, uFormat, lpgm, cbBuffer, lpvBuffer, lpmat2 );
GetGlyphIndicesW_new( hdc, (LPWSTR)&uChar, 1, (LPWORD)&glyph, 0 );

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

@ -41,8 +41,6 @@ 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("EnumFontFamiliesExW", EnumFontFamiliesExW_fwd),
DECL_API("EnumFontFamiliesW", EnumFontFamiliesW_fwd),
DECL_API("EnumFontsW", EnumFontsW_fwd),
DECL_API("EnumICMProfilesW", EnumICMProfilesW_fwd),
DECL_API("GetCharABCWidthsW", GetCharABCWidthsW_fwd),

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

@ -22,7 +22,6 @@
#ifndef _GDI32_APILIST_H
#define _GDI32_APILIST_H
#include "auxdecl.h"
#include "kexcoresdk.h"
BOOL init_gdi32();
@ -45,8 +44,6 @@ FWDPROC CreateFontW_fwd;
FWDPROC CreateICW_fwd;
FWDPROC CreateMetaFileW_fwd;
FWDPROC CreateScalableFontResourceW_fwd;
FWDPROC EnumFontFamiliesExW_fwd;
FWDPROC EnumFontFamiliesW_fwd;
FWDPROC EnumFontsW_fwd;
FWDPROC EnumICMProfilesW_fwd;
FWDPROC GetCharABCWidthsW_fwd;

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

@ -31,8 +31,6 @@ FORWARD_TO_UNICOWS(CreateFontW);
FORWARD_TO_UNICOWS(CreateICW);
FORWARD_TO_UNICOWS(CreateMetaFileW);
FORWARD_TO_UNICOWS(CreateScalableFontResourceW);
FORWARD_TO_UNICOWS(EnumFontFamiliesExW);
FORWARD_TO_UNICOWS(EnumFontFamiliesW);
FORWARD_TO_UNICOWS(EnumFontsW);
FORWARD_TO_UNICOWS(EnumICMProfilesW);
FORWARD_TO_UNICOWS(GetCharABCWidthsW);

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

@ -35,7 +35,6 @@ static const apilib_named_api kernel32_named_apis[] =
DECL_API("BuildCommDCBW", BuildCommDCBW_fwd),
DECL_API("CallNamedPipeW", CallNamedPipeW_fwd),
DECL_API("CommConfigDialogW", CommConfigDialogW_fwd),
DECL_API("CompareStringW", CompareStringW_fwd),
DECL_API("CreateEventW", CreateEventW_fwd),
DECL_API("CreateFileMappingW", CreateFileMappingW_fwd),
DECL_API("CreateMailslotW", CreateMailslotW_fwd),
@ -54,7 +53,6 @@ static const apilib_named_api kernel32_named_apis[] =
DECL_API("FatalAppExitW", FatalAppExitW_fwd),
DECL_API("FillConsoleOutputCharacterW", FillConsoleOutputCharacterW_fwd),
DECL_API("FormatMessageW", FormatMessageW_fwd),
DECL_API("GetAtomNameW", GetAtomNameW_fwd),
DECL_API("GetCPInfoExW", GetCPInfoExW_fwd),
DECL_API("GetCalendarInfoW", GetCalendarInfoW_fwd),
DECL_API("GetComputerNameW", GetComputerNameW_fwd),
@ -65,8 +63,6 @@ static const apilib_named_api kernel32_named_apis[] =
DECL_API("GetEnvironmentVariableW", GetEnvironmentVariableW_fwd),
DECL_API("GetLocaleInfoW", GetLocaleInfoW_fwd),
DECL_API("GetLogicalDriveStringsW", GetLogicalDriveStringsW_fwd),
DECL_API("GetModuleFileNameW", GetModuleFileNameW_fwd),
DECL_API("GetModuleHandleW", GetModuleHandleW_fwd),
DECL_API("GetNamedPipeHandleStateW", GetNamedPipeHandleStateW_fwd),
DECL_API("GetNumberFormatW", GetNumberFormatW_fwd),
DECL_API("GetPrivateProfileIntW", GetPrivateProfileIntW_fwd),
@ -77,14 +73,9 @@ static const apilib_named_api kernel32_named_apis[] =
DECL_API("GetProfileIntW", GetProfileIntW_fwd),
DECL_API("GetProfileSectionW", GetProfileSectionW_fwd),
DECL_API("GetProfileStringW", GetProfileStringW_fwd),
DECL_API("GetStringTypeExW", GetStringTypeExW_fwd),
DECL_API("GetStringTypeW", GetStringTypeW_fwd),
DECL_API("GetTimeFormatW", GetTimeFormatW_fwd),
DECL_API("GetVolumeInformationW", GetVolumeInformationW_fwd),
DECL_API("IsBadStringPtrW", IsBadStringPtrW_fwd),
DECL_API("LCMapStringW", LCMapStringW_fwd),
DECL_API("LoadLibraryExW", LoadLibraryExW_fwd),
DECL_API("LoadLibraryW", LoadLibraryW_fwd),
DECL_API("OpenEventW", OpenEventW_fwd),
DECL_API("OpenFileMappingW", OpenFileMappingW_fwd),
DECL_API("OpenMutexW", OpenMutexW_fwd),
@ -113,8 +104,6 @@ static const apilib_named_api kernel32_named_apis[] =
DECL_API("WritePrivateProfileStructW", WritePrivateProfileStructW_fwd),
DECL_API("WriteProfileSectionW", WriteProfileSectionW_fwd),
DECL_API("WriteProfileStringW", WriteProfileStringW_fwd),
DECL_API("lstrcmpW", lstrcmpW_fwd),
DECL_API("lstrcmpiW", lstrcmpiW_fwd),
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
};

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

@ -22,7 +22,6 @@
#ifndef _KERNEL32_APILIST_H
#define _KERNEL32_APILIST_H
#include "auxdecl.h"
#include "kexcoresdk.h"
BOOL init_kernel32();
@ -33,7 +32,6 @@ FWDPROC BuildCommDCBAndTimeoutsW_fwd;
FWDPROC BuildCommDCBW_fwd;
FWDPROC CallNamedPipeW_fwd;
FWDPROC CommConfigDialogW_fwd;
FWDPROC CompareStringW_fwd;
FWDPROC CreateEventW_fwd;
FWDPROC CreateFileMappingW_fwd;
FWDPROC CreateMailslotW_fwd;
@ -52,7 +50,6 @@ FWDPROC ExpandEnvironmentStringsW_fwd;
FWDPROC FatalAppExitW_fwd;
FWDPROC FillConsoleOutputCharacterW_fwd;
FWDPROC FormatMessageW_fwd;
FWDPROC GetAtomNameW_fwd;
FWDPROC GetCPInfoExW_fwd;
FWDPROC GetCalendarInfoW_fwd;
FWDPROC GetComputerNameW_fwd;
@ -63,8 +60,6 @@ FWDPROC GetDriveTypeW_fwd;
FWDPROC GetEnvironmentVariableW_fwd;
FWDPROC GetLocaleInfoW_fwd;
FWDPROC GetLogicalDriveStringsW_fwd;
FWDPROC GetModuleFileNameW_fwd;
FWDPROC GetModuleHandleW_fwd;
FWDPROC GetNamedPipeHandleStateW_fwd;
FWDPROC GetNumberFormatW_fwd;
FWDPROC GetPrivateProfileIntW_fwd;
@ -75,14 +70,9 @@ FWDPROC GetPrivateProfileStructW_fwd;
FWDPROC GetProfileIntW_fwd;
FWDPROC GetProfileSectionW_fwd;
FWDPROC GetProfileStringW_fwd;
FWDPROC GetStringTypeExW_fwd;
FWDPROC GetStringTypeW_fwd;
FWDPROC GetTimeFormatW_fwd;
FWDPROC GetVolumeInformationW_fwd;
FWDPROC IsBadStringPtrW_fwd;
FWDPROC LCMapStringW_fwd;
FWDPROC LoadLibraryExW_fwd;
FWDPROC LoadLibraryW_fwd;
FWDPROC OpenEventW_fwd;
FWDPROC OpenFileMappingW_fwd;
FWDPROC OpenMutexW_fwd;
@ -111,8 +101,6 @@ FWDPROC WritePrivateProfileStringW_fwd;
FWDPROC WritePrivateProfileStructW_fwd;
FWDPROC WriteProfileSectionW_fwd;
FWDPROC WriteProfileStringW_fwd;
FWDPROC lstrcmpW_fwd;
FWDPROC lstrcmpiW_fwd;
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
#endif

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

@ -25,7 +25,6 @@ FORWARD_TO_UNICOWS(BuildCommDCBAndTimeoutsW);
FORWARD_TO_UNICOWS(BuildCommDCBW);
FORWARD_TO_UNICOWS(CallNamedPipeW);
FORWARD_TO_UNICOWS(CommConfigDialogW);
FORWARD_TO_UNICOWS(CompareStringW);
FORWARD_TO_UNICOWS(CreateEventW);
FORWARD_TO_UNICOWS(CreateFileMappingW);
FORWARD_TO_UNICOWS(CreateMailslotW);
@ -44,7 +43,6 @@ FORWARD_TO_UNICOWS(ExpandEnvironmentStringsW);
FORWARD_TO_UNICOWS(FatalAppExitW);
FORWARD_TO_UNICOWS(FillConsoleOutputCharacterW);
FORWARD_TO_UNICOWS(FormatMessageW);
FORWARD_TO_UNICOWS(GetAtomNameW);
FORWARD_TO_UNICOWS(GetCPInfoExW);
FORWARD_TO_UNICOWS(GetCalendarInfoW);
FORWARD_TO_UNICOWS(GetComputerNameW);
@ -55,8 +53,6 @@ FORWARD_TO_UNICOWS(GetDriveTypeW);
FORWARD_TO_UNICOWS(GetEnvironmentVariableW);
FORWARD_TO_UNICOWS(GetLocaleInfoW);
FORWARD_TO_UNICOWS(GetLogicalDriveStringsW);
FORWARD_TO_UNICOWS(GetModuleFileNameW);
FORWARD_TO_UNICOWS(GetModuleHandleW);
FORWARD_TO_UNICOWS(GetNamedPipeHandleStateW);
FORWARD_TO_UNICOWS(GetNumberFormatW);
FORWARD_TO_UNICOWS(GetPrivateProfileIntW);
@ -67,14 +63,9 @@ FORWARD_TO_UNICOWS(GetPrivateProfileStructW);
FORWARD_TO_UNICOWS(GetProfileIntW);
FORWARD_TO_UNICOWS(GetProfileSectionW);
FORWARD_TO_UNICOWS(GetProfileStringW);
FORWARD_TO_UNICOWS(GetStringTypeExW);
FORWARD_TO_UNICOWS(GetStringTypeW);
FORWARD_TO_UNICOWS(GetTimeFormatW);
FORWARD_TO_UNICOWS(GetVolumeInformationW);
FORWARD_TO_UNICOWS(IsBadStringPtrW);
FORWARD_TO_UNICOWS(LCMapStringW);
FORWARD_TO_UNICOWS(LoadLibraryExW);
FORWARD_TO_UNICOWS(LoadLibraryW);
FORWARD_TO_UNICOWS(OpenEventW);
FORWARD_TO_UNICOWS(OpenFileMappingW);
FORWARD_TO_UNICOWS(OpenMutexW);
@ -103,5 +94,3 @@ FORWARD_TO_UNICOWS(WritePrivateProfileStringW);
FORWARD_TO_UNICOWS(WritePrivateProfileStructW);
FORWARD_TO_UNICOWS(WriteProfileSectionW);
FORWARD_TO_UNICOWS(WriteProfileStringW);
FORWARD_TO_UNICOWS(lstrcmpW);
FORWARD_TO_UNICOWS(lstrcmpiW);

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

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

@ -47,13 +47,13 @@ RSC=rc.exe
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x415 /d "NDEBUG"
# ADD RSC /l 0x415 /d "NDEBUG"
# ADD RSC /l 0x415 /i "../../common" /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# 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 ../../common/KernelEx.lib ../../kexcrt/kexcrt.lib libc.lib /nologo /dll /map /machine:I386 /nodefaultlib /OPT:NOWIN98
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shlwapi.lib shell32.lib rpcrt4.lib usp10.lib ../../common/KernelEx.lib ../../kexcrt/kexcrt.lib libc.lib delayimp.lib /nologo /dll /map /machine:I386 /nodefaultlib /OPT:NOWIN98 /DELAYLOAD:shell32.dll /DELAYLOAD:rpcrt4.dll /DELAYLOAD:usp10.dll /DELAYLOAD:comdlg32.dll /DELAYLOAD:winspool.drv
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "KernelEx Base NonShared - Win32 Debug"
@ -74,13 +74,13 @@ LINK32=link.exe
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x415 /d "_DEBUG"
# ADD RSC /l 0x415 /d "_DEBUG"
# ADD RSC /l 0x415 /i "../../common" /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# 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 ../../common/KernelEx.lib ../../kexcrt/kexcrt.lib libc.lib /nologo /dll /map /debug /machine:I386 /nodefaultlib /pdbtype:sept /OPT:NOWIN98
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shlwapi.lib shell32.lib rpcrt4.lib usp10.lib ../../common/KernelEx.lib ../../kexcrt/kexcrt.lib libc.lib delayimp.lib /nologo /dll /map /debug /machine:I386 /nodefaultlib /pdbtype:sept /OPT:NOWIN98 /DELAYLOAD:shell32.dll /DELAYLOAD:rpcrt4.dll /DELAYLOAD:usp10.dll /DELAYLOAD:comdlg32.dll /DELAYLOAD:winspool.drv
# SUBTRACT LINK32 /pdb:none
!ENDIF
@ -173,6 +173,10 @@ SOURCE=.\comdlg32\_comdlg32_apilist.h
# End Source File
# Begin Source File
SOURCE=.\comdlg32\openfilename_fix.c
# End Source File
# Begin Source File
SOURCE=.\comdlg32\unicomdlg32.c
# End Source File
# End Group
@ -208,6 +212,38 @@ SOURCE=.\shell32\SHGetFolderPath.c
SOURCE=.\shell32\unishell32.c
# End Source File
# End Group
# Begin Group "rpcrt4"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\rpcrt4\_rpcrt4_apilist.c
# End Source File
# Begin Source File
SOURCE=.\rpcrt4\_rpcrt4_apilist.h
# End Source File
# Begin Source File
SOURCE=.\rpcrt4\unirpcrt4.c
# End Source File
# End Group
# Begin Group "winspool"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\winspool\_winspool_apilist.c
# End Source File
# Begin Source File
SOURCE=.\winspool\_winspool_apilist.h
# End Source File
# Begin Source File
SOURCE=.\winspool\DefaultPrinter.c
# End Source File
# End Group
# Begin Source File
SOURCE=.\common.c
@ -215,43 +251,6 @@ SOURCE=.\common.c
# Begin Source File
SOURCE=.\kexbasen.def
!IF "$(CFG)" == "KernelEx Base NonShared - Win32 Release"
# Begin Custom Build
OutDir=.\Release
ProjDir=.
InputPath=.\kexbasen.def
BuildCmds= \
link /LIB /NOLOGO /MACHINE:IX86 /DEF:$(ProjDir)\shell32ord.def /OUT:$(OutDir)\shell32ord.lib
"$(OutDir)\shell32ord.lib" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(OutDir)\shell32ord.exp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "KernelEx Base NonShared - Win32 Debug"
# Begin Custom Build
OutDir=.\Debug
ProjDir=.
InputPath=.\kexbasen.def
BuildCmds= \
link /LIB /NOLOGO /MACHINE:IX86 /DEF:$(ProjDir)\shell32ord.def /OUT:$(OutDir)\shell32ord.lib
"$(OutDir)\shell32ord.lib" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"$(OutDir)\shell32ord.exp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ENDIF
# End Source File
# Begin Source File
@ -259,11 +258,6 @@ SOURCE=.\main.c
# End Source File
# Begin Source File
SOURCE=.\shell32ord.def
# PROP Exclude_From_Build 1
# End Source File
# Begin Source File
SOURCE=.\unifwd.c
# End Source File
# End Group
@ -272,10 +266,6 @@ SOURCE=.\unifwd.c
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\auxdecl.h
# End Source File
# Begin Source File
SOURCE=.\common.h
# End Source File
# Begin Source File

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

@ -1,6 +1,5 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#include "version.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
@ -54,8 +53,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 4,0,1,2
PRODUCTVERSION 4,0,1,2
FILEVERSION RCVERSION
PRODUCTVERSION RCVERSION
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -73,14 +72,14 @@ BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "Xeno86\0"
VALUE "FileDescription", "KernelEx Base Non-shared Api Library\0"
VALUE "FileVersion", "4, 0, 1, 2\0"
VALUE "FileVersion", _RCVERSION_ "\0"
VALUE "InternalName", "kexbasen\0"
VALUE "LegalCopyright", "Copyright <20> 2009, Xeno86\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "kexbasen.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "KernelEx\0"
VALUE "ProductVersion", "4, 0, 1, 2\0"
VALUE "ProductVersion", VERSION_STR "\0"
VALUE "SpecialBuild", "\0"
END
END

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

@ -28,9 +28,11 @@
#include "advapi32/_advapi32_apilist.h"
#include "comdlg32/_comdlg32_apilist.h"
#include "shell32/_shell32_apilist.h"
#include "rpcrt4/_rpcrt4_apilist.h"
#include "winspool/_winspool_apilist.h"
//#include "/__apilist.h"
static apilib_api_table api_table[7];
static apilib_api_table api_table[9];
static void fill_apitable()
{
@ -40,6 +42,8 @@ static void fill_apitable()
api_table[3] = apitable_advapi32;
api_table[4] = apitable_comdlg32;
api_table[5] = apitable_shell32;
api_table[6] = apitable_rpcrt4;
api_table[7] = apitable_winspool;
//last entry is null terminator
}
@ -48,15 +52,12 @@ __declspec(dllexport)
const apilib_api_table* get_api_table()
{
fill_apitable();
//check if unicows is available
if (!unifwd_init())
return NULL;
return api_table;
}
BOOL init()
{
return common_init() && init_kernel32() && init_gdi32() && init_user32() && init_advapi32() && init_comdlg32() && init_shell32();
return common_init() && init_kernel32() && init_gdi32() && init_user32() && init_advapi32() && init_comdlg32() && init_shell32() && init_rpcrt4() && init_winspool();
}
BOOL APIENTRY DllMain(HINSTANCE instance, DWORD reason, BOOL load_static)

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

View File

@ -0,0 +1,48 @@
/*
* KernelEx
* Copyright (C) 2009, Xeno86
*
* This file is part of KernelEx source code.
*
* KernelEx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; version 2 of the License.
*
* KernelEx is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include "common.h"
#include "kexcoresdk.h"
#include "_rpcrt4_apilist.h"
BOOL init_rpcrt4()
{
return TRUE;
}
static const apilib_named_api rpcrt4_named_apis[] =
{
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
DECL_API("RpcStringFreeW", RpcStringFreeW_new),
DECL_API("UuidFromStringW", UuidFromStringW_new),
DECL_API("UuidToStringW", UuidToStringW_new),
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
};
#if 0
static const apilib_unnamed_api rpcrt4_ordinal_apis[] =
{
/*** AUTOGENERATED APILIST ORDINAL EXPORTS BEGIN ***/
/*** AUTOGENERATED APILIST ORDINAL EXPORTS END ***/
};
#endif
const apilib_api_table apitable_rpcrt4 = DECL_TAB("RPCRT4.DLL", rpcrt4_named_apis, 0 /*rpcrt4_ordinal_apis*/);

View File

@ -0,0 +1,36 @@
/*
* KernelEx
* Copyright (C) 2009, Xeno86
*
* This file is part of KernelEx source code.
*
* KernelEx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; version 2 of the License.
*
* KernelEx is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef _RPCRT4_APILIST_H
#define _RPCRT4_APILIST_H
#include "kexcoresdk.h"
BOOL init_rpcrt4();
extern const apilib_api_table apitable_rpcrt4;
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
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);
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
#endif

View File

@ -0,0 +1,65 @@
/*
* KernelEx
* Copyright (C) 2009, Xeno86
*
* This file is part of KernelEx source code.
*
* KernelEx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; version 2 of the License.
*
* KernelEx is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include "common.h"
#include <rpc.h>
/* MAKE_EXPORT RpcStringFreeW_new=RpcStringFreeW */
RPC_STATUS
RPC_ENTRY
RpcStringFreeW_new(IN OUT unsigned short ** String)
{
HeapFree(GetProcessHeap(), 0, *String);
return RPC_S_OK;
}
/* MAKE_EXPORT UuidFromStringW_new=UuidFromStringW */
RPC_STATUS
RPC_ENTRY
UuidFromStringW_new(IN unsigned short * StringUuidW, OUT UUID * Uuid)
{
ALLOC_WtoA(StringUuid);
return UuidFromStringA((unsigned char*) StringUuidA, Uuid);
}
/* MAKE_EXPORT UuidToStringW_new=UuidToStringW */
RPC_STATUS
RPC_ENTRY
UuidToStringW_new(IN UUID * Uuid, OUT unsigned short ** StringUuid)
{
RPC_STATUS ret;
unsigned char* uuidA;
ret = UuidToStringA(Uuid, &uuidA);
if (ret == RPC_S_OK)
{
int size = (strlen((char*) uuidA) + 1) * sizeof(short);
*StringUuid = (unsigned short*) HeapAlloc(GetProcessHeap(), 0, size);
if (!*StringUuid)
{
RpcStringFreeA(&uuidA);
return RPC_S_OUT_OF_MEMORY;
}
MultiByteToWideChar(CP_ACP, 0, (char*)uuidA, -1, *StringUuid, size);
RpcStringFreeA(&uuidA);
}
return ret;
}

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

@ -1,23 +1,23 @@
/*
* Path Functions
*
* Copyright 1998, 1999, 2000 Juergen Schmied
* Copyright 2004 Juan Lang
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
/*
* Path Functions
*
* Copyright 1998, 1999, 2000 Juergen Schmied
* Copyright 2004 Juan Lang
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
#ifdef _MSC_VER
@ -27,281 +27,274 @@
#define WARN() ((void)0)
#else
#define TRACE(...) do {} while(0)
#define TRACE_(x) TRACE
#define TRACE_(x) TRACE
#define WARN(...) do {} while(0)
#endif
#define _WIN32_IE 0x0500
#include <windows.h>
#include <windows.h>
#include <shlguid.h>
#include "auxshlguid.h"
#include "pidl.h"
#include <shlwapi.h>
#include "common.h"
#include "_shell32_apilist.h"
#include "auxdecl.h"
EXTERN_C HRESULT WINAPI SHILCreateFromPathA(LPCSTR path, LPITEMIDLIST *ppidl, DWORD *attributes); /* ORDINAL 28 */
EXTERN_C LPVOID WINAPI SHAlloc(DWORD len); /* ORDINAL 196 */
EXTERN_C void WINAPI SHFree(LPVOID pv); /* ORDINAL 195 */
EXTERN_C LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl); /* ORDINAL 153 */
EXTERN_C LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2); /* ORDINAL 25 */
/**************************************************************************
*
* internal functions
*
* ### 1. section creating pidls ###
*
*************************************************************************
*/
LPITEMIDLIST _ILAlloc(PIDLTYPE type, unsigned int size)
{
LPITEMIDLIST pidlOut = NULL;
pidlOut = (LPITEMIDLIST) SHAlloc(size + 5);
if(pidlOut)
{
LPPIDLDATA pData;
LPITEMIDLIST pidlNext;
ZeroMemory(pidlOut, size + 5);
pidlOut->mkid.cb = size + 3;
pData = _ILGetDataPointer(pidlOut);
if (pData)
pData->type = type;
pidlNext = ILGetNext(pidlOut);
if (pidlNext)
pidlNext->mkid.cb = 0x00;
TRACE("-- (pidl=%p, size=%u)\n", pidlOut, size);
}
return pidlOut;
}
LPITEMIDLIST _ILCreateDesktop()
{
LPITEMIDLIST ret;
TRACE("()\n");
ret = (LPITEMIDLIST) SHAlloc(2);
if (ret)
ret->mkid.cb = 0;
return ret;
}
LPITEMIDLIST _ILCreateMyComputer()
{
TRACE("()\n");
return _ILCreateGuid(PT_GUID, &CLSID_MyComputer);
}
LPITEMIDLIST _ILCreateMyDocuments()
{
TRACE("()\n");
return _ILCreateGuid(PT_GUID, &CLSID_MyDocuments);
}
LPITEMIDLIST _ILCreateIExplore()
{
TRACE("()\n");
return _ILCreateGuid(PT_GUID, &CLSID_Internet);
}
LPITEMIDLIST _ILCreateControlPanel()
{
LPITEMIDLIST parent = _ILCreateGuid(PT_GUID, &CLSID_MyComputer), ret = NULL;
TRACE("()\n");
if (parent)
{
LPITEMIDLIST cpl = _ILCreateGuid(PT_SHELLEXT, &CLSID_ControlPanel);
if (cpl)
{
ret = ILCombine(parent, cpl);
SHFree(cpl);
}
SHFree(parent);
}
return ret;
}
LPITEMIDLIST _ILCreatePrinters()
{
LPITEMIDLIST parent = _ILCreateGuid(PT_GUID, &CLSID_MyComputer), ret = NULL;
TRACE("()\n");
if (parent)
{
LPITEMIDLIST printers = _ILCreateGuid(PT_YAGUID, &CLSID_Printers);
if (printers)
{
ret = ILCombine(parent, printers);
SHFree(printers);
}
SHFree(parent);
}
return ret;
}
LPITEMIDLIST _ILCreateNetwork()
{
TRACE("()\n");
return _ILCreateGuid(PT_GUID, &CLSID_NetworkPlaces);
}
LPITEMIDLIST _ILCreateBitBucket()
{
TRACE("()\n");
return _ILCreateGuid(PT_GUID, &CLSID_RecycleBin);
}
LPITEMIDLIST _ILCreateGuid(PIDLTYPE type, const IID *guid)
{
LPITEMIDLIST pidlOut;
if (type == PT_SHELLEXT || type == PT_GUID || type == PT_YAGUID)
{
pidlOut = _ILAlloc(type, sizeof(GUIDStruct));
if (pidlOut)
{
LPPIDLDATA pData = _ILGetDataPointer(pidlOut);
memcpy(&(pData->u.guid.guid), guid, sizeof(GUID));
TRACE("-- create GUID-pidl %s\n",
debugstr_guid(&(pData->u.guid.guid)));
}
}
else
{
WARN("%d: invalid type for GUID\n", type);
pidlOut = NULL;
}
return pidlOut;
}
/**************************************************************************
*
* ### 4. getting pointers to parts of pidls ###
*
**************************************************************************
* _ILGetDataPointer()
*/
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
{
if(pidl && pidl->mkid.cb != 0x00)
return (LPPIDLDATA) &(pidl->mkid.abID);
return NULL;
}
/*************************************************************************
* SHGetFolderLocation [SHELL32.@]
*
* Gets the folder locations from the registry and creates a pidl.
*
* PARAMS
* hwndOwner [I]
* nFolder [I] CSIDL_xxxxx
* hToken [I] token representing user, or NULL for current user, or -1 for
* default user
* dwReserved [I] must be zero
* ppidl [O] PIDL of a special folder
*
* RETURNS
* Success: S_OK
* Failure: Standard OLE-defined error result, S_FALSE or E_INVALIDARG
*
* NOTES
* Creates missing reg keys and directories.
* Mostly forwards to SHGetFolderPathW, but a few values of nFolder return
* virtual folders that are handled here.
*/
/* MAKE_EXPORT SHGetFolderLocation_new=SHGetFolderLocation */
HRESULT WINAPI SHGetFolderLocation_new(
HWND hwndOwner,
int nFolder,
HANDLE hToken,
DWORD dwReserved,
LPVOID *_ppidl)
/**************************************************************************
*
* internal functions
*
* ### 1. section creating pidls ###
*
*************************************************************************
*/
LPITEMIDLIST _ILAlloc(PIDLTYPE type, unsigned int size)
{
LPITEMIDLIST *ppidl = (LPITEMIDLIST*) _ppidl;
HRESULT hr = E_INVALIDARG;
TRACE("%p 0x%08x %p 0x%08lx %p\n",
hwndOwner, nFolder, hToken, dwReserved, ppidl);
if (!ppidl)
return E_INVALIDARG;
if (dwReserved)
return E_INVALIDARG;
/* The virtual folders' locations are not user-dependent */
*ppidl = NULL;
switch (nFolder)
{
case CSIDL_DESKTOP:
*ppidl = _ILCreateDesktop();
break;
case CSIDL_PERSONAL:
*ppidl = _ILCreateMyDocuments();
break;
case CSIDL_INTERNET:
*ppidl = _ILCreateIExplore();
break;
case CSIDL_CONTROLS:
*ppidl = _ILCreateControlPanel();
break;
case CSIDL_PRINTERS:
*ppidl = _ILCreatePrinters();
break;
case CSIDL_BITBUCKET:
*ppidl = _ILCreateBitBucket();
break;
case CSIDL_DRIVES:
*ppidl = _ILCreateMyComputer();
break;
case CSIDL_NETWORK:
*ppidl = _ILCreateNetwork();
break;
default:
{
char szPath[MAX_PATH];
hr = SHGetFolderPathA_new(hwndOwner, nFolder, hToken,
SHGFP_TYPE_CURRENT, szPath);
if (SUCCEEDED(hr))
{
DWORD attributes=0;
TRACE("Value=%s\n", debugstr_w(szPath));
hr = SHILCreateFromPathA(szPath, ppidl, &attributes);
}
else if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND))
{
/* unlike SHGetFolderPath, SHGetFolderLocation in shell32
* version 6.0 returns E_FAIL for nonexistent paths
*/
hr = E_FAIL;
}
}
}
if(*ppidl)
hr = NOERROR;
TRACE("-- (new pidl %p)\n",*ppidl);
return hr;
}
LPITEMIDLIST pidlOut = NULL;
pidlOut = (LPITEMIDLIST) SHAlloc(size + 5);
if(pidlOut)
{
LPPIDLDATA pData;
LPITEMIDLIST pidlNext;
ZeroMemory(pidlOut, size + 5);
pidlOut->mkid.cb = size + 3;
pData = _ILGetDataPointer(pidlOut);
if (pData)
pData->type = type;
pidlNext = ILGetNext(pidlOut);
if (pidlNext)
pidlNext->mkid.cb = 0x00;
TRACE("-- (pidl=%p, size=%u)\n", pidlOut, size);
}
return pidlOut;
}
LPITEMIDLIST _ILCreateDesktop()
{
LPITEMIDLIST ret;
TRACE("()\n");
ret = (LPITEMIDLIST) SHAlloc(2);
if (ret)
ret->mkid.cb = 0;
return ret;
}
LPITEMIDLIST _ILCreateMyComputer()
{
TRACE("()\n");
return _ILCreateGuid(PT_GUID, &CLSID_MyComputer);
}
LPITEMIDLIST _ILCreateMyDocuments()
{
TRACE("()\n");
return _ILCreateGuid(PT_GUID, &CLSID_MyDocuments);
}
LPITEMIDLIST _ILCreateIExplore()
{
TRACE("()\n");
return _ILCreateGuid(PT_GUID, &CLSID_Internet);
}
LPITEMIDLIST _ILCreateControlPanel()
{
LPITEMIDLIST parent = _ILCreateGuid(PT_GUID, &CLSID_MyComputer), ret = NULL;
TRACE("()\n");
if (parent)
{
LPITEMIDLIST cpl = _ILCreateGuid(PT_SHELLEXT, &CLSID_ControlPanel);
if (cpl)
{
ret = ILCombine(parent, cpl);
SHFree(cpl);
}
SHFree(parent);
}
return ret;
}
LPITEMIDLIST _ILCreatePrinters()
{
LPITEMIDLIST parent = _ILCreateGuid(PT_GUID, &CLSID_MyComputer), ret = NULL;
TRACE("()\n");
if (parent)
{
LPITEMIDLIST printers = _ILCreateGuid(PT_YAGUID, &CLSID_Printers);
if (printers)
{
ret = ILCombine(parent, printers);
SHFree(printers);
}
SHFree(parent);
}
return ret;
}
LPITEMIDLIST _ILCreateNetwork()
{
TRACE("()\n");
return _ILCreateGuid(PT_GUID, &CLSID_NetworkPlaces);
}
LPITEMIDLIST _ILCreateBitBucket()
{
TRACE("()\n");
return _ILCreateGuid(PT_GUID, &CLSID_RecycleBin);
}
LPITEMIDLIST _ILCreateGuid(PIDLTYPE type, const IID *guid)
{
LPITEMIDLIST pidlOut;
if (type == PT_SHELLEXT || type == PT_GUID || type == PT_YAGUID)
{
pidlOut = _ILAlloc(type, sizeof(GUIDStruct));
if (pidlOut)
{
LPPIDLDATA pData = _ILGetDataPointer(pidlOut);
memcpy(&(pData->u.guid.guid), guid, sizeof(GUID));
TRACE("-- create GUID-pidl %s\n",
debugstr_guid(&(pData->u.guid.guid)));
}
}
else
{
WARN("%d: invalid type for GUID\n", type);
pidlOut = NULL;
}
return pidlOut;
}
/**************************************************************************
*
* ### 4. getting pointers to parts of pidls ###
*
**************************************************************************
* _ILGetDataPointer()
*/
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
{
if(pidl && pidl->mkid.cb != 0x00)
return (LPPIDLDATA) &(pidl->mkid.abID);
return NULL;
}
/*************************************************************************
* SHGetFolderLocation [SHELL32.@]
*
* Gets the folder locations from the registry and creates a pidl.
*
* PARAMS
* hwndOwner [I]
* nFolder [I] CSIDL_xxxxx
* hToken [I] token representing user, or NULL for current user, or -1 for
* default user
* dwReserved [I] must be zero
* ppidl [O] PIDL of a special folder
*
* RETURNS
* Success: S_OK
* Failure: Standard OLE-defined error result, S_FALSE or E_INVALIDARG
*
* NOTES
* Creates missing reg keys and directories.
* Mostly forwards to SHGetFolderPathW, but a few values of nFolder return
* virtual folders that are handled here.
*/
/* MAKE_EXPORT SHGetFolderLocation_new=SHGetFolderLocation */
HRESULT WINAPI SHGetFolderLocation_new(
HWND hwndOwner,
int nFolder,
HANDLE hToken,
DWORD dwReserved,
LPVOID *_ppidl)
{
LPITEMIDLIST *ppidl = (LPITEMIDLIST*) _ppidl;
HRESULT hr = E_INVALIDARG;
TRACE("%p 0x%08x %p 0x%08lx %p\n",
hwndOwner, nFolder, hToken, dwReserved, ppidl);
if (!ppidl)
return E_INVALIDARG;
if (dwReserved)
return E_INVALIDARG;
/* The virtual folders' locations are not user-dependent */
*ppidl = NULL;
switch (nFolder)
{
case CSIDL_DESKTOP:
*ppidl = _ILCreateDesktop();
break;
case CSIDL_PERSONAL:
*ppidl = _ILCreateMyDocuments();
break;
case CSIDL_INTERNET:
*ppidl = _ILCreateIExplore();
break;
case CSIDL_CONTROLS:
*ppidl = _ILCreateControlPanel();
break;
case CSIDL_PRINTERS:
*ppidl = _ILCreatePrinters();
break;
case CSIDL_BITBUCKET:
*ppidl = _ILCreateBitBucket();
break;
case CSIDL_DRIVES:
*ppidl = _ILCreateMyComputer();
break;
case CSIDL_NETWORK:
*ppidl = _ILCreateNetwork();
break;
default:
{
char szPath[MAX_PATH];
hr = SHGetFolderPathA_new(hwndOwner, nFolder, hToken,
SHGFP_TYPE_CURRENT, szPath);
if (SUCCEEDED(hr))
{
DWORD attributes=0;
TRACE("Value=%s\n", debugstr_w(szPath));
hr = SHILCreateFromPath((LPWSTR)szPath, ppidl, &attributes);
}
else if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND))
{
/* unlike SHGetFolderPath, SHGetFolderLocation in shell32
* version 6.0 returns E_FAIL for nonexistent paths
*/
hr = E_FAIL;
}
}
}
if(*ppidl)
hr = NOERROR;
TRACE("-- (new pidl %p)\n",*ppidl);
return hr;
}

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

@ -28,31 +28,31 @@ typedef HRESULT (WINAPI *SHGetFolderPathW_t)(HWND, int, HANDLE, DWORD, LPWSTR);
static SHGetFolderPathA_t SHGetFolderPathA_pfn = (SHGetFolderPathA_t)-1;
static SHGetFolderPathW_t SHGetFolderPathW_pfn = (SHGetFolderPathW_t)-1;
BOOL init_shfolder(void)
{
DWORD lasterr = GetLastError();
HMODULE hShell32 = GetModuleHandle("SHELL32.DLL");
PROC pfn = kexGetProcAddress(hShell32, "SHGetFolderPathA");
if (pfn)
SHGetFolderPathA_pfn = (SHGetFolderPathA_t) pfn;
pfn = kexGetProcAddress(hShell32, "SHGetFolderPathW");
if (pfn)
SHGetFolderPathW_pfn = (SHGetFolderPathW_t) pfn;
SetLastError(lasterr);
return TRUE;
}
static PROC LoadShfolderProc(const char* 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();
if (!hShfolder)
//first try with shell32
if (!hShell32)
{
hShfolder = GetModuleHandle(ShfolderFn);
if (!hShfolder) hShfolder = LoadLibrary(ShfolderFn);
hShell32 = GetModuleHandle(Shell32Fn);
if (!hShell32) hShell32 = LoadLibrary(Shell32Fn);
}
if (hShell32) ret = kexGetProcAddress(hShell32, proc);
//fallback to shfolder
if (!ret)
{
if (!hShfolder)
{
hShfolder = GetModuleHandle(ShfolderFn);
if (!hShfolder) hShfolder = LoadLibrary(ShfolderFn);
}
if (hShfolder) ret = kexGetProcAddress(hShfolder, proc);
}
SetLastError(lasterr);

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

@ -23,11 +23,9 @@
#include "kexcoresdk.h"
#include "_shell32_apilist.h"
extern BOOL init_shfolder(void);
BOOL init_shell32()
{
return init_shfolder();
return TRUE;
}
static const apilib_named_api shell32_named_apis[] =

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

@ -22,7 +22,6 @@
#ifndef _SHELL32_APILIST_H
#define _SHELL32_APILIST_H
#include "auxdecl.h"
#include "kexcoresdk.h"
BOOL init_shell32();

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

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

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

View File

@ -1,8 +0,0 @@
LIBRARY SHELL32.dll
EXPORTS
SHILCreateFromPathA@12 @28 NONAME
SHAlloc@4 @196 NONAME
SHFree@4 @195 NONAME
ILGetNext@4 @153 NONAME
ILCombine@8 @25 NONAME

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

@ -20,6 +20,7 @@
*/
#include <windows.h>
#include <float.h>
#include "unifwd.h"
#include "kexcoresdk.h"
#include "common.h"
@ -28,9 +29,21 @@ static HMODULE hUnicows;
int unifwd_init(void)
{
DWORD lasterror = GetLastError();
hUnicows = GetModuleHandle("UNICOWS.DLL");
if (!hUnicows)
{
//Some DLLs that are loaded in conjunction with
//unicows.dll may blow the FPU's control word.
//Save it here...
unsigned int fpu_cw;
fpu_cw = _control87(0, 0);
hUnicows = LoadLibrary("UNICOWS.DLL");
//...and restore afterwards
if (_control87(0, 0) != fpu_cw)
_control87(fpu_cw, 0xfffff);
}
SetLastError(lasterror);
return (hUnicows != NULL);
}

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

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

@ -33,21 +33,10 @@ 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("CallMsgFilterW", CallMsgFilterW_fwd),
DECL_API("CallWindowProcW", CallWindowProcW_fwd),
DECL_API("ChangeDisplaySettingsExW", ChangeDisplaySettingsExW_fwd),
DECL_API("ChangeDisplaySettingsW", ChangeDisplaySettingsW_fwd),
DECL_API("ChangeMenuW", ChangeMenuW_fwd),
DECL_API("CharLowerBuffW", CharLowerBuffW_fwd),
DECL_API("CharLowerW", CharLowerW_fwd),
DECL_API("CharNextW", CharNextW_fwd),
DECL_API("CharPrevW", CharPrevW_fwd),
DECL_API("CharToOemBuffW", CharToOemBuffW_fwd),
DECL_API("CharToOemW", CharToOemW_fwd),
DECL_API("CharUpperBuffW", CharUpperBuffW_fwd),
DECL_API("CharUpperW", CharUpperW_fwd),
DECL_API("CopyAcceleratorTableW", CopyAcceleratorTableW_fwd),
DECL_API("CreateAcceleratorTableW", CreateAcceleratorTableW_fwd),
DECL_API("CreateDialogIndirectParamW", CreateDialogIndirectParamW_fwd),
DECL_API("CreateDialogParamW", CreateDialogParamW_new),
DECL_API("CreateMDIWindowW", CreateMDIWindowW_fwd),
@ -61,7 +50,6 @@ static const apilib_named_api user32_named_apis[] =
DECL_API("DefWindowProcW", DefWindowProcW_new),
DECL_API("DialogBoxIndirectParamW", DialogBoxIndirectParamW_fwd),
DECL_API("DialogBoxParamW", DialogBoxParamW_fwd),
DECL_API("DispatchMessageW", DispatchMessageW_fwd),
DECL_API("DlgDirListComboBoxW", DlgDirListComboBoxW_fwd),
DECL_API("DlgDirListW", DlgDirListW_fwd),
DECL_API("DlgDirSelectComboBoxExW", DlgDirSelectComboBoxExW_fwd),
@ -96,11 +84,6 @@ static const apilib_named_api user32_named_apis[] =
DECL_API("GrayStringW", GrayStringW_fwd),
DECL_API("InsertMenuItemW", InsertMenuItemW_fwd),
DECL_API("InsertMenuW", InsertMenuW_fwd),
DECL_API("IsCharAlphaNumericW", IsCharAlphaNumericW_fwd),
DECL_API("IsCharAlphaW", IsCharAlphaW_fwd),
DECL_API("IsCharLowerW", IsCharLowerW_fwd),
DECL_API("IsCharUpperW", IsCharUpperW_fwd),
DECL_API("IsDialogMessageW", IsDialogMessageW_fwd),
DECL_API("IsWindowUnicode", IsWindowUnicode_fwd),
DECL_API("LoadAcceleratorsW", LoadAcceleratorsW_fwd),
DECL_API("LoadBitmapW", LoadBitmapW_fwd),
@ -115,9 +98,6 @@ static const apilib_named_api user32_named_apis[] =
DECL_API("MapVirtualKeyW", MapVirtualKeyW_fwd),
DECL_API("MessageBoxIndirectW", MessageBoxIndirectW_fwd),
DECL_API("ModifyMenuW", ModifyMenuW_fwd),
DECL_API("OemToCharBuffW", OemToCharBuffW_fwd),
DECL_API("OemToCharW", OemToCharW_fwd),
DECL_API("PeekMessageW", PeekMessageW_fwd),
DECL_API("PostMessageW", PostMessageW_fwd),
DECL_API("PostThreadMessageW", PostThreadMessageW_fwd),
DECL_API("RegisterClassExW", RegisterClassExW_fwd),
@ -141,7 +121,6 @@ static const apilib_named_api user32_named_apis[] =
DECL_API("SetWindowsHookW", SetWindowsHookW_fwd),
DECL_API("SystemParametersInfoW", SystemParametersInfoW_fwd),
DECL_API("TabbedTextOutW", TabbedTextOutW_fwd),
DECL_API("TranslateAcceleratorW", TranslateAcceleratorW_fwd),
DECL_API("UnregisterClassW", UnregisterClassW_fwd),
DECL_API("VkKeyScanExW", VkKeyScanExW_fwd),
DECL_API("VkKeyScanW", VkKeyScanW_fwd),

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

@ -22,7 +22,6 @@
#ifndef _USER32_APILIST_H
#define _USER32_APILIST_H
#include "auxdecl.h"
#include "kexcoresdk.h"
BOOL init_user32();
@ -31,21 +30,10 @@ extern const apilib_api_table apitable_user32;
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
FWDPROC AppendMenuW_fwd;
FWDPROC BroadcastSystemMessageW_fwd;
FWDPROC CallMsgFilterW_fwd;
FWDPROC CallWindowProcW_fwd;
FWDPROC ChangeDisplaySettingsExW_fwd;
FWDPROC ChangeDisplaySettingsW_fwd;
FWDPROC ChangeMenuW_fwd;
FWDPROC CharLowerBuffW_fwd;
FWDPROC CharLowerW_fwd;
FWDPROC CharNextW_fwd;
FWDPROC CharPrevW_fwd;
FWDPROC CharToOemBuffW_fwd;
FWDPROC CharToOemW_fwd;
FWDPROC CharUpperBuffW_fwd;
FWDPROC CharUpperW_fwd;
FWDPROC CopyAcceleratorTableW_fwd;
FWDPROC CreateAcceleratorTableW_fwd;
FWDPROC CreateDialogIndirectParamW_fwd;
FWDPROC CreateMDIWindowW_fwd;
FWDPROC CreateWindowExW_fwd;
@ -57,7 +45,6 @@ FWDPROC DefFrameProcW_fwd;
FWDPROC DefMDIChildProcW_fwd;
FWDPROC DialogBoxIndirectParamW_fwd;
FWDPROC DialogBoxParamW_fwd;
FWDPROC DispatchMessageW_fwd;
FWDPROC DlgDirListComboBoxW_fwd;
FWDPROC DlgDirListW_fwd;
FWDPROC DlgDirSelectComboBoxExW_fwd;
@ -92,11 +79,6 @@ FWDPROC GetWindowTextW_fwd;
FWDPROC GrayStringW_fwd;
FWDPROC InsertMenuItemW_fwd;
FWDPROC InsertMenuW_fwd;
FWDPROC IsCharAlphaNumericW_fwd;
FWDPROC IsCharAlphaW_fwd;
FWDPROC IsCharLowerW_fwd;
FWDPROC IsCharUpperW_fwd;
FWDPROC IsDialogMessageW_fwd;
FWDPROC IsWindowUnicode_fwd;
FWDPROC LoadAcceleratorsW_fwd;
FWDPROC LoadBitmapW_fwd;
@ -111,9 +93,6 @@ FWDPROC MapVirtualKeyExW_fwd;
FWDPROC MapVirtualKeyW_fwd;
FWDPROC MessageBoxIndirectW_fwd;
FWDPROC ModifyMenuW_fwd;
FWDPROC OemToCharBuffW_fwd;
FWDPROC OemToCharW_fwd;
FWDPROC PeekMessageW_fwd;
FWDPROC PostMessageW_fwd;
FWDPROC PostThreadMessageW_fwd;
FWDPROC RegisterClassExW_fwd;
@ -137,7 +116,6 @@ FWDPROC SetWindowsHookW_fwd;
FWDPROC SetWindowTextW_fwd;
FWDPROC SystemParametersInfoW_fwd;
FWDPROC TabbedTextOutW_fwd;
FWDPROC TranslateAcceleratorW_fwd;
FWDPROC UnregisterClassW_fwd;
FWDPROC VkKeyScanExW_fwd;
FWDPROC VkKeyScanW_fwd;

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

@ -25,21 +25,10 @@
FORWARD_TO_UNICOWS(AppendMenuW);
FORWARD_TO_UNICOWS(BroadcastSystemMessageW);
FORWARD_TO_UNICOWS(CallMsgFilterW);
FORWARD_TO_UNICOWS(CallWindowProcW);
FORWARD_TO_UNICOWS(ChangeDisplaySettingsExW);
FORWARD_TO_UNICOWS(ChangeDisplaySettingsW);
FORWARD_TO_UNICOWS(ChangeMenuW);
FORWARD_TO_UNICOWS(CharLowerBuffW);
FORWARD_TO_UNICOWS(CharLowerW);
FORWARD_TO_UNICOWS(CharNextW);
FORWARD_TO_UNICOWS(CharPrevW);
FORWARD_TO_UNICOWS(CharToOemBuffW);
FORWARD_TO_UNICOWS(CharToOemW);
FORWARD_TO_UNICOWS(CharUpperBuffW);
FORWARD_TO_UNICOWS(CharUpperW);
FORWARD_TO_UNICOWS(CopyAcceleratorTableW);
FORWARD_TO_UNICOWS(CreateAcceleratorTableW);
FORWARD_TO_UNICOWS(CreateDialogIndirectParamW);
static BOOL CALLBACK SetUnicode(HWND hwnd, LPARAM lParam)
@ -80,7 +69,6 @@ LRESULT WINAPI DefWindowProcW_new(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lPa
FORWARD_TO_UNICOWS(DialogBoxIndirectParamW);
FORWARD_TO_UNICOWS(DialogBoxParamW);
FORWARD_TO_UNICOWS(DispatchMessageW);
FORWARD_TO_UNICOWS(DlgDirListComboBoxW);
FORWARD_TO_UNICOWS(DlgDirListW);
FORWARD_TO_UNICOWS(DlgDirSelectComboBoxExW);
@ -115,11 +103,6 @@ FORWARD_TO_UNICOWS(GetWindowTextW);
FORWARD_TO_UNICOWS(GrayStringW);
FORWARD_TO_UNICOWS(InsertMenuItemW);
FORWARD_TO_UNICOWS(InsertMenuW);
FORWARD_TO_UNICOWS(IsCharAlphaNumericW);
FORWARD_TO_UNICOWS(IsCharAlphaW);
FORWARD_TO_UNICOWS(IsCharLowerW);
FORWARD_TO_UNICOWS(IsCharUpperW);
FORWARD_TO_UNICOWS(IsDialogMessageW);
FORWARD_TO_UNICOWS(IsWindowUnicode);
FORWARD_TO_UNICOWS(LoadAcceleratorsW);
FORWARD_TO_UNICOWS(LoadBitmapW);
@ -134,9 +117,6 @@ FORWARD_TO_UNICOWS(MapVirtualKeyExW);
FORWARD_TO_UNICOWS(MapVirtualKeyW);
FORWARD_TO_UNICOWS(MessageBoxIndirectW);
FORWARD_TO_UNICOWS(ModifyMenuW);
FORWARD_TO_UNICOWS(OemToCharBuffW);
FORWARD_TO_UNICOWS(OemToCharW);
FORWARD_TO_UNICOWS(PeekMessageW);
FORWARD_TO_UNICOWS(PostMessageW);
FORWARD_TO_UNICOWS(PostThreadMessageW);
FORWARD_TO_UNICOWS(RegisterClassExW);
@ -160,7 +140,6 @@ FORWARD_TO_UNICOWS(SetWindowsHookW);
FORWARD_TO_UNICOWS(SetWindowTextW);
FORWARD_TO_UNICOWS(SystemParametersInfoW);
FORWARD_TO_UNICOWS(TabbedTextOutW);
FORWARD_TO_UNICOWS(TranslateAcceleratorW);
FORWARD_TO_UNICOWS(UnregisterClassW);
FORWARD_TO_UNICOWS(VkKeyScanExW);
FORWARD_TO_UNICOWS(VkKeyScanW);

View File

@ -0,0 +1,70 @@
/*
* KernelEx
* Copyright (C) 2009, Xeno86
*
* This file is part of KernelEx source code.
*
* KernelEx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; version 2 of the License.
*
* KernelEx is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include "common.h"
/* MAKE_EXPORT GetDefaultPrinterA=GetDefaultPrinterA */
BOOL WINAPI GetDefaultPrinterA(LPSTR buf, LPDWORD size)
{
DWORD needed, returned;
BOOL ret;
DWORD len;
EnumPrinters(PRINTER_ENUM_DEFAULT, NULL, 1, NULL, 0, &needed, &returned);
if (needed == 0)
{
SetLastError(ERROR_FILE_NOT_FOUND);
return FALSE;
}
PRINTER_INFO_1* ppi = (PRINTER_INFO_1*) alloca(needed);
ret = EnumPrinters(PRINTER_ENUM_DEFAULT, NULL, 1, (BYTE*) ppi, needed, &needed, &returned);
if (!ret)
{
SetLastError(ERROR_FILE_NOT_FOUND);
return FALSE;
}
len = strlen(ppi->pName);
if (len >= *size)
{
*size = len + 1;
SetLastError(ERROR_INSUFFICIENT_BUFFER);
return FALSE;
}
strcpy(buf, ppi->pName);
*size = len + 1;
return TRUE;
}
/* MAKE_EXPORT GetDefaultPrinterW=GetDefaultPrinterW */
BOOL WINAPI GetDefaultPrinterW(LPWSTR bufW, LPDWORD sizeW)
{
BOOL ret;
DWORD sizeA = *sizeW;
ALLOC_A(buf, sizeA);
ret = GetDefaultPrinterA(bufA, &sizeA);
if (ret)
{
*sizeW = ABUFtoW(buf, sizeA, *sizeW);
if (!ret)
*sizeW = ABUFtoW(buf, sizeA, 0);
}
return FALSE;
}

View File

@ -0,0 +1,47 @@
/*
* KernelEx
* Copyright (C) 2009, Xeno86
*
* This file is part of KernelEx source code.
*
* KernelEx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; version 2 of the License.
*
* KernelEx is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include "common.h"
#include "kexcoresdk.h"
#include "_winspool_apilist.h"
BOOL init_winspool()
{
return TRUE;
}
static const apilib_named_api winspool_named_apis[] =
{
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
DECL_API("GetDefaultPrinterA", GetDefaultPrinterA),
DECL_API("GetDefaultPrinterW", GetDefaultPrinterW),
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
};
#if 0
static const apilib_unnamed_api winspool_ordinal_apis[] =
{
/*** AUTOGENERATED APILIST ORDINAL EXPORTS BEGIN ***/
/*** AUTOGENERATED APILIST ORDINAL EXPORTS END ***/
};
#endif
const apilib_api_table apitable_winspool = DECL_TAB("WINSPOOL.DRV", winspool_named_apis, 0 /*winspool_ordinal_apis*/);

View File

@ -0,0 +1,35 @@
/*
* KernelEx
* Copyright (C) 2009, Xeno86
*
* This file is part of KernelEx source code.
*
* KernelEx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; version 2 of the License.
*
* KernelEx is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef _WINSPOOL_APILIST_H
#define _WINSPOOL_APILIST_H
#include "kexcoresdk.h"
BOOL init_winspool();
extern const apilib_api_table apitable_winspool;
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
BOOL WINAPI GetDefaultPrinterA(LPSTR buf, LPDWORD size);
BOOL WINAPI GetDefaultPrinterW(LPWSTR bufW, LPDWORD sizeW);
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
#endif

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

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

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

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

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

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

@ -22,7 +22,6 @@
#ifndef _ADVAPI32_APILIST_H
#define _ADVAPI32_APILIST_H
#include "auxdecl.h"
#include "kexcoresdk.h"
BOOL init_advapi32();

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

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

@ -1123,11 +1123,11 @@ GetFileSecurityW_new( LPCWSTR lpFileName,
DWORD nNeeded;
LPBYTE pBuffer;
DWORD iLocNow;
SECURITY_DESCRIPTOR_RELATIVE *pSDRelative;
SECURITY_DESCRIPTOR *pSDRelative;
FIXMEW("GetFileSecurityW(%s) : returns fake SECURITY_DESCRIPTOR\n", lpFileName);
nNeeded = sizeof(SECURITY_DESCRIPTOR_RELATIVE);
nNeeded = sizeof(SECURITY_DESCRIPTOR);
if (RequestedInformation & OWNER_SECURITY_INFORMATION)
nNeeded += sizeof(sidWorld);
if (RequestedInformation & GROUP_SECURITY_INFORMATION)
@ -1145,33 +1145,33 @@ GetFileSecurityW_new( LPCWSTR lpFileName,
if (!InitializeSecurityDescriptor_new(pSecurityDescriptor, SECURITY_DESCRIPTOR_REVISION))
return FALSE;
pSDRelative = (PISECURITY_DESCRIPTOR_RELATIVE) pSecurityDescriptor;
pSDRelative = (PISECURITY_DESCRIPTOR) pSecurityDescriptor;
pSDRelative->Control |= SE_SELF_RELATIVE;
pBuffer = (LPBYTE) pSDRelative;
iLocNow = sizeof(SECURITY_DESCRIPTOR_RELATIVE);
iLocNow = sizeof(SECURITY_DESCRIPTOR);
if (RequestedInformation & OWNER_SECURITY_INFORMATION)
{
memcpy(pBuffer + iLocNow, &sidWorld, sizeof(sidWorld));
pSDRelative->Owner = iLocNow;
pSDRelative->Owner = (PACL) iLocNow;
iLocNow += sizeof(sidWorld);
}
if (RequestedInformation & GROUP_SECURITY_INFORMATION)
{
memcpy(pBuffer + iLocNow, &sidWorld, sizeof(sidWorld));
pSDRelative->Group = iLocNow;
pSDRelative->Group = (PACL) iLocNow;
iLocNow += sizeof(sidWorld);
}
if (RequestedInformation & DACL_SECURITY_INFORMATION)
{
GetWorldAccessACL((PACL) (pBuffer + iLocNow));
pSDRelative->Dacl = iLocNow;
pSDRelative->Dacl = (PACL) iLocNow;
iLocNow += WINE_SIZE_OF_WORLD_ACCESS_ACL;
}
if (RequestedInformation & SACL_SECURITY_INFORMATION)
{
GetWorldAccessACL((PACL) (pBuffer + iLocNow));
pSDRelative->Sacl = iLocNow;
pSDRelative->Sacl = (PACL) iLocNow;
/* iLocNow += WINE_SIZE_OF_WORLD_ACCESS_ACL; */
}
return TRUE;

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

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

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

@ -34,6 +34,10 @@ DWORD WINAPI GetGlyphOutlineA_fix(
{
//last parameter must point to writeable memory
MAT2 matr;
memcpy( &matr, lpmat2, sizeof(MAT2) );
return GetGlyphOutlineA( hdc, uChar, uFormat, lpgm, cbBuffer, lpvBuffer, &matr );
if (lpmat2)
{
memcpy( &matr, lpmat2, sizeof(MAT2) );
lpmat2 = &matr;
}
return GetGlyphOutlineA( hdc, uChar, uFormat, lpgm, cbBuffer, lpvBuffer, lpmat2 );
}

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

@ -26,12 +26,225 @@
*/
#include <windows.h>
#include "auxdecl.h"
#include <malloc.h>
#include "gdi9x.h"
#include "k32ord.h"
#ifdef _MSC_VER
#ifdef __cplusplus
extern "C"
#endif
__declspec(selectany) int _fltused=1;
#endif
#ifndef ETO_PDY
#define ETO_PDY 0x2000
#endif
static DWORD g_GdiBase;
#define REBASEGDI(x) ( g_GdiBase + (DWORD)(x) )
/* MAKE_EXPORT GetFontUnicodeRanges_new=GetFontUnicodeRanges */
DWORD WINAPI GetFontUnicodeRanges_new(
HDC hdc,
LPGLYPHSET lpgs
)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/* On 9x fallback to system function */
/* MAKE_EXPORT SetGraphicsMode_NT=SetGraphicsMode */
int WINAPI SetGraphicsMode_NT(
HDC hdc, // handle to device context
int iMode // graphics mode
)
{
return GM_COMPATIBLE;
}
/* MAKE_EXPORT SetWorldTransform_9x=SetWorldTransform */
BOOL WINAPI SetWorldTransform_9x(
HDC hdc, // handle to device context
CONST XFORM *lpXform // transformation data
)
{
return FALSE;
}
/* MAKE_EXPORT GetRandomRgn_NT=GetRandomRgn */
int WINAPI GetRandomRgn_NT(
HDC hdc, // handle to DC
HRGN hrgn, // handle to region
INT iNum // must be SYSRGN
)
{
int result = GetRandomRgn(hdc,hrgn,iNum);
if (result)
{
POINT pt;
GetDCOrgEx(hdc,&pt);
OffsetRgn(hrgn,pt.x,pt.y);
}
return result;
}
PDCOBJ GetDCObj( HDC hDC )
{
PDCOBJ retobj;
PLHENTRY entry;
if (!hDC) return NULL;
if (!g_GdiBase) g_GdiBase = MapSL( LoadLibrary16("gdi") << 16 );
entry = (PLHENTRY)REBASEGDI(LOWORD(hDC));
if ( !entry->wBlock || entry->bFlags == LHE_FREEHANDLE ) return NULL;
if ( entry->bFlags & LHE_DISCARDED )
{
if ( entry->wBlock & 3 ) return NULL; //32-bit handles have to divide by 4
DWORD* highDC = (DWORD*)REBASEGDI( 0x10000 + entry->wBlock );
if ( IsBadReadPtr(highDC,sizeof(DWORD)) ) return NULL; //oops dead handle
retobj = (PDCOBJ)REBASEGDI(*highDC);
if ( IsBadReadPtr(retobj,sizeof(DCOBJ)) ) return NULL; //oops?!
}
else
retobj = (PDCOBJ)REBASEGDI(entry->wBlock);
WORD checktype = (retobj->wType & GDI_OBJTYPE_MASK);
if ( checktype != GDI_OBJTYPE_DC && checktype != GDI_OBJTYPE_DC_NO ) return NULL;
return retobj;
}
void floattofrac( float f, int* m, int* d)
{
float absf = f > 0 ? f : -f;
if ( absf < 1 )
{
*m = 1;
*d = (int) (1 / f);
}
else
{
*m = (int)f;
*d = 1;
}
}
#define almostzero(x) ( x > -0.0001 && x < 0.0001 )
/* MAKE_EXPORT SetWorldTransform_NT=SetWorldTransform */
BOOL WINAPI SetWorldTransform_NT(
HDC hdc, // handle to device context
CONST XFORM *lpXform // transformation data
)
{
PDCOBJ dcobj = GetDCObj(hdc);
WORD savemapmode;
int wx;
int wy;
int vx;
int vy;
if ( !dcobj || !lpXform || !almostzero(lpXform->eM12) || !almostzero(lpXform->eM21)
|| almostzero(lpXform->eM11) || almostzero(lpXform->eM22) )
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE; //no rotating for you
}
floattofrac( lpXform->eM11, &vx, &wx );
floattofrac( lpXform->eM22, &vy, &wy );
//hack DC mode to anisotropic to make Set*ExtEx work
savemapmode = dcobj->mapmode;
dcobj->mapmode = MM_ANISOTROPIC;
SetWindowExtEx(hdc,wx,wy,NULL);
SetViewportExtEx(hdc,vx,vy,NULL);
SetViewportOrgEx(hdc,(int)lpXform->eDx,(int)lpXform->eDy,NULL);
//set it back
dcobj->mapmode = savemapmode;
return TRUE;
}
/************************************************************************/
/* Those hacks shouldn't hurt anybody. */
/************************************************************************/
/* MAKE_EXPORT SetMapMode_NT=SetMapMode */
int WINAPI SetMapMode_NT(
HDC hdc, // handle to device context
int fnMapMode // new mapping mode
)
{
if ( fnMapMode == MM_TEXT && GetMapMode(hdc) == MM_TEXT ) return MM_TEXT;
return SetMapMode( hdc, fnMapMode );
}
/* MAKE_EXPORT GetTextMetricsA_NT=GetTextMetricsA */
BOOL WINAPI GetTextMetricsA_NT(
HDC hdc, // handle to DC
LPTEXTMETRIC lptm // text metrics
)
{
PDCOBJ dcobj = GetDCObj(hdc);
int saved = 0;
BOOL retval;
if ( !dcobj ) 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);
return retval;
}
/* MAKE_EXPORT GetWorldTransform_NT=GetWorldTransform */
BOOL WINAPI GetWorldTransform_NT(
HDC hdc, // handle to device context
LPXFORM lpXform // transformation
)
{
SIZE v;
SIZE w;
POINT org;
if ( !lpXform ) return FALSE;
GetWindowExtEx(hdc,&w);
GetViewportExtEx(hdc,&v);
GetViewportOrgEx(hdc,&org);
lpXform->eM11 = (float)v.cx/w.cx;
lpXform->eM12 = 0;
lpXform->eM21 = 0;
lpXform->eM22 = (float)v.cy/w.cy;
lpXform->eDx = (float)org.x;
lpXform->eDy = (float)org.y;
return TRUE;
}
/* MAKE_EXPORT ModifyWorldTransform_NT=ModifyWorldTransform */
BOOL WINAPI ModifyWorldTransform_NT(
HDC hdc, // handle to device context
CONST XFORM *lpXform, // transformation data
DWORD iMode // modification mode
)
{
//we accept only 'reset world' scenario
XFORM x;
if ( iMode != MWT_IDENTITY ) return FALSE;
x.eDx = 0;
x.eDy = 0;
x.eM11 = 1;
x.eM12 = 0;
x.eM21 = 0;
x.eM22 = 1;
return SetWorldTransform_NT(hdc,&x);
}
/************************************************************************/
/* Text out API fixes */
/************************************************************************/
static void WINAPI MakeDxFromDxDy(const int* lpDx, int* newlpDx, UINT cbCount)
{
UINT oneDx;
@ -56,12 +269,12 @@ BOOL WINAPI ExtTextOutA_new(
LPCSTR lpString, // string
UINT cbCount, // number of characters in string
CONST INT* lpDx // array of spacing values
)
)
{
BOOL result;
int* buffer = 0;
int* buffer = NULL;
if ((UINT)lpString>0xFFFFu)
if ( HIWORD(lpString) )
{
if (cbCount>8192) cbCount = 8192;
if (fuOptions & ETO_PDY) //win9x can't understand it and messes up other flags
@ -69,19 +282,21 @@ BOOL WINAPI ExtTextOutA_new(
fuOptions = fuOptions & ~ETO_PDY;
if (lpDx) //we have to make array which contains dx values only
{
buffer = (int*)HeapAlloc(GetProcessHeap(),0,cbCount*sizeof(int));
if (!buffer) //you've managed to ruin everything
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
if ( cbCount>128 )
buffer = (int*)HeapAlloc(GetProcessHeap(),0,cbCount*sizeof(int));
else
buffer = (int*)alloca(cbCount*sizeof(int));
if (!buffer)
return FALSE;
}
MakeDxFromDxDy(lpDx,buffer, cbCount);
lpDx = buffer;
}
}
}
result = ExtTextOutA(hdc,X,Y,fuOptions,lprc,lpString,cbCount,lpDx);
if (buffer) HeapFree (GetProcessHeap(),0,buffer);
if ( buffer && cbCount>128 )
HeapFree(GetProcessHeap(),0,buffer);
return result;
}
@ -96,53 +311,46 @@ BOOL WINAPI ExtTextOutW_new(
LPCWSTR lpString, // string
UINT cbCount, // number of characters in string
CONST INT* lpDx // array of spacing values
)
)
{
BOOL result;
BOOL optimized = FALSE;
int* buffer = 0;
char english[128];
int* buffer = NULL;
PDCOBJ dcobj = GetDCObj( hdc );
WORD savemapmode = 0;
if ((UINT)lpString>0xFFFFu)
if ( HIWORD(lpString) )
{
if (cbCount>8192) cbCount = 8192;
if (fuOptions & ETO_PDY)
if (fuOptions & ETO_PDY) //win9x can't understand it and messes up other flags
{
fuOptions = fuOptions & ~ETO_PDY;
if (lpDx)
if (lpDx) //we have to make array which contains dx values only
{
buffer = (int*)HeapAlloc(GetProcessHeap(),0,cbCount*sizeof(int));
if (!buffer)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
if ( cbCount>128 )
buffer = (int*)HeapAlloc(GetProcessHeap(),0,cbCount*sizeof(int));
else
buffer = (int*)alloca(cbCount*sizeof(int));
if (!buffer)
return FALSE;
}
MakeDxFromDxDy(lpDx,buffer,cbCount);
lpDx = buffer;
}
}
//now, common case optimization (English short string)
if (!(fuOptions & ETO_GLYPH_INDEX || cbCount>128 || *lpString>0x7Fu))
{
UINT i;
LPCWSTR uString = lpString;
for (i = 0; i< cbCount; i++)
{
if (*uString>0x7Fu) break; else english[i]=(char)*uString;
uString++;
}
optimized = (i == cbCount);
}
else
optimized = FALSE;
}
if (optimized)
result = ExtTextOutA(hdc,X,Y,fuOptions,lprc,english,cbCount,lpDx);
else
result = ExtTextOutW(hdc,X,Y,fuOptions,lprc,lpString,cbCount,lpDx);
if (buffer) HeapFree (GetProcessHeap(),0,buffer);
if ( dcobj && dcobj->mapmode == MM_TEXT &&
( dcobj->ViewportExtX!=1 || dcobj->ViewportExtY!=1
|| dcobj->WindowExtX!=1 || dcobj->WindowExtY!=1) )
{
savemapmode = dcobj->mapmode;
dcobj->mapmode = MM_ANISOTROPIC;
}
result = ExtTextOutW(hdc,X,Y,fuOptions,lprc,lpString,cbCount,lpDx);
if ( savemapmode )
dcobj->mapmode = savemapmode;
if ( buffer && cbCount>128 )
HeapFree(GetProcessHeap(),0,buffer);
return result;
}
@ -173,58 +381,3 @@ BOOL WINAPI PolyTextOutW_new( HDC hdc, const POLYTEXTW *pptxt, INT cStrings )
return FALSE;
return TRUE;
}
/* MAKE_EXPORT GetFontUnicodeRanges_new=GetFontUnicodeRanges */
DWORD WINAPI GetFontUnicodeRanges_new(
HDC hdc,
LPGLYPHSET lpgs
)
{
SetLastError(ERROR_NOT_SUPPORTED);
return 0;
}
/* On 9x fallback to system function */
/* MAKE_EXPORT SetGraphicsMode_NT=SetGraphicsMode */
int WINAPI SetGraphicsMode_NT(
HDC hdc, // handle to device context
int iMode // graphics mode
)
{
return GM_COMPATIBLE;
}
/* MAKE_EXPORT SetWorldTransform_9x=SetWorldTransform */
BOOL WINAPI SetWorldTransform_9x(
HDC hdc, // handle to device context
CONST XFORM *lpXform // transformation data
)
{
return FALSE;
}
/* MAKE_EXPORT SetWorldTransform_NT=SetWorldTransform */
BOOL WINAPI SetWorldTransform_NT(
HDC hdc, // handle to device context
CONST XFORM *lpXform // transformation data
)
{
return TRUE;
}
/* MAKE_EXPORT GetRandomRgn_NT=GetRandomRgn */
int WINAPI GetRandomRgn_NT(
HDC hdc, // handle to DC
HRGN hrgn, // handle to region
INT iNum // must be SYSRGN
)
{
int result = GetRandomRgn(hdc,hrgn,iNum);
if (result)
{
POINT pt;
GetDCOrgEx(hdc,&pt);
OffsetRgn(hrgn,pt.x,pt.y);
}
return result;
}

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

@ -40,6 +40,8 @@ static const apilib_named_api gdi32_named_apis[] =
DECL_API("AddFontResourceExA", AddFontResourceExA_new),
DECL_API("AddFontResourceExW", AddFontResourceExW_new),
DECL_API("AddFontResourceW", AddFontResourceW_new),
DECL_API("EnumFontFamiliesExW", EnumFontFamiliesExW_new),
DECL_API("EnumFontFamiliesW", EnumFontFamiliesW_new),
DECL_API("ExtTextOutA", ExtTextOutA_new),
DECL_API("ExtTextOutW", ExtTextOutW_new),
DECL_API("GetCharWidth32A", GetCharWidthA),
@ -47,6 +49,9 @@ static const apilib_named_api gdi32_named_apis[] =
DECL_API("GetFontUnicodeRanges", GetFontUnicodeRanges_new),
DECL_API("GetGlyphOutlineA", GetGlyphOutlineA_fix),
DECL_API("GetRandomRgn", GetRandomRgn_NT),
DECL_API("GetTextMetricsA", GetTextMetricsA_NT),
DECL_API("GetWorldTransform", GetWorldTransform_NT),
DECL_API("ModifyWorldTransform", ModifyWorldTransform_NT),
DECL_API("PolyTextOutA", PolyTextOutA_new),
DECL_API("PolyTextOutW", PolyTextOutW_new),
DECL_API("RemoveFontMemResourceEx", RemoveFontMemResourceEx_stub),
@ -56,6 +61,7 @@ static const apilib_named_api gdi32_named_apis[] =
DECL_API("SetDCBrushColor", SetDCBrushColor_stub),
DECL_API("SetDCPenColor", SetDCPenColor_stub),
DECL_API("SetGraphicsMode", SetGraphicsMode_NT),
DECL_API("SetMapMode", SetMapMode_NT),
DECL_API("SetWorldTransform", SetWorldTransform_9x),
DECL_API("SetWorldTransform", SetWorldTransform_NT),
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/

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

@ -22,7 +22,6 @@
#ifndef _GDI32_APILIST_H
#define _GDI32_APILIST_H
#include "auxdecl.h"
#include "kexcoresdk.h"
BOOL init_gdi32();
@ -32,21 +31,27 @@ extern const apilib_api_table apitable_gdi32;
INT WINAPI AddFontResourceExA_new(LPCSTR str, DWORD fl, PVOID pdv);
BOOL WINAPI RemoveFontResourceExA_new(LPCSTR str, DWORD fl, PVOID pdv);
DWORD WINAPI GetGlyphOutlineA_fix(HDC hdc, UINT uChar, UINT uFormat, LPGLYPHMETRICS lpgm, DWORD cbBuffer, LPVOID lpvBuffer, CONST MAT2 *lpmat2);
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);
int WINAPI GetRandomRgn_NT(HDC hdc, HRGN hrgn, INT iNum);
BOOL WINAPI SetWorldTransform_NT(HDC hdc, CONST XFORM *lpXform);
int WINAPI SetMapMode_NT(HDC hdc, int fnMapMode);
BOOL WINAPI GetTextMetricsA_NT(HDC hdc, LPTEXTMETRIC lptm);
BOOL WINAPI GetWorldTransform_NT(HDC hdc, LPXFORM lpXform);
BOOL WINAPI ModifyWorldTransform_NT(HDC hdc, CONST XFORM *lpXform, DWORD iMode);
BOOL WINAPI ExtTextOutA_new(HDC hdc, int X, int Y, UINT fuOptions, CONST RECT* lprc, LPCSTR lpString, UINT cbCount, CONST INT* lpDx);
BOOL WINAPI ExtTextOutW_new(HDC hdc, int X, int Y, UINT fuOptions, CONST RECT* lprc, LPCWSTR lpString, UINT cbCount, CONST INT* lpDx);
BOOL WINAPI PolyTextOutA_new(HDC hdc, const POLYTEXTA *pptxt, INT cStrings);
BOOL WINAPI PolyTextOutW_new(HDC hdc, const POLYTEXTW *pptxt, INT cStrings);
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);
BOOL WINAPI SetWorldTransform_NT(HDC hdc, CONST XFORM *lpXform);
int WINAPI GetRandomRgn_NT(HDC hdc, HRGN hrgn, INT iNum);
STUB SetDCBrushColor_stub;
STUB SetDCPenColor_stub;
STUB AddFontMemResourceEx_stub;
STUB RemoveFontMemResourceEx_stub;
INT WINAPI AddFontResourceExW_new(LPCWSTR strW, DWORD fl, PVOID pdv);
INT WINAPI AddFontResourceW_new(LPCWSTR strW);
int WINAPI EnumFontFamiliesExW_new(HDC hdc, LPLOGFONTW pLogfontW, FONTENUMPROCW pEnumFontFamExProc, LPARAM lParam, DWORD dwFlags);
int WINAPI EnumFontFamiliesW_new(HDC hdc, LPCWSTR lpszFamily, FONTENUMPROCW lpEnumFontFamProc, LPARAM lParam);
BOOL WINAPI RemoveFontResourceExW_new(LPCWSTR strW, DWORD fl, PVOID pdv);
BOOL WINAPI RemoveFontResourceW_new(LPCWSTR strW);
/*** AUTOGENERATED APILIST DECLARATIONS END ***/

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

View File

@ -0,0 +1,59 @@
/*
* KernelEx
*
* Copyright (C) 2009, 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 __GDI9X_H
#define __GDI9X_H
#define LHE_DISCARDED 0x40
#define LHE_FREEHANDLE 0xFF
#define GDI_OBJTYPE_MASK 0x5FFF
#define GDI_OBJTYPE_DC 0x4F4D
#define GDI_OBJTYPE_DC_NO 0x4F4E
#define ResetMapMode( hdc ) SetMapMode( hdc, GetMapMode(hdc) )
#pragma pack(push,1)
typedef struct
{
WORD wBlock;
BYTE bFlags;
BYTE bLocks;
} LHENTRY, *PLHENTRY;
typedef struct
{
WORD wZero; //+0
WORD wType; //+2
BYTE filler[0x80]; //+4
WORD WindowExtX; //+84
WORD WindowExtY; //+86
BYTE filler2[4]; //+88
WORD ViewportExtX; //+8C
WORD ViewportExtY; //+8E
BYTE filler3[4]; //+90
WORD mapmode; //+94
} DCOBJ, *PDCOBJ;
#pragma pack(pop)
#endif

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

@ -21,6 +21,14 @@
#include "common.h"
#include "_gdi32_apilist.h"
#include "../kernel32/_kernel32_apilist.h"
typedef struct
{
FONTENUMPROCW EnumProcW;
LPARAM lParam;
} EnumFamilies_t;
//MAKE_EXPORT AddFontResourceExW_new=AddFontResourceExW
INT WINAPI AddFontResourceExW_new(LPCWSTR strW, DWORD fl, PVOID pdv)
@ -38,6 +46,110 @@ INT WINAPI AddFontResourceW_new(LPCWSTR strW)
return AddFontResourceA(strA);
}
static int CALLBACK EnumFontFamExConv(const LOGFONTA *plfA,
const TEXTMETRICA* ptmA, DWORD FontType, LPARAM lParam)
{
const ENUMLOGFONTEXA* fontA = (const ENUMLOGFONTEXA*) plfA;
const NEWTEXTMETRICEXA* tmA = (const NEWTEXTMETRICEXA*) ptmA;
ENUMLOGFONTEXW elfeW;
NEWTEXTMETRICEXW ntmeW;
ENUMLOGFONTEXW* fontW = &elfeW;
NEWTEXTMETRICEXW* tmW = &ntmeW;
EnumFamilies_t* pef = (EnumFamilies_t*) lParam;
memcpy(&fontW->elfLogFont, &fontA->elfLogFont, sizeof(LOGFONTA) - LF_FACESIZE);
MultiByteToWideChar(CP_ACP, 0, (LPCSTR) fontA->elfLogFont.lfFaceName, -1,
fontW->elfLogFont.lfFaceName, LF_FACESIZE);
fontW->elfLogFont.lfFaceName[LF_FACESIZE - 1] = 0;
MultiByteToWideChar(CP_ACP, 0, (LPCSTR) fontA->elfFullName, -1,
fontW->elfFullName, LF_FULLFACESIZE);
fontW->elfFullName[LF_FULLFACESIZE - 1] = 0;
MultiByteToWideChar(CP_ACP, 0, (LPCSTR) fontA->elfStyle, -1,
fontW->elfStyle, LF_FACESIZE);
fontW->elfStyle[LF_FACESIZE - 1] = 0;
MultiByteToWideChar(CP_ACP, 0, (LPCSTR) fontA->elfScript, -1,
fontW->elfScript, LF_FACESIZE);
fontW->elfScript[LF_FACESIZE - 1] = 0;
tmW->ntmTm.tmHeight = tmA->ntmTm.tmHeight;
tmW->ntmTm.tmAscent = tmA->ntmTm.tmAscent;
tmW->ntmTm.tmDescent = tmA->ntmTm.tmDescent;
tmW->ntmTm.tmInternalLeading = tmA->ntmTm.tmInternalLeading;
tmW->ntmTm.tmExternalLeading = tmA->ntmTm.tmExternalLeading;
tmW->ntmTm.tmAveCharWidth = tmA->ntmTm.tmAveCharWidth;
tmW->ntmTm.tmMaxCharWidth = tmA->ntmTm.tmMaxCharWidth;
tmW->ntmTm.tmWeight = tmA->ntmTm.tmWeight;
tmW->ntmTm.tmOverhang = tmA->ntmTm.tmOverhang;
tmW->ntmTm.tmDigitizedAspectX = tmA->ntmTm.tmDigitizedAspectX;
tmW->ntmTm.tmDigitizedAspectY = tmA->ntmTm.tmDigitizedAspectY;
tmW->ntmTm.tmItalic = tmA->ntmTm.tmItalic;
tmW->ntmTm.tmUnderlined = tmA->ntmTm.tmUnderlined;
tmW->ntmTm.tmStruckOut = tmA->ntmTm.tmStruckOut;
tmW->ntmTm.tmPitchAndFamily = tmA->ntmTm.tmPitchAndFamily;
tmW->ntmTm.tmCharSet = tmA->ntmTm.tmCharSet;
//needs review - are this conversions necessary or is it enough to just copy?
#if 1
MultiByteToWideChar(CP_ACP, 0, (LPCSTR) &tmA->ntmTm.tmFirstChar, 1,
&tmW->ntmTm.tmFirstChar, 1);
MultiByteToWideChar(CP_ACP, 0, (LPCSTR) &tmA->ntmTm.tmLastChar, 1,
&tmW->ntmTm.tmLastChar, 1);
MultiByteToWideChar(CP_ACP, 0, (LPCSTR) &tmA->ntmTm.tmDefaultChar, 1,
&tmW->ntmTm.tmDefaultChar, 1);
MultiByteToWideChar(CP_ACP, 0, (LPCSTR) &tmA->ntmTm.tmBreakChar, 1,
&tmW->ntmTm.tmBreakChar, 1);
#else
tmW->ntmTm.tmFirstChar = tmA->ntmTm.tmFirstChar;
tmW->ntmTm.tmLastChar = tmA->ntmTm.tmLastChar;
tmW->ntmTm.tmDefaultChar = tmA->ntmTm.tmDefaultChar;
tmW->ntmTm.tmBreakChar = tmA->ntmTm.tmBreakChar;
#endif
tmW->ntmTm.ntmFlags = tmA->ntmTm.ntmFlags;
tmW->ntmTm.ntmSizeEM = tmA->ntmTm.ntmSizeEM;
tmW->ntmTm.ntmCellHeight = tmA->ntmTm.ntmCellHeight;
tmW->ntmTm.ntmAvgWidth = tmA->ntmTm.ntmAvgWidth;
memcpy(&tmW->ntmFontSig, &tmA->ntmFontSig, sizeof(FONTSIGNATURE));
return pef->EnumProcW((LOGFONTW*) &elfeW, (TEXTMETRICW*) &ntmeW, FontType, pef->lParam);
}
/* MAKE_EXPORT EnumFontFamiliesExW_new=EnumFontFamiliesExW */
int WINAPI EnumFontFamiliesExW_new(HDC hdc, LPLOGFONTW pLogfontW,
FONTENUMPROCW pEnumFontFamExProc, LPARAM lParam, DWORD dwFlags)
{
EnumFamilies_t ef;
LOGFONTA logfont;
memcpy(&logfont, pLogfontW, sizeof(LOGFONTA) - LF_FACESIZE);
WideCharToMultiByte(CP_ACP, 0, pLogfontW->lfFaceName, -1, logfont.lfFaceName,
LF_FACESIZE, NULL, NULL);
logfont.lfFaceName[LF_FACESIZE - 1] = '\0';
ef.EnumProcW = pEnumFontFamExProc;
ef.lParam = lParam;
return EnumFontFamiliesExA(hdc, &logfont, EnumFontFamExConv, (LPARAM) &ef, dwFlags);
}
/* MAKE_EXPORT EnumFontFamiliesW_new=EnumFontFamiliesW */
int WINAPI EnumFontFamiliesW_new(HDC hdc, LPCWSTR lpszFamily,
FONTENUMPROCW lpEnumFontFamProc, LPARAM lParam)
{
LOGFONTW lf;
LOGFONTW* plf = NULL;
if (lpszFamily)
{
if (!*lpszFamily)
return 1;
lstrcpynW_new(lf.lfFaceName, lpszFamily, LF_FACESIZE);
lf.lfCharSet = DEFAULT_CHARSET;
lf.lfPitchAndFamily = 0;
plf = &lf;
}
return EnumFontFamiliesExW_new(hdc, plf, lpEnumFontFamProc, lParam, 0);
}
//MAKE_EXPORT RemoveFontResourceExW_new=RemoveFontResourceExW
BOOL WINAPI RemoveFontResourceExW_new(LPCWSTR strW, DWORD fl, PVOID pdv)
{

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

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

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

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

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

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

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

@ -20,7 +20,6 @@
*/
#include <windows.h>
#include "auxdecl.h"
/* MAKE_EXPORT GlobalMemoryStatusEx_new=GlobalMemoryStatusEx */
BOOL WINAPI GlobalMemoryStatusEx_new(LPMEMORYSTATUSEX lpmemex)

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

View File

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -40,7 +40,7 @@ BOOL init_kernel32()
/*
* MAKE_EXPORT GetWindowsDirectoryA=GetSystemWindowsDirectoryA
* MAKE_EXPORT GetWindowsDirectoryW=GetSystemWindowsDirectoryW
* MAKE_EXPORT GetWindowsDirectoryW_new=GetSystemWindowsDirectoryW
* MAKE_EXPORT GetSystemInfo=GetNativeSystemInfo
* MAKE_EXPORT SetLastError=RestoreLastError
*/
@ -50,6 +50,7 @@ static const apilib_named_api kernel32_named_apis[] =
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
DECL_API("AddAtomW", AddAtomW_new),
DECL_API("AssignProcessToJobObject", AssignProcessToJobObject_new),
DECL_API("CompareStringW", CompareStringW_new),
DECL_API("CopyFileExA", CopyFileExA_new),
DECL_API("CopyFileExW", CopyFileExW_new),
DECL_API("CopyFileW", CopyFileW_new),
@ -74,7 +75,10 @@ static const apilib_named_api kernel32_named_apis[] =
DECL_API("FindNextFileW", FindNextFileW_new),
DECL_API("FindResourceExW", FindResourceExW_new),
DECL_API("FindResourceW", FindResourceW_new),
DECL_API("FoldStringA", FoldStringA_new),
DECL_API("FoldStringW", FoldStringW_new),
DECL_API("FreeEnvironmentStringsW", FreeEnvironmentStringsW_new),
DECL_API("GetAtomNameW", GetAtomNameW_new),
DECL_API("GetConsoleWindow", GetConsoleWindow_new),
DECL_API("GetCurrentDirectoryW", GetCurrentDirectoryW_new),
DECL_API("GetDefaultCommConfigW", GetDefaultCommConfigW_new),
@ -86,13 +90,17 @@ static const apilib_named_api kernel32_named_apis[] =
DECL_API("GetFileSizeEx", GetFileSizeEx_new),
DECL_API("GetFullPathNameW", GetFullPathNameW_new),
DECL_API("GetLongPathNameW", GetLongPathNameW_new),
DECL_API("GetModuleFileNameW", GetModuleFileNameW_new),
DECL_API("GetModuleHandleW", GetModuleHandleW_new),
DECL_API("GetNativeSystemInfo", GetSystemInfo),
DECL_API("GetShortPathNameW", GetShortPathNameW_new),
DECL_API("GetStartupInfoW", GetStartupInfoW_new),
DECL_API("GetStringTypeExW", GetStringTypeExW_new),
DECL_API("GetStringTypeW", GetStringTypeW_new),
DECL_API("GetSystemDefaultUILanguage", GetSystemDefaultUILanguage_new),
DECL_API("GetSystemDirectoryW", GetSystemDirectoryW_new),
DECL_API("GetSystemWindowsDirectoryA", GetWindowsDirectoryA),
DECL_API("GetSystemWindowsDirectoryW", GetWindowsDirectoryW),
DECL_API("GetSystemWindowsDirectoryW", GetWindowsDirectoryW_new),
DECL_API("GetTempFileNameW", GetTempFileNameW_new),
DECL_API("GetTempPathW", GetTempPathW_new),
DECL_API("GetUserDefaultUILanguage", GetUserDefaultUILanguage_new),
@ -125,6 +133,8 @@ static const apilib_named_api kernel32_named_apis[] =
DECL_API("GetVersionExW", GetVersionExW_WIN2K3),
DECL_API("GetVersionExW", GetVersionExW_VISTA),
DECL_API("GetVersionExW", GetVersionExW_WIN2K8),
DECL_API("GetVolumePathNameA", GetVolumePathNameA_new),
DECL_API("GetVolumePathNameW", GetVolumePathNameW_new),
DECL_API("GetWindowsDirectoryW", GetWindowsDirectoryW_new),
DECL_API("GlobalAddAtomW", GlobalAddAtomW_new),
DECL_API("GlobalFindAtomW", GlobalFindAtomW_new),
@ -137,6 +147,9 @@ static const apilib_named_api kernel32_named_apis[] =
DECL_API("IsProcessorFeaturePresent", IsProcessorFeaturePresent_new),
DECL_API("IsValidLanguageGroup", IsValidLanguageGroup_stub),
DECL_API("KEXVersion", KEXVersion),
DECL_API("LCMapStringW", LCMapStringW_new),
DECL_API("LoadLibraryExW", LoadLibraryExW_new),
DECL_API("LoadLibraryW", LoadLibraryW_new),
DECL_API("LockFileEx", LockFileEx_new),
DECL_API("MapViewOfFileEx", MapViewOfFileEx_new),
DECL_API("Module32FirstW", Module32FirstW_new),
@ -146,6 +159,7 @@ static const apilib_named_api kernel32_named_apis[] =
DECL_API("MoveFileW", MoveFileW_new),
DECL_API("MoveFileWithProgressA", MoveFileWithProgressA_new),
DECL_API("MoveFileWithProgressW", MoveFileWithProgressW_new),
DECL_API("MultiByteToWideChar", MultiByteToWideChar_new),
DECL_API("OpenJobObjectA", OpenJobObjectA_new),
DECL_API("OpenJobObjectW", OpenJobObjectW_new),
DECL_API("OpenThread", OpenThread_new),
@ -185,7 +199,10 @@ static const apilib_named_api kernel32_named_apis[] =
DECL_API("VerifyVersionInfoW", VerifyVersionInfoW_WIN2K8),
DECL_API("VirtualAllocEx", VirtualAllocEx_new),
DECL_API("VirtualFreeEx", VirtualFreeEx_new),
DECL_API("WideCharToMultiByte", WideCharToMultiByte_new),
DECL_API("WriteFile", WriteFile_fix),
DECL_API("lstrcmpW", lstrcmpW_new),
DECL_API("lstrcmpiW", lstrcmpiW_new),
DECL_API("lstrcpynW", lstrcpynW_new),
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
};

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

@ -22,7 +22,6 @@
#ifndef _KERNEL32_APILIST_H
#define _KERNEL32_APILIST_H
#include "auxdecl.h"
#include "kexcoresdk.h"
#include <tlhelp32.h>
@ -73,6 +72,14 @@ STUB QueueUserWorkItem_stub;
STUB ReplaceFileA_stub;
STUB ReplaceFileW_stub;
STUB FindFirstFileExW_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);
INT WINAPI LCMapStringW_new(LCID lcid, DWORD flags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen);
INT WINAPI FoldStringW_new(DWORD dwFlags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen);
INT WINAPI FoldStringA_new(DWORD dwFlags, LPCSTR src, INT srclen, LPSTR dst, INT dstlen);
int WINAPI lstrcmpW_new(LPCWSTR str1, LPCWSTR str2);
int WINAPI lstrcmpiW_new(LPCWSTR str1, LPCWSTR str2);
LANGID WINAPI GetUserDefaultUILanguage_new(void);
LANGID WINAPI GetSystemDefaultUILanguage_new(void);
BOOL WINAPI EnumUILanguagesA_new(UILANGUAGE_ENUMPROCA pUILangEnumProc, DWORD dwFlags, LONG_PTR lParam);
@ -92,6 +99,7 @@ BOOL WINAPI FindNextFileW_new(HANDLE handle, LPWIN32_FIND_DATAW dataW);
HRSRC WINAPI FindResourceExW_new(HMODULE hModule, LPCWSTR typeW, LPCWSTR nameW, WORD lang);
HRSRC WINAPI FindResourceW_new(HINSTANCE hModule, LPCWSTR name, LPCWSTR type);
BOOL WINAPI FreeEnvironmentStringsW_new(void* env);
UINT WINAPI GetAtomNameW_new(ATOM atom, LPWSTR bufferW, int size);
DWORD WINAPI GetCurrentDirectoryW_new(DWORD nBufferLength, LPWSTR lpBufferW);
BOOL WINAPI GetDefaultCommConfigW_new(LPCWSTR lpszNameW, LPCOMMCONFIG lpCC, LPDWORD lpdwSize);
BOOL WINAPI GetDiskFreeSpaceExW_new(LPCWSTR lpDirectoryNameW, PULARGE_INTEGER lpFreeBytesAvailableToCaller, PULARGE_INTEGER lpTotalNumberOfBytes, PULARGE_INTEGER lpTotalNumberOfFreeBytes);
@ -101,6 +109,8 @@ BOOL WINAPI GetFileAttributesExW_new(LPCWSTR lpFileNameW, GET_FILEEX_INFO_LEVELS
DWORD WINAPI GetFileAttributesW_new(LPCWSTR lpFileNameW);
DWORD WINAPI GetFullPathNameW_new(LPCWSTR lpFileNameW, DWORD nBufferLength, LPWSTR lpBufferW, LPWSTR *lpFilePartW);
DWORD WINAPI GetLongPathNameW_new(LPCWSTR lpszShortPathW, LPWSTR lpszLongPathW, DWORD cchBuffer);
DWORD WINAPI GetModuleFileNameW_new(HMODULE hModule, LPWSTR lpFilenameW, DWORD nSize);
HMODULE WINAPI GetModuleHandleW_new(LPCWSTR lpModuleNameW);
DWORD WINAPI GetShortPathNameW_new(LPCWSTR lpszLongPathW, LPWSTR lpszShortPathW, DWORD cchBuffer);
VOID WINAPI GetStartupInfoW_new(LPSTARTUPINFOW lpStartupInfo);
UINT WINAPI GetSystemDirectoryW_new(LPWSTR lpBufferW, UINT uSize);
@ -110,6 +120,8 @@ UINT WINAPI GetWindowsDirectoryW_new(LPWSTR lpBufferW, UINT uSize);
ATOM WINAPI GlobalAddAtomW_new(LPCWSTR strW);
ATOM WINAPI GlobalFindAtomW_new(LPCWSTR strW);
UINT WINAPI GlobalGetAtomNameW_new(ATOM atom, LPWSTR bufferW, int size);
HINSTANCE WINAPI LoadLibraryW_new(LPCWSTR lpLibFileNameW);
HINSTANCE WINAPI LoadLibraryExW_new(LPCWSTR lpLibFileNameW, HANDLE hFile, DWORD dwFlags);
BOOL WINAPI Module32FirstW_new(HANDLE hSnapshot, LPMODULEENTRY32W lpmeW);
BOOL WINAPI Module32NextW_new(HANDLE hSnapshot, LPMODULEENTRY32W lpmeW);
BOOL WINAPI MoveFileExW_new(LPCWSTR existingfileW, LPCWSTR newfileW, DWORD flags);
@ -165,6 +177,10 @@ BOOL WINAPI VerifyVersionInfoA_VISTA(LPOSVERSIONINFOEXA lpVersionInfo, DWORD dwT
BOOL WINAPI VerifyVersionInfoW_VISTA(LPOSVERSIONINFOEXW lpVersionInfo, DWORD dwTypeMask, DWORDLONG dwlConditionMask);
BOOL WINAPI VerifyVersionInfoA_WIN2K8(LPOSVERSIONINFOEXA lpVersionInfo, DWORD dwTypeMask, DWORDLONG dwlConditionMask);
BOOL WINAPI VerifyVersionInfoW_WIN2K8(LPOSVERSIONINFOEXW lpVersionInfo, DWORD dwTypeMask, DWORDLONG dwlConditionMask);
BOOL WINAPI GetVolumePathNameA_new(LPCSTR filename, LPSTR volumepathname, DWORD buflen);
BOOL WINAPI GetVolumePathNameW_new(LPCWSTR filenameW, LPWSTR volumepathnameW, DWORD buflen);
int WINAPI WideCharToMultiByte_new(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, LPSTR lpMultiByteStr, int cchMultiByte, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar);
int WINAPI MultiByteToWideChar_new(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cchMultiByte, LPWSTR lpWideCharStr, int cchWideChar);
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
#endif

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

View File

@ -0,0 +1,445 @@
/*
* Locale support
*
* Copyright 1995 Martin von Loewis
* Copyright 1998 David Lee Lambert
* Copyright 2000 Julio C<>sar G<>zquez
* Copyright 2002 Alexandre Julliard for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <windows.h>
#include "locale_unicode.h"
#ifdef _MSC_VER
#pragma warning(disable:4002)
#define TRACE() ((void)0)
#define TRACE_() ((void)0)
#define WARN() ((void)0)
#else
#define TRACE(...) do {} while(0)
#define TRACE_(x) TRACE
#define WARN(...) do {} while(0)
#endif
/******************************************************************************
* CompareStringW (KERNEL32.@)
*
* See CompareStringA.
*/
/* MAKE_EXPORT CompareStringW_new=CompareStringW */
INT WINAPI CompareStringW_new(LCID lcid, DWORD style,
LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
{
INT ret;
if (!str1 || !str2)
{
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
if( style & ~(NORM_IGNORECASE|NORM_IGNORENONSPACE|NORM_IGNORESYMBOLS|
SORT_STRINGSORT|NORM_IGNOREKANATYPE|NORM_IGNOREWIDTH|LOCALE_USE_CP_ACP|0x10000000) )
{
SetLastError(ERROR_INVALID_FLAGS);
return 0;
}
/* this style is related to diacritics in Arabic, Japanese, and Hebrew */
if (style & 0x10000000)
WARN("Ignoring unknown style 0x10000000\n");
if (len1 < 0) len1 = strlenW(str1);
if (len2 < 0) len2 = strlenW(str2);
ret = wine_compare_string(style, str1, len1, str2, len2);
if (ret) /* need to translate result */
return (ret < 0) ? CSTR_LESS_THAN : CSTR_GREATER_THAN;
return CSTR_EQUAL;
}
/******************************************************************************
* GetStringTypeW (KERNEL32.@)
*
* See GetStringTypeA.
*/
/* MAKE_EXPORT GetStringTypeW_new=GetStringTypeW */
BOOL WINAPI GetStringTypeW_new( DWORD type, LPCWSTR src, INT count, LPWORD chartype )
{
if (count == -1) count = strlenW(src) + 1;
switch(type)
{
case CT_CTYPE1:
while (count--) *chartype++ = get_char_typeW( *src++ ) & 0xfff;
break;
case CT_CTYPE2:
while (count--) *chartype++ = get_char_typeW( *src++ ) >> 12;
break;
case CT_CTYPE3:
{
#if 0
WARN("CT_CTYPE3: semi-stub.\n");
while (count--)
{
int c = *src;
WORD type1, type3 = 0; /* C3_NOTAPPLICABLE */
type1 = get_char_typeW( *src++ ) & 0xfff;
/* try to construct type3 from type1 */
if(type1 & C1_SPACE) type3 |= C3_SYMBOL;
if(type1 & C1_ALPHA) type3 |= C3_ALPHA;
if ((c>=0x30A0)&&(c<=0x30FF)) type3 |= C3_KATAKANA;
if ((c>=0x3040)&&(c<=0x309F)) type3 |= C3_HIRAGANA;
if ((c>=0x4E00)&&(c<=0x9FAF)) type3 |= C3_IDEOGRAPH;
if ((c>=0x0600)&&(c<=0x06FF)) type3 |= C3_KASHIDA;
if ((c>=0x3000)&&(c<=0x303F)) type3 |= C3_SYMBOL;
if ((c>=0xFF00)&&(c<=0xFF60)) type3 |= C3_FULLWIDTH;
if ((c>=0xFF00)&&(c<=0xFF20)) type3 |= C3_SYMBOL;
if ((c>=0xFF3B)&&(c<=0xFF40)) type3 |= C3_SYMBOL;
if ((c>=0xFF5B)&&(c<=0xFF60)) type3 |= C3_SYMBOL;
if ((c>=0xFF21)&&(c<=0xFF3A)) type3 |= C3_ALPHA;
if ((c>=0xFF41)&&(c<=0xFF5A)) type3 |= C3_ALPHA;
if ((c>=0xFFE0)&&(c<=0xFFE6)) type3 |= C3_FULLWIDTH;
if ((c>=0xFFE0)&&(c<=0xFFE6)) type3 |= C3_SYMBOL;
if ((c>=0xFF61)&&(c<=0xFFDC)) type3 |= C3_HALFWIDTH;
if ((c>=0xFF61)&&(c<=0xFF64)) type3 |= C3_SYMBOL;
if ((c>=0xFF65)&&(c<=0xFF9F)) type3 |= C3_KATAKANA;
if ((c>=0xFF65)&&(c<=0xFF9F)) type3 |= C3_ALPHA;
if ((c>=0xFFE8)&&(c<=0xFFEE)) type3 |= C3_HALFWIDTH;
if ((c>=0xFFE8)&&(c<=0xFFEE)) type3 |= C3_SYMBOL;
*chartype++ = type3;
}
break;
#else
//use implementation from SHLWAPI - ordinal 35
HMODULE hShlwapi = GetModuleHandle("SHLWAPI.DLL");
BOOL (WINAPI *GetStringType3ExW)(LPCWSTR, INT, LPWORD);
if (!hShlwapi)
hShlwapi = LoadLibrary("SHLWAPI.DLL");
if (!hShlwapi)
{
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}
GetStringType3ExW = (BOOL (WINAPI*)(LPCWSTR, INT, LPWORD))
GetProcAddress(hShlwapi, (LPSTR) 35);
return GetStringType3ExW(src, count, chartype);
#endif
}
default:
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}
return TRUE;
}
/******************************************************************************
* GetStringTypeExW (KERNEL32.@)
*
* See GetStringTypeExA.
*/
/* MAKE_EXPORT GetStringTypeExW_new=GetStringTypeExW */
BOOL WINAPI GetStringTypeExW_new( LCID locale, DWORD type, LPCWSTR src, INT count, LPWORD chartype )
{
/* locale is ignored for Unicode */
return GetStringTypeW_new( type, src, count, chartype );
}
/*************************************************************************
* LCMapStringW (KERNEL32.@)
*
* See LCMapStringA.
*/
/* MAKE_EXPORT LCMapStringW_new=LCMapStringW */
INT WINAPI LCMapStringW_new(LCID lcid, DWORD flags, LPCWSTR src, INT srclen,
LPWSTR dst, INT dstlen)
{
LPWSTR dst_ptr;
if (!src || !srclen || dstlen < 0)
{
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
/* mutually exclusive flags */
if ((flags & (LCMAP_LOWERCASE | LCMAP_UPPERCASE)) == (LCMAP_LOWERCASE | LCMAP_UPPERCASE) ||
(flags & (LCMAP_HIRAGANA | LCMAP_KATAKANA)) == (LCMAP_HIRAGANA | LCMAP_KATAKANA) ||
(flags & (LCMAP_HALFWIDTH | LCMAP_FULLWIDTH)) == (LCMAP_HALFWIDTH | LCMAP_FULLWIDTH) ||
(flags & (LCMAP_TRADITIONAL_CHINESE | LCMAP_SIMPLIFIED_CHINESE)) == (LCMAP_TRADITIONAL_CHINESE | LCMAP_SIMPLIFIED_CHINESE))
{
SetLastError(ERROR_INVALID_FLAGS);
return 0;
}
if (!dstlen) dst = NULL;
lcid = ConvertDefaultLocale(lcid);
if (flags & LCMAP_SORTKEY)
{
INT ret;
if (src == dst)
{
SetLastError(ERROR_INVALID_FLAGS);
return 0;
}
if (srclen < 0) srclen = strlenW(src);
TRACE("(0x%04x,0x%08x,%s,%d,%p,%d)\n",
lcid, flags, debugstr_wn(src, srclen), srclen, dst, dstlen);
ret = wine_get_sortkey(flags, src, srclen, (BYTE *)dst, dstlen);
if (ret == 0)
SetLastError(ERROR_INSUFFICIENT_BUFFER);
else
ret++;
return ret;
}
/* SORT_STRINGSORT must be used exclusively with LCMAP_SORTKEY */
if (flags & SORT_STRINGSORT)
{
SetLastError(ERROR_INVALID_FLAGS);
return 0;
}
if (srclen < 0) srclen = strlenW(src) + 1;
TRACE("(0x%04x,0x%08x,%s,%d,%p,%d)\n",
lcid, flags, debugstr_wn(src, srclen), srclen, dst, dstlen);
if (!dst) /* return required string length */
{
INT len;
for (len = 0; srclen; src++, srclen--)
{
WCHAR wch = *src;
/* tests show that win2k just ignores NORM_IGNORENONSPACE,
* and skips white space and punctuation characters for
* NORM_IGNORESYMBOLS.
*/
if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE)))
continue;
len++;
}
return len;
}
if (flags & LCMAP_UPPERCASE)
{
for (dst_ptr = dst; srclen && dstlen; src++, srclen--)
{
WCHAR wch = *src;
if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE)))
continue;
*dst_ptr++ = toupperW(wch);
dstlen--;
}
}
else if (flags & LCMAP_LOWERCASE)
{
for (dst_ptr = dst; srclen && dstlen; src++, srclen--)
{
WCHAR wch = *src;
if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE)))
continue;
*dst_ptr++ = tolowerW(wch);
dstlen--;
}
}
else
{
if (src == dst)
{
SetLastError(ERROR_INVALID_FLAGS);
return 0;
}
for (dst_ptr = dst; srclen && dstlen; src++, srclen--)
{
WCHAR wch = *src;
if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE)))
continue;
*dst_ptr++ = wch;
dstlen--;
}
}
if (srclen)
{
SetLastError(ERROR_INSUFFICIENT_BUFFER);
return 0;
}
return dst_ptr - dst;
}
/*************************************************************************
* FoldStringW (KERNEL32.@)
*
* See FoldStringA.
*/
/* MAKE_EXPORT FoldStringW_new=FoldStringW */
INT WINAPI FoldStringW_new(DWORD dwFlags, LPCWSTR src, INT srclen,
LPWSTR dst, INT dstlen)
{
int ret;
switch (dwFlags & (MAP_COMPOSITE|MAP_PRECOMPOSED|MAP_EXPAND_LIGATURES))
{
case 0:
if (dwFlags)
break;
/* Fall through for dwFlags == 0 */
case MAP_PRECOMPOSED|MAP_COMPOSITE:
case MAP_PRECOMPOSED|MAP_EXPAND_LIGATURES:
case MAP_COMPOSITE|MAP_EXPAND_LIGATURES:
SetLastError(ERROR_INVALID_FLAGS);
return 0;
}
if (!src || !srclen || dstlen < 0 || (dstlen && !dst) || src == dst)
{
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
ret = wine_fold_string(dwFlags, src, srclen, dst, dstlen);
if (!ret)
SetLastError(ERROR_INSUFFICIENT_BUFFER);
return ret;
}
/*************************************************************************
* FoldStringA (KERNEL32.@)
*
* Map characters in a string.
*
* PARAMS
* dwFlags [I] Flags controlling chars to map (MAP_ constants from "winnls.h")
* src [I] String to map
* srclen [I] Length of src, or -1 if src is NUL terminated
* dst [O] Destination for mapped string
* dstlen [I] Length of dst, or 0 to find the required length for the mapped string
*
* RETURNS
* Success: The length of the string written to dst, including the terminating NUL. If
* dstlen is 0, the value returned is the same, but nothing is written to dst,
* and dst may be NULL.
* Failure: 0. Use GetLastError() to determine the cause.
*/
/* MAKE_EXPORT FoldStringA_new=FoldStringA */
INT WINAPI FoldStringA_new(DWORD dwFlags, LPCSTR src, INT srclen,
LPSTR dst, INT dstlen)
{
INT ret = 0, srclenW = 0;
WCHAR *srcW = NULL, *dstW = NULL;
if (!src || !srclen || dstlen < 0 || (dstlen && !dst) || src == dst)
{
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
srclenW = MultiByteToWideChar(CP_ACP, dwFlags & MAP_COMPOSITE ? MB_COMPOSITE : 0,
src, srclen, NULL, 0);
srcW = (WCHAR*) HeapAlloc(GetProcessHeap(), 0, srclenW * sizeof(WCHAR));
if (!srcW)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
goto FoldStringA_exit;
}
MultiByteToWideChar(CP_ACP, dwFlags & MAP_COMPOSITE ? MB_COMPOSITE : 0,
src, srclen, srcW, srclenW);
dwFlags = (dwFlags & ~MAP_PRECOMPOSED) | MAP_FOLDCZONE;
ret = FoldStringW_new(dwFlags, srcW, srclenW, NULL, 0);
if (ret && dstlen)
{
dstW = (WCHAR*) HeapAlloc(GetProcessHeap(), 0, ret * sizeof(WCHAR));
if (!dstW)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
goto FoldStringA_exit;
}
ret = FoldStringW_new(dwFlags, srcW, srclenW, dstW, ret);
if (!WideCharToMultiByte(CP_ACP, 0, dstW, ret, dst, dstlen, NULL, NULL))
{
ret = 0;
SetLastError(ERROR_INSUFFICIENT_BUFFER);
}
}
HeapFree(GetProcessHeap(), 0, dstW);
FoldStringA_exit:
HeapFree(GetProcessHeap(), 0, srcW);
return ret;
}
/*************************************************************************
* lstrcmpW (KERNEL32.@)
*
* See lstrcmpA.
*/
/* MAKE_EXPORT lstrcmpW_new=lstrcmpW */
int WINAPI lstrcmpW_new(LPCWSTR str1, LPCWSTR str2)
{
int ret;
if ((str1 == NULL) && (str2 == NULL)) return 0;
if (str1 == NULL) return -1;
if (str2 == NULL) return 1;
ret = CompareStringW_new(GetThreadLocale(), 0, str1, -1, str2, -1);
if (ret) ret -= 2;
return ret;
}
/*************************************************************************
* lstrcmpiW (KERNEL32.@)
*
* See lstrcmpiA.
*/
/* MAKE_EXPORT lstrcmpiW_new=lstrcmpiW */
int WINAPI lstrcmpiW_new(LPCWSTR str1, LPCWSTR str2)
{
int ret;
if ((str1 == NULL) && (str2 == NULL)) return 0;
if (str1 == NULL) return -1;
if (str2 == NULL) return 1;
ret = CompareStringW_new(GetThreadLocale(), NORM_IGNORECASE, str1, -1, str2, -1);
if (ret) ret -= 2;
return ret;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,198 @@
/*
* String folding
*
* Copyright 2003 Jon Griffiths
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "locale_unicode.h"
static inline WCHAR to_unicode_digit( WCHAR ch )
{
extern const WCHAR wine_digitmap[];
return ch + wine_digitmap[wine_digitmap[ch >> 8] + (ch & 0xff)];
}
static inline WCHAR to_unicode_native( WCHAR ch )
{
extern const WCHAR wine_compatmap[];
return ch + wine_compatmap[wine_compatmap[ch >> 8] + (ch & 0xff)];
}
static const WCHAR wine_ligatures[] =
{
0x00c6, 0x00de, 0x00df, 0x00e6, 0x00fe, 0x0132, 0x0133, 0x0152,
0x0153, 0x01c4, 0x01c5, 0x01c6, 0x01c7, 0x01c8, 0x01c9, 0x01ca,
0x01cb, 0x01cc, 0x01e2, 0x01e3, 0x01f1, 0x01f2, 0x01f3, 0x01fc,
0x01fd, 0x05f0, 0x05f1, 0x05f2, 0xfb00, 0xfb01, 0xfb02, 0xfb03,
0xfb04, 0xfb05, 0xfb06
};
/* Unicode expanded ligatures */
static const WCHAR wine_expanded_ligatures[][4] =
{
{ 'A','E','\0',1 },
{ 'T','H','\0',1 },
{ 's','s','\0',1 },
{ 'a','e','\0',1 },
{ 't','h','\0',1 },
{ 'I','J','\0',1 },
{ 'i','j','\0',1 },
{ 'O','E','\0',1 },
{ 'o','e','\0',1 },
{ 'D',0x017d,'\0',1 },
{ 'D',0x017e,'\0',1 },
{ 'd',0x017e,'\0',1 },
{ 'L','J','\0',1 },
{ 'L','j','\0',1 },
{ 'l','j','\0',1 },
{ 'N','J','\0',1 },
{ 'N','j','\0',1 },
{ 'n','j','\0',1 },
{ 0x0100,0x0112,'\0',1 },
{ 0x0101,0x0113,'\0',1 },
{ 'D','Z','\0',1 },
{ 'D','z','\0',1 },
{ 'd','z','\0',1 },
{ 0x00c1,0x00c9,'\0',1 },
{ 0x00e1,0x00e9,'\0',1 },
{ 0x05d5,0x05d5,'\0',1 },
{ 0x05d5,0x05d9,'\0',1 },
{ 0x05d9,0x05d9,'\0',1 },
{ 'f','f','\0',1 },
{ 'f','i','\0',1 },
{ 'f','l','\0',1 },
{ 'f','f','i',2 },
{ 'f','f','l',2 },
{ 0x017f,'t','\0',1 },
{ 's','t','\0',1 }
};
static inline int get_ligature_len( WCHAR wc )
{
int low = 0, high = sizeof(wine_ligatures)/sizeof(WCHAR) -1;
while (low <= high)
{
int pos = (low + high) / 2;
if (wine_ligatures[pos] < wc)
low = pos + 1;
else if (wine_ligatures[pos] > wc)
high = pos - 1;
else
return wine_expanded_ligatures[pos][3];
}
return 0;
}
static inline const WCHAR* get_ligature( WCHAR wc )
{
static const WCHAR empty_ligature[] = { '\0','\0','\0', 0 };
int low = 0, high = sizeof(wine_ligatures)/sizeof(WCHAR) -1;
while (low <= high)
{
int pos = (low + high) / 2;
if (wine_ligatures[pos] < wc)
low = pos + 1;
else if (wine_ligatures[pos] > wc)
high = pos - 1;
else
return wine_expanded_ligatures[pos];
}
return empty_ligature;
}
/* fold a unicode string */
int wine_fold_string( int flags, const WCHAR *src, int srclen, WCHAR *dst, int dstlen )
{
WCHAR *dstbase = dst;
const WCHAR *expand;
int i;
if (srclen == -1)
srclen = strlenW(src) + 1; /* Include terminating NUL in count */
if (!dstlen)
{
/* Calculate the required size for dst */
dstlen = srclen;
if (flags & MAP_EXPAND_LIGATURES)
{
while (srclen--)
{
dstlen += get_ligature_len(*src);
src++;
}
}
else if (flags & MAP_COMPOSITE)
{
/* FIXME */
}
else if (flags & MAP_PRECOMPOSED)
{
/* FIXME */
}
return dstlen;
}
if (srclen > dstlen)
return 0;
dstlen -= srclen;
/* Actually perform the mapping(s) specified */
for (i = 0; i < srclen; i++)
{
WCHAR ch = *src;
if (flags & MAP_EXPAND_LIGATURES)
{
expand = get_ligature(ch);
if (expand[0])
{
if (!dstlen--)
return 0;
dst[0] = expand[0];
if (expand[2])
{
if (!dstlen--)
return 0;
*++dst = expand[1];
ch = expand[2];
}
else
ch = expand[1];
dst++;
}
}
else if (flags & MAP_COMPOSITE)
{
/* FIXME */
}
else if (flags & MAP_PRECOMPOSED)
{
/* FIXME */
}
if (flags & MAP_FOLDDIGITS)
ch = to_unicode_digit(ch);
if (flags & MAP_FOLDCZONE)
ch = to_unicode_native(ch);
*dst++ = ch;
src++;
}
return dst - dstbase;
}

View File

@ -0,0 +1,350 @@
/*
* Unicode sort key generation
*
* Copyright 2003 Dmitry Timoshkov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "locale_unicode.h"
extern int get_decomposition(WCHAR src, WCHAR *dst, unsigned int dstlen);
extern const unsigned int collation_table[];
/*
* flags - normalization NORM_* flags
*
* FIXME: 'variable' flag not handled
*/
int wine_get_sortkey(int flags, const WCHAR *src, int srclen, BYTE *dst, int dstlen)
{
WCHAR dummy[4]; /* no decomposition is larger than 4 chars */
int key_len[4];
BYTE *key_ptr[4];
const WCHAR *src_save = src;
int srclen_save = srclen;
key_len[0] = key_len[1] = key_len[2] = key_len[3] = 0;
for (; srclen; srclen--, src++)
{
int decomposed_len = 1;/*get_decomposition(*src, dummy, 4);*/
dummy[0] = *src;
if (decomposed_len)
{
int i;
for (i = 0; i < decomposed_len; i++)
{
WCHAR wch = dummy[i];
unsigned int ce;
/* tests show that win2k just ignores NORM_IGNORENONSPACE,
* and skips white space and punctuation characters for
* NORM_IGNORESYMBOLS.
*/
if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE)))
continue;
if (flags & NORM_IGNORECASE) wch = tolowerW(wch);
ce = collation_table[collation_table[wch >> 8] + (wch & 0xff)];
if (ce != (unsigned int)-1)
{
if (ce >> 16) key_len[0] += 2;
if ((ce >> 8) & 0xff) key_len[1]++;
if ((ce >> 4) & 0x0f) key_len[2]++;
if (ce & 1)
{
if (wch >> 8) key_len[3]++;
key_len[3]++;
}
}
else
{
key_len[0] += 2;
if (wch >> 8) key_len[0]++;
if (wch & 0xff) key_len[0]++;
}
}
}
}
if (!dstlen) /* compute length */
/* 4 * '\1' + 1 * '\0' + key length */
return key_len[0] + key_len[1] + key_len[2] + key_len[3] + 4 + 1;
if (dstlen < key_len[0] + key_len[1] + key_len[2] + key_len[3] + 4 + 1)
return 0; /* overflow */
src = src_save;
srclen = srclen_save;
key_ptr[0] = dst;
key_ptr[1] = key_ptr[0] + key_len[0] + 1;
key_ptr[2] = key_ptr[1] + key_len[1] + 1;
key_ptr[3] = key_ptr[2] + key_len[2] + 1;
for (; srclen; srclen--, src++)
{
int decomposed_len = 1;/*get_decomposition(*src, dummy, 4);*/
dummy[0] = *src;
if (decomposed_len)
{
int i;
for (i = 0; i < decomposed_len; i++)
{
WCHAR wch = dummy[i];
unsigned int ce;
/* tests show that win2k just ignores NORM_IGNORENONSPACE,
* and skips white space and punctuation characters for
* NORM_IGNORESYMBOLS.
*/
if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE)))
continue;
if (flags & NORM_IGNORECASE) wch = tolowerW(wch);
ce = collation_table[collation_table[wch >> 8] + (wch & 0xff)];
if (ce != (unsigned int)-1)
{
WCHAR key;
if ((key = ce >> 16))
{
*key_ptr[0]++ = key >> 8;
*key_ptr[0]++ = key & 0xff;
}
/* make key 1 start from 2 */
if ((key = (ce >> 8) & 0xff)) *key_ptr[1]++ = key + 1;
/* make key 2 start from 2 */
if ((key = (ce >> 4) & 0x0f)) *key_ptr[2]++ = key + 1;
/* key 3 is always a character code */
if (ce & 1)
{
if (wch >> 8) *key_ptr[3]++ = wch >> 8;
if (wch & 0xff) *key_ptr[3]++ = wch & 0xff;
}
}
else
{
*key_ptr[0]++ = 0xff;
*key_ptr[0]++ = 0xfe;
if (wch >> 8) *key_ptr[0]++ = wch >> 8;
if (wch & 0xff) *key_ptr[0]++ = wch & 0xff;
}
}
}
}
*key_ptr[0] = '\1';
*key_ptr[1] = '\1';
*key_ptr[2] = '\1';
*key_ptr[3]++ = '\1';
*key_ptr[3] = 0;
return key_ptr[3] - dst;
}
static inline int compare_unicode_weights(int flags, const WCHAR *str1, int len1,
const WCHAR *str2, int len2)
{
unsigned int ce1, ce2;
int ret;
/* 32-bit collation element table format:
* unicode weight - high 16 bit, diacritic weight - high 8 bit of low 16 bit,
* case weight - high 4 bit of low 8 bit.
*/
while (len1 > 0 && len2 > 0)
{
if (flags & NORM_IGNORESYMBOLS)
{
int skip = 0;
/* FIXME: not tested */
if (get_char_typeW(*str1) & (C1_PUNCT | C1_SPACE))
{
str1++;
len1--;
skip = 1;
}
if (get_char_typeW(*str2) & (C1_PUNCT | C1_SPACE))
{
str2++;
len2--;
skip = 1;
}
if (skip) continue;
}
/* hyphen and apostrophe are treated differently depending on
* whether SORT_STRINGSORT specified or not
*/
if (!(flags & SORT_STRINGSORT))
{
if (*str1 == '-' || *str1 == '\'')
{
if (*str2 != '-' && *str2 != '\'')
{
str1++;
len1--;
continue;
}
}
else if (*str2 == '-' || *str2 == '\'')
{
str2++;
len2--;
continue;
}
}
ce1 = collation_table[collation_table[*str1 >> 8] + (*str1 & 0xff)];
ce2 = collation_table[collation_table[*str2 >> 8] + (*str2 & 0xff)];
if (ce1 != (unsigned int)-1 && ce2 != (unsigned int)-1)
ret = (ce1 >> 16) - (ce2 >> 16);
else
ret = *str1 - *str2;
if (ret) return ret;
str1++;
str2++;
len1--;
len2--;
}
return len1 - len2;
}
static inline int compare_diacritic_weights(int flags, const WCHAR *str1, int len1,
const WCHAR *str2, int len2)
{
unsigned int ce1, ce2;
int ret;
/* 32-bit collation element table format:
* unicode weight - high 16 bit, diacritic weight - high 8 bit of low 16 bit,
* case weight - high 4 bit of low 8 bit.
*/
while (len1 > 0 && len2 > 0)
{
if (flags & NORM_IGNORESYMBOLS)
{
int skip = 0;
/* FIXME: not tested */
if (get_char_typeW(*str1) & (C1_PUNCT | C1_SPACE))
{
str1++;
len1--;
skip = 1;
}
if (get_char_typeW(*str2) & (C1_PUNCT | C1_SPACE))
{
str2++;
len2--;
skip = 1;
}
if (skip) continue;
}
ce1 = collation_table[collation_table[*str1 >> 8] + (*str1 & 0xff)];
ce2 = collation_table[collation_table[*str2 >> 8] + (*str2 & 0xff)];
if (ce1 != (unsigned int)-1 && ce2 != (unsigned int)-1)
ret = ((ce1 >> 8) & 0xff) - ((ce2 >> 8) & 0xff);
else
ret = *str1 - *str2;
if (ret) return ret;
str1++;
str2++;
len1--;
len2--;
}
return len1 - len2;
}
static inline int compare_case_weights(int flags, const WCHAR *str1, int len1,
const WCHAR *str2, int len2)
{
unsigned int ce1, ce2;
int ret;
/* 32-bit collation element table format:
* unicode weight - high 16 bit, diacritic weight - high 8 bit of low 16 bit,
* case weight - high 4 bit of low 8 bit.
*/
while (len1 > 0 && len2 > 0)
{
if (flags & NORM_IGNORESYMBOLS)
{
int skip = 0;
/* FIXME: not tested */
if (get_char_typeW(*str1) & (C1_PUNCT | C1_SPACE))
{
str1++;
len1--;
skip = 1;
}
if (get_char_typeW(*str2) & (C1_PUNCT | C1_SPACE))
{
str2++;
len2--;
skip = 1;
}
if (skip) continue;
}
ce1 = collation_table[collation_table[*str1 >> 8] + (*str1 & 0xff)];
ce2 = collation_table[collation_table[*str2 >> 8] + (*str2 & 0xff)];
if (ce1 != (unsigned int)-1 && ce2 != (unsigned int)-1)
ret = ((ce1 >> 4) & 0x0f) - ((ce2 >> 4) & 0x0f);
else
ret = *str1 - *str2;
if (ret) return ret;
str1++;
str2++;
len1--;
len2--;
}
return len1 - len2;
}
static inline int real_length(const WCHAR *str, int len)
{
while (len && !str[len - 1]) len--;
return len;
}
int wine_compare_string(int flags, const WCHAR *str1, int len1,
const WCHAR *str2, int len2)
{
int ret;
len1 = real_length(str1, len1);
len2 = real_length(str2, len2);
ret = compare_unicode_weights(flags, str1, len1, str2, len2);
if (!ret)
{
if (!(flags & NORM_IGNORENONSPACE))
ret = compare_diacritic_weights(flags, str1, len1, str2, len2);
if (!ret && !(flags & NORM_IGNORECASE))
ret = compare_case_weights(flags, str1, len1, str2, len2);
}
return ret;
}

View File

@ -0,0 +1,350 @@
/*
* Wine internal Unicode definitions
*
* Copyright 2000 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_WINE_UNICODE_H
#define __WINE_WINE_UNICODE_H
#include <stdarg.h>
#include <windows.h>
#ifdef __WINE_WINE_TEST_H
#error This file should not be used in Wine tests
#endif
typedef unsigned long ULONG_PTR;
#define WINE_UNICODE_API
#ifndef WINE_UNICODE_INLINE
#ifdef _MSC_VER
#define WINE_UNICODE_INLINE inline
#else
#define WINE_UNICODE_INLINE extern inline
#endif
#endif
#ifndef MAP_FOLDCZONE
#define MAP_FOLDCZONE 0x0010
#endif
#ifndef MAP_PRECOMPOSED
#define MAP_PRECOMPOSED 0x0020
#endif
#ifndef MAP_COMPOSITE
#define MAP_COMPOSITE 0x0040
#endif
#ifndef MAP_FOLDDIGITS
#define MAP_FOLDDIGITS 0x0080
#endif
#ifndef MAP_EXPAND_LIGATURES
#define MAP_EXPAND_LIGATURES 0x2000
#endif
/* code page info common to SBCS and DBCS */
struct cp_info
{
unsigned int codepage; /* codepage id */
unsigned int char_size; /* char size (1 or 2 bytes) */
WCHAR def_char; /* default char value (can be double-byte) */
WCHAR def_unicode_char; /* default Unicode char value */
const char *name; /* code page name */
};
struct sbcs_table
{
struct cp_info info;
const WCHAR *cp2uni; /* code page -> Unicode map */
const WCHAR *cp2uni_glyphs; /* code page -> Unicode map with glyph chars */
const unsigned char *uni2cp_low; /* Unicode -> code page map */
const unsigned short *uni2cp_high;
};
struct dbcs_table
{
struct cp_info info;
const WCHAR *cp2uni; /* code page -> Unicode map */
const unsigned char *cp2uni_leadbytes;
const unsigned short *uni2cp_low; /* Unicode -> code page map */
const unsigned short *uni2cp_high;
unsigned char lead_bytes[12]; /* lead bytes ranges */
};
union cptable
{
struct cp_info info;
struct sbcs_table sbcs;
struct dbcs_table dbcs;
};
extern const union cptable *wine_cp_get_table( unsigned int codepage );
extern const union cptable *wine_cp_enum_table( unsigned int index );
extern int wine_cp_mbstowcs( const union cptable *table, int flags,
const char *src, int srclen,
WCHAR *dst, int dstlen );
extern int wine_cp_wcstombs( const union cptable *table, int flags,
const WCHAR *src, int srclen,
char *dst, int dstlen, const char *defchar, int *used );
extern int wine_cpsymbol_mbstowcs( const char *src, int srclen, WCHAR *dst, int dstlen );
extern int wine_cpsymbol_wcstombs( const WCHAR *src, int srclen, char *dst, int dstlen );
extern int wine_utf8_mbstowcs( int flags, const char *src, int srclen, WCHAR *dst, int dstlen );
extern int wine_utf8_wcstombs( int flags, const WCHAR *src, int srclen, char *dst, int dstlen );
extern int wine_compare_string( int flags, const WCHAR *str1, int len1, const WCHAR *str2, int len2 );
extern int wine_get_sortkey( int flags, const WCHAR *src, int srclen, BYTE *dst, int dstlen );
extern int wine_fold_string( int flags, const WCHAR *src, int srclen , WCHAR *dst, int dstlen );
extern int strcmpiW( const WCHAR *str1, const WCHAR *str2 );
extern int strncmpiW( const WCHAR *str1, const WCHAR *str2, int n );
extern int memicmpW( const WCHAR *str1, const WCHAR *str2, int n );
extern WCHAR *strstrW( const WCHAR *str, const WCHAR *sub );
extern long int strtolW( const WCHAR *nptr, WCHAR **endptr, int base );
extern unsigned long int strtoulW( const WCHAR *nptr, WCHAR **endptr, int base );
extern int sprintfW( WCHAR *str, const WCHAR *format, ... );
extern int snprintfW( WCHAR *str, size_t len, const WCHAR *format, ... );
extern int vsprintfW( WCHAR *str, const WCHAR *format, va_list valist );
extern int vsnprintfW( WCHAR *str, size_t len, const WCHAR *format, va_list valist );
WINE_UNICODE_INLINE int wine_is_dbcs_leadbyte( const union cptable *table, unsigned char ch );
WINE_UNICODE_INLINE int wine_is_dbcs_leadbyte( const union cptable *table, unsigned char ch )
{
return (table->info.char_size == 2) && (table->dbcs.cp2uni_leadbytes[ch]);
}
WINE_UNICODE_INLINE WCHAR tolowerW( WCHAR ch );
WINE_UNICODE_INLINE WCHAR tolowerW( WCHAR ch )
{
extern WINE_UNICODE_API const WCHAR wine_casemap_lower[];
return ch + wine_casemap_lower[wine_casemap_lower[ch >> 8] + (ch & 0xff)];
}
WINE_UNICODE_INLINE WCHAR toupperW( WCHAR ch );
WINE_UNICODE_INLINE WCHAR toupperW( WCHAR ch )
{
extern WINE_UNICODE_API const WCHAR wine_casemap_upper[];
return ch + wine_casemap_upper[wine_casemap_upper[ch >> 8] + (ch & 0xff)];
}
/* the character type contains the C1_* flags in the low 12 bits */
/* and the C2_* type in the high 4 bits */
WINE_UNICODE_INLINE unsigned short get_char_typeW( WCHAR ch );
WINE_UNICODE_INLINE unsigned short get_char_typeW( WCHAR ch )
{
extern WINE_UNICODE_API const unsigned short wine_wctype_table[];
return wine_wctype_table[wine_wctype_table[ch >> 8] + (ch & 0xff)];
}
WINE_UNICODE_INLINE int iscntrlW( WCHAR wc );
WINE_UNICODE_INLINE int iscntrlW( WCHAR wc )
{
return get_char_typeW(wc) & C1_CNTRL;
}
WINE_UNICODE_INLINE int ispunctW( WCHAR wc );
WINE_UNICODE_INLINE int ispunctW( WCHAR wc )
{
return get_char_typeW(wc) & C1_PUNCT;
}
WINE_UNICODE_INLINE int isspaceW( WCHAR wc );
WINE_UNICODE_INLINE int isspaceW( WCHAR wc )
{
return get_char_typeW(wc) & C1_SPACE;
}
WINE_UNICODE_INLINE int isdigitW( WCHAR wc );
WINE_UNICODE_INLINE int isdigitW( WCHAR wc )
{
return get_char_typeW(wc) & C1_DIGIT;
}
WINE_UNICODE_INLINE int isxdigitW( WCHAR wc );
WINE_UNICODE_INLINE int isxdigitW( WCHAR wc )
{
return get_char_typeW(wc) & C1_XDIGIT;
}
WINE_UNICODE_INLINE int islowerW( WCHAR wc );
WINE_UNICODE_INLINE int islowerW( WCHAR wc )
{
return get_char_typeW(wc) & C1_LOWER;
}
WINE_UNICODE_INLINE int isupperW( WCHAR wc );
WINE_UNICODE_INLINE int isupperW( WCHAR wc )
{
return get_char_typeW(wc) & C1_UPPER;
}
WINE_UNICODE_INLINE int isalnumW( WCHAR wc );
WINE_UNICODE_INLINE int isalnumW( WCHAR wc )
{
return get_char_typeW(wc) & (C1_ALPHA|C1_DIGIT|C1_LOWER|C1_UPPER);
}
WINE_UNICODE_INLINE int isalphaW( WCHAR wc );
WINE_UNICODE_INLINE int isalphaW( WCHAR wc )
{
return get_char_typeW(wc) & (C1_ALPHA|C1_LOWER|C1_UPPER);
}
WINE_UNICODE_INLINE int isgraphW( WCHAR wc );
WINE_UNICODE_INLINE int isgraphW( WCHAR wc )
{
return get_char_typeW(wc) & (C1_ALPHA|C1_PUNCT|C1_DIGIT|C1_LOWER|C1_UPPER);
}
WINE_UNICODE_INLINE int isprintW( WCHAR wc );
WINE_UNICODE_INLINE int isprintW( WCHAR wc )
{
return get_char_typeW(wc) & (C1_ALPHA|C1_BLANK|C1_PUNCT|C1_DIGIT|C1_LOWER|C1_UPPER);
}
/* some useful string manipulation routines */
WINE_UNICODE_INLINE unsigned int strlenW( const WCHAR *str );
WINE_UNICODE_INLINE unsigned int strlenW( const WCHAR *str )
{
const WCHAR *s = str;
while (*s) s++;
return s - str;
}
WINE_UNICODE_INLINE WCHAR *strcpyW( WCHAR *dst, const WCHAR *src );
WINE_UNICODE_INLINE WCHAR *strcpyW( WCHAR *dst, const WCHAR *src )
{
WCHAR *p = dst;
while ((*p++ = *src++));
return dst;
}
/* strncpy doesn't do what you think, don't use it */
#define strncpyW(d,s,n) error do_not_use_strncpyW_use_lstrcpynW_or_memcpy_instead
WINE_UNICODE_INLINE int strcmpW( const WCHAR *str1, const WCHAR *str2 );
WINE_UNICODE_INLINE int strcmpW( const WCHAR *str1, const WCHAR *str2 )
{
while (*str1 && (*str1 == *str2)) { str1++; str2++; }
return *str1 - *str2;
}
WINE_UNICODE_INLINE int strncmpW( const WCHAR *str1, const WCHAR *str2, int n );
WINE_UNICODE_INLINE int strncmpW( const WCHAR *str1, const WCHAR *str2, int n )
{
if (n <= 0) return 0;
while ((--n > 0) && *str1 && (*str1 == *str2)) { str1++; str2++; }
return *str1 - *str2;
}
WINE_UNICODE_INLINE WCHAR *strcatW( WCHAR *dst, const WCHAR *src );
WINE_UNICODE_INLINE WCHAR *strcatW( WCHAR *dst, const WCHAR *src )
{
strcpyW( dst + strlenW(dst), src );
return dst;
}
WINE_UNICODE_INLINE WCHAR *strchrW( const WCHAR *str, WCHAR ch );
WINE_UNICODE_INLINE WCHAR *strchrW( const WCHAR *str, WCHAR ch )
{
do { if (*str == ch) return (WCHAR *)(ULONG_PTR)str; } while (*str++);
return NULL;
}
WINE_UNICODE_INLINE WCHAR *strrchrW( const WCHAR *str, WCHAR ch );
WINE_UNICODE_INLINE WCHAR *strrchrW( const WCHAR *str, WCHAR ch )
{
WCHAR *ret = NULL;
do { if (*str == ch) ret = (WCHAR *)(ULONG_PTR)str; } while (*str++);
return ret;
}
WINE_UNICODE_INLINE WCHAR *strpbrkW( const WCHAR *str, const WCHAR *accept );
WINE_UNICODE_INLINE WCHAR *strpbrkW( const WCHAR *str, const WCHAR *accept )
{
for ( ; *str; str++) if (strchrW( accept, *str )) return (WCHAR *)(ULONG_PTR)str;
return NULL;
}
WINE_UNICODE_INLINE size_t strspnW( const WCHAR *str, const WCHAR *accept );
WINE_UNICODE_INLINE size_t strspnW( const WCHAR *str, const WCHAR *accept )
{
const WCHAR *ptr;
for (ptr = str; *ptr; ptr++) if (!strchrW( accept, *ptr )) break;
return ptr - str;
}
WINE_UNICODE_INLINE size_t strcspnW( const WCHAR *str, const WCHAR *reject );
WINE_UNICODE_INLINE size_t strcspnW( const WCHAR *str, const WCHAR *reject )
{
const WCHAR *ptr;
for (ptr = str; *ptr; ptr++) if (strchrW( reject, *ptr )) break;
return ptr - str;
}
WINE_UNICODE_INLINE WCHAR *strlwrW( WCHAR *str );
WINE_UNICODE_INLINE WCHAR *strlwrW( WCHAR *str )
{
WCHAR *ret = str;
while ((*str = tolowerW(*str))) str++;
return ret;
}
WINE_UNICODE_INLINE WCHAR *struprW( WCHAR *str );
WINE_UNICODE_INLINE WCHAR *struprW( WCHAR *str )
{
WCHAR *ret = str;
while ((*str = toupperW(*str))) str++;
return ret;
}
WINE_UNICODE_INLINE WCHAR *memchrW( const WCHAR *ptr, WCHAR ch, size_t n );
WINE_UNICODE_INLINE WCHAR *memchrW( const WCHAR *ptr, WCHAR ch, size_t n )
{
const WCHAR *end;
for (end = ptr + n; ptr < end; ptr++) if (*ptr == ch) return (WCHAR *)(ULONG_PTR)ptr;
return NULL;
}
WINE_UNICODE_INLINE WCHAR *memrchrW( const WCHAR *ptr, WCHAR ch, size_t n );
WINE_UNICODE_INLINE WCHAR *memrchrW( const WCHAR *ptr, WCHAR ch, size_t n )
{
const WCHAR *end;
WCHAR *ret = NULL;
for (end = ptr + n; ptr < end; ptr++) if (*ptr == ch) ret = (WCHAR *)(ULONG_PTR)ptr;
return ret;
}
/*WINE_UNICODE_INLINE long int atolW( const WCHAR *str );
WINE_UNICODE_INLINE long int atolW( const WCHAR *str )
{
return strtolW( str, (WCHAR **)0, 10 );
}
WINE_UNICODE_INLINE int atoiW( const WCHAR *str );
WINE_UNICODE_INLINE int atoiW( const WCHAR *str )
{
return (int)atolW( str );
}*/
#undef WINE_UNICODE_INLINE
#endif /* __WINE_WINE_UNICODE_H */

File diff suppressed because it is too large Load Diff

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

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

@ -254,6 +254,18 @@ BOOL WINAPI FreeEnvironmentStringsW_new(void* env)
return HeapFree(GetProcessHeap(), 0, env);
}
//MAKE_EXPORT GetAtomNameW_new=GetAtomNameW
UINT WINAPI GetAtomNameW_new(ATOM atom, LPWSTR bufferW, int size)
{
UINT ret;
ALLOC_A(buffer, size * acp_mcs);
ret = GetAtomNameA(atom, bufferA, size * acp_mcs);
if (ret)
ret = ABUFtoW(buffer, ret + 1, size);
if (ret) ret--;
return ret;
}
//MAKE_EXPORT GetCurrentDirectoryW_new=GetCurrentDirectoryW
DWORD WINAPI GetCurrentDirectoryW_new(DWORD nBufferLength, LPWSTR lpBufferW)
{
@ -397,6 +409,42 @@ DWORD WINAPI GetLongPathNameW_new(LPCWSTR lpszShortPathW, LPWSTR lpszLongPathW,
return ret;
}
//MAKE_EXPORT GetModuleFileNameW_new=GetModuleFileNameW
DWORD WINAPI GetModuleFileNameW_new(HMODULE hModule, LPWSTR lpFilenameW, DWORD nSize)
{
DWORD ret;
char lpFilenameA[MAX_PATH];
if (nSize <= 0)
return 0;
ret = GetModuleFileNameA(hModule, lpFilenameA, MAX_PATH);
if (ret)
{
file_GetCP();
DWORD last_err = GetLastError();
if (ret >= MAX_PATH)
{
SetLastError(ERROR_FILENAME_EXCED_RANGE);
return 0;
}
ret = file_AtoW(lpFilename, nSize);
if (!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
{
ret = nSize;
}
else if (ret) ret--;
SetLastError(last_err);
}
return ret;
}
//MAKE_EXPORT GetModuleHandleW_new=GetModuleHandleW
HMODULE WINAPI GetModuleHandleW_new(LPCWSTR lpModuleNameW)
{
file_GetCP();
file_ALLOC_WtoA(lpModuleName);
return GetModuleHandleA(lpModuleNameA);
}
//MAKE_EXPORT GetShortPathNameW_new=GetShortPathNameW
DWORD WINAPI GetShortPathNameW_new(LPCWSTR lpszLongPathW, LPWSTR lpszShortPathW, DWORD cchBuffer)
{
@ -542,7 +590,23 @@ UINT WINAPI GlobalGetAtomNameW_new(ATOM atom, LPWSTR bufferW, int size)
ret = ABUFtoW(buffer, ret + 1, size);
if (ret) ret--;
return ret;
}
}
//MAKE_EXPORT LoadLibraryW_new=LoadLibraryW
HINSTANCE WINAPI LoadLibraryW_new(LPCWSTR lpLibFileNameW)
{
file_GetCP();
file_ALLOC_WtoA(lpLibFileName);
return LoadLibraryA(lpLibFileNameA);
}
//MAKE_EXPORT LoadLibraryExW_new=LoadLibraryExW
HINSTANCE WINAPI LoadLibraryExW_new(LPCWSTR lpLibFileNameW, HANDLE hFile, DWORD dwFlags)
{
file_GetCP();
file_ALLOC_WtoA(lpLibFileName);
return LoadLibraryExA(lpLibFileNameA, hFile, dwFlags);
}
//MAKE_EXPORT Module32FirstW_new=Module32FirstW
BOOL WINAPI Module32FirstW_new(HANDLE hSnapshot, LPMODULEENTRY32W lpmeW)

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

@ -20,7 +20,6 @@
*/
#include <windows.h>
#include "auxdecl.h"
/* special structure used internally to save some space */
typedef struct

View File

@ -0,0 +1,52 @@
/*
* KernelEx
* Copyright (C) 2009, Xeno86
*
* This file is part of KernelEx source code.
*
* KernelEx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; version 2 of the License.
*
* KernelEx is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include "common.h"
/* MAKE_EXPORT GetVolumePathNameA_new=GetVolumePathNameA */
BOOL WINAPI GetVolumePathNameA_new(LPCSTR filename, LPSTR volumepathname, DWORD buflen)
{
//semi-stub - doesn't work with UNC
const char *p = filename;
if (p && tolower(p[0]) >= 'a' && tolower(p[0]) <= 'z' && p[1] ==':' && p[2] == '\\' && buflen >= 4)
{
volumepathname[0] = p[0];
volumepathname[1] = ':';
volumepathname[2] = '\\';
volumepathname[3] = 0;
return TRUE;
}
return FALSE;
}
/* MAKE_EXPORT GetVolumePathNameW_new=GetVolumePathNameW */
BOOL WINAPI GetVolumePathNameW_new(LPCWSTR filenameW, LPWSTR volumepathnameW, DWORD buflen)
{
BOOL ret;
file_GetCP();
file_ALLOC_WtoA(filename);
ALLOC_A(volumepathname, buflen);
ret = GetVolumePathNameA_new(filenameA, volumepathnameA, buflen);
if (ret)
file_ABUFtoW(volumepathname, -1, buflen);
return ret;
}

View File

@ -0,0 +1,60 @@
/*
* KernelEx
* Copyright (C) 2009, Xeno86
*
* This file is part of KernelEx source code.
*
* KernelEx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; version 2 of the License.
*
* KernelEx is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <windows.h>
#ifndef CP_THREAD_ACP
#define CP_THREAD_ACP 3
#endif
/* MAKE_EXPORT WideCharToMultiByte_new=WideCharToMultiByte */
int WINAPI WideCharToMultiByte_new(
UINT CodePage,
DWORD dwFlags,
LPCWSTR lpWideCharStr,
int cchWideChar,
LPSTR lpMultiByteStr,
int cchMultiByte,
LPCSTR lpDefaultChar,
LPBOOL lpUsedDefaultChar
)
{
if (CodePage == CP_THREAD_ACP)
CodePage = CP_ACP;
return WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar,
lpMultiByteStr, cchMultiByte, lpDefaultChar, lpUsedDefaultChar);
}
/* MAKE_EXPORT MultiByteToWideChar_new=MultiByteToWideChar */
int WINAPI MultiByteToWideChar_new(
UINT CodePage,
DWORD dwFlags,
LPCSTR lpMultiByteStr,
int cchMultiByte,
LPWSTR lpWideCharStr,
int cchWideChar
)
{
if (CodePage == CP_THREAD_ACP)
CodePage = CP_ACP;
return MultiByteToWideChar(CodePage, dwFlags, lpMultiByteStr, cchMultiByte,
lpWideCharStr, cchWideChar);
}

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

View File

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

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

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