add some missing attributes for win32

This commit is contained in:
Doug MacEachern 2005-08-07 04:19:15 +00:00
parent c3ca0a22fb
commit 3110870743
1 changed files with 26 additions and 0 deletions

View File

@ -176,7 +176,10 @@ static int fileattrs_get(sigar_t *sigar,
sigar_file_attrs_t *fileattrs, sigar_file_attrs_t *fileattrs,
int linkinfo) int linkinfo)
{ {
BY_HANDLE_FILE_INFORMATION info;
WIN32_FILE_ATTRIBUTE_DATA attrs; WIN32_FILE_ATTRIBUTE_DATA attrs;
HANDLE handle;
DWORD flags;
SIGAR_ZERO(fileattrs); SIGAR_ZERO(fileattrs);
@ -189,6 +192,29 @@ static int fileattrs_get(sigar_t *sigar,
fillin_fileattrs(fileattrs, &attrs, linkinfo); fillin_fileattrs(fileattrs, &attrs, linkinfo);
flags = fileattrs->type == SIGAR_FILETYPE_DIR ?
FILE_FLAG_BACKUP_SEMANTICS :
FILE_ATTRIBUTE_NORMAL;
handle = CreateFile(file,
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
flags,
NULL);
if (handle != INVALID_HANDLE_VALUE) {
if (GetFileInformationByHandle(handle, &info)) {
fileattrs->inode =
info.nFileIndexLow |
(info.nFileIndexHigh << 32);
fileattrs->device = info.dwVolumeSerialNumber;
fileattrs->nlink = info.nNumberOfLinks;
}
CloseHandle(handle);
}
return SIGAR_OK; return SIGAR_OK;
} }