本文整理匯總了C++中DebugTrace函數的典型用法代碼示例。如果您正苦於以下問題:C++ DebugTrace函數的具體用法?C++ DebugTrace怎麽用?C++ DebugTrace使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DebugTrace函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: NtfsCompleteMdl
NTSTATUS
NtfsCompleteMdl (
IN PIRP_CONTEXT IrpContext,
IN PIRP Irp
)
/*++
Routine Description:
This routine performs the function of completing Mdl read and write
requests. It should be called only from NtfsFsdRead and NtfsFsdWrite.
Arguments:
Irp - Supplies the originating Irp.
Return Value:
NTSTATUS - Will always be STATUS_PENDING or STATUS_SUCCESS.
--*/
{
PFILE_OBJECT FileObject;
PIO_STACK_LOCATION IrpSp;
PNTFS_ADVANCED_FCB_HEADER Header;
ASSERT( FlagOn( IrpContext->TopLevelIrpContext->State, IRP_CONTEXT_STATE_OWNS_TOP_LEVEL ));
PAGED_CODE();
DebugTrace( +1, Dbg, ("NtfsCompleteMdl\n") );
DebugTrace( 0, Dbg, ("IrpContext = %08lx\n", IrpContext) );
DebugTrace( 0, Dbg, ("Irp = %08lx\n", Irp) );
//
// Do completion processing.
//
FileObject = IoGetCurrentIrpStackLocation( Irp )->FileObject;
switch( IrpContext->MajorFunction ) {
case IRP_MJ_READ:
CcMdlReadComplete( FileObject, Irp->MdlAddress );
break;
case IRP_MJ_WRITE:
try {
PSCB Scb;
VBO StartingVbo;
LONGLONG ByteCount;
LONGLONG ByteRange;
BOOLEAN DoingIoAtEof = FALSE;
ASSERT( FlagOn( IrpContext->State, IRP_CONTEXT_STATE_WAIT ));
IrpSp = IoGetCurrentIrpStackLocation( Irp );
Scb = (PSCB)(IrpSp->FileObject->FsContext);
Header = &(Scb->Header);
//
// Now synchronize with the FsRtl Header and Scb.
//
if (Header->PagingIoResource != NULL) {
StartingVbo = IrpSp->Parameters.Write.ByteOffset.QuadPart;
ByteCount = (LONGLONG) IrpSp->Parameters.Write.Length;
ByteRange = StartingVbo + ByteCount + PAGE_SIZE - 1;
ClearFlag( ((ULONG) ByteRange), PAGE_SIZE - 1 );
ExAcquireResourceSharedLite( Header->PagingIoResource, TRUE );
NtfsAcquireFsrtlHeader( Scb );
//
// Now see if this is at EOF.
// Recursive flush will generate IO which ends on page boundary
// which is why we rounded the range
//
if (ByteRange > Header->ValidDataLength.QuadPart) {
//
// Mark that we are writing to EOF. If someone else is currently
// writing to EOF, wait for them.
//
ASSERT( ByteRange - StartingVbo < MAXULONG );
DoingIoAtEof = !FlagOn( Header->Flags, FSRTL_FLAG_EOF_ADVANCE_ACTIVE ) ||
NtfsWaitForIoAtEof( Header, (PLARGE_INTEGER)&StartingVbo, (ULONG)(ByteRange - StartingVbo) );
if (DoingIoAtEof) {
SetFlag( Header->Flags, FSRTL_FLAG_EOF_ADVANCE_ACTIVE );
//.........這裏部分代碼省略.........
示例2: DebugTrace
void JNetwork::ThreadProc(void* param)
{
JNetwork* pThis = reinterpret_cast<JNetwork*>(param);
JSocket* pSocket = NULL;
if (pThis->serverIP.size()) {
DebugTrace("Starting Client Thread");
pThis->socket = new JSocket(pThis->serverIP);
if(pThis->socket->isConnected())
pSocket = pThis->socket;
} else {
DebugTrace("Starting Server Thread");
pThis->socket = new JSocket();
// Wait for some client
pSocket = pThis->socket->Accept();
}
while(pSocket && pSocket->isConnected()) {
char buff[1024];
{
boost::mutex::scoped_lock l(pThis->receiveMutex);
int len = pSocket->Read(buff, sizeof(buff));
if(len) {
DebugTrace("receiving " << len << " bytes : " << buff);
pThis->received << buff;
}
// Checking for some command to execute
size_t found = pThis->received.str().find("Command");
if(found != string::npos)
{
map<string, processCmd>::iterator ite = sCommandMap.find((pThis->received.str()).substr(0, found) + "Command");
if(ite != sCommandMap.end())
{
DebugTrace("begin of command received : "<< pThis->received.str() );
DebugTrace("begin of command toSend : "<< pThis->toSend.str() );
boost::mutex::scoped_lock l(pThis->sendMutex);
pThis->toSend << pThis->received.str().substr(0, found) + "Response ";
pThis->received.str("");
processCmd theMethod = (ite)->second;
theMethod(pThis->received, pThis->toSend);
DebugTrace("end of command received : "<< pThis->received.str() );
DebugTrace("end of command toSend : "<< pThis->toSend.str() );
}
}
// Checking for some response to execute
found = pThis->received.str().find("Response");
if(found != string::npos)
{
map<string, processCmd>::iterator ite = sCommandMap.find((pThis->received.str()).substr(0, found) + "Response");
if(ite != sCommandMap.end())
{
DebugTrace("begin of response received : "<< pThis->received.str() );
DebugTrace("begin of response toSend : "<< pThis->toSend.str() );
boost::mutex::scoped_lock l(pThis->sendMutex);
string aString;
pThis->received >> aString;
processCmd theMethod = (ite)->second;
theMethod(pThis->received, pThis->toSend);
pThis->received.str("");
DebugTrace("end of response received : "<< pThis->received.str() );
DebugTrace("end of response toSend : "<< pThis->toSend.str() );
}
}
}
示例3: NdFatSecondaryCommonRead
NTSTATUS
NdFatSecondaryCommonRead (
IN PIRP_CONTEXT IrpContext,
IN PIRP Irp,
IN ULONG BytesToRead
)
{
NTSTATUS status;
PVOLUME_DEVICE_OBJECT volDo = CONTAINING_RECORD( IrpContext->Vcb, VOLUME_DEVICE_OBJECT, Vcb );
BOOLEAN secondarySessionResourceAcquired = FALSE;
PIO_STACK_LOCATION irpSp = IoGetCurrentIrpStackLocation( Irp );
PFILE_OBJECT fileObject = irpSp->FileObject;
struct Read read;
PSECONDARY_REQUEST secondaryRequest = NULL;
PNDFS_REQUEST_HEADER ndfsRequestHeader;
PNDFS_WINXP_REQUEST_HEADER ndfsWinxpRequestHeader;
PNDFS_WINXP_REPLY_HEADER ndfsWinxpReplytHeader;
LARGE_INTEGER timeOut;
TYPE_OF_OPEN typeOfOpen;
PVCB vcb;
PFCB fcb;
PCCB ccb;
BOOLEAN fcbAcquired = FALSE;
PUCHAR outputBuffer;
ULONG totalReadLength;
_U64 primaryFileHandle = 0;
ASSERT( KeGetCurrentIrql() < DISPATCH_LEVEL );
typeOfOpen = FatDecodeFileObject( fileObject, &vcb, &fcb, &ccb );
ASSERT( typeOfOpen == UserFileOpen );
if (FlagOn(ccb->NdFatFlags, ND_FAT_CCB_FLAG_UNOPENED)) {
/*if (FlagOn( fcb->FcbState, FCB_STATE_FILE_DELETED )) {
ASSERT( FALSE );
FatRaiseStatus( IrpContext, STATUS_FILE_DELETED, NULL, NULL );
} else */{
ASSERT( FlagOn(ccb->NdFatFlags, ND_FAT_CCB_FLAG_CORRUPTED) );
return STATUS_FILE_CORRUPT_ERROR;
}
}
if (!FlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT)) {
ASSERT( FALSE );
DebugTrace2( 0, Dbg, ("Can't wait in create\n") );
status = FatFsdPostRequest( IrpContext, Irp );
DebugTrace2( -1, Dbg2, ("NdFatSecondaryCommonRead: FatFsdPostRequest -> %08lx\n", status) );
return status;
}
if (irpSp->Parameters.Read.ByteOffset.QuadPart == FILE_WRITE_TO_END_OF_FILE &&
irpSp->Parameters.Read.ByteOffset.HighPart == -1) {
read.ByteOffset = fcb->Header.FileSize;
} else {
read.ByteOffset = irpSp->Parameters.Read.ByteOffset;
}
read.Key = 0;
read.Length = irpSp->Parameters.Read.Length;
read.Length = BytesToRead;
ASSERT( FlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT) );
//FatAcquireSharedFcb( IrpContext, fcb );
//fcbAcquired = TRUE;
try {
secondarySessionResourceAcquired
= SecondaryAcquireResourceExclusiveLite( IrpContext,
&volDo->Secondary->SessionResource,
BooleanFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT) );
if (FlagOn(volDo->Secondary->Thread.Flags, SECONDARY_THREAD_FLAG_REMOTE_DISCONNECTED) ) {
PrintIrp( Dbg2, "SECONDARY_THREAD_FLAG_REMOTE_DISCONNECTED", NULL, IrpContext->OriginatingIrp );
FatRaiseStatus( IrpContext, STATUS_CANT_WAIT );
//.........這裏部分代碼省略.........
示例4: FatFspDispatch
VOID
FatFspDispatch (
IN PVOID Context
)
/*++
Routine Description:
This is the main FSP thread routine that is executed to receive
and dispatch IRP requests. Each FSP thread begins its execution here.
There is one thread created at system initialization time and subsequent
threads created as needed.
Arguments:
Context - Supplies the thread id.
Return Value:
None - This routine never exits
--*/
{
NTSTATUS Status;
PIRP Irp;
PIRP_CONTEXT IrpContext;
PIO_STACK_LOCATION IrpSp;
BOOLEAN VcbDeleted;
PVOLUME_DEVICE_OBJECT VolDo;
IrpContext = (PIRP_CONTEXT)Context;
Irp = IrpContext->OriginatingIrp;
IrpSp = IoGetCurrentIrpStackLocation( Irp );
//
// Now because we are the Fsp we will force the IrpContext to
// indicate true on Wait.
//
SetFlag(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT | IRP_CONTEXT_FLAG_IN_FSP);
//
// If this request has an associated volume device object, remember it.
//
if ( IrpSp->FileObject != NULL ) {
VolDo = CONTAINING_RECORD( IrpSp->DeviceObject,
VOLUME_DEVICE_OBJECT,
DeviceObject );
} else {
VolDo = NULL;
}
//
// Now case on the function code. For each major function code,
// either call the appropriate FSP routine or case on the minor
// function and then call the FSP routine. The FSP routine that
// we call is responsible for completing the IRP, and not us.
// That way the routine can complete the IRP and then continue
// post processing as required. For example, a read can be
// satisfied right away and then read can be done.
//
// We'll do all of the work within an exception handler that
// will be invoked if ever some underlying operation gets into
// trouble (e.g., if FatReadSectorsSync has trouble).
//
while ( TRUE ) {
DebugTrace(0, Dbg, "FatFspDispatch: Irp = 0x%08lx\n", Irp);
//
// If this Irp was top level, note it in our thread local storage.
//
FsRtlEnterFileSystem();
if ( FlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_RECURSIVE_CALL) ) {
IoSetTopLevelIrp( (PIRP)FSRTL_FSP_TOP_LEVEL_IRP );
} else {
IoSetTopLevelIrp( Irp );
}
#if __NDAS_FAT__
do {
#if __NDAS_FAT_SECONDARY__
//.........這裏部分代碼省略.........
示例5: xixfs_IsFromLocal
//
// compare addresses to see if the address is local.
//
BOOLEAN
xixfs_IsFromLocal(
PLPX_ADDRESS Addr
) {
NTSTATUS ntStatus;
SOCKETLPX_ADDRESS_LIST socketLpxAddressList;
LONG idx_addr ;
PAGED_CODE();
DebugTrace(DEBUG_LEVEL_TRACE, DEBUG_TARGET_HOSTCOM,
("Enter xixfs_IsFromLocal \n"));
DebugTrace(DEBUG_LEVEL_INFO, DEBUG_TARGET_HOSTCOM,
( "[LFS] xixfs_IsFromLocal: Entered with Addr:%02x:%02x:%02x:%02x:%02x:%02x\n",
Addr->Node[0], Addr->Node[1], Addr->Node[2],
Addr->Node[3], Addr->Node[4], Addr->Node[5]
));
//
// get addresses from LPX
//
socketLpxAddressList.iAddressCount = 0 ;
ntStatus = LpxTdiGetAddressList(
&socketLpxAddressList
) ;
if(!NT_SUCCESS(ntStatus)) {
DebugTrace( DEBUG_LEVEL_ERROR, DEBUG_TARGET_ALL, ( "[LFS] xixfs_IsFromLocal: LpxTdiGetAddressList() failed.\n")) ;
return FALSE ;
}
if(0 == socketLpxAddressList.iAddressCount) {
DebugTrace( DEBUG_LEVEL_ERROR, DEBUG_TARGET_ALL, ( "[LFS] xixfs_IsFromLocal: No NICs in the host.\n")) ;
return FALSE ;
}
for(idx_addr = 0 ; idx_addr < socketLpxAddressList.iAddressCount ; idx_addr ++ ) {
//
// BUG FIX for LPX: skip SocketLpxDevice
//
if( (0 == socketLpxAddressList.SocketLpx[idx_addr].LpxAddress.Node[0]) &&
(0 == socketLpxAddressList.SocketLpx[idx_addr].LpxAddress.Node[1]) &&
(0 == socketLpxAddressList.SocketLpx[idx_addr].LpxAddress.Node[2]) &&
(0 == socketLpxAddressList.SocketLpx[idx_addr].LpxAddress.Node[3]) &&
(0 == socketLpxAddressList.SocketLpx[idx_addr].LpxAddress.Node[4]) &&
(0 == socketLpxAddressList.SocketLpx[idx_addr].LpxAddress.Node[5]) ) {
DebugTrace(DEBUG_LEVEL_INFO, DEBUG_TARGET_HOSTCOM, ( "[LFS] xixfs_IsFromLocal: We don't use SocketLpx device.\n") );
continue ;
}
if( RtlCompareMemory(Addr->Node, socketLpxAddressList.SocketLpx[idx_addr].LpxAddress.Node, ETHER_ADDR_LENGTH)
== ETHER_ADDR_LENGTH ) {
DebugTrace(DEBUG_LEVEL_INFO, DEBUG_TARGET_HOSTCOM, ( "[LFS] xixfs_IsFromLocal: found a address matching.\n")) ;
return TRUE ;
}
}
DebugTrace(DEBUG_LEVEL_TRACE, DEBUG_TARGET_HOSTCOM,
("Exit xixfs_IsFromLocal \n"));
return FALSE ;
}
示例6: FatCheckFileAccess
BOOLEAN
FatCheckFileAccess (
PIRP_CONTEXT IrpContext,
IN UCHAR DirentAttributes,
IN PACCESS_MASK DesiredAccess
)
/*++
Routine Description:
This routine checks if a desired access is allowed to a file represented
by the specified DirentAttriubutes.
Arguments:
DirentAttributes - Supplies the Dirent attributes to check access for
DesiredAccess - Supplies the desired access mask that we are checking for
Return Value:
BOOLEAN - TRUE if access is allowed and FALSE otherwise
--*/
{
BOOLEAN Result;
DebugTrace(+1, Dbg, "FatCheckFileAccess\n", 0);
DebugTrace( 0, Dbg, "DirentAttributes = %8lx\n", DirentAttributes);
DebugTrace( 0, Dbg, "DesiredAccess = %8lx\n", *DesiredAccess);
PAGED_CODE();
//
// This procedures is programmed like a string of filters each
// filter checks to see if some access is allowed, if it is not allowed
// the filter return FALSE to the user without further checks otherwise
// it moves on to the next filter. The filter check is to check for
// desired access flags that are not allowed for a particular dirent
//
Result = TRUE;
try {
//
// Check for Volume ID or Device Dirents, these are not allowed user
// access at all
//
if (FlagOn(DirentAttributes, FAT_DIRENT_ATTR_VOLUME_ID) ||
FlagOn(DirentAttributes, FAT_DIRENT_ATTR_DEVICE)) {
DebugTrace(0, Dbg, "Cannot access volume id or device\n", 0);
try_return( Result = FALSE );
}
//
// Check the desired access for the object - we only blackball that
// we do not understand. The model of filesystems using ACLs is that
// they do not type the ACL to the object the ACL is on. Permissions
// are not checked for consistency vs. the object type - dir/file.
//
if (FlagOn(*DesiredAccess, ~(DELETE |
READ_CONTROL |
WRITE_OWNER |
WRITE_DAC |
SYNCHRONIZE |
ACCESS_SYSTEM_SECURITY |
FILE_WRITE_DATA |
FILE_READ_EA |
FILE_WRITE_EA |
FILE_READ_ATTRIBUTES |
FILE_WRITE_ATTRIBUTES |
FILE_LIST_DIRECTORY |
FILE_TRAVERSE |
FILE_DELETE_CHILD |
FILE_APPEND_DATA))) {
DebugTrace(0, Dbg, "Cannot open object\n", 0);
try_return( Result = FALSE );
}
//
// Check for a read-only Dirent
//
if (FlagOn(DirentAttributes, FAT_DIRENT_ATTR_READ_ONLY)) {
//
// Check the desired access for a read-only dirent. AccessMask will contain
// the flags we're going to allow.
//
ACCESS_MASK AccessMask = DELETE | READ_CONTROL | WRITE_OWNER | WRITE_DAC |
//.........這裏部分代碼省略.........
示例7: FatCommonSetVolumeInfo
NTSTATUS
FatCommonSetVolumeInfo (
IN PIRP_CONTEXT IrpContext,
IN PIRP Irp
)
/*++
Routine Description:
This is the common routine for setting Volume Information called by both
the fsd and fsp threads.
Arguments:
Irp - Supplies the Irp being processed
Return Value:
NTSTATUS - The return status for the operation
--*/
{
NTSTATUS Status;
PIO_STACK_LOCATION IrpSp;
PVCB Vcb;
PFCB Fcb;
PCCB Ccb;
TYPE_OF_OPEN TypeOfOpen;
ULONG Length;
FS_INFORMATION_CLASS FsInformationClass;
PVOID Buffer;
//
// Get the current stack location
//
IrpSp = IoGetCurrentIrpStackLocation( Irp );
DebugTrace(+1, Dbg, "FatCommonSetVolumeInfo...\n", 0);
DebugTrace( 0, Dbg, "Irp = %08lx\n", Irp );
DebugTrace( 0, Dbg, "->Length = %08lx\n", IrpSp->Parameters.SetVolume.Length);
DebugTrace( 0, Dbg, "->FsInformationClass = %08lx\n", IrpSp->Parameters.SetVolume.FsInformationClass);
DebugTrace( 0, Dbg, "->Buffer = %08lx\n", Irp->AssociatedIrp.SystemBuffer);
//
// Reference our input parameters to make things easier
//
Length = IrpSp->Parameters.SetVolume.Length;
FsInformationClass = IrpSp->Parameters.SetVolume.FsInformationClass;
Buffer = Irp->AssociatedIrp.SystemBuffer;
//
// Decode the file object to get the Vcb
//
TypeOfOpen = FatDecodeFileObject( IrpSp->FileObject, &Vcb, &Fcb, &Ccb );
if (TypeOfOpen != UserVolumeOpen) {
FatCompleteRequest( IrpContext, Irp, STATUS_ACCESS_DENIED );
DebugTrace(-1, Dbg, "FatCommonSetVolumeInfo -> STATUS_ACCESS_DENIED\n", 0);
return STATUS_ACCESS_DENIED;
}
#ifndef DOUBLE_SPACE_WRITE
ASSERT(Vcb->Dscb == NULL);
#endif // DOUBLE_SPACE_WRITE
//
// Acquire exclusive access to the Vcb and enqueue the Irp if we didn't
// get access
//
if (!FatAcquireExclusiveVcb( IrpContext, Vcb )) {
DebugTrace(0, Dbg, "Cannot acquire Vcb\n", 0);
Status = FatFsdPostRequest( IrpContext, Irp );
DebugTrace(-1, Dbg, "FatCommonSetVolumeInfo -> %08lx\n", Status );
return Status;
}
try {
//
// Make sure the vcb is in a usable condition. This will raise
// and error condition if the volume is unusable
//
// Also verify the Root Dcb since we need info from there.
//
FatVerifyFcb( IrpContext, Vcb->RootDcb );
//.........這裏部分代碼省略.........
示例8: FatQueryFsVolumeInfo
NTSTATUS
FatQueryFsVolumeInfo (
IN PIRP_CONTEXT IrpContext,
IN PVCB Vcb,
IN PFILE_FS_VOLUME_INFORMATION Buffer,
IN OUT PULONG Length
)
/*++
Routine Description:
This routine implements the query volume info call
Arguments:
Vcb - Supplies the Vcb being queried
Buffer - Supplies a pointer to the output buffer where the information
is to be returned
Length - Supplies the length of the buffer in byte. This variable
upon return recieves the remaining bytes free in the buffer
Return Value:
NTSTATUS - Returns the status for the query
--*/
{
ULONG BytesToCopy;
NTSTATUS Status;
DebugTrace(0, Dbg, "FatQueryFsVolumeInfo...\n", 0);
//
// Zero out the buffer, then extract and fill up the non zero fields.
//
RtlZeroMemory( Buffer, sizeof(FILE_FS_VOLUME_INFORMATION) );
Buffer->VolumeSerialNumber = Vcb->Vpb->SerialNumber;
Buffer->SupportsObjects = FALSE;
*Length -= FIELD_OFFSET(FILE_FS_VOLUME_INFORMATION, VolumeLabel[0]);
//
// Check if the buffer we're given is long enough
//
if ( *Length >= (ULONG)Vcb->Vpb->VolumeLabelLength ) {
BytesToCopy = Vcb->Vpb->VolumeLabelLength;
Status = STATUS_SUCCESS;
} else {
BytesToCopy = *Length;
Status = STATUS_BUFFER_OVERFLOW;
}
//
// Copy over what we can of the volume label, and adjust *Length
//
Buffer->VolumeLabelLength = Vcb->Vpb->VolumeLabelLength;
RtlCopyMemory( &Buffer->VolumeLabel[0],
&Vcb->Vpb->VolumeLabel[0],
BytesToCopy );
*Length -= BytesToCopy;
//
// Set our status and return to our caller
//
UNREFERENCED_PARAMETER( IrpContext );
return Status;
}
示例9: DumpStatistics
void DumpStatistics()
{
#ifdef TRACK_OBJECT_USAGE
DebugTrace("-----------------------------------------------------------");
DebugTrace("Object Usage Stats" << std::endl);
DebugTrace("CardPrimitive current count: " << InstanceCounter<CardPrimitive>::GetCurrentObjectCount());
DebugTrace("CardPrimitive current byte usage: " << InstanceCounter<CardPrimitive>::GetCurrentByteCount());
DebugTrace("CardPrimitive max count: " << InstanceCounter<CardPrimitive>::GetMaximumObjectCount());
DebugTrace("CardPrimitive max byte usage: " << InstanceCounter<CardPrimitive>::GetMaximumByteCount() << std::endl);
DebugTrace("MTGCard current count: " << InstanceCounter<MTGCard>::GetCurrentObjectCount());
DebugTrace("MTGCard current byte usage: " << InstanceCounter<MTGCard>::GetCurrentByteCount());
DebugTrace("MTGCard max count: " << InstanceCounter<MTGCard>::GetMaximumObjectCount());
DebugTrace("MTGCard max byte usage: " << InstanceCounter<MTGCard>::GetMaximumByteCount() << std::endl);
DebugTrace("MTGCardInstance current count: " << InstanceCounter<MTGCardInstance>::GetCurrentObjectCount());
DebugTrace("MTGCardInstance current byte usage: " << InstanceCounter<MTGCardInstance>::GetCurrentByteCount());
DebugTrace("MTGCardInstance max count: " << InstanceCounter<MTGCardInstance>::GetMaximumObjectCount());
DebugTrace("MTGCardInstance max byte usage: " << InstanceCounter<MTGCardInstance>::GetMaximumByteCount() << std::endl);
DebugTrace("ManaCost current count: " << InstanceCounter<ManaCost>::GetCurrentObjectCount());
DebugTrace("ManaCost current byte usage: " << InstanceCounter<ManaCost>::GetCurrentByteCount());
DebugTrace("ManaCost max count: " << InstanceCounter<ManaCost>::GetMaximumObjectCount());
DebugTrace("ManaCost max byte usage: " << InstanceCounter<ManaCost>::GetMaximumByteCount() << std::endl);
DebugTrace("ExtraCost current count: " << InstanceCounter<ExtraCost>::GetCurrentObjectCount());
DebugTrace("ExtraCost current byte usage: " << InstanceCounter<ExtraCost>::GetCurrentByteCount());
DebugTrace("ExtraCost max count: " << InstanceCounter<ExtraCost>::GetMaximumObjectCount());
DebugTrace("ExtraCost max byte usage: " << InstanceCounter<ExtraCost>::GetMaximumByteCount() << std::endl);
DebugTrace("-----------------------------------------------------------");
#endif
}
示例10: FatCommonQueryVolumeInfo
NTSTATUS
FatCommonQueryVolumeInfo (
IN PIRP_CONTEXT IrpContext,
IN PIRP Irp
)
/*++
Routine Description:
This is the common routine for querying volume information called by both
the fsd and fsp threads.
Arguments:
Irp - Supplies the Irp being processed
Return Value:
NTSTATUS - The return status for the operation
--*/
{
NTSTATUS Status;
PIO_STACK_LOCATION IrpSp;
PVCB Vcb;
PFCB Fcb;
PCCB Ccb;
ULONG Length;
FS_INFORMATION_CLASS FsInformationClass;
PVOID Buffer;
BOOLEAN WeAcquiredVcb = FALSE;
//
// Get the current stack location
//
IrpSp = IoGetCurrentIrpStackLocation( Irp );
DebugTrace(+1, Dbg, "FatCommonQueryVolumeInfo...\n", 0);
DebugTrace( 0, Dbg, "Irp = %08lx\n", Irp );
DebugTrace( 0, Dbg, "->Length = %08lx\n", IrpSp->Parameters.QueryVolume.Length);
DebugTrace( 0, Dbg, "->FsInformationClass = %08lx\n", IrpSp->Parameters.QueryVolume.FsInformationClass);
DebugTrace( 0, Dbg, "->Buffer = %08lx\n", Irp->AssociatedIrp.SystemBuffer);
//
// Reference our input parameters to make things easier
//
Length = IrpSp->Parameters.QueryVolume.Length;
FsInformationClass = IrpSp->Parameters.QueryVolume.FsInformationClass;
Buffer = Irp->AssociatedIrp.SystemBuffer;
//
// Decode the file object to get the Vcb
//
(VOID) FatDecodeFileObject( IrpSp->FileObject, &Vcb, &Fcb, &Ccb );
try {
//
// Make sure the vcb is in a usable condition. This will raise
// and error condition if the volume is unusable
//
// Also verify the Root Dcb since we need info from there.
//
FatVerifyFcb( IrpContext, Vcb->RootDcb );
//
// Based on the information class we'll do different actions. Each
// of the procedures that we're calling fills up the output buffer
// if possible and returns true if it successfully filled the buffer
// and false if it couldn't wait for any I/O to complete.
//
switch (FsInformationClass) {
case FileFsVolumeInformation:
//
// This is the only routine we need the Vcb shared because of
// copying the volume label. All other routines copy fields that
// cannot change or are just manifest constants.
//
if (!FatAcquireSharedVcb( IrpContext, Vcb )) {
DebugTrace(0, Dbg, "Cannot acquire Vcb\n", 0);
Status = FatFsdPostRequest( IrpContext, Irp );
} else {
Status = FatQueryFsVolumeInfo( IrpContext, Vcb, Buffer, &Length );
//.........這裏部分代碼省略.........
示例11: FatCommonRead
NTSTATUS
FatCommonRead (
IN PIRP_CONTEXT IrpContext,
IN PIRP Irp
)
/*++
Routine Description:
This is the common read routine for NtReadFile, called from both
the Fsd, or from the Fsp if a request could not be completed without
blocking in the Fsd. This routine has no code where it determines
whether it is running in the Fsd or Fsp. Instead, its actions are
conditionalized by the Wait input parameter, which determines whether
it is allowed to block or not. If a blocking condition is encountered
with Wait == FALSE, however, the request is posted to the Fsp, who
always calls with WAIT == TRUE.
Arguments:
Irp - Supplies the Irp to process
Return Value:
NTSTATUS - The return status for the operation
--*/
{
PVCB Vcb;
PFCB FcbOrDcb;
PCCB Ccb;
VBO StartingVbo;
ULONG ByteCount;
ULONG RequestedByteCount;
PIO_STACK_LOCATION IrpSp;
PFILE_OBJECT FileObject;
TYPE_OF_OPEN TypeOfRead;
BOOLEAN PostIrp = FALSE;
BOOLEAN OplockPostIrp = FALSE;
BOOLEAN FcbOrDcbAcquired = FALSE;
BOOLEAN Wait;
BOOLEAN PagingIo;
BOOLEAN NonCachedIo;
BOOLEAN SynchronousIo;
NTSTATUS Status;
FAT_IO_CONTEXT StackFatIoContext;
//
// A system buffer is only used if we have to access the
// buffer directly from the Fsp to clear a portion or to
// do a synchronous I/O, or a cached transfer. It is
// possible that our caller may have already mapped a
// system buffer, in which case we must remember this so
// we do not unmap it on the way out.
//
PVOID SystemBuffer = NULL;
LARGE_INTEGER StartingByte;
//
// Get current Irp stack location.
//
IrpSp = IoGetCurrentIrpStackLocation( Irp );
FileObject = IrpSp->FileObject;
//
// Initialize the appropriate local variables.
//
Wait = BooleanFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT);
PagingIo = BooleanFlagOn(Irp->Flags, IRP_PAGING_IO);
NonCachedIo = BooleanFlagOn(Irp->Flags,IRP_NOCACHE);
SynchronousIo = BooleanFlagOn(FileObject->Flags, FO_SYNCHRONOUS_IO);
DebugTrace(+1, Dbg, "CommonRead\n", 0);
DebugTrace( 0, Dbg, " Irp = %8lx\n", Irp);
DebugTrace( 0, Dbg, " ->ByteCount = %8lx\n", IrpSp->Parameters.Read.Length);
DebugTrace( 0, Dbg, " ->ByteOffset.LowPart = %8lx\n", IrpSp->Parameters.Read.ByteOffset.LowPart);
DebugTrace( 0, Dbg, " ->ByteOffset.HighPart = %8lx\n", IrpSp->Parameters.Read.ByteOffset.HighPart);
//
// Extract starting Vbo and offset.
//
StartingByte = IrpSp->Parameters.Read.ByteOffset;
StartingVbo = StartingByte.LowPart;
ByteCount = IrpSp->Parameters.Read.Length;
//.........這裏部分代碼省略.........
示例12: FatPostStackOverflowRead
NTSTATUS
FatPostStackOverflowRead (
IN PIRP_CONTEXT IrpContext,
IN PIRP Irp,
IN PFCB Fcb
)
/*++
Routine Description:
This routine posts a read request that could not be processed by
the fsp thread because of stack overflow potential.
Arguments:
Irp - Supplies the request to process.
Fcb - Supplies the file.
Return Value:
STATUS_PENDING.
--*/
{
PKEVENT Event;
PERESOURCE Resource;
DebugTrace(0, Dbg, "Getting too close to stack limit pass request to Fsp\n", 0 );
//
// Allocate an event and get shared on the resource we will
// be later using the common read.
//
Event = FsRtlAllocatePool( NonPagedPool, sizeof(KEVENT) );
KeInitializeEvent( Event, NotificationEvent, FALSE );
if (FlagOn(Irp->Flags, IRP_PAGING_IO) && (Fcb->Header.PagingIoResource != NULL)) {
Resource = Fcb->Header.PagingIoResource;
} else {
Resource = Fcb->Header.Resource;
}
ExAcquireResourceShared( Resource, TRUE );
try {
//
// Make the Irp just like a regular post request and
// then send the Irp to the special overflow thread.
// After the post we will wait for the stack overflow
// read routine to set the event that indicates we can
// now release the scb resource and return.
//
FatPrePostIrp( IrpContext, Irp );
//
// If this read is the result of a verify, we have to
// tell the overflow read routne to temporarily
// hijack the Vcb->VerifyThread field so that reads
// can go through.
//
if (Fcb->Vcb->VerifyThread == KeGetCurrentThread()) {
SetFlag(IrpContext->Flags, IRP_CONTEXT_FLAG_VERIFY_READ);
}
FsRtlPostStackOverflow( IrpContext, Event, FatStackOverflowRead );
//
// And wait for the worker thread to complete the item
//
(VOID) KeWaitForSingleObject( Event, Executive, KernelMode, FALSE, NULL );
}
finally {
ExReleaseResource( Resource );
ExFreePool( Event );
}
return STATUS_PENDING;
}
示例13: FatFsdRead
NTSTATUS
FatFsdRead (
IN PVOLUME_DEVICE_OBJECT VolumeDeviceObject,
IN PIRP Irp
)
/*++
Routine Description:
This is the driver entry to the common read routine for NtReadFile calls.
For synchronous requests, the CommonRead is called with Wait == TRUE,
which means the request will always be completed in the current thread,
and never passed to the Fsp. If it is not a synchronous request,
CommonRead is called with Wait == FALSE, which means the request
will be passed to the Fsp only if there is a need to block.
Arguments:
VolumeDeviceObject - Supplies the volume device object where the
file being Read exists
Irp - Supplies the Irp being processed
Return Value:
NTSTATUS - The FSD status for the IRP
--*/
{
PFCB Fcb;
NTSTATUS Status;
PIRP_CONTEXT IrpContext = NULL;
BOOLEAN TopLevel;
DebugTrace(+1, Dbg, "FatFsdRead\n", 0);
//
// Call the common Read routine, with blocking allowed if synchronous
//
FsRtlEnterFileSystem();
//
// We are first going to do a quick check for paging file IO.
//
Fcb = (PFCB)(IoGetCurrentIrpStackLocation(Irp)->FileObject->FsContext);
if ((NodeType(Fcb) == FAT_NTC_FCB) &&
FlagOn(Fcb->FcbState, FCB_STATE_PAGING_FILE)) {
//
// Do the usual STATUS_PENDING things.
//
IoMarkIrpPending( Irp );
//
// If there is not enough stack to do this read, then post this
// read to the overflow queue.
//
if (IoGetRemainingStackSize() < OVERFLOW_READ_THRESHHOLD) {
KEVENT Event;
PAGING_FILE_OVERFLOW_PACKET Packet;
Packet.Irp = Irp;
Packet.Fcb = Fcb;
KeInitializeEvent( &Event, NotificationEvent, FALSE );
FsRtlPostPagingFileStackOverflow( &Packet, &Event, FatOverflowPagingFileRead );
//
// And wait for the worker thread to complete the item
//
(VOID) KeWaitForSingleObject( &Event, Executive, KernelMode, FALSE, NULL );
} else {
//
// Perform the actual IO, it will be completed when the io finishes.
//
FatPagingFileIo( Irp, Fcb );
}
FsRtlExitFileSystem();
return STATUS_PENDING;
}
try {
TopLevel = FatIsIrpTopLevel( Irp );
//.........這裏部分代碼省略.........
示例14: xixfs_FindOutChanges
static VOID
xixfs_FindOutChanges(
PSOCKETLPX_ADDRESS_LIST Original,
PSOCKETLPX_ADDRESS_LIST Updated,
PSOCKETLPX_ADDRESS_LIST Disabled,
PSOCKETLPX_ADDRESS_LIST Enabled
) {
LONG idx_ori, idx_updated, idx_disabled, idx_enabled ;
BOOLEAN found ;
UINT32 matchmask ;
PAGED_CODE();
DebugTrace(DEBUG_LEVEL_TRACE, DEBUG_TARGET_HOSTCOM,
("Enter xixfs_FindOutChanges \n"));
ASSERT(sizeof(matchmask) * 8 >= MAX_SOCKETLPX_INTERFACE) ;
idx_disabled = 0 ;
Disabled->iAddressCount = 0 ;
matchmask = 0 ;
for(idx_ori = 0 ; idx_ori < Original->iAddressCount ; idx_ori ++ ) {
found = FALSE ;
//
// find disabled ones.
//
for(idx_updated = 0 ; idx_updated < Updated->iAddressCount ; idx_updated ++) {
if( RtlCompareMemory(
Original->SocketLpx[idx_ori].LpxAddress.Node,
Updated->SocketLpx[idx_updated].LpxAddress.Node,
ETHER_ADDR_LENGTH
) == ETHER_ADDR_LENGTH ) {
//
// check this match in the bit mask.
// help find enabled ones.
//
matchmask |= 1 << idx_updated ;
found = TRUE ;
break ;
}
}
//
// add disabled one to the list
//
if(!found) {
RtlCopyMemory(Disabled->SocketLpx[idx_disabled].LpxAddress.Node,
Original->SocketLpx[idx_ori].LpxAddress.Node,
ETHER_ADDR_LENGTH
) ;
Disabled->iAddressCount ++ ;
idx_disabled ++ ;
}
}
//
// find enabled ones.
//
idx_enabled = 0 ;
Enabled->iAddressCount = 0 ;
for(idx_updated = 0 ; idx_updated < Updated->iAddressCount ; idx_updated ++) {
//
// add enabled one to the list.
//
if(!(matchmask & (1 << idx_updated))) {
RtlCopyMemory(
Enabled->SocketLpx[idx_enabled].LpxAddress.Node,
Updated->SocketLpx[idx_updated].LpxAddress.Node,
ETHER_ADDR_LENGTH
) ;
Enabled->iAddressCount ++ ;
idx_enabled ++ ;
}
}
DebugTrace(DEBUG_LEVEL_TRACE, DEBUG_TARGET_HOSTCOM,
("Exit xixfs_FindOutChanges \n"));
}
示例15: FatQueryFsSizeInfo
NTSTATUS
FatQueryFsSizeInfo (
IN PIRP_CONTEXT IrpContext,
IN PVCB Vcb,
IN PFILE_FS_SIZE_INFORMATION Buffer,
IN OUT PULONG Length
)
/*++
Routine Description:
This routine implements the query volume size call
Arguments:
Vcb - Supplies the Vcb being queried
Buffer - Supplies a pointer to the output buffer where the information
is to be returned
Length - Supplies the length of the buffer in byte. This variable
upon return recieves the remaining bytes free in the buffer
Return Value:
Status - Returns the status for the query
--*/
{
PDSCB Dscb = Vcb->Dscb;
DebugTrace(0, Dbg, "FatQueryFsSizeInfo...\n", 0);
RtlZeroMemory( Buffer, sizeof(FILE_FS_SIZE_INFORMATION) );
//
// Set the output buffer. If this is a double space volume, we have
// some additional work to do.
//
Dscb = Vcb->Dscb;
if (Dscb && (Dscb->SectorsAllocated != 0)) {
ULONG EstimatedClustersFree;
//
// Compute how many clusters we think we can represent on this
// disk. This is:
//
// (Total - Allocated) * (Represented / Allocated)
//
// which for computational reasons, we reduce to:
//
// (Total * Represented / Allocated) - Represented
//
EstimatedClustersFree =
(ULONG)
((((LONGLONG)(Dscb->CvfLayout.CvfHeap.Size / 512) *
(LONGLONG)(Dscb->SectorsRepresented)) /
Dscb->SectorsAllocated)
-
Dscb->SectorsRepresented)
/
Vcb->Bpb.SectorsPerCluster;
//
// Now, if this number is smaller than the remaining clusters in
// the FAT table, then use it.
//
Buffer->AvailableAllocationUnits.LowPart =
EstimatedClustersFree < Vcb->AllocationSupport.NumberOfFreeClusters ?
EstimatedClustersFree : Vcb->AllocationSupport.NumberOfFreeClusters;
//
// To get the total number of clusters, take how many FAT clusters
// we have used, and add the number returned above.
//
Buffer->TotalAllocationUnits.LowPart =
Vcb->AllocationSupport.NumberOfClusters -
Vcb->AllocationSupport.NumberOfFreeClusters +
Buffer->AvailableAllocationUnits.LowPart;
} else {
Buffer->TotalAllocationUnits.LowPart =
Vcb->AllocationSupport.NumberOfClusters;
Buffer->AvailableAllocationUnits.LowPart =
Vcb->AllocationSupport.NumberOfFreeClusters;
}
//.........這裏部分代碼省略.........