How to read pointer data with Win32::API

I have a case where I’m using Win32::API like this:

GMEM_FIXED = 0
a = GlobalAlloc(GMEM_FIXED, x) # x is some large number
b = GlobalLock(a)

GetDIBits(_, _, _, _, b, _, _) # _ are just some variables, which are
not necessary to show in here

And, since i’m using windows-pr, then the functions above are declared
like this:
API.new(‘GlobalAlloc’, ‘LL’, ‘L’)
API.new(‘GlobalLock’, ‘L’, ‘L’)
API.new(‘GetDIBits’, ‘LLIIPPI’, ‘I’, ‘gdi32’)

In short, i don’t seem to understand, how can i read the binary data
lurking behind the pointer of ‘b’, which is actually just a Fixnum
(because GlobalAlloc and GlobalLock return long). Is it even possible in
Ruby? Should i try some other approach instead?

Jarmo

In short, i don’t seem to understand, how can i read the binary data
lurking behind the pointer of ‘b’, which is actually just a Fixnum
(because GlobalAlloc and GlobalLock return long). Is it even possible in
Ruby? Should i try some other approach instead?

Suggest FFI since it has things like get_pointer (though I’m not too
into it in depth)…
-rp