ReactOS 0.4.15-dev-7958-gcd0bb1a
fontsub.cpp File Reference
#include <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include <tchar.h>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cassert>
#include "resource.h"
Include dependency graph for fontsub.cpp:

Go to the source code of this file.

Classes

struct  ITEM
 
struct  CHARSET_ENTRY
 

Macros

#define NAME_COLUMN_WIDTH   250
 
#define SUB_COLUMN_WIDTH   250
 
#define MAX_STRING   120
 
#define _countof(array)   (sizeof(array) / sizeof(array[0]))
 

Typedefs

typedef std::wstring STRING
 
typedef std::set< STRINGFONTNAMESET
 
typedef std::vector< ITEMITEMVECTOR
 
typedef struct CHARSET_ENTRY CHARSET_ENTRY
 

Functions

static void trim (STRING &str)
 
static int CALLBACK EnumFontFamExProc (const ENUMLOGFONTW *pelf, const NEWTEXTMETRICW *pntm, int FontType, LPARAM lParam)
 
BOOL DoLoadNames (void)
 
bool ItemCompareByNameAscend (const ITEM &Item1, const ITEM &Item2)
 
bool ItemCompareByNameDescend (const ITEM &Item1, const ITEM &Item2)
 
bool ItemCompareBySubAscend (const ITEM &Item1, const ITEM &Item2)
 
bool ItemCompareBySubDescend (const ITEM &Item1, const ITEM &Item2)
 
void DoSort (INT iColumn, BOOL bAscendant=TRUE)
 
void LV_AddItems (HWND hwnd)
 
BOOL DoLoadItems (void)
 
BOOL DoLoad (void)
 
void LV_InvalidateRow (HWND hwnd, INT iRow=-1)
 
BOOL LV_Init (HWND hwnd)
 
BOOL EditDlg_OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
 
void LV_OnDelete (HWND hwnd, INT iRow=-1)
 
void EditDlg_OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
 
INT_PTR CALLBACK EditDlg_DlgProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
void LV_OnDblClk (HWND hwnd)
 
BOOL MainWnd_OnCreate (HWND hwnd, LPCREATESTRUCT lpCreateStruct)
 
BOOL AddDlg_OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
 
void AddDlg_OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
 
INT_PTR CALLBACK AddDlg_DlgProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
void MainWnd_OnNew (HWND hwnd)
 
BOOL MainWnd_OnUpdateRegistry (HWND hwnd)
 
LPWSTR SkipSpace (LPCWSTR pch)
 
LPWSTR SkipQuoted (LPWSTR pch)
 
void UnescapeHex (const STRING &str, size_t &i, STRING &Ret, BOOL Unicode)
 
void UnescapeOther (const STRING &str, size_t &i, STRING &Ret)
 
void UnescapeChar (const STRING &str, size_t &i, STRING &Ret)
 
STRING Unquote (const STRING &str)
 
BOOL DoParseFile (LPVOID pvContents, DWORD dwSize)
 
BOOL DoImport (HWND hwnd, LPCWSTR pszFile)
 
STRING Escape (const STRING &str)
 
BOOL DoExport (HWND hwnd, LPCWSTR pszFile)
 
void MakeFilter (LPWSTR pszFilter)
 
void MainWnd_OnImport (HWND hwnd)
 
void MainWnd_OnExport (HWND hwnd)
 
void MainWnd_OnReload (HWND hwnd)
 
void MainWnd_OnEdit (HWND hwnd)
 
void MainWnd_OnDelete (HWND hwnd)
 
void MainWnd_OnOpenRegKey (HWND hwnd)
 
void MainWnd_OnAbout (HWND hwnd)
 
void MainWnd_OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
 
void MainWnd_OnDestroy (HWND hwnd)
 
void MainWnd_OnSize (HWND hwnd, UINT state, int cx, int cy)
 
void MainWnd_OnDrawItem (HWND hwnd, const DRAWITEMSTRUCT *lpDrawItem)
 
void MainWnd_OnMeasureItem (HWND hwnd, MEASUREITEMSTRUCT *lpMeasureItem)
 
LRESULT MainWnd_OnNotify (HWND hwnd, int idFrom, NMHDR *pnmhdr)
 
LRESULT MainWnd_OnContextMenu (HWND hwnd, HWND hwndContext, UINT xPos, UINT yPos)
 
void MainWnd_OnActivate (HWND hwnd, UINT state, HWND hwndActDeact, BOOL fMinimized)
 
BOOL EnableProcessPrivileges (LPCWSTR lpPrivilegeName, BOOL bEnable=TRUE)
 
void MainWnd_OnClose (HWND hwnd)
 
LRESULT CALLBACK WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
INT WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, INT nCmdShow)
 

Variables

HINSTANCE g_hInstance = NULL
 
HWND g_hMainWnd = NULL
 
HICON g_hIcon = NULL
 
HWND g_hListView = NULL
 
BOOL g_bModified = FALSE
 
BOOL g_bNeedsReboot = FALSE
 
INT g_iItem = 0
 
LPCWSTR g_pszClassName = L"ReactOS Font Substitutes Editor"
 
LPCWSTR g_pszFileHeader = L"Windows Registry Editor Version 5.00"
 
WCHAR g_szTitle [MAX_STRING]
 
WCHAR g_szNameHead [MAX_STRING]
 
WCHAR g_szSubstituteHead [MAX_STRING]
 
INT g_iSortColumn = 0
 
BOOL g_bSortAscendant = TRUE
 
LPCWSTR g_pszKey
 
FONTNAMESET g_Names
 
ITEMVECTOR g_Items
 
STRING g_strFontName
 
STRING g_strSubstitute
 
BYTE g_CharSet1 = DEFAULT_CHARSET
 
BYTE g_CharSet2 = DEFAULT_CHARSET
 
CHARSET_ENTRY g_CharSetList []
 
const WCHAR g_LongestName [] = L"CHINESEBIG5_CHARSET (136)"
 

Macro Definition Documentation

◆ _countof

#define _countof (   array)    (sizeof(array) / sizeof(array[0]))

Definition at line 30 of file fontsub.cpp.

◆ MAX_STRING

#define MAX_STRING   120

Definition at line 27 of file fontsub.cpp.

◆ NAME_COLUMN_WIDTH

#define NAME_COLUMN_WIDTH   250

Definition at line 25 of file fontsub.cpp.

◆ SUB_COLUMN_WIDTH

#define SUB_COLUMN_WIDTH   250

Definition at line 26 of file fontsub.cpp.

Typedef Documentation

◆ CHARSET_ENTRY

◆ FONTNAMESET

typedef std::set<STRING> FONTNAMESET

Definition at line 67 of file fontsub.cpp.

◆ ITEMVECTOR

typedef std::vector<ITEM> ITEMVECTOR

Definition at line 68 of file fontsub.cpp.

◆ STRING

typedef std::wstring STRING

Definition at line 33 of file fontsub.cpp.

Function Documentation

◆ AddDlg_DlgProc()

INT_PTR CALLBACK AddDlg_DlgProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 696 of file fontsub.cpp.

697{
698 switch (uMsg)
699 {
702 }
703 return 0;
704}
void AddDlg_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
Definition: fontsub.cpp:611
BOOL AddDlg_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
Definition: fontsub.cpp:554
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define HANDLE_MSG(hwnd, message, fn)
Definition: windowsx.h:322
#define WM_COMMAND
Definition: winuser.h:1740
#define WM_INITDIALOG
Definition: winuser.h:1739

Referenced by MainWnd_OnNew().

◆ AddDlg_OnCommand()

void AddDlg_OnCommand ( HWND  hwnd,
int  id,
HWND  hwndCtl,
UINT  codeNotify 
)

Definition at line 611 of file fontsub.cpp.

612{
613 WCHAR szKey[MAX_STRING], szValue[MAX_STRING], sz[MAX_STRING];
614 INT i, iCharSet1, iCharSet2;
615 BYTE CharSet1, CharSet2;
617 switch (id)
618 {
619 case IDOK:
620 GetDlgItemTextW(hwnd, cmb1, szKey, _countof(szKey));
621 key = szKey;
622 trim(key);
624 if (key.empty() || key == sz)
625 {
630 return;
631 }
632
633 GetDlgItemTextW(hwnd, cmb2, szValue, _countof(szValue));
634 value = szValue;
635 trim(value);
636 if (value.empty())
637 {
642 return;
643 }
644
645 iCharSet1 = SendDlgItemMessageW(hwnd, cmb3, CB_GETCURSEL, 0, 0);
646 if (iCharSet1 == CB_ERR)
647 iCharSet1 = 0;
648 iCharSet2 = SendDlgItemMessageW(hwnd, cmb4, CB_GETCURSEL, 0, 0);
649 if (iCharSet2 == CB_ERR)
650 iCharSet2 = 0;
651
652 CharSet1 = g_CharSetList[iCharSet1].CharSet;
653 CharSet2 = g_CharSetList[iCharSet2].CharSet;
654
655 for (i = 0; i < (INT)g_Items.size(); ++i)
656 {
657 if (g_Items[i].m_Name == key &&
658 g_Items[i].m_CharSet1 == CharSet1)
659 {
660 WCHAR sz[MAX_STRING];
665 return;
666 }
667 }
668 {
669 ITEM Item(key, value, CharSet1, CharSet2);
670 g_Items.push_back(Item);
672
673 i = (INT)g_Items.size();
674 LV_ITEM LvItem;
675 ZeroMemory(&LvItem, sizeof(LvItem));
676 LvItem.mask = LVIF_PARAM;
677 LvItem.iItem = i;
678 LvItem.lParam = i;
679
680 LvItem.iSubItem = 0;
682
683 LvItem.iSubItem = 1;
685 }
688 break;
689 case IDCANCEL:
691 break;
692 }
693}
#define cmb1
Definition: dlgs.h:48
#define cmb3
Definition: dlgs.h:50
#define cmb4
Definition: dlgs.h:51
#define cmb2
Definition: dlgs.h:49
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
CHARSET_ENTRY g_CharSetList[]
Definition: fontsub.cpp:83
std::wstring STRING
Definition: fontsub.cpp:33
#define _countof(array)
Definition: fontsub.cpp:30
HWND g_hListView
Definition: fontsub.cpp:49
BOOL g_bModified
Definition: fontsub.cpp:50
ITEMVECTOR g_Items
Definition: fontsub.cpp:71
static void trim(STRING &str)
Definition: fontsub.cpp:107
#define MAX_STRING
Definition: fontsub.cpp:27
HINSTANCE g_hInstance
Definition: fontsub.cpp:46
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define IDS_ALREADYEXISTS
Definition: resource.h:35
#define IDS_ENTERNAME
Definition: resource.h:27
#define IDS_ENTERNAME2
Definition: resource.h:36
#define INT
Definition: polytest.cpp:20
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2408
#define LVIF_PARAM
Definition: commctrl.h:2311
#define LV_ITEM
Definition: commctrl.h:2337
BYTE CharSet
Definition: fontsub.cpp:79
Definition: fontsub.cpp:36
Definition: copy.c:22
int32_t INT
Definition: typedefs.h:58
Definition: pdh_main.c:94
_In_ WDFCOLLECTION _In_ WDFOBJECT Item
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
#define ZeroMemory
Definition: winbase.h:1712
#define MAKELPARAM(l, h)
Definition: winuser.h:4008
#define IDCANCEL
Definition: winuser.h:831
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define CB_ERR
Definition: winuser.h:2435
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:830
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MB_ICONERROR
Definition: winuser.h:787
HWND WINAPI SetFocus(_In_opt_ HWND)
#define CB_SETEDITSEL
Definition: winuser.h:1963
#define CB_GETCURSEL
Definition: winuser.h:1943
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char BYTE
Definition: xxhash.c:193

Referenced by AddDlg_DlgProc().

◆ AddDlg_OnInitDialog()

BOOL AddDlg_OnInitDialog ( HWND  hwnd,
HWND  hwndFocus,
LPARAM  lParam 
)

Definition at line 554 of file fontsub.cpp.

555{
557 ZeroMemory(&Item, sizeof(Item));
558 Item.iItem = -1;
559 Item.mask = CBEIF_TEXT;
560
561 FONTNAMESET::iterator it, end = g_Names.end();
562 for (it = g_Names.begin(); it != end; ++it)
563 {
564 Item.pszText = const_cast<LPWSTR>(it->c_str());
569 }
570 WCHAR szEnterName[MAX_STRING];
571 LoadStringW(g_hInstance, IDS_ENTERNAME, szEnterName, _countof(szEnterName));
572 SetDlgItemTextW(hwnd, cmb1, szEnterName);
574
576 for (INT i = 0; i < Count; ++i)
577 {
578 Item.pszText = const_cast<LPWSTR>(g_CharSetList[i].DisplayName);
583 }
584
587 for (INT i = 0; i < Count; ++i)
588 {
590 {
592 }
594 {
596 }
597 }
598
599 SIZE siz;
603 DeleteDC(hDC);
604
607
608 return TRUE;
609}
static HDC hDC
Definition: 3dtext.c:33
#define lstrlenW
Definition: compat.h:750
static void CharSet(RTF_Info *info)
Definition: reader.c:2420
BYTE g_CharSet2
Definition: fontsub.cpp:75
BYTE g_CharSet1
Definition: fontsub.cpp:74
FONTNAMESET g_Names
Definition: fontsub.cpp:70
const WCHAR g_LongestName[]
Definition: fontsub.cpp:105
GLuint GLuint end
Definition: gl.h:1545
static HDC
Definition: imagelist.c:92
int Count
Definition: noreturn.cpp:7
#define CBEIF_TEXT
Definition: commctrl.h:3786
#define CBEM_INSERTITEM
Definition: commctrl.h:3845
LPCWSTR DisplayName
Definition: fontsub.cpp:80
LONG cx
Definition: kdterminal.h:27
LONG_PTR LPARAM
Definition: windef.h:208
#define ComboBox_GetCount(hwndCtl)
Definition: windowsx.h:48
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define DEFAULT_GUI_FONT
Definition: wingdi.h:909
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI DeleteDC(_In_ HDC)
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
#define CB_SETHORIZONTALEXTENT
Definition: winuser.h:1965
#define CB_SETCURSEL
Definition: winuser.h:1961
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by AddDlg_DlgProc().

◆ DoExport()

BOOL DoExport ( HWND  hwnd,
LPCWSTR  pszFile 
)

Definition at line 1048 of file fontsub.cpp.

1049{
1054 return FALSE;
1055
1056 BOOL bSuccess;
1057 DWORD dwSize, cbWritten;
1058 WCHAR szCharSet1[MAX_STRING], szCharSet2[MAX_STRING];
1059 WCHAR szLine[MAX_STRING * 2 + 4];
1060
1061 /* write header */
1062 dwSize = lstrlenW(g_pszFileHeader) * sizeof(WCHAR);
1063 bSuccess =
1064 WriteFile(hFile, "\xFF\xFE", 2, &cbWritten, NULL) &&
1065 WriteFile(hFile, g_pszFileHeader, dwSize, &cbWritten, NULL);
1066 if (bSuccess)
1067 {
1068 wsprintfW(szLine, L"\r\n\r\n[HKEY_LOCAL_MACHINE\\%s]\r\n", g_pszKey);
1069 dwSize = lstrlenW(szLine) * sizeof(WCHAR);
1070 bSuccess = WriteFile(hFile, szLine, dwSize, &cbWritten, NULL);
1071 }
1072 if (bSuccess)
1073 {
1074 size_t i, Count = g_Items.size();
1075 for (i = 0; i < Count; ++i)
1076 {
1077 if (g_Items[i].m_CharSet1 != DEFAULT_CHARSET)
1078 wsprintfW(szCharSet1, L",%u", g_Items[i].m_CharSet1);
1079 else
1080 szCharSet1[0] = UNICODE_NULL;
1081
1082 if (g_Items[i].m_CharSet2 != DEFAULT_CHARSET)
1083 wsprintfW(szCharSet2, L",%u", g_Items[i].m_CharSet2);
1084 else
1085 szCharSet2[0] = UNICODE_NULL;
1086
1087 STRING Name = Escape(g_Items[i].m_Name);
1088 STRING Substitute = Escape(g_Items[i].m_Substitute);
1089 wsprintfW(szLine, L"\"%s%s\"=\"%s%s\"\r\n",
1090 Name.c_str(), szCharSet1,
1091 Substitute.c_str(), szCharSet2);
1092
1093 dwSize = lstrlenW(szLine) * sizeof(WCHAR);
1094 if (!WriteFile(hFile, szLine, dwSize, &cbWritten, NULL))
1095 {
1096 bSuccess = FALSE;
1097 break;
1098 }
1099 }
1100 WriteFile(hFile, L"\r\n", 2 * sizeof(WCHAR), &cbWritten, NULL);
1101 }
1103
1104 if (!bSuccess)
1105 {
1106 DeleteFileW(pszFile);
1107 }
1108
1109 return bSuccess;
1110}
static VOID Substitute(_Out_writes_bytes_(BufferSize) PWCHAR Buffer, _In_ ULONG BufferSize, _In_ PCWSTR Template, _In_ PCWSTR SystemDriveName, _In_ PCWSTR SystemRootName)
Definition: IoFilesystem.c:231
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define FILE_SHARE_READ
Definition: compat.h:136
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
static BOOLEAN bSuccess
Definition: drive.cpp:433
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
STRING Escape(const STRING &str)
Definition: fontsub.cpp:1030
LPCWSTR g_pszFileHeader
Definition: fontsub.cpp:55
LPCWSTR g_pszKey
Definition: fontsub.cpp:64
#define CREATE_ALWAYS
Definition: disk.h:72
#define FILE_FLAG_WRITE_THROUGH
Definition: disk.h:47
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
_In_ HANDLE hFile
Definition: mswsock.h:90
#define GENERIC_WRITE
Definition: nt_native.h:90
#define UNICODE_NULL
#define L(x)
Definition: ntvdm.h:50
#define DEFAULT_CHARSET
Definition: wingdi.h:384
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)

Referenced by MainWnd_OnExport().

◆ DoImport()

BOOL DoImport ( HWND  hwnd,
LPCWSTR  pszFile 
)

Definition at line 997 of file fontsub.cpp.

998{
1003 return FALSE;
1004
1007 if (dwSize != 0xFFFFFFFF)
1008 {
1009 std::vector<BYTE> Contents(dwSize + 2);
1010 DWORD cbRead;
1011 if (ReadFile(hFile, &Contents[0], dwSize, &cbRead, NULL) &&
1012 cbRead == dwSize)
1013 {
1014 /* check BOM */
1015 if (memcmp(&Contents[0], "\xFF\xFE", 2) == 0)
1016 {
1017 bSuccess = DoParseFile(&Contents[2], dwSize - 2);
1018 }
1019 else
1020 {
1021 bSuccess = DoParseFile(&Contents[0], dwSize);
1022 }
1023 }
1024 }
1026
1027 return bSuccess;
1028}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define OPEN_EXISTING
Definition: compat.h:775
#define ReadFile(a, b, c, d, e)
Definition: compat.h:742
#define GENERIC_READ
Definition: compat.h:135
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:331
BOOL DoParseFile(LPVOID pvContents, DWORD dwSize)
Definition: fontsub.cpp:915
#define FILE_FLAG_SEQUENTIAL_SCAN
Definition: disk.h:43
#define FILE_SHARE_DELETE
Definition: nt_native.h:682

Referenced by MainWnd_OnImport().

◆ DoLoad()

BOOL DoLoad ( void  )

Definition at line 310 of file fontsub.cpp.

311{
312 return DoLoadNames() && DoLoadItems();
313}
BOOL DoLoadItems(void)
Definition: fontsub.cpp:256
BOOL DoLoadNames(void)
Definition: fontsub.cpp:145

Referenced by MainWnd_OnCreate(), and MainWnd_OnReload().

◆ DoLoadItems()

BOOL DoLoadItems ( void  )

Definition at line 256 of file fontsub.cpp.

257{
258 ITEMVECTOR Items;
259
260 HKEY hKey = NULL;
262 if (hKey == NULL)
263 return FALSE;
264
266 DWORD cbName, cbValue;
267 for (DWORD dwIndex = 0; ; ++dwIndex)
268 {
269 cbName = sizeof(szName);
270 cbValue = sizeof(szValue);
271 LONG Error = RegEnumValueW(hKey, dwIndex, szName, &cbName,
272 NULL, NULL, (LPBYTE)szValue, &cbValue);
273 if (Error != ERROR_SUCCESS)
274 break;
275
276 BYTE CharSet1 = DEFAULT_CHARSET, CharSet2 = DEFAULT_CHARSET;
277 LPWSTR pch;
278
279 pch = wcsrchr(szName, L',');
280 if (pch)
281 {
282 *pch = 0;
283 CharSet1 = (BYTE)_wtoi(pch + 1);
284 }
285
286 pch = wcsrchr(szValue, L',');
287 if (pch)
288 {
289 *pch = 0;
290 CharSet2 = (BYTE)_wtoi(pch + 1);
291 }
292
293 ITEM Item(szName, szValue, CharSet1, CharSet2);
294 trim(Item.m_Name);
295 trim(Item.m_Substitute);
296 Items.push_back(Item);
297 }
298
300
301 g_Items = Items;
303 DoSort(0, TRUE);
306
307 return !g_Items.empty();
308}
BOOL Error
Definition: chkdsk.c:66
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
Definition: reg.c:2830
#define wcsrchr
Definition: compat.h:16
void DoSort(INT iColumn, BOOL bAscendant=TRUE)
Definition: fontsub.cpp:180
void LV_AddItems(HWND hwnd)
Definition: fontsub.cpp:233
BOOL g_bNeedsReboot
Definition: fontsub.cpp:51
std::vector< ITEM > ITEMVECTOR
Definition: fontsub.cpp:68
FxAutoRegKey hKey
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
#define pch(ap)
Definition: match.c:418
#define KEY_READ
Definition: nt_native.h:1023
long LONG
Definition: pedump.c:60
static const WCHAR szName[]
Definition: powrprof.c:45
unsigned char * LPBYTE
Definition: typedefs.h:53
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by DoLoad().

