- UID
- 1821
- 精华
- 积分
- 3247
- 威望
- 点
- 宅币
- 个
- 贡献
- 次
- 宅之契约
- 份
- 最后登录
- 1970-1-1
- 在线时间
- 小时
|
本帖最后由 Ayala 于 2021-2-11 23:21 编辑
- .686p
- .model flat,stdcall
- .nolist
- option casemap:none
- ;OPTION PROC:export
- include Strings.mac
- include windows.inc
- include user32.inc
- include kernel32.inc
- includelib user32.lib
- includelib kernel32.lib
- include msvcrt.inc
- includelib msvcrt.lib
- include ws2_32.inc
- includelib ws2_32.lib
- IDD_DLG1 EQU 1000
- IDC_EDT1 EQU 1001
- IDC_EDT2 EQU 1004
- IDC_EDT3 EQU 1003
- IDC_EDT4 EQU 1006
- IDC_EDT5 EQU 1008
- IDC_EDT6 EQU 1011
- IDC_EDT7 EQU 1012
- IDC_BTN1 EQU 1002
- IDC_BTN2 EQU 1009
- IDC_BTN3 EQU 1010
- .data
- C2cmd byte MAX_PATH dup(0)
- asmcmd byte MAX_PATH dup(0)
- asmpath byte MAX_PATH dup(0)
- incpath byte MAX_PATH dup(0)
- asmfile byte MAX_PATH dup(0)
- tagfile byte MAX_PATH dup(0)
- .code
- DlgBuildAsmCmd proc hDlg:HWND
- invoke crt_sprintf,offset asmcmd ,$CTA0("%s %s %s %s & pause"),offset asmpath,offset incpath,offset asmfile,offset tagfile
- invoke SetDlgItemText,hDlg,IDC_EDT5,offset asmcmd
- ret
- DlgBuildAsmCmd endp
- DlgInit proc hDlg:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
- invoke SetDlgItemText,hDlg,IDC_EDT1,offset C2cmd
- invoke SetDlgItemText,hDlg,IDC_EDT3,offset asmpath
- invoke SetDlgItemText,hDlg,IDC_EDT4,offset incpath
- invoke SetDlgItemText,hDlg,IDC_EDT6,offset asmfile
- invoke SetDlgItemText,hDlg,IDC_EDT7,offset tagfile
- invoke DlgBuildAsmCmd,hDlg
- ret
- DlgInit endp
- DlgCmd proc hDlg:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
- mov eax, wParam
- and eax,0ffffh
-
- .if eax == IDC_BTN1
- invoke GetDlgItemText,hDlg,IDC_EDT1,offset C2cmd,MAX_PATH
- invoke crt_system,offset C2cmd
-
- .elseif eax == IDC_BTN2
- invoke crt_system,offset asmcmd
- .elseif eax == IDC_BTN3
- invoke DlgBuildAsmCmd,hDlg
- .endif
-
- ret
- DlgCmd endp
- DlgProc proc hDlg:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
- mov eax, uMsg
- .if eax == WM_INITDIALOG
- invoke DlgInit, hDlg, uMsg, wParam, lParam
- mov eax,TRUE
- .elseif eax == WM_COMMAND
- invoke DlgCmd, hDlg, uMsg, wParam, lParam
- .elseif eax == WM_CLOSE
- invoke EndDialog, hDlg, 0
- mov eax,TRUE
-
- .else
- mov eax, FALSE
-
- .endif
-
- ret
- DlgProc endp
- _main proc
- invoke GetCommandLine
- invoke crt_sprintf,offset C2cmd ,$CTA0("org\\%s -Fa foo.asm"),eax
- invoke crt_sprintf,offset asmpath ,$CTA0("..\\masm32\\bin\\ML.EXE /c /coff /Cp /nologo")
- invoke crt_sprintf,offset incpath ,$CTA0("/I..\\masm32\\include\\ /I..\\masm32\\macros\")
- invoke crt_sprintf,offset asmfile ,$CTA0(".\\Module2\\Module2.asm")
- invoke crt_sprintf,offset tagfile ,$CTA0("-Fo.\\Module2.OBJ")
-
- invoke GetModuleHandle,NULL
- invoke DialogBoxParam,eax,IDD_DLG1,NULL,DlgProc,0
-
- ret
- _main endp
- end _main
复制代码
- #define IDD_DLG1 1000
- #define IDC_EDT1 1001
- #define IDC_BTN1 1002
- #define IDC_EDT2 1004
- #define IDC_EDT3 1003
- #define IDC_STC1 1005
- #define IDC_EDT4 1006
- #define IDC_STC2 1007
- #define IDC_EDT5 1008
- #define IDC_BTN2 1009
- #define IDC_BTN3 1010
- #define IDC_EDT6 1011
- #define IDC_EDT7 1012
- #define IDC_STC3 1013
- #define IDC_STC4 1014
- #include "../../../masm32/include/resource.h"
- IDD_DLG1 DIALOGEX 10,10,513,273
- CAPTION "IDD_DLG"
- FONT 8,"MS Sans Serif",0,0,0
- STYLE WS_VISIBLE|WS_OVERLAPPEDWINDOW
- BEGIN
- CONTROL "",IDC_EDT1,"Edit",WS_CHILDWINDOW|WS_VISIBLE|WS_VSCROLL|WS_TABSTOP|ES_MULTILINE,3,150,372,42,WS_EX_CLIENTEDGE
- CONTROL "编译源文件",IDC_BTN1,"Button",WS_CHILDWINDOW|WS_VISIBLE|WS_TABSTOP,387,150,123,42
- CONTROL "",IDC_EDT2,"Edit",WS_CHILDWINDOW|WS_VISIBLE|WS_TABSTOP,3,198,507,72,WS_EX_CLIENTEDGE
- CONTROL "",IDC_EDT3,"Edit",WS_CHILDWINDOW|WS_VISIBLE|WS_TABSTOP|ES_MULTILINE,3,3,369,24,WS_EX_CLIENTEDGE
- CONTROL "汇编编译器路径",IDC_STC1,"Static",WS_CHILDWINDOW|WS_VISIBLE|SS_CENTERIMAGE,384,6,114,21
- CONTROL "",IDC_EDT4,"Edit",WS_CHILDWINDOW|WS_VISIBLE|WS_VSCROLL|WS_TABSTOP|ES_MULTILINE,3,30,369,33,WS_EX_CLIENTEDGE
- CONTROL "头文件路径",IDC_STC2,"Static",WS_CHILDWINDOW|WS_VISIBLE|SS_CENTERIMAGE,384,36,114,21
- CONTROL "",IDC_EDT5,"Edit",WS_CHILDWINDOW|WS_VISIBLE|WS_VSCROLL|WS_TABSTOP|ES_MULTILINE,3,111,372,36,WS_EX_CLIENTEDGE
- CONTROL "编译asm",IDC_BTN2,"Button",WS_CHILDWINDOW|WS_VISIBLE|WS_TABSTOP,387,111,123,36
- CONTROL "重生成编译命令",IDC_BTN3,"Button",WS_CHILDWINDOW|WS_VISIBLE|WS_TABSTOP,387,84,93,21
- CONTROL "",IDC_EDT6,"Edit",WS_CHILDWINDOW|WS_VISIBLE|WS_VSCROLL|WS_TABSTOP|ES_MULTILINE,3,66,303,21,WS_EX_CLIENTEDGE
- CONTROL "",IDC_EDT7,"Edit",WS_CHILDWINDOW|WS_VISIBLE|WS_VSCROLL|WS_TABSTOP|ES_MULTILINE,3,87,303,21,WS_EX_CLIENTEDGE
- CONTROL "汇编源文件",IDC_STC3,"Static",WS_CHILDWINDOW|WS_VISIBLE,312,69,54,21
- CONTROL "目标文件",IDC_STC4,"Static",WS_CHILDWINDOW|WS_VISIBLE,312,90,54,21
- END
复制代码
测试代码
- '主窗体
- Private Sub Command1_Click()
- newthread "111111111111111"
- End Sub
- '模块2
- Public Function threadproc(ByVal p As Long)
- MsgBox "threadproc"
- End Function
- Public Function newthread(s As String)
- threadproc 0
- End Function
复制代码
- .686p
- .model flat,stdcall
- .nolist
- ;option casemap:none
- include Strings.mac
- include windows.inc
- include user32.inc
- include kernel32.inc
- includelib user32.lib
- includelib kernel32.lib
- includelib Vbaexe6.lib
- .code
- ?threadproc@Module2@@AAGXXZ proc syscall s
- invoke MessageBoxW,NULL,$CTW0("xxxx"),$CTW0("xxxx"),MB_OK
- ret
- ?threadproc@Module2@@AAGXXZ endp
- ?newthread@Module2@@AAGXXZ proc syscall a1,a2
-
- mov eax,a2
- mov eax,[eax]
- invoke MessageBoxW,NULL,$CTW0("1111"),eax,MB_OK
-
- invoke CreateThread,NULL,0,?threadproc@Module2@@AAGXXZ,0,0,0
-
- ret 8
- ?newthread@Module2@@AAGXXZ endp
- end
复制代码
c2.exe
(6 KB, 下载次数: 1)
vb目录里新建目录org,将原来c2房里,把这个换上
|
|