https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1530a678a8259114e6f62…
commit 1530a678a8259114e6f625ba0a0b8dd7cc713c18
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Mon Jan 24 16:45:59 2022 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Sun Jan 30 01:01:58 2022 +0100
[CONCFG:FONT] Add SAL annotations.
---
win32ss/user/winsrv/concfg/font.c | 58 +++++++++++++++++++++------------------
win32ss/user/winsrv/concfg/font.h | 50 +++++++++++++++++----------------
2 files changed, 58 insertions(+), 50 deletions(-)
diff --git a/win32ss/user/winsrv/concfg/font.c b/win32ss/user/winsrv/concfg/font.c
index 1c3cbb4f191..2c5e9abc83a 100644
--- a/win32ss/user/winsrv/concfg/font.c
+++ b/win32ss/user/winsrv/concfg/font.c
@@ -30,7 +30,7 @@ LIST_ENTRY TTFontCache = {&TTFontCache, &TTFontCache};
/* Retrieves the character set associated with a given code page */
BYTE
CodePageToCharSet(
- IN UINT CodePage)
+ _In_ UINT CodePage)
{
CHARSETINFO CharInfo;
if (TranslateCharsetInfo(UlongToPtr(CodePage), &CharInfo, TCI_SRCCODEPAGE))
@@ -41,12 +41,13 @@ CodePageToCharSet(
HFONT
CreateConsoleFontEx(
- IN LONG Height,
- IN LONG Width OPTIONAL,
- IN OUT LPWSTR FaceName, // Points to a WCHAR array of LF_FACESIZE elements
- IN ULONG FontFamily,
- IN ULONG FontWeight,
- IN UINT CodePage)
+ _In_ LONG Height,
+ _In_opt_ LONG Width,
+ _Inout_updates_z_(LF_FACESIZE)
+ PWSTR FaceName,
+ _In_ ULONG FontFamily,
+ _In_ ULONG FontWeight,
+ _In_ UINT CodePage)
{
LOGFONTW lf;
@@ -85,9 +86,9 @@ CreateConsoleFontEx(
HFONT
CreateConsoleFont2(
- IN LONG Height,
- IN LONG Width OPTIONAL,
- IN OUT PCONSOLE_STATE_INFO ConsoleInfo)
+ _In_ LONG Height,
+ _In_opt_ LONG Width,
+ _Inout_ PCONSOLE_STATE_INFO ConsoleInfo)
{
return CreateConsoleFontEx(Height,
Width,
@@ -99,7 +100,7 @@ CreateConsoleFont2(
HFONT
CreateConsoleFont(
- IN OUT PCONSOLE_STATE_INFO ConsoleInfo)
+ _Inout_ PCONSOLE_STATE_INFO ConsoleInfo)
{
/*
* Format:
@@ -115,12 +116,13 @@ CreateConsoleFont(
ConsoleInfo->CodePage);
}
+_Success_(return)
BOOL
GetFontCellSize(
- IN HDC hDC OPTIONAL,
- IN HFONT hFont,
- OUT PUINT Height,
- OUT PUINT Width)
+ _In_opt_ HDC hDC,
+ _In_ HFONT hFont,
+ _Out_ PUINT Height,
+ _Out_ PUINT Width)
{
BOOL Success = FALSE;
HDC hOrgDC = hDC;
@@ -186,10 +188,10 @@ Quit:
BOOL
IsValidConsoleFont2(
- IN PLOGFONTW lplf,
- IN PNEWTEXTMETRICW lpntm,
- IN DWORD FontType,
- IN UINT CodePage)
+ _In_ PLOGFONTW lplf,
+ _In_ PNEWTEXTMETRICW lpntm,
+ _In_ DWORD FontType,
+ _In_ UINT CodePage)
{
LPCWSTR FaceName = lplf->lfFaceName;
@@ -348,10 +350,10 @@ typedef struct _IS_VALID_CONSOLE_FONT_PARAM
static BOOL CALLBACK
IsValidConsoleFontProc(
- IN PLOGFONTW lplf,
- IN PNEWTEXTMETRICW lpntm,
- IN DWORD FontType,
- IN LPARAM lParam)
+ _In_ PLOGFONTW lplf,
+ _In_ PNEWTEXTMETRICW lpntm,
+ _In_ DWORD FontType,
+ _In_ LPARAM lParam)
{
PIS_VALID_CONSOLE_FONT_PARAM Param = (PIS_VALID_CONSOLE_FONT_PARAM)lParam;
Param->IsValidFont = IsValidConsoleFont2(lplf, lpntm, FontType,
Param->CodePage);
@@ -362,8 +364,9 @@ IsValidConsoleFontProc(
BOOL
IsValidConsoleFont(
- IN LPCWSTR FaceName,
- IN UINT CodePage)
+ // _In_reads_or_z_(LF_FACESIZE)
+ _In_ PCWSTR FaceName,
+ _In_ UINT CodePage)
{
IS_VALID_CONSOLE_FONT_PARAM Param;
HDC hDC;
@@ -526,8 +529,9 @@ RefreshTTFontCache(VOID)
PTT_FONT_ENTRY
FindCachedTTFont(
- IN LPCWSTR FaceName,
- IN UINT CodePage)
+ // _In_reads_or_z_(LF_FACESIZE)
+ _In_ PCWSTR FaceName,
+ _In_ UINT CodePage)
{
PLIST_ENTRY Entry;
PTT_FONT_ENTRY FontEntry;
diff --git a/win32ss/user/winsrv/concfg/font.h b/win32ss/user/winsrv/concfg/font.h
index ee1aa92736c..15224b3f9d6 100644
--- a/win32ss/user/winsrv/concfg/font.h
+++ b/win32ss/user/winsrv/concfg/font.h
@@ -59,45 +59,48 @@ typedef struct _TT_FONT_ENTRY
BYTE
CodePageToCharSet(
- IN UINT CodePage);
+ _In_ UINT CodePage);
HFONT
CreateConsoleFontEx(
- IN LONG Height,
- IN LONG Width OPTIONAL,
- IN OUT LPWSTR FaceName, // Points to a WCHAR array of LF_FACESIZE elements
- IN ULONG FontFamily,
- IN ULONG FontWeight,
- IN UINT CodePage);
+ _In_ LONG Height,
+ _In_opt_ LONG Width,
+ _Inout_updates_z_(LF_FACESIZE)
+ PWSTR FaceName,
+ _In_ ULONG FontFamily,
+ _In_ ULONG FontWeight,
+ _In_ UINT CodePage);
HFONT
CreateConsoleFont2(
- IN LONG Height,
- IN LONG Width OPTIONAL,
- IN OUT PCONSOLE_STATE_INFO ConsoleInfo);
+ _In_ LONG Height,
+ _In_opt_ LONG Width,
+ _Inout_ PCONSOLE_STATE_INFO ConsoleInfo);
HFONT
CreateConsoleFont(
- IN OUT PCONSOLE_STATE_INFO ConsoleInfo);
+ _Inout_ PCONSOLE_STATE_INFO ConsoleInfo);
+_Success_(return)
BOOL
GetFontCellSize(
- IN HDC hDC OPTIONAL,
- IN HFONT hFont,
- OUT PUINT Height,
- OUT PUINT Width);
+ _In_opt_ HDC hDC,
+ _In_ HFONT hFont,
+ _Out_ PUINT Height,
+ _Out_ PUINT Width);
BOOL
IsValidConsoleFont2(
- IN PLOGFONTW lplf,
- IN PNEWTEXTMETRICW lpntm,
- IN DWORD FontType,
- IN UINT CodePage);
+ _In_ PLOGFONTW lplf,
+ _In_ PNEWTEXTMETRICW lpntm,
+ _In_ DWORD FontType,
+ _In_ UINT CodePage);
BOOL
IsValidConsoleFont(
- IN LPCWSTR FaceName,
- IN UINT CodePage);
+ // _In_reads_or_z_(LF_FACESIZE)
+ _In_ PCWSTR FaceName,
+ _In_ UINT CodePage);
/*
* To install additional TrueType fonts to be available for the console,
@@ -119,8 +122,9 @@ RefreshTTFontCache(VOID);
PTT_FONT_ENTRY
FindCachedTTFont(
- IN LPCWSTR FaceName,
- IN UINT CodePage);
+ // _In_reads_or_z_(LF_FACESIZE)
+ _In_ PCWSTR FaceName,
+ _In_ UINT CodePage);
#define IsAdditionalTTFont(FaceName) \
(FindCachedTTFont((FaceName), INVALID_CP) != NULL)