Modify ↓
Opened 15 years ago
Closed 13 years ago
#1586 closed Bug (Fixed)
DllStructSetData(char, 1, string-with-NUL-character), junk data(?)
Reported by: | anonymous | Owned by: | Jon |
---|---|---|---|
Milestone: | 3.3.7.7 | Component: | AutoIt |
Version: | 3.3.6.1 | Severity: | None |
Keywords: | Cc: |
Description
kinda expect the character part to end up with 0x61.00.63.00.64 or 0x61.00.00.00.00
anything else (junk data?) seems like a bug to me.
Local $sOrg = 'a' & Chr(0) & 'c' & Chr(0) & 'd' ;; -> a[NUL]c[NUL]d ConsoleWrite('StringLen($sOrg) = ' & StringLen($sOrg) & @CRLF) ;; 5 $sCnv = StringReplace($sOrg, Chr(0), Chr(0), 0, 1) ;; -> a[NUL]c[NUL]d $sCnv = StringReplace($sOrg, Chr(0), '[nul]', 0, 1) ;; -> a[nul]c[nul]d ConsoleWrite('$sCnv = ' & $sCnv & @CRLF) Local $tChar = DllStructCreate('char[5]') Local $tByte = DllStructCreate('byte[5]', DllStructGetPtr($tChar)) ;; assuming ansi. DllStructSetData($tByte, 1, $sOrg) ;; -> 0x61.00.63.00.64 ConsoleWrite('$tByte = ' & DllStructGetData($tByte, 1) & @CRLF) DllStructSetData($tChar, 1, $sOrg) ;; -> 0x61.00.99.01.20 -> a.NUL.(junk?) ConsoleWrite('$tByte = ' & DllStructGetData($tByte, 1) & @CRLF) ;; $sOrg still unchanged. just making sure. $sCnv = StringReplace($sOrg, Chr(0), '[nul]', 0, 1) ;; -> a[nul]c[nul]d ConsoleWrite('$sCnv = ' & $sCnv & @CRLF)
but than again ...
Attachments (0)
Change History (7)
comment:1 Changed 15 years ago by Jpm
comment:2 Changed 14 years ago by Jpm
- Milestone set to 3.3.7.0
- Owner set to Jpm
- Resolution set to Fixed
- Status changed from new to closed
Fixed by revision [5925] in version: 3.3.7.0
comment:3 Changed 14 years ago by mvg
Thanks.
Just curious. What will the resulting stored data be now for "DllStructSetData($tChar, ...)"
1) 0x61.00.63.00.64
2) 0x61.00.00.00.00
3) ...
comment:4 Changed 14 years ago by Jpm
1)
comment:5 Changed 13 years ago by Jon
- Resolution Fixed deleted
- Status changed from closed to reopened
comment:7 Changed 13 years ago by Jon
- Milestone set to 3.3.7.7
- Owner changed from Jpm to Jon
- Resolution set to Fixed
- Status changed from reopened to closed
Fixed by revision [6086] in version: 3.3.7.7
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.
Note: See
TracTickets for help on using
tickets.
in fact the rewriting thru tchar will assume that your $sOrg is a real string.
So for me 0x6100... is correct.
I will investigate to see why the last byte is changed I get a 0x61.00.00.00.10