Changeset 87578 in vbox for trunk/src/VBox/Main/src-server/win
- Timestamp:
- Feb 3, 2021 3:43:22 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 142606
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/win/HostDnsServiceWin.cpp
r83794 r87578 42 42 #include <vector> 43 43 44 static inline int registerNotification(const HKEY& hKey, HANDLE& hEvent); 45 static void appendTokenizedStrings(std::vector<std::string> &vecStrings, const std::string &strToAppend, char chDelim = ' '); 44 45 DECLINLINE(int) registerNotification(const HKEY &hKey, HANDLE &hEvent) 46 { 47 LONG lrc = RegNotifyChangeKeyValue(hKey, 48 TRUE, 49 REG_NOTIFY_CHANGE_LAST_SET, 50 hEvent, 51 TRUE); 52 AssertMsgReturn(lrc == ERROR_SUCCESS, 53 ("Failed to register event on the key. Please debug me!"), 54 VERR_INTERNAL_ERROR); 55 56 return VINF_SUCCESS; 57 } 58 59 static void appendTokenizedStrings(std::vector<std::string> &vecStrings, const std::string &strToAppend, char chDelim /* = ' ' */) 60 { 61 if (strToAppend.empty()) 62 return; 63 64 std::istringstream stream(strToAppend); 65 std::string substr; 66 67 while (std::getline(stream, substr, chDelim)) 68 { 69 if (substr.empty()) 70 continue; 71 72 if (std::find(vecStrings.cbegin(), vecStrings.cend(), substr) != vecStrings.cend()) 73 continue; 74 75 vecStrings.push_back(substr); 76 } 77 } 78 46 79 47 80 struct HostDnsServiceWin::Data … … 444 477 } 445 478 446 static inline int registerNotification(const HKEY& hKey, HANDLE& hEvent)447 {448 LONG lrc = RegNotifyChangeKeyValue(hKey,449 TRUE,450 REG_NOTIFY_CHANGE_LAST_SET,451 hEvent,452 TRUE);453 AssertMsgReturn(lrc == ERROR_SUCCESS,454 ("Failed to register event on the key. Please debug me!"),455 VERR_INTERNAL_ERROR);456 457 return VINF_SUCCESS;458 }459 460 static void appendTokenizedStrings(std::vector<std::string> &vecStrings, const std::string &strToAppend, char chDelim /* = ' ' */)461 {462 if (strToAppend.empty())463 return;464 465 std::istringstream stream(strToAppend);466 std::string substr;467 468 while (std::getline(stream, substr, chDelim))469 {470 if (substr.empty())471 continue;472 473 if (std::find(vecStrings.cbegin(), vecStrings.cend(), substr) != vecStrings.cend())474 continue;475 476 vecStrings.push_back(substr);477 }478 }479
Note:
See TracChangeset
for help on using the changeset viewer.