ReactOS 0.4.15-dev-8028-g8e799e2
mlng.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  MLNGINFO
 
class  CStaticIconList
 

Functions

INT InatAddIcon (_In_ HICON hIcon)
 @implemented
 
HICON InatCreateIcon (_In_ LANGID LangID)
 @implemented
 
HICON InatCreateIconBySize (_In_ LANGID LangID, _In_ INT nWidth, _In_ INT nHeight, _In_ const LOGFONTW *plf)
 @implemented
 
BOOL InatGetIconSize (_Out_ INT *pcx, _Out_ INT *pcy)
 @implemented
 
INT InatGetImageCount (VOID)
 @implemented
 
VOID InatRemoveAll (VOID)
 @implemented
 
DWORD GetHKLSubstitute (_In_ HKL hKL)
 @implemented
 
HICON GetIconFromFile (_In_ INT cx, _In_ INT cy, _In_ LPCWSTR pszFileName, _In_ INT iIcon)
 @implemented
 
VOID UninitINAT (VOID)
 @implemented
 

Function Documentation

◆ GetHKLSubstitute()

DWORD GetHKLSubstitute ( _In_ HKL  hKL)

@implemented

Definition at line 93 of file mlng.cpp.

94{
95 if (IS_IME_HKL(hKL))
96 return HandleToUlong(hKL);
97
98 DWORD dwKLID;
99 if (HIWORD(hKL) == LOWORD(hKL))
100 dwKLID = LOWORD(hKL);
101 else if (IS_SPECIAL_HKL(hKL))
102 dwKLID = GetSpecialKLID(hKL);
103 else
104 dwKLID = HandleToUlong(hKL);
105
106 if (dwKLID == 0)
107 return HandleToUlong(hKL);
108
109 CicRegKey regKey;
110 LSTATUS error = regKey.Open(HKEY_CURRENT_USER, L"Keyboard Layout\\Substitutes");
111 if (error == ERROR_SUCCESS)
112 {
113 WCHAR szName[MAX_PATH], szValue[MAX_PATH];
114 DWORD dwIndex, dwValue;
115 for (dwIndex = 0; ; ++dwIndex)
116 {
117 error = regKey.EnumValue(dwIndex, szName, _countof(szName));
118 szName[_countof(szName) - 1] = UNICODE_NULL; // Avoid buffer overrun
119 if (error != ERROR_SUCCESS)
120 break;
121
122 error = regKey.QuerySz(szName, szValue, _countof(szValue));
123 szValue[_countof(szValue) - 1] = UNICODE_NULL; // Avoid buffer overrun
124 if (error != ERROR_SUCCESS)
125 break;
126
127 dwValue = wcstoul(szValue, NULL, 16);
128 if ((dwKLID & ~SPECIAL_MASK) == dwValue)
129 {
130 dwKLID = wcstoul(szName, NULL, 16);
131 break;
132 }
133 }
134 }
135
136 return dwKLID;
137}
#define SPECIAL_MASK
Definition: debug.h:13
#define HandleToUlong(h)
Definition: basetsd.h:79
LSTATUS QuerySz(LPCTSTR pszValueName, LPTSTR pszValue, DWORD cchValueMax)
Definition: cicreg.h:84
LSTATUS Open(HKEY hKey, LPCTSTR lpSubKey, REGSAM samDesired=KEY_READ)
Definition: cicreg.h:51
LSTATUS EnumValue(DWORD dwIndex, LPTSTR lpValueName, DWORD cchValueName)
Definition: cicreg.h:108
#define ERROR_SUCCESS
Definition: deptool.c:10
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
#define NULL
Definition: types.h:112
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IS_SPECIAL_HKL(hKL)
Definition: imm32_undoc.h:21
#define IS_IME_HKL(hKL)
Definition: imm32_undoc.h:20
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define error(str)
Definition: mkdosfs.c:1605
DWORD GetSpecialKLID(_In_ HKL hKL)
@implemented
Definition: mlng.cpp:46
#define UNICODE_NULL
#define L(x)
Definition: ntvdm.h:50
#define LOWORD(l)
Definition: pedump.c:82
static const WCHAR szName[]
Definition: powrprof.c:45
#define _countof(array)
Definition: sndvol32.h:68
#define HIWORD(l)
Definition: typedefs.h:247
#define HKEY_CURRENT_USER
Definition: winreg.h:11
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by GetKbdLayoutNameFromReg().

