Skip to content

Commit 8f10b20

Browse files
committed
Fix make enum bug, unify more type-change items.
1 parent 274fa95 commit 8f10b20

3 files changed

Lines changed: 21 additions & 0 deletions

File tree

ui/flowgraphwidget.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ class BINARYNINJAUIAPI FlowGraphWidget :
401401
void makeDouble();
402402
void cycleFloatSize();
403403
void makePtr();
404+
void makeEnum();
404405
void makeString(size_t charSize = 1);
405406
void toggleIntegerSignedness();
406407

ui/linearview.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#define LINEAR_VIEW_UPDATE_CHECK_INTERVAL 200
2222
#define MAX_STRING_TYPE_LENGTH 1048576
2323

24+
struct StructureMemberTypeActionContext;
25+
2426
/*!
2527
2628
\defgroup linearview LinearView
@@ -313,6 +315,11 @@ class BINARYNINJAUIAPI LinearView : public QAbstractScrollArea, public View, pub
313315
StructureRef defineInnerSign(TypeRef type, uint64_t offset, uint64_t size, std::set<TypeRef>& seen);
314316
TypeRef getPointerTypeAndName(ArchitectureRef arch, uint64_t addr, std::string& name);
315317
std::string getVariableName(uint64_t addr);
318+
bool getSelectedStructureMemberForTypeAction(
319+
const UIActionContext& context, StructureMemberTypeActionContext& memberContext);
320+
bool canMakeEnum(const UIActionContext& context);
321+
void makeEnum(const UIActionContext& context);
322+
bool makeEnumForSelectedStructureMember(const UIActionContext& context, TypeRef enumType);
316323

317324
BinaryNinja::Ref<BinaryNinja::LinearViewObject> createLinearViewObject();
318325
LinearViewCursorPosition getPositionForCursor(BinaryNinja::LinearViewCursor* cursor);

ui/util.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,19 @@ bool BINARYNINJAUIAPI toggleLocalVariableIntegerSignedness(BinaryViewRef view, F
3737
bool BINARYNINJAUIAPI setLocalVariableFloatWidth(BinaryViewRef view, FunctionRef func, BinaryNinja::Variable var, size_t width);
3838
bool BINARYNINJAUIAPI cycleLocalVariableFloatWidth(BinaryViewRef view, FunctionRef func, BinaryNinja::Variable var);
3939
bool BINARYNINJAUIAPI makeLocalVariablePointer(BinaryViewRef view, FunctionRef func, BinaryNinja::Variable var);
40+
bool BINARYNINJAUIAPI makeLocalVariableEnum(
41+
BinaryViewRef view, FunctionRef func, BinaryNinja::Variable var, TypeRef enumType);
42+
struct BINARYNINJAUIAPI StructureMemberTypeActionContext
43+
{
44+
BinaryNinja::DataVariable var;
45+
TypeRef rootType;
46+
BinaryNinja::QualifiedName rootName;
47+
TypeRef parentType;
48+
size_t fieldIndex = (size_t)-1;
49+
TypeRef fieldType;
50+
};
51+
bool BINARYNINJAUIAPI replaceStructureMemberType(
52+
BinaryViewRef view, const StructureMemberTypeActionContext& memberContext, TypeRef newType);
4053
bool BINARYNINJAUIAPI getIntegerDataVariableDisplayValue(
4154
const UIActionContext& context, uint64_t& value, size_t& width, bool& isSigned);
4255
QString BINARYNINJAUIAPI getIntegerDisplayActionName(

0 commit comments

Comments
 (0)