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


C++ FreeItem函数代码示例

本文整理汇总了C++中FreeItem函数的典型用法代码示例。如果您正苦于以下问题:C++ FreeItem函数的具体用法?C++ FreeItem怎么用?C++ FreeItem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了FreeItem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CompareProductName

NTSTATUS
CompareProductName(
    IN HANDLE hSubKey,
    IN LPWSTR PnpName,
    IN ULONG ProductNameSize,
    OUT LPWSTR ProductName)
{
    PKEY_VALUE_PARTIAL_INFORMATION PartialInformation;
    UNICODE_STRING DriverDescName = RTL_CONSTANT_STRING(L"DriverDesc");
    UNICODE_STRING MatchingDeviceIdName = RTL_CONSTANT_STRING(L"MatchingDeviceId");
    ULONG Length;
    LPWSTR DeviceName;

    /* read MatchingDeviceId value */
    PartialInformation = ReadKeyValue(hSubKey, &MatchingDeviceIdName);

    if (!PartialInformation)
        return STATUS_UNSUCCESSFUL;


    /* extract last '&' */
    DeviceName = wcsrchr((LPWSTR)PartialInformation->Data, L'&');
    ASSERT(DeviceName);
    /* terminate it */
    DeviceName[0] = L'\0';

    Length = wcslen((LPWSTR)PartialInformation->Data);

    DPRINT("DeviceName %S PnpName %S Length %u\n", (LPWSTR)PartialInformation->Data, PnpName, Length);

    if (_wcsnicmp((LPWSTR)PartialInformation->Data, &PnpName[4], Length))
    {
        FreeItem(PartialInformation);
        return STATUS_NO_MATCH;
    }

    /* free buffer */
    FreeItem(PartialInformation);

    /* read DriverDescName value */
    PartialInformation = ReadKeyValue(hSubKey, &DriverDescName);

    if (!PartialInformation)
    {
        /* failed to read driver desc key */
        return STATUS_UNSUCCESSFUL;
    }

    /* copy key name */
    Length = min(ProductNameSize * sizeof(WCHAR), PartialInformation->DataLength);
    RtlMoveMemory(ProductName, (PVOID)PartialInformation->Data, Length);

    /* zero terminate it */
    ProductName[ProductNameSize-1] = L'\0';

    /* free buffer */
    FreeItem(PartialInformation);

    return STATUS_SUCCESS;
}
开发者ID:GYGit,项目名称:reactos,代码行数:60,代码来源:sup.c

示例2: FreeEventData

VOID
FreeEventData(IN PVOID EventData)
{
    PKSEVENTDATA Data = (PKSEVENTDATA)EventData;

    FreeItem(Data->EventHandle.Event);
    FreeItem(Data);
}
开发者ID:hoangduit,项目名称:reactos,代码行数:8,代码来源:mmixer.c

示例3: USBCCGP_GetStringDescriptor

NTSTATUS
NTAPI
USBCCGP_GetStringDescriptor(
    IN PDEVICE_OBJECT DeviceObject,
    IN ULONG DescriptorLength,
    IN UCHAR DescriptorIndex,
    IN LANGID LanguageId,
    OUT PVOID *OutDescriptor)
{
    NTSTATUS Status;
    PUSB_STRING_DESCRIPTOR StringDescriptor;
    ULONG Size;
    PVOID Buffer;

    // retrieve descriptor
    Status = USBCCGP_GetDescriptor(DeviceObject, USB_STRING_DESCRIPTOR_TYPE, DescriptorLength, DescriptorIndex, LanguageId, OutDescriptor);
    if (!NT_SUCCESS(Status))
    {
        // failed
        return Status;
    }

    // get descriptor structure
    StringDescriptor = (PUSB_STRING_DESCRIPTOR)*OutDescriptor;

    // sanity check
    ASSERT(StringDescriptor->bLength < DescriptorLength - 2);

    if (StringDescriptor->bLength == 2)
    {
        // invalid descriptor
        FreeItem(StringDescriptor);
        return STATUS_DEVICE_DATA_ERROR;
    }

    // calculate size
    Size = StringDescriptor->bLength + sizeof(WCHAR);

    // allocate buffer
    Buffer = AllocateItem(NonPagedPool, Size);
    if (!Buffer)
    {
        // no memory
        FreeItem(StringDescriptor);
        return STATUS_INSUFFICIENT_RESOURCES;
    }

    // copy result
    RtlCopyMemory(Buffer, StringDescriptor->bString, Size - FIELD_OFFSET(USB_STRING_DESCRIPTOR, bString));

    // free buffer
    FreeItem(StringDescriptor);

    // store result
    *OutDescriptor = (PVOID)Buffer;
    return STATUS_SUCCESS;
}
开发者ID:RPG-7,项目名称:reactos,代码行数:57,代码来源:descriptor.c

