@@ -24,91 +24,56 @@ Usage
2424API Reference
2525-------------
2626
27- DOSHeaderIsDLL
28- ^^^^^^^^^^^^^^
27+ .. c :function :: BOOL DOSHeaderIsDLL (PDOS_HEADER pDosHeader)
2928
30- .. code-block :: c
29+ Check the FileHeader Characteristics field to determine whether the PE image
30+ is marked as both executable (IMAGE_FILE_EXECUTABLE_IMAGE) and a DLL
31+ (IMAGE_FILE_DLL).
3132
32- BOOL DOSHeaderIsDLL(
33- _In_ PDOS_HEADER pDosHeader
34- );
33+ :param PDOS_HEADER pDosHeader: A pointer to the DOS header to analyze.
34+ :return: ``TRUE`` if *pDosHeader* is a DLL.
35+ :rtype: BOOL
3536
36- *pDosHeader * [in]
37- A pointer to the DOS header to check.
37+ .. c:function:: BOOL DOSHeaderIsEXE(PDOS_HEADER pDosHeader)
3838
39- ** Return value **
40- The function returns `` TRUE `` if pDosHeader appears to be representative of a
41- DLL file .
39+ Check the FileHeader Characteristics field to determine whether the PE image
40+ is marked as both executable (IMAGE_FILE_EXECUTABLE_IMAGE) and not a DLL
41+ (IMAGE_FILE_DLL) .
4242
43- DOSHeaderIsEXE
44- ^^^^^^^^^^^^^^
43+ :param PDOS_HEADER pDosHeader: A pointer to the DOS header to analyze.
44+ :return: ``TRUE`` if *pDosHeader* is an EXE.
45+ :rtype: BOOL
4546
46- .. code-block :: c
47+ .. c:function:: BOOL ReflectiveTransformerToDLL(PDOS_HEADER pDosHeader, DWORD dwAddressOfEntryPoint)
4748
48- BOOL DOSHeaderIsEXE(
49- _In_ PDOS_HEADER pDosHeader
50- );
49+ Transform the PE image pDosHeader into a DLL. This updates the FileHeader
50+ Characteristics field as necessary, updates the OptionalHeader ImageBase to
51+ the default value for DLL files and sets a new entry point.
5152
52- *pDosHeader * [in]
53- A pointer to the DOS header to check.
53+ :param PDOS_HEADER pDosHeader: A pointer to the DOS header transform.
54+ :param DWORD dwAddressOfEntryPoint: The RVA of the new entry point for the PE image.
55+ :return: ``TRUE`` on success.
56+ :rtype: BOOL
5457
55- **Return value **
56- The function returns ``TRUE `` if pDosHeader appears to be representative of
57- an EXE file.
58+ .. c:function:: BOOL ReflectiveTransformerToEXE(PDOS_HEADER pDosHeader, DWORD dwAddressOfEntryPoint)
5859
59- RVAFromExportName
60- ^^^^^^^^^^^^^^^^^
60+ Transform the PE image pDosHeader into an EXE. This updates the FileHeader
61+ Characteristics field as necessary, updates the OptionalHeader ImageBase to
62+ the default value for EXE files and sets a new entry point.
6163
62- .. code-block :: c
64+ :param PDOS_HEADER pDosHeader: A pointer to the DOS header transform.
65+ :param DWORD dwAddressOfEntryPoint: The RVA of the new entry point for the PE image.
66+ :return: ``TRUE`` on success.
67+ :rtype: BOOL
6368
64- DWORD RVAFromExportName(
65- _In_ PDOS_HEADER pDosHeader,
66- _In_ LPCSTR lpProcName
67- );
69+ .. c:function:: DWORD RVAFromExportName(PDOS_HEADER pDosHeader, LPCSTR lpProcName)
6870
69- *pDosHeader * [in]
70- A pointer to the DOS header of the PE image to resolve the export from.
71+ Get the relative virtual address (RVA) of an exported function by it's name
72+ from an unloaded PE image. The return value can then be used as the
73+ *dwAddressOfEntryPoint* argument to the ``ReflectiveTransformerTo*`` set of
74+ functions.
7175
72- *lpProcName * [in]
73- A pointer to the name of the exported function to resolve the RVA for.
74-
75- **Return value **
76- The function returns a non-zero value on success.
77-
78- ReflectiveTransformerToDLL
79- ^^^^^^^^^^^^^^^^^^^^^^^^^^
80-
81- .. code-block :: c
82-
83- BOOL ReflectiveTransformerToDLL(
84- _In_ PDOS_HEADER pDosHeader,
85- _In_ DWORD dwAddressOfEntryPoint
86- );
87-
88- *pDosHeader * [in]
89- A pointer to the DOS header transform.
90-
91- *dwAddressOfEntryPoint * [in]
92- The RVA of the new entry point for the PE image.
93-
94- **Return value **
95- The function returns ``TRUE `` on success.
96-
97- ReflectiveTransformerToEXE
98- ^^^^^^^^^^^^^^^^^^^^^^^^^^
99-
100- .. code-block :: c
101-
102- BOOL ReflectiveTransformerToEXE(
103- _In_ PDOS_HEADER pDosHeader,
104- _In_ DWORD dwAddressOfEntryPoint
105- );
106-
107- *pDosHeader * [in]
108- A pointer to the DOS header transform.
109-
110- *dwAddressOfEntryPoint * [in]
111- The RVA of the new entry point for the PE image.
112-
113- **Return value **
114- The function returns ``TRUE `` on success.
76+ :param PDOS_HEADER pDosHeader: A pointer to the DOS header of the PE image to resolve the export from.
77+ :param LPCSTR lpProcName: A pointer to the name of the exported function to resolve the RVA for.
78+ :return: The function returns a non-zero value on success.
79+ :rtype: DWORD
0 commit comments