Windows memory pointers in Python?

Gregory Piñero gregpinero at gmail.com
Wed Oct 12 12:19:37 EDT 2005


Well, I think I've got it after a bit of research:

c_char_p(address) seems to do the trick. Thus it would be:
ctypes.c_char_p(address)

Of course still let me know if this is somehow WRONG, or if there is a
better way, but this seems good. Thanks again ctypes!
http://starship.python.net/crew/theller/ctypes/

-Greg

On 10/12/05, Gregory Piñero <gregpinero at gmail.com> wrote:
>
> Hi guys,
>
> I'm really lost of on this one. How can I turn this (VB?) code into
> Python? Basically I call a function exposed from a dll and it returns me
> what I believe is a pointer to a location in memory? Now I need to read that
> area to get the string I need. This link has the solution but it is written
> in VB:
>
> http://www.contactreview.com/mb/showflat.php/Cat/0/Number/15670/an/0/page/14(it's the third post down)
>
> I have to think Python would have something similiar.
>
> Below is my relevant source code just in case you need that too.
>
> I really appriciate any help anyone might have.
>
> --
> Gregory Piñero
> Chief Innovation Officer
> Blended Technologies
> (www.blendedtechnologies.com <http://www.blendedtechnologies.com>)
>
> #---My code: (testing the GOLDMINE API)
> from ctypes import *
> windll.LoadLibrary('GM6S32.dll')
> windll.GM6S32.GMW_LoadBDE
> ('J:\\','J:\\GMBase\\',r'J:\\Common\\','user','pw')
> windll.GM6S32.GMW_NV_SetValue(container,"AccountNo", "(310)555-1212")
> #finally, I call a function to see what I stored:
> windll.GM6S32.GMW_NV_GetValue(container, "AccountNo", "'(none)'")
> #it returns 16236360
> #Now I need to access the string related to this somewhere ...
>
>
>
>


--
Gregory Piñero
Chief Innovation Officer
Blended Technologies
(www.blendedtechnologies.com <http://www.blendedtechnologies.com>)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20051012/7c8c2f42/attachment.html>


More information about the Python-list mailing list