diff options
author | Yuri Benditovich <yuri.benditovich@daynix.com> | 2019-03-14 11:30:35 +0200 |
---|---|---|
committer | Yan Vugenfirer <yan@daynix.com> | 2019-04-15 11:19:13 +0300 |
commit | 12f71a300bd13344a59d17ea905d0b59b22cd74e (patch) | |
tree | 0e5d762ad4b953224b423dd8e0961158dcb7c227 | |
parent | fe0a2ca00568d93cee7e144e0b5e5d537985b50b (diff) |
implement read/write/compare operations for extended rules
This commit adds implementation of registry operation for
extended rules in user-mode. Kernel driver still recognizes
all the entries as default ones (it ignores the Type value).
Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
-rw-r--r-- | UsbDk/HideRulesRegPublic.h | 1 | ||||
-rw-r--r-- | UsbDkHelper/RuleManager.cpp | 5 |
2 files changed, 5 insertions, 1 deletions
diff --git a/UsbDk/HideRulesRegPublic.h b/UsbDk/HideRulesRegPublic.h index 1a028e0..ecd3a9a 100644 --- a/UsbDk/HideRulesRegPublic.h +++ b/UsbDk/HideRulesRegPublic.h @@ -31,6 +31,7 @@ #define USBDK_HIDE_RULE_PID TEXT("PID") #define USBDK_HIDE_RULE_BCD TEXT("BCD") #define USBDK_HIDE_RULE_CLASS TEXT("Class") +#define USBDK_HIDE_RULE_TYPE TEXT("Type") #define USBDK_HIDE_RULES_PATH TEXT("SYSTEM\\CurrentControlSet\\Services\\") \ USBDK_DRIVER_NAME TEXT("\\") \ diff --git a/UsbDkHelper/RuleManager.cpp b/UsbDkHelper/RuleManager.cpp index 80fe36c..24845e2 100644 --- a/UsbDkHelper/RuleManager.cpp +++ b/UsbDkHelper/RuleManager.cpp @@ -16,7 +16,8 @@ static bool operator == (const USB_DK_HIDE_RULE& r1, const USB_DK_HIDE_RULE& r2) (r1.PID == r2.PID) && (r1.BCD == r2.BCD) && (r1.Class == r2.Class) && - (r1.Hide == r2.Hide); + (r1.Hide == r2.Hide) && + (r1.Type == r2.Type); } DWORD CRulesManager::ReadDword(LPCTSTR RuleName, LPCTSTR ValueName) const @@ -53,6 +54,7 @@ ULONG64 CRulesManager::ReadBool(LPCTSTR RuleName, LPCTSTR ValueName) const void CRulesManager::ReadRule(LPCTSTR RuleName, USB_DK_HIDE_RULE &Rule) const { + Rule.Type = ReadDword(RuleName, USBDK_HIDE_RULE_TYPE); Rule.Hide = ReadBool(RuleName, USBDK_HIDE_RULE_SHOULD_HIDE); Rule.VID = ReadDwordMask(RuleName, USBDK_HIDE_RULE_VID); Rule.PID = ReadDwordMask(RuleName, USBDK_HIDE_RULE_PID); @@ -106,6 +108,7 @@ void CRulesManager::AddRule(const USB_DK_HIDE_RULE &Rule) throw UsbDkRuleManagerException(TEXT("Failed to create rule key"), ERROR_FUNCTION_FAILED); } + WriteDword(RuleName, USBDK_HIDE_RULE_TYPE, static_cast<ULONG>(Rule.Type)); WriteDword(RuleName, USBDK_HIDE_RULE_SHOULD_HIDE, static_cast<ULONG>(Rule.Hide)); WriteDword(RuleName, USBDK_HIDE_RULE_VID, static_cast<ULONG>(Rule.VID)); WriteDword(RuleName, USBDK_HIDE_RULE_PID, static_cast<ULONG>(Rule.PID)); |