I asked this on the powerBASIC forum but without luck.
I wanted to try to get rid of my declares and call the few calls i have using Call Dword...
This works fine but i still need to include GetModuleHandle() and GetProcAddress().
Is there any way to obtain these addresses in PB/WIN without declaring them?
Some sort of ASM eq. ??
Thanks,
I wanted to try to get rid of my declares and call the few calls i have using Call Dword...
This works fine but i still need to include GetModuleHandle() and GetProcAddress().
Is there any way to obtain these addresses in PB/WIN without declaring them?
Some sort of ASM eq. ??
Thanks,
What you really need is LoadLibrary and GetProcAddress, from there everything is at your finger tips. After all in most cases the module handle for your main executable is 0400000h anyway. You can take a look at Iczelion's page, I think there is an example of a Win32 program without imports by y0da.
Will search for it.
I need the "kernel" instance to be used with GetProcAddress().
Then i can obtain "LoadLibraryA" and so..
Would be neat if i could get rid of the first two (declares)
I thought you 'left the building'?
:)
I need the "kernel" instance to be used with GetProcAddress().
Then i can obtain "LoadLibraryA" and so..
Would be neat if i could get rid of the first two (declares)
I thought you 'left the building'?
:)
I found this ASM file, but frankly way to complex to me to convert.
http://win32assembly.online.fr/files/kernel.zip
If someone is able to manage the Kernel instance and GetProcAddress() this way in PowerBASIC let me know.
Thanks!
(I'll ask on the PB forum as well)
http://win32assembly.online.fr/files/kernel.zip
If someone is able to manage the Kernel instance and GetProcAddress() this way in PowerBASIC let me know.
Thanks!
(I'll ask on the PB forum as well)
Why don't you just say that you want to imports? Anyway you need at least one entry in the import table for your exe to work on win2k.
To get kernel32.dll address...
Code by lingo12 (if I remember the nick correctly)
Search for the export table and then extract the address.
To get kernel32.dll address...
assume fs:nothing
mov eax,fs:[30h]
mov edx,0B8h
mov ecx,[eax+30h]
test eax,eax
jns KI_1
mov ebx,[eax+34h]
or ecx,ecx
jnz KI_2
KI_1:
mov eax,[eax+0Ch]
sub edx,0B0h
mov eax,[eax+1Ch]
mov ebx,[eax]
KI_2:
mov eax,[ebx+edx] ;;ebp = kernel base
mov ebp,eax
Code by lingo12 (if I remember the nick correctly)
Search for the export table and then extract the address.
I appreciate your efforst but i still have difficulty with:
1) assume fs:nothing ( i assume a flag which must be set to 0 first?)
2) ;ebp = kernel base
If so, how do i get that in an ordianry long.dword ion PB?
:)
1) assume fs:nothing ( i assume a flag which must be set to 0 first?)
2) ;ebp = kernel base
If so, how do i get that in an ordianry long.dword ion PB?
:)
Btw, The powerbasic exe or dll will already have kernel loaded the moment i need the instance handle.
So i assume the kernel example will not be OS depending at all.
So i assume the kernel example will not be OS depending at all.
If you don't want to be kernel/OS version dependant, use GetModuleHandle and GetProcAddress...