Results 1 to 10 of 10

Thread: hide a file and make it undeletable

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2000
    Posts
    18

    Angry

    how to manipulate the FAT in win95 so that a file is made hidden, and it becomes impossible to delete that file.
    the option of setting the file attributes is very elementary.
    the user should not be able to see that file, and should not be able to delete that file.
    it must be possible to make the file visible through program, use it, and again make it hidden.

  2. #2
    Guest
    Not the best way but, to make it undeletable, you can use this line
    Code:
    Open "C:\Windows\Desktop\ttt.txt" For Input As #1
    That way, it will always be open, thus, it will be harder for someone to delete.

    If you really want to make it hidden and undeletable, I suggest you look into Assembly or C++ as VB is not the best language for direct disk access.


  3. #3
    Hyperactive Member CyberSurfer's Avatar
    Join Date
    Aug 2000
    Location
    Old London Town
    Posts
    425
    I came across this problem myself a while back, and came up with the following solution.

    1) Write the data to the file to be made hidden, and close it.

    2) Create an MSDOS Batch file. ie

    Code:
    Open "hide.bat" for output as #1
    3) Write the appropriate attrib line to the batch file. ie:

    Code:
    attrib +h c:\myfiles\text.txt
    4) Shell the batch file from within VB. ie:

    Code:
    shell ("c:\myfiles\hide.bat")
    You could always determine the location of the batch file by using the App.path object.

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    I think he means hiding the file, rather than setting its hidden attribute. One suggestion - find its FAT entry, and mark all its clusters as unusable. Then, when it is unlocked, mark them as read.

    Although this is well out of VB's scope.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  5. #5
    Fanatic Member
    Join Date
    Feb 2000
    Location
    The Netherlands
    Posts
    715
    If you set the clusters unusable, then Scandisc will report it to the user.

  6. #6
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    I think there is a way to trick scandisk into not doing that...not sure what it is. (I know there is because some programs such as Magic Folders do that)
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Sep 2000
    Posts
    18

    Post making a file hidden and undeletable

    you are right in saying that there are some programs like magic folders which hide a directory and / or a file. i do not mean setting the hidden attribute of the file or directory.
    similarly, the file / directory should not be deletable.

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Sep 2000
    Posts
    18

    Post hiding a file

    the method of shelling it , or using a batch file is not desirable.
    it is too naive, please suggest something else

  9. #9
    Guest
    How big is the file? If it's several Megs large then forget it, else try hiding the contents in the registry! (in a vague location or so).

    That way you won't see a file, and wouldn't be able to delete it...

    I think the "Magic Folders" also uses this technique, just as the "Control Panel"-folder doesn't exist (they are all *.cpl files in C:\windows).

    Just my $0.02..

  10. #10
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    The control panel is a 'fake' folder. If you create a folder with a specific CLSID, as in "Control Panel.{xxx}", then it will load the In-Process server associated with that CLSID to provide the directory, as opposed to the normal file viewer. The Control Panel server simply loads all the .cpl files in your windows folder.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

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