◆ DoLoadNames()

BOOL DoLoadNames ( void  )

Definition at line 145 of file fontsub.cpp.

146{
147 g_Names.clear();
148
149 LOGFONTW lf;
150 ZeroMemory(&lf, sizeof(lf));
152
155 DeleteDC(hDC);
156
157 return !g_Names.empty();
158}
static int CALLBACK EnumFontFamExProc(const ENUMLOGFONTW *pelf, const NEWTEXTMETRICW *pntm, int FontType, LPARAM lParam)
Definition: fontsub.cpp:123
BYTE lfCharSet
Definition: dimm.idl:67
int WINAPI EnumFontFamiliesExW(_In_ HDC, _In_ PLOGFONTW, _In_ FONTENUMPROCW, _In_ LPARAM, _In_ DWORD)
FARPROC FONTENUMPROCW
Definition: wingdi.h:2897

Referenced by DoLoad().

◆ DoParseFile()

BOOL DoParseFile ( LPVOID  pvContents,
DWORD  dwSize 
)

Definition at line 915 of file fontsub.cpp.

916{
917 ITEMVECTOR Items;
918
919 LPWSTR pch, pchSep, pchStart = (LPWSTR)pvContents;
920
921 pchStart[dwSize / sizeof(WCHAR)] = UNICODE_NULL;
922
923 // check header
924 const DWORD cbHeader = lstrlenW(g_pszFileHeader) * sizeof(WCHAR);
925 if (memcmp(pchStart, g_pszFileHeader, cbHeader) != 0)
926 return FALSE;
927
928 pchStart += cbHeader / sizeof(WCHAR);
929
930 // find the key
931 WCHAR szKey[MAX_STRING];
932 wsprintfW(szKey, L"[HKEY_LOCAL_MACHINE\\%s]", g_pszKey);
933 pch = wcsstr(pchStart, szKey);
934 if (pch == NULL)
935 return FALSE;
936
937 pchStart = pch + lstrlenW(szKey);
938
939 for (;;)
940 {
941 pchStart = SkipSpace(pchStart);
942 if (*pchStart == UNICODE_NULL || *pchStart == L'[')
943 break;
944
945 pch = wcschr(pchStart, L'\n');
946 if (pch)
947 *pch = UNICODE_NULL;
948
949 pchSep = SkipQuoted(pchStart);
950 if (*pchSep == L'=')
951 {
952 *pchSep = UNICODE_NULL;
953
954 STRING key = pchStart;
955 trim(key);
956 key = Unquote(key);
957
958 STRING value = pchSep + 1;
959 trim(value);
961
962 BYTE CharSet1 = DEFAULT_CHARSET, CharSet2 = DEFAULT_CHARSET;
963
964 size_t pos;
965 pos = key.find(L',');
966 if (pos != STRING::npos)
967 {
968 CharSet1 = (BYTE)_wtoi(&key[pos + 1]);
969 key.resize(pos);
970 trim(key);
971 }
972 pos = value.find(L',');
973 if (pos != STRING::npos)
974 {
975 CharSet2 = (BYTE)_wtoi(&value[pos + 1]);
976 value.resize(pos);
977 trim(value);
978 }
979
980 ITEM Item(key, value, CharSet1, CharSet2);
981 Items.push_back(Item);
982 }
983
984 if (pch == NULL)
985 break;
986
987 pchStart = pch + 1;
988 }
989
990 g_Items = Items;
992
994 return TRUE;
995}
#define wcschr
Definition: compat.h:17
LPWSTR SkipQuoted(LPWSTR pch)
Definition: fontsub.cpp:776
STRING Unquote(const STRING &str)
Definition: fontsub.cpp:898
LPWSTR SkipSpace(LPCWSTR pch)
Definition: fontsub.cpp:767
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)

Referenced by DoImport().

◆ DoSort()

void DoSort ( INT  iColumn,
BOOL  bAscendant = TRUE 
)

Definition at line 180 of file fontsub.cpp.

181{
182 LV_COLUMN Column;
183 ZeroMemory(&Column, sizeof(Column));
184 Column.mask = LVCF_IMAGE | LVCF_SUBITEM;
185 Column.iImage = 2;
186 Column.iSubItem = 0;
187 ListView_SetColumn(g_hListView, 0, &Column);
188 Column.iSubItem = 1;
189 ListView_SetColumn(g_hListView, 1, &Column);
190
191 switch (iColumn)
192 {
193 case 0:
194 Column.iSubItem = 0;
195 if (bAscendant)
196 {
197 std::sort(g_Items.begin(), g_Items.end(),
199 Column.iImage = 0;
200 ListView_SetColumn(g_hListView, 0, &Column);
201 }
202 else
203 {
204 std::sort(g_Items.begin(), g_Items.end(),
206 Column.iImage = 1;
207 ListView_SetColumn(g_hListView, 0, &Column);
208 }
209 break;
210 case 1:
211 Column.iSubItem = 1;
212 if (bAscendant)
213 {
214 std::sort(g_Items.begin(), g_Items.end(),
216 Column.iImage = 0;
217 ListView_SetColumn(g_hListView, 1, &Column);
218 }
219 else
220 {
221 std::sort(g_Items.begin(), g_Items.end(),
223 Column.iImage = 1;
224 ListView_SetColumn(g_hListView, 1, &Column);
225 }
226 break;
227 }
228 g_iSortColumn = iColumn;
229 g_bSortAscendant = bAscendant;
231}
INT g_iSortColumn
Definition: fontsub.cpp:61
bool ItemCompareByNameDescend(const ITEM &Item1, const ITEM &Item2)
Definition: fontsub.cpp:165
bool ItemCompareBySubAscend(const ITEM &Item1, const ITEM &Item2)
Definition: fontsub.cpp:170
bool ItemCompareByNameAscend(const ITEM &Item1, const ITEM &Item2)
Definition: fontsub.cpp:160
bool ItemCompareBySubDescend(const ITEM &Item1, const ITEM &Item2)
Definition: fontsub.cpp:175
BOOL g_bSortAscendant
Definition: fontsub.cpp:62
#define LVCF_IMAGE
Definition: commctrl.h:2590
#define LVCF_SUBITEM
Definition: commctrl.h:2589
#define ListView_SetColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2629
#define LV_COLUMN
Definition: commctrl.h:2547
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)

Referenced by DoLoadItems(), and MainWnd_OnNotify().

◆ EditDlg_DlgProc()

INT_PTR CALLBACK EditDlg_DlgProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 505 of file fontsub.cpp.

506{
507 switch (uMsg)
508 {
511 }
512 return 0;
513}
void EditDlg_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
Definition: fontsub.cpp:461
BOOL EditDlg_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
Definition: fontsub.cpp:380

Referenced by LV_OnDblClk().

◆ EditDlg_OnCommand()

void EditDlg_OnCommand ( HWND  hwnd,
int  id,
HWND  hwndCtl,
UINT  codeNotify 
)

Definition at line 461 of file fontsub.cpp.

462{
463 WCHAR szValue[MAX_STRING];
464 STRING str;
465 INT i;
466
467 switch (id)
468 {
469 case IDOK:
470 GetDlgItemTextW(hwnd, cmb2, szValue, _countof(szValue));
471 str = szValue;
472 trim(str);
473 if (str.empty())
474 {
475 WCHAR sz[MAX_STRING];
480 return;
481 }
482
483 g_Items[g_iItem].m_CharSet2 = DEFAULT_CHARSET;
485 if (i != CB_ERR)
486 {
487 g_Items[g_iItem].m_CharSet2 = g_CharSetList[i].CharSet;
488 }
489 g_Items[g_iItem].m_Substitute = str;
490
493 break;
494 case IDCANCEL:
496 break;
497 case psh1:
500 break;
501 }
502}
#define psh1
Definition: dlgs.h:112
INT g_iItem
Definition: fontsub.cpp:52
void LV_OnDelete(HWND hwnd, INT iRow=-1)
Definition: fontsub.cpp:434
const WCHAR * str

Referenced by EditDlg_DlgProc().

◆ EditDlg_OnInitDialog()

BOOL EditDlg_OnInitDialog ( HWND  hwnd,
HWND  hwndFocus,
LPARAM  lParam 
)

Definition at line 380 of file fontsub.cpp.

381{
383 ZeroMemory(&Item, sizeof(Item));
384 Item.mask = CBEIF_TEXT;
385
386 FONTNAMESET::iterator it, end = g_Names.end();
387 for (it = g_Names.begin(); it != end; ++it)
388 {
389 Item.pszText = const_cast<LPWSTR>(it->c_str());
392 }
395
397 for (INT i = 0; i < Count; ++i)
398 {
399 Item.pszText = const_cast<LPWSTR>(g_CharSetList[i].DisplayName);
404 }
405
408 for (INT i = 0; i < Count; ++i)
409 {
411 {
413 }
415 {
417 }
418 }
419
420 SIZE siz;
424 DeleteDC(hDC);
425
428
430
431 return TRUE;
432}
#define edt1
Definition: dlgs.h:65
STRING g_strSubstitute
Definition: fontsub.cpp:73
STRING g_strFontName
Definition: fontsub.cpp:72
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)

Referenced by EditDlg_DlgProc().

◆ EnableProcessPrivileges()

BOOL EnableProcessPrivileges ( LPCWSTR  lpPrivilegeName,
BOOL  bEnable = TRUE 
)

Definition at line 1443 of file fontsub.cpp.

1444{
1445 HANDLE hToken;
1446 LUID luid;
1447 TOKEN_PRIVILEGES tokenPrivileges;
1448 BOOL Ret;
1449
1452 &hToken);
1453 if (!Ret)
1454 return Ret; // failure
1455
1456 Ret = ::LookupPrivilegeValueW(NULL, lpPrivilegeName, &luid);
1457 if (Ret)
1458 {
1459 tokenPrivileges.PrivilegeCount = 1;
1460 tokenPrivileges.Privileges[0].Luid = luid;
1461 tokenPrivileges.Privileges[0].Attributes = bEnable ? SE_PRIVILEGE_ENABLED : 0;
1462
1463 Ret = ::AdjustTokenPrivileges(hToken, FALSE, &tokenPrivileges, 0, 0, 0);
1464 }
1465
1466 ::CloseHandle(hToken);
1467 return Ret;
1468}
BOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName, LPCWSTR lpPrivilegeName, PLUID lpLuid)
Definition: misc.c:782
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
Definition: security.c:374
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:294
#define GetCurrentProcess()
Definition: compat.h:759
$ULONG PrivilegeCount
Definition: setypes.h:1023
LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]
Definition: setypes.h:1024
_In_ BOOL bEnable
Definition: winddi.h:3426
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:930
#define TOKEN_QUERY
Definition: setypes.h:928
#define SE_PRIVILEGE_ENABLED
Definition: setypes.h:63

