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


C++ Dump函数代码示例

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


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

示例1: process_rings


//.........这里部分代码省略.........
		    }
		  else if (i < 0)
		    {
		      bogus_oob = 0;
		      first = 0;
		    }
		  else
		    c += i;
		}
	      if (bogus_oob && c > 0)
		{
		  int i;
		  /*
		   * Bogosity.  We have to do the read
		   * to clear the atmark to get out of
		   * an infinate loop.
		   */
		  i = read (net, netiring.supply + c, canread - c);
		  if (i > 0)
		    c += i;
		}
	    }
	  else
	    {
	      c = recv (net, netiring.supply, canread, 0);
	    }
	}
      else
	{
	  c = recv (net, netiring.supply, canread, 0);
	}
      settimer (didnetreceive);
#else /* !defined(SO_OOBINLINE) */
      c = recv (net, (char *) netiring.supply, canread, 0);
#endif /* !defined(SO_OOBINLINE) */
      if (c < 0 && errno == EWOULDBLOCK)
	{
	  c = 0;
	}
      else if (c <= 0)
	{
	  return -1;
	}
      if (netdata)
	{
	  Dump ('<', netiring.supply, c);
	}
      if (c)
	ring_supplied (&netiring, c);
      returnValue = 1;
    }

  /*
   * Something to read from the tty...
   */
  if (FD_ISSET (tin, ibitsp))
    {
      FD_CLR (tin, ibitsp);
      c = TerminalRead (ttyiring.supply, ring_empty_consecutive (&ttyiring));
      if (c < 0 && errno == EIO)
	c = 0;
      if (c < 0 && errno == EWOULDBLOCK)
	{
	  c = 0;
	}
      else
	{
	  /* EOF detection for line mode!!!! */
	  if ((c == 0) && MODE_LOCAL_CHARS (globalmode) && isatty (tin))
	    {
	      /* must be an EOF... */
	      *ttyiring.supply = termEofChar;
	      c = 1;
	    }
	  if (c <= 0)
	    {
	      return -1;
	    }
	  if (termdata)
	    {
	      Dump ('<', ttyiring.supply, c);
	    }
	  ring_supplied (&ttyiring, c);
	}
      returnValue = 1;		/* did something useful */
    }

  if (FD_ISSET (net, obitsp))
    {
      FD_CLR (net, obitsp);
      returnValue |= netflush ();
    }
  if (FD_ISSET (tout, obitsp))
    {
      FD_CLR (tout, obitsp);
      returnValue |= (ttyflush (SYNCHing | flushout) > 0);
    }

  return returnValue;
}
开发者ID:a5216652166,项目名称:rcp100,代码行数:101,代码来源:sys_bsd.c

示例2: Dump

	bool OLE::writeToDevice (void)
	{
	CHECK_DEVICE;

	#ifdef DEBUG_OBJECT
		m_device->debug ("\n>>>> OLE::writeToDevice <<<<\n");
	#endif

	#ifdef DEBUG_OBJECT
		Dump (zero);

		switch (m_objectType)
		{
		case OLEType::Static:
			m_device->debug ("\tobjectType: 1 - static\n");
			break;
		case OLEType::Embedded:
			m_device->debug ("\tobjectType: 2 - embedded\n");
			break;
		case OLEType::Link:
			m_device->debug ("\tobjectType: 3 - link\n");
			break;
		}

		Dump (indent);
		Dump (width);
		Dump (height);
		Dump (zero2);
		Dump (numDataBytes);
		Dump (zero3);
		Dump (objectName);
		Dump (zero4);
		Dump (numHeaderBytes);
		Dump (zero5);
		Dump (widthScaledRel1000);
		Dump (heightScaledRel1000);
	#endif

		// write header
		if (!OLEGenerated::writeToDevice ())
			return false;

		// write data
		if (!m_device->writeInternal (m_externalObject, m_externalObjectSize))
			return false;

		return true;
	}
开发者ID:JeremiasE,项目名称:KFormula,代码行数:48,代码来源:structures.cpp

