2012-08-15 82 views
4

我在Windows 7 MASM32中学习x86汇编语言,我想创建一个可以打开记事本的脚本。我看过谷歌,似乎无法找到任何东西。我怎样才能做到这一点?从汇编语言运行另一个程序

任何帮助,将不胜感激。

感谢

+0

一种方法是调用'system'功能。 – huon 2012-08-15 06:30:51

+0

你能告诉我该怎么做? – Progrmr 2012-08-15 10:32:42

回答

2

看看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 
+0

这会做什么?我看不到这是什么。 – Progrmr 2012-08-15 10:30:41

+0

别担心。现在有道理。 – Progrmr 2012-08-15 10:47:35