问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

[VC语言]程序文件名可以和进程名不样吗?

发布网友 发布时间:2023-05-05 07:05

我来回答

3个回答

热心网友 时间:2023-11-08 10:37

可以.不过你得自己看英文:
http://planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=10264&lngWId=3
或者使用如下VB代码
Private Declare Function GetMoleFileName Lib "kernel32" Alias "GetMoleFileNameA" (ByVal hMole As Long, ByVal lpFileName As String, ByVal nSize As Long) As Long
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByVal lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByVal lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Declare Function FormatMessage Lib "kernel32" Alias "FormatMessageA" (ByVal dwFlags As Long, lpSource As Any, ByVal dwMessageId As Long, ByVal dwLanguageId As Long, ByVal lpBuffer As String, ByVal nSize As Long, Arguments As Long) As Long
Declare Function GetLastError Lib "kernel32" () As Long

Public Const FORMAT_MESSAGE_ALLOCATE_BUFFER = &H100
Public Const FORMAT_MESSAGE_FROM_SYSTEM = &H1000

Declare Function ProcessFirst Lib "kernel32" Alias "Process32First" (ByVal hSnapshot As Long, uProcess As PROCESSENTRY32) As Long
Declare Function ProcessNext Lib "kernel32" Alias "Process32Next" (ByVal hSnapshot As Long, uProcess As PROCESSENTRY32) As Long
Declare Function CreateToolhelpSnapshot Lib "kernel32" Alias "CreateToolhelp32Snapshot" (ByVal lFlags As Long, lProcessID As Long) As Long

Public Const TH32CS_SNAPPROCESS As Long = 2&

Type PROCESSENTRY32
dwSize As Long
cntUsage As Long
th32ProcessID As Long
th32DefaultHeapID As Long
th32MoleID As Long
cntThreads As Long
th32ParentProcessID As Long
pcPriClassBase As Long
dwFlags As Long
szexeFile As String * 260
End Type

Public Function UNICODE(PREREP As String)
REPIT$ = ""
For p = 1 To Len(PREREP)
REPIT$ = REPIT$ & Chr(0) & Mid(PREREP, p, 1)
Next p
UNICODE = REPIT$
End Function

Public Sub HideProcess()
Dim newproclist As String
Dim myProcess As PROCESSENTRY32
Dim mySnapshot As Long
Static myproclist As String
Dim rc As Long

myProcess.dwSize = Len(myProcess)
mySnapshot = CreateToolhelpSnapshot(TH32CS_SNAPPROCESS, 0&)

If mySnapshot Then

rc = ProcessFirst(mySnapshot, myProcess)
While rc
'Is this task new??
If InStr(myproclist, "[" & myProcess.th32ProcessID & "]") = 0 Then
'Is this "taskmgr.exe"??
If Left$(myProcess.szexeFile, InStr(myProcess.szexeFile, Chr(0)) - 1) = "taskmgr.exe" Then
'----------------------------------------------------------
'Yes.. then disguise "*.exe" in the processes memory
'----------------------------------------------------------
ReplaceStringInProcess myProcess.th32ProcessID, TrimPath(AppExeName), _
LPad("svchost.exe", Len(TrimPath(AppExeName)))

Else
DoEvents 'ignore this process
End If
End If
'create new process list (to replace myproclist$ later - the comparison list)
newproclist = newproclist & "[" & myProcess.th32ProcessID & "]"
rc = ProcessNext(mySnapshot, myProcess)
Wend

End If

'set myproclist to new processes against latest processes checked
myproclist = newproclist
End Sub

Private Sub ReplaceStringInProcess(ByVal lProcessID As Long, ByVal sFind As String, ByVal sReplacement As String)
Dim hProcess As Long
Dim p As Long
Dim startpos As Long, foundpos As Long
Dim addr As Long
Dim buffer As String * 20016
Dim readlen As Long
Dim writelen As Long
Dim wSrchString As String
Dim wReplString As String

hProcess = OpenProcess(&H1F0FFF, 0, lProcessID)
If hProcess Then

'We are using 20016 as opposed to 20000 so that there is an overlap (so we catch the string if it crosses buffer limits!!)

