Vector35 / Vector35/binaryninja-api
Improved copying of data structures
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.3k
- Forks
- 298
- Avg merge
- 5d 5h
- Merged PRs (30d)
- 19
Description
I see that there is room to making a nice optimization when copying of data structures. Here is an example:
Test code:
SYSTEMTIME a;
FILETIME b;
void struct_copy()
{
SYSTEMTIME systemTime;
FILETIME filetime;
GetSystemTime(&systemTime);
SystemTimeToFileTime(&systemTime, &filetime);
a = systemTime;
b = filetime;
}
HLIL result:
void sub_140001010()
struct SYSTEMTIME systemTime
GetSystemTime(&systemTime)
struct FILETIME fileTime
SystemTimeToFileTime(&systemTime, &fileTime)
struct SYSTEMTIME* rdi = &a
struct SYSTEMTIME* rsi = &systemTime
for (int64_t rcx_2 = 0x10; rcx_2 != 0; rcx_2 = rcx_2 - 1)
rdi->wYear.b = rsi->wYear.b
rdi = &rdi->wYear + 1
rsi = &rsi->wYear + 1
int64_t rax
rax.d = fileTime.dwLowDateTime
rax:4.d = fileTime.dwHighDateTime
b.dwLowDateTime = rax.d
*(&b + 4) = rax:4.d
It would be great if binary ninja could turn these two into a simple = operation.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue provides a C example using SYSTEMTIME and FILETIME and shows the resulting HLIL. Start by reproducing this example and inspecting how these structure copies are represented. Done means both copies are emitted as simple assignment operations rather than expanded copy loops or scalar stores.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- reverse-engineering
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100