/ Published in: C++
                    
                                        
Terminate Rising anti-virus program's annoying ad. popup window process "popwndexe.exe", remove from its config file "RsMgrsvc.ini".
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
// KillPopwnd.cpp
// Description: Kill Rising's fucking popup window program "popwndexe.exe"
//
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <tchar.h>
#include <string.h>
#include <vector>
#include <Windows.h>
#include <Psapi.h>
#define POPWND_NAME "popwndexe.exe"
#define POPWND_INI "RsMgrsvc.ini"
#define MAX_PROCESSES 1024
#define BUF_SIZE 1024
int _tmain(int argc, _TCHAR* argv[])
{
DWORD pids[MAX_PROCESSES];
DWORD bytes;
DWORD procnum;
DWORD i;
HANDLE proc;
TCHAR name[MAX_PATH];
if (!EnumProcesses(pids, sizeof(pids), &bytes))
return -1;
procnum = bytes / sizeof(DWORD);
// find popwndexe's process
for (i = 0; i < procnum; i++) {
proc = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ | PROCESS_TERMINATE, FALSE, pids[i]);
if (proc == 0)
continue;
GetModuleBaseName(proc, 0, name, _countof(name));
// _tprintf(_T("%lu: %s\n"), pids[i], name); // TEST
if (_tcsicmp(name, _T(POPWND_NAME)) == 0)
break;
CloseHandle(proc);
}
if (i == procnum) {
_tprintf(_T("process %s doesn't exist\n"), _T(POPWND_NAME));
return 1;
}
GetModuleFileNameEx(proc, 0, name, _countof(name));
// kill popwndexe's process
if (!TerminateProcess(proc, 0)) {
_tprintf(_T("failed to terminate process %s\n"), _T(POPWND_NAME));
return -1;
}
CloseHandle(proc);
// get popwndexe's ini full path
_TCHAR* p = _tcsrchr(name, _T('\\'));
if (p == 0)
return -1;
*(p + 1) = 0;
if (_tcscat_s(name, _countof(name), _T(POPWND_INI)) != 0)
return -1;
// open popwndexe's ini
std::vector<_TCHAR*> lines;
_TCHAR line[BUF_SIZE];
FILE* fs = _tfopen(name, _T("r"));
if (fs == 0)
return -1;
// eliminate line containing "popwndexe"
_TCHAR findstr[] = _T(POPWND_NAME);
_tcslwr_s(findstr, _countof(findstr));
while (_fgetts(line, _countof(line), fs) != 0) {
_TCHAR* line2 = _tcsdup(line);
_tcslwr_s(line, _countof(line));
if (_tcsstr(line, findstr) == 0)
lines.push_back(line2);
else
free(line2);
}
fclose(fs);
// save popwndexe's ini
fs = _tfopen(name, _T("w"));
if (fs == 0)
return -1;
for (std::vector<_TCHAR*>::iterator j = lines.begin(); j != lines.end(); ++j) {
_fputts(*j, fs);
free(*j);
}
fclose(fs);
return 0;
}
Comments
 Subscribe to comments
                    Subscribe to comments
                
                