Check return code from hid_get_serial_number_string() in GetSerialString()
Amended for code style by Adam Honse <calcprogrammer1@gmail.com>
This commit is contained in:
parent
4e4eade335
commit
22acdd1fed
37 changed files with 217 additions and 37 deletions
|
|
@ -31,7 +31,12 @@ std::string DuckyKeyboardController::GetDeviceLocation()
|
|||
std::string DuckyKeyboardController::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
hid_get_serial_number_string(dev, serial_string, 128);
|
||||
int ret = hid_get_serial_number_string(dev, serial_string, 128);
|
||||
|
||||
if(ret != 0)
|
||||
{
|
||||
return("");
|
||||
}
|
||||
|
||||
std::wstring return_wstring = serial_string;
|
||||
std::string return_string(return_wstring.begin(), return_wstring.end());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue