The Samba-Bugzilla – Attachment 1750 Details for
Bug 3529
Hardlink count for directories incorrect... most of the time
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Windows testcase for hardlink count on Samba shares
zwqueryinformationfile.c (text/plain), 1.90 KB, created by
Corinna Vinschen
on 2006-02-22 04:45:44 UTC
(
hide
)
Description:
Windows testcase for hardlink count on Samba shares
Filename:
MIME Type:
Creator:
Corinna Vinschen
Created:
2006-02-22 04:45:44 UTC
Size:
1.90 KB
patch
obsolete
>#include <windows.h> >#include <ntsecapi.h> >#include <ddk/ntifs.h> >#include "stdio.h" >#include "stdlib.h" > >int >main (int argc, char *argv[]) >{ > char *fname; > wchar_t wc_path[4096]; > UNICODE_STRING upath; > OBJECT_ATTRIBUTES attr; > HANDLE fhdl; > NTSTATUS status; > PFILE_ALL_INFORMATION fai = (PFILE_ALL_INFORMATION) alloca (4096); > IO_STATUS_BLOCK io; > > while (--argc > 0) > { > fname = *++argv; > mbstowcs (wc_path, fname, 4096); > if (!RtlDosPathNameToNtPathName_U (wc_path, &upath, NULL, NULL)) > { > fprintf (stderr, "RtlDosPathNameToNtPathName_U(%s): %lx (%lu)\n", > fname, status, RtlNtStatusToDosError (status)); > continue; > } > InitializeObjectAttributes (&attr, &upath, > OBJ_CASE_INSENSITIVE | OBJ_INHERIT, > NULL, NULL); > >#define WORKING_LINK_COUNT_ACCESS (READ_CONTROL | FILE_READ_ATTRIBUTES \ > | FILE_READ_DATA) > >#define BROKEN_LINK_COUNT_ACCESS (READ_CONTROL | FILE_READ_ATTRIBUTES) > > status = ZwOpenFile (&fhdl, WORKING_LINK_COUNT_ACCESS, > &attr, &io, > FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, > FILE_OPEN_FOR_BACKUP_INTENT|FILE_OPEN_FOR_RECOVERY); > if (!NT_SUCCESS (status)) > { > fprintf (stderr, "ZwOpenFile(%s): %lx (%lu)\n", > fname, status, RtlNtStatusToDosError (status)); > continue; > } > status = ZwQueryInformationFile (fhdl, &io, fai, 4096, > FileAllInformation); > if (!NT_SUCCESS (status)) > { > fprintf (stderr, "ZwQueryInformationFile(%s): %lx (%lu)\n", > fname, status, RtlNtStatusToDosError (status)); > continue; > } > printf ("dir: %s, nlinks: %3lu, filesize: %8llu, allocsize: %8llu %s\n", > fai->StandardInformation.Directory ? "yes" : "no ", > fai->StandardInformation.NumberOfLinks, > fai->StandardInformation.EndOfFile.QuadPart, > fai->StandardInformation.AllocationSize.QuadPart, > fname); > ZwClose (fhdl); > RtlFreeUnicodeString (&upath); > } > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 3529
: 1750