_execl() funcution on windows 10 platform to rename the process

Viewed 32

I am trying to rename the current running process name using c programming language but getting error here the code which I had done


#include <studio.h>
#include <stdlib.h>
#include <process.h>

Int main(int argc ,char *argv[])
{
_execl(argv[0],”newname.exe”,NULL);
}

While in Linux system it works properly Suppose file name is old.exe

When we open the terminal and hit command Ps -a We are able to see ./old is running

And right now I want to change the name and keep the same pid as before

The following changes are made in file name old.c


#include <studio.h>
#include <stdlib.h>
#include <unistd.h>

Int main(int argc ,char *argv[])
{
execl(argv[0],”./newname”,NULL);
While(1)
{
}
}

While above is is running then go to terminate and hit the command Ps -a You are able to see ./newname is running with the same process

So same I have to implement on windows

0 Answers
Related