Skip to content

Commit

Permalink
feat: implement modulerefs in dotnet module.
Browse files Browse the repository at this point in the history
  • Loading branch information
plusvic committed Mar 17, 2024
1 parent bfba792 commit 6f32a08
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 5 deletions.
11 changes: 11 additions & 0 deletions lib/src/modules/dotnet/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2689,6 +2689,13 @@ impl From<Dotnet<'_>> for protos::dotnet::Dotnet {
dotnet.assembly_refs.iter().map(protos::dotnet::AssemblyRef::from),
);

result.modulerefs.extend(
dotnet
.module_refs
.iter()
.filter_map(|module_ref| module_ref.map(|s| s.to_string())),
);

result.streams.extend(
dotnet.stream_headers.iter().map(protos::dotnet::Stream::from),
);
Expand Down Expand Up @@ -2728,6 +2735,10 @@ impl From<Dotnet<'_>> for protos::dotnet::Dotnet {
result.constants.len().try_into().unwrap(),
);

result.set_number_of_modulerefs(
result.modulerefs.len().try_into().unwrap(),
);

result
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ number_of_guids: 1
number_of_resources: 1
number_of_classes: 4
number_of_assembly_refs: 4
number_of_modulerefs: 2
number_of_user_strings: 10
number_of_constants: 3
typelib: "286e82a5-8e28-4288-b175-0099b68f4880"
Expand Down Expand Up @@ -410,4 +411,7 @@ user_strings:
- "*\000=\000L\000o\000a\000d\000 \000D\000N\000G\000u\000a\000r\000d\000 \000R\000u\000n\000t\000i\000m\000e\000 \000l\000i\000b\000r\000a\000r\000y\000 \000f\000a\000i\000l\000e\000d\000,\000 \000r\000u\000n\000t\000i\000m\000e\000 \000l\000i\000b\000r\000a\000r\000y\000 \000n\000o\000t\000 \000f\000o\000u\000n\000d\000 \000o\000r\000 \000A\000c\000c\000e\000s\000s\000 \000D\000e\000n\000i\000e\000d\000.\000=\000*\000[\000O\000c\000t\000o\000p\000u\000s\000R\000P\000A\000.\000C\000s\000v\000.\000d\000l\000l\000]\000"
- "E\000r\000r\000o\000r\000,\000 \000D\000N\000G\000u\000a\000r\000d\000 \000R\000u\000n\000t\000i\000m\000e\000 \000l\000i\000b\000r\000a\000r\000y\000 \000n\000o\000t\000 \000l\000o\000a\000d\000e\000d\000!\000"
- "A\000 \000n\000e\000w\000e\000r\000 \000v\000e\000r\000s\000i\000o\000n\000 \000o\000f\000 \000D\000N\000G\000u\000a\000r\000d\000 \000R\000u\000n\000t\000i\000m\000e\000 \000l\000i\000b\000r\000a\000r\000y\000 \000i\000s\000 \000n\000e\000e\000d\000e\000d\000 \000t\000o\000 \000r\000u\000n\000 \000t\000h\000i\000s\000 \000a\000p\000p\000l\000i\000c\000a\000t\000i\000o\000n\000.\000"
- "[\000*\000=\000*\000]\000T\000h\000i\000s\000 \000a\000p\000p\000l\000i\000c\000a\000t\000i\000o\000n\000 \000i\000s\000 \000e\000x\000p\000i\000r\000e\000d\000 \000!\000[\000*\000=\000*\000]\000"
- "[\000*\000=\000*\000]\000T\000h\000i\000s\000 \000a\000p\000p\000l\000i\000c\000a\000t\000i\000o\000n\000 \000i\000s\000 \000e\000x\000p\000i\000r\000e\000d\000 \000!\000[\000*\000=\000*\000]\000"
modulerefs:
- "OctopusRPA.Common.dll"
- "OctopusRPA.Common64.dll"
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ number_of_guids: 1
number_of_resources: 0
number_of_classes: 8
number_of_assembly_refs: 3
number_of_modulerefs: 0
number_of_user_strings: 8
number_of_constants: 0
streams:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ number_of_guids: 1
number_of_resources: 0
number_of_classes: 24
number_of_assembly_refs: 1
number_of_modulerefs: 0
number_of_user_strings: 1
number_of_constants: 0
typelib: "63ca6b3c-208c-47ef-9294-fbc91c947d15"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ number_of_guids: 1
number_of_resources: 0
number_of_classes: 0
number_of_assembly_refs: 0
number_of_modulerefs: 0
number_of_user_strings: 10
number_of_constants: 0
streams:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ number_of_guids: 1
number_of_resources: 0
number_of_classes: 12
number_of_assembly_refs: 1
number_of_modulerefs: 0
number_of_user_strings: 0
number_of_constants: 40
streams:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ number_of_guids: 16
number_of_resources: 1
number_of_classes: 297
number_of_assembly_refs: 4
number_of_modulerefs: 0
number_of_user_strings: 0
number_of_constants: 0
streams:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ number_of_guids: 1
number_of_resources: 1
number_of_classes: 31
number_of_assembly_refs: 2
number_of_modulerefs: 2
number_of_user_strings: 45
number_of_constants: 0
streams:
Expand Down Expand Up @@ -2085,4 +2086,7 @@ user_strings:
- "w\000s\0002\000_\0003\0002\000.\000d\000l\000l\000"
- "G\000e\000t\000A\000d\000d\000r\000I\000n\000f\000o\000E\000x\000C\000a\000n\000c\000e\000l\000"
- "G\000e\000t\000A\000d\000d\000r\000I\000n\000f\000o\000E\000x\000C\000a\000n\000c\000e\000l\000 \000r\000e\000t\000u\000r\000n\000e\000d\000 \000e\000r\000r\000o\000r\000 \000{\0000\000}\000"
- "R\000e\000g\000i\000s\000t\000e\000r\000F\000o\000r\000C\000a\000n\000c\000e\000l\000l\000a\000t\000i\000o\000n\000"
- "R\000e\000g\000i\000s\000t\000e\000r\000F\000o\000r\000C\000a\000n\000c\000e\000l\000l\000a\000t\000i\000o\000n\000"
modulerefs:
- "kernel32.dll"
- "ws2_32.dll"
7 changes: 4 additions & 3 deletions lib/src/modules/protos/dotnet.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ message Dotnet {
optional bool is_dotnet = 1;
optional string module_name = 2;
optional bytes version = 3; // TODO: should be string?

optional uint64 number_of_streams = 4;
optional uint64 number_of_guids = 5;
optional uint64 number_of_resources = 6;
Expand All @@ -32,11 +32,12 @@ message Dotnet {
repeated string guids = 18;
repeated bytes constants = 19;
optional Assembly assembly = 20;
repeated AssemblyRef assembly_refs = 21;
repeated AssemblyRef assembly_refs = 21;
repeated Resource resources = 22;
repeated Class classes = 23;
repeated uint32 field_offsets = 24;
repeated bytes user_strings = 25;
repeated string modulerefs = 26;
}

message Assembly {
Expand Down Expand Up @@ -90,7 +91,7 @@ message Method {
optional string name = 1;
optional string visibility = 2;
required bool abstract = 3;
required bool static= 4;
required bool static = 4;
required bool virtual = 5;
required bool final = 6;
optional string return_type = 7;
Expand Down

0 comments on commit 6f32a08

Please sign in to comment.