【问题标题】:run another program from assembly language从汇编语言运行另一个程序
【发布时间】:2012-08-15 06:26:07
【问题描述】:

我目前正在 Windows 7 MASM32 中学习 x86 汇编语言,我想制作一个可以打开记事本的脚本。我在谷歌上看过,似乎找不到任何东西。我该怎么做?

任何帮助将不胜感激。

谢谢

【问题讨论】:

  • 一种方法是调用system 函数。
  • 你能告诉我怎么做吗?

标签: assembly x86 masm


【解决方案1】:

查看 CreateProcess 或 ShellExecute

push    offset proc_info        ;; lpProcessInformation
        push    offset startup_info     ;; lpStartupInfo
        push    offset new_dir          ;; lpCurrentDirectory
        push    00h             ;; lpEnviroment (get from calling process)
        push    00h             ;; dwCreatingFlags
        push    00h             ;; lpInheritHandles = FALSE
        push    00h             ;; lpThreadAttributes
        push    00h             ;; lpProcessAttributes (default process descriptor)
        push    offset params           ;; lpCommandLine =
        push    offset app          ;; lpApplicationName
                extrn    CreateProcessA: proc
        call    CreateProcessA

;; ...

proc_info:
pi_hProcess     dd      ?
pi_hThread      dd      ?
pi_dwProcessId      dd      ?
pi_dwThreadId       dd      ?
;;---------------------------------------------------------------
startup_info:
si_cb           dd      si_len
si_lpReserved       dd      0   ;; NULL
si_lpDesktop        dd      0   ;; NULL
si_lpTitle      dd      0   ;; NULL
si_dwX          dd      0
si_dwY          dd      0
si_dwXSize      dd      0
si_dwYSize      dd      0
si_XCountsChar      dd      0
si_YCountsChar      dd      0
si_dwFillAttribute           dd     0
si_dwFlags      dd      0  
si_wShowWindow      dw      0   ;; SW_HIDE
si_cbReserved2      dw      0
si_lpReserved2      dd      0   ;; NULL
si_hStdInput        dd      0   ;;
si_hStdOutput       dd      0   ;;   IGNORED
si_hStdError        dd      0   ;;
si_len          equ     $-startup_info

【讨论】:

  • 这会做什么?我看不出这是做什么的。
  • 别担心。现在说得通了。
猜你喜欢
  • 2016-09-27
  • 1970-01-01
  • 1970-01-01
  • 2014-10-07
  • 2014-12-26
  • 2012-01-19
  • 1970-01-01
相关资源
最近更新 更多