- Move on to using a real HEAP_LOCK structure for a heap lock.
- Implement kernel-mode counterparts of this lock too. Right now these don't introduce much of a difference, but they are going to be properly used by the new heap manager code.

svn path=/trunk/; revision=48994
This commit is contained in:
Aleksey Bragin 2010-10-05 12:42:55 +00:00
parent 04a028b58e
commit faa70e3d70
3 changed files with 32 additions and 18 deletions

View file

@ -113,33 +113,33 @@ RtlGetNtGlobalFlags(VOID)
NTSTATUS
NTAPI
RtlDeleteHeapLock(
PRTL_CRITICAL_SECTION CriticalSection)
PHEAP_LOCK Lock)
{
return RtlDeleteCriticalSection(CriticalSection);
return RtlDeleteCriticalSection(&Lock->CriticalSection);
}
NTSTATUS
NTAPI
RtlEnterHeapLock(
PRTL_CRITICAL_SECTION CriticalSection)
PHEAP_LOCK Lock)
{
return RtlEnterCriticalSection(CriticalSection);
return RtlEnterCriticalSection(&Lock->CriticalSection);
}
NTSTATUS
NTAPI
RtlInitializeHeapLock(
PRTL_CRITICAL_SECTION CriticalSection)
PHEAP_LOCK Lock)
{
return RtlInitializeCriticalSection(CriticalSection);
return RtlInitializeCriticalSection(&Lock->CriticalSection);
}
NTSTATUS
NTAPI
RtlLeaveHeapLock(
PRTL_CRITICAL_SECTION CriticalSection)
PHEAP_LOCK Lock)
{
return RtlLeaveCriticalSection(CriticalSection );
return RtlLeaveCriticalSection(&Lock->CriticalSection);
}
PVOID

View file

@ -1039,6 +1039,21 @@ typedef struct _RTL_CRITICAL_SECTION
#endif
//
// RTL Private Heap Structures
//
typedef struct _HEAP_LOCK
{
union
{
RTL_CRITICAL_SECTION CriticalSection;
#ifndef NTOS_MODE_USER
ERESOURCE Resource;
#endif
UCHAR Padding[0x68]; /* Max ERESOURCE size for x64 build. Needed because RTL is built only once */
};
} HEAP_LOCK, *PHEAP_LOCK;
//
// RTL Range List Structures
//

View file

@ -157,36 +157,35 @@ RtlGetCurrentPeb(VOID)
NTSTATUS
NTAPI
RtlDeleteHeapLock(
PRTL_CRITICAL_SECTION CriticalSection)
PHEAP_LOCK Lock)
{
ASSERT(FALSE);
ExDeleteResource(&Lock->Resource);
return STATUS_SUCCESS;
}
NTSTATUS
NTAPI
RtlEnterHeapLock(
PRTL_CRITICAL_SECTION CriticalSection)
PHEAP_LOCK Lock)
{
ASSERT(FALSE);
return STATUS_SUCCESS;
return ExAcquireResourceExclusive(&Lock->Resource, TRUE);
}
NTSTATUS
NTAPI
RtlInitializeHeapLock(
PRTL_CRITICAL_SECTION CriticalSection)
PHEAP_LOCK Lock)
{
ASSERT(FALSE);
return STATUS_SUCCESS;
ExInitializeResource(&Lock->Resource);
return STATUS_SUCCESS;
}
NTSTATUS
NTAPI
RtlLeaveHeapLock(
PRTL_CRITICAL_SECTION CriticalSection)
PHEAP_LOCK Lock)
{
ASSERT(FALSE);
ExReleaseResource(&Lock->Resource);
return STATUS_SUCCESS;
}