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. Design and Architecture
  4. How to find all files of a certain type in Memory?

How to find all files of a certain type in Memory?

Scheduled Pinned Locked Moved Design and Architecture
csharpcomperformancetutorialquestion
8 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.
  • S Offline
    S Offline
    Sonhospa
    wrote on last edited by
    #1

    Hi all, I'm contemplating what would be a good approach to find all the files of a certain filetype (*.bgl) that a third-party (unmanaged) application loads into memory - basically to get an overview of names and paths of them. Could someone of you please give me a hint or reading sources? I found the article "C# How to Scan a Process' Memory" but I'm too unexperienced to tell if that approach makes sense for retrieving a filelist only. Thank you very much in advance, Mick

    L 1 Reply Last reply
    0
    • S Sonhospa

      Hi all, I'm contemplating what would be a good approach to find all the files of a certain filetype (*.bgl) that a third-party (unmanaged) application loads into memory - basically to get an overview of names and paths of them. Could someone of you please give me a hint or reading sources? I found the article "C# How to Scan a Process' Memory" but I'm too unexperienced to tell if that approach makes sense for retrieving a filelist only. Thank you very much in advance, Mick

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

      The only way to do that would be by what is known as "hooking", whereby you intercept API requests and examine the content of the parameters before passing the request on to the operating system for processing. Once an application has loaded all or part of a file into memory then there is no way to find its name.

      S 1 Reply Last reply
      0
      • L Lost User

        The only way to do that would be by what is known as "hooking", whereby you intercept API requests and examine the content of the parameters before passing the request on to the operating system for processing. Once an application has loaded all or part of a file into memory then there is no way to find its name.

        S Offline
        S Offline
        Sonhospa
        wrote on last edited by
        #3

        Thank you for the first clue, Richard! After reading a little bit about hooking, I'm not quite sure if it would become a challenge or a torture, given my programming experience. But I want to give it a try. I also stumbled upon the "EasyHook" project, which seems to make things much easier in .NET, and will start reading the documentation later... maybe there are more hints or examples. I guess it would help me if you had an idea which of the different Windows API hooks to use in order to find which files the exe loads?

        L 2 Replies Last reply
        0
        • S Sonhospa

          Thank you for the first clue, Richard! After reading a little bit about hooking, I'm not quite sure if it would become a challenge or a torture, given my programming experience. But I want to give it a try. I also stumbled upon the "EasyHook" project, which seems to make things much easier in .NET, and will start reading the documentation later... maybe there are more hints or examples. I guess it would help me if you had an idea which of the different Windows API hooks to use in order to find which files the exe loads?

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

          You probably need to check all API calls connected with file I/O; search in MSDN for the documentation.

          1 Reply Last reply
          0
          • S Sonhospa

            Thank you for the first clue, Richard! After reading a little bit about hooking, I'm not quite sure if it would become a challenge or a torture, given my programming experience. But I want to give it a try. I also stumbled upon the "EasyHook" project, which seems to make things much easier in .NET, and will start reading the documentation later... maybe there are more hints or examples. I guess it would help me if you had an idea which of the different Windows API hooks to use in order to find which files the exe loads?

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

            Sonhospa wrote:

            Thank you for the first clue, Richard!

            Aw, I do like games - here's your second clue; Hook into the Windows File Copy API from C++ - Stack Overflow[^].

            Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

            S 1 Reply Last reply
            0
            • L Lost User

              Sonhospa wrote:

              Thank you for the first clue, Richard!

              Aw, I do like games - here's your second clue; Hook into the Windows File Copy API from C++ - Stack Overflow[^].

              Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

              S Offline
              S Offline
              Sonhospa
              wrote on last edited by
              #6

              Sorry, Eddy - I guess I don't get it right. Followed the link, but neither the thread nor the links in it lead me to anything I could even dream about understanding :( But you're right about the game thing :laugh: FSX

              L 1 Reply Last reply
              0
              • S Sonhospa

                Sorry, Eddy - I guess I don't get it right. Followed the link, but neither the thread nor the links in it lead me to anything I could even dream about understanding :( But you're right about the game thing :laugh: FSX

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

                That's why there's a warning in the stackoverflow thread; it is not an easy task - hooking isn't, and writing a filter isn't either. Look at it this way; there'll be few developers who can say they tried something similar. There'd be quite some people waiting for an article on "how" you did so :)

                Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                S 1 Reply Last reply
                0
                • L Lost User

                  That's why there's a warning in the stackoverflow thread; it is not an easy task - hooking isn't, and writing a filter isn't either. Look at it this way; there'll be few developers who can say they tried something similar. There'd be quite some people waiting for an article on "how" you did so :)

                  Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                  S Offline
                  S Offline
                  Sonhospa
                  wrote on last edited by
                  #8

                  I look at it the way you suggest and drop that idea. Thank you though, saved me a lot of time and coffee. :thumbsup:

                  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