Fix to allow storage of more than 127 devices in Windows. Closes #95
This commit is contained in:
parent
e89d0a29f8
commit
c364302037
1 changed files with 3 additions and 15 deletions
|
@ -120,28 +120,16 @@ int Settings::getNextDeviceId() const {
|
|||
if(lnExists == ERROR_SUCCESS){
|
||||
|
||||
DWORD dwLength;
|
||||
char *Buff = new char[intMaxRegValueLength];
|
||||
DWORD nResult(0);
|
||||
|
||||
long lngStatus = RegQueryValueEx(hk, L"LastUsedId", NULL, NULL, (LPBYTE)Buff, &dwLength);
|
||||
|
||||
if(lngStatus == ERROR_MORE_DATA){
|
||||
//The buffer is to small, recreate it
|
||||
delete Buff;
|
||||
Buff = new char[dwLength];
|
||||
lngStatus = RegQueryValueEx(hk, L"LastUsedId", NULL, NULL, (LPBYTE)Buff, &dwLength);
|
||||
}
|
||||
long lngStatus = RegQueryValueEx(hk, L"LastUsedId", NULL, NULL, reinterpret_cast<LPBYTE>(&nResult), &dwLength); //(LPBYTE)Buff, &dwLength);
|
||||
|
||||
if(lngStatus == ERROR_SUCCESS){
|
||||
|
||||
int intLast = (int)Buff[0];
|
||||
intReturn = intLast + 1;
|
||||
intReturn = nResult + 1;
|
||||
} else {
|
||||
intReturn = 1;
|
||||
}
|
||||
delete Buff;
|
||||
|
||||
DWORD dwVal = intReturn;
|
||||
|
||||
RegSetValueEx (hk, L"LastUsedId", 0L, REG_DWORD, (CONST BYTE*) &dwVal, sizeof(DWORD));
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue