Opened on Nov 17, 2010 at 7:22:33 AM
Closed on May 25, 2011 at 7:51:05 PM
Last modified on Jul 25, 2017 at 10:12:14 PM
#1816 closed Bug (Fixed)
_GUICtrlListView_GetItemText not properly work on Windows 7 x 64
| Reported by: | Owned by: | Jon | |
|---|---|---|---|
| Milestone: | 3.3.7.2 | Component: | AutoIt |
| Version: | 3.3.6.1 | Severity: | None |
| Keywords: | Cc: |
Description
I can't get text of SysListView32 item (returns empty string).
My system: Windows 7 Ultimate x64 Russian
I'm attach program ShellExView for testing.
Code:
$hWnd = ControlGetHandle("ShellExView","","SysListView321")
MsgBox(0,"", _GUICtrlListView_GetItemText($hWnd, 0,3))
I've check system messages with Spy8 taken from here: http:// mdb-blog . b l o g s p o t . com/2010/11/microsoft-spy-or-spyxx-for-download.html (remove spaces - you spam bot reject link)
The system message log is in attached image. In image you can see very strange wrong buffer size and zero in pszText pointer.
In other program (that I'm really need to interact with) with unicode codepage in SysListView32 the same bug.
Any solution?
P.S. Program log:
>"D:\PROGRAMS\Development\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "D:\PROGRAMS\Development\AutoIt3\Examples\tests2.au3" /autoit3dir "D:\PROGRAMS\Development\AutoIt3" /UserParams +>10:04:01 Starting AutoIt3Wrapper v.2.0.1.24 Environment(Language:0419 Keyboard:00000409 OS:WIN_7/ CPU:X64 OS:X64) >Running AU3Check (1.54.19.0) from:D:\PROGRAMS\Development\AutoIt3 +>10:04:01 AU3Check ended.rc:0 >Running:(3.3.6.1):D:\PROGRAMS\Development\AutoIt3\autoit3_x64.exe "D:\PROGRAMS\Development\AutoIt3\Examples\tests2.au3"
Attachments (1)
Change History (14)
by , on Nov 17, 2010 at 7:24:21 AM
| Attachment: | shexview_with_image.zip added |
|---|
comment:1 by , on Nov 17, 2010 at 8:05:37 AM
P.S.2.
By the way, maybe I'm wrong, but why then you create in _GUICtrlListView_GetItemText wchar buffer, you don't reserve double size buffer in external memory?
Your code:
If $fUnicode Then
$tBuffer = DllStructCreate("wchar Text[4096]")
Else
$tBuffer = DllStructCreate("char Text[4096]")
...
Local $pMemory = _MemInit($hWnd, $iItem + 4096, $tMemMap)
...
_MemRead($tMemMap, $pText, $pBuffer, 4096)
Then I've searching for solution, I try to fix it, but it is not solve above problem.
comment:2 by , on Nov 17, 2010 at 9:29:14 AM
I've found the reason of bug in your code.
Remark: size of LV_ITEMA structure is 72 = 0x48
In new test I have Spy log:
lParam: 0x02260000 (Pointer to LV_ITEMA) ... iSubItem: 3 state: 0000 stateMask: 0000 pszText: 00000000 cchTextMax: 36044872 = 0x02260048 (!!!) iImage: 0 lParam: 00001000 = 4096 (!)
So... see the problem?
Problem is:
the value of cchTextMax must be in pszText,
the value of lParam must be in cchTextMax.
Bug is in your struct LV_ITEMA(W) creation - it looks like you make size of state and stateMask as 8 bytes each for x64 OS, but it must be 4 bytes in any OS! Check MSDN.
Well, where and how I have to patch you code to correct solve the problem?
comment:3 by , on Nov 17, 2010 at 10:16:23 AM
I was wrong a little.
Size of state and stateMask is OK.
Problem in (from help):
ptr: 32 or 64bit unsigned integer (depending on if the x86 or x64 version of AutoIt is used)
If change in $tagLVITEM "ptr Text" to "uint Text" (i.e. make it 32bit) _GUICtrlListView_GetItemText solve the problem (but not solves the bug).
Thank you for silence.
Check other similar structs - maybe you have the same problems on x64.
comment:4 by , on Nov 17, 2010 at 4:24:46 PM
Look at these my previous tickets.
Maybe it can help you because there are mentioned functions where it's correctly handled.
http://www.autoitscript.com/trac/autoit/ticket/1317
http://www.autoitscript.com/trac/autoit/ticket/1318
http://www.autoitscript.com/trac/autoit/ticket/1336
comment:5 by , on Dec 10, 2010 at 8:20:00 AM
In fact the alignment of structure have been fixed for the next beta/release.
X64 is now working correctly, compatible with X86.
new types have been added
STRUCT The following datatypes will be align according to C declaration rules. See below. ENDSTRUCT end of the collection datatypes. Padding can occurs see below.
I think the problem will be closed with the next delivery
comment:6 by , on May 23, 2011 at 6:45:41 PM
| Component: | AutoIt → Standard UDFs |
|---|---|
| Owner: | set to |
comment:7 by , on May 24, 2011 at 9:44:47 PM
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:8 by , on May 24, 2011 at 9:44:53 PM
| Component: | Standard UDFs → AutoIt |
|---|
comment:9 by , on May 25, 2011 at 7:51:05 PM
| Resolution: | → Fixed |
|---|---|
| Status: | assigned → closed |
Assuming this has been fixed with dllstruct changes in 3.3.7.2
comment:11 by , on Feb 9, 2012 at 3:23:04 PM
| Milestone: | Future Release → 3.3.7.2 |
|---|
comment:12 by , on Jul 21, 2017 at 12:38:21 PM
64bit system is _GUICtrlListView_GetItemText not working currently i am using Autoit3.3.14.2 please help me
comment:13 by , on Jul 25, 2017 at 10:12:14 PM
santhosh2cse:
Go to the forum for this type of question, this isn't a tech support site, it's a bug report site.

test program with log message