[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.vb.general.discussion

Is it possible to read directly bytes from within my application?

Claire

5/21/2010 2:46:00 AM

Hello,
I came across the following problem.
After compiling my app into executable I want to insert into it some data
(few bytes), probably at the end of the file.
How can I programmatically read those bytes from within the same code?
Your help appreciated,
Claire


6 Answers

Dee Earley

5/21/2010 9:17:00 AM

0

On 21/05/2010 03:45, Claire wrote:
> Hello,
> I came across the following problem.
> After compiling my app into executable I want to insert into it some data
> (few bytes), probably at the end of the file.
> How can I programmatically read those bytes from within the same code?

You can use a resource file with a known marker in that you replace, and
can be read easily in your app using LoadResData() or append to the end
of the executable (data on the end won't effect the exe) and read it
using normal file I/O.

The resource method means you have an upper/fixed limit on size, but it
depends on the data itself as to whether that will be a problem or not.

--
Dee Earley (dee.earley@icode.co.uk)
i-Catcher Development Team

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)

Tony Toews

5/21/2010 8:58:00 PM

0

"Claire" <replyto@fra> wrote:

> I came across the following problem.
>After compiling my app into executable I want to insert into it some data
>(few bytes), probably at the end of the file.
>How can I programmatically read those bytes from within the same code?
>Your help appreciated,

I wonder though if anti virus programs would regard that as suspicious
behavior.

BTW are you trying to add a license key routine? I just give the
users a nine digit number. I create a file with that name and their
name encrypted in the file. I upload that to my website. Then my
program then downloads that file with the nine digit number from my
website.

Quite painless I hope. <smile>

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/ac...
Tony's Microsoft Access Blog - http://msmvps.com/blo...
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeup...
Granite Fleet Manager http://www.granite...

Mike Scirocco

5/21/2010 11:58:00 PM

0

On 5/21/2010 1:57 PM, Tony Toews [MVP] wrote:
>...I just give the users a nine digit number.
>...I create a file with that name and their name encrypted in the
file.
>...I upload that to my website. Then my program then downloads that file
>...with the nine digit number from my website.

That seems like a great approach. Do you use a hash for the encryption?

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

Henning

5/22/2010 12:57:00 AM

0



"Claire" <replyto@fra> skrev i meddelandet
news:e0qF0%23I%23KHA.5476@TK2MSFTNGP06.phx.gbl...
> Hello,
> I came across the following problem.
> After compiling my app into executable I want to insert into it some data
> (few bytes), probably at the end of the file.
> How can I programmatically read those bytes from within the same code?
> Your help appreciated,
> Claire
>

It could be possible to declare a string Const, and finding it's value and
change it.
Public Const MyCode As String = "asdfghjkl". Be aware it is stored as
Unicode.

/Henning


Tony Toews

5/23/2010 2:56:00 AM

0

mscir <mscir@yahoo.com> wrote:

>>...I just give the users a nine digit number.
> >...I create a file with that name and their name encrypted in the
>file.
> >...I upload that to my website. Then my program then downloads that file
> >...with the nine digit number from my website.
>
>That seems like a great approach. Do you use a hash for the encryption?

No, I use the MS CryptoAPI with a looong 20 or 40 character key.

I would strongly urge using the CryptoAPI as specified by Microsoft.
Read the documentation thoroughly.

See Security Alert: Debian & Ubuntu Linux Weak Encryption Keys
http://www.cmu.edu/computing/news/security/2008/may/051...
DSA-1571-1 openssl -- predictable random number generator
http://www.debian.org/security/200...

My point is that rolling your own solution can cause problems.

How to encrypt a string in Visual Basic 6.0 and how to decrypt the
string in Visual Basic .NET or in Visual Basic 2005
http://support.microsoft.com...

Ignore the VB.Net/2005 stuff. Decryption is just the reverse of
encryption and is easy to figure out from the sample code in the above
KB article. IIRC you can ignore the downloads too as the KB article
has the necessary sample code.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/ac...
Tony's Microsoft Access Blog - http://msmvps.com/blo...
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeup...
Granite Fleet Manager http://www.granite...

Mike Scirocco

5/24/2010 2:09:00 AM

0

On 5/22/2010 7:55 PM, Tony Toews [MVP] wrote:
> mscir<mscir@yahoo.com> wrote:
>
>>> ...I just give the users a nine digit number.
>>> ...I create a file with that name and their name encrypted in the
>> file.
>>> ...I upload that to my website. Then my program then downloads that file
>>> ...with the nine digit number from my website.
>>
>> That seems like a great approach. Do you use a hash for the encryption?
>
> No, I use the MS CryptoAPI with a looong 20 or 40 character key.
>
> I would strongly urge using the CryptoAPI as specified by Microsoft.
> Read the documentation thoroughly.
>
> See Security Alert: Debian& Ubuntu Linux Weak Encryption Keys
> http://www.cmu.edu/computing/news/security/2008/may/051...
> DSA-1571-1 openssl -- predictable random number generator
> http://www.debian.org/security/200...
>
> My point is that rolling your own solution can cause problems.
>
> How to encrypt a string in Visual Basic 6.0 and how to decrypt the
> string in Visual Basic .NET or in Visual Basic 2005
> http://support.microsoft.com...
>
> Ignore the VB.Net/2005 stuff. Decryption is just the reverse of
> encryption and is easy to figure out from the sample code in the above
> KB article. IIRC you can ignore the downloads too as the KB article
> has the necessary sample code.
>
> Tony

Thanks Tony.

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---