Results 1 to 7 of 7

Thread: [RESOLVED] Problem with LVM_GETITEM and 64-bit OS, please help

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2018
    Posts
    51

    Resolved [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
    Attached Files Attached Files
    Last edited by ferrmask; Sep 23rd, 2021 at 07:52 PM.

  2. #2
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,296

    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
    Last edited by dz32; Sep 22nd, 2021 at 07:06 AM.

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2018
    Posts
    51

    Re: Problem with LVM_GETITEM and 64-bit process, please help

    Quote Originally Posted by dz32 View Post
    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

  4. #4
    PowerPoster
    Join Date
    Feb 2015
    Posts
    2,797

    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

  5. #5

    Thread Starter
    Member
    Join Date
    Dec 2018
    Posts
    51

    Re: Problem with LVM_GETITEM and 64-bit OS, please help

    Quote Originally Posted by The trick View Post
    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
    Attached Files Attached Files
    Last edited by ferrmask; Sep 22nd, 2021 at 11:08 PM.

  6. #6

  7. #7

    Thread Starter
    Member
    Join Date
    Dec 2018
    Posts
    51

    Re: Problem with LVM_GETITEM and 64-bit OS, please help

    Quote Originally Posted by The trick View Post
    You have 2 errors...
    Problem solved.
    Thanks for the help!

    Best regards,
    FerrMask
    Last edited by ferrmask; Sep 23rd, 2021 at 07:52 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width