示例3: if

	bool PageLayout::readFromDevice (void)
	{
	CHECK_DEVICE;

	#ifdef DEBUG_PAGELAYOUT
		m_device->debug ("\n<<<< PageLayout::readFromDevice >>>>\n");
	#endif

		int numPageLayoutPages = m_header->getNumPageSectionProperty ();

	#ifdef DEBUG_PAGELAYOUT
		m_device->debug ("num pageLayoutPages: ", numPageLayoutPages);
	#endif

		// no PageLayout
		if (numPageLayoutPages == 0)
			return true;
		else if (numPageLayoutPages > 1)
			ErrorAndQuit (Error::InvalidFormat, "invalid #pageLayoutPages\n");

		// seek to the PageLayout in the file
		if (!m_device->seekInternal (m_header->getPageSectionProperty () * 128, SEEK_SET))
			ErrorAndQuit (Error::FileError, "could not seek to pageLayout\n");

		if (!PageLayoutGenerated::readFromDevice ())
			return false;

	#ifdef DEBUG_PAGELAYOUT
		Dump (magic102);
		Dump (magic512);

		Dump (pageHeight);
		Dump (pageWidth);
		Dump (pageNumberStart);
		Dump (topMargin);
		Dump (textHeight);
		Dump (leftMargin);
		Dump (textWidth);

		Dump (magic256);

		Dump (headerFromTop);
		Dump (footerFromTop);

		Dump (magic720);
		Dump (zero);
		Dump (magic1080);
		Dump (unknown);
		Dump (zero2);
	#endif

		#define UpdateModifiedCount(variable) if (m_##variable != variable##Default) m_numModified++
		UpdateModifiedCount (magic102);
		UpdateModifiedCount (magic512);
		UpdateModifiedCount (pageHeight);
		UpdateModifiedCount (pageWidth);
		UpdateModifiedCount (pageNumberStart);
		UpdateModifiedCount (topMargin);
		UpdateModifiedCount (textHeight);
		UpdateModifiedCount (leftMargin);
		UpdateModifiedCount (textWidth);
		UpdateModifiedCount (magic256);
		UpdateModifiedCount (headerFromTop);
		UpdateModifiedCount (footerFromTop);
		UpdateModifiedCount (magic720);
		UpdateModifiedCount (zero);
		UpdateModifiedCount (magic1080);
		//UpdateModifiedCount (unknown);	// no reliable default for unknown
		UpdateModifiedCount (zero2);
		#undef UpdateModifiedCount

		return true;
	}
开发者ID:JeremiasE,项目名称:KFormula,代码行数:73,代码来源:structures.cpp

示例4: Dump

std::ostream &
Register::DumpTrace(std::ostream &o, VM &vm, const int bb, const int pc)
{
	return Dump(o) << "=" << Get(vm) << " ";
}
开发者ID:tsmigiel,项目名称:compiler,代码行数:5,代码来源:VM.cpp

示例5: Dump

void LogCompStr::AssertValid() {
  if (dwCursorPos > GetCompCharCount()) {
    Dump();
    DebugPrintA("dwCursorPos: %u\n", dwCursorPos);
    DebugPrintA("GetCompCharCount(): %u\n", GetCompCharCount());
    assert(0);
  }
  if (comp_attr.size()) {
    if (comp_attr.size() != comp_str.size()) {
      Dump();
      DebugPrintA("comp_attr.size(): %u\n", (int)comp_attr.size());
      DebugPrintA("comp_str.size(): %u\n", (int)comp_str.size());
      assert(0);
    }
  }
  if (comp_clause.size()) {
    if (comp_clause[0] != 0) {
      Dump();
      assert(0);
    }
    if (comp_clause[comp_clause.size() - 1] != GetCompCharCount()) {
      Dump();
      assert(0);
    }
    if (extra.iClause > (DWORD)comp_clause.size()) {
      Dump();
      DebugPrintA("extra.iClause: %u\n", extra.iClause);
      DebugPrintA("comp_clause.size(): %u\n", (int)comp_clause.size());
      assert(0);
    }
    for (size_t i = 1; i < comp_clause.size(); ++i) {
      if (comp_clause[i] > GetCompCharCount()) {
        Dump();
        assert(0);
      }
      if (comp_clause[i - 1] > comp_clause[i]) {
        Dump();
        assert(0);
      }
    }
  }
  if (result_read_clause.size()) {
    if (result_read_clause[0] != 0) {
      Dump();
      assert(0);
    }
    for (size_t i = 1; i < result_read_clause.size(); ++i) {
      if (result_read_clause[i] > (DWORD)result_read_str.size()) {
        Dump();
        assert(0);
      }
      if (result_read_clause[i - 1] > result_read_clause[i]) {
        Dump();
        assert(0);
      }
    }
  }
  if (result_clause.size()) {
    if (result_clause[0] != 0) {
      Dump();
      assert(0);
    }
    for (size_t i = 1; i < result_clause.size(); ++i) {
      if (result_clause[i] > (DWORD)result_str.size()) {
        Dump();
        assert(0);
      }
      if (result_clause[i - 1] > result_clause[i]) {
        Dump();
        assert(0);
      }
    }
  }
  if (extra.hiragana_clauses.size() != extra.typing_clauses.size()) {
    Dump();
    assert(0);
  }
} // LogCompStr::AssertValid
开发者ID:katahiromz,项目名称:mzimeja,代码行数:78,代码来源:comp_str.cpp

