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){
|
if(lnExists == ERROR_SUCCESS){
|
||||||
|
|
||||||
DWORD dwLength;
|
DWORD dwLength;
|
||||||
char *Buff = new char[intMaxRegValueLength];
|
DWORD nResult(0);
|
||||||
|
|
||||||
long 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_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);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(lngStatus == ERROR_SUCCESS){
|
if(lngStatus == ERROR_SUCCESS){
|
||||||
|
intReturn = nResult + 1;
|
||||||
int intLast = (int)Buff[0];
|
|
||||||
intReturn = intLast + 1;
|
|
||||||
} else {
|
} else {
|
||||||
intReturn = 1;
|
intReturn = 1;
|
||||||
}
|
}
|
||||||
delete Buff;
|
|
||||||
|
|
||||||
DWORD dwVal = intReturn;
|
DWORD dwVal = intReturn;
|
||||||
|
|
||||||
RegSetValueEx (hk, L"LastUsedId", 0L, REG_DWORD, (CONST BYTE*) &dwVal, sizeof(DWORD));
|
RegSetValueEx (hk, L"LastUsedId", 0L, REG_DWORD, (CONST BYTE*) &dwVal, sizeof(DWORD));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue