News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Cute toy to run files and apps on a network box.

Started by hutch--, December 29, 2021, 12:56:19 PM

Previous topic - Next topic

hutch--

Elegant in its simplicity, if it fits in half a screen, it has to be OK.  :tongue:

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    include \masm32\include64\masm64rt.inc

    .data?
      hInstance dq ?

    .data
      ffilter db "All Files",0,"*.*",0,0            ; the file filter string
      pfilt dq ffilter                              ; pointer to filter string
      pName dq 0                                    ; pointer for retrieved filename
    .code

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

entry_point proc

    mov hInstance, rvcall(GetModuleHandle,0)

    invoke open_file_dialog,0,hInstance, \          ; file dialog
           "Select file to open",pfilt
    mov pName, rax                                  ; store the file data address
    cmp BYTE PTR [rax], 0                           ; test if its a zero (0)
    je @F                                           ; bypass action if zero
    invoke ShellExecute,0,"open",pName,0,0,SW_SHOW  ; try ShellExecute to run different file types
    .if rax { 33                                    ; if error
      exec pName                                    ; run CreateProcess()
    .endif
  @@:

    .exit

entry_point endp

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    end

hutch--

If you have your LAN set up correctly and share at least one partition, you can start this toy and enter the computer name in the form "\\MyBox", hit enter and you can navigate the shared partition or folder and run files in that folder.