读取给定文件的属性

Read a given file's attributes

我有一个任务,他们给我一个文件的路径,我必须打印那个文件的所有属性...

到目前为止,我在互联网上找到的所有内容都是关于 writing/reading 来自文件的,但这一点帮助也没有。

编辑:必须用汇编语言完成 EDIT2:我正在使用 windows 7 x64,但我所有的程序都是使用 TASM、TLINK 编译的,并且我正在使用 Turbo Debugger 进行 debuggin

因为这似乎是 homework/assignment 相关的,所以我将指导您了解执行任务所需的资源和中断信息,而无需编写实际代码。

  • 所有与 MS-DOS/BIOS 相关的东西最好的地方之一是 Ralph Brown's Interrupt List
  • 在处理 DOS 和文件时,大多数感兴趣的例程可能是 DOS Int 21h functions
  • 特别是您可能想要使用 DOS 的 Int 21h/AX=4300h Get File Attributes 功能。

    AX = 4300h
    DS:DX -> ASCIZ filename
    
    Return:
    CF clear if successful
    CX = file attributes (see #01420)
    AX = CX (DR DOS 5.0)
    CF set on error
    AX = error code (01h,02h,03h,05h) (see #01680 at AH=59h)
    

    您还会发现 file attribute bits

    Bit(s)  Description     (Table 01420)
    7      shareable (Novell NetWare)
           pending deleted files (Novell DOS, OpenDOS)
    6      unused
    5      archive
    4      directory
    3      volume label.
           Execute-only (Novell NetWare)
    2      system
    1      hidden
    0      read-only