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


C++ RtlZeroMemory函数代码示例

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


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

示例1: FWHookTcpipRecvHandler

NTSTATUS	FWHookTcpipRecvHandler()
{
	PKK_NDIS_PROTOCOL_BLOCK	pTcpipProtocolBlcok=NULL;
	PKK_NDIS_PROTOCOL_BLOCK	pProtocolBlockHeader=NULL;
	ULONG	ut1,ut2;
	PNDIS_COMMON_OPEN_BLOCK_2k3_early	pOpenBlock=NULL;
	NTSTATUS	status	=	STATUS_SUCCESS;
	PNDIS_HOOK_INFO	pHI	;
	PULONG	ptmp;
	PLOCK_STATE	pLockState1=NULL;

#ifdef VMPROTECT
	VMProtectBeginVirtualization("FWHookTcpipRecvHandler");
#endif


	pLockState1	=	kmalloc(sizeof(LOCK_STATE));

	ut1	=	ut2	=	0;

	do 
	{
		pTcpipProtocolBlcok	=	(PKK_NDIS_PROTOCOL_BLOCK)GetTcpipProtocolBlock();

		if (pTcpipProtocolBlcok==0)
		{
			status	=	STATUS_UNSUCCESSFUL;
			break;
		}
		pOpenBlock	=	pTcpipProtocolBlcok->OpenQueue;
		NdisAcquireReadWriteLock(&g_HookTcpipFireWallLock, KKRWLOCK_FOR_WRITE, pLockState1);

		while(pOpenBlock)
		{

// 			if (!IsPhysicalMiniport(pOpenBlock->MiniportHandle))
// 			{
// 				goto __nextpOpenBlock;
// 			}
			pHI	=	kmalloc(sizeof(NDIS_HOOK_INFO));
			ptmp=NULL;
			RtlZeroMemory(pHI, sizeof(NDIS_HOOK_INFO));
			pHI->OldHandler	=	(PVOID)pOpenBlock->ReceiveHandler;
			pHI->Address2Restore	=	&(pOpenBlock->ReceiveHandler);
			pHI->pMiniBlock	=	(ULONG)pOpenBlock->MiniportHandle;
			pHI->pSignContext	=	(PVOID)pOpenBlock->ProtocolBindingContext;
			pHI->pProtocolBindingContext	=	(ULONG)pOpenBlock->ProtocolBindingContext;
			pHI->pOpenblock	=	(ULONG_PTR)pOpenBlock;
			pHI->szFuncname	=	"KKNewTcpipArpRcv";
			pHI->NewHandler	=	(PVOID)KKNewTcpipArpRcv;
			*(PULONG)&(pOpenBlock->ReceivePacketHandler)=0;	//把这个清0了

			InsertHeadList(&g_HookTcpipFireWallList.Next, &pHI->Next);


			ptmp	=	(ULONG*)pHI->Address2Restore;
			*ptmp	=	(ULONG)KKNewTcpipArpRcv;

//__nextpOpenBlock:
			pOpenBlock	=	(PNDIS_COMMON_OPEN_BLOCK_2k3_early)pOpenBlock->ProtocolNextOpen;
		}
		NdisReleaseReadWriteLock(&g_HookTcpipFireWallLock, pLockState1);



	} while (0);

	if (pLockState1)
	{
		kfree(pLockState1);
	}
#ifdef VMPROTECT
	VMProtectEnd();
#endif
	
	return status;
}
开发者ID:wtxpwh,项目名称:cyber-interceptor,代码行数:77,代码来源:firewall.c

示例2: LurnResetFaultInfo

VOID
LurnResetFaultInfo(PLURELATION_NODE Lurn)
{
	RtlZeroMemory(&Lurn->FaultInfo, sizeof(LURN_FAULT_INFO));
}
开发者ID:Nevermore2015,项目名称:ndas4windows,代码行数:5,代码来源:ndaslurn.c

示例3: testdrvRegEnumerateValueKeys

