Jump to content

Recommended Posts

Posted

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 :)

Posted

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)
Posted (edited)

Thanks! Sheesh, how did you know that? Just experience?

Oh, and I guess realloc doesn't work with DllStruct pointers, only pointers from malloc / calloc.

Edited by wraithdu
Posted

Thanks! Sheesh, how did you know that? Just experience?

Oh, and I guess realloc doesn't work with DllStruct pointers, only pointers from malloc / calloc.

I checked the C++ header.

Broken link? PM me and I'll send you the file!

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
×
×
  • Create New...