NO

Author Topic: Explorer refresher  (Read 370 times)

Offline Vortex

  • Member
  • *
  • Posts: 802
    • http://www.vortex.masmcode.com
Explorer refresher
« on: October 28, 2023, 11:27:36 AM »
A small tool to refresh the desktop and the other open windows :

Code: [Select]
include     RefreshExplorer.inc

.data

class       db 'SHELLDLL_DefView',0

.data?

buffer      db BUFF_SIZE dup(?)

.code

start:

    invoke  EnumWindows,ADDR EnumWndProc,\
            ADDR class

    invoke  ExitProcess,0

EnumWndProc PROC hWnd:DWORD,lParam:DWORD

    invoke  EnumChildWindows,hWnd,\
            ADDR EnumChildWndProc,0
           
    mov     eax,1
    ret

EnumWndProc ENDP


EnumChildWndProc PROC hWnd,lParam:DWORD

    invoke  GetClassName,hWnd,ADDR buffer,BUFF_SIZE
    invoke  szCmp,ADDR buffer,ADDR class
    test    eax,eax
    jz      @f

    invoke  SendMessage,hWnd,WM_COMMAND,\
            WM_REFRESH,0
           
    xor     eax,eax
    ret           
@@:   
    mov     eax,1
    ret

EnumChildWndProc ENDP


OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE

align 16

szCmp PROC str1:DWORD,str2:DWORD

  ; Function from the Masm32 package
  ; --------------------------------------
  ; scan zero terminated string for match
  ; --------------------------------------
    mov     ecx,[esp+4]
    mov     edx,[esp+8]

    push    ebx
    push    esi
    mov     eax,-1
    mov     esi,1

    align 4
   
cmst:

    REPEAT 3
   
    add     eax,esi
    movzx   ebx,BYTE PTR [ecx+eax]
    cmp     bl,[edx+eax]
    jne     no_match
    test    ebx,ebx       ; check for terminator
    je      retlen
   
    ENDM

    add     eax,esi
    movzx   ebx,BYTE PTR [ecx+eax]
    cmp     bl,[edx+eax]
    jne     no_match
    test    ebx,ebx       ; check for terminator
    jne     cmst

retlen:                   ; length is in EAX

    pop     esi
    pop     ebx
    retn    8

  no_match:
 
    xor     eax,eax       ; return zero on no match
    pop     esi
    pop     ebx
    retn    8

szCmp ENDP

OPTION PROLOGUE:PrologueDef
OPTION EPILOGUE:EpilogueDef

END start
Code it... That's all...