Find ADS Files/Streams?
-
Hi community, i have a funktion to count files in a directory and its subdirectory, but how to count a ADS files, alternate da ta stream? How to pas a path to FindFile() and FindNextFile() ?? I try to make a path from a visible file like: "C:\visible.txt" to "C:\visible.txt:*.*" but this is not correct. Does any one knows how to do this? Thanks in advance bosfan
-
Hi community, i have a funktion to count files in a directory and its subdirectory, but how to count a ADS files, alternate da ta stream? How to pas a path to FindFile() and FindNextFile() ?? I try to make a path from a visible file like: "C:\visible.txt" to "C:\visible.txt:*.*" but this is not correct. Does any one knows how to do this? Thanks in advance bosfan
Your path should be something like:
char* szPath = "C:\\directory\\*.ads";
You must always escape the special characters, such as backslash, in string constants in C/C++, by prefixing them with the escape character, which is a backslash. In your example you are escaping the first character (
v
) of the wordvisible
.One of these days I'm going to think of a really clever signature.
-
Hi community, i have a funktion to count files in a directory and its subdirectory, but how to count a ADS files, alternate da ta stream? How to pas a path to FindFile() and FindNextFile() ?? I try to make a path from a visible file like: "C:\visible.txt" to "C:\visible.txt:*.*" but this is not correct. Does any one knows how to do this? Thanks in advance bosfan
Use this Code : Streams.h
//
// return code type
//
typedef INT NTSTATUS;//
// Check for success
//
#define NT_SUCCESS(Status) ((NTSTATUS)(Status) >= 0)//
// The NT return codes we care about
//
#define STATUS_BUFFER_OVERFLOW ((NTSTATUS)0x80000005L)//--------------------------------------------------------------------
// N T F S C O N T R O L F I L E D E F I N I T I O N S
//--------------------------------------------------------------------//
// Prototype for NtFsControlFile and data structures
// used in its definition
////
// Io Status block (see NTDDK.H)
//
typedef struct _IO_STATUS_BLOCK {
NTSTATUS Status;
ULONG Information;
} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;//
// Apc Routine (see NTDDK.H)
//
typedef VOID (*PIO_APC_ROUTINE) (
PVOID ApcContext,
PIO_STATUS_BLOCK IoStatusBlock,
ULONG Reserved
);//
// File information classes (see NTDDK.H)
//
typedef enum _FILE_INFORMATION_CLASS {
// end_wdm
FileDirectoryInformation = 1,
FileFullDirectoryInformation, // 2
FileBothDirectoryInformation, // 3
FileBasicInformation, // 4 wdm
FileStandardInformation, // 5 wdm
FileInternalInformation, // 6
FileEaInformation, // 7
FileAccessInformation, // 8
FileNameInformation, // 9
FileRenameInformation, // 10
FileLinkInformation, // 11
FileNamesInformation, // 12
FileDispositionInformation, // 13
FilePositionInformation, // 14 wdm
FileFullEaInformation, // 15
FileModeInformation, // 16
FileAlignmentInformation, // 17
FileAllInformation, // 18
FileAllocationInformation, // 19
FileEndOfFileInformation, // 20 wdm
FileAlternateNameInformation, // 21
FileStreamInformation, // 22
FilePipeInformation, // 23
FilePipeLocalInformation, // 24
FilePipeRemoteInformation, // 25
FileMailslotQueryInformation, // 26
FileMailslotSetInformation, // 27
FileCompressionInformation, // 28
FileObjectIdInformation, // 29
FileCompletionInformation, // 30
FileMoveClusterInformation, // 31
FileQuotaInformation, // 32
FileReparsePointInformation, // 33
FileNetworkOpenInformation, // 34
FileAttributeTagInformation, // 35
FileTrackingInformation, // 36
FileMaximumInformation
// begin_wdm
} -
Your path should be something like:
char* szPath = "C:\\directory\\*.ads";
You must always escape the special characters, such as backslash, in string constants in C/C++, by prefixing them with the escape character, which is a backslash. In your example you are escaping the first character (
v
) of the wordvisible
.One of these days I'm going to think of a really clever signature.
-
Use this Code : Streams.h
//
// return code type
//
typedef INT NTSTATUS;//
// Check for success
//
#define NT_SUCCESS(Status) ((NTSTATUS)(Status) >= 0)//
// The NT return codes we care about
//
#define STATUS_BUFFER_OVERFLOW ((NTSTATUS)0x80000005L)//--------------------------------------------------------------------
// N T F S C O N T R O L F I L E D E F I N I T I O N S
//--------------------------------------------------------------------//
// Prototype for NtFsControlFile and data structures
// used in its definition
////
// Io Status block (see NTDDK.H)
//
typedef struct _IO_STATUS_BLOCK {
NTSTATUS Status;
ULONG Information;
} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;//
// Apc Routine (see NTDDK.H)
//
typedef VOID (*PIO_APC_ROUTINE) (
PVOID ApcContext,
PIO_STATUS_BLOCK IoStatusBlock,
ULONG Reserved
);//
// File information classes (see NTDDK.H)
//
typedef enum _FILE_INFORMATION_CLASS {
// end_wdm
FileDirectoryInformation = 1,
FileFullDirectoryInformation, // 2
FileBothDirectoryInformation, // 3
FileBasicInformation, // 4 wdm
FileStandardInformation, // 5 wdm
FileInternalInformation, // 6
FileEaInformation, // 7
FileAccessInformation, // 8
FileNameInformation, // 9
FileRenameInformation, // 10
FileLinkInformation, // 11
FileNamesInformation, // 12
FileDispositionInformation, // 13
FilePositionInformation, // 14 wdm
FileFullEaInformation, // 15
FileModeInformation, // 16
FileAlignmentInformation, // 17
FileAllInformation, // 18
FileAllocationInformation, // 19
FileEndOfFileInformation, // 20 wdm
FileAlternateNameInformation, // 21
FileStreamInformation, // 22
FilePipeInformation, // 23
FilePipeLocalInformation, // 24
FilePipeRemoteInformation, // 25
FileMailslotQueryInformation, // 26
FileMailslotSetInformation, // 27
FileCompressionInformation, // 28
FileObjectIdInformation, // 29
FileCompletionInformation, // 30
FileMoveClusterInformation, // 31
FileQuotaInformation, // 32
FileReparsePointInformation, // 33
FileNetworkOpenInformation, // 34
FileAttributeTagInformation, // 35
FileTrackingInformation, // 36
FileMaximumInformation
// begin_wdm
} -
Use this Code : Streams.h
//
// return code type
//
typedef INT NTSTATUS;//
// Check for success
//
#define NT_SUCCESS(Status) ((NTSTATUS)(Status) >= 0)//
// The NT return codes we care about
//
#define STATUS_BUFFER_OVERFLOW ((NTSTATUS)0x80000005L)//--------------------------------------------------------------------
// N T F S C O N T R O L F I L E D E F I N I T I O N S
//--------------------------------------------------------------------//
// Prototype for NtFsControlFile and data structures
// used in its definition
////
// Io Status block (see NTDDK.H)
//
typedef struct _IO_STATUS_BLOCK {
NTSTATUS Status;
ULONG Information;
} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;//
// Apc Routine (see NTDDK.H)
//
typedef VOID (*PIO_APC_ROUTINE) (
PVOID ApcContext,
PIO_STATUS_BLOCK IoStatusBlock,
ULONG Reserved
);//
// File information classes (see NTDDK.H)
//
typedef enum _FILE_INFORMATION_CLASS {
// end_wdm
FileDirectoryInformation = 1,
FileFullDirectoryInformation, // 2
FileBothDirectoryInformation, // 3
FileBasicInformation, // 4 wdm
FileStandardInformation, // 5 wdm
FileInternalInformation, // 6
FileEaInformation, // 7
FileAccessInformation, // 8
FileNameInformation, // 9
FileRenameInformation, // 10
FileLinkInformation, // 11
FileNamesInformation, // 12
FileDispositionInformation, // 13
FilePositionInformation, // 14 wdm
FileFullEaInformation, // 15
FileModeInformation, // 16
FileAlignmentInformation, // 17
FileAllInformation, // 18
FileAllocationInformation, // 19
FileEndOfFileInformation, // 20 wdm
FileAlternateNameInformation, // 21
FileStreamInformation, // 22
FilePipeInformation, // 23
FilePipeLocalInformation, // 24
FilePipeRemoteInformation, // 25
FileMailslotQueryInformation, // 26
FileMailslotSetInformation, // 27
FileCompressionInformation, // 28
FileObjectIdInformation, // 29
FileCompletionInformation, // 30
FileMoveClusterInformation, // 31
FileQuotaInformation, // 32
FileReparsePointInformation, // 33
FileNetworkOpenInformation, // 34
FileAttributeTagInformation, // 35
FileTrackingInformation, // 36
FileMaximumInformation
// begin_wdm
}Hi, in this example i need a WDK installed, is this right? Because VS 10 don't know a "NtQueryInformationFile" and i found on microsoft.com that i need "ntifs.h" to include for this? After all ntifs.h is on my system but now i can't find "windowsfamiliy.h" :( Best wishes bosfan