1
0
Fork 0

View and copy raw string

This commit is contained in:
torusrxxx 2017-12-31 20:12:38 +08:00 committed by Duncan Ogilvie
parent 39f78b1c33
commit 164d8b0730
2 changed files with 17 additions and 0 deletions

View File

@ -2,6 +2,7 @@
#include "ui_DataCopyDialog.h"
#include "Bridge.h"
#include <QCryptographicHash>
#include <QTextCodec>
#define AF_INET6 23 // Internetwork Version 6
typedef PCTSTR(__stdcall* INETNTOPW)(INT Family, PVOID pAddr, wchar_t* pStringBuf, size_t StringBufSize);
@ -19,6 +20,8 @@ DataCopyDialog::DataCopyDialog(const QVector<byte_t>* data, QWidget* parent) : Q
mTypes[DataCString] = FormatType { tr("C-Style String"), 1 };
mTypes[DataCUnicodeString] = FormatType { tr("C-Style Unicode String"), 1 };
mTypes[DataCShellcodeString] = FormatType { tr("C-Style Shellcode String"), 1 };
mTypes[DataString] = FormatType { tr("String"), 1 };
mTypes[DataUnicodeString] = FormatType { tr("Unicode String"), 1 };
mTypes[DataPascalByte] = FormatType { tr("Pascal BYTE (Hex)"), 42 };
mTypes[DataPascalWord] = FormatType { tr("Pascal WORD (Hex)"), 21 };
mTypes[DataPascalDword] = FormatType { tr("Pascal DWORD (Hex)"), 10 };
@ -219,6 +222,18 @@ void DataCopyDialog::printData(DataType type)
}
break;
case DataString:
{
data = QTextCodec::codecForLocale()->makeDecoder()->toUnicode((const char*)(mData->data()), mData->size());
}
break;
case DataUnicodeString:
{
data = QString::fromUtf16((const ushort*)(mData->data()), mData->size() / sizeof(ushort));
}
break;
case DataPascalByte:
{
data += QString().sprintf("Array [1..%u] of Byte = (\n", mData->size());

View File

@ -37,6 +37,8 @@ private:
DataCString,
DataCUnicodeString,
DataCShellcodeString,
DataString,
DataUnicodeString,
DataPascalByte,
DataPascalWord,
DataPascalDword,