flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
ctl3d32 30 Oct 2010, 01:42
Hi folks!
I'm trying to import and execute some functions from a dll. This dll belongs to a program that does not run above win2k, but this dll is well documented. These are the functions: Code: typedef void * tSr9000Hdl; SR9000API tSr9000Hdl MSVC_STDCALL Sr9000HandleGet ( void ); SR9000API void MSVC_STDCALL Sr9000HandleClose ( const tSr9000Hdl hdl ); I wrote the following code to import and execute two functions, but can't make it work. Could someone please help me? Code: format PE GUI 4.0 entry start include 'win32a.inc' section '.text' code readable executable start: invoke GetModuleHandle,0 mov [h_process],eax ;invoke LoadLibrary,dll ;mov [h_dll],eax ;invoke GetProcAddress,[h_dll],func ;mov [h_func],eax ;invoke h_func invoke Sr9000HandleGet invoke Sr9000HandleClose,eax exit: invoke ExitProcess,0 section '.data' data readable writeable dll db 'SR9000.DLL',0 func db 'Sr9000HandleGet',0 section '.bss' readable writeable h_process dd ? ;handles to the executable process. ;h_dll dd ? ;h_func dd ? section '.idata' import data readable writeable library kernel,'KERNEL32.DLL',\ sr9000,'SR9000.DLL' import sr9000,\ Sr9000HandleGet,'Sr9000HandleGet',\ Sr9000HandleClose,'Sr9000HandleClose' import kernel,\ GetModuleHandle,'GetModuleHandleA',\ ExitProcess,'ExitProcess' ;GetProcAddress,'GetProcAddress',\ ;LoadLibrary,'LoadLibraryA',\ ;import user,\ ; MessageBoxA,'MessageBoxA' Attached you can get the .h file of the dll and the dll itself. Thanks, ctl3d32
|
|||||||||||
![]() |
|
Yardman 30 Oct 2010, 04:45
[ Post removed by author. ]
Last edited by Yardman on 04 Apr 2012, 03:54; edited 1 time in total |
|||
![]() |
|
revolution 30 Oct 2010, 11:57
Make sure the DLL is in the same folder as the exe file. Either that or put the DLL in the system folder.
LoadLibrary has a set method it uses to find the DLL, make sure the DLL is in one of those places that LoadLibrary looks. |
|||
![]() |
|
ctl3d32 30 Oct 2010, 12:41
It's in the same folder as the .exe.
It's an old dll and an old program. Just for the record, it does not even run correctly under winXP. ![]() The university my brother works at bought this very expensive pc board, and they can't switch back to Win2k doe to compatibility issues with other software. Thanks anyway, ctl3d32 |
|||
![]() |
|
revolution 30 Oct 2010, 12:59
I doubt anyone else can test this for you unless they also have the same card.
|
|||
![]() |
|
pearlz 30 Oct 2010, 17:37
I tried rename of IOrange.dll it's return an error when i load library with sr9000.dll
this error <in messagebox> This application has failed to start because IORange.dll was not found. Re-installing the application may fix this problem. then i tried Loadlibrary with IOrange.dll i get an error Code: invoke LoadLibrary,'IORANGE.DLL' test eax,eax jnz @f invoke MessageBox,0,'Error in LoadLibrary','Error',0 jmp exit @@: IORANGE.DLL is corrupted? |
|||
![]() |
|
baldr 30 Oct 2010, 18:29
ctl3d32,
IORANGE.DLL seems to depend on some driver ("\\.\IORangeDevice0" or "VIORange.VXD"). |
|||
![]() |
|
pearlz 30 Oct 2010, 18:48
but i use Dev-C++ and i write
Code: #include "windows.h" int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { HWND hLib=LoadLibraryEx("SR9000.DLL",NULL,1); TCHAR add[50]=""; if (!hLib) { MessageBox(0,"Load Error","LoadLibrary",0); return 0; }else{ MessageBox(0,"Load OK","LoadLibrary",0); HWND hFunc=GetProcAddress(hLib,"Sr9000HandleGet"); wsprintf(add,"Address= %d",&hFunc); MessageBox(0,add,"LoadLibrary",0); /* if (hFunc) MessageBox(0,"Get OK","LoadLibrary",0);*/ return 0; } return 0; } it's work fine. can you use C or c++ for your work? Last edited by pearlz on 30 Oct 2010, 18:57; edited 1 time in total |
|||
![]() |
|
ctl3d32 30 Oct 2010, 18:51
Thanks guys!
You all gave me an idea, and i think it worked. I copied the source code to the software's folder and it seemed to work ( when debugging it with olly). I will try more with it. Thank you all very very much, this was letting me crazy. I'm so stupid!!!! Thumbs Up for all of you! Cheers, ctl3d32 |
|||
![]() |
|
pearlz 30 Oct 2010, 19:00
but hLib and hFunc have one value
it's equal. |
|||
![]() |
|
pearlz 30 Oct 2010, 19:01
but wish you success.
|
|||
![]() |
|
pearlz 30 Oct 2010, 19:04
oh i'm sory
Code: wsprintf(add,"Address= %d",&hFunc); ;change to wsprintf(add,"Address= %d",hFunc); but it work ![]() who stupid? ![]() |
|||
![]() |
|
pearlz 30 Oct 2010, 19:08
Baldr my idol, he so intelligent.
|
|||
![]() |
|
ctl3d32 30 Oct 2010, 21:21
Just for the record, it was missing "VIORange.VXD",since it was located at the installation folder. As soon as i copied my .ASM source to the installation folder, it worked flawlessly.
Thank you all!!!!! |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.