示例6: localAllocateOffscreenLinear

static FBLinearPtr
localAllocateOffscreenLinear(
    ScreenPtr pScreen, 
    int length,
    int gran,
    MoveLinearCallbackProcPtr moveCB,
    RemoveLinearCallbackProcPtr removeCB,
    pointer privData
){
   FBManagerPtr offman;
   FBLinearLinkPtr link;
   FBAreaPtr area;
   FBLinearPtr linear = NULL;
   BoxPtr extents;
   int w, h, pitch;

   offman = pScreen->devPrivates[xf86FBScreenIndex].ptr;

   /* Try to allocate from linear memory first...... */
#ifdef DEBUG
   ErrorF("ALLOCATING LINEAR\n");
#endif
   if ((linear = AllocateLinear(offman, length, gran, privData)))
   	return linear;

#ifdef DEBUG
   ErrorF("NOPE, ALLOCATING AREA\n");
#endif

   if(!(link = xalloc(sizeof(FBLinearLink))))
     return NULL;

   /* No linear available, so try and pinch some from the XY areas */
   extents = REGION_EXTENTS(pScreen, offman->InitialBoxes);
   pitch = extents->x2 - extents->x1;

   if(gran && ((gran > pitch) || (pitch % gran))) {
	/* we can't match the specified alignment with XY allocations */
	xfree(link);
	return NULL;
   }

   if(length < pitch) { /* special case */
	w = length;
	h = 1;
   } else {
	w = pitch;
	h = (length + pitch - 1) / pitch;
   }

   if((area = localAllocateOffscreenArea(pScreen, w, h, gran, 
			moveCB   ? LinearMoveCBWrapper   : NULL, 
			removeCB ? LinearRemoveCBWrapper : NULL, 
			privData))) 
   {
	link->area = area;
	link->free = 0;
	link->next = offman->LinearAreas;
	offman->LinearAreas = link;
	linear = &(link->linear);
	linear->pScreen = pScreen;
	linear->size = h * w;
	linear->offset = (pitch * area->box.y1) + area->box.x1;
	linear->granularity = gran;
	linear->MoveLinearCallback = moveCB;
	linear->RemoveLinearCallback = removeCB;
	linear->devPrivate.ptr = privData;
   } else 
	xfree(link);

#ifdef DEBUG
   Dump(offman->LinearAreas);
#endif

   return linear;
}
开发者ID:marioaugustorama,项目名称:tropix-xwindow,代码行数:76,代码来源:xf86fbman.c

示例7: Dump

void
Dump(
    HANDLE  Handle
    )
{
    NTSTATUS    status;
    PKEY_BASIC_INFORMATION KeyInformation;
    OBJECT_ATTRIBUTES ObjectAttributes;
    ULONG   NamePos;
    ULONG   index;
    STRING  enumname;
    HANDLE  WorkHandle;
    ULONG   ResultLength;
    static  char buffer[WORK_SIZE];
    PUCHAR  p;

    KeyInformation = (PKEY_BASIC_INFORMATION)buffer;
    NamePos = WorkName.Length;

    //
    // Print name of node we are about to dump out
    //
    print(&WorkName);
    printf("::\n\n");

    //
    // Print out node's values
    //
    DumpValues(Handle);

    //
    // Enumerate node's children and apply ourselves to each one
    //

    for (index = 0; TRUE; index++) {

        RtlZeroMemory(KeyInformation, WORK_SIZE);
        status = NtEnumerateKey(
                    Handle,
                    index,
                    KeyBasicInformation,
                    KeyInformation,
                    WORK_SIZE,
                    &ResultLength
                    );

        if (status == STATUS_NO_MORE_ENTRIES) {

            WorkName.Length = NamePos;
            return;

        } else if (!NT_SUCCESS(status)) {

            printf("rtdmp: dump1: status = %08lx\n", status);
            exit(1);

        }

        enumname.Buffer = &(KeyInformation->Name[0]);
        enumname.Length = KeyInformation->NameLength;
        enumname.MaximumLength = KeyInformation->NameLength;

        p = WorkName.Buffer;
        p += WorkName.Length;
        *p = '\\';
        p++;
        *p = '\0';
        WorkName.Length += 2;

        RtlAppendStringToString((PSTRING)&WorkName, (PSTRING)&enumname);

        InitializeObjectAttributes(
            &ObjectAttributes,
            &enumname,
            0,
            Handle,
            NULL
            );
        ObjectAttributes.Attributes |= OBJ_CASE_INSENSITIVE;

        status = NtOpenKey(
                    &WorkHandle,
                    MAXIMUM_ALLOWED,
                    &ObjectAttributes
                    );
        if (!NT_SUCCESS(status)) {
            printf("rtdmp: dump2: %08lx\n", status);
            exit(1);
        }

        Dump(WorkHandle);
        NtClose(WorkHandle);
        WorkName.Length = NamePos;
    }
}
开发者ID:conioh,项目名称:os-design,代码行数:95,代码来源:rtdmp.c

