Skip to content

Commit

Permalink
Update handle.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
pain1929 authored May 31, 2023
1 parent 504932f commit 399dd76
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions handle/handle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ LONG_PTR GetPID(const TCHAR* processName)
success = Process32First(snapshot, &pe);
if (_tcscmp(processName, pe.szExeFile) == 0)
{
CloseHandle(snapshot);
return pe.th32ProcessID;
}
while (success)
{
success = Process32Next(snapshot, &pe);
if (_tcscmp(processName, pe.szExeFile) == 0)
{
CloseHandle(snapshot);
return pe.th32ProcessID;
}
}
Expand Down

0 comments on commit 399dd76

Please sign in to comment.