Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Find ADS Files/Streams?

Find ADS Files/Streams?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bosfan
    wrote on last edited by
    #1

    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

    L 2 Replies Last reply
    0
    • B 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

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      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 word visible.

      One of these days I'm going to think of a really clever signature.

      L 1 Reply Last reply
      0
      • B 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

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        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
        }

        B 2 Replies Last reply
        0
        • L Lost User

          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 word visible.

          One of these days I'm going to think of a really clever signature.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          ADS files is not file with ADS extension , it's : windows alternate data streams. ADS Files[^]

          1 Reply Last reply
          0
          • L Lost User

            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
            }

            B Offline
            B Offline
            bosfan
            wrote on last edited by
            #5

            Hi there, thanks for help! That is new for me. Best Regards bosfan

            1 Reply Last reply
            0
            • L Lost User

              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
              }

              B Offline
              B Offline
              bosfan
              wrote on last edited by
              #6

              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

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups