Console App., Hide specific folder

This is a discussion on Console App., Hide specific folder within the C++ Programming forums, part of the General Programming Boards category; Like the 'Hide Folder'-programs, how to hide a specific folder in Windows? Do SetFileAttributes and FILE_ATTRIBUTE_HIDDEN have anything to do ...

  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    15

    Console App., Hide specific folder

    Like the 'Hide Folder'-programs, how to hide a specific folder in Windows?

    Do SetFileAttributes and FILE_ATTRIBUTE_HIDDEN have anything to do with such command?

    -And may I remind you; I do not seek for this answer to be used in any illegal or harmful way, so lay off the "Hmmm, a bit suspicious. Skiddie?" -comments.

  2. #2
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    I do not seek for this answer to be used in any illegal or harmful way
    Don't worry, I don't think hiding your gigabytes of porn is illegal or harmful to me at all.

    Code:
    #include <stdio.h>
    #include <windows.h>
    
    int main( int argc, char* argv[] )
    {
      if( argc == 2 )
      {
        if( !SetFileAttributes( argv[1], FILE_ATTRIBUTE_HIDDEN ) )
        {
          fprintf( stderr, "Failed to hide: '%s'\n", argv[1] );
        }
      }
      else
      {
        fprintf( stderr, "usage: hide <filename>\n" );
      }
    }

  3. #3
    Registered User
    Join Date
    Mar 2005
    Posts
    15
    Code:
    #include <stdio.h>
    #include <windows.h>
    
    int main( int argc, char* argv[] )
    {
      if( argc == 2 )
      {
        if( !SetFileAttributes( argv[1], FILE_ATTRIBUTE_HIDDEN ) )
        {
          fprintf( stderr, "Failed to hide: '%s'\n", argv[1] );
        }
      }
      else
      {
        fprintf( stderr, "usage: hide <filename>\n" );
      }
    }
    - Doesn't work. Command prompt pops up and closes immediately. - Perhaps because of no getche()?

    Oh, and I need the program to have the hiding folder path in the program, not to make it visually.

    Example:
    Run program -> Automatically Hides C:\MYCOMPUTER\DC++\downloads

  4. #4
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    - Doesn't work. Command prompt pops up and closes immediately. - Perhaps because of no getche()?
    I intentionally coded it to be run on the console. I assumed this because the title of the topic does say "Console App".

    In general just hide whatever file you wish like this:

    Code:
    SetFileAttributes( "C:\\MyPornFolder", FILE_ATTRIBUTE_HIDDEN );
    Edit: Note the two backslashes. When specifying a filepath with backslashes you need two since backslash is an escape character.
    Last edited by Dante Shamest; 03-28-2005 at 04:41 AM.

  5. #5
    Registered User
    Join Date
    Mar 2005
    Posts
    15
    Right right, folder properties -> show hidden files and folders.

    Right, this is just too easy to discover and reveal my porns, so is there a way to hide the folder in such way, that it cannot be revealed by "show hidden files and folders" -property.

    Or that the hidden folder cannot use the files under the folder.

    So if I have funny_football.avi in a "downloads" folder, and I hide the downloads folder, how to make it so, that I cannot ignitiate the funny_football.avi from like "Recent Documents" ?
    Last edited by nextstep; 03-28-2005 at 04:51 AM.

  6. #6
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    The only practical way I can think of doing it is to encrypt the file using an encryption algorithm.

  7. #7
    Registered User
    Join Date
    Mar 2005
    Posts
    15
    Right, so how do I add a simple encryption for the folder I hide?

  8. #8
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    Write a program that messes up the bytes using a key. You can use a XOR encryption which is easier to implement, or a more advanced one like MD5.

  9. #9
    Registered User
    Join Date
    Mar 2005
    Posts
    15
    Well can you find/create me an example? I'm still pretty new.

  10. #10
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    On second thoughts, I'm not sure if it's possible to encrypt a Windows folder. I know you can encrypt normal files though.

  11. #11
    Registered User
    Join Date
    Mar 2005
    Posts
    15
    Code:
    #include <stdio.h>
    #include <windows.h>
    
    int main( int argc, char* argv[] )
    {
    
    SetFileAttributes( "C:\\MYCOMPUTER\\DC++\\downloads\\xXx", FILE_ATTRIBUTE_HIDDEN );
    
    }
    -Well so, I need to add an encryption for that code, that messes up the bytes using a key. XOR encryption or something.

    Or if there is another way to disable funny_football.avi from "xXx" folder to be ignitiated from somewhere else, like for example 'Recent Documents'.

    Goal is to make the files under the folder un-executable.

    ----

    If you didn't understand, here's a bit easier way to understand:

    Well either to hide the folder in such way that any files under the folder cannot be ignitiated, or to create an encryption added to the code above, that will make the folder hidden&encrypted and the files under the folder are un-ignitiable.

    Example:

    Run program -> Hide C:\MYCOMPUTER\DC++\downloads\xXx

    or

    Run program -> Hide C:\MYCOMPUTER\DC++\downloads\xXx

    as long as the files under the folder cannot be ignitiated through anything (for example 'Recent Documents' or so)
    Last edited by nextstep; 03-28-2005 at 06:46 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Intergrating console program into windowed app
    By spadez in forum C Programming
    Replies: 4
    Last Post: 02-26-2009, 12:58 PM
  2. Adding a console window to a Win32 app
    By VirtualAce in forum Game Programming
    Replies: 7
    Last Post: 02-01-2009, 01:09 PM
  3. Replies: 12
    Last Post: 05-06-2006, 04:34 PM
  4. Windows app without console
    By Zeike in forum Windows Programming
    Replies: 4
    Last Post: 08-31-2005, 01:59 PM
  5. Can someone help me with this console app please?
    By Marcos in forum C++ Programming
    Replies: 4
    Last Post: 07-26-2003, 08:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21