This tool converts C struct definitions to NASM (Netwide Assembler) format. It supports a lot of platforms specific types (GCC/Clang/WinAPI) etc, for example (uint64_t, ULONGLONG, unsigned __int64, UNICODE_STRING).
This is the C struct in my_structs.h:
typedef struct _TEB_ACTIVE_FRAME_CONTEXT
{
ULONG Flags;
PSTR FrameName;
} TEB_ACTIVE_FRAME_CONTEXT, * PTEB_ACTIVE_FRAME_CONTEXT;This is the output struct in NASM syntax:
struc TEB_ACTIVE_FRAME_CONTEXT
.Flags resd 1
.FrameName resq 1
endstrucTo use the script, you need to have Python 3 installed on your machine.
You have to install pycparser:
pip install pycparser
python ctonasm.py -i <structs.h> -o <structs.inc>
We can see that the output nasm structs are nicely and correctly structred:

If you're too lazy to install Python, you can download the Windows .exe binary in the Releases page.
This tool is licened under MIT.