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

📄 access.c

📁 这是一个开放源代码的与WINNT/WIN2K/WIN2003兼容的操作系统
💻 C
字号:
#include <precomp.h>
#include <tchar.h>

#define NDEBUG
#include <internal/debug.h>

#ifdef _UNICODE
 #define _TS S
#else
 #define _TS s
#endif


/*
 * @implemented
 */
int _taccess( const _TCHAR *_path, int _amode )
{
    DWORD Attributes = GetFileAttributes(_path);
    DPRINT(MK_STR(_taccess)"('%"sT"', %x)\n", _path, _amode);

    if (Attributes == (DWORD)-1) {
    	_dosmaperr(GetLastError());
        return -1;
    }
    if ((_amode & W_OK) == W_OK) {
        if ((Attributes & FILE_ATTRIBUTE_READONLY) == FILE_ATTRIBUTE_READONLY) {
            __set_errno(EACCES);
            return -1;
        }
    }

    return 0;
}



/*
 * INTERNAL
 */
int access_dirT(const _TCHAR *_path)
{
    DWORD Attributes = GetFileAttributes(_path);
    DPRINT(MK_STR(is_dirT)"('%"sT"')\n", _path);

    if (Attributes == (DWORD)-1) {
         _dosmaperr(GetLastError());
        return -1;
    }

    if ((Attributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY)
    {
      __set_errno(EACCES);
      return -1;
    }

   return 0;
}

⌨️ 快捷键说明

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