Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
C# Get charmap Unicode Character Name
using System;
using System.Runtime.InteropServices;
namespace GetCharName
{
static class Program
{
// found using IDA 6.8 Pro
// charmap loads a DLL named GetUName.dll
// which has a selfnamed function and pulls
// the name of a unicode character using an
// int and loads the name into a string
// in c++, it is used like
// GetUName(int, LPWSTR *)
[DllImport("GetUName.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int GetUName(int x, [MarshalAs(UnmanagedType.LPWStr)]string lpBuffer);
// create string buffer to load name in (255 in case of large names, can be changed)
public static string charactername = new string('*', 255);
static void Main()
{
GetUName('A', charactername);
// asteriks are still left in (* because names don't include
// any), simply cut the length so they aren't included
charactername = charactername.Substring(0, charactername.IndexOf('*') - 1);
Console.Write(charactername);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.