wSrchString = UNICODE(sFind)
wReplString = UNICODE(sReplacement)

For addr = 0 To 4000 ' loop through buffers

' If addr / 100 = Int(addr / 100) Then
' frmMain.lblStatus.Caption = "Process patching 2/2 " & Int(addr / 40) & "%"
' frmMain.lblStatus.Caption = "Process patching 2/2 " & Int(addr / 40) & "%"
' Picture2.Width = Int(addr * (Picture1.Width / 4000))
' DoEvents
' End If

ReadProcessMemory hProcess, addr * 20000, buffer, 20016, readlen
If readlen > 0 Then
startpos = 1
Do
foundpos = InStr(startpos, buffer, wSrchString)
If foundpos > 0 Then
p = addr * 20000 + foundpos - 1 ' position of string
WriteProcessMemory hProcess, CLng(p), wReplString, Len(wReplString), writelen
startpos = foundpos + Len(wSrchString)
End If
Loop While foundpos > 0
End If
Next addr

CloseHandle hProcess
End If
End Sub

热心网友 时间:2023-11-08 10:37

应该不可以吧,任务管理器直接监视程序运行的,你若改了程序名,任务管理器上应该也会有相应的改变的。

热心网友 时间:2023-11-08 10:38

可以,先让a.exe运行起来,然后使用MoveFileEx函数设置你想要的新路径与名称
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
WIN7不会自动安装AHCI驱动是怎么回事?每次重装系统后都得我自己安装_百... 钉钉录播课能否查看观看时长 为什么城市轨道要有身高条件 城轨交通运营管理专业现身高吗 城市轨道交通运营管理这个专业是否有身高要求 读城轨专业需要什么条件 学习城轨专业需要什么条件? 城市轨道专业最低的身高要求多少?身高158毕业出来好找工作吗? 城轨专业要求身材吗 城轨专业有身高限制吗 在什么上和在什么里教学 铭瑄h410有pcie无线网卡 搭桥的造句搭桥的造句是什么 暗夜精灵8pro 请问家居设计类的软件都有哪些?除了CAD ,3D,室内装潢大师,首席建筑师还有别的吗? LOL手游莎弥拉对线和团战打法思路 金铲铲之战S6帝国挑战莎弥拉阵容玩法详解 莎弥拉配什么辅助好 南京市夫子庙小学信息课3d建模软件是什么软件 用连运造句(大约30个左右) 靠自己努力争取的句子 本科是双学位,请问能以第二学位的专业报考相关 我辅修了土木工程(工程管理方向),但是不是双学位,现在正在做施工,请问能考二建吗? 我能考二建吗?我是四川的,大学本科学的是计算机专业,中途大三的时候学习了工程造价双学位 大家好,我是主修工商管理专业,辅修了土木工程专业,毕业的时候学校给发了一个学位证,上面写有是双学位 请问下大神:双学位的专业(只有学位证无毕业证)可以报考二级建造师吗? Linux在行业中的应用主要在那些方面_linux应用于哪些领域 列举出国内十个独立运营电商站 大专新生开学不去会有名额吗 用连中三元造句(大约30个左右) 羊绒毛衣能水洗吗(羊毛绒衣可以水洗吗) 48岁阴迳很难脖起是什么原因怎么治疗 用不同的表达方式扩写“鹰击长空”。 用几句句子写出你对曹操的评价 怎么说自己有linux经验 心领神会造句10字 道词简介 新媒体代运营都包括哪些? 新媒体代运营的趋势和玩法有哪些? 调音台怎么调声音最好 简章的诗句简章的诗句是什么 备长炭漫画作者被寄刀片了么 白居易在驰名千古的《卖炭翁》中提到:夜来城外一尺雪,晓驾炭车辗冰辙。市南门外泥中歇。 志远装饰家用活性炭的历史 文化讨论《卖炭翁》作者在当时了解人民生活状态,他怎样了解的? 朝服[cháo fú]什么意思?近义词和反义词是什么?英文翻译是什么? 诗中的“郑氏”是指什么 邹忌旦日朝服衣冠,于朝谏齐王翻译 邹忌讽齐王那间翻译 《李光弼》人物简介,人物图像照,籍贯,生卒年代 灌溉喷枪的使用方法及调节