NO

Author Topic: PARMAREA  (Read 1197 times)

Grincheux

  • Guest
PARMAREA
« on: April 27, 2021, 09:16:02 PM »
Can someone explain me how to use this?
I have read the help file and make what it says, I get false result

Code: [Select]
;   __________________________________________________________________________________
;   _______________________ CompareFunc ______________________________________________
;   __________________________________________________________________________________

                     ALIGN   16

CompareFunc               PROC   USES RDI,__lParam_1:LPARAM,__lParam_2:LPARAM,__lParamSort:LPARAM PARMAREA=4*QWORD
                     LOCAL   _Lv1:LVITEM
                     LOCAL   _Lv2:LVITEM
                     LOCAL   _szStr_1[256]:BYTE
                     LOCAL   _szStr_2[256]:BYTE
                     LOCAL   _dwNumber_1:DWORD
                     LOCAL   _dwNumber_2:DWORD
                     LOCAL   _lParamSort:QWORD

                     mov      [_lParamSort],r8                     ; _lParamSort = 928 SHOULD BE 8

                     mov      _Lv1.iItem,ecx                        ; RCX = 2
                     mov      _Lv1.iSubItem,r8d                  ; R8 = 8
                     mov      _Lv1.cchTextMax,256
                     mov      _Lv1._mask,LVIF_TEXT

                     mov      _Lv2.iItem,edx                       ; RDX = 3
                     mov      _Lv2.iSubItem,r8d                 ; R8 = 8
                     mov      _Lv2.cchTextMax,256
                     mov      _Lv2._mask,LVIF_TEXT

                     lea      rax,_szStr_1
                     lea      rcx,_szStr_2

                     mov      _Lv1.pszText,rax
                     mov      _Lv2.pszText,rcx

                     mov      rcx,[hWndMain + rip]
                     mov      edx,IDC_LISTVIEW_01
                     call   GetDlgItem

                     mov      rdi,rax

                     mov      rcx,rax
                     mov      edx,LVM_GETITEMTEXT
                     mov      r8d,_Lv1.iItem
                     lea      r9,_Lv1
                     call   SendMessageA

                     mov      rcx,rdi
                     mov      edx,LVM_GETITEMTEXT
                     mov      r8d,_Lv2.iItem
                     lea      r9,_Lv2
                     call   SendMessageA

                     cmp      _lParamSort,8
                     jge      @Compare

                     lea      rcx,_szStr_1
                     call   Ascii2QWord
                     mov      _dwNumber_1,eax

                     mov      rcx,SIZEOF _szStr_1
                     lea      rdx,_szStr_1
                     mov      r8,OFFSET szFmt_03
                     mov      r9d,eax
                     call   sqlite3_snprintf

                     lea      rcx,_szStr_2
                     call   Ascii2QWord
                     mov      _dwNumber_2,eax

                     mov      rcx,SIZEOF _szStr_2
                     lea      rdx,_szStr_2
                     mov      r8,OFFSET szFmt_03
                     mov      r9d,eax
                     mov      rax,OFFSET @Compare
                     push   rax
                     jmp      sqlite3_snprintf

                     ALIGN   16
@Compare :
                     lea      rcx,_szStr_1
                     lea      rdx,_szStr_2
                     call   lstrcmpA

                     ret
CompareFunc               ENDP
Thanks
« Last Edit: April 27, 2021, 09:18:17 PM by Grincheux »

Offline John Z

  • Member
  • *
  • Posts: 790
Re: PARMAREA
« Reply #1 on: April 29, 2021, 03:41:10 PM »
Might help others to help you if you also include the parameter values you are passing to the code.  Might clarify "false result" - do you mean the sort is not performed correctly?

Wish I could be more help but it has been many years since I did assembly.  Think 286/386 timeframe....


John Z

Grincheux

  • Guest
Re: PARMAREA
« Reply #2 on: April 29, 2021, 03:47:33 PM »
I have found. PARMAREA was not the problem and it runs like the doc says.
The problem was ME:Use RDI without saving, passing the wrong paramter size...
Trying to sort hex numbers in conerting them to decimal rather than hexa...
I am very tired!