示例4: test_Enqueue

TEST
test_Enqueue(){
	Queue q;
	Node *newItem, *newItem2, *newItem3;
	InitQueue(&q);
	
	newItem = NewItem();
	
	//add item to queue
	AddQueue(&q, newItem);

	ASSERT(q.head == newItem);
	ASSERT(q.tail == newItem);
	ASSERT(q.count == 1);

	newItem2 = NewItem();
	AddQueue(&q, newItem2);

	//make sure that head val has not changed, and only tail val has changed
	ASSERT(q.head == newItem);
	ASSERT(q.tail == newItem2);
	ASSERT(q.count == 2);
	//head should point at tail
	ASSERT(q.head->next == q.tail);

	//one more for good measure
	newItem3 = NewItem();
	AddQueue(&q, newItem3);
	//head has not changed, as we add to the end
	ASSERT(q.head == newItem);
	//tail is our new item
	ASSERT(q.tail == newItem3);
	//count updated correctly
	ASSERT(q.count == 3);
	//head.prev points to tail
	ASSERT(q.head->prev == q.tail);
	//head.next does not point to tail, points to middle
	ASSERT(q.head->next == newItem2);
	//3 items, all connected
	ASSERT(q.head->next->next == q.tail);
	//tail.next == head
	ASSERT(q.tail->next == q.head);
	
	//free items
	FreeItem(newItem);
	FreeItem(newItem2);
	FreeItem(newItem3);


	PASS();
}
开发者ID:jjrob13,项目名称:CSE430,代码行数:51,代码来源:proj_1.c

示例5: test_RotateQ

TEST
test_RotateQ(){

	Queue q;
	InitQueue(&q);
	Node *newItem1, *newItem2, *newItem3, *newItem4;

	newItem1 = NewItem();
	newItem2 = NewItem();
	newItem3 = NewItem();
	newItem4 = NewItem();

	AddQueue(&q, newItem1);
	AddQueue(&q, newItem2);
	AddQueue(&q, newItem3);
	AddQueue(&q, newItem4);

	//Queue is 1 2 3 4
	ASSERT(q.head == newItem1);
	ASSERT(q.tail == newItem4);

	RotateQ(&q);
	//Queue is 2 3 4 1
	ASSERT(q.head == newItem2);
	ASSERT(q.tail == newItem1);

	RotateQ(&q);
	//Queue is 3 4 1 2
	ASSERT(q.head == newItem3);
	ASSERT(q.tail == newItem2);

	RotateQ(&q);
	//Queue is 4 1 2 3
	ASSERT(q.head == newItem4);
	ASSERT(q.tail == newItem3);

	RotateQ(&q);
	//Queue is 1 2 3 4
	ASSERT(q.head == newItem1);
	ASSERT(q.tail == newItem4);

	FreeItem(newItem1);
	FreeItem(newItem2);
	FreeItem(newItem3);
	FreeItem(newItem4);
	
	PASS();
}
开发者ID:jjrob13,项目名称:CSE430,代码行数:48,代码来源:proj_1.c

示例6: RemoveItem

/**
 * Remove the specified DrmData item <code>d</code>.
 *
 * @param p - the pointer of the DRM content InputStream object.
 *
 * @return <code>JNI_DRM_SUCCESS</code> if remove successfuly,
 *         otherwise return <code>JNI_DRM_FAILURE</code>
 */
static int32_t RemoveItem(int32_t id)
{
    DrmData *curItem, *preItem;

    if (NULL == drmTable)
        return CDrmRawContent::JNI_DRM_FAILURE;

    preItem = NULL;
    for (curItem = drmTable; curItem != NULL; curItem = curItem->next) {
        if (id == curItem->id) {
            if (curItem == drmTable)
                drmTable = curItem->next;
            else
                preItem->next = curItem->next;

            FreeItem(curItem);

            return CDrmRawContent::JNI_DRM_SUCCESS;
        }

        preItem = curItem;
    }

    return CDrmRawContent::JNI_DRM_FAILURE;
}
开发者ID:imace,项目名称:ElastosRDK5_0,代码行数:33,代码来源:CDrmRawContent.cpp

示例7: KsUnregisterWorker

/*
    @implemented
*/
KSDDKAPI
VOID
NTAPI
KsUnregisterWorker(
    IN  PKSWORKER Worker)
{
    PKSIWORKER KsWorker;
    KIRQL OldIrql;

    if (!Worker)
        return;

    /* get ks worker implementation */
    KsWorker = (PKSIWORKER)Worker;
    /* acquire spinlock */
    KeAcquireSpinLock(&KsWorker->Lock, &OldIrql);
    /* fake status running to avoid work items to be queued by the counted worker */
    KsWorker->Counter = 1;
    /* is there currently a work item active */
    if (KsWorker->QueuedWorkItemCount)
    {
        /* release the lock */
        KeReleaseSpinLock(&KsWorker->Lock, OldIrql);
        /* wait for the worker routine to finish */
        KeWaitForSingleObject(&KsWorker->Event, Executive, KernelMode, FALSE, NULL);
    }
    else
    {
        /* no work item active, just release the lock */
        KeReleaseSpinLock(&KsWorker->Lock, OldIrql);
    }
    /* free worker context */
    FreeItem(KsWorker);
}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:37,代码来源:worker.c

示例8: Dispatch_fnClose

NTSTATUS
NTAPI
Dispatch_fnClose(
    PDEVICE_OBJECT DeviceObject,
    PIRP Irp)
{
    PIO_STACK_LOCATION IoStack;
    PDISPATCH_CONTEXT DispatchContext;
    NTSTATUS Status;

    // get current irp stack
    IoStack = IoGetCurrentIrpStackLocation(Irp);
    // get dispatch context
    DispatchContext = (PDISPATCH_CONTEXT)IoStack->FileObject->FsContext;

    // let IrpTarget handle request
    Status = DispatchContext->Target->Close(DeviceObject, Irp);

    if (NT_SUCCESS(Status))
    {
       KsFreeObjectHeader(DispatchContext->ObjectHeader);
       FreeItem(DispatchContext, TAG_PORTCLASS);
    }
    // done
    return Status;
}
开发者ID:RareHare,项目名称:reactos,代码行数:26,代码来源:dispatcher.cpp

示例9: KsValidateClockCreateRequest

/*
    @implemented
*/
KSDDKAPI
NTSTATUS
NTAPI
KsValidateClockCreateRequest(
    IN  PIRP Irp,
    OUT PKSCLOCK_CREATE* OutClockCreate)
{
    PKSCLOCK_CREATE ClockCreate;
    NTSTATUS Status;
    ULONG Size;

    /* minimum request size */
    Size = sizeof(KSCLOCK_CREATE);

    /* copy create request */
    Status = KspCopyCreateRequest(Irp, 
                                  KSSTRING_Clock,
                                  &Size,
                                  (PVOID*)&ClockCreate);

    if (!NT_SUCCESS(Status))
        return Status;

    if (ClockCreate->CreateFlags != 0)
    {
        /* flags must be zero */
        FreeItem(ClockCreate);
        return STATUS_INVALID_PARAMETER;
    }

    *OutClockCreate = ClockCreate;
    return STATUS_SUCCESS;
}
开发者ID:Moteesh,项目名称:reactos,代码行数:36,代码来源:clocks.c

示例10: Pin_fnClose

