Modify

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#2198 closed Bug (No Bug)

DllStructGetData causes crash

Reported by: JFX Owned by:
Milestone: Component: AutoIt
Version: 3.3.8.1 Severity: None
Keywords: Cc:

Description

DllStructGetData sometimes crashes on a wchar Structure.
Only happens on the first run, never in a loop.
Also happens rarely so push F5 a "few" times.

$ret = DllCall("shell32.dll", "ptr", "CommandLineToArgvW", "wstr", $CmdLineRaw, "int*", 0)
If @error Or Not $ret[0] Then Exit 1
$tPtr = DllStructCreate("ptr", $ret[0])
$retarr = DllStructGetData($tPtr, 1)
$tBuffer = DllStructCreate("wchar[4095]", $retarr)

;crash occurs here
$aRet = DllStructGetData($tBuffer, 1)
DllCall("kernel32.dll", "ptr", "LocalFree", "ptr", $ret[0])

Attachments (0)

Change History (2)

comment:1 Changed 8 years ago by Valik

  • Resolution set to No Bug
  • Status changed from new to closed

Your code is garbage. We cannot protect you from writing shitty code.

comment:2 Changed 8 years ago by JFX

hmm was just a small reproduce form this one here:

http://www.autoitscript.com/forum/topic/67275-dllcall-and-commandlinetoargvw-return-value/page__view__findpost__p__497994

So I assume the DllStructCreate("wchar[4095]", $retarr) is the wrong thing here?
I should never create a (w)char struct in a place, were i don't know what it contains?

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.