⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 runexe.asm

📁 masm32编写的运行外部exe程序的例子
💻 ASM
字号:
; #########################################################################

      .386
      .model flat, stdcall
      option casemap :none   ; case sensitive

; #########################################################################

      include \masm32\include\windows.inc
      include \masm32\include\user32.inc
      include \masm32\include\kernel32.inc

      includelib \masm32\lib\user32.lib
      includelib \masm32\lib\kernel32.lib

; #########################################################################
MY_STRUCT STRUCT
    Item1 dd  ?
    Item2 dd  ?
    Item3 db  16 dup(?)
MY_STRUCT ENDS


.DATA
    cStartChar db '"'
    Er_msg_loaddll db "程序运行时出现错误!",0
    Er_msg_getfunc db "get function address ok!",0
    
    Ok_msg_loaddll db "load dll ok",0
    Ok_msg_getfunc db "get function address error !",0
    
.data?
    szBuffer     db  128 dup(?)
    szCommandLine dd ?

.code

start:
    invoke GetCommandLine
    mov szCommandLine, eax
    mov al,[eax]
    .if al == cStartChar
    ; Program run in windows Explorer, the command line string like {"run.exe" -param }

    .else
    ; Program run in shell (console window) ,the command line string like { run -param }

    .endif
    
    ;invoke WinExec,addr szFileName,SW_SHOWNORMAL

    ; --------------------------------------------------------
    ; The following are the same function calls using MASM
    ; "invoke" syntax. It is clearer code, it is type checked
    ; against a function prototype and it is less error prone.
    ; --------------------------------------------------------

    invoke MessageBox, 0, szCommandLine, 0, MB_OK

    invoke ExitProcess, 0

end start

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -