1
\$\begingroup\$

Hey I don't know why that when I compile this code that the fear.exe process is not running I am using visual studio for my coding ide choice the project is a win32 project // application method, that I am using..

I should say that I added a new item a c++ file called main.c++ and should I use the code file that Defines the entry point for the application. or does it matter.

#include "iostream"
#include "Windows.h"
#include "OVR_CAPI_D3D.h"
#include "Win32_DirectXAppUtil.h"
#include "stdio.h"
#include "string.h"
#include "Shlobj.h"
#include "Shlwapi.h"

using namespace std;

int WINAPI WinMain(HINSTANCE hinst, HINSTANCE, LPSTR, int)
{
    STARTUPINFO startinfo = { 0 };

    PROCESS_INFORMATION processinfo = { 0 };

    BOOL bsuccess = CreateProcess(TEXT("E:\SteamLibrary\steamapps\common\FEAR Ultimate Shooter Edition\FEAR.exe"), NULL, NULL, NULL, FALSE, NULL, NULL,
        NULL, &startinfo, &processinfo);

    if (bsuccess)
    {
        cout << "Process Injected" << endl
            << "Process ID:\t" << processinfo.dwProcessId << endl;

    }
    else
    {
            cout << "Error to start the injected process" << GetLastError() << endl;
        }
        cin.get();
        return(0);
    }
\$\endgroup\$
0

1 Answer 1

1
\$\begingroup\$

A single \ represents character escape sequence so you should replace "E:\SteamLibrary\steamapps\common\FEAR Ultimate Shooter Edition\FEAR.exe" with "E:\\SteamLibrary\\steamapps\\common\\FEAR Ultimate Shooter Edition\\FEAR.exe"

Also, you are using a hard-coded path, so if the path of FEAR.exe changes then CreateProcess will fail

\$\endgroup\$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.