This is part of Family API which allow to create dual-os version of program runs under OS/2 and DOS

Note: This is legacy API call. It is recommended to use 32-bit equivalent

DosSetFileMode

This call changes the mode (attribute) of the specified file.

Syntax

DosSetFileMode (FileName, NewAttribute, Reserved)

Parameters

;FileName (PSZ) - input : Address of the file path name. :DosQSysInfo is called by an application during initialization to determine the maximum path length allowed by OS/2. ;NewAttribute (USHORT) - input : File's new attribute. File attributes are defined as follows: 'Bit Description' 15-6 Reserved and must be zero. 5 File archive 4 Subdirectory 3 Volume label 2 System file (excluded from normal directory searches) 1 Hidden file 0 Read only file :These bits may be set individually or in combination. For example, an attribute value of 0021H (bits 5 and 0 set to 1) indicates a read-only file that should be archived. ;Reserved (ULONG) - input : Reserved must be set to zero.

Return Code

rc (USHORT) - return Return code descriptions are: * 0 NO_ERROR * 2 ERROR_FILE_NOT_FOUND * 3 ERROR_PATH_NOT_FOUND * 5 ERROR_ACCESS_DENIED * 26 ERROR_NOT_DOS_DISK * 32 ERROR_SHARING_VIOLATION * 36 ERROR_SHARING_BUFFER_EXCEEDED * 87 ERROR_INVALID_PARAMETER * 108 ERROR_DRIVE_LOCKED * 206 ERROR_FILENAME_EXCED_RANGE

Remarks

Attributes for Volume Label (0008H) and Subdirectory (0010H) cannot be changed using DosSetFileMode. If these attributes are specified, ERROR_INVALID_PARAMETER is returned.

DosQFileMode is used to query the current settings for file attributes. Calling DosQFSInfo obtains volume label information.

Attributes of root directories cannot be changed using DosSetFileMode. If these attributes are specified, ERROR_ACCESS_DENIED is returned.

Example Code

C Binding

<PRE> #define INCL_DOSFILEMGR

USHORT rc = DosSetFileMode(FileName, NewAttribute, Reserved);

PSZ FileName; /* File path name string */ USHORT NewAttribute; /* New attribute of file */ ULONG 0; /* Reserved (must be zero) */

USHORT rc; /* return code */ </PRE>

MASM Binding

<PRE> EXTRN DosSetFileMode:FAR INCL_DOSFILEMGR EQU 1

PUSH@ ASCIIZ FileName ;File path name string PUSH WORD NewAttribute ;New attribute of file PUSH DWORD 0 ;Reserved (must be zero) CALL DosSetFileMode

Returns WORD </PRE>

Note

Text based on http://www.edm2.com/index.php/DosSetFileMode

Family API
DOS	Process Manager	DosBeep DosExit DosSleep DosExecPgm
File Manager	DosChDir DosChgFilePtr DosClose DosDelete DosDupHandle DosMkDir DosMove DosQCurDir DosQCurDisk DosSetFileMode DosOpen DosQFileInfo DosRead DosQFileMode DosQFSInfo DosQVerify DosRmDir DosSelectDisk DosFindClose DosFindFirst DosFindNext DosSetFileInfo DosSetVerify DosWrite DosFileLocks DosSetFHandState DosNewSize DosBufReset DosQFHandState DosSetFSinfo DosShutdown
Memory Manager	DosFreeSeg DosSubAlloc DosSubFree DosSubSet DosAllocHuge DosAllocSeg DosReallocHuge DosReallocSeg DosGetHugeShift DosCreateCSAlias
NLS	DosCaseMap DosGetCtryInfo DosGetDBCSEv DosSetCtryCode DosGetCollate DosGetMessage DosInsMessage DosPutMessage
Date and Time	DosSetDateTime DosGetDateTime
Devices	DosDevConfig DosDevIOCtl DosDevIOCtl2
Signals	DosHoldSignal DosSetSigHandler
Misc	BadDynLink DosGetEnv DosGetMachineMode DosGetVersion DosError DosErrClass DosSetVec
KBD	KbdCharIn KbdFlushBuffer KbdGetStatus KbdSetStatus KbdStringIn KbdPeek
VIO	VioGetBuf VioGetConfig VioGetCurPos VioGetCurType VioGetPhysBuf VioReadCellStr VioReadCharStr VioScrollUp VioScrollDn VioScrollLf VioScrollRt VioScrUnLock VioSetCurPos VioSetCurType VioSetMode VioGetMode VioShowBuf VioWrtCellStr VioWrtCharStr VioWrtCharStrAtt VioWrtNAttr VioWrtNCell VioWrtNChar VioWrtTTY VioScrLock VioPopUp
Tools	BIND
Modules	DOSCALLS.DLL VIOCALLS.DLL KBDCALLS.DLL MSG.DLL
Libraries	API.LIB OS2386.LIB FAPI.LIB DOSCALLS.LIB SUBCALLS.LIB