本文整理匯總了C++中EngAllocMem函數的典型用法代碼示例。如果您正苦於以下問題:C++ EngAllocMem函數的具體用法?C++ EngAllocMem怎麽用?C++ EngAllocMem使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了EngAllocMem函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: IntEngCreateClipRegion
CLIPOBJ* FASTCALL
IntEngCreateClipRegion(ULONG count, PRECTL pRect, PRECTL rcBounds)
{
CLIPGDI *Clip;
if(count > 1)
{
RECTL *dest;
Clip = EngAllocMem(0, sizeof(CLIPGDI) + ((count - 1) * sizeof(RECTL)), GDITAG_CLIPOBJ);
if(Clip != NULL)
{
Clip->EnumRects.c = count;
Clip->EnumOrder = CD_ANY;
for(dest = Clip->EnumRects.arcl;count > 0; count--, dest++, pRect++)
{
*dest = *pRect;
}
Clip->ClipObj.iDComplexity = DC_COMPLEX;
Clip->ClipObj.iFComplexity = ((Clip->EnumRects.c <= 4) ? FC_RECT4 : FC_COMPLEX);
Clip->ClipObj.iMode = TC_RECTANGLES;
Clip->ClipObj.rclBounds = *rcBounds;
return GDIToObj(Clip, CLIP);
}
}
else
{
Clip = EngAllocMem(0, sizeof(CLIPGDI), GDITAG_CLIPOBJ);
if(Clip != NULL)
{
Clip->EnumRects.c = 1;
Clip->EnumOrder = CD_ANY;
Clip->EnumRects.arcl[0] = *rcBounds;
Clip->ClipObj.iDComplexity = (((rcBounds->top == rcBounds->bottom) &&
(rcBounds->left == rcBounds->right))
? DC_TRIVIAL : DC_RECT);
Clip->ClipObj.iFComplexity = FC_RECT;
Clip->ClipObj.iMode = TC_RECTANGLES;
Clip->ClipObj.rclBounds = *rcBounds;
return GDIToObj(Clip, CLIP);
}
}
return NULL;
}
示例2: IntSetPalette
BOOL APIENTRY
IntSetPalette(
IN DHPDEV dhpdev,
IN PPALETTEENTRY ppalent,
IN ULONG iStart,
IN ULONG cColors)
{
PVIDEO_CLUT pClut;
ULONG ClutSize;
ClutSize = sizeof(VIDEO_CLUT) + (cColors * sizeof(ULONG));
pClut = EngAllocMem(0, ClutSize, ALLOC_TAG);
pClut->FirstEntry = iStart;
pClut->NumEntries = cColors;
memcpy(&pClut->LookupTable[0].RgbLong, ppalent, sizeof(ULONG) * cColors);
if (((PPDEV)dhpdev)->PaletteShift)
{
while (cColors--)
{
pClut->LookupTable[cColors].RgbArray.Red >>= ((PPDEV)dhpdev)->PaletteShift;
pClut->LookupTable[cColors].RgbArray.Green >>= ((PPDEV)dhpdev)->PaletteShift;
pClut->LookupTable[cColors].RgbArray.Blue >>= ((PPDEV)dhpdev)->PaletteShift;
pClut->LookupTable[cColors].RgbArray.Unused = 0;
}
}
else
{
while (cColors--)
示例3: GdiPoolCreate
PGDI_POOL
NTAPI
GdiPoolCreate(
ULONG cjAllocSize,
ULONG ulTag)
{
PGDI_POOL pPool;
/* Allocate a pool object */
pPool = EngAllocMem(0, sizeof(GDI_POOL), 'lopG');
if (!pPool) return NULL;
/* Initialize the object */
ExInitializePushLock(&pPool->pushlock);
InitializeListHead(&pPool->leInUseList);
InitializeListHead(&pPool->leReadyList);
InitializeListHead(&pPool->leEmptyList);
pPool->cEmptySections = 0;
pPool->cjAllocSize = cjAllocSize;
pPool->ulTag = ulTag;
pPool->cjSectionSize = GDI_POOL_ALLOCATION_GRANULARITY;
pPool->cSlotsPerSection = pPool->cjSectionSize / cjAllocSize;
DBG_INITLOG(&pPool->slhLog);
return pPool;
}
示例4: DrvEnableDriver
BOOL DrvEnableDriver(
ULONG iEngineVersion,
ULONG cj,
PDRVENABLEDATA pded)
{
iEngineVersion;
cj;
DbgPrint("DrvEnableDriver called\n");
pded->pdrvfn = gadrvfnTestFd;
pded->c = sizeof(gadrvfnTestFd) / sizeof(DRVFN);
pded->iDriverVersion = DDI_DRIVER_VERSION;
gpgset = (FD_GLYPHSET *)EngAllocMem(0, SZ_GLYPHSET(1, 1), EXFDTAG);
gpgset->cjThis = SZ_GLYPHSET(1, 1);
gpgset->flAccel = 0;
gpgset->cGlyphsSupported = 1;
gpgset->cRuns = 1;
gpgset->awcrun[0].wcLow = THEGLYPH;
gpgset->awcrun[0].cGlyphs = 1;
gpgset->awcrun[0].phg = (HGLYPH *)&gpgset->awcrun[1];
*(gpgset->awcrun[0].phg) = THEGLYPH;
return(TRUE);
}
示例5: BRUSHOBJ_pvAllocRbrush
/*
* @implemented
*/
PVOID APIENTRY
BRUSHOBJ_pvAllocRbrush(
IN BRUSHOBJ *pbo,
IN ULONG cj)
{
pbo->pvRbrush = EngAllocMem(0, cj, GDITAG_RBRUSH);
return pbo->pvRbrush;
}
示例6: POLYGONFILL_MakeEdgeList
FASTCALL
POLYGONFILL_MakeEdgeList(PPOINT Points, int Count)
{
int CurPt = 0;
FILL_EDGE_LIST* list = 0;
FILL_EDGE* e = 0;
if ( 0 == Points || 2 > Count )
return 0;
list = (FILL_EDGE_LIST*)EngAllocMem(FL_ZERO_MEMORY, sizeof(FILL_EDGE_LIST), FILL_EDGE_ALLOC_TAG);
if ( 0 == list )
goto fail;
list->Count = 0;
list->Edges = (FILL_EDGE**)EngAllocMem(FL_ZERO_MEMORY, Count*sizeof(FILL_EDGE*), FILL_EDGE_ALLOC_TAG);
if ( !list->Edges )
goto fail;
memset ( list->Edges, 0, Count * sizeof(FILL_EDGE*) );
for ( CurPt = 1; CurPt < Count; ++CurPt )
{
e = POLYGONFILL_MakeEdge ( Points[CurPt-1], Points[CurPt] );
if ( !e )
goto fail;
// if a straight horizontal line - who cares?
if ( !e->absdy )
EngFreeMem ( e );
else
list->Edges[list->Count++] = e;
}
e = POLYGONFILL_MakeEdge ( Points[CurPt-1], Points[0] );
if ( !e )
goto fail;
if ( !e->absdy )
EngFreeMem ( e );
else
list->Edges[list->Count++] = e;
return list;
fail:
DPRINT1("Out Of MEMORY!!\n");
POLYGONFILL_DestroyEdgeList ( list );
return 0;
}
示例7: POLYGONFILL_MakeEdge
FASTCALL
POLYGONFILL_MakeEdge(POINT From, POINT To)
{
FILL_EDGE* rc = (FILL_EDGE*)EngAllocMem(FL_ZERO_MEMORY, sizeof(FILL_EDGE), FILL_EDGE_ALLOC_TAG);
if (0 == rc)
return NULL;
//DPRINT1("Making Edge: (%d, %d) to (%d, %d)\n", From.x, From.y, To.x, To.y);
//Now Fill the struct.
if ( To.y < From.y )
{
rc->FromX = To.x;
rc->FromY = To.y;
rc->ToX = From.x;
rc->ToY = From.y;
rc->YDirection = -1;
// lines that go up get walked backwards, so need to be offset
// by -1 in order to make the walk identically on a pixel-level
rc->Error = -1;
}
else
{
rc->FromX = From.x;
rc->FromY = From.y;
rc->ToX = To.x;
rc->ToY = To.y;
rc->YDirection = 1;
rc->Error = 0;
}
rc->x = rc->FromX;
rc->y = rc->FromY;
rc->dx = rc->ToX - rc->FromX;
rc->dy = rc->ToY - rc->FromY;
rc->absdx = abs(rc->dx);
rc->absdy = abs(rc->dy);
rc->xmajor = rc->absdx > rc->absdy;
rc->ErrorMax = MAX(rc->absdx,rc->absdy);
rc->Error += rc->ErrorMax / 2;
rc->XDirection = (rc->dx < 0)?(-1):(1);
rc->pNext = 0;
DPRINT("MakeEdge (%i,%i)->(%i,%i) d=(%i,%i) dir=(%i,%i) err=%i max=%i\n",
From.x, From.y, To.x, To.y, rc->dx, rc->dy, rc->XDirection, rc->YDirection, rc->Error, rc->ErrorMax );
return rc;
}
示例8: OpenPlotFile
HANDLE
OpenPlotFile(
LPWSTR pFileName
)
/*++
Routine Description:
Arguments:
Return Value:
Author:
24-Oct-1995 Tue 14:16:46 created -by- Daniel Chou (danielc)
Revision History:
--*/
{
PPLOTFILE pPF;
DWORD cbSize;
if ((pPF = (PPLOTFILE)EngAllocMem(FL_ZERO_MEMORY,
sizeof(PLOTFILE),
'tolp')) &&
(pPF->hModule = EngLoadModule((LPWSTR)pFileName)) &&
(pPF->pbBeg = EngMapModule(pPF->hModule, &cbSize))) {
pPF->pbEnd = (pPF->pbCur = pPF->pbBeg) + cbSize;
return((HANDLE)pPF);
}
if (pPF) {
EngFreeMem((PVOID)pPF);
}
return((HANDLE)INVALID_HANDLE_VALUE);
}
示例9: EngCreateClip
/*
* @implemented
*/
CLIPOBJ * APIENTRY
EngCreateClip(VOID)
{
CLIPGDI *Clip = EngAllocMem(FL_ZERO_MEMORY, sizeof(CLIPGDI), GDITAG_CLIPOBJ);
if(Clip != NULL)
{
return GDIToObj(Clip, CLIP);
}
return NULL;
}
示例10: return
UCHAR *MCDDbgAlloc(UINT size)
{
UCHAR *pRet;
if (pRet = (UCHAR *)EngAllocMem(FL_ZERO_MEMORY, size + sizeof(ULONG),
MCD_ALLOC_TAG)) {
MCDrvAllocMemSize += size;
*((ULONG *)pRet) = size;
return (pRet + sizeof(ULONG));
} else
return (UCHAR *)NULL;
}
示例11: malloc
void *
malloc(size_t Size)
{
void *Object;
Object = EngAllocMem(0, sizeof(size_t) + Size, TAG_FREETYPE);
if (NULL != Object)
{
*((size_t *) Object) = Size;
Object = (void *)((size_t *) Object + 1);
}
return Object;
}
示例12: MoveAllSurfacesToRam
BOOL MoveAllSurfacesToRam(PDev *pdev)
{
UINT32 surface_id;
SurfaceInfo *surface_info;
SURFOBJ *surf_obj;
UINT8 *copy;
UINT8 *line0;
int size;
QXLPHYSICAL phys_mem;
for (surface_id = 1 ; surface_id < pdev->n_surfaces ; ++surface_id) {
surface_info = GetSurfaceInfo(pdev, surface_id);
if (!surface_info->draw_area.base_mem) {
continue;
}
surf_obj = surface_info->draw_area.surf_obj;
if (!surf_obj) {
DEBUG_PRINT((pdev, 3, "%s: %d: no surfobj, not copying\n", __FUNCTION__, surface_id));
continue;
}
size = surf_obj->sizlBitmap.cy * abs(surf_obj->lDelta);
copy = EngAllocMem(0, size, ALLOC_TAG);
DEBUG_PRINT((pdev, 3, "%s: %d: copying #%d to %p (%d)\n", __FUNCTION__, surface_id, size,
copy, surf_obj->lDelta));
RtlCopyMemory(copy, surface_info->draw_area.base_mem, size);
surface_info->copy = copy;
line0 = surf_obj->lDelta > 0 ? copy : copy + abs(surf_obj->lDelta) *
(surf_obj->sizlBitmap.cy - 1);
if (!EngModifySurface((HSURF)surface_info->hbitmap,
pdev->eng,
0, /* from the example: used to monitor memory HOOK_COPYBITS | HOOK_BITBLT, */
0, /* It's system-memory */
(DHSURF)surface_info,
line0,
surf_obj->lDelta,
NULL)) {
/* Send a create messsage for this surface - we previously did a destroy all. */
EngFreeMem(surface_info->copy);
surface_info->copy = NULL;
DEBUG_PRINT((pdev, 0, "%s: %d: EngModifySurface failed, sending create for %d-%d\n",
__FUNCTION__, surface_id, surface_id, pdev->n_surfaces - 1));
SendSurfaceRangeCreateCommand(pdev, surface_id, pdev->n_surfaces);
return FALSE;
}
QXLDelSurface(pdev, surface_info->draw_area.base_mem, DEVICE_BITMAP_ALLOCATION_TYPE_VRAM);
surface_info->draw_area.base_mem = copy;
FreeDrawArea(&surface_info->draw_area);
}
return TRUE;
}
示例13: EngCreateClip
APIENTRY
EngCreateClip(VOID)
{
XCLIPOBJ *Clip = EngAllocMem(FL_ZERO_MEMORY, sizeof(XCLIPOBJ), GDITAG_CLIPOBJ);
if(Clip != NULL)
{
IntEngInitClipObj(Clip);
TRACE("Created Clip Obj %p.\n", Clip);
return &Clip->ClipObj;
}
ERR("Clip object allocation failed!\n");
return NULL;
}
示例14: HackFixup
PVOID
HackFixup(
PVOID pvView,
ULONG cjView)
{
CHAR *pc;
pc = EngAllocMem(0, cjView, 'tmp ');
memcpy(pc, pvView, cjView);
*pc = 0;
return pc;
}
示例15: pohNewNode
OH* pohNewNode(
PDEV* ppdev)
{
LONG i;
LONG cOhs;
OHALLOC* poha;
OH* poh;
if (ppdev->heap.pohFreeList == NULL)
{
// We zero-init to initialize all the OH flags, and to help in
// debugging (we can afford to do this since we'll be doing this
// very infrequently):
poha = EngAllocMem(FL_ZERO_MEMORY, OH_ALLOC_SIZE, ALLOC_TAG);
if (poha == NULL)
return(NULL);
// Insert this OHALLOC at the begining of the OHALLOC chain:
poha->pohaNext = ppdev->heap.pohaChain;
ppdev->heap.pohaChain = poha;
// This has a '+ 1' because OHALLOC includes an extra OH in its
// structure declaration:
cOhs = (OH_ALLOC_SIZE - sizeof(OHALLOC)) / sizeof(OH) + 1;
// The big OHALLOC allocation is simply a container for a bunch of
// OH data structures in an array. The new OH data structures are
// linked together and added to the OH free list:
poh = &poha->aoh[0];
for (i = cOhs - 1; i != 0; i--)
{
poh->pohNext = poh + 1;
poh = poh + 1;
}
poh->pohNext = NULL;
ppdev->heap.pohFreeList = &poha->aoh[0];
}
poh = ppdev->heap.pohFreeList;
ppdev->heap.pohFreeList = poh->pohNext;
return(poh);
}