⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 setattr.c

📁 dos 6.0 源代码 .对大家提高有一定的帮助。
💻 C
字号:
/* setattr - set attribute for a directory entry */

#if defined(NT)
#include <windows.h>
#elif defined(OS2)
#include <os2.h>
#define RESV_BITS 0x3F	/* Bits not in this mask are documented as "reserved */
#elif defined(DOS)
#include <dos.h>
#endif


int setattr (pname, attr)
char *pname;
int attr;
{
#if defined(NT)

    return SetFileAttributes(pname, attr) ? 0 : GetLastError() ;

#elif defined(OS2)

    return DosSetFileMode( (char far *)pname , attr & RESV_BITS , 0L );

#else

    union REGS regs;
#if ( defined(M_I86CM) || defined (M_I86LM) || defined (M_I86HM) )
    struct SREGS sregs;
#endif

    // Set File Attributes. ds:dx are correctly loaded
    // depending upon the memory model.

    regs.x.ax = 0x4301;
    regs.x.cx = attr;
#if ( defined(M_I86CM) || defined (M_I86LM) || defined (M_I86HM) )
    segread( &sregs);
    sregs.ds = FP_SEG(pname);
    regs.x.dx = FP_OFF(pname);
    intdosx(&regs, &regs, &sregs);
#else
    regs.x.dx = (unsigned) pname;
    intdos (&regs, &regs);
#endif
    return regs.x.cflag;

#endif

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -