Jump to content

memcpy, memset help


wraithdu
 Share

Recommended Posts

Why on earth is this crashing under Vista?

Func _memset($dest, $c, $size)
    Local $ret = DllCall("msvcrt.dll", "ptr", "memset", "ptr", $dest, "int", $c, "long", $size)
    Return $ret[0]
EndFunc

$s = DllStructCreate("char[10]")
_memset(DllStructGetPtr($s), 58, DllStructGetSize($s))

Thanks...I'm tired :)

Link to comment
Share on other sites

Ok, so I can write AutoIt versions of memcpy and memset, however I need to get realloc working. Again, same crash -

Func _realloc($src, $size)
    Local $ret = DllCall("msvcrt.dll", "ptr", "realloc", "ptr", $src, "long", $size)
    Return $ret[0]
EndFunc

$s = DllStructCreate("char[10]")

$ret = _realloc(DllStructGetPtr($s), DllStructGetSize($s))
ConsoleWrite($ret & @CRLF)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...