Pages

2013-12-30

xbionic - ntdll.dll (Windows Native APIs)


1. [ntdll.dll] Header and Code from the scratch

    For implementing the system-call of Linux, Windows Native APIs will be used.
    And the API-set will be re-written from the scrach.

    [WinDDK] has the useful package to start, but that is too complicate.

    So, the structures and functions are extracted one by one whenever it is used.


2. Current Codes

    The porting process is on the stable stage, so the file system is almost fixed.
    See the below files :

    - Main Headers
       https://github.com/webos21/xbionic/blob/master/lib/mingw32/include/ntstatus.h
       https://github.com/webos21/xbionic/blob/master/lib/mingw32/include/nttypes.h
       https://github.com/webos21/xbionic/blob/master/lib/mingw32/include/ntdll.h
       https://github.com/webos21/xbionic/blob/master/lib/mingw32/include/ntsock.h

    - Supporting Headers
       https://github.com/webos21/xbionic/blob/master/lib/mingw32/include/poppack.h
       https://github.com/webos21/xbionic/blob/master/lib/mingw32/include/pshpack1.h
       https://github.com/webos21/xbionic/blob/master/lib/mingw32/include/pshpack2.h
       https://github.com/webos21/xbionic/blob/master/lib/mingw32/include/pshpack4.h
       https://github.com/webos21/xbionic/blob/master/lib/mingw32/include/pshpack8.h

    - Implementing Source
       https://github.com/webos21/xbionic/blob/master/xbionic/libc/arch-win/_nt_imp/ntdll.c
       https://github.com/webos21/xbionic/blob/master/xbionic/libc/arch-win/_nt_imp/ntsock.c

xbionic - bionic libc for windows


1. What is [xbionic]


1-1. Bionic Libc

    Android has the own standard c library, Bionic Libc.
    It is just for the Linux OS, more precisely the Linux Kernel.

    The implementation is very dependent on the System Call of Linux.
    Because it stands for providing the light-weight standard c library, so it is natural.

    Android version 4.4 (codename KitKat) has began to support the 64-bit CPU.
    So, the Bionic Libc is evolving to support it.


1-2. Cygwin & MinGW for Developing on Windows

    Cygwin(or MinGW) is the best choice to develop on Windows OS.

    But, there is some missing features. For example, [the Group Source on Multicast],
    [Getting the list of Ethernet Interfaces], [Socket Options], [Signal] and so on.

    Inspite of these missing features, it is quite useful.


1-3. Bionic Libc for Windows
    For overcome the missing features of Cygwin(or MinGW) and getting more flexible
    standard c library, it is started the porting Bionic Libc on Windows 7.

    [xbionic] is that project.  And, it is also the begining of Android Platform for Windows.
    That means running the Android Apps directly on Windows without QEMU.


2. the Way to port the Bionic Libc on Windows

2-1. only use the [ntdll.dll]

    [ntdll.dll] has the Windows Native API.  It is not documented by Microsoft.
    But, [WinDDK] has small piece of reference code and documents,
    and the undocumented project of NTinternal - http://undocumented.ntinternals.net/ -
    has the good API documents.  Also, the ReactOS Project has the good usage.

    On the source tree of Bionic Libc, libc/arch-x86 is the base directory
    to fork the [arch-win].
    And the implementation of linux system-call is re-written by Windows Native APIs.


2-2. Building System

    Same as any other android libraries, bionic libc has android building system
    - [Android.mk].

    But, I need the independent building system, so the Make and ANT is used
    for compiling and linking the project.


2-3. VCS - GitHub

    The project is started on GitHub.  https://github.com/webos21/xbionic.git
    Anyone can participate and help.