NTSTATUS
NTAPI
Pin_fnClose(
    PDEVICE_OBJECT DeviceObject,
    PIRP Irp)
{
    PDISPATCH_CONTEXT Context;
    PIO_STACK_LOCATION IoStack;

    //DPRINT("Pin_fnClose called DeviceObject %p Irp %p\n", DeviceObject, Irp);

    /* Get current stack location */
    IoStack = IoGetCurrentIrpStackLocation(Irp);

    /* The dispatch context is stored in the FsContext member */
    Context = (PDISPATCH_CONTEXT)IoStack->FileObject->FsContext;

    if (Context->Handle)
    {
        ZwClose(Context->Handle);
    }

    if (Context->hMixerPin)
    {
        ZwClose(Context->hMixerPin);
    }

    FreeItem(Context);

    Irp->IoStatus.Status = STATUS_SUCCESS;
    Irp->IoStatus.Information = 0;
    IoCompleteRequest(Irp, IO_NO_INCREMENT);
    return STATUS_SUCCESS;
}
开发者ID:GYGit,项目名称:reactos,代码行数:34,代码来源:pin.c

示例11: GetFirstTaskItemFromDB

/*
*****************************************************************************
**
** FUNCTION NAME: GetFirstTaskItemFromDB
**
** FUNCTION INPUTS:
**         ptrEncodeItem: the  encode information struct.
**
** FUNCTION DESCRIPTION
**        get the first record from the zriptask.db, and receive the total record of the db.
**
** FUNCTION OUTPUTS:
**       return: the count of the enc_pending record in the zriptask.db.
** HISTORY:
**
**           2008-7-2       HChen  Created.
**
*****************************************************************************
*/
int GetFirstTaskItemFromDB(PENC_PENDING ptrEncodeItem)
{ 
    int nRetVal = 0;
    char **result;
    int nRow, nCol; 

    if(QueryPendingTask(ENCPENDING,&result,&nRow,&nCol) == ZAPP_SUCCESS)
    {
        if((nRow >= 1)
            &&(result)
            &&(result[1*nCol+0])
            &&(result[1*nCol+1])
            &&(result[1*nCol+2]))
         {
            ZFREE(gObjID);
            gObjID = strdup(result[1*nCol+0]);    /*get the first record's objid of the db*/
            if((ConvertTask.eThreadStatus == THREAD_FINISHED) /*if the  ConvertTask is finished, the set value to the global struct*/
                &&(ConvertTask.eItemStatus == ITEM_ENCODED))
              {
                ConvertTask.nAccTrackNum++;
                ConvertTask.eItemStatus = ITEM_INIT;
                FreeItem(ptrEncodeItem);
                ptrEncodeItem->objID = strdup(result[1*nCol+0]);
                ptrEncodeItem->ptrAudioFormat = strdup(result[1*nCol+1]);
                ptrEncodeItem->ptrFormatCfg = strdup(result[1*nCol+2]);
              }
         }
        nRetVal = nRow;
    }
   if(result)
   {
      ZripTaskFreeResult(result);	
   }
    return nRetVal;
}
开发者ID:jamesyan84,项目名称:zbase,代码行数:54,代码来源:Convert.c

示例12: PwrCompletionFunction

VOID
CALLBACK
PwrCompletionFunction(
    IN PDEVICE_OBJECT DeviceObject,
    IN UCHAR MinorFunction,
    IN POWER_STATE PowerState,
    IN PVOID Context,
    IN PIO_STATUS_BLOCK IoStatus)
{
    NTSTATUS Status;
    PQUERY_POWER_CONTEXT PwrContext = (PQUERY_POWER_CONTEXT)Context;

    if (NT_SUCCESS(IoStatus->Status))
    {
        // forward request to lower device object
        Status = PcForwardIrpSynchronous(PwrContext->DeviceObject, PwrContext->Irp);
    }
    else
    {
        // failed
        Status = IoStatus->Status;
    }

    // start next power irp
    PoStartNextPowerIrp(PwrContext->Irp);

    // complete request
    PwrContext->Irp->IoStatus.Status = Status;
    IoCompleteRequest(PwrContext->Irp, IO_NO_INCREMENT);

    // free context
    FreeItem(PwrContext, TAG_PORTCLASS);
}
开发者ID:RareHare,项目名称:reactos,代码行数:33,代码来源:irp.cpp

示例13: IKsFilterFactory_fnRelease

