Results 1 to 10 of 10

Thread: Hide files/folders

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2008
    Posts
    1,260

    Hide files/folders

    I am wanting to create an app that hides files/folders from windows explorer.

    I think I need to create a system wide hook to do this.

    Is there any vb6 sample code out there to help me with this?
    thanks

    Simon Canning

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Hide files/folders

    To change single file attribute use SetAttr statement:
    Code:
    Private Sub Command1_Click()
        If Not Dir("c:\temp") = "" Then
            SetAttr "c:\temp", vbHidden
        End If
    End Sub
    To change folder attribute it's a bit more complex and requires to use windows api.
    Check out this link for a nicely wrapped sample.
    Also, I'm sure you're aware that more or less advanced user can easily change those attributes to whatever they wish.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2008
    Posts
    1,260

    Re: Hide files/folders

    I'm sure you're aware that more or less advanced user can easily change those attributes to whatever they wish

    - That is why I am interested in using a system wide hook.

  4. #4
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: Hide files/folders

    What's the file system? If it is non-FAT then set the permission accordingly rather than resorting to source code which can be abused.

  5. #5
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Hide files/folders

    Quote Originally Posted by leinad31
    ... set the permission accordingly rather than resorting to source code which can be abused.
    I agree - code can (and will) be used to produce malicious program.

    Anyway, why do you need to do that?

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Sep 2008
    Posts
    1,260

    Re: Hide files/folders

    It is ntfs.

    I am wanting to hide savegame files for my game so they cannot be tampered with... Also, I would like to make a commercial app to hide files as I think it would be popular..

  7. #7
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,929

    Re: Hide files/folders

    Using that method will only do any good if your program is running at the time (which is hard to ensure, especially if the user has a virus scanner), and is far from foolproof.

    Instead of doing that kind of thing, I would advise you to take a much more popular route:
    • Put the files into a folder that the user can't find easily - I'd recommend (as do Microsoft) using the AppData folder. You can see good example code for finding it here.

    • Encrypt the file, so that even if the files are found, they can't be edited easily (if done properly, even people like us wouldn't be able to do it). You can find several examples of encryption in the CodeBank - VB6 forum.
    Doing that will mean a little more effort in your program to load/save the files, but it is far more reliable (and much easier to implement) than what you want to do - and also means you aren't slowing down the persons computer (or wasting the memory) by running an extra program all the time.

  8. #8
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: Hide files/folders


  9. #9
    Frenzied Member
    Join Date
    Nov 2005
    Posts
    1,834

    Re: Hide files/folders

    This question has been asked many times before (even by me a few years ago) and has never been answered. Hiding files/folders in such a way that only your application can hide/show them is quite advanced stuff and probably needs a driver, something you can't write with VB6.

    And why write a commercial application to hide files/folders while there are already dozens of commercial applications that can do that, like 'Hide Files & Folders', 'Hide My Folder', 'Hide Folders XP', 'File Lock', 'Folder Vault', 'VIP Defense', 'Folder Guard', 'Folder Castle', 'Masker', 'Folder Secure', 'Instant Lock', etc ?

  10. #10
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: Hide files/folders

    What they often do, or have tried in the past, is to create a very large file and their driver interprets its as another file system... its not popular because when that single file gets corrupted then everything (sub files/folders) is lost. Also performance wise, such a file system would have an additional layer. Lastly, its security implementation may not comply with existing enterprise network management technologies or best practices so it may possibly end up providing less security (easier to hack) than existing counterparts tied to the OS.

    Just encrypt and compress the file, or store it in a password protected database (if database supports stored procedures then do the encrypt/decrypt there).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width