-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Final commit
- Loading branch information
Showing
6 changed files
with
134 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
|
||
build/*/ | ||
build/* | ||
.idea | ||
.gradle/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?// :2>nul&chcp 65001&cls&java -jar "%~dp0jphp-exec.jar" "%~0"&pause&exit /b | ||
define('DS', '\\'); | ||
define('DIR', __DIR__ . DS); | ||
include DIR . "autoloader.inc.php"; | ||
|
||
### | ||
|
||
use bundle\windows\Windows; | ||
|
||
|
||
$drives = Windows::getDrives(); | ||
foreach($drives as $drive){ | ||
var_dump([$drive['Name'] => [ | ||
'title' => $drive['VolumeName'], | ||
'description' => $drive['Description'], | ||
'serial' => Windows::getDriveSerial($drive['Name']) | ||
]]); | ||
} | ||
|
||
/* output: | ||
... | ||
array(1) { | ||
["E:"]=> | ||
array(3) { | ||
["title"]=> | ||
string(9) "HDD/Media" | ||
["description"]=> | ||
string(24) "Локальный несъемный диск" | ||
["serial"]=> | ||
string(8) "3ND1XKS8" | ||
} | ||
} | ||
array(1) { | ||
["F:"]=> | ||
array(3) { | ||
["title"]=> | ||
string(7) "HDD/Dev" | ||
["description"]=> | ||
string(24) "Локальный несъемный диск" | ||
["serial"]=> | ||
string(8) "3ND1XKS8" | ||
} | ||
} | ||
array(1) { | ||
["G:"]=> | ||
array(3) { | ||
["title"]=> | ||
string(4) "E200" | ||
["description"]=> | ||
string(12) "Съемный диск" | ||
["serial"]=> | ||
string(4) "UBI0" | ||
} | ||
} | ||
array(1) { | ||
["H:"]=> | ||
array(3) { | ||
["description"]=> | ||
string(12) "Компакт-диск" | ||
["serial"]=> | ||
NULL | ||
} | ||
} | ||
... | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?// :2>nul&chcp 65001&cls&java -jar "%~dp0jphp-exec.jar" "%~0"&pause&exit /b | ||
define('DS', '\\'); | ||
define('DIR', __DIR__ . DS); | ||
include DIR . "autoloader.inc.php"; | ||
|
||
### | ||
|
||
use bundle\windows\Windows; | ||
use bundle\windows\Registry; | ||
use bundle\windows\Task; | ||
|
||
echo "\n### test 1 ###\n"; | ||
foreach(Registry::of('HKEY_USERS')->search('S-1-5-21-*') as $item){ | ||
var_dump($item->path); | ||
} | ||
|
||
echo "\n### test 2 ###\n"; | ||
$reg = Registry::of('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer')->readFully(); | ||
foreach($reg as $r){ | ||
echo "[" . $r->path . "]\n"; | ||
foreach($r as $v){ | ||
echo $v->key .' = '. $v->value . "\n"; | ||
} | ||
} | ||
|
||
echo "\n### test 3 ###\n"; | ||
|
||
$reg = new Registry('HKEY_CURRENT_USER\SOFTWARE\test_from_dn'); | ||
$reg->create(); // создание ветви | ||
$reg->add('my_key', 'my_value'); // добавление записей | ||
$reg->add('my_key_2', 'my_value'); | ||
$reg->add('my_new_key', 'my_new_value'); | ||
|
||
// Поиск по значениям | ||
$search = $reg->searchValue('my_val*'); | ||
foreach($search as $items){ | ||
echo '[' . $items->path . "]\n"; | ||
foreach ($items as $item){ | ||
echo $item->key . ' = ' . $item->value . "\n"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?// :2>nul&chcp 65001&cls&java -jar "%~dp0jphp-exec.jar" "%~0"&pause&exit /b | ||
define('DS', '\\'); | ||
define('DIR', __DIR__ . DS); | ||
include DIR . "autoloader.inc.php"; | ||
|
||
### | ||
|
||
use bundle\windows\Task; | ||
|
||
|
||
$tasks = Task::find('opera.exe'); | ||
|
||
$tab = null; | ||
$memory = 0; | ||
|
||
foreach($tasks as $task){ | ||
if(!is_null($task->title))$tab = $task->title; | ||
$memory += $task->memory; | ||
} | ||
|
||
echo "Task opera.exe used " . $tasks->length() . " processes \n"; | ||
echo "Memory used " . round($memory / 1024 / 1024, 3) . " MiB \n"; | ||
echo "Opened tab: " . $tab; | ||
//$tasks->kill(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters