ReactOS 0.4.16-dev-2498-g8632030
utils.h
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Console Utilities Library
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: Base set of functions for loading string resources
5 * and message strings, and handle type identification.
6 * COPYRIGHT: Copyright 2017-2021 ReactOS Team
7 * Copyright 2017-2021 Hermes Belusca-Maito
8 */
9
18#ifndef __UTILS_H__
19#define __UTILS_H__
20
21#pragma once
22
23#ifndef _UNICODE
24#error The ConUtils library at the moment only supports compilation with _UNICODE defined!
25#endif
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31/* Avoid including winuser.h for these definitions */
32#ifndef IS_INTRESOURCE
33#define IS_INTRESOURCE(i) (((ULONG_PTR)(i) >> 16) == 0)
34#endif
35#ifndef MAKEINTRESOURCEA
36#define MAKEINTRESOURCEA(i) ((LPSTR)(ULONG_PTR)LOWORD(i))
37#endif
38#ifndef MAKEINTRESOURCEW
39#define MAKEINTRESOURCEW(i) ((LPWSTR)(ULONG_PTR)LOWORD(i))
40#endif
41// #define MAKEINTRESOURCE(i) ((ULONG_PTR)((WORD)(i)))
42
43INT
47 IN UINT uID,
48 IN LANGID LanguageId,
51
52INT
56 IN UINT uID,
59
60/* Override LoadString */
61#ifdef LoadString
62#undef LoadString
63#endif
64#define LoadStringW K32LoadStringW
65#if defined(UNICODE) || defined(_UNICODE)
66#define LoadString LoadStringW
67#else
68#error The ConUtils library only supports UNICODE at the moment!
69#endif // UNICODE
70
75 IN LPCVOID lpSource OPTIONAL,
76 IN DWORD dwMessageId,
77 IN DWORD dwLanguageId,
80 IN va_list *Arguments OPTIONAL);
81
84 IN LANGID LangId OPTIONAL);
85
86BOOL
87IsTTYHandle(IN HANDLE hHandle);
88
89BOOL
91
92
93// #include <wincon.h>
94
95
96#ifdef __cplusplus
97}
98#endif
99
100#endif /* __UTILS_H__ */
101
102/* EOF */
HINSTANCE hInstance
Definition: charmap.c:19
char * va_list
Definition: vadefs.h:50
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
USHORT LANGID
Definition: mui.h:9
CONST void * LPCVOID
Definition: minwindef.h:164
unsigned int UINT
Definition: ndis.h:50
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
_Out_ LPWSTR lpBuffer
Definition: netsh.h:68
_Out_ LPWSTR _In_ DWORD nBufferMax
Definition: netsh.h:69
_In_ UINT uID
Definition: shlwapi.h:156
#define IsConsoleHandle(h)
Definition: console.h:14
LANGID ConSetThreadUILanguage(IN LANGID LangId OPTIONAL)
Definition: utils.c:362
INT WINAPI K32LoadStringW(IN HINSTANCE hInstance OPTIONAL, IN UINT uID, OUT LPWSTR lpBuffer, IN INT nBufferMax)
Definition: utils.c:183
INT WINAPI K32LoadStringExW(IN HINSTANCE hInstance OPTIONAL, IN UINT uID, IN LANGID LanguageId, OUT LPWSTR lpBuffer, IN INT nBufferMax)
Definition: utils.c:110
BOOL IsTTYHandle(IN HANDLE hHandle)
Definition: utils.c:403
DWORD WINAPI FormatMessageSafeW(IN DWORD dwFlags, IN LPCVOID lpSource OPTIONAL, IN DWORD dwMessageId, IN DWORD dwLanguageId, OUT LPWSTR lpBuffer, IN DWORD nSize, IN va_list *Arguments OPTIONAL)
Definition: utils.c:264
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
int32_t INT
Definition: typedefs.h:58
#define IN
Definition: typedefs.h:39
#define OUT
Definition: typedefs.h:40
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:1834
#define WINAPI
Definition: msvc.h:6
WCHAR * LPWSTR
Definition: xmlstorage.h:184