1. Accessing EHLLAPI DLL files
- Posted by pete_stoner at btconnect.com Sep 10, 2003
- 609 views
Hi All, I need some help on this, I have some questions on using functions from DLL files.. I'm trying to reproduce a sample Visual Basic program (I don't know VB!) in Euphoria (EHLLAPI DLL stuff). The program needs to use a specific (win32) DLL file (which I'm also trying for the first time), with Euphoria I've successfully called and executed a function in another DLL file (which was a major step forward for me!!) where I could see the function I am calling in the DLL (Using Dependency Walker). However I have a problem (or 2) with the DLL I really need to use. An excerpt from the reference manual.. >The EHLLAPI entry point (hllapi) is always called with the following four parameters: >1.EHLLAPI Function Number (input) >2. Data Buffer (input/output) >3. Buffer Length (input/output) >4. Position (input); Return Code (output) > The prototype for the EHLLAPI is; (long hllapi(LPINT, LPSTR, LPINT, LPINT)" > Each parameter is passed by reference not by value...... (etc etc) My first problem is that I always get an error (-1) from my define_c_function . The function I am calling is not listed in the DLL I have to call, I am assuming that it must be in another DLLs that the first one links to (?), also the book says I have to call the function by number (I still don't fully understand if I am defining it correctly) i.e. ehlapi = open_dll("EHLAPI32.DLL") ConnectPS = define_c_func(ehlapi, "1", {C_INT, C_POINTER, C_INT}, C_INT) The ref book goes on to say.. >All the parameters in the hllapi call are pointers and the return code of the EHLLAPI function is returned in the value of the 4th parameter, not as the value of the function.. Which would suggest that I cannot get the return code with just the normal ret = c_func(ConnectPS.... Hopefully I've explained this enough (it's tricky when you don't really know what you are talking about!!)...Help!! .
2. Re: Accessing EHLLAPI DLL files
- Posted by pete_stoner at btconnect.com Sep 10, 2003
- 607 views
Thats what I call a quick reply, thanks Matt, you're a star! Time for me to do some more playing........... ----- Original Message ----- From: "Matt Lewis" <matthewwalkerlewis at yahoo.com> To: "EUforum" <EUforum at topica.com> Subject: RE: Accessing EHLLAPI DLL files > > > > From: pete_stoner at btconnect.com [mailto:pete_stoner at btconnect.com] > > > >The EHLLAPI entry point (hllapi) is always called with the following > > >four > > parameters: > > >1.EHLLAPI Function Number (input) > > >2. Data Buffer (input/output) > > >3. Buffer Length (input/output) > > >4. Position (input); Return Code (output) > > > The prototype for the EHLLAPI is; (long hllapi(LPINT, > > LPSTR, LPINT, > > LPINT)" > > > Each parameter is passed by reference not by value...... (etc etc) > > > > My first problem is that I always get an error (-1) from my > > define_c_function . The function I am calling is not listed > > in the DLL I have to call, I am assuming that it must be in > > another DLLs that the first one links to (?), also the book > > says I have to call the function by number (I still don't > > fully understand if I am defining it correctly) i.e. ehlapi = > > open_dll("EHLAPI32.DLL") ConnectPS = define_c_func(ehlapi, > > "1", {C_INT, C_POINTER, C_INT}, C_INT) > > > > The ref book goes on to say.. > > >All the parameters in the hllapi call are pointers and the > > return code > > >of > > the EHLLAPI function is returned in the value of the 4th > > parameter, not as the value of the function.. Which would > > suggest that I cannot get the return code with just the > > normal ret = c_func(ConnectPS.... > > OK, let's start with the function prototype: > > long hllapi(LPINT, LPSTR, LPINT,LPINT) > > This tells us that it returns a long value (probably an error indicator for > hllapi itself, not the function you're calling). The other parameters are > all pointers, do your define_c_func should look like: > > xhllapi = define_c_func( elhapi, "hllapi", repeat(C_POINTER,4), C_INT ) > > Any function you want to call, you will need to call through the hllapi > function. First, you need to allocate space in order to poke the values for > hllapi: > > func_no = allocate(4) > buffer = allocate( 256 ) > buffer_len = allocate(4) > position_return = allocate(4) > > Then poke the values for the function (assuming that ConnectPS is function > #1): > > poke4( func_no, 1 ) > poke( buffer, your_input_data ) > poke4( buffer_len, 256 ) > poke4( position_return, whatever_this_means ) > > ret = c_func( xhllapi, {func_no,buffer,buffer_len,position_return} ) > > -- to see what the return value was: > ? peek4s( position_return ) > > > You should use whatever buffer size that makes sense. Also, you should > check it after calling, because hllapi will probably tell you if it needs > more room to return whatever it was going to return in the buffer (if > anything--you'll have to read the documentation on each routine). I'm not > sure what #4, Position means to hllapi, so I can't help you out there. > > Matt Lewis > > --^---------------------------------------------------------------- > This email was sent to: pete_stoner at btconnect.com >
3. Re: Accessing EHLLAPI DLL files
- Posted by pete_stoner at btconnect.com Sep 11, 2003
- 605 views
Hi Jonas, Kind of, I'm trying to wrap the emulator functions for the IBM Personnal Communications so I can get and send data from/to a 3270 session, but it will be slow work as I am a novice to DLLs and C functions, so I might be back here for more advice... regards Pete ----- Original Message ----- From: "Jonas Temple" <jtemple at yhti.net> To: "EUforum" <EUforum at topica.com> Subject: RE: Accessing EHLLAPI DLL files > > > Pete, > > I'm assuming that you're working with the emulator interface functions > in Client Access from IBM. If so, if you get a working Euphoria wrapper > for this I would be interested in a copy, if it's okay. > > I've wrapped about 90% of the other CA DLLs and wanted to try EHLLAPI > but never got around to it. > > Thanks, > > Jonas Temple > > P.S. - If you're interested in any of the other CA functions you can > find my wrappers at www.yhti.net/~jktemple > pete_stoner at btconnect.com wrote: > > > > > > Hi All, > > I need some help on this, I have some questions on using functions from > > DLL files.. > > I'm trying to reproduce a sample Visual Basic program (I don't know VB!) > > in Euphoria (EHLLAPI DLL stuff). The program needs to use a specific > > (win32) > > DLL file (which I'm also trying for the first time), with Euphoria I've > > successfully called and executed a function in another DLL file (which > > was a > > major step forward for me!!) where I could see the function I am calling > > in > > the DLL (Using Dependency Walker). However I have a problem (or 2) with > > the > > DLL I really need to use. > > > > An excerpt from the reference manual.. > > >The EHLLAPI entry point (hllapi) is always called with the following > > >four > > parameters: > > >1.EHLLAPI Function Number (input) > > >2. Data Buffer (input/output) > > >3. Buffer Length (input/output) > > >4. Position (input); Return Code (output) > > > The prototype for the EHLLAPI is; (long hllapi(LPINT, LPSTR, LPINT, > > LPINT)" > > > Each parameter is passed by reference not by value...... (etc etc) > > > > My first problem is that I always get an error (-1) from my > > define_c_function . The function I am calling is not listed in the DLL I > > have to call, I am assuming that it must be in another DLLs that the > > first > > one links to (?), also the book says I have to call the function by > > number > > (I still don't fully understand if I am defining it correctly) i.e. > > ehlapi = open_dll("EHLAPI32.DLL") > > ConnectPS = define_c_func(ehlapi, "1", {C_INT, C_POINTER, C_INT}, C_INT) > > > > The ref book goes on to say.. > > >All the parameters in the hllapi call are pointers and the return code > > >of > > the EHLLAPI function is returned in the value of the 4th parameter, not > > as > > the value of the function.. > > Which would suggest that I cannot get the return code with just the > > normal > > ret = c_func(ConnectPS.... > > > > Hopefully I've explained this enough (it's tricky when you don't really > > know what you are talking about!!)...Help!! > > . > > > > > --^---------------------------------------------------------------- > This email was sent to: pete_stoner at btconnect.com > > > TOPICA - Start your own email discussion group. FREE! > >