◆ GetIconFromFile()

HICON GetIconFromFile ( _In_ INT  cx,
_In_ INT  cy,
_In_ LPCWSTR  pszFileName,
_In_ INT  iIcon 
)

@implemented

Definition at line 211 of file mlng.cpp.

212{
213 HICON hIcon;
214
217 else
218 ::ExtractIconExW(pszFileName, iIcon, &hIcon, NULL, 1);
219
220 return hIcon;
221}
UINT WINAPI ExtractIconExW(LPCWSTR lpszFile, INT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIcons)
Definition: iconcache.cpp:849
static HICON
Definition: imagelist.c:84
HICON hIcon
Definition: msconfig.c:44
_Out_opt_ int * cx
Definition: commctrl.h:585
WORD WORD PSZ PSZ pszFileName
Definition: vdmdbg.h:44
#define SM_CXSMICON
Definition: winuser.h:1012
int WINAPI GetSystemMetrics(_In_ int)

Referenced by MLNGINFO::InitIcon().

◆ InatAddIcon()

INT InatAddIcon ( _In_ HICON  hIcon)

@implemented

Definition at line 252 of file mlng.cpp.

253{
254 if (!EnsureIconImageList())
255 return -1;
256 return g_IconList.AddIcon(hIcon);
257}
INT AddIcon(HICON hIcon)
@implemented
Definition: mlng.cpp:451
CStaticIconList g_IconList
Definition: mlng.cpp:35
static BOOL EnsureIconImageList(VOID)
@implemented
Definition: mlng.cpp:224

Referenced by MLNGINFO::InitIcon().

◆ InatCreateIcon()

HICON InatCreateIcon ( _In_ LANGID  LangID)

@implemented

Definition at line 316 of file mlng.cpp.

317{
319
320 LOGFONTW lf;
322 return NULL;
323
324 if (cySmIcon < GetPhysicalFontHeight(&lf))
325 {
326 lf.lfWidth = 0;
327 lf.lfHeight = - (7 * cySmIcon) / 10;
328 }
329
330 return InatCreateIconBySize(LangID, cxSmIcon, cySmIcon, &lf);
331}
HICON InatCreateIconBySize(_In_ LANGID LangID, _In_ INT nWidth, _In_ INT nHeight, _In_ const LOGFONTW *plf)
@implemented
Definition: mlng.cpp:261
static INT GetPhysicalFontHeight(LOGFONTW *plf)
@implemented
Definition: mlng.cpp:233
LONG lfHeight
Definition: dimm.idl:59
LONG lfWidth
Definition: dimm.idl:60
int32_t INT
Definition: typedefs.h:58
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_writes_opt_ NumCharacters PUSHORT _Inout_ PUSHORT _In_ UCHAR _In_opt_ USHORT LangID
Definition: wdfusb.h:1083
#define SM_CYSMICON
Definition: winuser.h:1013
#define SPI_GETICONTITLELOGFONT
Definition: winuser.h:1380
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)

Referenced by MLNGINFO::InitIcon().

◆ InatCreateIconBySize()

HICON InatCreateIconBySize ( _In_ LANGID  LangID,
_In_ INT  nWidth,
_In_ INT  nHeight,
_In_ const LOGFONTW plf 
)

@implemented

Definition at line 261 of file mlng.cpp.