Referenced by MainWnd_OnClose(), and PropSheetProc().

◆ EnumFontFamExProc()

static int CALLBACK EnumFontFamExProc ( const ENUMLOGFONTW pelf,
const NEWTEXTMETRICW pntm,
int  FontType,
LPARAM  lParam 
)
static

Definition at line 123 of file fontsub.cpp.

127{
128 switch (pelf->elfFullName[0])
129 {
130 case UNICODE_NULL: case L'@':
131 break;
132 default:
133 g_Names.insert((const WCHAR *)pelf->elfFullName);
134 }
135 switch (pelf->elfLogFont.lfFaceName[0])
136 {
137 case UNICODE_NULL: case L'@':
138 break;
139 default:
140 g_Names.insert(pelf->elfLogFont.lfFaceName);
141 }
142 return 1;
143}
LOGFONTW elfLogFont
Definition: wingdi.h:2691
WCHAR elfFullName[LF_FULLFACESIZE]
Definition: wingdi.h:2692
WCHAR lfFaceName[LF_FACESIZE]
Definition: wingdi.h:1910

Referenced by DoLoadNames().

◆ Escape()

STRING Escape ( const STRING str)

Definition at line 1030 of file fontsub.cpp.

1031{
1032 STRING Ret;
1033 for (size_t i = 0; i < str.size(); ++i)
1034 {
1035 switch (str[i])
1036 {
1037 case L'"': case L'\\':
1038 Ret += L'\\';
1039 Ret += str[i];
1040 break;
1041 default:
1042 Ret += str[i];
1043 }
1044 }
1045 return Ret;
1046}

Referenced by add_mf_comment(), DECLARE_INTERFACE_(), DoExport(), IntGdiEscape(), NtGdiEscape(), NtGdiExtEscape(), PlayMetaFileRecord(), print_something(), and test_pscript_printer_dc().

◆ ItemCompareByNameAscend()

bool ItemCompareByNameAscend ( const ITEM Item1,
const ITEM Item2 
)
inline

Definition at line 160 of file fontsub.cpp.

161{
162 return Item1.m_Name < Item2.m_Name;
163}
STRING m_Name
Definition: fontsub.cpp:37

Referenced by DoSort().

◆ ItemCompareByNameDescend()

bool ItemCompareByNameDescend ( const ITEM Item1,
const ITEM Item2 
)
inline

Definition at line 165 of file fontsub.cpp.

166{
167 return Item1.m_Name > Item2.m_Name;
168}

Referenced by DoSort().

◆ ItemCompareBySubAscend()

bool ItemCompareBySubAscend ( const ITEM Item1,
const ITEM Item2 
)
inline

Definition at line 170 of file fontsub.cpp.

171{
172 return Item1.m_Substitute < Item2.m_Substitute;
173}
STRING m_Substitute
Definition: fontsub.cpp:37

Referenced by DoSort().

◆ ItemCompareBySubDescend()

bool ItemCompareBySubDescend ( const ITEM Item1,
const ITEM Item2 
)
inline

Definition at line 175 of file fontsub.cpp.

176{
177 return Item1.m_Substitute > Item2.m_Substitute;
178}

Referenced by DoSort().

◆ LV_AddItems()

void LV_AddItems ( HWND  hwnd)

Definition at line 233 of file fontsub.cpp.

234{
236
238 ZeroMemory(&Item, sizeof(Item));
239 Item.mask = LVIF_PARAM;
240
241 const INT Count = INT(g_Items.size());
242 for (INT i = 0; i < Count; ++i)
243 {
244 Item.iItem = i;
245 Item.iSubItem = 0;
246 Item.lParam = i;
248
249 Item.iItem = i;
250 Item.iSubItem = 1;
251 Item.lParam = i;
253 }
254}
#define ListView_DeleteAllItems(hwnd)
Definition: commctrl.h:2414

Referenced by DoLoadItems(), and DoParseFile().

◆ LV_Init()

BOOL LV_Init ( HWND  hwnd)

Definition at line 328 of file fontsub.cpp.

329{
332
333 HIMAGELIST hImageList;
334 hImageList = ImageList_Create(12, 12, ILC_COLOR8 | ILC_MASK, 2, 2);
335
336 HBITMAP hbm;
339 assert(hbm);
340 ImageList_AddMasked(hImageList, hbm, RGB(192, 192, 192));
342
345 assert(hbm);
346 ImageList_AddMasked(hImageList, hbm, RGB(192, 192, 192));
348
351 assert(hbm);
352 ImageList_AddMasked(hImageList, hbm, RGB(192, 192, 192));
354
356
357 LV_COLUMNW Column;
358 ZeroMemory(&Column, sizeof(Column));
360 Column.fmt = LVCFMT_LEFT;
361
362 Column.cx = NAME_COLUMN_WIDTH;
363 Column.pszText = g_szNameHead;
364 Column.iSubItem = 0;
365 Column.iImage = 0;
366 ListView_InsertColumn(hwnd, 0, &Column);
367
368 Column.cx = SUB_COLUMN_WIDTH;
369 Column.pszText = g_szSubstituteHead;
370 Column.iSubItem = 1;
371 Column.iImage = 2;
372 ListView_InsertColumn(hwnd, 1, &Column);
373
376
377 return TRUE;
378}
INT WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
Definition: imagelist.c:563
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
#define assert(x)
Definition: debug.h:53
#define RGB(r, g, b)
Definition: precomp.h:71
#define SUB_COLUMN_WIDTH
Definition: fontsub.cpp:26
WCHAR g_szSubstituteHead[MAX_STRING]
Definition: fontsub.cpp:59
WCHAR g_szNameHead[MAX_STRING]
Definition: fontsub.cpp:58
#define NAME_COLUMN_WIDTH
Definition: fontsub.cpp:25
pKey DeleteObject()
static HBITMAP
Definition: button.c:44
unsigned int UINT
Definition: ndis.h:50
_In_ HBITMAP hbm
Definition: ntgdi.h:2776
#define LVSIL_SMALL
Definition: commctrl.h:2299
#define ListView_SetItemState(hwndLV, i, data, mask)
Definition: commctrl.h:2673
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2636
#define LVS_EX_GRIDLINES
Definition: commctrl.h:2729
#define ListView_SetImageList(hwnd, himl, iImageList)
Definition: commctrl.h:2304
#define ILC_COLOR8
Definition: commctrl.h:355
#define LVCF_WIDTH
Definition: commctrl.h:2587
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2734
#define ListView_SetExtendedListViewStyle(hwndLV, dw)
Definition: commctrl.h:2725
#define LVIS_SELECTED
Definition: commctrl.h:2319
#define LV_COLUMNW
Definition: commctrl.h:2546
#define LVCF_FMT
Definition: commctrl.h:2586
#define LVCFMT_LEFT
Definition: commctrl.h:2598
#define ILC_MASK
Definition: commctrl.h:351
#define LVCF_TEXT
Definition: commctrl.h:2588
#define LVIS_FOCUSED
Definition: commctrl.h:2318
#define IMAGE_BITMAP
Definition: winuser.h:211
#define LR_CREATEDIBSECTION
Definition: winuser.h:1098
#define LoadImage
Definition: winuser.h:5815
#define LR_LOADMAP3DCOLORS
Definition: winuser.h:1097
#define MAKEINTRESOURCE
Definition: winuser.h:591

Referenced by MainWnd_OnCreate().

◆ LV_InvalidateRow()

void LV_InvalidateRow ( HWND  hwnd,
INT  iRow = -1 
)

Definition at line 315 of file fontsub.cpp.

316{
317 if (iRow == -1)
319 if (iRow == -1)
320 return;
321
322 RECT Rect;
323 LPRECT GccIsWhining = &Rect;
324 ListView_GetItemRect(hwnd, iRow, GccIsWhining, LVIR_BOUNDS);
326}
#define ListView_GetItemRect(hwnd, i, prc, code)
Definition: commctrl.h:2478
#define LVNI_SELECTED
Definition: commctrl.h:2424
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2434
#define LVIR_BOUNDS
Definition: commctrl.h:2472

◆ LV_OnDblClk()

void LV_OnDblClk ( HWND  hwnd)

Definition at line 515 of file fontsub.cpp.

516{
518 if (g_iItem == -1)
519 return;
520
521 g_strFontName = g_Items[g_iItem].m_Name;
522 g_strSubstitute = g_Items[g_iItem].m_Substitute;
523 g_CharSet1 = g_Items[g_iItem].m_CharSet1;
524 g_CharSet2 = g_Items[g_iItem].m_CharSet2;
525
529}
HWND g_hMainWnd
Definition: fontsub.cpp:47
INT_PTR CALLBACK EditDlg_DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: fontsub.cpp:505
#define IDD_EDIT
Definition: resource.h:22
#define DialogBox
Definition: winuser.h:5761

Referenced by MainWnd_OnEdit(), and MainWnd_OnNotify().

◆ LV_OnDelete()

void LV_OnDelete ( HWND  hwnd,
INT  iRow = -1 
)

Definition at line 434 of file fontsub.cpp.

435{
436 if (iRow == -1)
438 if (iRow == -1)
439 return;
440
443
444 WCHAR sz[MAX_STRING];
448 {
449 return;
450 }
451
453 g_Items.erase(g_Items.begin() + iRow);
455
457
459}
WCHAR g_szTitle[MAX_STRING]
Definition: fontsub.cpp:57
#define IDS_QUERYDELETE
Definition: resource.h:37
#define ListView_DeleteItem(hwnd, i)
Definition: commctrl.h:2411
#define MB_YESNO
Definition: winuser.h:817
#define MB_ICONINFORMATION
Definition: winuser.h:802
#define IDYES
Definition: winuser.h:835

Referenced by EditDlg_OnCommand(), MainWnd_OnDelete(), and MainWnd_OnNotify().

◆ MainWnd_OnAbout()

void MainWnd_OnAbout ( HWND  hwnd)

Definition at line 1238 of file fontsub.cpp.

