C# Get charmap Unicode Character Name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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