Results 1 to 11 of 11

Thread: protecting an application

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 1999
    Location
    Glasgow,Scotland
    Posts
    281

    Is there a way I can protect my files? I'm making an application that will be distributed on CD-ROM. There are a lot of realaudio and flash movies on the CD, and when users click a button on the interface of my app it will open the respective file.

    I'd much prefer if the user could open the files through my app only - rather than just having to double click the file and it opens. What's this about compression - where the files are compressed and your app decompresses them before opening them? Am I going in the right direction?

    Thanks for any help or tips!

  2. #2
    Lively Member
    Join Date
    Jun 1999
    Posts
    120
    suggestion...
    change the extensions of the files
    (e.g. .txt --> .tx_; .mdb --> .md_, etc.)

    when users click the button, revert
    back to the original extension before
    opening the file
    (you must have a list of extensions to
    know which letter to supply)

    hope this could help... goodluck!!!!

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 1999
    Location
    Glasgow,Scotland
    Posts
    281
    KenX,

    Thanks for the tip - much appreciated. But is there a better way than this? If I understand what you're saying, your idea is a way of codding people, rather than protecting my app.

    For example, if you double click a page.htm file, it opens in a browser. If you change the extension to, say, .hm, it doesn't open - it doesn't know what app to open it with.

    But if you open the browser .exe, choose open file, you will be able to open the .hm extension that way. Is there any way I can have it so my file can ONLY be opened through my App? What's this about resource files? Compressing?

    Thanks again!

  4. #4
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    If the files aren't enormous you could encrypt them.

    I don't actually know that much about file handling but if you can load the file into a byte array it should be very easy and fast to encrypt them by just adding 1 to each byte and setting it to 0 if it goes to 256. or adapt the encryption routine in http://forums.vb-world.net/showthrea...threadid=11948. then just save them as .tmp files, use those and delete them afterwards, or I think there's a way of setting a file to delete itself when all fererences to it are broken.

    hope this helps.

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    If you have a lot of files...

    You can make a compressed archive, but thats a bit complicated, but simply copying all files into a single file and save the length and order of them will do the same. In fact, that's really professional to have just one sourcefile.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 1999
    Location
    Glasgow,Scotland
    Posts
    281

    I think I might be getting somewhere now - I thought it was possible to do something like you're talking about, Kedaman.

    When you say, 'simply copying all files into a single file and save the length and order of them will do the same' do you mean using a program like Winzip?

    I don't imagine the feature you're speaking of is available in the simple edition of Winzip - perhaps the professional edition.

    Thanks

  7. #7
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    I didn't mean Winzip, but i think that's a way too, if you have a unzipcontrol. I don't.
    What i ment was to do your own archiver. It's not simple, i know but it don't have to be as advanced as winzip. The only features you need is to make it copy the files into a one archive file and then save a Table of contents into the end of the file. And the other feature is of course to read the Table of contents and extract the file(s) that you need.

  8. #8
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840
    Well,

    If you only want to read the files and not modify them (likely considering the CD distribution ) and thus you know all the file lengths you could write them into one file.

    Make youself a little VB tool which opens files in binary mode and appends them all together, keep a list of file names and lenghts and just read out the bytes you wnat into the temp dir when you need them and delete them when you're finished.

    If you put some thought into it you could define a header which has the contents in it. eg

    first 4 bytes (long) = header lenght (writen last after calc... len(header) )
    header (comma delimited or whatever)
    file bytes writen from array. it's not encryptipon but it would take a programmer to write code to extract the files.

    To exctract, read the header and search the string for the file, then load the bytes out into a byte array, write the temp file and open it, or if it's a format that your software supports, open it out of memory.

    binary read/write is fast so you won't have to worry about performance issues much, should only be a fraction slower

  9. #9
    Addicted Member
    Join Date
    Jul 1999
    Location
    Bergen, Norway
    Posts
    143
    Why not just put evrything into a resource file? it is easy to access and only programmers know how to open those files

    the resource editors comes with VB. just look around and you will find it.


    -Lumin

  10. #10
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Pittsburgh, PA
    Posts
    329
    put your flash files IN your program with an OLE control (if you don't want the user to see them then resize them until they are small or try setting visible to false)

    Set the AutoActivate property to getfocus
    When you click the button have the button setfocus on the ole and that should open it.
    this may work

    you could also try setting enabled to false and using the command button to enable it. have the autoactivate property on manual.
    i hope it works

  11. #11

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 1999
    Location
    Glasgow,Scotland
    Posts
    281
    Thanks all for your help,


    They're all good ideas and I'll look into them further. I might go through the Winzip strategy because it probably has all the hard work done already (provided all users don't have to have a copy of Winzip on their computer!).

    HAVocINCARNATE29 (where on earth did you come up with that name?), it was an interesting idea you said about Flash. But the problem with Flash is that it seems to be so damn complicated - an .OCX for IE, a plug in for Netscape, another .OCX to include with your App....I could see people ringing me up in nightmare proportions. I found out recently that you can make a projector with Shockwave - a standalone, that requires no .OCX etc. It makes your file an .exe. So I'll make loads of different .exes, include them in an archive, or whatever, and when the user clicks a command button, it will open that particular .exe. I think that's what I'll do. Unless someone has a better idea?

    Thanks!

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