本文整理汇总了C++中KillProcess函数的典型用法代码示例。如果您正苦于以下问题:C++ KillProcess函数的具体用法?C++ KillProcess怎么用?C++ KillProcess使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了KillProcess函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main_p2
int main_p2(int argc, char *argv[]) {
//assume first argument is the application name
if (argc < 5) {
printf("Error: Invalid number of command line arguments\n");
printf("Program expected the following cli arguments\n");
printf("./p2 init.file log.file, trans1.file, trans2.file\n");
exit(0);
}
int i = 0;
//Gets CLI Values. Tanks if values not provided.
for (i = 1; i < argc; i++) {
//printf("CLI Value:%s\n", argv[i]);
SetCLIValues(argv[i], i);
}
//open all 4 pipes
pipe(pipe1);
pipe(pipe2);
pipe(pipe3);
pipe(pipe4);
//fork store manager
pid_t sm_pid = ForkStoreManager();
//printf("Forked Store Manager\n");
//wait a sec for the store manager to load the input file.
//this is less to do with the store manager doing what it's
//supposed to do and more to prevent the forked processes
//from executing
//sleep(1);
pid1 = ForkProcess(1, trans1FileName, pipe1, pipe3);
//printf("Forked Process 1\n");
pid2 = ForkProcess(2, trans2FileName, pipe2, pipe4);
//printf("Forked Process 2\n");
GetInputFromUser();
//deallocates shared memory
KillProcess(sm_pid);
KillProcess(pid1);
KillProcess(pid2);
return 0;
}
开发者ID:ttrask,项目名称:eggen-os,代码行数:50,代码来源:p2.c
示例2: Defect_INC120743L
/**
@SYMTestCaseID SYSLIB-BAFL-UT-4052
@SYMTestCaseDesc Tests BackupServer crashes under IPC fuzzing and freezes phone
@SYMTestPriority High
@SYMTestActions Calls BackupServer with EBakOpCodeCloseServer with 0-4 args. Verifies that server returns KErrNotSupported.
@SYMTestExpectedResults Server should not process the CloseServer message and should return KErrNotSupported
*/
LOCAL_C void Defect_INC120743L()
{
TheTest.Next (_L ("Defect_INC120743L"));
__UHEAP_MARK;
RProcess server;
TInt messageToTest = EBakOpCodeCloseServer;
//Clean up any chance of launcher or baksrvs still running
TInt err = KillProcess(KServerLauncherProcess);
if((err != KErrNotFound)&&(err != KErrDied))
{
User::LeaveIfError(err);
}
err = KillProcess(KBURServerName);
if((err != KErrNotFound)&&(err != KErrDied))
{
User::LeaveIfError(err);
}
TInt startedFlag = LaunchServer(server);
TheTest.Printf(_L("LaunchServer has returned: %d"), startedFlag);
TheTest(startedFlag == 0 || startedFlag == KErrAlreadyExists);
CTrapCleanup* cleanup=CTrapCleanup::New();
err=KErrNoMemory;
if (cleanup)
{
//Carry out each test with number of arguments 1 - 4
for(TInt argCount = 0; argCount <= 4; argCount++)
{
RIpcServerCloseTest closeTest;
TRAP(err,closeTest.RunTestL(KServerName, messageToTest, argCount));
closeTest.Close();
}
delete cleanup;
}
__UHEAP_MARKEND;
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:55,代码来源:T_BaflDefect.cpp
示例3: fail
void
TestHangsParent::CleanUp()
{
if (!KillProcess(OtherProcess(), 0, false))
fail("terminating child process");
Close();
}
开发者ID:amyvmiwei,项目名称:firefox,代码行数:7,代码来源:TestHangs.cpp
示例4: Uninstall_Init
codeUNINSTALL_INIT Uninstall_Init(
HWND hwndParent,
LPCTSTR pszInstallDir)
{
// TODO: Add custom uninstallation code here
// To continue uninstallation, return codeUNINSTALL_INIT_CONTINUE
// If you want to cancel installation,
// return codeUNINSTALL_INIT_CANCEL
TCHAR szShortcutPath[MAX_PATH];
TCHAR szOutFileLink[MAX_PATH];
HKEY hKey;
HRESULT hr = S_OK;
KillProcess(_T("VKontakteWM.Notification.exe"));
SHGetSpecialFolderPath(0, szShortcutPath, CSIDL_PROGRAMS, false);
wsprintf(szOutFileLink,_T("%s\\%s"), szShortcutPath, _T("ВКонтакте.lnk"));
DeleteFile(szOutFileLink);
hr = RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("Security\\Shell\\StartInfo\\Start"), 0, 0, &hKey);
if(hr == ERROR_SUCCESS)
{
RegDeleteKey(hKey, TEXT("ВКонтакте.lnk"));
RegCloseKey(hKey);
}
return codeUNINSTALL_INIT_CONTINUE;
}
开发者ID:xorkrus,项目名称:vk_wm,代码行数:30,代码来源:VKontakteWM.Setup.dll.cpp
示例5: AddMenuString
void CDlg_AppInfo::OnWnds()
{
CMenu menu;
menu.CreatePopupMenu();
if(hSlWnd!=0){
AddMenuString(&menu,2,_l("Put link on desktop"));
AddMenuString(&menu,3,_l("Autohide window")+"...");
}
AddMenuString(&menu,1,_l("Kill application"));
::SetMenuDefaultItem(menu.m_hMenu, 0, FALSE);
CRect rt;
GetDlgItem(ID_WNDS)->GetWindowRect(&rt);
RECT rDesktopRECT;
rDesktopRECT.left=rDesktopRECT.top=-20;
rDesktopRECT.right=rDesktopRECT.bottom=-10;
HWND wndShotPhase2 = ::CreateWindowEx(WS_EX_TOOLWINDOW|WS_EX_TOPMOST|WS_EX_TRANSPARENT, "Static", "MENU_WND", WS_DISABLED, rDesktopRECT.left, rDesktopRECT.top, rDesktopRECT.right-rDesktopRECT.left, rDesktopRECT.bottom-rDesktopRECT.top, 0, 0, AfxGetApp()->m_hInstance, 0);
DWORD dwRes=::TrackPopupMenu(menu.m_hMenu, TPM_RETURNCMD, rt.right, rt.top, 0, wndShotPhase2 , NULL);
::DestroyWindow(wndShotPhase2);
if(dwRes==3){
AddToAutoHide(hSlWnd);
}
if(dwRes==1){
KillProcess(dwProcId,NULL);
}
if(dwRes==2){
CreateLinkInFolder(getDesktopPath(),hSlWnd);
}
}
开发者ID:calupator,项目名称:wiredplane-wintools,代码行数:28,代码来源:Dlg_AppInfo.cpp
示例6: use
/**
@SYMTestCaseID PDS-SQLITE3SEC-UT-4034
@SYMTestCaseDesc SQL server multi-insert performance test.
The test inserts 1000 records in a single transaction and stores
the execution time for later use (comparison and printing).
@SYMTestPriority High
@SYMTestActions SQL server multi-insert performance test.
@SYMTestExpectedResults Test must not fail
@SYMREQ REQ11320
*/
static void SqlServerMultiInsertTest(const char aInsertSql[], TInt aInsertRecCnt)
{
TheTest.Next( _L("@SYMTestCaseID:PDS-SQLITE3SEC-UT-4034"));
(void)KillProcess(KSqlSrvName);
TInt err = TheDb.Open(KTestDbName);
TEST2(err, KErrNone);
RSqlStatement stmt;
err = stmt.Prepare(TheDb, TPtrC8((const TUint8*)aInsertSql));
TEST2(err, KErrNone);
TUint32 fc = FastCounterValue();
err = TheDb.Exec(_L8("BEGIN"));
TEST(err >= 0);
for(TInt i=0;i<aInsertRecCnt;++i)
{
err = stmt.BindInt(0, i + 1);
TEST2(err, KErrNone);
err = stmt.Exec();
TEST2(err, 1);
err = stmt.Reset();
TEST2(err, KErrNone);
}
err = TheDb.Exec(_L8("COMMIT"));
TEST(err >= 0);
StorePerfTestResult(EPerfTestSqlMode, EPerfTestMultiInsert, FastCounterValue() - fc);
stmt.Close();
TheDb.Close();
}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:43,代码来源:tsqlitesecure_perf.cpp
示例7: AtTime
void CTimeWorkManager::RunL()
{
if (iState == EUninitialized)
{
// Do something the first time RunL() is called
iState = EInitialized;
AtTime();
}
else if (iState != EError)
{
switch (iStatus.Int())
{
case KErrNone:
{
// Do something
KillProcess();
}
break;
case KErrAbort:
AtTime();
break;
default:
break;
}
}
}
开发者ID:flaithbheartaigh,项目名称:lemonplayer,代码行数:27,代码来源:TimeWorkManager.cpp
示例8: GetExitCodeProcess
// This is called when the service process exits.
void CServiceRunner::ProcessStopped()
{
// If we are exiting then ignore this notification.
if (m_exiting)
return;
// Get the exit code.
unsigned long exitcode = 0;
GetExitCodeProcess(m_processHandle, &exitcode);
// Clean up.
KillProcess();
// Is a restart required?
if (m_autoRestart || m_forceRestart)
{
if (!m_forceRestart)
m_restartAttempts++;
CEventLogger::Get().Log(EVENTLOG_INFORMATION_TYPE, WEBINOS_SERVER_EVENT_EXIT_RESTART, m_parameters.serviceName.c_str(), 0);
Start();
}
else
{
// The process has exited and we don't want a restart, so exit the service here.
CEventLogger::Get().Log(EVENTLOG_INFORMATION_TYPE, WEBINOS_SERVER_EVENT_EXIT_REALLY, m_parameters.serviceName.c_str(), 0);
Exit(exitcode);
}
}
开发者ID:michelemorello,项目名称:Webinos-Platform,代码行数:31,代码来源:ServiceRunner.cpp
示例9: KillProcessTreeWinHelper
//---------------------------------------------------------------------------
// KillProcessTreeWinHelper
//
// This is a recursive helper function that terminates all the processes
// started by the specified process and them terminates the process itself
//
// Parameters:
// dwProcessId - identifier of the process to terminate
//
// Returns:
// Win32 error code.
//
BOOL WINAPI KillProcessTreeWinHelper(DWORD dwProcessId) {
// create a snapshot
auto_handle hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (!hSnapshot)
return GetLastError();
auto_localmem<PROCESSENTRY32*> pEntry = ::LocalAlloc(LMEM_FIXED|LMEM_ZEROINIT,sizeof(PROCESSENTRY32));
pEntry->dwSize = sizeof(PROCESSENTRY32);
if (!Process32First(hSnapshot, pEntry))
{
return GetLastError();
}
// kill all children first
do
{
// there was a report of infinite recursion, so watching out for the obvious self-loop possibility
DWORD pid = pEntry->th32ProcessID;
if (pEntry->th32ParentProcessID == dwProcessId && dwProcessId!=pid)
KillProcessTreeWinHelper(pid);
}
while (Process32Next(hSnapshot, pEntry));
// kill the process itself
if (!KillProcess(dwProcessId))
return GetLastError();
return ERROR_SUCCESS;
}
开发者ID:synopsys-arc-oss,项目名称:winp,代码行数:42,代码来源:winp.cpp
示例10: KillProcess
void CServiceRunner::ForceRestart()
{
m_forceRestart = true;
// Kill Process and wait for ProcessStopped to be called.
KillProcess();
}
开发者ID:michelemorello,项目名称:Webinos-Platform,代码行数:7,代码来源:ServiceRunner.cpp
示例11: _tmain
int _tmain(int argc, _TCHAR* argv[])
{
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
if( argc >= 2 )
::OutputDebugString(argv[1]);
//程序自动重启
if (argc == 2 && lstrcmpi(argv[1], TEXT("-A")) == 0)
{
try
{
i8desk::CWin32Svr::StopService(_T("I8VDiskSvr"));
KillProcess(_T("i8NodeServer.exe"));
}
catch(...)
{
// do nothing
}
Sleep(500);
// 重启服务
i8desk::CWin32Svr::StartService(_T("I8VDiskSvr"));
//StartProcess(_T("I8VDiskSvr.exe -d"));
return 0;
}
g_service.ProcessCmdLine(argc, argv);
return 0;
}
开发者ID:lubing521,项目名称:important-files,代码行数:32,代码来源:I8VDiskSvr.cpp
示例12: ProcessArgs
static void ProcessArgs(int argc, char **argv)
{
// If we can't connect to a gimbal, kill the app right now
if (OrionCommOpen(&argc, &argv) == FALSE)
KillProcess("", 1);
}// ProcessArgs
开发者ID:trilliumeng,项目名称:orion-sdk,代码行数:7,代码来源:CameraInfo.c
示例13: KillProcessTreeNtHelper
//---------------------------------------------------------------------------
// KillProcessTreeNtHelper
//
// This is a recursive helper function that terminates all the processes
// started by the specified process and them terminates the process itself
//
// Parameters:
// pInfo - processes information
// dwProcessId - identifier of the process to terminate
//
// Returns:
// Win32 error code.
//
static
BOOL
WINAPI
KillProcessTreeNtHelper
(
IN PSYSTEM_PROCESSES pInfo,
IN DWORD dwProcessId
)
{
// _ASSERTE(pInfo != NULL);
PSYSTEM_PROCESSES p = pInfo;
// kill all children first
for (;;)
{
if (p->InheritedFromProcessId == dwProcessId)
KillProcessTreeNtHelper(pInfo, p->ProcessId);
if (p->NextEntryDelta == 0)
break;
// find the address of the next process structure
p = (PSYSTEM_PROCESSES)(((LPBYTE)p) + p->NextEntryDelta);
}
// kill the process itself
if (!KillProcess(dwProcessId))
return GetLastError();
return ERROR_SUCCESS;
}
开发者ID:JimCallahan,项目名称:Pipeline,代码行数:45,代码来源:KillProcess.cpp
示例14: _FindAndKillProcess
/* Function: _FindAndKillProcess()
*
* in: LPSTR aProcessName: Name of process to find and kill
* BOOL aKillProcess: Indicates whether to kill the process
* or not.
* purpose: To find and kill a given process name currently running. This
* function only works under Win9x, Win2k, and WinXP systems.
*/
BOOL _FindAndKillProcess(kpf *kpfRoutines, LPSTR aProcessName, BOOL aKillProcess)
{
BOOL rv = FALSE;
HANDLE hCreateSnapshot = NULL;
PROCESSENTRY32 peProcessEntry;
hCreateSnapshot = kpfRoutines->pCreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if(hCreateSnapshot == (HANDLE)-1)
return(rv);
peProcessEntry.dwSize = sizeof(PROCESSENTRY32);
if(kpfRoutines->pProcessWalkFirst(hCreateSnapshot, &peProcessEntry))
{
char szBuf[MAX_BUF];
do
{
ParsePath(peProcessEntry.szExeFile, szBuf, sizeof(szBuf), FALSE, PP_FILENAME_ONLY);
/* do process name string comparison here */
if(lstrcmpi(szBuf, aProcessName) == 0)
{
rv = TRUE;
if(aKillProcess)
KillProcess(aProcessName, NULL, peProcessEntry.th32ProcessID);
else
break;
}
} while(kpfRoutines->pProcessWalkNext(hCreateSnapshot, &peProcessEntry));
}
CloseHandle(hCreateSnapshot);
return(rv);
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:43,代码来源:process.c
示例15: Uninstall_Init
codeUNINSTALL_INIT Uninstall_Init(
HWND hwndParent,
LPCTSTR pszInstallDir
)
{
// Kill process here
KillProcess(TEXT("MobileRemote.exe"));
return codeUNINSTALL_INIT_CONTINUE;
}
开发者ID:nbclark,项目名称:mobile-remote,代码行数:9,代码来源:MobileRemoteSetup.cpp
示例16: KillProcess
void ProcessTracker::KillAllProcesses()
{
for (ProcessInfoList::iterator procInfo = this->m_injectedProcessList.begin();
procInfo != this->m_injectedProcessList.end();
++procInfo)
{
KillProcess(procInfo->th32ProcessID);
}
// Kill the root process. If a 32bit application is started with the 64bit server it will not be registered in the injectedProcessList
// because the shared memory comms does not work between a server and app of different bitness.
// This can leave Steam.exe running after shutdown and will be blocking the port and preventing the server from being relaunched.
if (m_injectedAppID != 0)
{
KillProcess(m_injectedAppID);
}
this->m_injectedProcessList.clear();
}
开发者ID:StephenThomasUWTSD,项目名称:CodeXL,代码行数:19,代码来源:ProcessTracker.cpp
示例17: Uninstall_Init
codeUNINSTALL_INIT Uninstall_Init(
HWND hwndParent,
LPCTSTR pszInstallDir
)
{
SetToRegistry(REG_Disabled, 1);
// Kill process here
KillProcess(TEXT("Flipper.exe"));
return codeUNINSTALL_INIT_CONTINUE;
}
开发者ID:nbclark,项目名称:flipper,代码行数:10,代码来源:FlipperSetup.cpp
示例18: RFSInstallOnlyL
/**
@SYMTestCaseID SYSLIB-CENTRALREPOSITORY-CT-3343
@SYMTestCaseDesc Restore factory Settings from Install file.
@SYMTestPriority High
@SYMTestActions Ensure that the repository file only exists in the Install directory.
Open the repository and modify a setting. Force RFS
and check that the repository is restored against the Install file
@SYMTestExpectedResults The test repository should be reset against the Install file
@SYMDEF PDEF099108
*/
LOCAL_C void RFSInstallOnlyL()
{
TheTest.Start(_L(" @SYMTestCaseID:SYSLIB-CENTRALREPOSITORY-CT-3343 ResetAllRepositoriesTestL "));
TInt r;
TReal realVal;
TBuf<20> strVal;
//restore all test files - this ensures we have a repository file
//only on the c:
RestoreRFSTestFilesL(EInstallOnly);
TheTest.Next(_L("Open repository to ensure server is running"));
CRepository* repository = CRepository::NewLC(KUidRfsRepositoryInstallOnlyDefaultFile);
TheTest.Next(_L("Modify a Setting"));
r = repository->Set(KReal1, KReal1_UpdatedValue);
TEST2(r, KErrNone);
//verify the update
r = repository->Get(KReal1, realVal);
TEST2(r, KErrNone);
TEST(realVal == KReal1_UpdatedValue);
// Close repository
CleanupStack::PopAndDestroy(repository);
//Kill the server
TheTest.Next(_L("Kill the server process"));
_LIT( KCentralRepositoryServerName, "Centralrepositorysrv");
r = KillProcess(KCentralRepositoryServerName);
TEST2(r,KErrNone);
User::After(KGeneralDelay);
//Restart the server in soft reset mode to force a
//repository reset
TheTest.Next(_L("Manually start central respository"));
ReStartServerInSoftResetMode();
//Open the repository
repository = CRepository::NewLC(KUidRfsRepositoryInstallOnlyDefaultFile);
//verify that the Real value has been reset against the value in the install
//repository file
TheTest.Next(_L("Get 'Modified' value"));
r = repository->Get(KReal1, realVal);
TEST2(r, KErrNone);
TEST(realVal == KReal1_InstallValue);
// Close repository
CleanupStack::PopAndDestroy(repository);
TheTest.End();
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:65,代码来源:t_cenrep_rfs.cpp
示例19: KillProcess
void ProcessHandler::KillProcesses(const Blacklist& blacklist)
{
std::vector<Process> processes = blacklist.GetProcesses();
for (std::vector<Process>::iterator iter = processes.begin();
iter != processes.end();
++iter)
{
KillProcess(*iter);
}
}
开发者ID:vwarship,项目名称:ProcessKiller,代码行数:11,代码来源:ProcessHandler.cpp
示例20: AppendMenu
void CDialogProcess::OnNMRClickListProc(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
int index = pNMLV->iItem;
CString szCid;
CPoint pt;
DWORD dwCid;
if( index == -1 )
return;
HMENU hMenu = ::CreatePopupMenu();
AppendMenu( hMenu, MF_STRING, 10001, _T("进程模块") );
AppendMenu( hMenu, MF_STRING, 10002, _T("结束进程") );
GetCursorPos(&pt);
UINT Cmd = (UINT)::TrackPopupMenu( hMenu, TPM_LEFTALIGN|TPM_RETURNCMD, pt.x, pt.y, 0, m_hWnd, NULL );
switch( Cmd )
{
case 10001:
{
m_DialogDll.ShowWindow(SW_SHOW);
m_DialogDll.m_ListDll.DeleteAllItems();
szCid = m_ListProc.GetItemText(index, 0);
dwCid = _tcstoul(szCid, 0, 10);
GetDll(dwCid);
}
break;
case 10002:
{
szCid = m_ListProc.GetItemText(index, 0);
dwCid = _tcstoul(szCid, 0, 10);
if( KillProcess(dwCid) )
{
m_ListProc.DeleteItem(index);
}
else
{
MessageBoxA(NULL, "Kill process failed.","ERROR", MB_OK);
}
}
break;
}
*pResult = 0;
}
开发者ID:simileas,项目名称:prodo,代码行数:53,代码来源:DialogProcess.cpp
注:本文中的KillProcess函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论