2012-08-15 81 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