|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
embedding files to .exe
Hi,
I'm working on a VB App and need to be able to embed a file (freely). At the moment it is a .txt which contains license info and user related info. I want to be able to have that information in a file to be included with the final bootstrap .zip and have it so it can't be edited without a password or something. This is for a Win 2000/NT/XP type of OS and will be released freely, however people need to require licenses so i can keep track of it. The file looks like this at the moment: Code:
"Registrant", "Company", "Postcode", "Date of issue", "Date of expiration", "Type of license", "Issuer" thanks, comp |
|
#2
|
|||
|
|||
|
You can embed data in exe files easily using resource files. I never did much VB, but VC has an option like "file/add existing file/add resource file".
read the help file for how to create them. iirc you have to make a list of your resources in text format and then run a compiler on it. On each compile/build process of your program, the file will be included and can be retrieved using LoadResource(). Hereīs an article in the MSDN with an example for loading resources:http://msdn.microsoft.com/library/default.asp?.../usingresources.asp PS: encrypt the file and donīt call it "LICENSE.TXT". Resources can be modified easily.
__________________
-- Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more. |
|
#3
|
||||
|
||||
|
just passing by when... I realised I always wanted to know how to do that - thanks!
nao |
|
#4
|
||||
|
||||
|
BTW, if you want to know how to screw around with the existing resources of a program, here's one way, using Visual C++
DISCLAIMER - I'm not responsible for any damages caused by this technique. Use at your own risk. 1. Start Visual C++ 2. Go to File-->Open. 3. In the Open File Dialog box, change the Files of type combo box to Executable Files (*.exe; *.dll; *.ocx) 4. Open the file of your choice. For example, C:\WINNT\SYSTEM32\commdlg.dll (or C:\WINDOWS\SYSTEM32\commdlg.dll for Windoze 98 users) 5. You should be presented with the resource editor and a list of resources. If you used the above file, you can expand the Dialog resources and fiddle with the common dialogs -- my friend resizes the controls to show more files. You can change the dialogs, strings, icons etc. to your liking ![]() 6. If you do save the changes for the above file, then any program that uses the common dialogs will be affected. This means pretty much any program that displays a Open File, Save File, Print File, Find or Find/Replace Dialog Remember, USE AT YOUR OWN RISK! I don't personally fiddle with the commdlg.dll file, but I know someone who does. |
|
#5
|
||||
|
||||
|
Hehehe...
Reminds of my high school days. I modifed the names of DOS commands in COMMAND.COM on all of the library computers by creating a start-up disk that used DEBUG to run my asm code... Code:
debug < asmcode.asm Debug will only take basic 80x86 instructions, so I had to write the program really awkwardly, but that was enough to change all of the commands. I changed DIR to EJS and CD to DF etc., incremented hex vals of (ascii) command names by one. Anyway, the school techie said it was due to the 'Ripper' virus (anybody remember 1995/6... the Ripper virus epidemic?!), which was a load of horsesh*t. But he put those funny plastic cards with locks on them into all of the floppy drives to prevent people accidentally infecting further computers... well, my consience got the better of me, but I couldn't go back to fix the computers becasue I couldn't via the floppy-seek. The moral of my story is, learn how to pick locks - you never know when you might want to go back in to undo a prank! nao |
|
#6
|
||||
|
||||
|
You can get to the resource editor in VB in the add-ins. Goto the add-ins manager and load up VB6 Resource Editor.
You can store and access multiple types store in the resource file. i.e. for strings use LoadResString(resource id) |
![]() |
| Viewing: Dev Shed Forums > Other > Dev Shed Lounge > embedding files to .exe |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|