Implement a handle manager
See original GitHub issueHandles are currently hacked in. Add a handle manager that allows something like this:
def ZwCreateFile_syscall(...):
handle_data = (...)
hFile = dp.handles.new(data)
return hFile
def ZwReadFile_syscall(hFile: HANDLE, ...):
handle_data = dp.handles.get(hFile, None)
return
def ZwCloseHandle(hFile):
dp.handles.close(hFile)
It should also support duplication (every handle points to refcounted data).
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
How to Be a Good Manager - Business News Daily
A good leader sets a positive example and knows how to use their strengths to help their team achieve goals. Successful managers get...
Read more >4 Strategies Good Managers Use to Handle Their Problem ...
1. Prepare ahead. Great managers will analyze the problem first to understand all perspectives. · 2. Know the right timing and approach ·...
Read more >3 Steps to Better Handle Conflict with Your Boss | LSA Global
Handling conflict with your boss as a new manager is not easy. Managing your team is hard enough. You need your boss on...
Read more >6 Tips to Improve Manager Effectiveness at Your Company
They trust managers because they believe them to be competent, honest and reliable. You can instill trust for your leadership in three ways:...
Read more >How To Address Management Issues at Work: 6 Steps To Take
Strategies for managing issues at work. You can use the following strategies to handle issues at work: Develop your management skills. Here are ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Just had another look, saw you renamed the member to
handlesalready, thanks!For
__find_free_handleI guess you could just implement it without reusing handles to keep things simple. Another approach would be to keep a free list and only increase the handle count when there is nothing available in the free list. This is O(1).For the
getfunction I think you have to& ~3(or similar) because some lower bits of the handle value are ignored (don’t have a reference right now, but I can test later).The storage of a
dictI think is fine to start with, but eventually I suspect it could turn into a mess. An alternative would be to have a typed API, something like:This would allow for full flexibility. Optionally there could be a
HandleDatabase class that stores metadata like creation time, call stack (python and/or native) and tracing if desired.I guess an exception could be used to generically handle this in syscalls? I think I confused the behavior with process IDs…