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

shellext: ensure cmenu translation strings are zero terminated

when reading from registry

Changeset a0844bf36a11

Parent 6312c431a02c

by Adrian Buehlmann

Changes to one file · Browse files at a0844bf36a11 Showing diff from parent 6312c431a02c Diff from another changeset...

 
152
153
154
155
 
156
157
158
159
160
161
162
163
164
165
166
167
 
 
168
169
170
171
 
 
 
 
172
173
174
 
152
153
154
 
155
156
 
 
 
 
 
 
 
 
 
 
 
157
158
159
160
 
 
161
162
163
164
165
166
167
@@ -152,23 +152,16 @@
  LONG rv = RegOpenKeyExA(   HKEY_CURRENT_USER, subkey.c_str(), 0, KEY_READ, &hkey);   - if (rv == ERROR_SUCCESS && hkey) + if (rv != ERROR_SUCCESS || !hkey)   { - BYTE Data[MAX_PATH] = ""; - DWORD cbData = MAX_PATH * sizeof(BYTE); - - rv = RegQueryValueExA(hkey, "menuText", 0, 0, Data, &cbData); - if (rv == ERROR_SUCCESS) - menuText = reinterpret_cast<const char*>(&Data); - - cbData = MAX_PATH * sizeof(BYTE); - rv = RegQueryValueExA(hkey, "helpText", 0, 0, Data, &cbData); - if (rv == ERROR_SUCCESS) - helpText = reinterpret_cast<const char*>(&Data); + TDEBUG_TRACE("GetCMenuTranslation: RegOpenKeyExA(" << subkey << ") failed"); + return;   }   - if (hkey) - RegCloseKey(hkey); + GetRegSZValue(hkey, "menuText", menuText); + GetRegSZValue(hkey, "helpText", helpText); + + RegCloseKey(hkey);  }