DEV Community


Posted on • Updated on • Originally published at


(Feb'19) Get Unicode Character Name in C# (DllImport) (charmap mechanism)

Found this 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 *)
In C#, it can be imported this way:

[DllImport("GetUName.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int GetUName(int x, [MarshalAs(UnmanagedType.LPWStr)]string lpBuffer);
Enter fullscreen mode Exit fullscreen mode

Then, create a string buffer to load name in (255 in case of large names, can be changed)
public static string charactername = new string('*', 255);
And use in the program like so:

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);
Enter fullscreen mode Exit fullscreen mode

Included this in a program I wrote that inserts a character in the previously active window:
Also shared this on the pinvoke wiki:

Top comments (0)

An Animated Guide to Node.js Event Loop

Node.js doesn’t stop from running other operations because of Libuv, a C++ library responsible for the event loop and asynchronously handling tasks such as network requests, DNS resolution, file system operations, data encryption, etc.

What happens under the hood when Node.js works on tasks such as database queries? We will explore it by following this piece of code step by step.