04.09.2013, 23:44. Просмотров 454. Ответов 0
Добрый день. Имеется некоторый код. Он должен запускать определенный процесс с параметрами и подгружать нужные .dll. Все вроде бы хорошо, но почему-то постоянно ошибка "Failed to Create Process". В чем проблема, ребят?
Консоль показывает следующее:
'samplauncher.exe': Loaded 'C:\Users\Dmitriy\Documents\Visual Studio 2010\Projects\samplauncher\Release\samplauncher.exe', Symbols loaded.
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\msvcp100.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\msvcr100.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\apphelp.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\Windows\AppPatch\AcLayers.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\shell32.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\shlwapi.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\userenv.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\profapi.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\winspool.drv', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\mpr.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\ProgramData\VKSaver\vksaver3.dll', Binary was not built with debug information.
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\uxtheme.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'D:\Program Files (x86)\Fraps\fraps32.dll', Binary was not built with debug information.
'samplauncher.exe': Loaded 'D:\Program Files (x86)\RocketDock\RocketDock.dll', Binary was not built with debug information.
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\psapi.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file
'samplauncher.exe': Loaded 'C:\Windows\SysWOW64\clbcatq.dll', Cannot find or open the PDB file
The program '[7628] samplauncher.exe: Native' has exited with code 0 (0x0).
Программа при этом компилируется без ошибок, но процесс нужный она не запускает, выдавая сообщение о том, что "Failed to Create Process". Вот код программы:
C++ | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
| #include <windows.h>
#include <string>
using namespace std;
BOOL Inject(DWORD pId, LPSTR dllName)
{
HANDLE h = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pId);
if(h)
{
LPVOID LoadLibAddr = (LPVOID)GetProcAddress(GetModuleHandleA("kernel32.dll"), "LoadLibraryA");
LPVOID dereercomp = VirtualAllocEx(h, NULL, strlen(dllName), MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
WriteProcessMemory(h, dereercomp, dllName, strlen(dllName), NULL);
HANDLE asdc = CreateRemoteThread(h, NULL, NULL, (LPTHREAD_START_ROUTINE)LoadLibAddr, dereercomp, 0, NULL);
WaitForSingleObject(asdc, INFINITE);
VirtualFreeEx(h, dereercomp, strlen(dllName), MEM_RELEASE);
CloseHandle(asdc);
CloseHandle(h);
return TRUE;
}
return FALSE;
}
void main()
{
string processName = "gta_sa.exe";
STARTUPINFO cif;
ZeroMemory(&cif,sizeof(STARTUPINFO));
PROCESS_INFORMATION pi;
if(CreateProcess(processName.c_str(), "-c -n NickName -h 127.0.0.1 -p 7777", NULL,NULL, FALSE, DETACHED_PROCESS | CREATE_SUSPENDED, NULL, NULL, &cif, &pi))
{
if(pi.hProcess!=NULL)
{
if(!Inject(pi.dwProcessId, "samp.dll"))
{
TerminateProcess(pi.hProcess, 0);
ExitProcess(0);
}
ResumeThread(pi.hThread);
}
} else MessageBox(NULL, "Failed to Create Process", "Error", MB_ICONERROR);
} |
|
P.S. имя темы получилось немного не правильным по невнимательности.
0
|