CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2006
    Posts
    109

    Password check for DOC files

    I need to write a program which, given a password protected DOC file and a string, checks whether the string is the password of the file.

    Any ideas on how to approach this problem?

  2. #2
    Join Date
    Aug 2002
    Location
    Kerala
    Posts
    1,183

    Re: Password check for DOC files

    You did not say what version what framework etc. !!! .NET or MFC ???

    Assuming the latest VC version and default framework ( VS2008 and .NET)

    Code:
    using namespace System;
    using namespace Reflection;
    int main(array<System::String ^> ^args){
          Word::Application^ wdApp = gcnew Word::Application();
          Object^% file = gcnew String("c:\\Test\\doc1.doc");
          Object^% pwd = gcnew String("opensesame");
          Word::Document^ wdDoc;
          wdApp->Visible = true; 
          try {
          wdDoc = wdApp->Documents->Open( file , Missing::Value, 
                                          Missing::Value, Missing::Value, 
                                          pwd, Missing::Value, 
                                          Missing::Value, Missing::Value, 
                                          Missing::Value, Missing::Value,
                                          Missing::Value, Missing::Value, 
                                          Missing::Value, Missing::Value, 
                                          Missing::Value, Missing::Value 
                                          );
          }
          catch(Exception^ e) {
            Console::WriteLine(e->Message); 
         }
          if(wdDoc != nullptr) {
            Console::WriteLine("The document was opened successfully!");
          } 
          Console::ReadLine();  
          return 0;
    }
    Last edited by Sahir; February 24th, 2008 at 06:00 AM.

  3. #3
    Join Date
    Dec 2006
    Posts
    109

    Re: Password check for DOC files

    Thanks.

    This would word in Windows.

    How can I do this in linux, without the use of MS Word's API?

  4. #4
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    Re: Password check for DOC files

    My dear friend, you are on a wrong way.
    Try wasting your energy for a better cause!
    Last edited by ovidiucucu; February 25th, 2008 at 02:20 AM.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  5. #5
    Join Date
    Dec 2006
    Posts
    109

    Re: Password check for DOC files

    Yet, any ideas?

  6. #6
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    Re: Password check for DOC files

    There is no good reason to encourage password crackers.

    [ Thread closed ]
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  7. #7
    Ejaz's Avatar
    Ejaz is offline Elite Member Power Poster
    Join Date
    Jul 2002
    Location
    Lahore, Pakistan
    Posts
    4,211

    Re: Password check for DOC files

    Quote Originally Posted by tepez
    Yet, any ideas?
    For more ideas, you need to provide more information. What you are intended to do ( and why since I do smell something weird, like Ovidiu ), for what platform, which complier, anything you done so far and if you found any problems, what were they.

    This is neither a hacking/cracking site, nor "rent-a-coder" sort of place.

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

Featured