Modify

Opened 14 years ago

Closed 14 years ago

Last modified 7 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@… 14 years ago.
test program with log message

Download all attachments as: .zip

Change History (14)

Changed 14 years ago by ospavel@…

test program with log message

comment:1 Changed 14 years ago by ospavel@…

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 Changed 14 years ago by ospavel@…

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 Changed 14 years ago by ospavel@…

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 Changed 14 years ago by Zedna

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 Changed 14 years ago by Jpm

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 Changed 14 years ago by Jon

  • Component changed from AutoIt to Standard UDFs
  • Owner set to Gary

comment:7 Changed 14 years ago by Jon

  • Owner changed from Gary to Jon
  • Status changed from new to assigned

comment:8 Changed 14 years ago by Jon

  • Component changed from Standard UDFs to AutoIt

comment:9 Changed 14 years ago by Jon

  • Resolution set to Fixed
  • Status changed from assigned to closed

Assuming this has been fixed with dllstruct changes in 3.3.7.2

comment:10 Changed 14 years ago by TicketCleanup

  • Milestone set to Future Release

Automatic ticket cleanup.

comment:11 Changed 13 years ago by Jpm

  • Milestone changed from Future Release to 3.3.7.2

comment:12 Changed 7 years ago by santhosh2cse@…

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

comment:13 Changed 7 years ago by BrewManNH

santhosh2cse:
Go to the forum for this type of question, this isn't a tech support site, it's a bug report site.

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.

Add Comment

Modify Ticket

Action
as closed The owner will remain Jon.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.