本文整理汇总了C++中RtlFreeHeap函数的典型用法代码示例。如果您正苦于以下问题:C++ RtlFreeHeap函数的具体用法?C++ RtlFreeHeap怎么用?C++ RtlFreeHeap使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RtlFreeHeap函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MemAlloc
PVOID
WINAPI
MemAlloc(IN HANDLE Heap,
IN PVOID Ptr,
IN ULONG Size)
{
PVOID pBuf = NULL;
if(Size == 0 && Ptr == NULL)
{
return NULL;
}
if(Heap == NULL)
{
Heap = NtCurrentPeb()->ProcessHeap;
}
if(Size > 0)
{
if(Ptr == NULL)
/* malloc */
pBuf = RtlAllocateHeap(Heap, 0, Size);
else
/* realloc */
pBuf = RtlReAllocateHeap(Heap, 0, Ptr, Size);
}
else
/* free */
RtlFreeHeap(Heap, 0, Ptr);
return pBuf;
}
示例2: ConvertFiberToThread
/*
* @implemented
*/
BOOL
WINAPI
ConvertFiberToThread(VOID)
{
PTEB Teb;
PFIBER FiberData;
DPRINT1("Converting Fiber to Thread\n");
/* Check if the thread is already not a fiber */
Teb = NtCurrentTeb();
if (!Teb->HasFiberData)
{
/* Fail */
SetLastError(ERROR_ALREADY_THREAD);
return FALSE;
}
/* this thread won't run a fiber anymore */
Teb->HasFiberData = FALSE;
FiberData = Teb->NtTib.FiberData;
Teb->NtTib.FiberData = NULL;
/* Free the fiber */
ASSERT(FiberData != NULL);
RtlFreeHeap(GetProcessHeap(), 0, FiberData);
/* success */
return TRUE;
}
示例3: RtlDestroyProcessParameters
/*
* @implemented
*/
NTSTATUS
NTAPI
RtlDestroyProcessParameters(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters)
{
RtlFreeHeap(RtlGetProcessHeap(), 0, ProcessParameters);
return STATUS_SUCCESS;
}
示例4: LsaFreeMemory
/*
* @implemented
*/
NTSTATUS
WINAPI
LsaFreeMemory(IN PVOID Buffer)
{
TRACE("(%p)\n", Buffer);
return RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
}
示例5: DeleteFiber
/*
* @implemented
*/
VOID
WINAPI
DeleteFiber(LPVOID lpFiber)
{
SIZE_T Size = 0;
PFIBER Fiber = (PFIBER)lpFiber;
PTEB Teb;
/* First, exit the thread */
Teb = NtCurrentTeb();
if ((Teb->HasFiberData) && (Teb->NtTib.FiberData == Fiber)) ExitThread(1);
/* Now de-allocate the stack */
NtFreeVirtualMemory(NtCurrentProcess(),
&Fiber->DeallocationStack,
&Size,
MEM_RELEASE);
/* Get rid of FLS */
if (Fiber->FlsData) BaseRundownFls(Fiber->FlsData);
/* Get rid of the activation stack */
DPRINT1("Leaking activation stack because nobody implemented free");
//RtlFreeActivationContextStack(Fiber->ActivationContextStack);
/* Free the fiber data */
RtlFreeHeap(GetProcessHeap(), 0, lpFiber);
}
示例6: FindFirstVolumeA
/*
* @implemented (Wine 13 sep 2008)
*/
HANDLE
WINAPI
FindFirstVolumeA(IN LPSTR volume,
IN DWORD len)
{
WCHAR *buffer = NULL;
HANDLE handle;
buffer = RtlAllocateHeap( RtlGetProcessHeap(), 0, len * sizeof(WCHAR) );
if (!buffer)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return INVALID_HANDLE_VALUE;
}
handle = FindFirstVolumeW( buffer, len );
if (handle != INVALID_HANDLE_VALUE)
{
if (!WideCharToMultiByte( CP_ACP, 0, buffer, -1, volume, len, NULL, NULL ))
{
FindVolumeClose( handle );
handle = INVALID_HANDLE_VALUE;
}
}
RtlFreeHeap( RtlGetProcessHeap(), 0, buffer );
return handle;
}
示例7: LsapFreeLsaHeap
VOID
LsapFreeLsaHeap (
IN PVOID Base
)
/*++
Routine Description:
This function free previously allocated heap space.
Arguments:
Base - Provides the address of the previously allocated heap
space to deallocate.
Return Value:
None.
--*/
{
RtlFreeHeap( LsapHeap, 0, Base );
return;
}
示例8: SetVolumeLabelA
/*
* @implemented
*/
BOOL
WINAPI
SetVolumeLabelA(IN LPCSTR lpRootPathName,
IN LPCSTR lpVolumeName OPTIONAL) /* NULL if deleting label */
{
PWCHAR RootPathNameW;
PWCHAR VolumeNameW = NULL;
BOOL Result;
if (!(RootPathNameW = FilenameA2W(lpRootPathName, FALSE)))
return FALSE;
if (lpVolumeName)
{
if (!(VolumeNameW = FilenameA2W(lpVolumeName, TRUE)))
return FALSE;
}
Result = SetVolumeLabelW (RootPathNameW,
VolumeNameW);
if (VolumeNameW)
{
RtlFreeHeap (RtlGetProcessHeap (),
0,
VolumeNameW );
}
return Result;
}
示例9: LsarSetAuditEvents
NTSTATUS
LsarSetAuditEvents(PLSA_DB_OBJECT PolicyObject,
PLSAPR_POLICY_AUDIT_EVENTS_INFO Info)
{
PLSAP_POLICY_AUDIT_EVENTS_DATA AuditData = NULL;
ULONG AttributeSize;
NTSTATUS Status = STATUS_SUCCESS;
TRACE("(%p %p)\n", PolicyObject, Info);
AttributeSize = sizeof(LSAP_POLICY_AUDIT_EVENTS_DATA) +
Info->MaximumAuditEventCount * sizeof(DWORD);
AuditData = RtlAllocateHeap(RtlGetProcessHeap(),
HEAP_ZERO_MEMORY,
AttributeSize);
if (AuditData == NULL)
return STATUS_INSUFFICIENT_RESOURCES;
AuditData->AuditingMode = Info->AuditingMode;
AuditData->MaximumAuditEventCount = Info->MaximumAuditEventCount;
memcpy(&(AuditData->AuditEvents[0]),
Info->EventAuditingOptions,
Info->MaximumAuditEventCount * sizeof(DWORD));
Status = LsapSetObjectAttribute(PolicyObject,
L"PolAdtEv",
AuditData,
AttributeSize);
RtlFreeHeap(RtlGetProcessHeap(), 0, AuditData);
return Status;
}
示例10: delete_dos_device
/* delete the disk device for a given drive */
static void delete_dos_device( struct dos_drive *drive )
{
list_remove( &drive->entry );
if (drive->mount) delete_mount_point( drive->mount );
release_volume( drive->volume );
RtlFreeHeap( GetProcessHeap(), 0, drive );
}
示例11: GetClipboardFormatNameA
/*
* @implemented
*/
INT
WINAPI
GetClipboardFormatNameA(UINT format,
LPSTR lpszFormatName,
int cchMaxCount)
{
LPWSTR lpBuffer;
INT Length;
lpBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, cchMaxCount * sizeof(WCHAR));
if (!lpBuffer)
{
SetLastError(ERROR_OUTOFMEMORY);
return 0;
}
/* we need a UNICODE string */
Length = NtUserGetClipboardFormatName(format, lpBuffer, cchMaxCount);
if (Length != 0)
{
if (!WideCharToMultiByte(CP_ACP, 0, lpBuffer, Length, lpszFormatName, cchMaxCount, NULL, NULL))
{
/* clear result string */
Length = 0;
}
lpszFormatName[Length] = '\0';
}
RtlFreeHeap(RtlGetProcessHeap(), 0, lpBuffer);
return Length;
}
示例12: add_entry
BOOL
add_entry(
LPINT ac,
LPSTR **arg,
LPCSTR entry)
{
LPSTR q;
LPSTR *oldarg;
q = RtlAllocateHeap(ProcessHeap, 0, strlen(entry) + 1);
if (q == NULL)
return FALSE;
strcpy(q, entry);
oldarg = *arg;
*arg = RtlReAllocateHeap(ProcessHeap, 0, oldarg, (*ac + 2) * sizeof(LPSTR));
if (*arg == NULL)
{
RtlFreeHeap(ProcessHeap, 0, q);
*arg = oldarg;
return FALSE;
}
/* save new entry */
(*arg)[*ac] = q;
(*arg)[++(*ac)] = NULL;
return TRUE;
}
示例13: freep
static
VOID
freep(
LPSTR *p)
{
LPSTR *q;
if (!p)
return;
q = p;
while (*q)
RtlFreeHeap(ProcessHeap, 0, *q++);
RtlFreeHeap(ProcessHeap, 0, p);
}
示例14: CreateDIBPatternBrush
/*
* @implemented
*/
HBRUSH WINAPI
CreateDIBPatternBrush(
HGLOBAL hglbDIBPacked,
UINT fuColorSpec)
{
PVOID lpPackedDIB;
HBRUSH hBrush = NULL;
PBITMAPINFO pConvertedInfo;
UINT ConvertedInfoSize;
lpPackedDIB = GlobalLock(hglbDIBPacked);
if (lpPackedDIB == NULL)
return 0;
pConvertedInfo = ConvertBitmapInfo((PBITMAPINFO)lpPackedDIB, fuColorSpec,
&ConvertedInfoSize, TRUE);
if (pConvertedInfo)
{
hBrush = NtGdiCreateDIBBrush(pConvertedInfo, fuColorSpec,
ConvertedInfoSize, FALSE, FALSE, lpPackedDIB);
if ((PBITMAPINFO)lpPackedDIB != pConvertedInfo)
RtlFreeHeap(RtlGetProcessHeap(), 0, pConvertedInfo);
}
GlobalUnlock(hglbDIBPacked);
return hBrush;
}
示例15: CreateCatalogEntry
PCATALOG_ENTRY
CreateCatalogEntry(LPWSTR LibraryName)
{
PCATALOG_ENTRY Provider;
WS_DbgPrint(MAX_TRACE, ("LibraryName (%S).\n", LibraryName));
Provider = HeapAlloc(GlobalHeap, 0, sizeof(CATALOG_ENTRY));
if (!Provider)
return NULL;
ZeroMemory(Provider, sizeof(CATALOG_ENTRY));
if (!RtlCreateUnicodeString(&Provider->LibraryName, LibraryName))
{
RtlFreeHeap(GlobalHeap, 0, Provider);
return NULL;
}
Provider->ReferenceCount = 1;
InitializeCriticalSection(&Provider->Lock);
Provider->hModule = NULL;
Provider->Mapping = NULL;
//EnterCriticalSection(&CatalogLock);
InsertTailList(&CatalogListHead, &Provider->ListEntry);
//LeaveCriticalSection(&CatalogLock);
return Provider;
}