Your browser does not seem to support CSS. If images appear below, please disregard them.
toggle
May
S M T W T F S
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
Sponsored Links
Latest Postings
Topic Options
Rate This Topic
#17637 - 03/29/02 09:33 PM extracting files from .res
Joined: Mar 2002
Posts: 143
olosoft Offline
Member
olosoft Offline
Member

Joined: Mar 2002
Posts: 143
.
ok. basicaly i have a vb app that has a resource file attached to it. the resource file contains a midi. now, i want the program to load, extract the midi to a file, and then play it. i currently have it save the file by opening a file for output as binary and the using the put# command to output whole string, array of bytes converted to sting, to the file at once.

my problem is that when vb outputs to the file, it automaticaly adds " \" to the beggining of the file, and when i compare the outputed midi to the original, it says they differ starting at the fourth character.

i have tried outputing one cell of the vector at a time. that didnt work because vb was adding that **** to the beggining of each character then. i tried the API create file and write file stuff, but it wasnt creating the file at all.

any help would be appreciated.
heres a zip with all the ****. MIDI.zip. i included the original midi for reference.

Top
Sponsored Links
#17638 - 03/30/02 04:38 AM Re: extracting files from .res
Joined: Mar 2002
Posts: 1,273
SilentRage Offline
DollarDNS Owner
SilentRage Offline
DollarDNS Owner

Joined: Mar 2002
Posts: 1,273
OH, USA
with the Put statement you need to make sure the data is in a STRING variable. Not a variant/string or any other type. Just a STRING. If you must, use the CStr() function to convert the data to a string type. It will then save the data properly. Otherwise, it prepends variable type information so that when you load the data using the opposite of Put (I forget what) it will be loaded as the proper type.

As for the API - you probably wasn't using the CreateFile function with the CREATE_NEW flag set.


Domain Registration, Hosting, Management
http://www.dollardns.net
Top
#17639 - 04/03/02 03:10 AM Re: extracting files from .res
Joined: Mar 2002
Posts: 143
olosoft Offline
Member
olosoft Offline
Member

Joined: Mar 2002
Posts: 143
.
thanks SR, but, hrm, yea, the convert to string fuction didnt really work, kindof made it worse. lol. before at least the right characters were there, just seperated by 4 weird characters. now its all weird ****. ill try the API method again.

do you know of any other *simpler* way of attaching a file to the exe and then exporting it to a seperate file uppon execution?

oh, and one more thing. when i opened up my program with a hex editor, theres all the blank space in there, like, null characters. is there a way of compressing the exe to get rid of that space so that the exe will be smaller, yet still able to run? (i found out that you cant just delete it the hard way)

thanks again SR. i love you.

Top
#17640 - 04/03/02 04:03 PM Re: extracting files from .res
Joined: Mar 2002
Posts: 1,273
SilentRage Offline
DollarDNS Owner
SilentRage Offline
DollarDNS Owner

Joined: Mar 2002
Posts: 1,273
OH, USA
-----------
You haven't been to my site for a very long time have you? I compress ALL my programs now to make the EXE's smaller. A 40KB VB EXE can easily be shrunk down to 12KB. Also, since it compresses - all plain text in the EXE file is no longer plain text. You may use the program to only optimize your EXE without compressing - or do both. It was written in assembler. To force you to visit my site, I'm not going to tell you where I got the program. Instead, you'll just have to go to my site's Recommended Links page and find out for yourself. heh
-----------
And uh, I know what I'm talking about here. If you do this:

Open File For Binary As #1
Put #1, , CStr(AnyVariable)
Close #1

It will properly save EXACTLY what's in that variable and nothing more and nothing less.
-----------
As for an alternative to using resource files, see if you can do something with PEBundle by the same guy who made the EXE compresser.


Domain Registration, Hosting, Management
http://www.dollardns.net
Top
#17641 - 05/16/02 11:53 PM Re: extracting files from .res
Joined: Mar 2002
Posts: 256
ninjaneo Offline
UGN Security Staff
ninjaneo Offline
UGN Security Staff

Joined: Mar 2002
Posts: 256
CA, USA
Umm.. olo You could output the file and just chop off the 4 first characters.. Thats wut microsoft would do...

Top

Member Spotlight
Gremelin

Gremelin
Portland, OR; USA
Posts: 7,194
Joined: February 2002
Show All Member Profiles 
Forum Statistics
Forums46
Topics45,745
Posts80,913
Members2,157
Most Online1,567
Apr 25th, 2010
Top Posters(All Time)
UGN Security 38,909
Gremelin 7,194
§intå× 3,255
SilentRage 1,273
Ice 1,146
pergesu 1,136
Infinite 1,041
jonconley 955
Girlie 908
unreal 860
Newest Members
Herbert_Sherbert, codemauve, Lillysdragon1984, Brewwit, boa
2157 Registered Users
Who's Online Now
0 registered members (), 2 guests and 0 spiders.
Latest News