MCPcopy Create free account
hub / github.com/assaultcube/AC / getregszvalue

Function getregszvalue

source/src/stream.cpp:152–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150
151#ifdef WIN32
152char *getregszvalue(HKEY root, const char *keystr, const char *query)
153{
154 HKEY key;
155 if(RegOpenKeyEx(HKEY_CURRENT_USER, keystr, 0, KEY_READ, &key)==ERROR_SUCCESS)
156 {
157 DWORD type = 0, len = 0;
158 if(RegQueryValueEx(key, query, 0, &type, 0, &len)==ERROR_SUCCESS && type==REG_SZ)
159 {
160 char *val = new char[len];
161 long result = RegQueryValueEx(key, query, 0, &type, (uchar *)val, &len);
162 if(result==ERROR_SUCCESS)
163 {
164 RegCloseKey(key);
165 val[len-1] = '\0';
166 return val;
167 }
168 delete[] val;
169 }
170 RegCloseKey(key);
171 }
172 return NULL;
173}
174#endif
175
176void sethomedir(const char *dir)

Callers 1

sethomedirFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected