Menu
  • HOME
  • TAGS

c# How to set FileSystemRights.CreateDirectories to Deny but FileSystemRights.AppendData to Allow

c#,permissions,ntfs

The problem is solved the following way: // Create a new DirectoryInfo object. DirectoryInfo directoryInfo = new DirectoryInfo(_folderPath); // Get a DirectorySecurity object that represents the // current security settings. DirectorySecurity directorySecurity = directoryInfo.GetAccessControl(); SecurityIdentifier sidAll = new SecurityIdentifier("S-1-1-0"); //Set the permissions for files in that folder to allow FileSystemRights...

How to copy directory symbolic link as a link to the target?

c++,windows,winapi,filesystems,ntfs

You're asking to copy a directory using the CopyFileEx API. The fact that it's a symbolic link doesn't get resolved until after the check that it's a directory, which means you can't use this API to copy a directory symlink. Directory symlinks are treated slightly differently from file symlinks -...

GetFileAttributes inconsistency — why?

c++,winapi,ntfs

The three examples you give in the question and comments all refer to different things. \\?\D: refers to a volume, for which file attributes do not exist. \\?\D:\ is the root directory of the drive which does have attributes. D: is a little harder to define. I believe that the...

Opening many small files on NTFS is way too slow

c++,windows,performance,ntfs,directory-traversal

What you are trying to do is intrinsically difficult for any operating system to do efficiently. 45,000 subdirectories requires a lot of disk access no matter how it is sliced. Any file over about 1,000 bytes is "big" as far as NTFS is concerned. If there were a way to...

Why are permissions wonky when my IIS worker saves a file in ASP.NET?

c#,asp.net,iis,permissions,ntfs

I suspect the problem is with the use of Path.GetTempFileName followed by File.Move. When the uploaded file is saved to tempFilename, the temporary file gets whatever permissions are assigned to the temporary folder. Moving the file preserves those permissions as is instead of recalculating the inheritable permissions based on the...

Recurse a limited amount of folders

powershell,recursion,ntfs

You can manually recurse 1 level easily enough. Try this on for size: if ($ComputerName -eq '.'){ $Path = $Folder } else { $Path = "\\$ComputerName\$Folder" }ls if ($OutputFile){ gci c:\|%{if($_.PSIsContainer){GCI $_.FullName|get-acl};$_|get-acl}|sort PSParentPath|Export-CSV $OutputFile -NoType } else{ gci c:\|%{if($_.PSIsContainer){GCI $_.FullName|get-acl};$_|get-acl}|sort PSParentPath|FT -Auto } ...

Replace NTFS Permissions with PowerShell

permissions,powershell-v3.0,ntfs

I guess this question rather belongs to Server Fault, but I'd use ADMT (Active Directory Migration Tool, https://technet.microsoft.com/en-us/library/cc974332%28v=ws.10%29.aspx).

How to get NTFS on NETAPP

c#,network-programming,ntfs,network-shares,netapp

For doing this though, I tend to use: vfiler run vfilername fsecurity show /path/to/file/here This will print the various ACL attributes (NTFS and Unix) for the file in question. You'll need to first enumerate your share paths to do this. (cifs shares is a start point). There is a way...

Fast moving parts of file (like zero-copy on FS level)

filesystems,ntfs,ext4,hfs+

As of today, there's no published code to do that. It might be available soon though:https://lkml.org/lkml/2014/3/31/543

Reading NTFS volume root fails unless buffer size is a multiple of 512

c#,winapi,pinvoke,ntfs,ntfs-mft

For direct volume access you must read and write in multiples of the sector length, and starting from aligned offsets. That is the position must be a multiple of the sector length. You'll want to query the volume to find out the sector length. Use GetDiskFreeSpace or IOCTL_DISK_GET_DRIVE_GEOMETRY_EX for this....

Does a zero-length file take up a block on disk?

file,ntfs,diskspace

No, in case of NTFS, if file has 1 byte, it doesn't use any block. In general, if file has less than 300 bytes (approximately and in case that file record in MFT has 512 bytes - this value depends on file name length, size of MTF file record, etc.),...

Strange stdout redirect behavior

windows,file,batch-file,cmd,ntfs

, ; = <space> <tab> are standard delimiters so echo.>f,test is the same as echo. ,test>f . You can see what really happens in this case from a batch batch file with turned on echo.(just set echo on before the redirection). The redirection syntax could be tricky as it takes...

how to interpret FILENAME attribute of NTFS MFT?

ntfs,ntfs-mft

according to https://www.mandiant.com/blog/incident-response-ntfs-indx-buffers-part-2-internal-structures-file-attribute/ The 'file name' attribute has its structure. According to it the length of the filename is 4 and the value is "$MFT".

How to tell if WOW file system redirection is on for a thread?

c++,windows,winapi,ntfs,kernel32

There is no API function that reports this state. You are expected to remember that you disabled redirection.

where to find the data structures to access NTFS/FAT with c++ programming?

c++,windows,mfc,ntfs,fat

First, see What is a good resource to get started with Windows file system driver development? When you download DDK, look at source code for FAT32 kernel driver - it's very good starting point. MS doesn't provide source code for NTFS, but you can find quite good low level documentation...

Powershell - SetAccessRuleProtection not working in script

powershell,file-permissions,ntfs

The script actually works as intended, with large files though and no progress bar it seemed like it wasn't doing anything. Applied an echo and progress bar.

How to recovery losted NTFS partition on windows 7 [closed]

windows,partitioning,ntfs,recovery

You can try Easeus Partition Recovery. I lost my software partition one time and i was able to restore it with this tool.

rename() not working in a C program compiled using Dev C++

c,rename,ntfs,file-rename,dev-c++

I think you have some variables named with rename, that's why compiler gives called object 'rename' is not a function. Check this one. As said in the comment, please give more about your code.

Can git retain file owner, permissions, ACLs, and file attributes on a local Windows NTFS machine?

windows,git,windows-7,permissions,ntfs

GIT is a platform-independent code management tool, and can be run on numerous different operating systems. As a result, it is necessarily indifferent to any particular platform's notions of security or access control information. Security metadata about a file in Windows would be meaningless in, for example, a Linux environment,...

How do I get *change* file time in Windows?

python,winapi,filesystems,ntfs

OK, I seem to have figured it out, thanks to cocarin for pointing to Far sources. Far uses NtQueryInformationFile to get times and NtSetInformationFile to set them, and FILE_BASIC_INFORMATION structure contains all 4 times, including change time. QueryInformationFile docs: http://msdn.microsoft.com/en-us/library/windows/hardware/ff567052(v=vs.85).aspx (ZwQueryInformationFile) SetInformationFile docs: http://msdn.microsoft.com/en-us/library/windows/hardware/ff567096(v=vs.85).aspx (ZwSetInformationFile) FILE_BASIC_INFORMATION docs:...

What is the relationship between streams (ADS) and allocation units (clusters)? [closed]

windows,ntfs

Everything is a stream on NTFS. When you create/read/write a file "foo.txt", you're actually talking to a stream of the file (it just happens to be the default stream $DATA). This means that the three traditional "file size" values of Valid Data Length, End of File, and Allocation Size apply...

how to read ntfs master file table using c++

c++,ntfs,ntfs-mft

There is no C++ library functionality which would be OS specific, since this would not run on other platforms, or against other file systems. What you are really looking for is Windows API functions, not std C++ library functions. Your best source for that kind of information might be the...