Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .486
- .model flat, stdcall
- option casemap:none ; case sensitive
- ; ####################################################
- include windows.inc
- include user32.inc
- include kernel32.inc
- include comdlg32.inc
- ;include advapi32.inc
- ;include masm32.inc
- includelib user32.lib
- includelib kernel32.lib
- includelib comdlg32.lib
- ;includelib advapi32.lib
- ;includelib masm32.lib
- ; ####################################################
- .DATA
- dddd db "03/12/2016 20:15:30", 0
- eeee db "23/11/2015 21:05:32", 0
- ffff db "03/12/2016 20:15:30", 0
- fffg db "03/12/2016 20:15:31", 0
- .CODE
- ;
- ; accepts two date strings in format "23/11/2016 20:15:30"
- ;
- ; returns -1 if first comes before second, 0 if equal, 1 if second comes before first
- ; just like sorting function for list items needs
- ;
- CompareDate proc uses esi edi date1:DWORD, date2:DWORD
- mov esi, date1
- mov edi, date2
- mov cl, byte ptr [esi+6]
- cmp cl, byte ptr [edi+6]
- jb @exit1
- ja @exitm1
- mov cl, byte ptr [esi+7]
- cmp cl, byte ptr [edi+7]
- jb @exit1
- ja @exitm1
- mov cl, byte ptr [esi+8]
- cmp cl, byte ptr [edi+8]
- jb @exit1
- ja @exitm1
- mov cl, byte ptr [esi+9]
- cmp cl, byte ptr [edi+9]
- jb @exit1
- ja @exitm1
- mov cl, byte ptr [esi+3]
- cmp cl, byte ptr [edi+3]
- jb @exit1
- ja @exitm1
- mov cl, byte ptr [esi+4]
- cmp cl, byte ptr [edi+4]
- jb @exit1
- ja @exitm1
- mov cl, byte ptr [esi+0]
- cmp cl, byte ptr [edi+0]
- jb @exit1
- ja @exitm1
- mov cl, byte ptr [esi+1]
- cmp cl, byte ptr [edi+1]
- jb @exit1
- ja @exitm1
- mov cl, byte ptr [esi+0Bh]
- cmp cl, byte ptr [edi+0Bh]
- jb @exit1
- ja @exitm1
- mov cl, byte ptr [esi+0Ch]
- cmp cl, byte ptr [edi+0Ch]
- jb @exit1
- ja @exitm1
- mov cl, byte ptr [esi+0Eh]
- cmp cl, byte ptr [edi+0Eh]
- jb @exit1
- ja @exitm1
- mov cl, byte ptr [esi+0Fh]
- cmp cl, byte ptr [edi+0Fh]
- jb @exit1
- ja @exitm1
- mov cl, byte ptr [esi+11h]
- cmp cl, byte ptr [edi+11h]
- jb @exit1
- ja @exitm1
- mov cl, byte ptr [esi+12h]
- cmp cl, byte ptr [edi+12h]
- jb @exit1
- ja @exitm1
- mov eax, 0
- ret
- @exitm1:
- mov eax, -1
- ret
- @exit1:
- mov eax, 1
- ret
- CompareDate endp
- start:
- ; just a few tests
- invoke CompareDate, offset dddd, offset eeee
- invoke CompareDate, offset eeee, offset ffff
- invoke CompareDate, offset dddd, offset ffff
- invoke CompareDate, offset fffg, offset ffff
- invoke ExitProcess, 0
- end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement