У меня есть простая программа, которая не будет работать, и я все еще пытаюсь выяснить, что происходит.
Я пытаюсь вызвать процесс в Main dll.
Код ниже: < /p>
#include
#include
#include
DWORD WINAPI Main(LPVOID LParam) {
// Define STARTUPINFO and PROCESS_INFORMATION structures
STARTUPINFO si = { sizeof(STARTUPINFO) };
PROCESS_INFORMATION pi;
// Attempt to create the process
if (CreateProcess(
L"C:\\Users\\nee\\NotBackdoor\\Startup\\Main.exe", // Path to the executable
NULL, // Command line arguments (NULL to just execute the exe)
NULL, // Process security attributes
NULL, // Thread security attributes
FALSE, // Do not inherit handles
0, // No special creation flags
NULL, // Use the environment of the calling process
NULL, // Use the current directory
&si, // Pointer to the STARTUPINFO structure
&pi // Pointer to the PROCESS_INFORMATION structure
)) {
MessageBox(NULL, L"Process created successfully!", L"", MB_OK);
// Wait for the process to finish (optional)
WaitForSingleObject(pi.hProcess, INFINITE);
// Clean up the process and thread handles
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
else {
MessageBox(NULL, L"Process created unsuccessfully!!", L"", MB_OK);
}
return 69;
}
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
// Run the function in a new thread so the DLL can load properly without blocking
CreateThread(NULL, 0, Main, NULL, 0, NULL);
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
< /code>
ниже код ошибки: < /p>
---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Debug Assertion Failed!
Program: C:\Program Files\Google\Chrome\Application\chrome.exe
File: minkernel\crts\ucrt\src\appcrt\lowio\close.cpp
Line: 56
Expression: (_osfile(fh) & FOPEN)
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
---------------------------
Abort Retry Ignore
---------------------------
Код выше напечатает процесс создания процесса безуспешно по какой -то причине, и я не знаю, почему.
У меня есть простая программа, которая не будет работать, и я все еще пытаюсь выяснить, что происходит. Я пытаюсь вызвать процесс в Main dll. Код ниже: < /p> [code]#include #include #include
DWORD WINAPI Main(LPVOID LParam) { // Define STARTUPINFO and PROCESS_INFORMATION structures STARTUPINFO si = { sizeof(STARTUPINFO) }; PROCESS_INFORMATION pi;
// Attempt to create the process if (CreateProcess( L"C:\\Users\\nee\\NotBackdoor\\Startup\\Main.exe", // Path to the executable NULL, // Command line arguments (NULL to just execute the exe) NULL, // Process security attributes NULL, // Thread security attributes FALSE, // Do not inherit handles 0, // No special creation flags NULL, // Use the environment of the calling process NULL, // Use the current directory &si, // Pointer to the STARTUPINFO structure &pi // Pointer to the PROCESS_INFORMATION structure )) { MessageBox(NULL, L"Process created successfully!", L"", MB_OK);
// Wait for the process to finish (optional) WaitForSingleObject(pi.hProcess, INFINITE);
// Clean up the process and thread handles CloseHandle(pi.hProcess); CloseHandle(pi.hThread); } else { MessageBox(NULL, L"Process created unsuccessfully!!", L"", MB_OK); } return 69; }
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: // Run the function in a new thread so the DLL can load properly without blocking CreateThread(NULL, 0, Main, NULL, 0, NULL); break;
case DLL_THREAD_ATTACH: break;
case DLL_THREAD_DETACH: break;
case DLL_PROCESS_DETACH: break; }
return TRUE; } < /code> ниже код ошибки: < /p> --------------------------- Microsoft Visual C++ Runtime Library --------------------------- Debug Assertion Failed!
For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
--------------------------- Abort Retry Ignore --------------------------- [/code] Код выше напечатает процесс создания процесса безуспешно по какой -то причине, и я не знаю, почему.