20 #define LIBSMBIOS_SOURCE
33 CmosTokenD5::CmosTokenD5(
const smbios::ISmbiosItem &initItem, std::vector< CmosRWChecksumObserver > &initChecksumList)
35 validationKey(
""), checksumList(initChecksumList)
38 const u8 *ptr =
item->getBufferCopy(size) ;
40 memcpy( const_cast<dell_protected_value_1_structure*>(&
structure), ptr, size );
41 delete []
const_cast<u8 *
>(ptr);
77 throw InvalidAccessModeImpl();
82 throw InvalidAccessModeImpl();
98 throw NeedAuthenticationImpl(
"not decoded yet");
100 bool allocatedMem =
false;
107 byteArray =
new u8[size];
111 if( size < strSize + 1 )
112 throw ParameterErrorImpl();
114 for(
unsigned int i=0; i<strSize; ++i )
127 string retval(reinterpret_cast<const char *>(byteArray));
132 allocatedMem =
false;
137 catch (
const std::exception & )
143 allocatedMem =
false;
153 throw NeedAuthenticationImpl(
"not decoded yet");
157 u8 *targetBuffer =
new u8[strSize];
160 memset(targetBuffer, 0, strSize);
161 memcpy( targetBuffer, byteArray, size < strSize ? size : strSize );
172 delete[](targetBuffer);
178 delete[](targetBuffer);
195 throw NeedAuthenticationImpl(
"not decoded yet");
222 cout <<
"Password decode code not yet present." << pw << endl;
229 std::ios::fmtflags old_opts = cout.flags ();
231 cout <<
"DMI type 0x" << hex << setfill ('0') << setw (2) << static_cast<int>(
structure.
type);
232 cout <<
" Handle 0x" << hex << setfill ('0') << setw (4) << static_cast<int>(
structure.
handle);
235 cout <<
" Type 0x" << hex << setw(4) << static_cast<int>(
getType());
237 cout <<
" STRING Length " << dec << setfill(
'0') << setw(2) <<
getStringLength() ;
240 cout.flags (old_opts);