Skip to content

Instantly share code, notes, and snippets.

@donnaken15
Created February 20, 2019 23:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donnaken15/04c50e77b1bbf41c3afa1fffe5ae2148 to your computer and use it in GitHub Desktop.
Save donnaken15/04c50e77b1bbf41c3afa1fffe5ae2148 to your computer and use it in GitHub Desktop.
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