[英]Initializing a struct in yasm x86 assembly
I'm trying to initialize a WIN32_FIND_DATA structure in which to store info about files found with FindFirstFile and FindNextFile windows functions. 我正在尝试初始化WIN32_FIND_DATA结构,在其中存储有关使用FindFirstFile和FindNextFile Windows函数找到的文件的信息。 The problem is that i can't figure out how to initialize a stuct in yasm.
问题是我不知道如何在Yasm中初始化构造。 Here's my code:
这是我的代码:
struc FILETIME
.dwLowDateTime resd 1
.dwHighDateTime resd 1
endstruc
struc WIN32_FIND_DATA
.dwFileAttributes resd 1
.ftCreationTime resb FILETIME_size
.ftLastAccessTime resb FILETIME_size
.ftLastWriteTime resb FILETIME_size
.nFileSizeHigh resd 1
.nFileSizeLow resd 1
.dwReserved0 resd 1
.dwReserved1 resd 1
.cFileName resb 260
.cAlternateFileName resb 14
endstruc
[bits 32]
section .text
extern _exit
global _main
_main:
push 0
call _exit
ret
section .data
dataWin32:
istruc WIN32_FIND_DATA
at a, dd 0
at b, db 0
at c, db 0
at d, db 0
at e, dd 0
at f, dd 0
at g, dd 0
at h, dd 0
at i, db 0
a
iend
The errors i get are: 我得到的错误是:
testStruct.asm:38: error: undefined symbol `b' (first use)
testStruct.asm:38: error: (Each undefined symbol is reported only once.)
testStruct.asm:39: error: undefined symbol `c' (first use)
testStruct.asm:40: error: undefined symbol `d' (first use)
testStruct.asm:41: error: undefined symbol `e' (first use)
testStruct.asm:42: error: undefined symbol `f' (first use)
testStruct.asm:43: error: undefined symbol `g' (first use)
testStruct.asm:44: error: undefined symbol `h' (first use)
testStruct.asm:45: error: undefined symbol `i' (first use)
dataWin32:
istruc WIN32_FIND_DATA
at WIN32_FIND_DATA.dwFileAttributes,dd 0
at WIN32_FIND_DATA.ftCreationTime,db 0
at WIN32_FIND_DATA.ftLastAccessTime, db 0
at WIN32_FIND_DATA.ftLastWriteTime, db 0
at WIN32_FIND_DATA.nFileSizeHigh, dd 0
at WIN32_FIND_DATA.nFileSizeLow, dd 0
at WIN32_FIND_DATA.dwReserved0, dd 0
at WIN32_FIND_DATA.dwReserved1, dd 0
at WIN32_FIND_DATA.cFileName, db 0
at WIN32_FIND_DATA.cAlternateFileName,db 0
iend
You have to specify the struct name,otherwise the assembler cannot know which fields you are referring to. 您必须指定结构名称,否则汇编器无法知道您要引用的字段。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.