The MASM Forum

Members Gallery => Showcase => Topic started by: hutch-- on December 29, 2021, 12:56:19 PM

Title: Cute toy to run files and apps on a network box.
Post by: hutch-- on December 29, 2021, 12:56:19 PM
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
Title: Re: Cute toy to run files and apps on a network box.
Post by: hutch-- on December 31, 2021, 09:18:25 PM
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.