1 Attachment(s)
[RESOLVED] Problem with LVM_GETITEM and 64-bit OS, please help
I use the following code (original post by Bonnie West: https://www.vbforums.com/showthread....Clone-ListView) to get the Item from an external ListView. It works fine on Windows 7 32-bit (Unicode & ANSI), but on 64-bit System there is no return result, if ListView is Unicode (With ListView ANSI it is OK).
I searched for the solution on Google and found it here: https://forum.sources.ru/index.php?showtopic=406899 (by The trick).
However I don't know how to use the NtWow64WriteVirtualMemory64 function for my code.
Can someone please help me with this problem?
Best regards,
FerrMask
Re: Problem with LVM_GETITEM and 64-bit process, please help
is it a 64 bit process or just a 64bit OS?
This one should be working for 64bit OS Im not sure if I ever tried 64bit target process
https://github.com/dzzie/libs/blob/m...icate.bas#L205
also make sure the OpenProcess call is returning success. May have to run as admin
Re: Problem with LVM_GETITEM and 64-bit process, please help
Quote:
Originally Posted by
dz32
is it a 64 bit process or just a 64bit OS?
This one should be working for 64bit OS Im not sure if I ever tried 64bit target process
https://github.com/dzzie/libs/blob/m...icate.bas#L205
also make sure the OpenProcess call is returning success. May have to run as admin
Sorry dz32, I didn't make my problem clear. My code works on 64-bit Systems, however it only retrieves ListView ANSI Items, and ListView Unicode just empty strings.
Thank you very much for sharing.
Best regards,
FerrMask
Re: Problem with LVM_GETITEM and 64-bit OS, please help
You need to use 64-bit structures instead 32-bit ones for a 64-bit process:
Code:
Private Type HDITEM64
Mask As Long
cxy As Long
pszText As Currency
hbm As Currency
cchTextMax As Long
fmt As Long
lParam As Currency
iImage As Long
iOrder As Long
type As Long
lPad As Long
pvFilter As Currency
state As Long
End Type
Private Type LVITEM64
Mask As Long
iItem As Long
iSubItem As Long
state As Long
StateMask As Long
lPad As Long
pszText As Currency
cchTextMax As Long
iImage As Long
lParam As Currency
iIndent As Long
iGroupId As Long
cColumns As Long
lPad2 As Long
puColumns As Currency
piColFmt As Currency
iGroup As Long
End Type
Currency = a pointer. Don't forget to translate Long->Currency, for example:
Code:
PutMem4 tHDI.pszText, lngBuffer
1 Attachment(s)
Re: Problem with LVM_GETITEM and 64-bit OS, please help
Quote:
Originally Posted by
The trick
You need to use 64-bit structures instead 32-bit ones for a 64-bit process...
Thanks The trick, I tried using the 64-bit structures, but the result is still the same, besides, the application containing the ListView window is closed when executing the code.
Could you please check the code that I have attached?
Best regards,
FerrMask
Re: Problem with LVM_GETITEM and 64-bit OS, please help
You have 2 errors.
Code:
PutMem4 tHDI.pszText, ByVal lngBuffer
PutMem4 tLVI.pszText, ByVal lngBuffer
Code:
ReadProcessMemory(lngProcess, lngBuffer, ByVal StrPtr(strColumns(lngCol)), tHDI.cchTextMax - 2, lngRet)
ReadProcessMemory(lngProcess, lngBuffer, ByVal StrPtr(strItems(lngRow, lngCol)), tLVI.cchTextMax - 2, lngRet)
Re: Problem with LVM_GETITEM and 64-bit OS, please help
Quote:
Originally Posted by
The trick
You have 2 errors...
Problem solved.
Thanks for the help!
Best regards,
FerrMask