hi,
  how i add & read files from dll on runtime.i heard about .rc files can it be helpful in
  case of dll.plz reply soon,if yes plz guide me some start

@@:
regards
sihota
Posted on 2006-09-20 11:21:37 by sihotaamarpal
i have some dll file in which i have written one function that reads data from some file that exists externally(outside,other than dll file)
.my ques is how i embed that external file in my dll file so that i haven't to carry out that file always with my dll file.after embeding i want to read that inside file.howz that to be done?
Posted on 2006-09-20 12:45:47 by sihotaamarpal

.my ques is how i embed that external file in my dll file so that i haven't to carry out that file always with my dll file.after embeding i want to read that inside file.howz that to be done?

I belive the purpose of that is probably violate some copyright information, and moreover a RE related question.
Posted on 2006-09-20 14:41:07 by Dite
lol Dite.

sihotaamarpal, use the funcs LoadLibrary, LoadResource, LockResource in your app.
Examples of .rc files are present in MASM32 and PoAsm32. You can use RadAsm to easily make that .rc file.
Posted on 2006-09-20 15:11:10 by Ultrano

lol Dite.

Would you mind explain what it is funny ?

Melting a dll file to inside an exe or another dll is exactly related with RE.
What happend if the target dll is packed ?

Posted on 2006-09-20 15:57:50 by Dite
Please re-read his posts, as I already did. Only his first sentence is tricky, but later on he clears it up - he wants to embed data (like a LUT or image or text) into his _own_ dll. He asks how to build his own dll, that contains resources. And then how to read those resources. He even specified _why_ he needs it - and that's the exact reason resources were "invented" in Windows.

sihota:
Basically, you make a .rc file (a text file that defines what files to be included, and what dialogs/menus to be made). When you are compiling your .asm code, you also should compile your .rc file, and finally link them together. An example of a .rc file is:

#include "\masm32\include\resource.h"

1 ICON DISCARDABLE "icon1.ico"
2 ICON DISCARDABLE "myIcon2.ico"

107 BITMAP DISCARDABLE "bmp_107.bmp"
109 BITMAP DISCARDABLE "bmp_109.bmp"

200 RCDATA "myBinaryData.bin"



Then, in your dll, use

invoke GetModuleHandle,0
push eax
invoke FindResource,eax,200,RT_RCDATA
pop edx ; the module handle
invoke LoadResource,edx,eax
invoke GlobalLock,eax
; EAX now contains pointer to the data
Posted on 2006-09-20 16:45:40 by Ultrano
thks ultrano,that's i want
thks for replying
Posted on 2006-09-21 04:48:45 by sihotaamarpal