I’m trying to redefine this C structure to Lua with alien 0.50 module however I have a two arrays of char at the end. Both szLibraryPath and szLibraryName are originally defined as
char szLibraryPath[MAX_PATH] in C. Can this be done with alien?
LIBRARY_ITEM_DATA = alien.defstruct{
{ "hFile", "long" },
{ "BaseOfDll", "long" },
{ "hFileMapping", "long" },
{ "hFileMappingView", "long" },
{ "szLibraryPath", "byte" }, -- fix to MAX_PATH
{ "szLibraryName", "byte" } -- fix to MAX_PATH
}
Take a look at this answer by the author of Alien.
Your structure should look like this:
And you would get/set the arrays by manually reading/writing bytes at the end of the struct (using the code in the link). To access the second array, add MAX_PATH to all the offsets.