Modify

#1816 closed Bug (Fixed)

_GUICtrlListView_GetItemText not properly work on Windows 7 x 64

Reported by: ospavel@… 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)

shexview_with_image.zip (104.3 KB ) - added by ospavel@… on Nov 17, 2010 at 7:24:21 AM.
test program with log message

Download all attachments as: .zip

Change History (14)

by ospavel@…, on Nov 17, 2010 at 7:24:21 AM

Attachment: shexview_with_image.zip added

test program with log message

comment:1 by ospavel@…, 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 ospavel@…, 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 ospavel@…, 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 Zedna, 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 Jpm, 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 Jon, on May 23, 2011 at 6:45:41 PM

Component: AutoItStandard UDFs
Owner: set to Gary

comment:7 by Jon, on May 24, 2011 at 9:44:47 PM

Owner: changed from Gary to Jon
Status: newassigned

comment:8 by Jon, on May 24, 2011 at 9:44:53 PM

Component: Standard UDFsAutoIt

comment:9 by Jon, on May 25, 2011 at 7:51:05 PM

Resolution: Fixed
Status: assignedclosed

Assuming this has been fixed with dllstruct changes in 3.3.7.2

comment:10 by TicketCleanup, on May 25, 2011 at 9:00:01 PM

Milestone: Future Release

Automatic ticket cleanup.

comment:11 by Jpm, on Feb 9, 2012 at 3:23:04 PM

Milestone: Future Release3.3.7.2

comment:12 by santhosh2cse@…, 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 BrewManNH, 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.

Modify Ticket

Action
as closed The owner will remain Jon.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.