View source
class RegistryUtil
package funkin.backend.utils
@:cppFileCode("\r\n#include <windows.h>\r\n#include <tchar.h>\r\n#include <string>\r\n#include <vector>\r\n")Static methods
View on GitHub
@:functionCode("\r\n\t\tHKEY hKey;\r\n\t\tLONG result;\r\n\r\n\t\tstd::wstring subkey = std::wstring(key.wchar_str());\r\n\t\tstd::wstring valname = std::wstring(string.wchar_str());\r\n\r\n\t\tresult = RegOpenKeyExW((HKEY)reinterpret_cast<HKEY>(static_cast<uintptr_t>(hive)), subkey.c_str(), 0, KEY_SET_VALUE, &hKey);\r\n\t\tif (result != ERROR_SUCCESS) return false;\r\n\r\n\t\tresult = RegDeleteValueW(hKey, valname.c_str());\r\n\t\tRegCloseKey(hKey);\r\n\r\n\t\treturn result == ERROR_SUCCESS;\r\n\t")staticdelete(hive:RegistryHive, key:String, string:String):Bool
View on GitHub
@:functionCode("\r\n\t\tHKEY hKey;\r\n\t\tLONG result;\r\n\r\n\t\tstd::wstring subkey = std::wstring(key.wchar_str());\r\n\t\tstd::wstring valname = std::wstring(string.wchar_str());\r\n\r\n\t\tresult = RegOpenKeyExW((HKEY)reinterpret_cast<HKEY>(static_cast<uintptr_t>(hive)), subkey.c_str(), 0, KEY_READ, &hKey);\r\n\t\tif (result != ERROR_SUCCESS) return false;\r\n\r\n\t\tDWORD dataType = 0;\r\n\t\tresult = RegQueryValueExW(hKey, valname.c_str(), NULL, &dataType, NULL, NULL);\r\n\r\n\t\tRegCloseKey(hKey);\r\n\r\n\t\treturn result == ERROR_SUCCESS;\r\n\t")staticexists(hive:RegistryHive, key:String, string:String):Bool
View on GitHub
@:functionCode("\r\n\t\tHKEY hKey;\r\n\t\tLONG result;\r\n\t\tDWORD dataSize = 0;\r\n\t\tDWORD dataType = 0;\r\n\r\n\t\tstd::wstring subkey = std::wstring(key.wchar_str());\r\n\t\tstd::wstring valname = std::wstring(string.wchar_str());\r\n\r\n\t\tresult = RegOpenKeyExW((HKEY)reinterpret_cast<HKEY>(static_cast<uintptr_t>(hive)), subkey.c_str(), 0, KEY_READ, &hKey);\r\n\t\tif (result != ERROR_SUCCESS) return null();\r\n\r\n\t\tresult = RegQueryValueExW(hKey, valname.c_str(), NULL, &dataType, NULL, &dataSize);\r\n\t\tif (result != ERROR_SUCCESS || dataSize == 0) {\r\n\t\t\tRegCloseKey(hKey);\r\n\t\t\treturn null();\r\n\t\t}\r\n\r\n\t\tstd::vector<wchar_t> buffer(dataSize / sizeof(wchar_t));\r\n\t\tresult = RegQueryValueExW(hKey, valname.c_str(), NULL, NULL, (LPBYTE)buffer.data(), &dataSize);\r\n\t\tRegCloseKey(hKey);\r\n\r\n\t\tif (result == ERROR_SUCCESS) {\r\n\t\t\treturn ::String(buffer.data());\r\n\t\t}\r\n\t\treturn null();\r\n\t")staticget(hive:RegistryHive, key:String, string:String):Null<String>
View on GitHub