示例8: printf


//.........这里部分代码省略.........
                                                _Tracks[run].strf.size,(int)sizeof(WAVHeader));
                                                return 0;
                                        }
                                        fread(track->wavHeader,sizeof(WAVHeader),1,_fd);				
#ifdef ADM_BIG_ENDIAN
                                        Endian_WavHeader(track->wavHeader);
#endif
                                        if(extra>2)
                                        {
                                                fgetc(_fd);fgetc(_fd);
                                                extra-=2;
                                                track->extraDataLen=extra;		
                                                track->extraData=new uint8_t [extra];
                                                fread(track->extraData,extra,1,_fd);
                                        }
                                        track->trackNum=run;
                                        audio++;
                                        run++;
                           }	
                        }
                }
		
		// now look at the index stuff
		// there could be 3 cases:
		// 1- It is a openDML index, meta index  + several smaller index
		// 2- It is a legacy index (type 1 , most common)
		// 3- It is a broken index or no index at all
		//
		// If it is a openDML index we will find a "indx" field in the Tracks
		// Else we will find it in _regularIndex Track
		// Since openDML often also have a regular index we will try open DML first
		
		uint8_t ret=0;
		Dump();
		
		// take the size of riff header and actual file size
		uint64_t riffSize;
		fseeko(_fd,0,SEEK_END);		
		_fileSize=ftello(_fd);
		fseeko(_fd,0,SEEK_SET);
		read32();
		riffSize=(uint64_t )read32();
				
		
		// 1st case, we have an avi < 4 Gb
		// potentially avi type 1	
#if 0	
		if((_fileSize<4*1024*1024*1024LL)&&
                	// if riff size is ~ fileSize try regular index
			 (abs(riffSize-_fileSize)<1024*1024))
#endif

#define HAS(x) if(x) printf(#x" : yes\n"); else printf(#x" : no\n");
                // If there is no openDML index
                HAS( _regularIndex.offset);
                HAS( _Tracks[vidTrack].indx.offset);
                if(!ret && _regularIndex.offset &&!_Tracks[vidTrack].indx.offset) 
        // try regular avi if a idx1 field is there (avi index)
                        ret=indexRegular(vidTrack);

                if (!ret && _Tracks[vidTrack].indx.offset)	// Try openDML if a index field is there (openDML)
                        ret=indexODML(vidTrack);
                if(!ret) 
                {
                        printf("Could not index it properly...\n");
                        return 0;
开发者ID:BackupTheBerlios,项目名称:avidemux-svn,代码行数:67,代码来源:ADM_openDML.cpp

示例9: addcan

Node *Canonical(Node *n, Miscellaneous *miscell, int *cnt, char *uform, int *tl_yychar)
{	Node *m, *p, *k1, *k2, *prev, *dflt = ZN;
	int tok;
	static Node	*can = ZN;


	if (!n) return n;

	tok = n->ntyp;
	if (tok != AND && tok != OR)
		return n;

	can = ZN;
	addcan(tok, n, miscell);
#if 1
	Debug("\nA0: "); Dump(can); 
	Debug("\nA1: "); Dump(n); Debug("\n");
#endif
	releasenode(1, n);

	/* mark redundant nodes */
	if (tok == AND)
	{	for (m = can; m; m = (m->ntyp == AND) ? m->rgt : ZN)
		{	k1 = (m->ntyp == AND) ? m->lft : m;
			if (k1->ntyp == TRUE)
			{	marknode(AND, m);
				dflt = True;
				continue;
			}
			if (k1->ntyp == FALSE)
			{	releasenode(1, can);
				can = False;
				goto out;
		}	}
		for (m = can; m; m = (m->ntyp == AND) ? m->rgt : ZN)
		for (p = can; p; p = (p->ntyp == AND) ? p->rgt : ZN)
		{	if (p == m
			||  p->ntyp == -1
			||  m->ntyp == -1)
				continue;
			k1 = (m->ntyp == AND) ? m->lft : m;
			k2 = (p->ntyp == AND) ? p->lft : p;

			if (isequal(k1, k2, cnt, uform, tl_yychar, miscell))
			{	marknode(AND, p);
				continue;
			}
			if (anywhere(OR, k1, k2, cnt, uform, tl_yychar, miscell))
			{	marknode(AND, p);
				continue;
			}
			if (k2->ntyp == U_OPER
			&&  anywhere(AND, k2->rgt, can, cnt, uform, tl_yychar, miscell))
			{	marknode(AND, p);
				continue;
			}	/* q && (p U q) = q */
	}	}
	if (tok == OR)
	{	for (m = can; m; m = (m->ntyp == OR) ? m->rgt : ZN)
		{	k1 = (m->ntyp == OR) ? m->lft : m;
			if (k1->ntyp == FALSE)
			{	marknode(OR, m);
				dflt = False;
				continue;
			}
			if (k1->ntyp == TRUE)
			{	releasenode(1, can);
				can = True;
				goto out;
		}	}
		for (m = can; m; m = (m->ntyp == OR) ? m->rgt : ZN)
		for (p = can; p; p = (p->ntyp == OR) ? p->rgt : ZN)
		{	if (p == m
			||  p->ntyp == -1
			||  m->ntyp == -1)
				continue;
			k1 = (m->ntyp == OR) ? m->lft : m;
			k2 = (p->ntyp == OR) ? p->lft : p;

			if (isequal(k1, k2, cnt, uform, tl_yychar, miscell))
			{	marknode(OR, p);
				continue;
			}
			if (anywhere(AND, k1, k2, cnt, uform, tl_yychar, miscell))
			{	marknode(OR, p);
				continue;
			}
			if (k2->ntyp == V_OPER
			&&  k2->lft->ntyp == FALSE
			&&  anywhere(AND, k2->rgt, can, cnt, uform, tl_yychar, miscell))
			{	marknode(OR, p);
				continue;
			}	/* p || (F V p) = p */
	}	}
	for (m = can, prev = ZN; m; )	/* remove marked nodes */
	{	if (m->ntyp == -1)
		{	k2 = m->rgt;
			releasenode(0, m);
			if (!prev)
			{	m = can = can->rgt;
//.........这里部分代码省略.........
开发者ID:mlab-upenn,项目名称:arch-apex,代码行数:101,代码来源:rewrt.c

示例10: DumpTotal

 void DumpTotal(FILE* out) {
   mClassSize /= mAllStats.mCreates;
   Dump(-1, out, nsTraceRefcntImpl::ALL_STATS);
 }
开发者ID:lail3344,项目名称:mozilla-central,代码行数:4,代码来源:nsTraceRefcntImpl.cpp

示例11: TCOpenVolume


//.........这里部分代码省略.........
	{
		goto error;
	}

	// If we have opened a file, query its size now
	if (bRawDevice == FALSE)
	{
		ntStatus = ZwQueryInformationFile (Extension->hDeviceFile,
			&IoStatusBlock,
			&FileBasicInfo,
			sizeof (FileBasicInfo),
			FileBasicInformation);

		if (NT_SUCCESS (ntStatus))
		{
			if (mount->bPreserveTimestamp)
			{
				Extension->fileCreationTime = FileBasicInfo.CreationTime;
				Extension->fileLastAccessTime = FileBasicInfo.LastAccessTime;
				Extension->fileLastWriteTime = FileBasicInfo.LastWriteTime;
				Extension->fileLastChangeTime = FileBasicInfo.ChangeTime;
				Extension->bTimeStampValid = TRUE;
			}

			ntStatus = ZwQueryInformationFile (Extension->hDeviceFile,
				&IoStatusBlock,
				&FileStandardInfo,
				sizeof (FileStandardInfo),
				FileStandardInformation);
		}

		if (!NT_SUCCESS (ntStatus))
		{
			Dump ("ZwQueryInformationFile failed while opening file: NTSTATUS 0x%08x\n",
				ntStatus);
			goto error;
		}

		lDiskLength.QuadPart = FileStandardInfo.EndOfFile.QuadPart;

		if (FileBasicInfo.FileAttributes & FILE_ATTRIBUTE_COMPRESSED)
		{
			Dump ("File \"%ls\" is marked as compressed - not supported!\n", pwszMountVolume);
			mount->nReturnCode = ERR_COMPRESSION_NOT_SUPPORTED;
			ntStatus = STATUS_SUCCESS;
			goto error;
		}

		ntStatus = ObReferenceObjectByHandle (Extension->hDeviceFile,
			FILE_ALL_ACCESS,
			*IoFileObjectType,
			KernelMode,
			&Extension->pfoDeviceFile,
			0);

		if (!NT_SUCCESS (ntStatus))
		{
			goto error;
		}

		/* Get the FSD device for the file (probably either NTFS or	FAT) */
		Extension->pFsdDevice = IoGetRelatedDeviceObject (Extension->pfoDeviceFile);
	}
	else
	{
		// Try to gain "raw" access to the partition in case there is a live filesystem on it (otherwise,
开发者ID:ChiefGyk,项目名称:VeraCrypt,代码行数:67,代码来源:Ntvol.c

示例12: EncryptedIoQueueStart

NTSTATUS EncryptedIoQueueStart (EncryptedIoQueue *queue)
{
	NTSTATUS status;
	EncryptedIoQueueBuffer *buffer;
	int i;

	queue->StartPending = TRUE;
	queue->ThreadExitRequested = FALSE;

	queue->OutstandingIoCount = 0;
	queue->IoThreadPendingRequestCount = 0;

	queue->FirstPoolBuffer = NULL;
	KeInitializeMutex (&queue->BufferPoolMutex, 0);

	KeInitializeEvent (&queue->NoOutstandingIoEvent, SynchronizationEvent, FALSE);
	KeInitializeEvent (&queue->PoolBufferFreeEvent, SynchronizationEvent, FALSE);
	KeInitializeEvent (&queue->QueueResumedEvent, SynchronizationEvent, FALSE);

	queue->FragmentBufferA = TCalloc (TC_ENC_IO_QUEUE_MAX_FRAGMENT_SIZE);
	if (!queue->FragmentBufferA)
		goto noMemory;

	queue->FragmentBufferB = TCalloc (TC_ENC_IO_QUEUE_MAX_FRAGMENT_SIZE);
	if (!queue->FragmentBufferB)
		goto noMemory;

	KeInitializeEvent (&queue->FragmentBufferAFreeEvent, SynchronizationEvent, TRUE);
	KeInitializeEvent (&queue->FragmentBufferBFreeEvent, SynchronizationEvent, TRUE);

	queue->ReadAheadBufferValid = FALSE;
	queue->ReadAheadBuffer = TCalloc (TC_ENC_IO_QUEUE_MAX_FRAGMENT_SIZE);
	if (!queue->ReadAheadBuffer)
		goto noMemory;

	// Preallocate buffers
	for (i = 0; i < TC_ENC_IO_QUEUE_PREALLOCATED_IO_REQUEST_COUNT; ++i)
	{
		if (i < TC_ENC_IO_QUEUE_PREALLOCATED_ITEM_COUNT && !GetPoolBuffer (queue, sizeof (EncryptedIoQueueItem)))
			goto noMemory;

		if (!GetPoolBuffer (queue, sizeof (EncryptedIoRequest)))
			goto noMemory;
	}

	for (buffer = queue->FirstPoolBuffer; buffer != NULL; buffer = buffer->NextBuffer)
	{
		buffer->InUse = FALSE;
	}

	// Main thread
	InitializeListHead (&queue->MainThreadQueue);
	KeInitializeSpinLock (&queue->MainThreadQueueLock);
	KeInitializeEvent (&queue->MainThreadQueueNotEmptyEvent, SynchronizationEvent, FALSE);

	status = TCStartThread (MainThreadProc, queue, &queue->MainThread);
	if (!NT_SUCCESS (status))
		goto err;

	// IO thread
	InitializeListHead (&queue->IoThreadQueue);
	KeInitializeSpinLock (&queue->IoThreadQueueLock);
	KeInitializeEvent (&queue->IoThreadQueueNotEmptyEvent, SynchronizationEvent, FALSE);

	status = TCStartThread (IoThreadProc, queue, &queue->IoThread);
	if (!NT_SUCCESS (status))
	{
		queue->ThreadExitRequested = TRUE;
		TCStopThread (queue->MainThread, &queue->MainThreadQueueNotEmptyEvent);
		goto err;
	}

	// Completion thread
	InitializeListHead (&queue->CompletionThreadQueue);
	KeInitializeSpinLock (&queue->CompletionThreadQueueLock);
	KeInitializeEvent (&queue->CompletionThreadQueueNotEmptyEvent, SynchronizationEvent, FALSE);

	status = TCStartThread (CompletionThreadProc, queue, &queue->CompletionThread);
	if (!NT_SUCCESS (status))
	{
		queue->ThreadExitRequested = TRUE;
		TCStopThread (queue->MainThread, &queue->MainThreadQueueNotEmptyEvent);
		TCStopThread (queue->IoThread, &queue->IoThreadQueueNotEmptyEvent);
		goto err;
	}

#ifdef TC_TRACE_IO_QUEUE
	GetElapsedTimeInit (&queue->LastPerformanceCounter);
#endif

	queue->StopPending = FALSE;
	queue->StartPending = FALSE;

	Dump ("Queue started\n");
	return STATUS_SUCCESS;

noMemory:
	status = STATUS_INSUFFICIENT_RESOURCES;

err:
//.........这里部分代码省略.........
开发者ID:ChiefGyk,项目名称:VeraCrypt,代码行数:101,代码来源:EncryptedIoQueue.c

示例13: MainThreadProc


//.........这里部分代码省略.........
					{
						GetIntersection (alignedOffset.QuadPart, alignedLength, queue->EncryptedAreaStart, queue->EncryptedAreaEnd, &intersectStart, &intersectLength);
						if (intersectLength > 0)
						{
							dataUnit.Value = intersectStart / ENCRYPTION_DATA_UNIT_SIZE;
							DecryptDataUnits (buffer + (intersectStart - alignedOffset.QuadPart), &dataUnit, intersectLength / ENCRYPTION_DATA_UNIT_SIZE, queue->CryptoInfo);
						}
					}

					memcpy (dataBuffer, buffer + (item->OriginalOffset.LowPart & (ENCRYPTION_DATA_UNIT_SIZE - 1)), item->OriginalLength);
				}

				TCfree (buffer);
				CompleteOriginalIrp (item, item->Status, NT_SUCCESS (item->Status) ? item->OriginalLength : 0);
				continue;
			}

			// Validate offset and length
			if (item->OriginalLength == 0
				|| (item->OriginalLength & (ENCRYPTION_DATA_UNIT_SIZE - 1)) != 0
				|| (item->OriginalOffset.QuadPart & (ENCRYPTION_DATA_UNIT_SIZE - 1)) != 0
				|| (	!queue->IsFilterDevice &&
						(	(S_OK != ULongLongAdd(item->OriginalOffset.QuadPart, item->OriginalLength, &addResult))
							||	(addResult > (ULONGLONG) queue->VirtualDeviceLength)
						)
					)
				)
			{
				CompleteOriginalIrp (item, STATUS_INVALID_PARAMETER, 0);
				continue;
			}

#ifdef TC_TRACE_IO_QUEUE
			Dump ("Q  %I64d [%I64d] %c len=%d\n", item->OriginalOffset.QuadPart, GetElapsedTime (&queue->LastPerformanceCounter), item->Write ? 'W' : 'R', item->OriginalLength);
#endif

			if (!queue->IsFilterDevice)
			{
				// Adjust the offset for host file or device
				if (queue->CryptoInfo->hiddenVolume)
					hResult = ULongLongAdd(item->OriginalOffset.QuadPart, queue->CryptoInfo->hiddenVolumeOffset, &addResult);
				else
					hResult = ULongLongAdd(item->OriginalOffset.QuadPart, queue->CryptoInfo->volDataAreaOffset, &addResult);

				if (hResult != S_OK)
				{
					CompleteOriginalIrp (item, STATUS_INVALID_PARAMETER, 0);
					continue;
				}
				else
					item->OriginalOffset.QuadPart = addResult;

				// Hidden volume protection
				if (item->Write && queue->CryptoInfo->bProtectHiddenVolume)
				{
					// If there has already been a write operation denied in order to protect the
					// hidden volume (since the volume mount time)
					if (queue->CryptoInfo->bHiddenVolProtectionAction)
					{
						// Do not allow writing to this volume anymore. This is to fake a complete volume
						// or system failure (otherwise certain kinds of inconsistency within the file
						// system could indicate that this volume has used hidden volume protection).
						CompleteOriginalIrp (item, STATUS_INVALID_PARAMETER, 0);
						continue;
					}
开发者ID:ChiefGyk,项目名称:VeraCrypt,代码行数:66,代码来源:EncryptedIoQueue.c

示例14: IoThreadProc

static VOID IoThreadProc (PVOID threadArg)
{
	EncryptedIoQueue *queue = (EncryptedIoQueue *) threadArg;
	PLIST_ENTRY listEntry;
	EncryptedIoRequest *request;

	KeSetPriorityThread (KeGetCurrentThread(), LOW_REALTIME_PRIORITY);

	if (!queue->IsFilterDevice && queue->SecurityClientContext)
	{
#ifdef DEBUG
		NTSTATUS status =
#endif
		SeImpersonateClientEx (queue->SecurityClientContext, NULL);
		ASSERT (NT_SUCCESS (status));
	}

	while (!queue->ThreadExitRequested)
	{
		if (!NT_SUCCESS (KeWaitForSingleObject (&queue->IoThreadQueueNotEmptyEvent, Executive, KernelMode, FALSE, NULL)))
			continue;

		if (queue->ThreadExitRequested)
			break;

		while ((listEntry = ExInterlockedRemoveHeadList (&queue->IoThreadQueue, &queue->IoThreadQueueLock)))
		{
			InterlockedDecrement (&queue->IoThreadPendingRequestCount);
			request = CONTAINING_RECORD (listEntry, EncryptedIoRequest, ListEntry);

#ifdef TC_TRACE_IO_QUEUE
			Dump ("%c   %I64d [%I64d] roff=%I64d rlen=%d\n", request->Item->Write ? 'W' : 'R', request->Item->OriginalIrpOffset.QuadPart, GetElapsedTime (&queue->LastPerformanceCounter), request->Offset.QuadPart, request->Length);
#endif

			// Perform IO request if no preceding request of the item failed
			if (NT_SUCCESS (request->Item->Status))
			{
				if (queue->IsFilterDevice)
				{
					if (queue->RemapEncryptedArea && request->EncryptedLength > 0)
					{
						if (request->EncryptedLength != request->Length)
						{
							// Up to three subfragments may be required to handle a partially remapped fragment
							int subFragment;
							byte *subFragmentData = request->Data;

							for (subFragment = 0 ; subFragment < 3; ++subFragment)
							{
								LARGE_INTEGER subFragmentOffset;
								ULONG subFragmentLength;
								subFragmentOffset.QuadPart = request->Offset.QuadPart;

								switch (subFragment)
								{
								case 0:
									subFragmentLength = (ULONG) request->EncryptedOffset;
									break;

								case 1:
									subFragmentOffset.QuadPart += request->EncryptedOffset + queue->RemappedAreaOffset;
									subFragmentLength = request->EncryptedLength;
									break;

								case 2:
									subFragmentOffset.QuadPart += request->EncryptedOffset + request->EncryptedLength;
									subFragmentLength = (ULONG) (request->Length - (request->EncryptedOffset + request->EncryptedLength));
									break;
								}

								if (subFragmentLength > 0)
								{
									if (request->Item->Write)
										request->Item->Status = TCWriteDevice (queue->LowerDeviceObject, subFragmentData, subFragmentOffset, subFragmentLength);
									else
										request->Item->Status = TCCachedRead (queue, NULL, subFragmentData, subFragmentOffset, subFragmentLength);

									subFragmentData += subFragmentLength;
								}
							}
						}
						else
						{
							// Remap the fragment
							LARGE_INTEGER remappedOffset;
							remappedOffset.QuadPart = request->Offset.QuadPart + queue->RemappedAreaOffset;

							if (request->Item->Write)
								request->Item->Status = TCWriteDevice (queue->LowerDeviceObject, request->Data, remappedOffset, request->Length);
							else
								request->Item->Status = TCCachedRead (queue, NULL, request->Data, remappedOffset, request->Length);
						}
					}
					else
					{
						if (request->Item->Write)
							request->Item->Status = TCWriteDevice (queue->LowerDeviceObject, request->Data, request->Offset, request->Length);
						else
							request->Item->Status = TCCachedRead (queue, NULL, request->Data, request->Offset, request->Length);
					}
//.........这里部分代码省略.........
开发者ID:ChiefGyk,项目名称:VeraCrypt,代码行数:101,代码来源:EncryptedIoQueue.c

示例15: TestMain

 TestMain()
 {
     Dump("Bex Test Start...");
     atexit(pause);
 }
开发者ID:darcyg,项目名称:Bex,代码行数:5,代码来源:TestMain.cpp


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