Here's my code (please ignore my 'try' statement, I know..):
wchar_t *zGetName(DWORD kPid)
{
if (!kPid)
return NULL;
PROCESSENTRY32W kPE32;
HANDLE kSnap;
kPE32.dwSize = sizeof(PROCESSENTRY32W);
kSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (!kSnap)
return NULL;
if (Process32FirstW(kSnap, &kPE32))
{
do {
if (kPE32.th32ProcessID == kPid)
{
wchar_t *kExe = kPE32.szExeFile;
CloseHandle(kSnap);
return kExe;
}
} while (Process32NextW(kSnap, &kPE32));
}
CloseHandle(kSnap);
return NULL;
}
int main()
{
try
{
SetConsoleTitleW(L"BruteID");
std::cout << R"(Press any key to start scanning for process IDs. . .)";
getchar();
DWORD kFirst = 0x0;
int64_t kCount = 0;
for (kFirst; kFirst < 10000; ++kFirst)
{
kCount++;
wchar_t *kName = zGetName(kFirst);
if (kName != 0)
{
std::cout << "{" << __TIME__ << "} " << "The process ID " << kFirst << " belongs to the process ";
_tprintf(TEXT("%s"), kName);
std::cout << "\n";
zSetConsole(kCount);
}
else
zSetConsole(kCount);
}
}
catch (...) {}
getchar();
}
Basically I am trying to check all the process IDs with an extremely simple 'for' loop and get the names of those that exist, but instead of the text I am getting something like 0D45FBA, etc.
I tried a lot of things and this code is just the last thing that I tried without success, I am looking for help.
Also tried to chance from UNICODE to Multi-Byte and vice-versa and many other things.
Aucun commentaire:
Enregistrer un commentaire