passing a variable as a pointer to a windows DLL method

C

Citizen Snips

hi guys,

i'm having a problem with a DLL method call which requires a few
pointers.
the code is seg faulting (on the openPort call), so any advice is
appreciated.

i've been able to call other methods from the same dll, so it's possible
i'm passing the variables incorrectly to this method.


require 'dl'

$my_dll = DL.dlopen('some.dll')

handle = " " * 4
p_mask = " " * 8
$my_dll['openPort', 'HicIiIII'].call(handle, "demo", a_mask, p_mask,
1024, 3, 2)

Note, a_mask is initialised elsewhere.

The openPort method has the following signature:

openPort (
long *pHandle,
char *userName,
unsigned __int64 accessMask,
unsigned __int64 *pPermissionMask,
unsigned int queueSize,
unsigned int version,
unsigned int type)
);

I've also tried using the Win32API library, with the same result:

require "Win32API"
mydll = "some.dll"

openport =
Win32API.new(mydll,"openPort",['P','P','I','P','I','I','I'],'I')
openport.call(handle, "demo", a_mask, p_mask, 1024, 3, 2)


thanks in advance....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,740
Latest member
AdolphBig6

Latest Threads

Top