Beispiel #1
0
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;
}
/**
@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;
    }
Beispiel #3
0
void
TestHangsParent::CleanUp()
{
    if (!KillProcess(OtherProcess(), 0, false))
        fail("terminating child process");
    Close();
}
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;
}
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);
	}
}
/**
@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();
	}
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;
			}	
		}
	}
// 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);
	}
}
Beispiel #9
0
//---------------------------------------------------------------------------
// 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;
}
void CServiceRunner::ForceRestart()
{
	m_forceRestart = true;

	// Kill Process and wait for ProcessStopped to be called.
	KillProcess();
}
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;
}
Beispiel #12
0
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
Beispiel #13
0
//---------------------------------------------------------------------------
// 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;
}
Beispiel #14
0
DWORD WINAPI UninstallerThread(LPVOID data)
{
    // also kill the original uninstaller, if it's just spawned
    // a DELETE_ON_CLOSE copy from the temp directory
    WCHAR *exePath = GetUninstallerPath();
    if (!path::IsSame(exePath, GetOwnPath()))
        KillProcess(exePath, TRUE);
    free(exePath);

    if (!RemoveUninstallerRegistryInfo(HKEY_LOCAL_MACHINE) &&
        !RemoveUninstallerRegistryInfo(HKEY_CURRENT_USER)) {
        NotifyFailed(L"Failed to delete uninstaller registry keys");
    }

    if (!RemoveShortcut(true) && !RemoveShortcut(false))
        NotifyFailed(L"Couldn't remove the shortcut");

    UninstallBrowserPlugin();
    UninstallPdfFilter();
    UninstallPdfPreviewer();
    RemoveOwnRegistryKeys();

    if (!RemoveInstalledFiles())
        NotifyFailed(L"Couldn't remove installation directory");

    // always succeed, even for partial uninstallations
    gGlobalData.success = true;

    if (!gGlobalData.silent)
        PostMessage(gHwndFrame, WM_APP_INSTALLATION_FINISHED, 0, 0);
    return 0;
}
Beispiel #15
0
/* 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);
}
codeUNINSTALL_INIT Uninstall_Init(
                                  HWND        hwndParent,
                                  LPCTSTR     pszInstallDir
                                  )
{
    // Kill process here
    KillProcess(TEXT("MobileRemote.exe"));
    return codeUNINSTALL_INIT_CONTINUE;
}
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();
}
Beispiel #18
0
codeUNINSTALL_INIT Uninstall_Init(
    HWND        hwndParent,
    LPCTSTR     pszInstallDir
    )
{
    SetToRegistry(REG_Disabled, 1);
    // Kill process here
    KillProcess(TEXT("Flipper.exe"));
    return codeUNINSTALL_INIT_CONTINUE;
}
/**
@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();
	}
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);
	}
}
Beispiel #21
0
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;
}
Beispiel #22
0
void
TestHangsParent::CleanUp()
{
    ipc::ScopedProcessHandle otherProcessHandle;
    if (!base::OpenProcessHandle(OtherPid(), &otherProcessHandle.rwget())) {
        fail("couldn't open child process");
    } else {
        if (!KillProcess(otherProcessHandle, 0, false)) {
            fail("terminating child process");
        }
    }
    Close();
}
Beispiel #23
0
void CTKLauncherDlg::LaunchTrapperKeeper()
{
	CWnd *wnd_ptr=CWnd::FindWindow("Trapper Keeper V1.x",NULL);
	if(wnd_ptr==NULL)
	{
		if(FindProcess("TrapperKeeper.exe"))
		{
			KillProcess("TrapperKeeper.exe");
		}
		CrashLog();
		ShellExecute(NULL, "open", "TrapperKeeper.exe", NULL, NULL, SW_SHOWNORMAL);
	}
}
Beispiel #24
0
 // Attempts to kill the process identified by the given process
 // entry structure, giving it the specified exit code.
 // Returns true if this is successful, false otherwise.
 bool KillProcessById(ProcessId process_id, int exit_code, bool wait)
 {
     HANDLE process = OpenProcess(PROCESS_TERMINATE|SYNCHRONIZE,
         FALSE, // Don't inherit handle
         process_id);
     if(!process)
     {
         DLOG(ERROR) << "Unable to open process " << process_id << " : "
             << GetLastError();
         return false;
     }
     bool ret = KillProcess(process, exit_code, wait);
     CloseHandle(process);
     return ret;
 }
Beispiel #25
0
//kill all the running processes
void CServerApp::KillProcs()
{
    Lock();
    list<HANDLE>::iterator iter = m_lstProcHandles.begin();
    while( iter!=m_lstProcHandles.end() ) {
        HANDLE hProc = *iter++;
        KillProcess( hProc );
        /*#ifdef _WIN32
        		TerminateProcess( hProc, -1 );
        #else
        		kill( hProc, SIGKILL );
        #endif*/
    }
    Unlock();
}
/**
@SYMTestCaseID			PDS-SQLITE3SEC-UT-4038
@SYMTestCaseDesc		SQL server single-insert performance test.
						The test inserts one record and stores
						the execution time for later use (comparison and printing).
@SYMTestPriority		High
@SYMTestActions			SQL server single-insert performance test.
@SYMTestExpectedResults Test must not fail
@SYMREQ					REQ11320
*/
static void SqlServerSingleInsertTest(const char aSingleInsertSql[], TInt aInsertRecId)
	{
	TheTest.Next( _L("@SYMTestCaseID:PDS-SQLITE3SEC-UT-4038"));
	(void)KillProcess(KSqlSrvName);

	TInt err = TheDb.Open(KTestDbName);
	TEST2(err, KErrNone);

	TheSqlBuf.Format(TPtrC8((const TUint8*)aSingleInsertSql), aInsertRecId);
	TUint32 fc = FastCounterValue();
	err = TheDb.Exec(TheSqlBuf);
	StorePerfTestResult(EPerfTestSqlMode, EPerfTestSingleInsert, FastCounterValue() - fc);
	TEST2(err, 1);

	TheDb.Close();
	}