ULONG
NTAPI
IKsFilterFactory_fnRelease(
    IKsFilterFactory * iface)
{
    IKsFilterFactoryImpl * This = (IKsFilterFactoryImpl*)CONTAINING_RECORD(iface, IKsFilterFactoryImpl, Header.OuterUnknown);

    InterlockedDecrement(&This->ref);

    if (This->ref == 0)
    {
        if (!IsListEmpty(&This->SymbolicLinkList))
        {
            /* disable device interfaces */
            KspSetDeviceInterfacesState(&This->SymbolicLinkList, FALSE);
            /* free device interface strings */
            KspFreeDeviceInterfaces(&This->SymbolicLinkList);
        }

        FreeItem(This);
        return 0;
    }
    /* Return new reference count */
    return This->ref;
}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:25,代码来源:filterfactory.c

示例14: KsCreateDefaultClock

/*
    @implemented
*/
KSDDKAPI
NTSTATUS
NTAPI
KsCreateDefaultClock(
    IN  PIRP Irp,
    IN  PKSDEFAULTCLOCK DefaultClock)
{
    NTSTATUS Status;
    PKSCLOCK_CREATE ClockCreate;
    PKSICLOCK Clock;

    Status = KsValidateClockCreateRequest(Irp, &ClockCreate);
    if (!NT_SUCCESS(Status))
        return Status;

    /* let's allocate the clock struct */
    Clock = AllocateItem(NonPagedPool, sizeof(KSICLOCK));
    if (!Clock)
    {
        FreeItem(ClockCreate);
        return STATUS_INSUFFICIENT_RESOURCES;
    }

    /* now allocate the object header */
    Status = KsAllocateObjectHeader((PVOID*)&Clock->ObjectHeader, 0, NULL, Irp, &DispatchTable);

    /* did it work */
    if (!NT_SUCCESS(Status))
    {
        /* failed */
        FreeItem(ClockCreate);
        FreeItem(Clock);
        return Status;
    }

    /* initialize clock */
    /* FIXME IKsClock */
    Clock->ObjectHeader->ObjectType = (PVOID)Clock;
    Clock->ref = 1;
    Clock->ClockCreate = ClockCreate;
    Clock->DefaultClock = (PKSIDEFAULTCLOCK)DefaultClock;

    /* increment reference count */
    InterlockedIncrement(&Clock->DefaultClock->ReferenceCount);

    return Status;
}
开发者ID:Moteesh,项目名称:reactos,代码行数:50,代码来源:clocks.c

示例15: Enum

MIXER_STATUS
Enum(
    IN  PVOID EnumContext,
    IN  ULONG DeviceIndex,
    OUT LPWSTR * DeviceName,
    OUT PHANDLE OutHandle,
    OUT PHANDLE OutKey)
{
    PDEVICE_OBJECT DeviceObject;
    ULONG DeviceCount;
    NTSTATUS Status;
    UNICODE_STRING KeyName;

    /* get enumeration context */
    DeviceObject = (PDEVICE_OBJECT)EnumContext;

    /* get device count */
    DeviceCount = GetSysAudioDeviceCount(DeviceObject);

    if (DeviceIndex >= DeviceCount)
    {
        /* no more devices */
        return MM_STATUS_NO_MORE_DEVICES;
    }

    /* get device name */
    Status = GetSysAudioDevicePnpName(DeviceObject, DeviceIndex, DeviceName);

    if (!NT_SUCCESS(Status))
    {
        /* failed to retrieve device name */
        return MM_STATUS_UNSUCCESSFUL;
    }

    /* intialize key name */
    RtlInitUnicodeString(&KeyName, *DeviceName);

    /* open device interface key */
    Status = IoOpenDeviceInterfaceRegistryKey(&KeyName, GENERIC_READ | GENERIC_WRITE, OutKey);
#if 0
    if (!NT_SUCCESS(Status))
    {
        /* failed to open key */
        DPRINT("IoOpenDeviceInterfaceRegistryKey failed with %lx\n", Status);
        FreeItem(*DeviceName);
        return MM_STATUS_UNSUCCESSFUL;
    }
#endif

    /* open device handle */
    Status = OpenDevice(*DeviceName, OutHandle, NULL);
    if (!NT_SUCCESS(Status))
    {
        /* failed to open device */
        return MM_STATUS_UNSUCCESSFUL;
    }

    return MM_STATUS_SUCCESS;
}
开发者ID:hoangduit,项目名称:reactos,代码行数:59,代码来源:mmixer.c


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