问题
For A.EXE PE file, if the program runs as test mode, I would like to change the process name to "A_TEST.exe".
And if the program runs as safe mode, I want to change to "A_SAFE.exe"
The file name must be same(A.EXE).
Is it possible?
回答1:
If "process name" is a name which shows Task Manager - you can change it only from ring0.
From ring3 you can only change a default window title.
#include <intrin.h>
PEB* peb = (PEB*)__readfsdword(0x30);
wchar_t newTitle[] = L"NewTitle";
UNICODE_STRING newTitleUStr = {sizeof(newTitle), sizeof(newTitle), newTitle};
peb->ProcessParameters->WindowTitle = newTitleUStr;
回答2:
As far as I know this isn't possible without changing the file name.
来源:https://stackoverflow.com/questions/3722852/changing-a-process-name-in-runtime