wraithdu Posted December 1, 2008 Share Posted December 1, 2008 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 More sharing options...
wraithdu Posted December 1, 2008 Author Share Posted December 1, 2008 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 More sharing options...
monoceres Posted December 1, 2008 Share Posted December 1, 2008 The functions in msvcrt.dll uses the cdecl calling convention. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
wraithdu Posted December 1, 2008 Author Share Posted December 1, 2008 (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 December 1, 2008 by wraithdu Link to comment Share on other sites More sharing options...
monoceres Posted December 1, 2008 Share Posted December 1, 2008 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! Link to comment Share on other sites More sharing options...
wraithdu Posted December 1, 2008 Author Share Posted December 1, 2008 So this would be it, then? void * __cdecl realloc(_In_opt_ void * _Memory, _In_ size_t _NewSize); Good to know. Thanks again. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now