X-Git-Url: http://git.jankratochvil.net/?a=blobdiff_plain;f=lib%2Fmsvcrt%2Fsys_stat%2Fstat.c;h=7dc1b672a6c856b945212ea455803c54a5cc4878;hb=refs%2Ftags%2Fcaptive-0_8;hp=242c0bf7739756b6a05580f717b93e05b3b33fcf;hpb=569875a61758c7ea252562281ac4d95dce52f252;p=reactos.git diff --git a/lib/msvcrt/sys_stat/stat.c b/lib/msvcrt/sys_stat/stat.c index 242c0bf..7dc1b67 100644 --- a/lib/msvcrt/sys_stat/stat.c +++ b/lib/msvcrt/sys_stat/stat.c @@ -12,6 +12,7 @@ int _stat(const char* path, struct stat* buffer) { HANDLE findHandle; WIN32_FIND_DATAA findData; + char* ext; if (!buffer) { @@ -46,7 +47,15 @@ int _stat(const char* path, struct stat* buffer) if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) buffer->st_mode |= S_IFDIR; else + { buffer->st_mode |= S_IFREG; + ext = strrchr(path, '.'); + if (ext && (!stricmp(ext, ".exe") || + !stricmp(ext, ".com") || + !stricmp(ext, ".bat") || + !stricmp(ext, ".cmd"))) + buffer->st_mode |= S_IEXEC; + } if (!(findData.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) buffer->st_mode |= S_IWRITE;