RE: Tool to encrypt or decrypt log files
There are many things wrong though. If that is your entire code, it will never work properly. Instead post everything, including declarations.
Either way, with such an 'old' and dirty code style debugging is very difficult. Determining why that last API fails is the least of your worries.
Start by at least properly declaring and initializing all your variables! Especially if you are using Windows APIs it is essential you use proper code style and don't rely on defaults and the Variant types. Also note that there is no 'decimal' type in VB.
Second, you need to know the difference between unicode and ansi strings and how VB handles them, and thus how to implement it properly. For example, your password is not send as unicode to the APIs to begin with. Also learn what byte arrays are and the proper way to handle them and how they relate to ansi and unicode strings.
Third, the routines (cryptogrpahic provider and context) for decrypting a Messenger Plus! log might have changed since that first post in this thread, so using those might only work for old logs.
Fourth, you can't simply use the entire contents of the encrypted log file like that! It has a specific format with a header, data, contents, etc.
---
So, in a nutshell, there is so much wrong with that code that correcting it would simply result in giving you a complete working code. It is not a matter of just fixing a line or two, it needs a complete rewrite from scratch. Hence my next question and comments:
Have you programmed in VB before or is this one of your first things you've programmed? Because that entire code looks like it has been made by a first-time programmer, no offense though (everybody needs to start somewhere). But if it is one of your first programs, I strongly suggest to first learn a few things (eg: proper ansi/unicode handling and how VB handles it internally, proper binary file reading, etc) and first make easier things you completely understand, before copy/pasting and trying to make your own logfile decrypter.
This post was edited on 03-10-2011 at 12:21 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
|