Results 1 to 3 of 3

Thread: 0xc0000005 when starting exe

  1. #1

    Default 0xc0000005 when starting exe

    Hello,

    i am running a Programm with QT and Crypto++ included.

    I try to run following Code and get 0xc0000005 when trying to run it:

    Qt Code:
    1. // g++ -g3 -ggdb -O0 -DDEBUG -I/usr/include/cryptopp Driver.cpp -o Driver.exe -lcryptopp -lpthread
    2. // g++ -g -O2 -DNDEBUG -I/usr/include/cryptopp Driver.cpp -o Driver.exe -lcryptopp -lpthread
    3.  
    4.  
    5. #define CRYPTOPP_DEFAULT_NO_DLL
    6. #include "cryptopp/dll.h"
    7. #ifdef CRYPTOPP_WIN32_AVAILABLE
    8. #include <windows.h>
    9. #endif
    10.  
    11. #include "cryptopp/osrng.h"
    12. using CryptoPP::AutoSeededRandomPool;
    13.  
    14. #include <iostream>
    15. using std::cout;
    16. using std::cerr;
    17. using std::endl;
    18.  
    19. #include <string>
    20. using std::string;
    21.  
    22. #include <cstdlib>
    23. using std::exit;
    24.  
    25. #include "cryptopp/cryptlib.h"
    26. using CryptoPP::Exception;
    27.  
    28. #include "cryptopp/hex.h"
    29. using CryptoPP::HexEncoder;
    30. using CryptoPP::HexDecoder;
    31.  
    32. #include "cryptopp/filters.h"
    33. using CryptoPP::StringSink;
    34. using CryptoPP::StringSource;
    35. using CryptoPP::StreamTransformationFilter;
    36.  
    37. #include "cryptopp/aes.h"
    38. using CryptoPP::AES;
    39.  
    40. #include "cryptopp/modes.h"
    41. using CryptoPP::CFB_Mode;
    42.  
    43. int main(int argc, char *argv[])
    44. {
    45. AutoSeededRandomPool prng;
    46.  
    47. byte key[AES::DEFAULT_KEYLENGTH];
    48. prng.GenerateBlock(key, sizeof(key));
    49.  
    50. byte iv[AES::BLOCKSIZE];
    51. prng.GenerateBlock(iv, sizeof(iv));
    52.  
    53. string plain = "CFB Mode Test";
    54. string cipher, encoded, recovered;
    55.  
    56. /*********************************\
    57. \*********************************/
    58.  
    59. // Pretty print key
    60. encoded.clear();
    61. StringSource(key, sizeof(key), true,
    62. new HexEncoder(
    63. new StringSink(encoded)
    64. ) // HexEncoder
    65. ); // StringSource
    66. cout << "key: " << encoded << endl;
    67.  
    68. // Pretty print iv
    69. encoded.clear();
    70. StringSource(iv, sizeof(iv), true,
    71. new HexEncoder(
    72. new StringSink(encoded)
    73. ) // HexEncoder
    74. ); // StringSource
    75. cout << "iv: " << encoded << endl;
    76.  
    77. /*********************************\
    78. \*********************************/
    79.  
    80. try
    81. {
    82. cout << "plain text: " << plain << endl;
    83.  
    84. CFB_Mode< AES >::Encryption e;
    85. e.SetKeyWithIV(key, sizeof(key), iv);
    86.  
    87. // CFB mode must not use padding. Specifying
    88. // a scheme will result in an exception
    89. StringSource(plain, true,
    90. new StreamTransformationFilter(e,
    91. new StringSink(cipher)
    92. ) // StreamTransformationFilter
    93. ); // StringSource
    94. }
    95. catch(const CryptoPP::Exception& e)
    96. {
    97. cerr << e.what() << endl;
    98. exit(1);
    99. }
    100.  
    101. /*********************************\
    102. \*********************************/
    103.  
    104. // Pretty print
    105. encoded.clear();
    106. StringSource(cipher, true,
    107. new HexEncoder(
    108. new StringSink(encoded)
    109. ) // HexEncoder
    110. ); // StringSource
    111. cout << "cipher text: " << encoded << endl;
    112.  
    113. /*********************************\
    114. \*********************************/
    115.  
    116. try
    117. {
    118. CFB_Mode< AES >::Decryption d;
    119. d.SetKeyWithIV(key, sizeof(key), iv);
    120.  
    121. // The StreamTransformationFilter removes
    122. // padding as required.
    123. StringSource s(cipher, true,
    124. new StreamTransformationFilter(d,
    125. new StringSink(recovered)
    126. ) // StreamTransformationFilter
    127. ); // StringSource
    128.  
    129. cout << "recovered text: " << recovered << endl;
    130. }
    131. catch(const CryptoPP::Exception& e)
    132. {
    133. cerr << e.what() << endl;
    134. exit(1);
    135. }
    136.  
    137. /*********************************\
    138. \*********************************/
    139.  
    140. return 0;
    141. }
    To copy to clipboard, switch view to plain text mode 

    I read that its a dll Problem but i cant get along.

    I Compiled Crypto++ with this.

    Hope you can help me.

    Thx!

  2. #2
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    207
    Thanks
    20
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: 0xc0000005 when starting exe

    Have you copied the requisite crypto++ dll's against which you are linking into the application directory?

  3. #3
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: 0xc0000005 when starting exe

    00005 doesnt sound like a dll problem - more likely a dodgy pointer ime.

    have you debugged it? what is the call stack? what line is the exception from?
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

Similar Threads

  1. 0xc0000005 error when using qVector
    By przemo in forum Newbie
    Replies: 5
    Last Post: 9th December 2010, 14:02
  2. Replies: 6
    Last Post: 17th March 2010, 10:53
  3. Replies: 5
    Last Post: 23rd September 2008, 22:33
  4. Replies: 2
    Last Post: 13th August 2008, 17:46
  5. 0xc0000005 when linking against lib
    By niko in forum Qt Programming
    Replies: 10
    Last Post: 8th March 2006, 08:55

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.