|
@@ -108,7 +108,7 @@ class WinAdminPriv extends WscriptShell
|
|
{
|
|
{
|
|
WscriptShell::__construct();
|
|
WscriptShell::__construct();
|
|
}
|
|
}
|
|
- public static function check(array $removePatterns ,array $addPathes,array &$removePathes)
|
|
|
|
|
|
+ public static function check()
|
|
{
|
|
{
|
|
return self::RegWrite(self::$KEY_PATH,'AdminPriv','REG_EXPAND_SZ');
|
|
return self::RegWrite(self::$KEY_PATH,'AdminPriv','REG_EXPAND_SZ');
|
|
}
|
|
}
|
|
@@ -170,37 +170,22 @@ class WinEnvPath extends WscriptShell
|
|
//windows系统自启动操作类
|
|
//windows系统自启动操作类
|
|
class WinAutorun extends WscriptShell
|
|
class WinAutorun extends WscriptShell
|
|
{
|
|
{
|
|
|
|
+ private static $KEY_PATH = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\";
|
|
public function __construct()
|
|
public function __construct()
|
|
{
|
|
{
|
|
WscriptShell::__construct();
|
|
WscriptShell::__construct();
|
|
}
|
|
}
|
|
public static function remove($name)
|
|
public static function remove($name)
|
|
{
|
|
{
|
|
- $shell = self::$shell;
|
|
|
|
- if(! $shell){
|
|
|
|
- logError('failed to removeAutorun. shell is null.');
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
if( strlen($name) == 0){
|
|
if( strlen($name) == 0){
|
|
logError('failed to removeAutorun. name is empty.');
|
|
logError('failed to removeAutorun. name is empty.');
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
- try{
|
|
|
|
- $key = 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\' . $name;
|
|
|
|
- $shell->RegDelete($key);
|
|
|
|
- return true;
|
|
|
|
- } catch (\Exception $e) {
|
|
|
|
- logError('failed to removeAutorun',$e->getCode(),$e->getMessage());
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
|
|
+ $key = self::$KEY_PATH . $name;
|
|
|
|
+ return self::RegDelete($key);
|
|
}
|
|
}
|
|
public static function register($name,$cmd)
|
|
public static function register($name,$cmd)
|
|
{
|
|
{
|
|
- $shell = self::$shell;
|
|
|
|
- if(! $shell){
|
|
|
|
- logError('failed to registerAutorun. shell is null.');
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
if( strlen($name) == 0){
|
|
if( strlen($name) == 0){
|
|
logError('failed to registerAutorun. name is empty.');
|
|
logError('failed to registerAutorun. name is empty.');
|
|
return false;
|
|
return false;
|
|
@@ -209,14 +194,8 @@ class WinAutorun extends WscriptShell
|
|
logError('failed to registerAutorun. cmd is empty.');
|
|
logError('failed to registerAutorun. cmd is empty.');
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
- try{
|
|
|
|
- $key = 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\' . $name;
|
|
|
|
- $shell->RegWrite($key,$cmd,'REG_EXPAND_SZ');
|
|
|
|
- return true;
|
|
|
|
- } catch (\Exception $e) {
|
|
|
|
- logError('failed to registerAutorun',$e->getCode(),$e->getMessage());
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
|
|
+ $key = self::$KEY_PATH . $name;
|
|
|
|
+ return self::RegWrite($key,$cmd,'REG_EXPAND_SZ');
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|