So basically I am dealing with a pseudo asm code on Win32, and I am trying to make it re-assemble.
In the code, I see data structure like this:
errtable errentry <1, 16h>
errentry <2, 2>
errentry <3, 2>
errentry <4, 18h>
errentry <5, 0Dh>
.....
And in the .text section, I see code like this:
cmp eax, dword ptr errtable.oscode[ecx*8]
mov eax, errtable.errnocode[ecx*8]
Basically asm code/data like those above can not be directly re-assembled by NASM/MASM on windows 32 bit. So I have to adjust this code/data...
I searched on line and find the definition of the data structure in C:
struct errentry {
unsigned long oscode; /* OS return value */
int errnocode; /* System V error code */
};
static struct errentry errtable[] = {
{ ERROR_INVALID_FUNCTION, EINVAL }, /* 1 */
{ ERROR_FILE_NOT_FOUND, ENOENT }, /* 2 */
{ ERROR_PATH_NOT_FOUND, ENOENT }, /* 3 */
{ ERROR_TOO_MANY_OPEN_FILES, EMFILE }, /* 4 */
{ ERROR_ACCESS_DENIED, EACCES }, /* 5 */
{ ERROR_INVALID_HANDLE, EBADF }, /* 6 */
{ ERROR_ARENA_TRASHED, ENOMEM }, /* 7 */
{ ERROR_NOT_ENOUGH_MEMORY, ENOMEM }, /* 8 */
.........
So my question is : How to modify the asm code/data to make it re-assemble?
Thank you!