我對組裝很陌生,最近我一直在努力使 INT 21,43(將檔案屬性更改為只讀)作業。我正在使用 Windows 10、DOSBox x86 和 Turbo Assembler/Linker/Debugger,如果這有什么不同的話。據我所知,使用除錯器,它應該可以作業(根據檔案,未設定 CF 并且我沒有收到應有的錯誤代碼)。此外,如果我使用相同的 INT 21,43 來獲取(將 al 設定為 0)檔案的檔案屬性,該檔案已手動設定為只讀,則 CX 設定為 20,據我所知不會感覺,但 CF 沒有設定好,所以它說它有效。我希望你能幫我修復它,在此先感謝。
.model small
.stack 100h
.data
filename db "temp.txt",0 ; my file name
.code
start:
mov dx, @data
mov ds, dx
mov ah, 43h
mov al, 01h ; Set file attribute
mov cx, 01h ; 1 = read-only
lea dx, filename ; Set pointer to filename
int 21h
mov ah, 4ch ; Return to DOS
mov al, 0
int 21h
end start

uj5u.com熱心網友回復:
我只是嘗試從在 DOSBox 中運行的程式設定 ReadOnly 屬性,但它不起作用。
DOSBox 的幫助通過help /all,報告該ATTRIB命令不執行任何操作,并且僅提供兼容性。因此,DOS.function 43h (Get/Set File Attributes) 不會被實作是理所當然的。
由于 DOSBox 主要用于模擬舊的 DOS 游戲,因此可能沒有理由想要更改屬性。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/343794.html
