Thread: How to implement password access to specific file type in Windows programmatically?

  1. #1
    Registered User
    Join Date
    Jan 2017
    Posts
    5

    How to implement password access to specific file type in Windows programmatically?

    Windows OS.

    1. I do not want user to launch all ".doc" files (including those he brings in).
    2. User tries to launch a file "test.doc".
    3. The password window appears.
    4. If the password is correct, the file is opened.
    Know how?..

    I read this guide:
    3 Ways to Create a Password Protected File on Windows 7 - wikiHow

    The problem is that I want to do it by mask, not just a few known files.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    38,703
    How smart are your users?

    Do they have admin privileges?

    A crude way would be to associate .doc files with your program in windows explorer, so it always launches your program when they click on a .doc file.

    But...
    If they're smart enough, they can just open a cmd.exe console and type 'winword myfile.doc' and get past your annoyance.

    If they have admin, they can simply re-associate .doc files with winword and get past your annoyance.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Jan 2017
    Posts
    5
    They are smart enough. I need a more reliable solution.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    38,703
    Perhaps you need to take the same approach that say a virus scanner takes, which is capable of analysing each file open request.

    But how is that any more capable of being subverted by your "smart" users?
    They could simply uninstall it and you're back where you started.

    You should be wary that if there is a real virus scanner on the machine, that your additional wrapper could well be regarded as malware through behaviour analysis.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Jan 2017
    Posts
    5
    It is hard to find my process in a long list of processes. I am, say, administrator. Your idea needs consideration.

  6. #6
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Why do you need this? Consider education and already existing solutions on the market.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #7
    Registered User
    Join Date
    Jan 2017
    Posts
    5
    Quote Originally Posted by Elysia View Post
    Why do you need this? Consider education and already existing solutions on the market.

    Homework ;(

  8. #8
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    38,703
    So how robust does a homework answer need to be?

    Homework is usually about showing you understand things, and establishing proof of concepts.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 06-29-2014, 02:08 AM
  2. Windows Specific File I/O Part II
    By Neo1 in forum Windows Programming
    Replies: 1
    Last Post: 03-13-2008, 06:25 PM
  3. Windows Specific File I/O
    By Neo1 in forum Windows Programming
    Replies: 63
    Last Post: 03-04-2008, 03:32 PM
  4. Programmatically open a Windows Folder
    By Shaman in forum Windows Programming
    Replies: 4
    Last Post: 09-25-2001, 03:39 PM
  5. Need help reading in specific type of file
    By Natase in forum C Programming
    Replies: 4
    Last Post: 09-12-2001, 08:02 PM

Tags for this Thread