| View previous topic :: View next topic |
| Author |
Message |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Fri Sep 21, 2007 4:42 pm Post subject: calling dlls? |
|
|
How do I call a dll in delphi? I would also like to know how to call in C++ but I need to know how to do in delphi, its important for a project im doing.
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
sponge I'm a spammer
Reputation: 1
Joined: 07 Nov 2006 Posts: 6009
|
Posted: Fri Sep 21, 2007 4:43 pm Post subject: |
|
|
LoadLibrary/GetProcAddress call eax
_________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Fri Sep 21, 2007 4:44 pm Post subject: |
|
|
/ = and or or?
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
sponge I'm a spammer
Reputation: 1
Joined: 07 Nov 2006 Posts: 6009
|
Posted: Fri Sep 21, 2007 4:45 pm Post subject: |
|
|
and
_________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Fri Sep 21, 2007 4:50 pm Post subject: |
|
|
kk, btw, how do i get the file path of something?
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
sponge I'm a spammer
Reputation: 1
Joined: 07 Nov 2006 Posts: 6009
|
Posted: Fri Sep 21, 2007 5:07 pm Post subject: |
|
|
for your own program? details... if you want to know your on programs path (GetModulePath)
_________________
|
|
| Back to top |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Fri Sep 21, 2007 5:43 pm Post subject: |
|
|
| Vague, what do you mean by call?
|
|
| Back to top |
|
 |
sponge I'm a spammer
Reputation: 1
Joined: 07 Nov 2006 Posts: 6009
|
Posted: Fri Sep 21, 2007 5:44 pm Post subject: |
|
|
guessing he meant call a function in the dll.
_________________
|
|
| Back to top |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Fri Sep 21, 2007 5:52 pm Post subject: |
|
|
| _declspec(dllimport) ?
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Fri Sep 21, 2007 6:39 pm Post subject: |
|
|
Yea, I want to know how to call a function in the dll.
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
TheSorc3r3r I post too much
Reputation: 0
Joined: 06 Sep 2006 Posts: 2404
|
Posted: Fri Sep 21, 2007 7:17 pm Post subject: |
|
|
DWORD addy = GetProcAddress(LoadLibrary(dllpath), functionname);
__asm
{
push arguments
call addy
}
_________________
Don't laugh, I'm still learning photoshop! |
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Fri Sep 21, 2007 7:20 pm Post subject: |
|
|
| TheSorc3r3r wrote: | DWORD addy = GetProcAddress(LoadLibrary(dllpath), functionname);
__asm
{
push arguments
call addy
} |
| Code: |
DWORD addy = GetProcAddress(LoadLibrary(/*can i leave path blank if its in the same folder?*/)main);
_asm
{
push arguments //is that rly something i do lol
call addy
}
|
???
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
TheSorc3r3r I post too much
Reputation: 0
Joined: 06 Sep 2006 Posts: 2404
|
Posted: Fri Sep 21, 2007 7:49 pm Post subject: |
|
|
No, yes.
For example:
to call the function nub(int arg1, int arg2) like nub(4, 6), from lol.dll,
DWORD nub = GetProcAddress(LoadLibrary("lol.dll"), "nub");
__asm{
push 6
push 4 // MUST BE IN REVERSE ORDER!
call nub
}
_________________
Don't laugh, I'm still learning photoshop! |
|
| Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Fri Sep 21, 2007 7:55 pm Post subject: |
|
|
and what if he isn't using the stdcall calling convention? c/c++ compilers don't do that by default
the proper way is
| Code: |
typedef int(__cdecl* nubprototype)(int arg1, int arg2);
void aaaa()
{
nubprototype nb;
nb = (nubprototype)GetProcAddress(LoadLibrary(TEXT("lol.dll")), "nub");
nb(1, 2); //you can call it like any function, no inline asm required
}
|
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Fri Sep 21, 2007 8:20 pm Post subject: |
|
|
| TheSorc3r3r wrote: | No, yes.
For example:
to call the function nub(int arg1, int arg2) like nub(4, 6), from lol.dll,
DWORD nub = GetProcAddress(LoadLibrary("lol.dll"), "nub");
__asm{
push 6
push 4 // MUST BE IN REVERSE ORDER!
call nub
} |
push 6 push 4? I'm sorry, I havn't done assembly in a while =P btw, i know what its doing, well like i know what push 6 and push 4 means i just dont know what its acutally doing
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
|