Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8, 0.8.1, and 0.8.2

shellext/TortoiseUtils: new function GetRegistryConfig

Changeset b61881c0be9c

Parent ae1d723870ef

by Adrian Buehlmann

Changes to 2 files · Browse files at b61881c0be9c Showing diff from parent ae1d723870ef Diff from another changeset...

 
87
88
89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
91
92
 
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
@@ -87,6 +87,32 @@
  return result;  }   + +int GetRegistryConfig(const std::string& name, std::string& res) +{ + std::string subkey = "Software\\TortoiseHg"; + HKEY hkey = 0; + + LONG rv = RegOpenKeyExA( + HKEY_CURRENT_USER, subkey.c_str(), 0, KEY_READ, &hkey); + + if (rv != ERROR_SUCCESS || hkey == 0) + return 0; + + BYTE Data[MAX_PATH] = ""; + DWORD cbData = MAX_PATH * sizeof(char); + + rv = RegQueryValueExA( + hkey, name.c_str(), 0, 0, Data, &cbData); + + if (rv != ERROR_SUCCESS) + return 0; + + res = reinterpret_cast<char*>(&Data); + return 1; +} + +  // Start an external command  // Note: if the command is a batch file and the [full] path to the  // batch contains spaces, the path must be double-quoted.
 
35
36
37
 
38
39
 
35
36
37
38
39
40
@@ -35,5 +35,6 @@
 HICON GetTortoiseIcon(const std::string & iconname);  std::string GetHgRepoRoot(const std::string& path);  bool IsHgRepo(const std::string& path); +int GetRegistryConfig(const std::string& name, std::string& res);    #endif