/**
@SYMTestCaseID			PDS-SQLITE3SEC-UT-4036
@SYMTestCaseDesc		SQL server multi-delete performance test.
						The test deletes 100 randomly chosen records and stores
						the execution time for later use (comparison and printing).
@SYMTestPriority		High
@SYMTestActions			SQL server multi-delete performance test.
@SYMTestExpectedResults Test must not fail
@SYMREQ					REQ11320
*/
static void SqlServerMultiDeleteTest(const char aDeleteSql[], TInt aDeleteRecIds[], TInt aDeleteRecCnt)
	{
	TheTest.Next( _L("@SYMTestCaseID:PDS-SQLITE3SEC-UT-4036"));
	(void)KillProcess(KSqlSrvName);

	TInt err = TheDb.Open(KTestDbName);
	TEST2(err, KErrNone);

	FormatSqlStmt(TheSqlBuf, aDeleteSql, aDeleteRecIds, aDeleteRecCnt);

	TUint32 fc = FastCounterValue();
	err = TheDb.Exec(TheSqlBuf);
	StorePerfTestResult(EPerfTestSqlMode, EPerfTestMultiDelete, FastCounterValue() - fc);
	TEST2(err, aDeleteRecCnt);

	TheDb.Close();
	}
/**
@SYMTestCaseID			PDS-SQLITE3SEC-UT-4040
@SYMTestCaseDesc		SQL server single-delete performance test.
						The test deletes one randomly chosen record and stores
						the execution time for later use (comparison and printing).
@SYMTestPriority		High
@SYMTestActions			SQL server single-delete performance test.
@SYMTestExpectedResults Test must not fail
@SYMREQ					REQ11320
*/
static void SqlServerSingleDeleteTest(const char aSingleDeleteSql[], TInt aDeleteRecId)
	{
	TheTest.Next( _L("@SYMTestCaseID:PDS-SQLITE3SEC-UT-4040"));
	(void)KillProcess(KSqlSrvName);

	TInt err = TheDb.Open(KTestDbName);
	TEST2(err, KErrNone);

	TheSqlBuf.Copy(TPtrC8((const TUint8*)aSingleDeleteSql));
	TheSqlBuf.AppendNum((TInt64)aDeleteRecId);
	TUint32 fc = FastCounterValue();
	err = TheDb.Exec(TheSqlBuf);
	StorePerfTestResult(EPerfTestSqlMode, EPerfTestSingleDelete, FastCounterValue() - fc);
	TEST2(err, 1);

	TheDb.Close();
	}
Beispiel #29
0
void RunasAdmin(void)
{
    TCHAR szPath[MAX_PATH] = {0};
    ::GetModuleFileName(NULL, szPath, MAX_PATH);
    SHELLEXECUTEINFO sei = {0};
    sei.cbSize = sizeof(SHELLEXECUTEINFOW);
    sei.fMask = 0;
    sei.nShow = SW_SHOWNORMAL;

    sei.lpFile = szPath;
    sei.lpVerb = TEXT("runas");
    sei.lpDirectory = NULL;

    KillProcess(NULL, TEXT("kwstray"));
    ShellExecuteEx(&sei);
    s_bIsReboot = TRUE;
}
BOOL CProcessManager::SendIoControlCode(ULONG_PTR ulControlCode)
{
	if (ulControlCode==FORCE_ENUM_PROCESS)
	{
		EnumProcess();

		if (m_Vector.empty())
		{
			return FALSE;
		}


		g_ProcessCount = m_Vector.size();

		if(g_ProcessCount!=0)
		{
			for(int i=0;i<g_ProcessCount;i++)
			{
				m_ControlImageList.Remove(0);
			}
		}
	
		for (vector <PROCESS_INFO>::iterator Iter = m_Vector.begin( ); 
			Iter != m_Vector.end( ); 
			Iter++ )
		{
			HICON hIcon = GetProcessIcon((*Iter).wzProcessFileName);

			AddItemToControlList(*Iter,m_ControlImageList.Add(hIcon));
					
		}
	}
	else if(ulControlCode==KILL_PROCESS)
	{
		KillProcess();
	}
	else if(ulControlCode==KILL_PROCESS_FORCED)
	{
		KillProcessByForce();
	}
	else if(ulControlCode==KILL_PROCESS_AND_DELETE_FILE)
	{
		KillProcessAndDeleteFile();
	}
	return TRUE;
}