1532{
1535 ULONG_PTR DllBase, InitStart, InitEnd, ImageEnd, InitCode;
1541
1542
1544
1545
1547
1548
1556
1557
1560 {
1561
1564
1565
1566
1568 {
1569
1570 NextEntry = NextEntry->
Flink;
1571 continue;
1572 }
1573
1574
1576 if (!NtHeader)
1577 {
1578
1579 NextEntry = NextEntry->
Flink;
1580 continue;
1581 }
1582
1583
1586 InitStart = 0;
1587 while (SectionCount > 0)
1588 {
1589
1591
1592
1595 {
1596
1598 InitSection = Section;
1599 }
1600
1601 if (InitFound)
1602 {
1603
1605
1606
1608
1609
1612
1613
1616
1617
1618 if (SectionCount == 1)
1619 {
1620
1621 LastSection = Section;
1622 }
1623 else
1624 {
1625
1627 do
1628 {
1629
1630 SectionCount--;
1631 Section++;
1633 {
1634
1635 LastSection = Section;
1636 }
1637 else
1638 {
1639
1640 break;
1641 }
1642 }
1643 while (SectionCount > 1);
1644 }
1645
1646
1647 if (LastSection)
1648 {
1649
1651
1652
1654
1655
1656 if (SectionCount != 1)
1657 {
1658
1661 }
1662 }
1663
1664
1667
1668
1669 if (InitStart < InitEnd)
1670 {
1671
1672 if ((InitCode >= InitStart) && (InitCode < InitEnd))
1673 {
1674
1676 *StartVa = (
PVOID)InitStart;
1677 *EndVa = (
PVOID)InitEnd;
1678 }
1679 else
1680 {
1681
1683 DPRINT(
"Freeing init code: %p-%p ('%wZ' @%p : '%s')\n",
1690 }
1691 }
1692 }
1693
1694
1695 SectionCount--;
1696 Section++;
1697 }
1698
1699
1700 NextEntry = NextEntry->
Flink;
1701 }
1702
1703
1707}
#define ALIGN_DOWN_BY(size, align)
#define ALIGN_UP_BY(size, align)
_ACRTIMP int __cdecl strncmp(const char *, const char *, size_t)
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define ExAcquireResourceExclusiveLite(res, wait)
union Alignment_ Alignment
#define KeLeaveCriticalRegion()
#define KeEnterCriticalRegion()
FORCEINLINE BOOLEAN MI_IS_PHYSICAL_ADDRESS(IN PVOID Address)
#define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
#define IMAGE_FIRST_SECTION(NtHeader)
#define IMAGE_SCN_MEM_DISCARDABLE
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
LONG NTAPI KeReleaseMutant(IN PKMUTANT Mutant, IN KPRIORITY Increment, IN BOOLEAN Abandon, IN BOOLEAN Wait)
UNICODE_STRING BaseDllName
struct _LIST_ENTRY * Flink
LIST_ENTRY PsLoadedModuleList
ERESOURCE PsLoadedModuleResource
VOID NTAPI MiFindInitializationCode(OUT PVOID *StartVa, OUT PVOID *EndVa)
VOID NTAPI MiFreeInitializationCode(IN PVOID InitStart, IN PVOID InitEnd)
#define CONTAINING_RECORD(address, type, field)
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size