I am not able to close the process nb.exe. I need to close this process but it is not getting closed. During closing I also need to ensure that all the dll are unloaded related to this process. Below is my code.
entry.dwSize = sizeof(PROCESSENTRY32);
HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
if (Process32First(snapshot, &entry) == TRUE)
while (Process32Next(snapshot, &entry) == TRUE)
if (wcsicmp(entry.szExeFile, L"nb.exe") == 0)
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, entry.th32ProcessID);
Please let me know if you have any inputs.
I think you are mistaken as to what ExitProcess(value) does. You are not doing anything to the process running nb.exe, but are exiting the current process with nb's process ID as the exit code.