mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 20:53:50 +00:00
Vector instead of new/delete
This commit is contained in:
parent
8663177ad1
commit
b4174b6419
1 changed files with 4 additions and 6 deletions
|
@ -90,15 +90,13 @@ boost::filesystem::path WindowsPath::getInstallPath() const
|
|||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT(regkey), 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS)
|
||||
{
|
||||
//Key existed, let's try to read the install dir
|
||||
char* data = new char[4096];
|
||||
int len = 4096;
|
||||
std::vector<char> buf(512);
|
||||
int len = 512;
|
||||
|
||||
if (RegQueryValueEx(hKey, TEXT("Installed Path"), NULL, NULL, (LPBYTE)data, (LPDWORD)&len) == ERROR_SUCCESS)
|
||||
if (RegQueryValueEx(hKey, TEXT("Installed Path"), NULL, NULL, (LPBYTE)&buf[0], (LPDWORD)&len) == ERROR_SUCCESS)
|
||||
{
|
||||
installPath = data;
|
||||
installPath = &buf[0];
|
||||
}
|
||||
|
||||
delete[] data;
|
||||
}
|
||||
|
||||
return installPath;
|
||||
|
|
Loading…
Reference in a new issue