///////////////////////////////////////////////////////////////////////////////////////////////////
//  testdrvRegEnumerateValueKeys
//      Enumerates and print names of sub value keys using a given registry key handle.
//
//  Arguments:
//      IN  RegKeyHandle
//              Handle to root key
//
//  Return Value:
//      none
//
VOID testdrvRegEnumerateValueKeys(
    IN  HANDLE RegKeyHandle
    )
{
    NTSTATUS                        status;
    ULONG                           index;
    PKEY_VALUE_BASIC_INFORMATION    regBuffer;
    PWCHAR                          nameBuffer;
    ULONG                           length;

    status = STATUS_SUCCESS;
    index = 0;
    regBuffer = NULL;
    nameBuffer = NULL;

    while (status != STATUS_NO_MORE_ENTRIES)
    {
        // Get the buffer size necessary
        status = ZwEnumerateValueKey(
                    RegKeyHandle,
                    index,
                    KeyValueBasicInformation,
                    NULL,
                    0,
                    &length
                    );

        if ((status != STATUS_BUFFER_TOO_SMALL) && (status != STATUS_BUFFER_OVERFLOW))
        {
            if (status != STATUS_NO_MORE_ENTRIES)
            {
                testdrvDebugPrint(DBG_PNP, DBG_INFO, __FUNCTION__ ": ZwEnumerateValueKey failed %x", status);
            }
            else
            {
                testdrvDebugPrint(DBG_PNP, DBG_INFO, __FUNCTION__ ": Enumerated %d value keys", index);
            }

            break;
        }

        regBuffer = 
            (PKEY_VALUE_BASIC_INFORMATION)ExAllocatePoolWithTag(NonPagedPool, length, TESTDRV_POOL_TAG);

        if (regBuffer == NULL)
        {
            continue;
        }

        // Now actually attempt to get subkey info
        status = ZwEnumerateValueKey(
                    RegKeyHandle,
                    index,
                    KeyValueBasicInformation,
                    regBuffer,
                    length,
                    &length
                    );

        if (!NT_SUCCESS(status))
        {
            testdrvDebugPrint(DBG_PNP, DBG_INFO, __FUNCTION__ ": ZwEnumerateValueKey failed %x", status);

            // Free our temporary storage
            ExFreePool(regBuffer);

            continue;
        }

        // Allocate a buffer for the display name
        nameBuffer = (PWCHAR)ExAllocatePoolWithTag(
                                    PagedPool, 
                                    regBuffer->NameLength + sizeof(WCHAR), 
                                    TESTDRV_POOL_TAG
                                    );

        if (nameBuffer == NULL)
        {
            // Free our temporary storage
            ExFreePool(regBuffer);

            continue;
        }

        // NULL terminate the string
        RtlZeroMemory(nameBuffer, regBuffer->NameLength + sizeof(WCHAR));

        // Copy the name over
        RtlCopyMemory(nameBuffer, regBuffer->Name, regBuffer->NameLength);
//.........这里部分代码省略.........
开发者ID:ITh4cker,项目名称:DECAF,代码行数:101,代码来源:registry.c

示例4: MonitorAppAddFilters

DWORD
MonitorAppAddFilters(
   _In_    HANDLE         engineHandle,
   _In_    FWP_BYTE_BLOB* applicationPath)
/*++

Routine Description:

    Adds the required sublayer, filters and callouts to the Windows
    Filtering Platform (WFP).

Arguments:
   
   [in] HANDLE engineHandle - Handle to the base Filtering engine
   [in] FWP_BYTE_BLOB* applicationPath - full path to the application including
                                         the NULL terminator and size also 
                                         including the NULL the terminator
   [in] CALLOUTS* callouts - The callouts that need to be added.

Return Value:

    NO_ERROR or a specific result

--*/
{
   DWORD result = NO_ERROR;
   FWPM_SUBLAYER monitorSubLayer;
   FWPM_FILTER filter;
   FWPM_FILTER_CONDITION filterConditions[2]; // We only need two for this call.

   RtlZeroMemory(&monitorSubLayer, sizeof(FWPM_SUBLAYER)); 

   monitorSubLayer.subLayerKey = MONITOR_SAMPLE_SUBLAYER;
   monitorSubLayer.displayData.name = L"Monitor Sample Sub layer";
   monitorSubLayer.displayData.description = L"Monitor Sample Sub layer";
   monitorSubLayer.flags = 0;
   // We don't really mind what the order of invocation is.
   monitorSubLayer.weight = 0;
   
   printf("Starting Transaction\n");

   result = FwpmTransactionBegin(engineHandle, 0);
   if (NO_ERROR != result)
   {
      goto abort;
   }
   printf("Successfully Started Transaction\n");

   printf("Adding Sublayer\n");

   result = FwpmSubLayerAdd(engineHandle, &monitorSubLayer, NULL);
   if (NO_ERROR != result)
   {
      goto abort;
   }
   
   printf("Sucessfully added Sublayer\n");
   
   RtlZeroMemory(&filter, sizeof(FWPM_FILTER));

   filter.layerKey = FWPM_LAYER_ALE_FLOW_ESTABLISHED_V4;
   filter.displayData.name = L"Flow established filter.";
   filter.displayData.description = L"Sets up flow for traffic that we are interested in.";
   filter.action.type = FWP_ACTION_CALLOUT_INSPECTION; // We're only doing inspection.
   filter.action.calloutKey = MONITOR_SAMPLE_FLOW_ESTABLISHED_CALLOUT_V4;
   filter.filterCondition = filterConditions;
   filter.subLayerKey = monitorSubLayer.subLayerKey;
   filter.weight.type = FWP_EMPTY; // auto-weight.
      
   filter.numFilterConditions = 2;

   RtlZeroMemory(filterConditions, sizeof(filterConditions));

   //
   // Add the application path to the filter conditions.
   //
   filterConditions[0].fieldKey = FWPM_CONDITION_ALE_APP_ID;
   filterConditions[0].matchType = FWP_MATCH_EQUAL;
   filterConditions[0].conditionValue.type = FWP_BYTE_BLOB_TYPE;
   filterConditions[0].conditionValue.byteBlob = applicationPath;

   //
   // For the purposes of this sample, we will monitor TCP traffic only.
   //
   filterConditions[1].fieldKey = FWPM_CONDITION_IP_PROTOCOL;
   filterConditions[1].matchType = FWP_MATCH_EQUAL;
   filterConditions[1].conditionValue.type = FWP_UINT8;
   filterConditions[1].conditionValue.uint8 = IPPROTO_TCP;

   printf("Adding Flow Established Filter\n");

   result = FwpmFilterAdd(engineHandle,
                       &filter,
                       NULL,
                       NULL);

   if (NO_ERROR != result)
   {
      goto abort;
   }
//.........这里部分代码省略.........
开发者ID:0xhack,项目名称:Windows-driver-samples,代码行数:101,代码来源:monitor.cpp

示例5: PcDiskReadLogicalSectorsLBA

static BOOLEAN PcDiskReadLogicalSectorsLBA(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
{
    REGS                        RegsIn;
    REGS                        RegsOut;
    ULONG                            RetryCount;
    PI386_DISK_ADDRESS_PACKET    Packet = (PI386_DISK_ADDRESS_PACKET)(BIOSCALLBUFFER);

    TRACE("PcDiskReadLogicalSectorsLBA() DriveNumber: 0x%x SectorNumber: %I64d SectorCount: %d Buffer: 0x%x\n", DriveNumber, SectorNumber, SectorCount, Buffer);
    ASSERT(((ULONG_PTR)Buffer) <= 0xFFFFF);

    // BIOS int 0x13, function 42h - IBM/MS INT 13 Extensions - EXTENDED READ
    RegsIn.b.ah = 0x42;                    // Subfunction 42h
    RegsIn.b.dl = DriveNumber;            // Drive number in DL (0 - floppy, 0x80 - harddisk)
    RegsIn.x.ds = BIOSCALLBUFSEGMENT;    // DS:SI -> disk address packet
    RegsIn.w.si = BIOSCALLBUFOFFSET;

    // Setup disk address packet
    RtlZeroMemory(Packet, sizeof(I386_DISK_ADDRESS_PACKET));
    Packet->PacketSize = sizeof(I386_DISK_ADDRESS_PACKET);
    Packet->Reserved = 0;
    Packet->LBABlockCount = (USHORT)SectorCount;
    ASSERT(Packet->LBABlockCount == SectorCount);
    Packet->TransferBufferOffset = ((ULONG_PTR)Buffer) & 0x0F;
    Packet->TransferBufferSegment = (USHORT)(((ULONG_PTR)Buffer) >> 4);
    Packet->LBAStartBlock = SectorNumber;

    // BIOS int 0x13, function 42h - IBM/MS INT 13 Extensions - EXTENDED READ
    // Return:
    // CF clear if successful
    // AH = 00h
    // CF set on error
    // AH = error code
    // disk address packet's block count field set to the
    // number of blocks successfully transferred

    // Retry 3 times
    for (RetryCount=0; RetryCount<3; RetryCount++)
    {
        Int386(0x13, &RegsIn, &RegsOut);

        // If it worked return TRUE
        if (INT386_SUCCESS(RegsOut))
        {
            return TRUE;
        }
        // If it was a corrected ECC error then the data is still good
        else if (RegsOut.b.ah == 0x11)
        {
            return TRUE;
        }
        // If it failed the do the next retry
        else
        {
            PcDiskResetController(DriveNumber);

            continue;
        }
    }

    // If we get here then the read failed
    ERR("Disk Read Failed in LBA mode: %x (DriveNumber: 0x%x SectorNumber: %I64d SectorCount: %d)\n", RegsOut.b.ah, DriveNumber, SectorNumber, SectorCount);

    return FALSE;
}
开发者ID:Nevermore2015,项目名称:reactos,代码行数:64,代码来源:pcdisk.c

示例6: NdisRegisterProtocol

/*
 * @implemented
 */
VOID
EXPORT
NdisRegisterProtocol(
    OUT PNDIS_STATUS                    Status,
    OUT PNDIS_HANDLE                    NdisProtocolHandle,
    IN  PNDIS_PROTOCOL_CHARACTERISTICS  ProtocolCharacteristics,
    IN  UINT                            CharacteristicsLength)
/*
 * FUNCTION: Registers an NDIS driver's ProtocolXxx entry points
 * ARGUMENTS:
 *     Status                  = Address of buffer for status information
 *     NdisProtocolHandle      = Address of buffer for handle used to identify the driver
 *     ProtocolCharacteristics = Pointer to NDIS_PROTOCOL_CHARACTERISTICS structure
 *     CharacteristicsLength   = Size of structure which ProtocolCharacteristics targets
 * NOTES:
 *     - you *must* set NdisProtocolHandle before doing anything that could wind up
 *       getting BindAdapterHandler, as it will probably call OpenAdapter with this handle
 *     - the above implies that the initialization of the protocol block must be complete
 *       by then
 * TODO:
 *     - break this function up - probably do a 'ndisRefreshProtocolBindings' function
 *     - make this thing able to handle >1 protocol
 */
{
  PPROTOCOL_BINDING Protocol;
  NTSTATUS NtStatus;
  UINT MinSize;
  PNET_PNP_EVENT PnPEvent;

  NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));

  *NdisProtocolHandle = NULL;

  /* first validate the PROTOCOL_CHARACTERISTICS */
  switch (ProtocolCharacteristics->MajorNdisVersion)
    {
    case 0x03:
      /* we don't really want to support ndis3 drivers - so we complain for now */
      NDIS_DbgPrint(MID_TRACE, ("NDIS 3 protocol attempting to register\n"));
      MinSize = sizeof(NDIS30_PROTOCOL_CHARACTERISTICS);
      break;

    case 0x04:
      MinSize = sizeof(NDIS40_PROTOCOL_CHARACTERISTICS);
      break;

    case 0x05:
      MinSize = sizeof(NDIS50_PROTOCOL_CHARACTERISTICS);
      break;

    default:
      *Status = NDIS_STATUS_BAD_VERSION;
      NDIS_DbgPrint(MIN_TRACE, ("Incorrect characteristics size\n"));
      return;
    }

  if (CharacteristicsLength < MinSize)
    {
      NDIS_DbgPrint(MIN_TRACE, ("Bad protocol characteristics.\n"));
      *Status = NDIS_STATUS_BAD_CHARACTERISTICS;
      return;
    }

  /* set up the protocol block */
  Protocol = ExAllocatePool(NonPagedPool, sizeof(PROTOCOL_BINDING));
  if (!Protocol)
    {
      NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
      *Status = NDIS_STATUS_RESOURCES;
      return;
    }

  RtlZeroMemory(Protocol, sizeof(PROTOCOL_BINDING));
  RtlCopyMemory(&Protocol->Chars, ProtocolCharacteristics, MinSize);

  NtStatus = RtlUpcaseUnicodeString(&Protocol->Chars.Name, &ProtocolCharacteristics->Name, TRUE);
  if (!NT_SUCCESS(NtStatus))
    {
      NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
      ExFreePool(Protocol);
      *Status = NDIS_STATUS_RESOURCES;
      return;
    }

  KeInitializeSpinLock(&Protocol->Lock);

  InitializeListHead(&Protocol->AdapterListHead);

  /* We must set this before the call to ndisBindMiniportsToProtocol because the protocol's
   * BindAdapter handler might need it */

  *NdisProtocolHandle = Protocol;

  ndisBindMiniportsToProtocol(Status, Protocol);

  /* Should we only send this if ndisBindMiniportsToProtocol succeeds? */
  PnPEvent = ProSetupPnPEvent(NetEventBindsComplete, NULL, 0);
//.........这里部分代码省略.........
开发者ID:hoangduit,项目名称:reactos,代码行数:101,代码来源:protocol.c

示例7: MonitorAppAddCallouts

DWORD
MonitorAppAddCallouts()
/*++

Routine Description:

   Adds the callouts during installation

Arguments:
   
   [in]  PCWSTR AppPath - The path to the application to monitor.

Return Value:

    NO_ERROR or a specific FWP result.

--*/
{
   FWPM_CALLOUT callout;
   DWORD result;
   FWPM_DISPLAY_DATA displayData;
   HANDLE engineHandle = NULL;
   FWPM_SESSION session;
   RtlZeroMemory(&session, sizeof(FWPM_SESSION));

   session.displayData.name = L"Monitor Sample Non-Dynamic Session";
   session.displayData.description = L"For Adding callouts";

   printf("Opening Filtering Engine\n");
   result =  FwpmEngineOpen(
                            NULL,
                            RPC_C_AUTHN_WINNT,
                            NULL,
                            &session,
                            &engineHandle
                            );

   if (NO_ERROR != result)
   {
      goto cleanup;
   }

   printf("Starting Transaction for adding callouts\n");
   result = FwpmTransactionBegin(engineHandle, 0);
   if (NO_ERROR != result)
   {
      goto abort;
   }

   printf("Successfully started the Transaction\n");

   RtlZeroMemory(&callout, sizeof(FWPM_CALLOUT));
   displayData.description = MONITOR_FLOW_ESTABLISHED_CALLOUT_DESCRIPTION;
   displayData.name = MONITOR_FLOW_ESTABLISHED_CALLOUT_NAME;

   callout.calloutKey = MONITOR_SAMPLE_FLOW_ESTABLISHED_CALLOUT_V4;
   callout.displayData = displayData;
   callout.applicableLayer = FWPM_LAYER_ALE_FLOW_ESTABLISHED_V4;
   callout.flags = FWPM_CALLOUT_FLAG_PERSISTENT; // Make this a persistent callout.

   printf("Adding Persistent Flow Established callout through the Filtering Engine\n");

   result = FwpmCalloutAdd(engineHandle, &callout, NULL, NULL);
   if (NO_ERROR != result)
   {
      goto abort;
   }

   printf("Successfully Added Persistent Flow Established callout.\n");

   RtlZeroMemory(&callout, sizeof(FWPM_CALLOUT));

   displayData.description = MONITOR_STREAM_CALLOUT_DESCRIPTION;
   displayData.name = MONITOR_STREAM_CALLOUT_DESCRIPTION;

   callout.calloutKey = MONITOR_SAMPLE_STREAM_CALLOUT_V4;
   callout.displayData = displayData;
   callout.applicableLayer = FWPM_LAYER_STREAM_V4;
   callout.flags = FWPM_CALLOUT_FLAG_PERSISTENT; // Make this a persistent callout.

   printf("Adding Persistent Stream callout through the Filtering Engine\n");

   result = FwpmCalloutAdd(engineHandle, &callout, NULL, NULL);
   if (NO_ERROR != result)
   {
      goto abort;
   }

   printf("Successfully Added Persistent Stream callout.\n");
   
   printf("Committing Transaction\n");
   result = FwpmTransactionCommit(engineHandle);
   if (NO_ERROR == result)
   {
      printf("Successfully Committed Transaction.\n");
   }
   goto cleanup;

abort:
   printf("Aborting Transaction\n");
//.........这里部分代码省略.........
开发者ID:0xhack,项目名称:Windows-driver-samples,代码行数:101,代码来源:monitor.cpp

示例8: XixfsGetNdasBacl

NTSTATUS
XixfsGetNdasBacl(
	IN	PDEVICE_OBJECT	DeviceObject,
	OUT PNDAS_BLOCK_ACL	NdasBacl,
	IN BOOLEAN			SystemOrUser
)
{

	NTSTATUS		RC = STATUS_SUCCESS;
	BOOLEAN			result;
	PSRB_IO_CONTROL	pSrbIoCtl;
	PNDASSCSI_QUERY_INFO_DATA	QueryInfo;
	int				OutbuffSize = 0;
	PUCHAR			outBuff = NULL;
	PDEVICE_OBJECT	scsiAdpaterDeviceObject;


	PAGED_CODE();

	ASSERT(DeviceObject);	


	// need somemore
	ASSERT( NdasBacl->Length >= sizeof(NDASSCSI_QUERY_INFO_DATA) );
	
	result = XixFsGetScsiportAdapter(DeviceObject, &scsiAdpaterDeviceObject);
	
	if(result != TRUE){
		DebugTrace(DEBUG_LEVEL_ERROR, DEBUG_TARGET_ALL,
			("Fail XixfsGetNdasBacl!!! \n"));
		return STATUS_UNSUCCESSFUL;
	}	


	

	if(NdasBacl->Length < sizeof(NDASSCSI_QUERY_INFO_DATA)){
		DebugTrace(DEBUG_LEVEL_ERROR, DEBUG_TARGET_ALL,
			("Fail XixfsGetNdasBacl : TOO SAMLL BUFFER !!! \n"));
		return STATUS_UNSUCCESSFUL;
	}

	OutbuffSize = sizeof(SRB_IO_CONTROL) + NdasBacl->Length;
	OutbuffSize = SECTORALIGNSIZE_512(OutbuffSize);
	pSrbIoCtl = (PSRB_IO_CONTROL)ExAllocatePool(NonPagedPool , OutbuffSize);

	if(!pSrbIoCtl){
		ObDereferenceObject(scsiAdpaterDeviceObject);
		return STATUS_INSUFFICIENT_RESOURCES;
	}	

	try{
		RtlZeroMemory(pSrbIoCtl, OutbuffSize);
		pSrbIoCtl->HeaderLength = sizeof(SRB_IO_CONTROL);
		RtlCopyMemory(pSrbIoCtl->Signature, NDASSCSI_IOCTL_SIGNATURE, 8);
		pSrbIoCtl->Timeout = 10;
		pSrbIoCtl->ControlCode = NDASSCSI_IOCTL_QUERYINFO_EX;
		pSrbIoCtl->Length = OutbuffSize;


		
		QueryInfo = (PNDASSCSI_QUERY_INFO_DATA)((PUCHAR)pSrbIoCtl + sizeof(SRB_IO_CONTROL));
		outBuff = (PUCHAR)QueryInfo;

		QueryInfo->Length = sizeof(NDASSCSI_QUERY_INFO_DATA);
		QueryInfo->InfoClass = SystemOrUser?NdscSystemBacl:NdscUserBacl;
		QueryInfo->QueryDataLength = 0;
		
		//Fist step Send Disk
		RC = XixFsRawDevIoCtrl ( 
						DeviceObject,
						IOCTL_SCSI_MINIPORT,
						(uint8 *)pSrbIoCtl,
						OutbuffSize,
						(uint8 *)pSrbIoCtl,
						OutbuffSize,
						FALSE,
						NULL
						);
		
		if(NT_SUCCESS(RC)){
			RtlCopyMemory(NdasBacl, outBuff, NdasBacl->Length);
		}else{
			// Send port
			RC = XixFsRawDevIoCtrl ( 
							scsiAdpaterDeviceObject,
							IOCTL_SCSI_MINIPORT,
							(uint8 *)pSrbIoCtl,
							OutbuffSize,
							(uint8 *)pSrbIoCtl,
							OutbuffSize,
							FALSE,
							NULL
							);
			
			if(NT_SUCCESS(RC)){
				RtlCopyMemory(NdasBacl, outBuff, NdasBacl->Length);
			}
		}

//.........这里部分代码省略.........
开发者ID:JanD1943,项目名称:ndas4windows,代码行数:101,代码来源:XixFsNdasDeviceControl.c

示例9: XixFsCheckXifsd

NTSTATUS
XixFsCheckXifsd(
	PDEVICE_OBJECT			DeviceObject,
	PPARTITION_INFORMATION	partitionInfo,
	PBLOCKACE_ID			BlockAceId,
	PBOOLEAN				IsWriteProtected
)
{
	NTSTATUS		RC = STATUS_SUCCESS;
	NDSCIOCTL_PRIMUNITDISKINFO DiskInfo;
	NDAS_BLOCK_ACE	Partition_BACL;
	ASSERT(DeviceObject);
	
	*IsWriteProtected = FALSE;
	
	DebugTrace(DEBUG_LEVEL_ALL, (DEBUG_TARGET_RESOURCE| DEBUG_TARGET_FCB|DEBUG_TARGET_LOCK),
		("Enter XixFsSetXifsd \n"));

	try{
		RC = XixFsGetNdadDiskInfo(DeviceObject, &DiskInfo);

		if(NT_SUCCESS(RC)) {
				
			// is device support ndas lock
			if((DiskInfo.Lur.SupportedFeatures & (NDASFEATURE_GP_LOCK|NDASFEATURE_ADV_GP_LOCK)) == 0 ){
				DebugTrace(DEBUG_LEVEL_ERROR, DEBUG_TARGET_ALL,
					("Enter XixFsSetXifsd : don't support lock \n"));
				RC = STATUS_UNSUCCESSFUL;
				try_return(RC);
			}

		
		
			if(DiskInfo.Lur.DeviceMode != DEVMODE_SHARED_READWRITE){

				DebugTrace(DEBUG_LEVEL_ERROR, DEBUG_TARGET_ALL,
					("Failed XixFsSetXifsd : don't support read write \n"));
// Changed by ILGU HONG for readonly 09052006
				*IsWriteProtected = TRUE;
				RC = STATUS_SUCCESS;
// Changed by ILGU HONG for readonly end
				try_return(RC);
			}

				
			if(DiskInfo.Lur.EnabledFeatures  & NDASFEATURE_RO_FAKE_WRITE){
				
				RtlZeroMemory(&Partition_BACL, sizeof(PNDAS_BLOCK_ACE));
				Partition_BACL.AccessMode = NBACE_ACCESS_WRITE;
				Partition_BACL.BlockEndAddr = (partitionInfo->StartingOffset.QuadPart + partitionInfo->PartitionLength.QuadPart)/512 -1;
				Partition_BACL.BlockStartAddr = partitionInfo->StartingOffset.QuadPart/512;

				RC = XixFsAddUserBacl(DeviceObject, &Partition_BACL,BlockAceId);
				
				if(!NT_SUCCESS(RC)){
					DebugTrace(DEBUG_LEVEL_ERROR, DEBUG_TARGET_ALL,
						("Faile XixFsSetXifsd : XixFsAddUserBacl \n"));					
				}

			}


		}
	}finally{

	}


	return RC;	
}
开发者ID:JanD1943,项目名称:ndas4windows,代码行数:70,代码来源:XixFsNdasDeviceControl.c

示例10: XixFsGetNdadDiskInfo

	//	Added by ILGU HONG for 08312006
NTSTATUS
XixFsGetNdadDiskInfo(
	IN PDEVICE_OBJECT	DeviceObject,
	OUT	PNDSCIOCTL_PRIMUNITDISKINFO	PrimUnitDisk
	)
{
	NTSTATUS		RC = STATUS_SUCCESS;
	PDEVICE_OBJECT		scsiAdpaterDeviceObject = NULL;
	BOOLEAN				result = FALSE;
	PSRB_IO_CONTROL		pSrbIoCtl = NULL;
	uint32				OutbuffSize = 0;
	PNDASSCSI_QUERY_INFO_DATA		QueryInfo;
	PNDSCIOCTL_PRIMUNITDISKINFO	pPrimUnitDisk;

	PAGED_CODE();

	ASSERT(DeviceObject);

	
	DebugTrace(DEBUG_LEVEL_ALL, (DEBUG_TARGET_RESOURCE| DEBUG_TARGET_FCB|DEBUG_TARGET_LOCK),
		("Enter XixFsGetNdadDeviceInfo \n"));

	result = XixFsGetScsiportAdapter(DeviceObject, &scsiAdpaterDeviceObject);
	if(result != TRUE){
		DebugTrace(DEBUG_LEVEL_ERROR, DEBUG_TARGET_ALL,
			("Fail GetScsiportAdpater!!! \n"));
		return STATUS_UNSUCCESSFUL;
	}

	OutbuffSize = sizeof(SRB_IO_CONTROL) + sizeof(NDASSCSI_QUERY_INFO_DATA) + sizeof(NDSCIOCTL_PRIMUNITDISKINFO);
	OutbuffSize = SECTORALIGNSIZE_512(OutbuffSize);
	pSrbIoCtl = (PSRB_IO_CONTROL)ExAllocatePoolWithTag(NonPagedPool, OutbuffSize, TAG_BUFFER);
	
	if(!pSrbIoCtl){
		ObDereferenceObject(scsiAdpaterDeviceObject);
		return STATUS_INSUFFICIENT_RESOURCES;
	}

	try{
		RtlZeroMemory(pSrbIoCtl, OutbuffSize);
		
		pSrbIoCtl->HeaderLength = sizeof(SRB_IO_CONTROL);
		RtlCopyMemory(pSrbIoCtl->Signature, NDASSCSI_IOCTL_SIGNATURE, 8);
		pSrbIoCtl->Timeout = 10;
		pSrbIoCtl->ControlCode = NDASSCSI_IOCTL_QUERYINFO_EX;
		pSrbIoCtl->Length =  sizeof(NDASSCSI_QUERY_INFO_DATA) + sizeof(NDSCIOCTL_PRIMUNITDISKINFO);
		
		QueryInfo = (PNDASSCSI_QUERY_INFO_DATA)((PUCHAR)pSrbIoCtl + sizeof(SRB_IO_CONTROL));
		pPrimUnitDisk = (PNDSCIOCTL_PRIMUNITDISKINFO)((PUCHAR)pSrbIoCtl + sizeof(SRB_IO_CONTROL));

		QueryInfo->Length = sizeof(NDASSCSI_QUERY_INFO_DATA);
		QueryInfo->InfoClass = NdscPrimaryUnitDiskInformation;
		QueryInfo->QueryDataLength = 0;




		//Fist step Send Disk 
		RC = XixFsRawDevIoCtrl ( 
						DeviceObject,
						IOCTL_SCSI_MINIPORT,
						(uint8 *)pSrbIoCtl,
						OutbuffSize,
						(uint8 *)pSrbIoCtl,
						OutbuffSize,
						FALSE,
						NULL
						);

		if(NT_SUCCESS(RC)){

			if(pPrimUnitDisk->Length == sizeof(NDSCIOCTL_PRIMUNITDISKINFO)) {
				RtlCopyMemory(PrimUnitDisk, pPrimUnitDisk, sizeof(NDSCIOCTL_PRIMUNITDISKINFO));
			}

			DebugTrace(DEBUG_LEVEL_ERROR, DEBUG_TARGET_ALL,
				("Success XixFsGetNdadDeviceInfo Status (0x%x)\n", RC));
		}else{	
			// Send port 
			RC = XixFsRawDevIoCtrl ( 
							scsiAdpaterDeviceObject,
							IOCTL_SCSI_MINIPORT,
							(uint8 *)pSrbIoCtl,
							OutbuffSize,
							(uint8 *)pSrbIoCtl,
							OutbuffSize,
							FALSE,
							NULL
							);

			if(!NT_SUCCESS(RC)){
				DebugTrace(DEBUG_LEVEL_ERROR, DEBUG_TARGET_ALL,
					("Fail XixFsGetNdadDeviceInfo Status (0x%x)\n", RC));
			}else{

				if(pPrimUnitDisk->Length == sizeof(NDSCIOCTL_PRIMUNITDISKINFO)) {
					RtlCopyMemory(PrimUnitDisk, pPrimUnitDisk, sizeof(NDSCIOCTL_PRIMUNITDISKINFO));
				}

//.........这里部分代码省略.........
开发者ID:JanD1943,项目名称:ndas4windows,代码行数:101,代码来源:XixFsNdasDeviceControl.c

示例11: XixFsRemoveUserBacl

NTSTATUS
XixFsRemoveUserBacl(
	IN	PDEVICE_OBJECT	DeviceObject,
	IN	BLOCKACE_ID		BlockAceId
){
	NTSTATUS		RC = STATUS_SUCCESS;
	BOOLEAN			result;
	PSRB_IO_CONTROL	pSrbIoCtl;
	int				OutbuffSize;
	PNDSCIOCTL_REMOVE_USERBACL	removeNdasBace;
	PDEVICE_OBJECT	scsiAdpaterDeviceObject;

	PAGED_CODE();

	result = XixFsGetScsiportAdapter(DeviceObject, &scsiAdpaterDeviceObject);
	
	if(result != TRUE){
		DebugTrace(DEBUG_LEVEL_ERROR, DEBUG_TARGET_ALL,
			("Fail XixFsRemoveUserBacl!!! \n"));
		return STATUS_UNSUCCESSFUL;
	}	

	OutbuffSize = sizeof(SRB_IO_CONTROL) + sizeof(NDASSCSI_QUERY_INFO_DATA) + sizeof(NDSCIOCTL_REMOVE_USERBACL);
	OutbuffSize = SECTORALIGNSIZE_512(OutbuffSize);
	pSrbIoCtl = (PSRB_IO_CONTROL)ExAllocatePool(NonPagedPool , OutbuffSize);

	if(!pSrbIoCtl){
		ObDereferenceObject(scsiAdpaterDeviceObject);
		return STATUS_INSUFFICIENT_RESOURCES;
	}	

	
	try{
		RtlZeroMemory(pSrbIoCtl, OutbuffSize);
		pSrbIoCtl->HeaderLength = sizeof(SRB_IO_CONTROL);
		RtlCopyMemory(pSrbIoCtl->Signature, NDASSCSI_IOCTL_SIGNATURE, 8);
		pSrbIoCtl->Timeout = 10;
		pSrbIoCtl->ControlCode = NDASSCSI_IOCTL_REMOVE_USERBACL;
		pSrbIoCtl->Length = sizeof(NDSCIOCTL_REMOVE_USERBACL);

		
		removeNdasBace = (PNDSCIOCTL_REMOVE_USERBACL)((PUCHAR)pSrbIoCtl + sizeof(SRB_IO_CONTROL));
		removeNdasBace->NdasBlockAceId = BlockAceId;

		//Fist step Send Disk
		RC = XixFsRawDevIoCtrl ( 
						DeviceObject,
						IOCTL_SCSI_MINIPORT,
						(uint8 *)pSrbIoCtl,
						OutbuffSize,
						(uint8 *)pSrbIoCtl,
						OutbuffSize,
						FALSE,
						NULL
						);

		if(!NT_SUCCESS(RC)) {
			// Send port
			RC = XixFsRawDevIoCtrl ( 
							scsiAdpaterDeviceObject,
							IOCTL_SCSI_MINIPORT,
							(uint8 *)pSrbIoCtl,
							OutbuffSize,
							(uint8 *)pSrbIoCtl,
							OutbuffSize,
							FALSE,
							NULL
							);

			if(!NT_SUCCESS(RC)) {
				DebugTrace(DEBUG_LEVEL_ERROR, DEBUG_TARGET_ALL,
				("Fail XixFsRemoveUserBacl Not NetDisk. status = %x\n", RC));
			}
		}

	


	}finally{
		ObDereferenceObject(scsiAdpaterDeviceObject);
		ExFreePool(pSrbIoCtl);
	}

	return RC;
}
开发者ID:JanD1943,项目名称:ndas4windows,代码行数:85,代码来源:XixFsNdasDeviceControl.c

示例12: VmpInitializeVm

// Allocates structures for virtualization, initializes VMCS and virtualizes
// the current processor
_Use_decl_annotations_ static void VmpInitializeVm(
    ULONG_PTR guest_stack_pointer, ULONG_PTR guest_instruction_pointer,
    void *context) {
  PAGED_CODE();

  const auto shared_data = reinterpret_cast<SharedProcessorData *>(context);
  if (!shared_data) {
    return;
  }

  // Allocate related structures
  const auto processor_data =
      reinterpret_cast<ProcessorData *>(ExAllocatePoolWithTag(
          NonPagedPool, sizeof(ProcessorData), kHyperPlatformCommonPoolTag));
  if (!processor_data) {
    return;
  }
  RtlZeroMemory(processor_data, sizeof(ProcessorData));
  processor_data->shared_data = shared_data;
  InterlockedIncrement(&processor_data->shared_data->reference_count);

  // Set up EPT
  processor_data->ept_data = EptInitialization();
  if (!processor_data->ept_data) {
    goto ReturnFalse;
  }

  // Check if XSAVE/XRSTOR are available and save an instruction mask for all
  // supported user state components
  processor_data->xsave_inst_mask =
      RtlGetEnabledExtendedFeatures(static_cast<ULONG64>(-1));
  HYPERPLATFORM_LOG_DEBUG("xsave_inst_mask       = %p",
                          processor_data->xsave_inst_mask);
  if (processor_data->xsave_inst_mask) {
    // Allocate a large enough XSAVE area to store all supported user state
    // components. A size is round-up to multiple of the page size so that the
    // address fulfills a requirement of 64K alignment.
    //
    // See: ENUMERATION OF CPU SUPPORT FOR XSAVE INSTRUCTIONS AND XSAVESUPPORTED
    // FEATURES
    int cpu_info[4] = {};
    __cpuidex(cpu_info, 0xd, 0);
    const auto xsave_area_size = ROUND_TO_PAGES(cpu_info[2]);  // ecx
    processor_data->xsave_area = ExAllocatePoolWithTag(
        NonPagedPool, xsave_area_size, kHyperPlatformCommonPoolTag);
    if (!processor_data->xsave_area) {
      goto ReturnFalse;
    }
    RtlZeroMemory(processor_data->xsave_area, xsave_area_size);
  } else {
    // Use FXSAVE/FXRSTOR instead.
    int cpu_info[4] = {};
    __cpuid(cpu_info, 1);
    const CpuFeaturesEcx cpu_features_ecx = {static_cast<ULONG32>(cpu_info[2])};
    const CpuFeaturesEdx cpu_features_edx = {static_cast<ULONG32>(cpu_info[3])};
    if (cpu_features_ecx.fields.avx) {
      HYPERPLATFORM_LOG_ERROR("A processor supports AVX but not XSAVE/XRSTOR.");
      goto ReturnFalse;
    }
    if (!cpu_features_edx.fields.fxsr) {
      HYPERPLATFORM_LOG_ERROR("A processor does not support FXSAVE/FXRSTOR.");
      goto ReturnFalse;
    }
  }

  // Allocate other processor data fields
  processor_data->vmm_stack_limit =
      UtilAllocateContiguousMemory(KERNEL_STACK_SIZE);
  if (!processor_data->vmm_stack_limit) {
    goto ReturnFalse;
  }
  RtlZeroMemory(processor_data->vmm_stack_limit, KERNEL_STACK_SIZE);

  processor_data->vmcs_region =
      reinterpret_cast<VmControlStructure *>(ExAllocatePoolWithTag(
          NonPagedPool, kVmxMaxVmcsSize, kHyperPlatformCommonPoolTag));
  if (!processor_data->vmcs_region) {
    goto ReturnFalse;
  }
  RtlZeroMemory(processor_data->vmcs_region, kVmxMaxVmcsSize);

  processor_data->vmxon_region =
      reinterpret_cast<VmControlStructure *>(ExAllocatePoolWithTag(
          NonPagedPool, kVmxMaxVmcsSize, kHyperPlatformCommonPoolTag));
  if (!processor_data->vmxon_region) {
    goto ReturnFalse;
  }
  RtlZeroMemory(processor_data->vmxon_region, kVmxMaxVmcsSize);

  // Initialize stack memory for VMM like this:
  //
  // (High)
  // +------------------+  <- vmm_stack_region_base      (eg, AED37000)
  // | processor_data   |
  // +------------------+  <- vmm_stack_data             (eg, AED36FFC)
  // | MAXULONG_PTR     |
  // +------------------+  <- vmm_stack_base (initial SP)(eg, AED36FF8)
  // |                  |    v
//.........这里部分代码省略.........
开发者ID:N3mes1s,项目名称:HyperPlatform,代码行数:101,代码来源:vm.cpp

示例13: EnumNetCards

/*
kd> dt ndis!_NDIS_PROTOCOL_BLOCK
+0x000 Header           : _NDIS_OBJECT_HEADER
+0x004 ProtocolDriverContext : Ptr32 Void
+0x008 NextProtocol     : Ptr32 _NDIS_PROTOCOL_BLOCK
+0x00c OpenQueue        : Ptr32 _NDIS_OPEN_BLOCK
win7
*/
BOOLEAN	EnumNetCards()
{
	PNDIS_MINIPORT_BLOCK pMiniBlock=NULL;
	PNDIS_COMMON_OPEN_BLOCK_2k3_early	pOpenBlock=NULL;

	ULONG	MiniDriverBlockHeader	;
	ULONG	NetCardType	=	0;
	LIST_ENTRY		*pListEntry=NULL;
	NETCARDS_INFO		*pNI=NULL;
	NTSTATUS			status = STATUS_SUCCESS;
	ULONG			uTmp=0;
	ADAPTER_INFOEX	*pAdapterInfoEx	=	NULL;
	ADAPTER_INFO	AI;
	WCHAR			*p1,*p2;
	ULONG			index=0;
	UNICODE_STRING	uniTmp;
	DWORD		dwVersion=0;


	

	PKK_NDIS_PROTOCOL_BLOCK	pProtocol	=	(PKK_NDIS_PROTOCOL_BLOCK)GetProtocolHeader();

	dwVersion = GetWindowsVersion();
	p1=p2=NULL;

	//清空列表
	if (!IsListEmpty(&g_NetCardsInfoHeader.Next))
	{
		ExInterlockedRemoveHeadList(&g_NetCardsInfoHeader.Next, &g_NetCardsInfoLock);
// 		LockResource(&g_NetCardsInfoLock, TRUE);
// 		pListEntry = RemoveHeadList(&g_NetCardsInfoHeader.Next);
// 		UnlockResource(&g_NetCardsInfoLock);
		pNI	=	CONTAINING_RECORD(pListEntry, NETCARDS_INFO, Next);
		if (NULL==pNI)
		{

			DbgBreakPoint();

		}
		RtlFreeAnsiString(&pNI->Name);
		kfree(pNI);
	}
	status	=	GetAdapterInfo(NULL, &uTmp);
	if (status==STATUS_BUFFER_TOO_SMALL)
	{
		pAdapterInfoEx	=	kmalloc(uTmp);
		RtlZeroMemory(pAdapterInfoEx, uTmp);
		if (NULL== pAdapterInfoEx)
		{
			return FALSE;
		}
	}
	status = GetAdapterInfo(pAdapterInfoEx, &uTmp);
	if (pAdapterInfoEx->uNumber==0)
	{
		kprintf("GetAdapterInfo() return pAdapterInfoEx->uNumber==0");
		kfree(pAdapterInfoEx);
		return FALSE;
	}

	while (pProtocol)	
	{
		//search for  the nic driver block
		if (dwVersion==Windows_7||dwVersion==Windows_Vista)
		{
			if (((PNDIS_PROTOCOL_BLOCKWin7)pProtocol)->OpenQueue==0)
			{
				goto NextBlock;
			}
		}
		else
		{
			if (pProtocol->OpenQueue==NULL)
			{
				goto NextBlock;
			}
		}

		uTmp=0;
		//现在使用了protocol链表,所以要防止一个miniport多次使用的情况
		if (dwVersion==Windows_Vista||dwVersion==Windows_7)
		{
			PNDIS_OPEN_BLOCKWIN7 pOP7	=	(PNDIS_OPEN_BLOCKWIN7)((PNDIS_PROTOCOL_BLOCKWin7)pProtocol)->OpenQueue;
			pMiniBlock	=	pOP7->MiniportHandle;
		}
		else
		{
			pMiniBlock	=	pProtocol->OpenQueue->MiniportHandle;
		}

		pListEntry	=	g_NetCardsInfoHeader.Next.Flink;
//.........这里部分代码省略.........
开发者ID:wtxpwh,项目名称:cyber-interceptor,代码行数:101,代码来源:NetcardsInfo.c

示例14: GetAdapterInfo


//.........这里部分代码省略.........
				kfree(ustrDev.Buffer);
				uTmp	=	sizeof(pAIEX->pAI[uCounter].macAddress);
				nOid = OID_802_3_CURRENT_ADDRESS;
				status = ZwDeviceIoControlFile(hDev,
					NULL,
					NULL,
					NULL,
					&IoStatusBlock,
					IOCTL_NDIS_QUERY_GLOBAL_STATS,
					&nOid,
					sizeof(nOid),
					pAIEX->pAI[uCounter].macAddress,
					uTmp);
				if (STATUS_SUCCESS != status)
				{
					//DbgPrintEx(DPFLTR_IHVBUS_ID ,DPFLTR_ERROR_LEVEL,";ZwDeviceIoControlFile OID_802_3_PERMANENT_ADDRESS Error: 0x%x\n", status);
					break;
				}
				//DbgPrintEx(DPFLTR_IHVBUS_ID ,DPFLTR_ERROR_LEVEL,"Mac: %02X:%02X:%02X:%02X:%02X:%02X\n", pAIEX->pAI[uCounter].macAddress[0], pAIEX->pAI[uCounter].macAddress[1], pAIEX->pAI[uCounter].macAddress[2], pAIEX->pAI[uCounter].macAddress[3], pAIEX->pAI[uCounter].macAddress[4], pAIEX->pAI[uCounter].macAddress[5]);


				pAIEX->pAI[uCounter].GUID.Buffer	=	kmalloc(pKeyBasicInfo->NameLength);

				pAIEX->pAI[uCounter].GUID.Length = pAIEX->pAI[uCounter].GUID.MaximumLength	=	(USHORT)pKeyBasicInfo->NameLength;
				RtlCopyMemory(pAIEX->pAI[uCounter].GUID.Buffer, pKeyBasicInfo->Name, pKeyBasicInfo->NameLength);
				if (1)
				{
					CHAR	IPAddress[48];
					ANSI_STRING	aniString;
					UNICODE_STRING	uniString;
					char *pTmp=NULL;
					UNICODE_STRING   ustrAdapterInfo = UNICODE_STRING_CONST(L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\");
					WCHAR	*pPath	=kmalloc(ustrAdapterInfo.Length+pKeyBasicInfo->NameLength+2);
					RtlZeroMemory(pPath, ustrAdapterInfo.Length+pKeyBasicInfo->NameLength+2);
					RtlCopyMemory(pPath, ustrAdapterInfo.Buffer, ustrAdapterInfo.Length);
					pTmp	=	(char*)pPath;
					RtlCopyMemory(&pTmp[ustrAdapterInfo.Length], pKeyBasicInfo->Name, pKeyBasicInfo->NameLength);

					uTmp=0;
					uTmp	= sizeof(ULONG);
					status	=	KKGetKeyValue(pPath, L"EnableDHCP", &uTmp, &uTmp);
					if (NT_SUCCESS(status))
					{
						RtlZeroMemory(IPAddress, sizeof(IPAddress));
						//开启了DHCP情况
						if (uTmp==1)
						{
							pAIEX->pAI[uCounter].bDhcp	=	TRUE;

							//够长了,应该会自动截断
							RtlZeroMemory(IPAddress, sizeof(IPAddress));

							uTmp	=	sizeof(IPAddress);

							status = KKGetKeyValue(pPath, L"DhcpIPAddress", IPAddress, &uTmp);
							if (NT_SUCCESS(status))
							{

								RtlInitUnicodeString(&uniString, (WCHAR*)IPAddress);
								RtlUnicodeStringToAnsiString(&aniString, &uniString, TRUE);
								RtlZeroMemory(IPAddress, sizeof(IPAddress));
								RtlCopyMemory(IPAddress, aniString.Buffer, aniString.Length);
								pAIEX->pAI[uCounter].IPAddr	=	inet_addr(IPAddress);
								RtlFreeAnsiString(&aniString);
							}
							else
开发者ID:wtxpwh,项目名称:cyber-interceptor,代码行数:67,代码来源:NetcardsInfo.c

示例15: AFSValidateProcessEntry


//.........这里部分代码省略.........
        ntStatus = AFSLocateHashEntry( pDeviceExt->Specific.Control.AuthGroupTree.TreeHead,
                                       (ULONGLONG)ullTableHash,
                                       (AFSBTreeEntry **)&pSIDEntryCB);

        if( !NT_SUCCESS( ntStatus) ||
            pSIDEntryCB == NULL)
        {

            AFSReleaseResource( pDeviceExt->Specific.Control.AuthGroupTree.TreeLock);

            AFSAcquireExcl( pDeviceExt->Specific.Control.AuthGroupTree.TreeLock,
                            TRUE);

            ntStatus = AFSLocateHashEntry( pDeviceExt->Specific.Control.AuthGroupTree.TreeHead,
                                           (ULONGLONG)ullTableHash,
                                           (AFSBTreeEntry **)&pSIDEntryCB);

            if( !NT_SUCCESS( ntStatus) ||
                pSIDEntryCB == NULL)
            {

                pSIDEntryCB = (AFSSIDEntryCB *)AFSExAllocatePoolWithTag( NonPagedPool,
                                                                         sizeof( AFSSIDEntryCB),
                                                                         AFS_AG_ENTRY_CB_TAG);

                if( pSIDEntryCB == NULL)
                {

                    AFSReleaseResource( pDeviceExt->Specific.Control.AuthGroupTree.TreeLock);

                    try_return( ntStatus = STATUS_INSUFFICIENT_RESOURCES);
                }

                RtlZeroMemory( pSIDEntryCB,
                               sizeof( AFSSIDEntryCB));

                pSIDEntryCB->TreeEntry.HashIndex = (ULONGLONG)ullTableHash;

                while( ExUuidCreate( &pSIDEntryCB->AuthGroup) == STATUS_RETRY);

                uniGUID.Buffer = NULL;

                RtlStringFromGUID( pSIDEntryCB->AuthGroup,
                                   &uniGUID);

                AFSDbgTrace(( AFS_SUBSYSTEM_AUTHGROUP_PROCESSING,
                              AFS_TRACE_LEVEL_VERBOSE,
                              "%s  SID %wZ PID %I64X Session %08lX generated NEW AG %wZ\n",
                              __FUNCTION__,
                              &uniSIDString,
                              ullProcessID,
                              ulSessionId,
                              &uniGUID));

                if( uniGUID.Buffer != NULL)
                {
                    RtlFreeUnicodeString( &uniGUID);
                }

                if( pDeviceExt->Specific.Control.AuthGroupTree.TreeHead == NULL)
                {
                    pDeviceExt->Specific.Control.AuthGroupTree.TreeHead = (AFSBTreeEntry *)pSIDEntryCB;
                }
                else
                {
                    AFSInsertHashEntry( pDeviceExt->Specific.Control.AuthGroupTree.TreeHead,
开发者ID:bagdxk,项目名称:openafs,代码行数:67,代码来源:AFSProcessSupport.cpp


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