1239{
1240 WCHAR szAbout[MAX_PATH];
1241 LoadStringW(g_hInstance, IDS_ABOUT, szAbout, _countof(szAbout));
1242
1244 ZeroMemory(&Params, sizeof(Params));
1245 Params.cbSize = sizeof(Params);
1246 Params.hwndOwner = hwnd;
1247 Params.hInstance = g_hInstance;
1248 Params.lpszText = szAbout;
1249 Params.lpszCaption = g_szTitle;
1250 Params.dwStyle = MB_OK | MB_USERICON;
1251 Params.lpszIcon = MAKEINTRESOURCEW(1);
1252 Params.dwLanguageId = LANG_USER_DEFAULT;
1254}
#define IDS_ABOUT
Definition: resource.h:29
#define MAX_PATH
Definition: compat.h:34
#define LANG_USER_DEFAULT
Definition: tnerror.cpp:50
_In_ WDFIOTARGET _In_ PWDF_REQUEST_COMPLETION_PARAMS Params
Definition: wdfrequest.h:308
#define MB_OK
Definition: winuser.h:790
#define MB_USERICON
Definition: winuser.h:783
int WINAPI MessageBoxIndirectW(_In_ CONST MSGBOXPARAMSW *lpmbp)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by MainWnd_OnCommand().

◆ MainWnd_OnActivate()

void MainWnd_OnActivate ( HWND  hwnd,
UINT  state,
HWND  hwndActDeact,
BOOL  fMinimized 
)

Definition at line 1435 of file fontsub.cpp.

1436{
1437 if (state != WA_INACTIVE)
1438 {
1440 }
1441}
static int state
Definition: maze.c:121
#define WA_INACTIVE
Definition: winuser.h:2622

Referenced by WindowProc().

◆ MainWnd_OnClose()

void MainWnd_OnClose ( HWND  hwnd)

Definition at line 1470 of file fontsub.cpp.

1471{
1472 if (!g_bNeedsReboot && !g_bModified)
1473 {
1475 return;
1476 }
1477
1478 if (g_bModified)
1479 {
1480 WCHAR szUpdateNow[MAX_STRING];
1481 LoadStringW(g_hInstance, IDS_QUERYUPDATE, szUpdateNow, _countof(szUpdateNow));
1482 INT id = MessageBoxW(hwnd, szUpdateNow, g_szTitle,
1484 switch (id)
1485 {
1486 case IDYES:
1488 break;
1489 case IDNO:
1490 break;
1491 case IDCANCEL:
1492 return;
1493 }
1494 }
1495
1496 if (g_bNeedsReboot)
1497 {
1498 WCHAR szRebootNow[MAX_STRING];
1499 LoadStringW(g_hInstance, IDS_REBOOTNOW, szRebootNow, _countof(szRebootNow));
1500 INT id = MessageBoxW(hwnd, szRebootNow, g_szTitle,
1502 switch (id)
1503 {
1504 case IDYES:
1507 break;
1508 case IDNO:
1509 break;
1510 case IDCANCEL:
1511 return;
1512 }
1513 }
1514
1516}
BOOL EnableProcessPrivileges(LPCWSTR lpPrivilegeName, BOOL bEnable=TRUE)
Definition: fontsub.cpp:1443
BOOL MainWnd_OnUpdateRegistry(HWND hwnd)
Definition: fontsub.cpp:727
#define IDS_REBOOTNOW
Definition: resource.h:39
#define IDS_QUERYUPDATE
Definition: resource.h:34
#define SE_SHUTDOWN_NAME
Definition: winnt_old.h:384
#define EWX_REBOOT
Definition: winuser.h:638
#define IDNO
Definition: winuser.h:836
#define EWX_FORCE
Definition: winuser.h:635
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
BOOL WINAPI DestroyWindow(_In_ HWND)
#define MB_YESNOCANCEL
Definition: winuser.h:818

Referenced by WindowProc().

◆ MainWnd_OnCommand()

void MainWnd_OnCommand ( HWND  hwnd,
int  id,
HWND  hwndCtl,
UINT  codeNotify 
)

Definition at line 1256 of file fontsub.cpp.

1257{
1258 switch (id)
1259 {
1260 case ID_NEW:
1262 break;
1263 case ID_EDIT:
1265 break;
1266 case ID_EXIT:
1267 PostMessage(hwnd, WM_CLOSE, 0, 0);
1268 break;
1269 case ID_RELOAD:
1271 break;
1272 case ID_UPDATE_REGISTRY:
1274 break;
1275 case ID_DELETE:
1277 break;
1278 case ID_IMPORT:
1280 break;
1281 case ID_EXPORT:
1283 break;
1284 case ID_OPEN_REGKEY:
1286 break;
1287 case ID_ABOUT:
1289 break;
1290 }
1291}
#define ID_EXIT
Definition: resource.h:10
#define ID_DELETE
Definition: resource.h:25
#define ID_EXPORT
Definition: resource.h:17
#define ID_EDIT
Definition: resource.h:23
#define ID_ABOUT
Definition: charmap.c:17
void MainWnd_OnImport(HWND hwnd)
Definition: fontsub.cpp:1123
void MainWnd_OnOpenRegKey(HWND hwnd)
Definition: fontsub.cpp:1201
void MainWnd_OnEdit(HWND hwnd)
Definition: fontsub.cpp:1191
void MainWnd_OnExport(HWND hwnd)
Definition: fontsub.cpp:1155
void MainWnd_OnReload(HWND hwnd)
Definition: fontsub.cpp:1186
void MainWnd_OnDelete(HWND hwnd)
Definition: fontsub.cpp:1196
void MainWnd_OnAbout(HWND hwnd)
Definition: fontsub.cpp:1238
void MainWnd_OnNew(HWND hwnd)
Definition: fontsub.cpp:706
#define ID_RELOAD
Definition: resource.h:17
#define ID_NEW
Definition: resource.h:10
#define ID_OPEN_REGKEY
Definition: resource.h:19
#define ID_IMPORT
Definition: resource.h:15
#define ID_UPDATE_REGISTRY
Definition: resource.h:13
#define WM_CLOSE
Definition: winuser.h:1621
#define PostMessage
Definition: winuser.h:5832

Referenced by WindowProc().

◆ MainWnd_OnContextMenu()

LRESULT MainWnd_OnContextMenu ( HWND  hwnd,
HWND  hwndContext,
UINT  xPos,
UINT  yPos 
)

Definition at line 1414 of file fontsub.cpp.

1415{
1416 POINT pt = {(INT)xPos, (INT)yPos};
1419
1421 if (hMenu == NULL)
1422 return 0;
1423
1424 HMENU hSubMenu = GetSubMenu(hMenu, 0);
1425 if (hSubMenu == NULL)
1426 return 0;
1427
1430 xPos, yPos, 0, g_hMainWnd, NULL);
1432 return 0;
1433}
#define pt(x, y)
Definition: drawing.c:79
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
#define TPM_RIGHTBUTTON
Definition: winuser.h:2380
BOOL WINAPI SetForegroundWindow(_In_ HWND)
#define WM_LBUTTONDOWN
Definition: winuser.h:1776
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define TPM_LEFTALIGN
Definition: winuser.h:2377
#define WM_NULL
Definition: winuser.h:1607
#define LoadMenu
Definition: winuser.h:5817
BOOL WINAPI TrackPopupMenu(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _Reserved_ int, _In_ HWND, _Reserved_ LPCRECT)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)

Referenced by WindowProc().

◆ MainWnd_OnCreate()

BOOL MainWnd_OnCreate ( HWND  hwnd,
LPCREATESTRUCT  lpCreateStruct 
)

Definition at line 531 of file fontsub.cpp.

532{
533 DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_VSCROLL |
535 DWORD dwExStyle = WS_EX_CLIENTEDGE;
536 g_hListView = CreateWindowEx(dwExStyle, WC_LISTVIEW, NULL, dwStyle,
537 0, 0, 0, 0,
538 hwnd, (HMENU)1, g_hInstance, NULL);
539 if (g_hListView == NULL)
540 return FALSE;
541
542 if (!LV_Init(g_hListView))
543 return FALSE;
544
545 if (!DoLoad())
546 return FALSE;
547
551 return TRUE;
552}
BOOL DoLoad(void)
Definition: fontsub.cpp:310
BOOL LV_Init(HWND hwnd)
Definition: fontsub.cpp:328
#define WS_CHILD
Definition: pedump.c:617
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_VISIBLE
Definition: pedump.c:620
#define LVS_SINGLESEL
Definition: commctrl.h:2266
#define LVS_OWNERDRAWFIXED
Definition: commctrl.h:2283
#define LVS_REPORT
Definition: commctrl.h:2262
#define WC_LISTVIEW
Definition: commctrl.h:2259
#define CreateWindowEx
Definition: winuser.h:5755
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384

Referenced by WindowProc().

◆ MainWnd_OnDelete()

void MainWnd_OnDelete ( HWND  hwnd)

Definition at line 1196 of file fontsub.cpp.

1197{
1199}

Referenced by MainWnd_OnCommand().

◆ MainWnd_OnDestroy()

void MainWnd_OnDestroy ( HWND  hwnd)

Definition at line 1293 of file fontsub.cpp.

1294{
1295 PostQuitMessage(0);
1296}
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)

Referenced by WindowProc().

◆ MainWnd_OnDrawItem()

void MainWnd_OnDrawItem ( HWND  hwnd,
const DRAWITEMSTRUCT lpDrawItem 
)

Definition at line 1303 of file fontsub.cpp.

