Modify ↓
Opened 16 years ago
Closed 15 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 by , 16 years ago
comment:2 by , 16 years ago
| Milestone: | → 3.3.7.0 |
|---|---|
| Owner: | set to |
| Resolution: | → Fixed |
| Status: | new → closed |
Fixed by revision [5925] in version: 3.3.7.0
comment:3 by , 16 years ago
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:5 by , 15 years ago
| Resolution: | Fixed |
|---|---|
| Status: | closed → reopened |
comment:7 by , 15 years ago
| Milestone: | → 3.3.7.7 |
|---|---|
| Owner: | changed from to |
| Resolution: | → Fixed |
| Status: | reopened → closed |
Fixed by revision [6086] in version: 3.3.7.7
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