当前位置: 首页>>代码示例>>C++>>正文


C++ RtlFreeHeap函数代码示例

本文整理汇总了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;
}
开发者ID:RareHare,项目名称:reactos,代码行数:33,代码来源:malloc.c

示例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;
}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:32,代码来源:fiber.c

示例3: RtlDestroyProcessParameters

/*
 * @implemented
 */
NTSTATUS
NTAPI
RtlDestroyProcessParameters(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters)
{
   RtlFreeHeap(RtlGetProcessHeap(), 0, ProcessParameters);
   return STATUS_SUCCESS;
}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:10,代码来源:ppb.c

示例4: LsaFreeMemory

/*
 * @implemented
 */
NTSTATUS
WINAPI
LsaFreeMemory(IN PVOID Buffer)
{
    TRACE("(%p)\n", Buffer);
    return RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:10,代码来源:lsa.c

示例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);
}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:31,代码来源:fiber.c

示例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;
}
开发者ID:RPG-7,项目名称:reactos,代码行数:32,代码来源:volume.c

示例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;
}
开发者ID:mingpen,项目名称:OpenNT,代码行数:27,代码来源:lsasrvmm.c

示例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;
}
开发者ID:RPG-7,项目名称:reactos,代码行数:33,代码来源:volume.c

示例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;
}
开发者ID:GYGit,项目名称:reactos,代码行数:35,代码来源:policy.c

示例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 );
}
开发者ID:Sunmonds,项目名称:wine,代码行数:8,代码来源:device.c

示例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;
}
开发者ID:Moteesh,项目名称:reactos,代码行数:35,代码来源:clipboard.c

示例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;
}
开发者ID:GYGit,项目名称:reactos,代码行数:29,代码来源:cmdcons.c

示例13: freep

static
VOID
freep(
    LPSTR *p)
{
    LPSTR *q;

    if (!p)
        return;

    q = p;
    while (*q)
        RtlFreeHeap(ProcessHeap, 0, *q++);

    RtlFreeHeap(ProcessHeap, 0, p);
}
开发者ID:GYGit,项目名称:reactos,代码行数:16,代码来源:cmdcons.c

示例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;
}
开发者ID:staring,项目名称:RosFE,代码行数:31,代码来源:brush.c

示例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;
}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:34,代码来源:catalog.c


注:本文中的RtlFreeHeap函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。