1304{
1305 if (lpDrawItem->CtlType != ODT_LISTVIEW)
1306 return;
1307
1308 HDC hDC = lpDrawItem->hDC;
1310
1311 INT iColumn = 0, x, cx;
1312 RECT rcItem, rcSubItem, rcText;
1313 STRING Str;
1314
1316
1317 rcItem = lpDrawItem->rcItem;
1318 if (lpDrawItem->itemState & ODS_SELECTED)
1319 {
1320 FillRect(hDC, &rcItem, (HBRUSH)(COLOR_HIGHLIGHT + 1));
1322 }
1323 else
1324 {
1325 FillRect(hDC, &rcItem, (HBRUSH)(COLOR_WINDOW + 1));
1327 }
1328
1330 rcSubItem = rcItem;
1331 rcSubItem.left = x;
1332 rcSubItem.right = x + cx;
1333
1334 WCHAR sz[MAX_STRING];
1335
1336 rcText = rcSubItem;
1337 InflateRect(&rcText, -1, -1);
1338 Str = g_Items[lpDrawItem->itemID].m_Name;
1339 BYTE CharSet1 = g_Items[lpDrawItem->itemID].m_CharSet1;
1340 if (CharSet1 != DEFAULT_CHARSET)
1341 wsprintfW(sz, L"%s,%u", Str.c_str(), CharSet1);
1342 else
1343 wsprintfW(sz, L"%s", Str.c_str());
1344
1345 DrawTextW(hDC, sz, lstrlenW(sz), &rcText,
1347 DT_NOPREFIX);
1348
1349 x += cx;
1350 ++iColumn;
1351
1353 rcSubItem = rcItem;
1354 rcSubItem.left = x;
1355 rcSubItem.right = x + cx;
1356
1357 rcText = rcSubItem;
1358 InflateRect(&rcText, -1, -1);
1359 Str = g_Items[lpDrawItem->itemID].m_Substitute;
1360 BYTE CharSet2 = g_Items[lpDrawItem->itemID].m_CharSet2;
1361 if (CharSet2 != DEFAULT_CHARSET)
1362 wsprintfW(sz, L"%s,%u", Str.c_str(), CharSet2);
1363 else
1364 wsprintfW(sz, L"%s", Str.c_str());
1365
1366 DrawTextW(hDC, sz, lstrlenW(sz), &rcText,
1368 DT_NOPREFIX);
1369}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:16
#define ListView_GetColumnWidth(hwnd, iCol)
Definition: commctrl.h:2642
_Out_opt_ int * cx
Definition: commctrl.h:585
#define ODT_LISTVIEW
Definition: commctrl.h:80
LONG right
Definition: windef.h:308
LONG left
Definition: windef.h:306
#define TRANSPARENT
Definition: wingdi.h:950
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
DWORD WINAPI GetSysColor(_In_ int)
#define ODS_SELECTED
Definition: winuser.h:2545
#define DT_NOPREFIX
Definition: winuser.h:537
#define COLOR_WINDOW
Definition: winuser.h:918
#define DT_END_ELLIPSIS
Definition: winuser.h:529
#define COLOR_WINDOWTEXT
Definition: winuser.h:921
#define COLOR_HIGHLIGHT
Definition: winuser.h:926
#define DT_SINGLELINE
Definition: winuser.h:540
#define DT_LEFT
Definition: winuser.h:534
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:927
#define DT_VCENTER
Definition: winuser.h:543
int WINAPI GetScrollPos(_In_ HWND, _In_ int)
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define SB_HORZ
Definition: winuser.h:552

Referenced by WindowProc().

◆ MainWnd_OnEdit()

void MainWnd_OnEdit ( HWND  hwnd)

Definition at line 1191 of file fontsub.cpp.

1192{
1194}
void LV_OnDblClk(HWND hwnd)
Definition: fontsub.cpp:515

Referenced by MainWnd_OnCommand().

◆ MainWnd_OnExport()

void MainWnd_OnExport ( HWND  hwnd)

Definition at line 1155 of file fontsub.cpp.

1156{
1157 OPENFILENAMEW ofn = {0};
1158 WCHAR szFile[MAX_PATH] = L"";
1159 WCHAR szExportTitle[MAX_STRING];
1160 WCHAR szCannotExport[MAX_STRING];
1161 WCHAR szExportFilter[MAX_STRING];
1162 LoadStringW(g_hInstance, IDS_EXPORT, szExportTitle, _countof(szExportTitle));
1163 LoadStringW(g_hInstance, IDS_CANTEXPORT, szCannotExport, _countof(szCannotExport));
1164 LoadStringW(g_hInstance, IDS_OUTFILTER, szExportFilter, _countof(szExportFilter));
1165 MakeFilter(szExportFilter);
1166
1168 ofn.hwndOwner = hwnd;
1169 ofn.lpstrFilter = szExportFilter;
1170 ofn.lpstrFile = szFile;
1171 ofn.nMaxFile = _countof(szFile);
1172 ofn.lpstrTitle = szExportTitle;
1176 ofn.lpstrDefExt = L"reg";
1177 if (GetSaveFileNameW(&ofn))
1178 {
1179 if (!DoExport(hwnd, szFile))
1180 {
1181 MessageBoxW(hwnd, szCannotExport, g_szTitle, MB_ICONERROR);
1182 }
1183 }
1184}
#define OFN_OVERWRITEPROMPT
Definition: commdlg.h:116
#define OFN_EXPLORER
Definition: commdlg.h:104
#define OFN_DONTADDTORECENT
Definition: commdlg.h:98
#define OPENFILENAME_SIZE_VERSION_400
Definition: commdlg.h:402
#define OFN_LONGNAMES
Definition: commdlg.h:108
#define OFN_HIDEREADONLY
Definition: commdlg.h:107
#define OFN_ENABLESIZING
Definition: commdlg.h:101
#define OFN_PATHMUSTEXIST
Definition: commdlg.h:117
BOOL WINAPI GetSaveFileNameW(LPOPENFILENAMEW ofn)
Definition: filedlg.c:4801
BOOL DoExport(HWND hwnd, LPCWSTR pszFile)
Definition: fontsub.cpp:1048
void MakeFilter(LPWSTR pszFilter)
Definition: fontsub.cpp:1112
#define IDS_CANTEXPORT
Definition: resource.h:31
#define IDS_EXPORT
Definition: resource.h:29
#define IDS_OUTFILTER
Definition: resource.h:33
OPENFILENAME ofn
Definition: sndrec32.cpp:56
LPCSTR lpstrDefExt
Definition: commdlg.h:345
HWND hwndOwner
Definition: commdlg.h:330
LPCSTR lpstrTitle
Definition: commdlg.h:341
LPSTR lpstrFile
Definition: commdlg.h:336
DWORD Flags
Definition: commdlg.h:342
DWORD lStructSize
Definition: commdlg.h:329
LPCSTR lpstrFilter
Definition: commdlg.h:332
DWORD nMaxFile
Definition: commdlg.h:337

Referenced by MainWnd_OnCommand().

◆ MainWnd_OnImport()

void MainWnd_OnImport ( HWND  hwnd)

Definition at line 1123 of file fontsub.cpp.

1124{
1125 OPENFILENAMEW ofn = {0};
1126 WCHAR szFile[MAX_PATH] = L"";
1127 WCHAR szImportTitle[MAX_STRING];
1128 WCHAR szCannotImport[MAX_STRING];
1129 WCHAR szImportFilter[MAX_STRING];
1130 LoadStringW(g_hInstance, IDS_IMPORT, szImportTitle, _countof(szImportTitle));
1131 LoadStringW(g_hInstance, IDS_CANTIMPORT, szCannotImport, _countof(szCannotImport));
1132 LoadStringW(g_hInstance, IDS_INPFILTER, szImportFilter, _countof(szImportFilter));
1133 MakeFilter(szImportFilter);
1134
1136 ofn.hwndOwner = hwnd;
1137 ofn.lpstrFilter = szImportFilter;
1138 ofn.lpstrFile = szFile;
1139 ofn.nMaxFile = _countof(szFile);
1140 ofn.lpstrTitle = szImportTitle;
1145 ofn.lpstrDefExt = L"reg";
1146 if (GetOpenFileNameW(&ofn))
1147 {
1148 if (!DoImport(hwnd, szFile))
1149 {
1150 MessageBoxW(hwnd, szCannotImport, g_szTitle, MB_ICONERROR);
1151 }
1152 }
1153}
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
BOOL WINAPI GetOpenFileNameW(OPENFILENAMEW *ofn)
Definition: filedlg.c:4736
BOOL DoImport(HWND hwnd, LPCWSTR pszFile)
Definition: fontsub.cpp:997
#define IDS_IMPORT
Definition: resource.h:28
#define IDS_INPFILTER
Definition: resource.h:32
#define IDS_CANTIMPORT
Definition: resource.h:30

Referenced by MainWnd_OnCommand().

◆ MainWnd_OnMeasureItem()

void MainWnd_OnMeasureItem ( HWND  hwnd,
MEASUREITEMSTRUCT lpMeasureItem 
)

Definition at line 1371 of file fontsub.cpp.

1372{
1373 if (lpMeasureItem->CtlType != ODT_LISTVIEW)
1374 return;
1375
1376 TEXTMETRIC tm;
1377 HDC hDC = GetDC(hwnd);
1379 ReleaseDC(hwnd, hDC);
1380
1381 lpMeasureItem->itemHeight = tm.tmHeight * 4 / 3;
1382}
Definition: time.h:68
#define GetTextMetrics
Definition: wingdi.h:4474
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)

Referenced by WindowProc().

◆ MainWnd_OnNew()

void MainWnd_OnNew ( HWND  hwnd)

Definition at line 706 of file fontsub.cpp.

707{
709 if (g_iItem == -1)
710 return;
711
712 g_strFontName = g_Items[g_iItem].m_Name;
713 g_strSubstitute = g_Items[g_iItem].m_Substitute;
714 g_CharSet1 = g_Items[g_iItem].m_CharSet1;
715 g_CharSet2 = g_Items[g_iItem].m_CharSet2;
716
719 {
724 }
725}
#define IDD_ADD
Definition: resource.h:17
INT_PTR CALLBACK AddDlg_DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: fontsub.cpp:696
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2307
#define ListView_EnsureVisible(hwndLV, i, fPartialOK)
Definition: commctrl.h:2519

Referenced by MainWnd_OnCommand().

◆ MainWnd_OnNotify()

LRESULT MainWnd_OnNotify ( HWND  hwnd,
int  idFrom,
NMHDR pnmhdr 
)

Definition at line 1384 of file fontsub.cpp.

1385{
1386 NM_LISTVIEW *pNMLV = (NM_LISTVIEW *)pnmhdr;
1387 LV_KEYDOWN *pLVKD = (LV_KEYDOWN *)pnmhdr;
1388
1389 switch (pnmhdr->code)
1390 {
1391 case LVN_COLUMNCLICK:
1392 if (pNMLV->iSubItem == g_iSortColumn)
1393 DoSort(pNMLV->iSubItem, !g_bSortAscendant);
1394 else
1395 DoSort(pNMLV->iSubItem, TRUE);
1396 break;
1397 case NM_DBLCLK:
1399 break;
1400 case LVN_KEYDOWN:
1401 if (pLVKD->wVKey == VK_RETURN) // [Enter] key
1402 {
1404 }
1405 if (pLVKD->wVKey == VK_DELETE) // [Del] key
1406 {
1408 }
1409 break;
1410 }
1411 return 0;
1412}
#define LVN_COLUMNCLICK
Definition: commctrl.h:3139
#define NM_DBLCLK
Definition: commctrl.h:131
#define NM_LISTVIEW
Definition: commctrl.h:3030
#define LVN_KEYDOWN
Definition: commctrl.h:3184
#define LV_KEYDOWN
Definition: commctrl.h:3186
UINT code
Definition: winuser.h:3159
#define VK_RETURN
Definition: winuser.h:2201
#define VK_DELETE
Definition: winuser.h:2233

Referenced by WindowProc().

◆ MainWnd_OnOpenRegKey()

void MainWnd_OnOpenRegKey ( HWND  hwnd)

Definition at line 1201 of file fontsub.cpp.

1202{
1203 static const WCHAR s_szRegeditKey[] =
1204 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Applets\\Regedit";
1205 WCHAR sz[MAX_STRING];
1206
1207 // open regedit key
1208 HKEY hKey = NULL;
1209 LSTATUS Result = RegCreateKeyExW(HKEY_CURRENT_USER, s_szRegeditKey, 0,
1210 NULL, 0, KEY_WRITE, NULL, &hKey, NULL);
1211 if (Result != ERROR_SUCCESS)
1212 {
1215 return;
1216 }
1217
1218 // set LastKey value
1219 wsprintfW(sz, L"HKEY_LOCAL_MACHINE\\%s", g_pszKey);
1220 DWORD dwSize = sizeof(sz);
1221 Result = RegSetValueExW(hKey, L"LastKey", 0, REG_SZ,
1222 (LPBYTE)sz, dwSize);
1223
1224 // close now
1226
1227 if (Result != ERROR_SUCCESS)
1228 {
1231 return;
1232 }
1233
1234 // open by regedit
1235 ShellExecuteW(hwnd, NULL, L"regedit.exe", NULL, NULL, SW_SHOWNORMAL);
1236}
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
#define REG_SZ
Definition: layer.c:22
#define IDS_CANTOPENKEY
Definition: resource.h:38
#define KEY_WRITE
Definition: nt_native.h:1031
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2402
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define SW_SHOWNORMAL
Definition: winuser.h:770
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

Referenced by MainWnd_OnCommand().

◆ MainWnd_OnReload()

void MainWnd_OnReload ( HWND  hwnd)

Definition at line 1186 of file fontsub.cpp.

1187{
1188 DoLoad();
1189}

Referenced by MainWnd_OnCommand().

◆ MainWnd_OnSize()

void MainWnd_OnSize ( HWND  hwnd,
UINT  state,
int  cx,
int  cy 
)

Definition at line 1298 of file fontsub.cpp.

1299{
1300 MoveWindow(g_hListView, 0, 0, cx, cy, TRUE);
1301}
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)

Referenced by WindowProc().

◆ MainWnd_OnUpdateRegistry()

BOOL MainWnd_OnUpdateRegistry ( HWND  hwnd)

Definition at line 727 of file fontsub.cpp.

728{
729 // open the key
730 HKEY hKey = NULL;
732 if (hKey == NULL)
733 return FALSE;
734
735 // clear all values
737 DWORD cbName, cbValue;
738 for (;;)
739 {
740 cbName = sizeof(szName);
741 cbValue = sizeof(szValue);
742 LONG Error = RegEnumValueW(hKey, 0, szName, &cbName,
743 NULL, NULL, (LPBYTE)szValue, &cbValue);
744 if (Error != ERROR_SUCCESS)
745 break;
746
748 }
749
750 // set values
751 size_t Count = g_Items.size();
752 for (size_t i = 0; i < Count; ++i)
753 {
754 DWORD cbData = (g_Items[i].m_Substitute.size() + 1) * sizeof(WCHAR);
755 RegSetValueExW(hKey, g_Items[i].m_Name.c_str(), 0,
756 REG_SZ, (LPBYTE)g_Items[i].m_Substitute.c_str(), cbData);
757 }
758
759 // close now
761
764 return TRUE;
765}
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2330
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041

Referenced by MainWnd_OnClose(), and MainWnd_OnCommand().

◆ MakeFilter()

void MakeFilter ( LPWSTR  pszFilter)

Definition at line 1112 of file fontsub.cpp.

1113{
1114 while (*pszFilter)
1115 {
1116 if (*pszFilter == L'|')
1117 *pszFilter = 0;
1118
1119 ++pszFilter;
1120 }
1121}

Referenced by MainWnd_OnExport(), and MainWnd_OnImport().

◆ SkipQuoted()

LPWSTR SkipQuoted ( LPWSTR  pch)

Definition at line 776 of file fontsub.cpp.

777{
778 ++pch; // L'"'
779 while (*pch)
780 {
781 if (*pch == L'"')
782 {
783 ++pch;
784 break;
785 }
786 if (*pch == L'\\')
787 {
788 ++pch;
789 }
790 ++pch;
791 }
792 return pch;
793}

Referenced by DoParseFile().

◆ SkipSpace()

LPWSTR SkipSpace ( LPCWSTR  pch)

Definition at line 767 of file fontsub.cpp.

768{
769 while (*pch && wcschr(L" \t\r\n", *pch) != NULL)
770 {
771 ++pch;
772 }
773 return const_cast<LPWSTR>(pch);
774}

Referenced by DoParseFile().

◆ trim()

static void trim ( STRING str)
static

Definition at line 107 of file fontsub.cpp.

108{
109 static const WCHAR Spaces[] = L" \t\r\n";
110 size_t i = str.find_first_not_of(Spaces);
111 size_t j = str.find_last_not_of(Spaces);
112 if (i == STRING::npos || j == STRING::npos)
113 {
114 str.clear();
115 }
116 else
117 {
118 str = str.substr(i, j - i + 1);
119 }
120}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250

Referenced by AddDlg_OnCommand(), DoLoadItems(), DoParseFile(), and EditDlg_OnCommand().

◆ UnescapeChar()

void UnescapeChar ( const STRING str,
size_t i,
STRING Ret 
)

Definition at line 862 of file fontsub.cpp.

863{
864 if (str[i] != L'\\')
865 {
866 Ret += str[i];
867 ++i;
868 return;
869 }
870
871 ++i;
872 switch (str[i])
873 {
874 case L'a': Ret += L'\a'; ++i; break;
875 case L'b': Ret += L'\b'; ++i; break;
876 case L'f': Ret += L'\f'; ++i; break;
877 case L'n': Ret += L'\n'; ++i; break;
878 case L'r': Ret += L'\r'; ++i; break;
879 case L't': Ret += L'\t'; ++i; break;
880 case L'v': Ret += L'\v'; ++i; break;
881 case L'x':
882 // hexidemical
883 ++i;
884 UnescapeHex(str, i, Ret, FALSE);
885 break;
886 case L'u':
887 // Unicode hexidemical
888 ++i;
889 UnescapeHex(str, i, Ret, TRUE);
890 break;
891 default:
892 // other case
893 UnescapeOther(str, i, Ret);
894 break;
895 }
896}
void UnescapeHex(const STRING &str, size_t &i, STRING &Ret, BOOL Unicode)
Definition: fontsub.cpp:795
void UnescapeOther(const STRING &str, size_t &i, STRING &Ret)
Definition: fontsub.cpp:829

Referenced by Unquote().

◆ UnescapeHex()

void UnescapeHex ( const STRING str,
size_t i,
STRING Ret,
BOOL  Unicode 
)

Definition at line 795 of file fontsub.cpp.

796{
797 STRING Num;
798
799 // hexadecimal
800 if (iswxdigit(str[i]))
801 {
802 Num += str[i];
803 ++i;
804 if (iswxdigit(str[i]))
805 {
806 Num += str[i];
807 ++i;
808 if (Unicode)
809 {
810 if (iswxdigit(str[i]))
811 {
812 Num += str[i];
813 ++i;
814 if (iswxdigit(str[i]))
815 {
816 Num += str[i];
817 ++i;
818 }
819 }
820 }
821 }
822 }
823 if (!Num.empty())
824 {
825 Ret += (WCHAR)wcstoul(&Num[0], NULL, 16);
826 }
827}
#define iswxdigit(_c)
Definition: ctype.h:668
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)

Referenced by UnescapeChar().

◆ UnescapeOther()

void UnescapeOther ( const STRING str,
size_t i,
STRING Ret 
)

Definition at line 829 of file fontsub.cpp.

830{
831 STRING Num;
832
833 // check octal
834 if (L'0' <= str[i] && str[i] < L'8')
835 {
836 Num += str[i];
837 ++i;
838 if (L'0' <= str[i] && str[i] < L'8')
839 {
840 Num += str[i];
841 ++i;
842 if (L'0' <= str[i] && str[i] < L'8')
843 {
844 Num += str[i];
845 ++i;
846 }
847 }
848 }
849 if (Num.empty())
850 {
851 Ret += str[i];
852 ++i;
853 }
854 else
855 {
856 // octal
857 Ret += (WCHAR)wcstoul(&Num[0], NULL, 8);
858 }
859}

Referenced by UnescapeChar().

◆ Unquote()

STRING Unquote ( const STRING str)

Definition at line 898 of file fontsub.cpp.

899{
900 if (str[0] != L'"')
901 return str;
902
903 STRING Ret;
904 size_t i = 1;
905 while (i < str.size())
906 {
907 if (str[i] == L'"' || str[i] == UNICODE_NULL)
908 break;
909
910 UnescapeChar(str, i, Ret);
911 }
912 return Ret;
913}
void UnescapeChar(const STRING &str, size_t &i, STRING &Ret)
Definition: fontsub.cpp:862

Referenced by DoParseFile().

◆ WindowProc()

LRESULT CALLBACK WindowProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1519 of file fontsub.cpp.

1520{
1521 switch (uMsg)
1522 {
1533 default:
1534 return DefWindowProc(hwnd, uMsg, wParam, lParam);
1535 }
1536}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
void MainWnd_OnDrawItem(HWND hwnd, const DRAWITEMSTRUCT *lpDrawItem)
Definition: fontsub.cpp:1303
void MainWnd_OnActivate(HWND hwnd, UINT state, HWND hwndActDeact, BOOL fMinimized)
Definition: fontsub.cpp:1435
void MainWnd_OnDestroy(HWND hwnd)
Definition: fontsub.cpp:1293
void MainWnd_OnClose(HWND hwnd)
Definition: fontsub.cpp:1470
void MainWnd_OnSize(HWND hwnd, UINT state, int cx, int cy)
Definition: fontsub.cpp:1298
LRESULT MainWnd_OnNotify(HWND hwnd, int idFrom, NMHDR *pnmhdr)
Definition: fontsub.cpp:1384
void MainWnd_OnMeasureItem(HWND hwnd, MEASUREITEMSTRUCT *lpMeasureItem)
Definition: fontsub.cpp:1371
BOOL MainWnd_OnCreate(HWND hwnd, LPCREATESTRUCT lpCreateStruct)
Definition: fontsub.cpp:531
void MainWnd_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
Definition: fontsub.cpp:1256
LRESULT MainWnd_OnContextMenu(HWND hwnd, HWND hwndContext, UINT xPos, UINT yPos)
Definition: fontsub.cpp:1414
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define WM_NOTIFY
Definition: richedit.h:61
#define DefWindowProc
Definition: ros2win.h:31
#define WM_CREATE
Definition: winuser.h:1608
#define WM_SIZE
Definition: winuser.h:1611
#define WM_DRAWITEM
Definition: winuser.h:1645
#define WM_ACTIVATE
Definition: winuser.h:1612
#define WM_MEASUREITEM
Definition: winuser.h:1646
#define WM_DESTROY
Definition: winuser.h:1609

