1
0
mirror of https://github.com/UzixLS/KernelEx.git synced 2025-07-19 15:31:19 +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

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)
{