266{
267 WCHAR szText[64];
269 szText, _countof(szText));
270 if (!ret)
271 szText[0] = szText[1] = L'?';
272
273 szText[2] = UNICODE_NULL;
274 CharUpperW(szText);
275
277 if (!hFont)
278 return NULL;
279
280 HDC hDC = ::GetDC(NULL);
281 HDC hMemDC = ::CreateCompatibleDC(hDC);
282 HBITMAP hbmColor = ::CreateCompatibleBitmap(hDC, nWidth, nHeight);
283 HBITMAP hbmMask = ::CreateBitmap(nWidth, nHeight, 1, 1, NULL);
285
286 HICON hIcon = NULL;
287 HGDIOBJ hbmOld = ::SelectObject(hMemDC, hbmColor);
288 HGDIOBJ hFontOld = ::SelectObject(hMemDC, hFont);
289 if (hMemDC && hbmColor && hbmMask)
290 {
293
294 RECT rc = { 0, 0, nWidth, nHeight };
295 ::ExtTextOutW(hMemDC, 0, 0, ETO_OPAQUE, &rc, L"", 0, NULL);
296
297 ::DrawTextW(hMemDC, szText, 2, &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
298 ::SelectObject(hMemDC, hbmMask);
299
300 ::PatBlt(hMemDC, 0, 0, nWidth, nHeight, BLACKNESS);
301
302 ICONINFO IconInfo = { TRUE, 0, 0, hbmMask, hbmColor };
304 }
305 ::SelectObject(hMemDC, hFontOld);
306 ::SelectObject(hMemDC, hbmOld);
307
308 ::DeleteObject(hbmMask);
309 ::DeleteObject(hbmColor);
310 ::DeleteDC(hMemDC);
312 return hIcon;
313}
static HDC hDC
Definition: 3dtext.c:33
HFONT hFont
Definition: main.c:53
#define TRUE
Definition: types.h:120
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: locale.c:1665
unsigned int BOOL
Definition: ntddk_ex.h:94
pKey DeleteObject()
_Out_opt_ PICONINFO IconInfo
Definition: ntuser.h:2294
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:92
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:16
int ret
#define BLACKNESS
Definition: wingdi.h:323
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI ExtTextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_ UINT options, _In_opt_ const RECT *lprect, _In_reads_opt_(c) LPCWSTR lpString, _In_ UINT c, _In_reads_opt_(c) const INT *lpDx)
#define ETO_OPAQUE
Definition: wingdi.h:647
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
BOOL WINAPI DeleteDC(_In_ HDC)
#define LOCALE_NOUSEROVERRIDE
Definition: winnls.h:19
#define LOCALE_SABBREVLANGNAME
Definition: winnls.h:28
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
DWORD WINAPI GetSysColor(_In_ int)
HICON WINAPI CreateIconIndirect(_In_ PICONINFO)
Definition: cursoricon.c:2612
#define DT_CENTER
Definition: winuser.h:527
#define COLOR_HIGHLIGHT
Definition: winuser.h:926
#define DT_SINGLELINE
Definition: winuser.h:540
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:927
HDC WINAPI GetDC(_In_opt_ HWND)
#define DT_VCENTER
Definition: winuser.h:543
LPWSTR WINAPI CharUpperW(_Inout_ LPWSTR)

Referenced by InatCreateIcon().

◆ InatGetIconSize()

BOOL InatGetIconSize ( _Out_ INT pcx,
_Out_ INT pcy 
)

@implemented

Definition at line 334 of file mlng.cpp.

335{
336 g_IconList.GetIconSize(pcx, pcy);
337 return TRUE;
338}
void GetIconSize(INT *pcx, INT *pcy)
@implemented
Definition: mlng.cpp:479

Referenced by MLNGINFO::InitIcon().

◆ InatGetImageCount()

INT InatGetImageCount ( VOID  )

@implemented

Definition at line 341 of file mlng.cpp.

342{
343 return g_IconList.GetImageCount();
344}
INT GetImageCount()
@implemented
Definition: mlng.cpp:488

◆ InatRemoveAll()

VOID InatRemoveAll ( VOID  )

@implemented

Definition at line 347 of file mlng.cpp.

348{
351}
void RemoveAll(BOOL bNoLock)
@implemented
Definition: mlng.cpp:497
static INT s_cx
Definition: mlng.h:29
#define FALSE
Definition: types.h:117

◆ UninitINAT()

VOID UninitINAT ( VOID  )

@implemented

Definition at line 354 of file mlng.cpp.

355{
357
358 if (g_pMlngInfo)
359 {
360 delete g_pMlngInfo;
362 }
363}
CicArray< MLNGINFO > * g_pMlngInfo
Definition: mlng.cpp:32

Referenced by ProcessDetach().