Index: src/ch/Device IO.h =================================================================== diff -u -N -rd2b121c78f510b5384b8ef0ca80afbfd7f77fef7 -r7e88d1bbb47944b6a26a0a59414cf9f9a30589bc --- src/ch/Device IO.h (.../Device IO.h) (revision d2b121c78f510b5384b8ef0ca80afbfd7f77fef7) +++ src/ch/Device IO.h (.../Device IO.h) (revision 7e88d1bbb47944b6a26a0a59414cf9f9a30589bc) @@ -98,38 +98,47 @@ } int iOffset=0, iOffset2=0; - TCHAR *pszSignature, *pszOffset; - while (iOffset < iCount) + TCHAR* pszSignature = NULL; + TCHAR* pszOffset = NULL; + while(iOffset < iCount) { - if ((iCount2=QueryDosDevice(szQuery+iOffset, szSymbolic, 1024)) == 0) - return false; - - // read values from szSymbolic and compare with szMapping - iOffset2=0; - while (iOffset2 < iCount2) + if(_tcsncmp(szQuery+iOffset, _T("STORAGE#Volume#"), _tcslen(_T("STORAGE#Volume#"))) == 0) { - // compare szSymbolic+iOffset2 with szMapping - if (_tcscmp(szMapping, szSymbolic+iOffset2) == 0 - && _tcsncmp(szQuery+iOffset, _T("STORAGE#Volume#"), _tcslen(_T("STORAGE#Volume#"))) == 0) + if((iCount2 = QueryDosDevice(szQuery+iOffset, szSymbolic, 1024)) == 0) + return false; + + // now search for 'Signature' and extract (from szQuery+iOffset) + pszSignature=_tcsstr(szQuery+iOffset, _T("Signature")); + if (pszSignature == NULL) { - // now search for 'Signature' and extract (from szQuery+iOffset) - pszSignature=_tcsstr(szQuery+iOffset, _T("Signature")); - if (pszSignature == NULL) - continue; - pszOffset=_tcsstr(pszSignature, _T("Offset")); - if (pszOffset == NULL) - continue; + iOffset+=_tcslen(szQuery+iOffset)+1; + continue; + } + pszOffset=_tcsstr(pszSignature, _T("Offset")); + if (pszOffset == NULL) + { + iOffset+=_tcslen(szQuery+iOffset)+1; + continue; + } - // for better string copying - pszOffset[0]=_T('\0'); + // for better string copying + pszOffset[0]=_T('\0'); - // found Signature & Offset - copy - int iCnt=reinterpret_cast(pszOffset)-reinterpret_cast(pszSignature)+1; - _tcsncpy(lpszBuffer, pszSignature, (iCnt > iSize) ? iSize : iCnt); - return true; - } + // read values from szSymbolic and compare with szMapping + iOffset2=0; + while (iOffset2 < iCount2) + { + // compare szSymbolic+iOffset2 with szMapping + if (_tcscmp(szMapping, szSymbolic+iOffset2) == 0) + { + // found Signature & Offset - copy + int iCnt=reinterpret_cast(pszOffset)-reinterpret_cast(pszSignature)+1; + _tcsncpy(lpszBuffer, pszSignature, (iCnt > iSize) ? iSize : iCnt); + return true; + } - iOffset2+=_tcslen(szSymbolic)+1; + iOffset2+=_tcslen(szSymbolic)+1; + } } iOffset+=_tcslen(szQuery+iOffset)+1;