View Full Version : Dll functions
ReVeR
August 12th, 2004, 00:28
Hey.
i got this question.
i got a prog that calls an openGl function....it is rather easy in c++ but, if u disasseble the code u see that to call teh openGl function the program needs to call the getprocadress function and then use it to get to the ogl function.....
any ideas on why this is this way?
and also to what extent is this the same as lets say ....calling a winapi function?
thx
lifewire
August 12th, 2004, 03:56
sometimes it is done when using functions from certain dll's that are not supposed to exist on all systems. normally, if an imported module (dll) is missing, the windows loader would say "can't find blabla.dll". when a program manually loads the module using loadlibrary and locates the imported functions using getprocaddress it could display a more friendly error message like "you don't have opengl. download it from www.opengl.something".
naides
August 12th, 2004, 06:11
A dll can be statically imported during the compilation/linking process. Most winApi dll are imported this way by default. In that case you don't need to use getProcAddress or any thing like that, Import Table Mechanism of windows PE
finds out the addresses of all the imported functions when the program loads.
The second flavor of dll is imported during runtime in an "as needed" fashion, which reduces some overhead, but requires more explicit work by the program(er). That is when LoadLibrary and GetProcAddress gets used to obtain the particular function code address, because it is not contained in the IAT.
ReVeR
August 12th, 2004, 10:33
eh...crap i got it.....i forogt that we include libs for ogl.....
sry for dumbas post....one morequestion...were is GetDriveTypeA and MessegeBoxA ?
what dll?
kernel or user?
thx
naides
August 12th, 2004, 10:51
Quote:
[Originally Posted by ReVeR]eh...crap i got it.....i forogt that we include libs for ogl.....
sry for dumbas post....one morequestion...were is Kernel32:GetDriveTypeA and User32:MessegeBoxA ?
what dll?
kernel or user?
thx |
Quickest way to find out is in SoftIce put a bpx on the function, then when you list the breakpoints (bl), the dll name is prepended to the name of the API function.
Olly will allow you to see the functions in the import list grouped by dll. A little more cumbersome.
ReVeR
August 12th, 2004, 16:07
k, thx....
1 more question....
what does getDriveTypeA return when the cd rom is found ?
thx
gabri3l
August 12th, 2004, 16:21
The returns for getdrivetype are
0: The drive type cannot be determined.
1: The root directory does not exist.
DRIVE_REMOVABLE or 2: The drive can be removed from the drive.
DRIVE_FIXED or 3: The disk cannot be removed from the drive.
DRIVE_REMOTE or 4: The drive is a remote (network) drive.
DRIVE_CDROM or 5: The drive is a CD-ROM drive.
DRIVE_RAMDISK or 6: The drive is a RAM disk
You should probably grab the win32api help file at Iczelion. It will answer a lot of your questions. hxxp://spiff.tripnet.se/~iczelion/files/win32api.zip
lifewire
August 13th, 2004, 06:36
all api related questions are in the sdk. there you'll find also in which module the api's are exported. a better way to quickcheck in softice is not to bpx and bl, but use: exp apiname.
naides
August 13th, 2004, 09:20
Quote:
[Originally Posted by lifewire] a better way to quickcheck in softice is not to bpx and bl, but use: exp apiname. |
A Newbie Knows more than I do. Oh, the shame!

dELTA
August 13th, 2004, 10:04
I wouldn't exactly consider lifewire to be a newbie, although maybe you were only making a joke referring to his post count here.

naides
August 13th, 2004, 11:02
Quote:
[Originally Posted by dELTA]I wouldn't exactly consider lifewire to be a newbie, although maybe you were only making a joke referring to his post count here.  |
Anybody may have more info that I have. I was making a joke!. I am a professional newbie.
I don't judge a person by the post count, what a difference from some people in this board. . .

dELTA
August 13th, 2004, 17:14
Aw man, even the
newbies are starting to make post count related wisecracks to me...

And I wouldn't really call you a newbie either for that matter naides.

Powered by vBulletin® Version 4.2.2 Copyright © 2018 vBulletin Solutions, Inc. All rights reserved.