Modify

Opened 15 years ago

Closed 15 years ago

Last modified 9 years ago

#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@… 15 years ago.
test program with log message

Download all attachments as: .zip

Change History (14)

by ospavel@…, 15 years ago

Attachment: shexview_with_image.zip added

test program with log message

comment:1 by ospavel@…, 15 years ago

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@…, 15 years ago

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@…, 15 years ago

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, 15 years ago

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 J-Paul Mesnage, 15 years ago

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, 15 years ago

Component: AutoItStandard UDFs
Owner: set to Gary

comment:7 by Jon, 15 years ago

Owner: changed from Gary to Jon
Status: newassigned

comment:8 by Jon, 15 years ago

Component: Standard UDFsAutoIt

comment:9 by Jon, 15 years ago

Resolution: Fixed
Status: assignedclosed

Assuming this has been fixed with dllstruct changes in 3.3.7.2

comment:10 by TicketCleanup, 15 years ago

Milestone: Future Release

Automatic ticket cleanup.

comment:11 by J-Paul Mesnage, 14 years ago

Milestone: Future Release3.3.7.2

comment:12 by santhosh2cse@…, 9 years ago

64bit system is _GUICtrlListView_GetItemText not working currently i am using Autoit3.3.14.2 please help me

comment:13 by BrewManNH, 9 years ago

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.