Fehler "Zugriffsverletzung" beim Versuch, das ModuleEntry32 :: Modbaseaddr -Feld aus der TLHELP32.H -Bibliothek zu druckC++

Programme in C++. Entwicklerforum
Anonymous
 Fehler "Zugriffsverletzung" beim Versuch, das ModuleEntry32 :: Modbaseaddr -Feld aus der TLHELP32.H -Bibliothek zu druck

Post by Anonymous »

Ich versuche, diesen Code zu funktionieren: < /p>

Code: Select all

#include  // For general input and output
#include  // Windows API for interacting with windows processes
#include  // For getting snapshots

int main()
{
/*
Get the process ID to attach later
*/

DWORD gameProcID = -1; // Variable to hold the process ID, has to be a DWORD because the windows API wants it that way. Starts as -1 (which is invald) so it is known if the process wasn't found
HANDLE procSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS , 0); // Creates a "snapshot" of the current processes (Essentially a list of the processes)

// Creates a placeholder process entry, that will hold each process for checking
PROCESSENTRY32 currentProc;
currentProc.dwSize = sizeof(PROCESSENTRY32); // Has to have it's "sizeof" member set, or else the loop fails.

// Loops through each process in the snapshot until it finds Winquake.exe
if (Process32First(procSnap, &currentProc)) { // Starts by getting the first process
do {
if (!_wcsicmp(currentProc.szExeFile, L"Winquake.exe")) { // Checks if the process is Winquake, using a Wide Character String Compare function
// If found, update the variable and break out the loop
gameProcID = currentProc.th32ProcessID;
break;
}
} while (Process32Next(procSnap, &currentProc)); // While there are still more processes, keep checking
}
CloseHandle(procSnap); // Close the snapshot. Good memory management :)

// If it can't find the process, print and then close
if (gameProcID == -1) {
std::cout

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post