예제 #1
0
파일: clientobj.c 프로젝트: staring/RosFE
HGDIOBJ
WINAPI
GdiInsertClientObj(
    _In_ PVOID pvObject,
    _In_ GDILOOBJTYPE eObjType)
{
    PCLIENTOBJLINK pcol;
    ULONG iHashIndex;
    HGDIOBJ hobj;

    /* Call win32k to create a client object handle */
    hobj = NtGdiCreateClientObj(eObjType);
    if (hobj == NULL)
    {
        return NULL;
    }

    /* Calculate the hash index */
    iHashIndex = (ULONG_PTR)hobj % _countof(gapcolHashTable);

    /* Allocate a link structure */
    pcol = HeapAlloc(GetProcessHeap(), 0, sizeof(*pcol));
    if (pcol == NULL)
    {
        NtGdiDeleteClientObj(hobj);
        return NULL;
    }

    /* Setup the link structure */
    pcol->hobj = hobj;
    pcol->pvObj = pvObject;

    /* Enter the critical section */
    EnterCriticalSection(&gcsClientObjLinks);

    /* Insert the link structure */
    pcol->pcolNext = gapcolHashTable[iHashIndex];
    gapcolHashTable[iHashIndex] = pcol;

    /* Leave the critical section */
    LeaveCriticalSection(&gcsClientObjLinks);

    return hobj;
}
예제 #2
0
파일: clientobj.c 프로젝트: GYGit/reactos
PVOID
WINAPI
GdiDeleteClientObj(
    _In_ HGDIOBJ hobj)
{
    PVOID pvObject;

    /* Remove the client object link */
    pvObject = GdiRemoveClientObjLink(hobj);
    if (pvObject == NULL)
    {
        return NULL;
    }

    /* Call win32k to delete the handle */
    if (!NtGdiDeleteClientObj(hobj))
    {
        ASSERT(FALSE);
    }

    return pvObject;
}
예제 #3
0
파일: clientobj.c 프로젝트: GYGit/reactos
HGDIOBJ
WINAPI
GdiCreateClientObj(
    _In_ PVOID pvObject,
    _In_ GDILOOBJTYPE eObjType)
{
    HGDIOBJ hobj;

    /* Call win32k to create a client object handle */
    hobj = NtGdiCreateClientObj(eObjType);
    if (hobj == NULL)
    {
        return NULL;
    }

    /* Create the client object link */
    if (!GdiCreateClientObjLink(hobj, pvObject))
    {
        NtGdiDeleteClientObj(hobj);
        return NULL;
    }

    return hobj;
}