     1                                  ;	SCCSID = @(#)finfo.asm	1.1 85/04/11
     2                                  ;TITLE	FILE_INFO - Internal Get/Set File Info routines
     3                                  ;NAME	FILE_INFO
     4                                  ; Low level routines for returning file information and setting file
     5                                  ;   attributes
     6                                  ;
     7                                  ;   GET_FILE_INFO
     8                                  ;   SET_FILE_ATTRIBUTE
     9                                  ;
    10                                  ;   Modification history:
    11                                  ;
    12                                  ;	Created: ARR 30 March 1983
    13                                  ;
    14                                  
    15                                  ;
    16                                  ; get the appropriate segment definitions
    17                                  ;
    18                                  [list -]
    18          ******************       warning: redefining multi-line macro `struc' [-w+pp-macro-redef-multi]
    14                              <4> [list -]
    14                              <3> [list -]
     3                              <2> 
     4                              <2> addsection DOSSTART, align=16 PUBLIC class=DOSSTART
     5                              <2> ; (no prior section) ; DOSSTART		ENDS
     6                              <2> 
     7                              <2> addsection DOSSTARTJUMP, align=1 PUBLIC class=START
     8                              <2> ; (no prior section) ; DOSSTARTJUMP		ENDS
     9                              <2> 
    10                              <2> addsection CONSTANTS, align=2 PUBLIC class=CONST
    11                              <2> ; (no prior section) ; CONSTANTS	ENDS
    12                              <2> 
    13                              <2> addsection DATA, align=2 PUBLIC class=DATA
    14                              <2> ; (no prior section) ; DATA		ENDS
    15                              <2> 
    16                              <2> addsection TABLE, align=2 PUBLIC class=TABLE
    17                              <2> ; (no prior section) ; TABLE		ENDS
    18                              <2> 
    19                              <2> addsection DOSDATATABLE, align=2 PUBLIC class=DOSDATACODE
    20                              <2> ; (no prior section) ; DOSDATATABLE		ENDS
    21                              <2> 
    22                              <2> addsection DOSDATACODE, align=1 PUBLIC class=DOSDATACODE
    23                              <2> ; (no prior section) ; DOSDATACODE		ENDS
    24                              <2> 
    25                              <2> addsection DOSBIODATA, align=2 PUBLIC class=DOSBIODATA
    26                              <2> 
    27                              <2> addsection LAST, align=16 PUBLIC class=LAST
    28                              <2> ; (no prior section) ; LAST		ENDS
    29                              <2> 
    30                              <2> group DOSGROUP DOSSTART DOSSTARTJUMP CONSTANTS DATA TABLE DOSDATATABLE DOSDATACODE DOSBIODATA LAST
     8                              <1> 
     9                              <1> %include "dcodeseg.nas"
     1                              <2> 
     2                              <2> %ifndef DCODESEGNAS
     3                              <2> %assign DCODESEGNAS 1
     4                              <2> 
     5                              <2> section DOSCODETABLE align=2 PUBLIC class=DOSCODE
     6                              <2> ; (no prior section) ; DOSCODETABLE		ENDS
     7                              <2> section DOSCODECODE align=1 PUBLIC class=DOSCODE
     8                              <2> ; (no prior section) ; DOSCODECODE		ENDS
     9                              <2> section DOSBIOCODE align=2 PUBLIC class=DOSCODE
    10                              <2> section BIOCODE	align=2 PUBLIC class=DOSCODE
    11                              <2> 
    12                              <2> %ifnidni DOSENTRYGROUP, DOSCODEGROUP
    13                              <2>  group DOSCODEGROUP DOSCODETABLE DOSCODECODE DOSBIOCODE BIOCODE
    14                              <2> %endif
    15                              <2> 
    16                              <2> %endif
    10                              <1> 
    11                              <1> section LAST
    12                              <1> ; (no prior section) ; LAST		ENDS
    20                                  
    21                                  [list +]
    22                                  section DOSCODECODE
    23                                  [list -]
    23          ******************       warning: out: ... for DOS Version 4.00 ... [-w+user]
    23          ******************       warning: out: BPB.INC... [-w+user]
    23          ******************       warning: out: ... CLONE version build switch on ... [-w+user]
    23          ******************       warning: out: DEVSYM.INC... [-w+user]
    32                                  
    33                                  %iassign Installed TRUE
    34                                  
    35                                  	i_need	THISCDS,DWORD
    36                                  	i_need	CURBUF,DWORD
    37                                  	i_need	NoSetDir,BYTE
    38                                  	i_need	THISDRV,BYTE
    39                                  	I_need	EXTERR_CLASS,BYTE
    40                                  	I_need	EXTERR_ACTION,BYTE
    41                                  	I_need	EXTERR_LOCUS,BYTE
    42                                  	i_need	DMAADD,DWORD
    43                                  	i_need	FastOpenFlg,BYTE
    44                                  
    45                                   assume nocheck, ss:DOSGROUP
    46                                  
    47                                  ;SUBTTL GET_FILE_INFO -- Get File Information
    48                                  ;PAGE
    49                                  
    50                                  ; Inputs:
    51                                  ;	[WFP_START] Points to WFP string ("d:/" must be first 3 chars, NUL
    52                                  ;		terminated)
    53                                  ;	[CURR_DIR_END] Points to end of Current dir part of string
    54                                  ;		( = -1 if current dir not involved, else
    55                                  ;		 Points to first char after last "/" of current dir part)
    56                                  ;	[THISCDS] Points to CDS being used
    57                                  ;		(Low word = -1 if NUL CDS (Net direct request))
    58                                  ;	[SATTRIB] Is attribute of search, determines what files can be found
    59                                  ; Function:
    60                                  ;	Get Information about a file
    61                                  ; Returns:
    62                                  ;	CARRY CLEAR
    63                                  ;	    AX = Attribute of file
    64                                  ;	    CX = Time stamp of file
    65                                  ;	    DX = Date stamp of file
    66                                  ;	    BX:DI = Size of file (32 bit)
    67                                  ;	CARRY SET
    68                                  ;	    AX is error code
    69                                  ;		error_file_not_found
    70                                  ;			Last element of path not found
    71                                  ;		error_path_not_found
    72                                  ;			Bad path (not in curr dir part if present)
    73                                  ;		error_bad_curr_dir
    74                                  ;			Bad path in current directory part of path
    75                                  ; DS preserved, others destroyed
    76                                  
    77                                  	procedure   GET_FILE_INFO,NEAR
    77          ******************       warning: proc GET_FILE_INFO... [-w+user]
    78                                  	DOSAssume   CS,<DS>,"Get_File_Info"
    79                                  	ASSUME	ES:NOTHING
    80                                  
    81 00000000 E8(0000)                	Invoke	TestNet
    82                                  Local_Info equ LOCAL_INFO	; NASM port label
    83 00000003 7306                    	JNC	Local_Info
    84                                  ;	invoke	OWN_SHARE2		       ;IFS. IFS owns share ?		;AN000;
    85                                  ;	JZ	ifsshare		       ;IFS. yes			;AN000;
    86                                  ;	PUSH	WORD PTR [DMAADD+2]	       ;IFS. save DMAADD		;AN000;
    87                                  ;	PUSH	WORD PTR [DMAADD]	       ;IFS.				;AN000;
    88                                  ;	invoke	IFS_SEARCH_FIRST	       ;IFS. do search first		;AN000;
    89                                  ;	JC	nofiles 		       ;IFS. file not existing		;AN000;
    90                                  delete_next_file:			       ;IFS.				;AN000;
    91                                  ;	invoke	IFS_REN_DEL_CHECK	       ;IFS. do REN_DEL_CHECK		;AN000;
    92                                  ;	JNC	share_okok		       ;IFS. share ok			;AN000;
    93                                  ;	MOV	AX,error_sharing_violation     ;IFS. share violation		;AN000;
    94                                  ;	JMP	SHORT nofiles		       ;IFS.				;AN000;
    95                                  share_okok:
    96                                  ;	POP	WORD PTR [DMAADD]	       ;IFS. retor DMAADD		;AN000;
    97                                  ;	POP	WORD PTR [DMAADD+2]	       ;IFS.				;AN000;
    98                                  ifsshare:
    99                                  %IFN Installed
   100                                  	transfer NET_GET_FILE_INFO
   101                                  %ELSE
   102                                  multNET equ MultNET	; NASM port equate
   103 00000005 B80F11                  	MOV	AX,(multNET << 8) | 15
   104 00000008 CD2F                    	INT	2FH
   105 0000000A C3                      	return
   106                                  %ENDIF
   107                                  nofiles:
   108                                  ;	POP	WORD PTR [DMAADD]	       ;IFS. retor DMAADD		;AN000;
   109                                  ;	POP	WORD PTR [DMAADD+2]	       ;IFS.				;AN000;
   110                                  ;	ret				       ;IFS. return
   111                                  
   112                                  LOCAL_INFO:
   113 0000000B E8(0000)                	EnterCrit   critDisk
   114 0000000E C606[0000]01            	MOV	byte [NoSetDir],1		; if we find a dir, don't change to it
   115 00000013 E8(0000)                	invoke	Get_FAST_PATH
   116                                  info_check:
   117 00000016 7313                    	JNC	info_check_dev
   118                                  
   119                                  NO_PATH:
   120                                  	DOSAssume   CS,<DS>,"FINFO/No_Path"
   121                                  	ASSUME	ES:NOTHING
   122                                  
   123 00000018 750C                    	JNZ	bad_path
   124 0000001A 08C9                    	OR	CL,CL
   125 0000001C 7408                    	JZ	bad_path
   126                                  info_no_file:
   127 0000001E B80200                  	MOV	AX,error_file_not_found
   128                                  BadRet:
   129 00000021 F9                      	STC
   130                                  justRet:
   131 00000022 E8(0000)                	LeaveCrit   critDisk
   132 00000025 C3                      	return
   133                                  
   134                                  bad_path:
   135 00000026 B80300                  	MOV	AX,error_path_not_found
   136 00000029 EBF6                    	jmp	BadRet
   137                                  
   138                                  info_check_dev:
   139 0000002B 08E4                    	OR	AH,AH
   140 0000002D 78EF                    	JS	info_no_file		; device
   141 0000002F 1E                      	PUSH	DS
   142 00000030 8E1E[0200]              	MOV	DS,WORD PTR [CURBUF+2]
   143                                  ASSUME	DS:NOTHING
   144 00000034 89DE                    	MOV	SI,BX
   145 00000036 31DB                    	XOR	BX,BX			; Assume size=0 (dir)
   146 00000038 89DF                    	MOV	DI,BX
   147 0000003A 8B4C16                  	MOV	CX,[SI + dir_time]
   148 0000003D 8B5418                  	MOV	DX,[SI + dir_date]
   149 00000040 30E4                    	XOR	AH,AH
   150 00000042 8A440B                  	MOV	AL,[SI + dir_attr]
   151 00000045 A810                    	TEST	AL,attr_directory
   152 00000047 7506                    	JNZ	NO_SIZE
   153 00000049 8B7C1C                  	MOV	DI,[SI + dir_size_l]
   154 0000004C 8B5C1E                  	MOV	BX,[SI + dir_size_h]
   155                                  NO_SIZE:
   156 0000004F 1F                      	POP	DS
   157                                   assume ds:DOSGROUP
   158 00000050 F8                      	CLC
   159                                  JustRet equ justRet	; NASM port label
   160 00000051 EBCF                    	jmp	JustRet
   161                                  EndProc GET_FILE_INFO
   162                                  
   163                                  Break	<SET_FILE_ATTRIBUTE -- Set File Attribute>
   164                                  
   165                                  ; Inputs:
   166                                  ;	[WFP_START] Points to WFP string ("d:/" must be first 3 chars, NUL
   167                                  ;		terminated)
   168                                  ;	[CURR_DIR_END] Points to end of Current dir part of string
   169                                  ;		( = -1 if current dir not involved, else
   170                                  ;		 Points to first char after last "/" of current dir part)
   171                                  ;	[THISCDS] Points to CDS being used
   172                                  ;		(Low word = -1 if NUL CDS (Net direct request))
   173                                  ;	[SATTRIB] is attribute of search (determines what files may be found)
   174                                  ;	AX is new attributes to give to file
   175                                  ; Function:
   176                                  ;	Set File Attributes
   177                                  ; Returns:
   178                                  ;	CARRY CLEAR
   179                                  ;	    No error
   180                                  ;	CARRY SET
   181                                  ;	    AX is error code
   182                                  ;		error_file_not_found
   183                                  ;			Last element of path not found
   184                                  ;		error_path_not_found
   185                                  ;			Bad path (not in curr dir part if present)
   186                                  ;		error_bad_curr_dir
   187                                  ;			Bad path in current directory part of path
   188                                  ;		error_access_denied
   189                                  ;			Attempt to set an attribute which cannot be set
   190                                  ;			(attr_directory, attr_volume_ID)
   191                                  ;		error_sharing_violation
   192                                  ;			Sharing mode of file did not allow the change
   193                                  ;			(this request requires exclusive write/read access)
   194                                  ;			(INT 24H generated)
   195                                  ; DS preserved, others destroyed
   196                                  
   197                                  	procedure   SET_FILE_ATTRIBUTE,NEAR
   197          ******************       warning: proc SET_FILE_ATTRIBUTE... [-w+user]
   198                                  	DOSAssume   CS,<DS>,"Set_File_Attribute"
   199                                  	ASSUME	ES:NOTHING
   200                                  
   201 00000053 A9D8FF                  	TEST	AX,~ attr_changeable
   202 00000056 7414                    	JZ	set_look
   203                                  BAD_ACC:
   204                                  ExtErr_Locus equ EXTERR_LOCUS	; NASM port label
   205                                  errLoc_UNK equ errLOC_Unk	; NASM port equate
   206 00000058 C606[0000]01            	MOV	byte [ExtErr_Locus],errLoc_UNK
   207                                  ExtErr_Class equ EXTERR_CLASS	; NASM port label
   208                                  errClass_Apperr equ errCLASS_Apperr	; NASM port equate
   209 0000005D C606[0000]07            	MOV	byte [ExtErr_Class],errClass_Apperr
   210                                  ExtErr_Action equ EXTERR_ACTION	; NASM port label
   211                                  errAct_Abort equ errACT_Abort	; NASM port equate
   212 00000062 C606[0000]04            	MOV	byte [ExtErr_Action],errAct_Abort
   213 00000067 B80500                  	MOV	AX,error_access_denied
   214 0000006A F9                      	STC
   215 0000006B C3                      	return
   216                                  
   217                                  set_look:
   218 0000006C E8(0000)                	Invoke	TestNet
   219                                  Local_Set equ LOCAL_SET	; NASM port label
   220 0000006F 7308                    	JNC	Local_Set
   221                                  
   222                                  %IFN Installed
   223                                  	transfer NET_SEQ_SET_FILE_ATTRIBUTE
   224                                  %ELSE
   225 00000071 50                      	PUSH	AX
   226 00000072 B80E11                  	MOV	AX,(multNET << 8) | 14
   227 00000075 CD2F                    	INT	2FH
   228 00000077 5B                      	POP	BX			; clean stack
   229 00000078 C3                      	return
   230                                  %ENDIF
   231                                  
   232                                  LOCAL_SET:
   233 00000079 E8(0000)                	EnterCrit   critDisk
   234 0000007C 50                      	PUSH	AX			; Save new attributes
   235 0000007D C606[0000]01            	MOV	byte [NoSetDir],1		; if we find a dir, don't change to it
   236 00000082 E8(0000)                	invoke	GetPath 		; get path through fastopen if there	 ;AC000;
   237 00000085 7303                    	JNC	set_check_device
   238 00000087 5B                      	POP	BX			; Clean stack (don't zap AX)
   239 00000088 EB8E                    	JMP	NO_PATH
   240                                  
   241                                  set_check_device:
   242 0000008A 08E4                    	OR	AH,AH
   243 0000008C 7906                    	JNS	set_check_share
   244 0000008E 58                      	POP	AX
   245 0000008F E8(0000)                	LeaveCrit   critDisk
   246 00000092 EBC4                    	JMP	BAD_ACC 		; device
   247                                  
   248                                  set_check_share:
   249 00000094 58                      	POP	AX			; Get new attributes
   250 00000095 E8(0000)                	invoke	REN_DEL_Check
   251 00000098 7305                    	JNC	set_do
   252 0000009A B82000                  	MOV	AX,error_sharing_violation
   253                                  ok_bye equ OK_BYE	; NASM port label
   254 0000009D EB34                    	jmp	short	ok_bye
   255                                  
   256                                  set_do:
   257 0000009F C43E[0000]              	LES	DI,[CURBUF]
   258 000000A3 2680670BD8              	AND	BYTE PTR [ES:BX + dir_attr],~ attr_changeable
   259 000000A8 2608470B                	OR	BYTE PTR [ES:BX + dir_attr],AL
   260                                  
   261 000000AC 26F6450540              	TEST	byte [ES:DI + buf_flags],buf_dirty  ;LB. if already dirty		;AN000;
   262 000000B1 7508                    	JNZ	yesdirty		  ;LB.	  don't increment dirty count   ;AN000;
   263 000000B3 E8(0000)                	invoke	INC_DIRTY_COUNT 	  ;LB.					;AN000;
   264 000000B6 26804D0540              	OR	byte [ES:DI + buf_flags],buf_dirty
   265                                  yesdirty:
   266 000000BB A0[0000]                	MOV	AL,[THISDRV]
   267                                  ;;;; 10/1/86 F.C update fastopen cache
   268 000000BE 52                      	PUSH	DX
   269 000000BF 57                      	PUSH	DI
   270 000000C0 B400                    	MOV	AH,0		  ; dir entry update
   271 000000C2 88C2                    	MOV	DL,AL		  ; drive number A=0,B=1,,
   272 000000C4 89DF                    	MOV	DI,BX		  ; ES:DI -> dir entry
   273 000000C6 E8(0000)                	invoke	FastOpen_Update
   274 000000C9 5F                      	POP	DI
   275 000000CA 5A                      	POP	DX
   276                                  ;;;; 9/11/86 F.C update fastopen cache
   277 000000CB E8(0000)                	invoke	FlushBuf
   278 000000CE 7303                    	JNC	OK_BYE
   279 000000D0 B80200                  	MOV	AX,error_file_not_found
   280                                  OK_BYE:
   281 000000D3 E8(0000)                	LeaveCrit   critDisk
   282 000000D6 C3                      	return
   283                                  
   284                                  EndProc SET_FILE_ATTRIBUTE
   285                                  
   286                                  
   287                                  
   288                                  	procedure   GET_FAST_PATH,NEAR
   288          ******************       warning: proc GET_FAST_PATH... [-w+user]
   289                                  	ASSUME	DS:NOTHING,ES:NOTHING
   290                                  
   291 000000D7 36800E[0000]01          	OR	byte [ss:FastOpenFlg],FastOpen_Set ;FO. trigger fastopen		;AN000;
   292 000000DD E8(0000)                	invoke	GetPath
   293 000000E0 9C                      	PUSHF			       ;FO.					;AN000;
   294 000000E1 368026[0000]80          	AND    byte [ss:FastOpenFlg],Fast_yes  ;FO. clear all fastopen flags		;AN000;
   295 000000E7 9D                      	POPF			       ;FO.					;AN000;
   296 000000E8 C3                      	return
   297                                  
   298                                  EndProc GET_FAST_PATH
   299                                  
   300                                      END
