文件扩展名
2011年7月24日 星期日
16:08
文件后缀名: 8+3格式,8个字节,文件名,3个字节后缀名
文件扩展名
维基百科,自由的百科全书
副檔名(Filename Extension,或作延伸檔名)是早期操作系统(如VMS/CP/M/DOS等)用来标志文件格式的一种机制。以DOS来说,一个副檔名是跟在主檔名后面的,由一个分隔符号分隔。在一个像“example.txt”的檔名中,example是主檔名,txt为副檔名,表示这个文件是一个純文字文件,“.”就是主檔名与副檔名的分隔符号。
DOS作業系统(包括Windows 3.x)把副檔名限制在3个字符以内。在其他Windows作業系統上,無論是16/32 位元的Windows 95、Windows 98、Windows ME還是32位的Windows NT、Windows 2000、Windows XP、Windows 2003和Windows Vista、Windows 7的FAT32檔案系统中包含有一个界面水平的修正,使得副檔名的字数可以达到256个英文字符,但是在系统层面,仍然保留3个字母的命名方式,这对很多用户来说都是不可见的。NTFS檔案系统则没有这种限制。(但NTFS不適用於95、98和ME)
檔案的副檔名可以根据外壳(shell)或浏览器的设置表示为显示的或隐藏的。传播电脑病毒或蠕虫病毒的恶意用户可能使用类似于LOVE-LETTER-FOR-YOU.TXT.vbs或JustForYou.TXT.exe这样看起来像是一个无害的纯文本文件的檔案传播给目标用户,如果檔案副檔名是隐藏的话(通常微软作業系统預设为隐藏的),那么这个VBScript檔案或帶有電腦病毒的執行檔就有可能欺骗到用户。
然而这种命名法有着很大的缺陷,甚至安全的缺陷。所以某些作業系统已经不再遵循副檔名的规范,而是采用更精确的檔案魔術數字(magic number)来确定檔案類型(参见UNIX/Linux系统)。不过Windows系列的作業系统即使是最新的Windows 7都依然保持这种命名格式。
文件扩展名更重要的作用是让系统决定当用户想打开这个文件的时候用哪种软件运行,如windows系统中exe文件是可执行文件,doc文件默认用office word打开。
源文档 <http://zh.wikipedia.org/wiki/%E6%96%87%E4%BB%B6%E6%89%A9%E5%B1%95%E5%90%8D>
8.3
维基百科,自由的百科全书
8.3是一種限制對檔案名稱的長度的方法,這在DOS和Microsoft Windows的Windows 95及Windows NT 3.5以的前版本中,在FAT檔案系統中的常用方法。在以前的CP/M及某些的通用資料和迪吉多微型電腦作業系統中使用。
8.3檔案名稱最多只可以含有8個字元,跟著最多3個字元的副檔名,利用『.』號將兩者連接起來。檔案及目錄名稱 是全部使用大寫字母的。
[编辑]對於8.3與長檔名的相容性
VFAT,是對於FAT系統中的加強版,在Windows 95和Windows NT 3.5加入。VFAT檔案系統可允許比傳統的8.3檔名,支援更長、而且能大小寫混合的長檔名(LFN)。
要維持對以前的應用程式(例如DOS和Windows 3.1)中的向下兼容性,每一個長檔名便會自動產生一個相應的8.3檔案名稱,可容許檔案可以繼續更名、刪除或開啟。
由於這對於一個長檔名沒有一個必然的算法建立一個8.3檔名,Windows會使用以下的常規以決定一個8.3檔案名稱是如何產生:
在Windows NT family中的NTFS檔案系統本身已經對長檔名作出支援,但8.3的名稱仍然會保留,供舊有的應用程式使用。這可以選擇性地關上這個功能以增加效能。
源文档 <http://zh.wikipedia.org/wiki/8.3>
Function 4Eh - Search for first match
Action: |
Searches the default or specified drive:directory for the first occurrence of a matching filename. |
On entry: |
AH = 4Eh |
Returns: |
CX = Attribute to use in search DS:DX = Segment:offset of ASCIIZ file specification |
Notes: |
|
CX = 0 if successful. The current DTA is filled as follows:
Bytes
0-20: Reserved for use by DOS in subsequent calls
21: Attribute of matched file
22-23: File time stamp
24-25: File date stamp
26-27: least significant word of file size
28-29: Most significant word of file size
30-42:: Filenarne.extension in ASCIIZ string form
Carry set if failed, AX = Error code as follows
02h path invalid
12h: no rnatching directory entry
This call assumes the DTA has heat set up by a successful call to function 1Ah.
Both wildcards (? and *) are permitted in filenames, but only the first matching name is returned.
if the attribute in CX is zero only normal files are searched. If the volume label attribute bit is set only volume labels are returned. For all other attribute settings, (i.e, hidden, system or directory) those files and normal files are searched
Function 4Fh - Search for next match
Action: |
Searches for the next matching file after a previously successful call to Function 4Eh. |
On entry: |
AH = 4Fh |
Returns: |
Carry clear if successful The current DTA is filled as follows:- Bytes 0-20 : reserved for use by DOS in subsequent calls 21: Attribute of matched file 22-23: File time stamp 24-25: File date stamp 26-27: least significant word of file size 28-29: Most significant word of file size 30-42: Filenarne.extension in ASCIIZ string form Carry set if failed, AX = Error code 12h: no matching directory entry |
Notes: |
When used this call requires a DTA containing returned data from a previously successful call to function 4Eh or 4Fh. Use of function 4Fh is only relevant when the original file spedacation used in function 4Eh included at least one wildcard. |
源文档 <http://bbc.nvg.org/doc/Master%20512%20Technical%20Guide/m512techb_int21.htm>
Function 4Eh - Find first matching file
AH = 4Eh
AL = flag used by APPEND
CX = attribute mask
DS:EDX -> ASCIZ file name (may include path and wildcards)
Returns
CF = clear on success (DTA as set with function 1Ah filled)
CF = set on error (AX = error code)
Function 4Fh - Find next matching file
AH = 4Fh
DTA as set with function 1Ah contains information from previous Find First call (function 4Eh)
Returns
CF = clear on success (DTA as set with function 1Ah filled)
CF = set on error (AX = error code)
源文档 <http://tippach.business.t-online.de/wdosx/int21api.html#f4e>
|
|||||||
|
.model small, c
源文档 <http://stackoverflow.com/questions/5653624/assembly-interrupt-21-4eh-4fh-problem>
|
||||||
|
ds:dx should contain the address of the (null terminated) filename (wildchars allowed). So for example to list all exes in c:\ the filename will be c:\*.exe. On return, if the carry flag is set to 1 there weren't files, otherwise the DTA is filled in this way: Offset Size in bytes Meaning You can tell DOS where you want the DTA to be placed with this simple snippet: mov dx,OFFSET youChoose ; DS:DX points to DTA
源文档 <http://stackoverflow.com/questions/5653624/assembly-interrupt-21-4eh-4fh-problem>
|
||||||
|
|||||||
|
.model small .stack .data
FileName db "c:\*.*",0 ;file name DTA db 128 dup(?) ;buffer to store the DTA ErrorMsg db "An Error has occurred - exiting.$"
.code
mov ax,@data ; set up ds to be equal to the mov ds,ax ; data segment mov es,ax ; also es
mov dx,OFFSET DTA ; DS:DX points to DTA mov ah,1AH ; function 1Ah - set DTA int 21h ; call DOS service
mov cx,3Fh ; attribute mask - all files mov dx,OFFSET FileName ; DS:DX points ASCIZ filename mov ah,4Eh ; function 4Eh - find first int 21h ; call DOS service
jc error ; jump if carry flag is set
LoopCycle:
mov dx,OFFSET FileName ; DS:DX points to file name mov ah,4Fh ; function 4fh - find next int 21h ; call DOS service
jc exit ; exit if carry flag is set
mov cx,13 ; length of filename mov si,OFFSET DTA+30 ; DS:SI points to filename in DTA xor bh,bh ; video page - 0 mov ah,0Eh ; function 0Eh - write character
NextChar:
lodsb ; AL = next character in string int 10h ; call BIOS service
loop NextChar
mov di,OFFSET DTA+30 ; ES:DI points to DTA mov cx,13 ; length of filename xor al,al ; fill with zeros rep stosb ; erase DTA
jmp LoopCycle ; continue searching
error:
mov dx,OFFSET ErrorMsg ; display error message mov ah,9 int 21h
exit:
mov ax,4C00h ; exit to DOS int 21h
end
源文档 <http://hi.baidu.com/yanjingtu/blog/item/a3dfb98f55c9f3ecf01f36c5.html>
|
||||||
|
|||||||
|
Cx bit 0 = 1 read-only file
源文档 <http://stackoverflow.com/questions/5653624/assembly-interrupt-21-4eh-4fh-problem>
|
||||||
|
使用 Microsoft Office OneNote 2007 进行创建
可在一个位置放置所有笔记和信息