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. Prevent user from deleting/moving files

Prevent user from deleting/moving files

Scheduled Pinned Locked Moved C / C++ / MFC
question
11 Posts 4 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.
  • H Offline
    H Offline
    HENDRIK R
    wrote on last edited by
    #1

    Hello all, I'm writing an application where I need to prevent users from deleting/moving/... files on my hard-disk. The only thing I found out is that you can do that for whole folders by use of ICopyHook. But are there other solutions, especially for single files, too? Thanks, Schlaubi

    J J H 3 Replies Last reply
    0
    • H HENDRIK R

      Hello all, I'm writing an application where I need to prevent users from deleting/moving/... files on my hard-disk. The only thing I found out is that you can do that for whole folders by use of ICopyHook. But are there other solutions, especially for single files, too? Thanks, Schlaubi

      J Offline
      J Offline
      JohnMcL
      wrote on last edited by
      #2

      For single files you could set its attribute to write-protected. That would be the nicest way, because the user can still choose if he absolutely wants to delete the file. However if you want to prevent the user from deleting/moving it during runtime, you could just open the file. The OS would not allow opened files to be deleted/moved.

      H 1 Reply Last reply
      0
      • J JohnMcL

        For single files you could set its attribute to write-protected. That would be the nicest way, because the user can still choose if he absolutely wants to delete the file. However if you want to prevent the user from deleting/moving it during runtime, you could just open the file. The OS would not allow opened files to be deleted/moved.

        H Offline
        H Offline
        HENDRIK R
        wrote on last edited by
        #3

        Thanks for your hints, but I need to prevent the user form deleting any file on my disk. So both your solution will not work for me. Thanks anyway!

        R 1 Reply Last reply
        0
        • H HENDRIK R

          Thanks for your hints, but I need to prevent the user form deleting any file on my disk. So both your solution will not work for me. Thanks anyway!

          R Offline
          R Offline
          Rickard Andersson20
          wrote on last edited by
          #4

          Are you trying to build an anti-virus tool? :) I don't think that is possible... Rickard Andersson@Suza Computing C# and C++ programmer from SWEDEN! UIN: 50302279 E-Mail: nikado@pc.nu Speciality: I love C#, ASP.NET and C++!

          H 1 Reply Last reply
          0
          • R Rickard Andersson20

            Are you trying to build an anti-virus tool? :) I don't think that is possible... Rickard Andersson@Suza Computing C# and C++ programmer from SWEDEN! UIN: 50302279 E-Mail: nikado@pc.nu Speciality: I love C#, ASP.NET and C++!

            H Offline
            H Offline
            HENDRIK R
            wrote on last edited by
            #5

            Are you trying to build an anti-virus tool? How did you come accross that idea? Do you write a virus and fear my tool?;) No, in fact i wrote a "secure" browser for some kind of information terminals. And some kids tried (and even got it out:(() how to delete files. That was the point I started to think about kind of forbid-to-delete-tool.

            1 Reply Last reply
            0
            • H HENDRIK R

              Hello all, I'm writing an application where I need to prevent users from deleting/moving/... files on my hard-disk. The only thing I found out is that you can do that for whole folders by use of ICopyHook. But are there other solutions, especially for single files, too? Thanks, Schlaubi

              J Offline
              J Offline
              jhwurmbach
              wrote on last edited by
              #6

              Maybe you can use File system access rights? This would work under NT, 2K and XP prof. The outdated(W95 to ME) and crippleware (XP Home) versions are out of the question, though.


              My opinions may have changed, but not the fact that I am right.

              1 Reply Last reply
              0
              • H HENDRIK R

                Hello all, I'm writing an application where I need to prevent users from deleting/moving/... files on my hard-disk. The only thing I found out is that you can do that for whole folders by use of ICopyHook. But are there other solutions, especially for single files, too? Thanks, Schlaubi

                H Offline
                H Offline
                HENDRIK R
                wrote on last edited by
                #7

                Seems like I've to add another line.:-D I dont wanna play with access rights and that stuff - my goal is to prevent deleting only during runtime, not during the whole windows session. But thanks for your hints anyway:):)

                J 1 Reply Last reply
                0
                • H HENDRIK R

                  Seems like I've to add another line.:-D I dont wanna play with access rights and that stuff - my goal is to prevent deleting only during runtime, not during the whole windows session. But thanks for your hints anyway:):)

                  J Offline
                  J Offline
                  jhwurmbach
                  wrote on last edited by
                  #8

                  Schlaubi wrote: I dont wanna play with access rights and that stuff - my goal is to prevent deleting only during runtime, not during the whole windows session. I do not think that I would want that to be possible - at least not with one of the "real" Windows versions. But I fear there could be some hook to do that.:(


                  My opinions may have changed, but not the fact that I am right.

                  H 1 Reply Last reply
                  0
                  • J jhwurmbach

                    Schlaubi wrote: I dont wanna play with access rights and that stuff - my goal is to prevent deleting only during runtime, not during the whole windows session. I do not think that I would want that to be possible - at least not with one of the "real" Windows versions. But I fear there could be some hook to do that.:(


                    My opinions may have changed, but not the fact that I am right.

                    H Offline
                    H Offline
                    HENDRIK R
                    wrote on last edited by
                    #9

                    jhwurmbach wrote: I do not think that I would want that to be possible - at least not with one of the "real" Windows versions. Your opinion is not that wrong - under usual circumstances I would not want to have that, too. But in my special case I need it - for public information terminals available for everyone, also little hacker kids trying everything to get the system crashed.:)

                    J 1 Reply Last reply
                    0
                    • H HENDRIK R

                      jhwurmbach wrote: I do not think that I would want that to be possible - at least not with one of the "real" Windows versions. Your opinion is not that wrong - under usual circumstances I would not want to have that, too. But in my special case I need it - for public information terminals available for everyone, also little hacker kids trying everything to get the system crashed.:)

                      J Offline
                      J Offline
                      jhwurmbach
                      wrote on last edited by
                      #10

                      Well, but then you only have ONE application running all day, and probably not IE6 with its deep OS integration. Do not allow anyone to start any application, prevent your browser from calling a shell and no one will be able to delete a file.


                      My opinions may have changed, but not the fact that I am right.

                      H 1 Reply Last reply
                      0
                      • J jhwurmbach

                        Well, but then you only have ONE application running all day, and probably not IE6 with its deep OS integration. Do not allow anyone to start any application, prevent your browser from calling a shell and no one will be able to delete a file.


                        My opinions may have changed, but not the fact that I am right.

                        H Offline
                        H Offline
                        HENDRIK R
                        wrote on last edited by
                        #11

                        jhwurmbach wrote: prevent your browser from calling a shell That's a fact I never thought about - I only concentrated on a programmatical solution. But that did it! Thank you very much.:)

                        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