Referenced by wWinMain().

◆ wWinMain()

INT WINAPI wWinMain ( HINSTANCE  hInstance,
HINSTANCE  hPrevInstance,
LPWSTR  lpCmdLine,
INT  nCmdShow 
)

Definition at line 1538 of file fontsub.cpp.

1543{
1546
1548
1552
1553 WNDCLASSW wc = {0};
1554 wc.style = 0;
1556 wc.hInstance = hInstance;
1558 wc.hIcon = g_hIcon;
1560 wc.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
1563 if (!RegisterClassW(&wc))
1564 {
1565 MessageBoxA(NULL, "ERROR: RegisterClass failed.", NULL, MB_ICONERROR);
1566 return 1;
1567 }
1568
1569 const DWORD dwStyle = WS_OVERLAPPEDWINDOW;
1573 INT Height = 320;
1574
1575 RECT Rect = { 0, 0, Width, Height };
1576 AdjustWindowRect(&Rect, dwStyle, TRUE);
1577 Width = Rect.right - Rect.left;
1578 Height = Rect.bottom - Rect.top;
1579
1582 NULL, NULL, hInstance, NULL);
1583 if (g_hMainWnd == NULL)
1584 {
1585 MessageBoxA(NULL, "ERROR: CreateWindow failed.", NULL, MB_ICONERROR);
1586 return 2;
1587 }
1588
1589 ShowWindow(g_hMainWnd, nCmdShow);
1591
1592 MSG msg;
1593 while (GetMessage(&msg, NULL, 0, 0))
1594 {
1596 continue;
1597
1600 }
1601
1602 return (INT)msg.wParam;
1603}
#define msg(x)
Definition: auth_time.c:54
#define IDS_TITLE
Definition: resource.h:30
#define IDS_FONTNAME
Definition: resource.h:11
HINSTANCE hInstance
Definition: charmap.c:19
VOID WINAPI InitCommonControls(void)
Definition: commctrl.c:863
LPCWSTR g_pszClassName
Definition: fontsub.cpp:54
HICON g_hIcon
Definition: fontsub.cpp:48
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: fontsub.cpp:1519
#define IDS_SUBSTITUTE
Definition: resource.h:26
HACCEL hAccel
Definition: main.c:47
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
LPCWSTR lpszClassName
Definition: winuser.h:3185
LPCWSTR lpszMenuName
Definition: winuser.h:3184
HBRUSH hbrBackground
Definition: winuser.h:3183
HICON hIcon
Definition: winuser.h:3181
HINSTANCE hInstance
Definition: winuser.h:3180
UINT style
Definition: winuser.h:3176
WNDPROC lpfnWndProc
Definition: winuser.h:3177
HCURSOR hCursor
Definition: winuser.h:3182
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI AdjustWindowRect(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL)
#define SM_CXVSCROLL
Definition: winuser.h:961
int WINAPI MessageBoxA(_In_opt_ HWND hWnd, _In_opt_ LPCSTR lpText, _In_opt_ LPCSTR lpCaption, _In_ UINT uType)
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define IDC_ARROW
Definition: winuser.h:687
#define GetMessage
Definition: winuser.h:5790
#define LoadIcon
Definition: winuser.h:5813
BOOL WINAPI UpdateWindow(_In_ HWND)
#define LoadCursor
Definition: winuser.h:5812
#define SM_CXSIZEFRAME
Definition: winuser.h:993
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4316
#define CW_USEDEFAULT
Definition: winuser.h:225
HACCEL WINAPI LoadAcceleratorsW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
#define DispatchMessage
Definition: winuser.h:5765
#define TranslateAccelerator
Definition: winuser.h:5860
int WINAPI GetSystemMetrics(_In_ int)
#define COLOR_3DFACE
Definition: winuser.h:929

Variable Documentation

◆ g_bModified

◆ g_bNeedsReboot

BOOL g_bNeedsReboot = FALSE

Definition at line 51 of file fontsub.cpp.

Referenced by DoLoadItems(), MainWnd_OnClose(), and MainWnd_OnUpdateRegistry().

◆ g_bSortAscendant

BOOL g_bSortAscendant = TRUE

Definition at line 62 of file fontsub.cpp.

Referenced by DoSort(), and MainWnd_OnNotify().

◆ g_CharSet1

BYTE g_CharSet1 = DEFAULT_CHARSET

Definition at line 74 of file fontsub.cpp.

Referenced by AddDlg_OnInitDialog(), EditDlg_OnInitDialog(), LV_OnDblClk(), and MainWnd_OnNew().

◆ g_CharSet2

BYTE g_CharSet2 = DEFAULT_CHARSET

Definition at line 75 of file fontsub.cpp.

Referenced by AddDlg_OnInitDialog(), EditDlg_OnInitDialog(), LV_OnDblClk(), and MainWnd_OnNew().

◆ g_CharSetList

CHARSET_ENTRY g_CharSetList[]
Initial value:
=
{
{ DEFAULT_CHARSET, L"DEFAULT_CHARSET (1)" },
{ ANSI_CHARSET, L"ANSI_CHARSET (0)" },
{ SYMBOL_CHARSET, L"SYMBOL_CHARSET (2)" },
{ SHIFTJIS_CHARSET, L"SHIFTJIS_CHARSET (128)" },
{ HANGUL_CHARSET, L"HANGUL_CHARSET (129)" },
{ GB2312_CHARSET, L"GB2312_CHARSET (134)" },
{ CHINESEBIG5_CHARSET, L"CHINESEBIG5_CHARSET (136)" },
{ OEM_CHARSET, L"OEM_CHARSET (255)" },
{ JOHAB_CHARSET, L"JOHAB_CHARSET (130)" },
{ HEBREW_CHARSET, L"HEBREW_CHARSET (177)" },
{ ARABIC_CHARSET, L"ARABIC_CHARSET (178)" },
{ GREEK_CHARSET, L"GREEK_CHARSET (161)" },
{ TURKISH_CHARSET, L"TURKISH_CHARSET (162)" },
{ VIETNAMESE_CHARSET, L"VIETNAMESE_CHARSET (163)" },
{ THAI_CHARSET, L"THAI_CHARSET (222)" },
{ EASTEUROPE_CHARSET, L"EASTEUROPE_CHARSET (238)" },
{ RUSSIAN_CHARSET, L"RUSSIAN_CHARSET (204)" },
{ MAC_CHARSET, L"MAC_CHARSET (77)" },
{ BALTIC_CHARSET, L"BALTIC_CHARSET (186)" }
}
#define HANGUL_CHARSET
Definition: wingdi.h:388
#define RUSSIAN_CHARSET
Definition: wingdi.h:396
#define ARABIC_CHARSET
Definition: wingdi.h:394
#define THAI_CHARSET
Definition: wingdi.h:397
#define GREEK_CHARSET
Definition: wingdi.h:391
#define JOHAB_CHARSET
Definition: wingdi.h:401
#define CHINESEBIG5_CHARSET
Definition: wingdi.h:390
#define ANSI_CHARSET
Definition: wingdi.h:383
#define OEM_CHARSET
Definition: wingdi.h:400
#define VIETNAMESE_CHARSET
Definition: wingdi.h:402
#define MAC_CHARSET
Definition: wingdi.h:403
#define HEBREW_CHARSET
Definition: wingdi.h:393
#define SHIFTJIS_CHARSET
Definition: wingdi.h:386
#define SYMBOL_CHARSET
Definition: wingdi.h:385
#define EASTEUROPE_CHARSET
Definition: wingdi.h:399
#define GB2312_CHARSET
Definition: wingdi.h:389
#define BALTIC_CHARSET
Definition: wingdi.h:395
#define TURKISH_CHARSET
Definition: wingdi.h:392

Definition at line 83 of file fontsub.cpp.

Referenced by AddDlg_OnCommand(), AddDlg_OnInitDialog(), EditDlg_OnCommand(), and EditDlg_OnInitDialog().

◆ g_hIcon

HICON g_hIcon = NULL

Definition at line 48 of file fontsub.cpp.

Referenced by wWinMain().

◆ g_hInstance

◆ g_hListView

◆ g_hMainWnd

HWND g_hMainWnd = NULL

Definition at line 47 of file fontsub.cpp.

Referenced by LV_OnDblClk(), LV_OnDelete(), MainWnd_OnContextMenu(), MainWnd_OnNew(), and wWinMain().

◆ g_iItem

INT g_iItem = 0

Definition at line 52 of file fontsub.cpp.

Referenced by EditDlg_OnCommand(), LV_OnDblClk(), and MainWnd_OnNew().

◆ g_iSortColumn

INT g_iSortColumn = 0

Definition at line 61 of file fontsub.cpp.

Referenced by DoSort(), and MainWnd_OnNotify().

◆ g_Items

◆ g_LongestName

const WCHAR g_LongestName[] = L"CHINESEBIG5_CHARSET (136)"

Definition at line 105 of file fontsub.cpp.

Referenced by AddDlg_OnInitDialog(), and EditDlg_OnInitDialog().

◆ g_Names

FONTNAMESET g_Names

◆ g_pszClassName

LPCWSTR g_pszClassName = L"ReactOS Font Substitutes Editor"

Definition at line 54 of file fontsub.cpp.

Referenced by wWinMain().

◆ g_pszFileHeader

LPCWSTR g_pszFileHeader = L"Windows Registry Editor Version 5.00"

Definition at line 55 of file fontsub.cpp.

Referenced by DoExport(), and DoParseFile().

◆ g_pszKey

LPCWSTR g_pszKey
Initial value:
=
L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\FontSubstitutes"

Definition at line 64 of file fontsub.cpp.

Referenced by DoExport(), DoLoadItems(), DoParseFile(), MainWnd_OnOpenRegKey(), and MainWnd_OnUpdateRegistry().

◆ g_strFontName

STRING g_strFontName

Definition at line 72 of file fontsub.cpp.

Referenced by EditDlg_OnInitDialog(), LV_OnDblClk(), and MainWnd_OnNew().

◆ g_strSubstitute

STRING g_strSubstitute

Definition at line 73 of file fontsub.cpp.

Referenced by EditDlg_OnInitDialog(), LV_OnDblClk(), and MainWnd_OnNew().

◆ g_szNameHead

WCHAR g_szNameHead[MAX_STRING]

Definition at line 58 of file fontsub.cpp.

Referenced by LV_Init(), and wWinMain().

◆ g_szSubstituteHead

WCHAR g_szSubstituteHead[MAX_STRING]

Definition at line 59 of file fontsub.cpp.

Referenced by LV_Init(), and wWinMain().

◆ g_szTitle