![]() |
Bearsampp 2026.7.11
|
Public Member Functions | |
| __construct () | |
| deleteValue ($key, $subkey, $entry) | |
| exists ($key, $subkey, $entry=null) | |
| getAppBinsRegKey ($fromRegistry=true) | |
| getAppPathRegKey () | |
| getLatestError () | |
| getProcessorRegKey () | |
| getSysPathRegKey () | |
| getValue ($key, $subkey, $entry=null) | |
| setAppBinsRegKey ($value) | |
| setAppPathRegKey ($value) | |
| setExpandStringValue ($key, $subkey, $entry, $value) | |
| setStringValue ($key, $subkey, $entry, $value) | |
| setSysPathRegKey ($value) | |
Data Fields | |
| const | APP_BINS_REG_ENTRY = 'BEARSAMPP_BINS' |
| const | APP_PATH_REG_ENTRY = 'BEARSAMPP_PATH' |
| const | END_PROCESS_STR = 'FINISHED!' |
| const | ENV_KEY = 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment' |
| const | HKEY_CLASSES_ROOT = 'HKCR' |
| const | HKEY_CURRENT_USER = 'HKCU' |
| const | HKEY_LOCAL_MACHINE = 'HKLM' |
| const | HKEY_USERS = 'HKEY_USERS' |
| const | PROCESSOR_REG_ENTRY = 'Identifier' |
| const | PROCESSOR_REG_SUBKEY = 'HARDWARE\DESCRIPTION\System\CentralProcessor\0' |
| const | REG_BINARY = 'REG_BINARY' |
| const | REG_DWORD = 'REG_DWORD' |
| const | REG_ERROR_ENTRY = 'REG_ERROR_ENTRY' |
| const | REG_ERROR_SET = 'REG_ERROR_SET' |
| const | REG_EXPAND_SZ = 'REG_EXPAND_SZ' |
| const | REG_MULTI_SZ = 'REG_MULTI_SZ' |
| const | REG_NO_ERROR = 'REG_NO_ERROR' |
| const | REG_SZ = 'REG_SZ' |
| const | SYSPATH_REG_ENTRY = 'Path' |
Private Member Functions | |
| setValue ($key, $subkey, $entry, $value, $type) | |
| writeLog ($log) | |
Private Attributes | |
| $latestError | |
Class Registry
This class provides methods to interact with the Windows Registry using COM. It includes functionalities to check the existence of registry keys, get and set values, and delete registry entries. The class also logs operations and errors.
Definition at line 17 of file class.registry.php.
| __construct | ( | ) |
Registry constructor. Initializes the Registry class and logs the initialization.
Definition at line 57 of file class.registry.php.
References Log\initClass().
| deleteValue | ( | $key, | |
| $subkey, | |||
| $entry ) |
Deletes a registry entry.
| string | $key | The root key (e.g., HKEY_LOCAL_MACHINE). |
| string | $subkey | The subkey path. |
| string | $entry | The entry name. |
Definition at line 161 of file class.registry.php.
References setValue(), and writeLog().
| exists | ( | $key, | |
| $subkey, | |||
| $entry = null ) |
Checks if a registry key or entry exists. Now uses Win32Native COM methods instead of VBScript.
| string | $key | The root key (e.g., HKEY_LOCAL_MACHINE). |
| string | $subkey | The subkey path. |
| string | null | $entry | The entry name (optional). |
Definition at line 83 of file class.registry.php.
References $result, Win32Native\registryExists(), and writeLog().
| getAppBinsRegKey | ( | $fromRegistry = true | ) |
Retrieves or generates the application binaries registry key.
| bool | $fromRegistry | Determines whether to retrieve the key from the registry or generate it. |
Definition at line 238 of file class.registry.php.
References $bearsamppBins, Log\debug(), Path\formatWindowsPath(), Path\getModuleSymlinkPath(), and getValue().
| getAppPathRegKey | ( | ) |
Retrieves the application path from the registry.
Definition at line 315 of file class.registry.php.
References getValue().
| getLatestError | ( | ) |
Retrieves the latest error message.
Definition at line 391 of file class.registry.php.
References $latestError.
| getProcessorRegKey | ( | ) |
Retrieves the processor identifier from the registry.
Definition at line 377 of file class.registry.php.
References getValue().
| getSysPathRegKey | ( | ) |
Retrieves the system path from the registry.
Definition at line 346 of file class.registry.php.
References getValue().
| getValue | ( | $key, | |
| $subkey, | |||
| $entry = null ) |
Retrieves the value of a registry entry. Now uses Win32Native COM methods instead of VBScript.
| string | $key | The root key (e.g., HKEY_LOCAL_MACHINE). |
| string | $subkey | The subkey path. |
| string | null | $entry | The entry name (optional). |
Definition at line 104 of file class.registry.php.
References $bearsamppLang, $result, Lang\ERROR, Win32Native\registryGetValue(), and writeLog().
Referenced by getAppBinsRegKey(), getAppPathRegKey(), getProcessorRegKey(), and getSysPathRegKey().
| setAppBinsRegKey | ( | $value | ) |
Sets the application binaries registry key.
| string | $value | The new value for the application binaries. |
Definition at line 300 of file class.registry.php.
References setStringValue().
| setAppPathRegKey | ( | $value | ) |
Sets the application path in the registry.
| string | $value | The new value for the application path. |
Definition at line 331 of file class.registry.php.
References setStringValue().
| setExpandStringValue | ( | $key, | |
| $subkey, | |||
| $entry, | |||
| $value ) |
Sets an expanded string value in the registry.
| string | $key | The root key (e.g., HKEY_LOCAL_MACHINE). |
| string | $subkey | The subkey path. |
| string | $entry | The entry name. |
| string | $value | The value to set. |
Definition at line 148 of file class.registry.php.
References setValue().
Referenced by setSysPathRegKey().
| setStringValue | ( | $key, | |
| $subkey, | |||
| $entry, | |||
| $value ) |
Sets a string value in the registry.
| string | $key | The root key (e.g., HKEY_LOCAL_MACHINE). |
| string | $subkey | The subkey path. |
| string | $entry | The entry name. |
| string | $value | The value to set. |
Definition at line 134 of file class.registry.php.
References setValue().
Referenced by setAppBinsRegKey(), and setAppPathRegKey().
| setSysPathRegKey | ( | $value | ) |
Sets the system path in the registry.
| string | $value | The new value for the system path. |
Definition at line 362 of file class.registry.php.
References setExpandStringValue().
|
private |
Sets a value in the registry. Now uses Win32Native COM methods instead of VBScript.
| string | $key | The root key (e.g., HKEY_LOCAL_MACHINE). |
| string | $subkey | The subkey path. |
| string | $entry | The entry name. |
| string | null | $value | The value to set (optional). |
| string | $type | The type of value to set (e.g., SetStringValue). |
Definition at line 178 of file class.registry.php.
References $bearsamppLang, $result, Lang\ERROR, Batch\refreshEnvVars(), Lang\REGISTRY_SET_ERROR_TEXT, Win32Native\registryDeleteKey(), Win32Native\registryDeleteValue(), Win32Native\registryGetValue(), Win32Native\registrySetValue(), and writeLog().
Referenced by deleteValue(), setExpandStringValue(), and setStringValue().
|
private |
Writes a log entry.
| string | $log | The log message to write. |
Definition at line 68 of file class.registry.php.
References $bearsamppRoot, Log\debug(), and Path\getRegistryLogFilePath().
Referenced by deleteValue(), exists(), getValue(), and setValue().
|
private |
Definition at line 51 of file class.registry.php.
Referenced by getLatestError().
| const APP_BINS_REG_ENTRY = 'BEARSAMPP_BINS' |
Definition at line 39 of file class.registry.php.
Referenced by ActionStartup\checkBinsRegKey(), ActionStartup\checkSystemPathRegKey(), and ActionSwitchVersion\processWindow().
| const APP_PATH_REG_ENTRY = 'BEARSAMPP_PATH' |
Definition at line 42 of file class.registry.php.
Referenced by ActionStartup\checkPathRegKey(), and Batch\refreshEnvVars().
| const END_PROCESS_STR = 'FINISHED!' |
Definition at line 19 of file class.registry.php.
| const ENV_KEY = 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment' |
Definition at line 36 of file class.registry.php.
| const HKEY_CLASSES_ROOT = 'HKCR' |
Definition at line 21 of file class.registry.php.
| const HKEY_CURRENT_USER = 'HKCU' |
Definition at line 22 of file class.registry.php.
| const HKEY_LOCAL_MACHINE = 'HKLM' |
Definition at line 23 of file class.registry.php.
Referenced by ActionStartup\cleanOldBehaviors(), Nssm\infos(), BinMailpit\rebuildConf(), BinMemcached\rebuildConf(), and BinXlight\rebuildConf().
| const HKEY_USERS = 'HKEY_USERS' |
Definition at line 24 of file class.registry.php.
| const PROCESSOR_REG_ENTRY = 'Identifier' |
Definition at line 49 of file class.registry.php.
| const PROCESSOR_REG_SUBKEY = 'HARDWARE\DESCRIPTION\System\CentralProcessor\0' |
Definition at line 48 of file class.registry.php.
| const REG_BINARY = 'REG_BINARY' |
Definition at line 28 of file class.registry.php.
| const REG_DWORD = 'REG_DWORD' |
Definition at line 29 of file class.registry.php.
| const REG_ERROR_ENTRY = 'REG_ERROR_ENTRY' |
Definition at line 32 of file class.registry.php.
| const REG_ERROR_SET = 'REG_ERROR_SET' |
Definition at line 33 of file class.registry.php.
| const REG_EXPAND_SZ = 'REG_EXPAND_SZ' |
Definition at line 27 of file class.registry.php.
| const REG_MULTI_SZ = 'REG_MULTI_SZ' |
Definition at line 30 of file class.registry.php.
| const REG_NO_ERROR = 'REG_NO_ERROR' |
Definition at line 34 of file class.registry.php.
| const REG_SZ = 'REG_SZ' |
Definition at line 26 of file class.registry.php.
| const SYSPATH_REG_ENTRY = 'Path' |
Definition at line 45 of file class.registry.php.
Referenced by ActionStartup\checkSystemPathRegKey().