25#define NAME_COLUMN_WIDTH 250
26#define SUB_COLUMN_WIDTH 250
30 #define _countof(array) (sizeof(array) / sizeof(array[0]))
65 L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\FontSubstitutes";
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)
266 DWORD cbName, cbValue;
267 for (
DWORD dwIndex = 0; ; ++dwIndex)
270 cbValue =
sizeof(szValue);
296 Items.push_back(
Item);
386 FONTNAMESET::iterator it,
end =
g_Names.end();
389 Item.pszText =
const_cast<LPWSTR>(it->c_str());
561 FONTNAMESET::iterator it,
end =
g_Names.end();
564 Item.pszText =
const_cast<LPWSTR>(it->c_str());
614 INT i, iCharSet1, iCharSet2;
615 BYTE CharSet1, CharSet2;
624 if (
key.empty() ||
key == sz)
737 DWORD cbName, cbValue;
741 cbValue =
sizeof(szValue);
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;
905 while (
i <
str.size())
928 pchStart += cbHeader /
sizeof(
WCHAR);
966 if (
pos != STRING::npos)
973 if (
pos != STRING::npos)
981 Items.push_back(
Item);
1007 if (
dwSize != 0xFFFFFFFF)
1009 std::vector<BYTE> Contents(
dwSize + 2);
1015 if (
memcmp(&Contents[0],
"\xFF\xFE", 2) == 0)
1033 for (
size_t i = 0;
i <
str.size(); ++
i)
1037 case L'"':
case L'\\':
1090 Name.c_str(), szCharSet1,
1116 if (*pszFilter ==
L'|')
1203 static const WCHAR s_szRegeditKey[] =
1204 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Applets\\Regedit";
1248 Params.lpszText = szAbout;
1312 RECT rcItem, rcSubItem, rcText;
1317 rcItem = lpDrawItem->
rcItem;
1389 switch (pnmhdr->
code)
1425 if (hSubMenu ==
NULL)
static VOID Substitute(_Out_writes_bytes_(BufferSize) PWCHAR Buffer, _In_ ULONG BufferSize, _In_ PCWSTR Template, _In_ PCWSTR SystemDriveName, _In_ PCWSTR SystemRootName)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
#define RegCloseKey(hKey)
VOID WINAPI InitCommonControls(void)
#define OFN_OVERWRITEPROMPT
#define OFN_DONTADDTORECENT
#define OPENFILENAME_SIZE_VERSION_400
#define OFN_FILEMUSTEXIST
#define OFN_PATHMUSTEXIST
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)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
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)
BOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName, LPCWSTR lpPrivilegeName, PLUID lpLuid)
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
INT WINAPI ImageList_AddMasked(HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
BOOL WINAPI GetOpenFileNameW(OPENFILENAMEW *ofn)
BOOL WINAPI GetSaveFileNameW(LPOPENFILENAMEW ofn)
#define ReadFile(a, b, c, d, e)
#define INVALID_HANDLE_VALUE
#define GetCurrentProcess()
#define FILE_ATTRIBUTE_NORMAL
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
static void CharSet(RTF_Info *info)
CHARSET_ENTRY g_CharSetList[]
void MainWnd_OnImport(HWND hwnd)
void LV_OnDelete(HWND hwnd, INT iRow=-1)
STRING Escape(const STRING &str)
BOOL DoExport(HWND hwnd, LPCWSTR pszFile)
LPWSTR SkipQuoted(LPWSTR pch)
void AddDlg_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
void DoSort(INT iColumn, BOOL bAscendant=TRUE)
void LV_AddItems(HWND hwnd)
void MainWnd_OnOpenRegKey(HWND hwnd)
BOOL EnableProcessPrivileges(LPCWSTR lpPrivilegeName, BOOL bEnable=TRUE)
WCHAR g_szSubstituteHead[MAX_STRING]
void MainWnd_OnEdit(HWND hwnd)
STRING Unquote(const STRING &str)
void MainWnd_OnExport(HWND hwnd)
bool ItemCompareByNameDescend(const ITEM &Item1, const ITEM &Item2)
void MainWnd_OnDrawItem(HWND hwnd, const DRAWITEMSTRUCT *lpDrawItem)
void MainWnd_OnReload(HWND hwnd)
void LV_InvalidateRow(HWND hwnd, INT iRow=-1)
void MainWnd_OnActivate(HWND hwnd, UINT state, HWND hwndActDeact, BOOL fMinimized)
void MakeFilter(LPWSTR pszFilter)
bool ItemCompareBySubAscend(const ITEM &Item1, const ITEM &Item2)
void UnescapeChar(const STRING &str, size_t &i, STRING &Ret)
INT_PTR CALLBACK AddDlg_DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL AddDlg_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
WCHAR g_szNameHead[MAX_STRING]
#define NAME_COLUMN_WIDTH
void UnescapeHex(const STRING &str, size_t &i, STRING &Ret, BOOL Unicode)
void MainWnd_OnDestroy(HWND hwnd)
static void trim(STRING &str)
static int CALLBACK EnumFontFamExProc(const ENUMLOGFONTW *pelf, const NEWTEXTMETRICW *pntm, int FontType, LPARAM lParam)
void MainWnd_OnDelete(HWND hwnd)
bool ItemCompareByNameAscend(const ITEM &Item1, const ITEM &Item2)
void MainWnd_OnClose(HWND hwnd)
BOOL DoImport(HWND hwnd, LPCWSTR pszFile)
void MainWnd_OnAbout(HWND hwnd)
INT_PTR CALLBACK EditDlg_DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
void MainWnd_OnSize(HWND hwnd, UINT state, int cx, int cy)
bool ItemCompareBySubDescend(const ITEM &Item1, const ITEM &Item2)
LRESULT MainWnd_OnNotify(HWND hwnd, int idFrom, NMHDR *pnmhdr)
WCHAR g_szTitle[MAX_STRING]
INT WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, INT nCmdShow)
void EditDlg_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
void MainWnd_OnMeasureItem(HWND hwnd, MEASUREITEMSTRUCT *lpMeasureItem)
BOOL MainWnd_OnCreate(HWND hwnd, LPCREATESTRUCT lpCreateStruct)
const WCHAR g_LongestName[]
void MainWnd_OnNew(HWND hwnd)
void UnescapeOther(const STRING &str, size_t &i, STRING &Ret)
void MainWnd_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
BOOL MainWnd_OnUpdateRegistry(HWND hwnd)
std::set< STRING > FONTNAMESET
BOOL EditDlg_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
LRESULT MainWnd_OnContextMenu(HWND hwnd, HWND hwndContext, UINT xPos, UINT yPos)
BOOL DoParseFile(LPVOID pvContents, DWORD dwSize)
LPWSTR SkipSpace(LPCWSTR pch)
void LV_OnDblClk(HWND hwnd)
std::vector< ITEM > ITEMVECTOR
GLint GLint GLint GLint GLint x
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
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
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
#define FILE_FLAG_SEQUENTIAL_SCAN
#define FILE_FLAG_WRITE_THROUGH
#define IDS_ALREADYEXISTS
#define ID_UPDATE_REGISTRY
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
#define FILE_SHARE_DELETE
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
#define WS_OVERLAPPEDWINDOW
static const WCHAR szName[]
_Out_opt_ int _Out_opt_ int * cy
#define ListView_InsertItem(hwnd, pitem)
#define ListView_SetItemState(hwndLV, i, data, mask)
#define ListView_GetItemRect(hwnd, i, prc, code)
#define ListView_InsertColumn(hwnd, iCol, pcol)
#define ListView_SetImageList(hwnd, himl, iImageList)
#define LVS_OWNERDRAWFIXED
#define ListView_GetColumnWidth(hwnd, iCol)
#define ListView_GetNextItem(hwnd, i, flags)
#define LVS_EX_FULLROWSELECT
#define ListView_GetItemCount(hwnd)
#define ListView_SetExtendedListViewStyle(hwndLV, dw)
#define ListView_DeleteAllItems(hwnd)
#define ListView_DeleteItem(hwnd, i)
#define ListView_SetColumn(hwnd, iCol, pcol)
#define ListView_EnsureVisible(hwndLV, i, fPartialOK)
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
ITEM(const STRING &Name, const STRING &Substitute, BYTE CharSet1, BYTE CharSet2)
LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]
WCHAR elfFullName[LF_FULLFACESIZE]
WCHAR lfFaceName[LF_FACESIZE]
#define LANG_USER_DEFAULT
TW_UINT32 TW_UINT16 TW_UINT16 MSG
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
_In_ HFONT _Out_ PUINT Height
_In_ WDFCOLLECTION _In_ WDFOBJECT Item
_In_ WDFIOTARGET _In_ PWDF_REQUEST_COMPLETION_PARAMS Params
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
#define ComboBox_GetCount(hwndCtl)
#define HANDLE_MSG(hwnd, message, fn)
HGDIOBJ WINAPI GetStockObject(_In_ int)
int WINAPI EnumFontFamiliesExW(_In_ HDC, _In_ PLOGFONTW, _In_ FONTENUMPROCW, _In_ LPARAM, _In_ DWORD)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define CHINESEBIG5_CHARSET
#define VIETNAMESE_CHARSET
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
int WINAPI SetBkMode(_In_ HDC, _In_ int)
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
BOOL WINAPI DeleteDC(_In_ HDC)
#define EASTEUROPE_CHARSET
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
#define HKEY_LOCAL_MACHINE
#define HKEY_CURRENT_USER
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
DWORD WINAPI GetSysColor(_In_ int)
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI AdjustWindowRect(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
#define CB_SETHORIZONTALEXTENT
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
int WINAPI MessageBoxA(_In_opt_ HWND hWnd, _In_opt_ LPCSTR lpText, _In_opt_ LPCSTR lpCaption, _In_ UINT uType)
#define LR_CREATEDIBSECTION
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
BOOL WINAPI SetForegroundWindow(_In_ HWND)
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
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)
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI UpdateWindow(_In_ HWND)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define COLOR_HIGHLIGHTTEXT
HDC WINAPI GetDC(_In_opt_ HWND)
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
HACCEL WINAPI LoadAcceleratorsW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
#define MB_ICONINFORMATION
int WINAPI MessageBoxIndirectW(_In_ CONST MSGBOXPARAMSW *lpmbp)
BOOL WINAPI TrackPopupMenu(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _Reserved_ int, _In_ HWND, _Reserved_ LPCRECT)
int WINAPI GetScrollPos(_In_ HWND, _In_ int)
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define MAKEINTRESOURCEW(i)
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define LR_LOADMAP3DCOLORS
#define TranslateAccelerator
BOOL WINAPI DestroyWindow(_In_ HWND)
int WINAPI GetSystemMetrics(_In_ int)
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
_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
#define TOKEN_ADJUST_PRIVILEGES
#define SE_PRIVILEGE_ENABLED