📄 frmmain.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmMain
BorderStyle = 3 'Fixed Dialog
Caption = "DLL注入 for X论坛"
ClientHeight = 1770
ClientLeft = 45
ClientTop = 435
ClientWidth = 4935
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1770
ScaleWidth = 4935
StartUpPosition = 2 '屏幕中心
Begin MSComDlg.CommonDialog cdlg1
Left = 4080
Top = 720
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton btnUnloadDll
Caption = "卸载(&U)"
Height = 350
Left = 1800
TabIndex = 6
Top = 1200
Width = 1200
End
Begin VB.CommandButton btnLoadDll
Caption = "注入(&L)"
Height = 350
Left = 240
TabIndex = 5
Top = 1200
Width = 1200
End
Begin VB.TextBox edtProcessId
Height = 300
Left = 1800
TabIndex = 4
Text = "0"
Top = 650
Width = 2100
End
Begin VB.CommandButton btnChooseDLL
Caption = "选择(&B)"
Height = 300
Left = 3900
TabIndex = 2
Top = 200
Width = 975
End
Begin VB.TextBox edtDLLFileName
Height = 300
Left = 1800
Locked = -1 'True
TabIndex = 1
Top = 200
Width = 2100
End
Begin VB.Label Label3
Alignment = 2 'Center
Caption = "编程小猪"
Height = 250
Left = 3300
TabIndex = 7
Top = 1360
Width = 1575
End
Begin VB.Label Label2
Alignment = 1 'Right Justify
Caption = "注入进程的ID(&P):"
Height = 250
Left = 120
TabIndex = 3
Top = 720
Width = 1650
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
Caption = "用来注入的DLL(&D):"
Height = 250
Left = 120
TabIndex = 0
Top = 240
Width = 1650
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'单击“先择”
Private Sub btnChooseDLL_Click()
'使用Common Dialog获取一个DLL文件路径
With cdlg1
.FileName = "" '初始化FileName属性为空字符串
.Flags = &H4 '不显示“以只读方式打开”选项
.Filter = "DLL文件(*.dll)|*.dll" '设置过滤器为DLL文件
.ShowOpen '显示对话框
If .FileName <> "" Then edtDLLFileName.Text = .FileName '如果FileName属性不为空字符串,就设置文本框的置为DLL文件路径
End With
End Sub
'单击“注入”
Private Sub btnLoadDll_Click()
On Error GoTo errHandle
If Trim(edtProcessId.Text) = "" Or Trim(edtDLLFileName.Text) = "" Then
MsgBox "请指定一个合适的DLL文件路径和运行中的进程ID值", vbInformation Or vbOKOnly, "提示"
Exit Sub
End If
'调用LoadDLL加载DLL
Call LoadDLL(CLng(edtProcessId.Text), edtDLLFileName.Text)
Exit Sub
errHandle:
MsgBox Err.Description, vbInformation Or vbOKOnly, "错误"
Err.Clear
End Sub
'单击“卸载”
Private Sub btnUnloadDll_Click()
On Error GoTo errHandle
If Trim(edtProcessId.Text) = "" Or Trim(edtDLLFileName.Text) = "" Then
MsgBox "请指定一个合适的DLL文件路径和运行中的进程ID值", vbInformation Or vbOKOnly, "提示"
Exit Sub
End If
'调用UnloadDLL卸载DLL
'如果DLL被加载多次,调用一次并不能成功卸载,因为系统为每个DLL设置了一个计数器,每加载一次,计数器的值会增加1
'而每卸载一次,计数器的值减少1,只有当计数器为0时,系统才会真正的卸载这个DLL
Call UnloadDLl(CLng(edtProcessId.Text), edtDLLFileName.Text)
Exit Sub
errHandle:
MsgBox Err.Description, vbInformation Or vbOKOnly, "错误"
Err.Clear
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -