DynamoRIO / dynamorio

Dynamic Instrumentation Tool Platform
Other
2.62k stars 554 forks source link

build own implementation of Windows system library routines needed for typical clients #1063

Open derekbruening opened 9 years ago

derekbruening commented 9 years ago

From bruen...@google.com on January 22, 2013 16:55:00

split from issue #916 .

this issue covers building our own implementation using the DR API and DR's internal syscall infrastructure, rather than building on the native API. while the latter would enable libraries that could be used for other projects, the internal allocs inside ntdll routines mean we need to redirect them and in some cases it's easier to redirect the higher-up kernel32 routine instead.

the initial goal would be to cover the 210 kernel32 routines used by the union of dbghelp, typical C++ clients, and msvcrt.

Original issue: http://code.google.com/p/dynamorio/issues/detail?id=1063

derekbruening commented 9 years ago

From bruen...@google.com on February 08, 2013 10:13:42

we should implement relative path support in issue #298

derekbruening commented 9 years ago

From bruen...@google.com on February 08, 2013 16:30:49

\ TODO redirect kernel32 forwards (xref issue #1073 )

on win7, forwards we care about: % dumpbin /exports c:/windows/syswow64/kernel32.dll | grep forwarded 205 CB DecodePointer (forwarded to NTDLL.RtlDecodePointer) 212 D2 DeleteCriticalSection (forwarded to NTDLL.RtlDeleteCriticalSection) 237 EB EncodePointer (forwarded to NTDLL.RtlEncodePointer) 241 EF EnterCriticalSection (forwarded to NTDLL.RtlEnterCriticalSection) 285 11B ExitThread (forwarded to NTDLL.RtlExitUserThread) 718 2CC HeapAlloc (forwarded to NTDLL.RtlAllocateHeap) 725 2D3 HeapReAlloc (forwarded to NTDLL.RtlReAllocateHeap) 727 2D5 HeapSize (forwarded to NTDLL.RtlSizeHeap) 742 2E4 InitializeCriticalSection (forwarded to NTDLL.RtlInitializeCriticalSection) 827 33A LeaveCriticalSection (forwarded to NTDLL.RtlLeaveCriticalSection) 1213 4BC SubmitThreadpoolWork (forwarded to NTDLL.TpPostWork)

derekbruening commented 9 years ago

From bruen...@google.com on February 08, 2013 16:31:17

should be issue #1071

derekbruening commented 9 years ago

From bruen...@google.com on March 06, 2014 13:37:24

A lot of routines have already been implemented, but we still have a ways to go. This is a good issue for incremental contributions.

Here is how to go about filling in the remaining routines:

The header files in core/win32/drwinapi/ contain the initial set of routines we'd like implemented. Find routines that are not yet present in the table in the corresponding _redir.c file. Add implementations in the appropriate .c file (in the same group as in the _redir.h file: see the banner comments there). Add unit tests at the bottom of the file.

Labels: GoodContrib