[Com0com-cvs] com0com fileinfo.c,NONE,1.1 com0com.h,1.13,1.14 initunlo.c,1.4,1.5 sources,1.3,1.4 tra
The virtual serial port driver for Windows.
Brought to you by:
vfrolov
From: Vyacheslav F. <vf...@us...> - 2005-09-28 10:07:20
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25810 Modified Files: com0com.h initunlo.c sources trace.c trace.h tracetbl.c Added Files: fileinfo.c Log Message: Implemented IRP_MJ_QUERY_INFORMATION and IRP_MJ_SET_INFORMATION --- NEW FILE: fileinfo.c --- /* * $Id: fileinfo.c,v 1.1 2005/09/28 10:06:42 vfrolov Exp $ * * Copyright (c) 2005 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * * $Log: fileinfo.c,v $ * Revision 1.1 2005/09/28 10:06:42 vfrolov * Implemented IRP_MJ_QUERY_INFORMATION and IRP_MJ_SET_INFORMATION * * */ #include "precomp.h" /* * FILE_ID used by HALT_UNLESS to put it on BSOD */ #define FILE_ID 0xA NTSTATUS FdoPortQueryInformation(PC0C_FDOPORT_EXTENSION pDevExt, IN PIRP pIrp) { NTSTATUS status; if ((pDevExt->handFlow.ControlHandShake & SERIAL_ERROR_ABORT) && pDevExt->pIoPortLocal->errors) { pIrp->IoStatus.Information = 0; status = STATUS_CANCELLED; } else { PIO_STACK_LOCATION pIrpStack; pIrpStack = IoGetCurrentIrpStackLocation(pIrp); switch (pIrpStack->Parameters.QueryFile.FileInformationClass) { case FileStandardInformation: RtlZeroMemory(pIrp->AssociatedIrp.SystemBuffer, sizeof(FILE_STANDARD_INFORMATION)); pIrp->IoStatus.Information = sizeof(FILE_STANDARD_INFORMATION); status = STATUS_SUCCESS; break; case FilePositionInformation: RtlZeroMemory(pIrp->AssociatedIrp.SystemBuffer, sizeof(FILE_POSITION_INFORMATION)); pIrp->IoStatus.Information = sizeof(FILE_POSITION_INFORMATION); status = STATUS_SUCCESS; break; default: pIrp->IoStatus.Information = 0; status = STATUS_INVALID_PARAMETER; } } TraceIrp("FdoPortQueryInformation", pIrp, &status, TRACE_FLAG_PARAMS); pIrp->IoStatus.Status = status; IoCompleteRequest(pIrp, IO_NO_INCREMENT); return status; } NTSTATUS FdoPortSetInformation(PC0C_FDOPORT_EXTENSION pDevExt, IN PIRP pIrp) { NTSTATUS status; if ((pDevExt->handFlow.ControlHandShake & SERIAL_ERROR_ABORT) && pDevExt->pIoPortLocal->errors) { status = STATUS_CANCELLED; } else { PIO_STACK_LOCATION pIrpStack; pIrpStack = IoGetCurrentIrpStackLocation(pIrp); switch (pIrpStack->Parameters.QueryFile.FileInformationClass) { case FileEndOfFileInformation: case FileAllocationInformation: status = STATUS_SUCCESS; break; default: status = STATUS_INVALID_PARAMETER; } } TraceIrp("FdoPortSetInformation", pIrp, &status, TRACE_FLAG_PARAMS); pIrp->IoStatus.Information = 0; pIrp->IoStatus.Status = status; IoCompleteRequest(pIrp, IO_NO_INCREMENT); return status; } NTSTATUS c0cFileInformation(IN PDEVICE_OBJECT pDevObj, IN PIRP pIrp) { NTSTATUS status; PC0C_COMMON_EXTENSION pDevExt = pDevObj->DeviceExtension; ULONG code = IoGetCurrentIrpStackLocation(pIrp)->MajorFunction; switch (pDevExt->doType) { case C0C_DOTYPE_FP: if (code == IRP_MJ_QUERY_INFORMATION) status = FdoPortQueryInformation((PC0C_FDOPORT_EXTENSION)pDevExt, pIrp); else status = FdoPortSetInformation((PC0C_FDOPORT_EXTENSION)pDevExt, pIrp); break; default: status = STATUS_INVALID_DEVICE_REQUEST; pIrp->IoStatus.Information = 0; pIrp->IoStatus.Status = status; IoCompleteRequest(pIrp, IO_NO_INCREMENT); TraceCode(pDevExt, "IRP_MJ_", codeNameTableIrpMj, code, &status); } return status; } Index: sources =================================================================== RCS file: /cvsroot/com0com/com0com/sources,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sources 25 Aug 2005 15:38:17 -0000 1.3 --- sources 28 Sep 2005 10:06:42 -0000 1.4 *************** *** 16,19 **** --- 16,20 ---- write.c \ wait.c \ + fileinfo.c \ io.c \ startirp.c \ Index: initunlo.c =================================================================== RCS file: /cvsroot/com0com/com0com/initunlo.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** initunlo.c 13 Sep 2005 14:56:16 -0000 1.4 --- initunlo.c 28 Sep 2005 10:06:42 -0000 1.5 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2005/09/28 10:06:42 vfrolov + * Implemented IRP_MJ_QUERY_INFORMATION and IRP_MJ_SET_INFORMATION + * * Revision 1.4 2005/09/13 14:56:16 vfrolov * Implemented IRP_MJ_FLUSH_BUFFERS *************** *** 69,74 **** pDrvObj->MajorFunction[IRP_MJ_DEVICE_CONTROL] = c0cIoControl; pDrvObj->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = c0cInternalIoControl; ! pDrvObj->MajorFunction[IRP_MJ_QUERY_INFORMATION] = c0cQueryInformation; ! pDrvObj->MajorFunction[IRP_MJ_SET_INFORMATION] = c0cSetInformation; pDrvObj->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = c0cSystemControlDispatch; pDrvObj->MajorFunction[IRP_MJ_PNP] = c0cPnpDispatch; --- 72,77 ---- pDrvObj->MajorFunction[IRP_MJ_DEVICE_CONTROL] = c0cIoControl; pDrvObj->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = c0cInternalIoControl; ! pDrvObj->MajorFunction[IRP_MJ_QUERY_INFORMATION] = c0cFileInformation; ! pDrvObj->MajorFunction[IRP_MJ_SET_INFORMATION] = c0cFileInformation; pDrvObj->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = c0cSystemControlDispatch; pDrvObj->MajorFunction[IRP_MJ_PNP] = c0cPnpDispatch; *************** *** 104,141 **** } - NTSTATUS c0cQueryInformation(IN PDEVICE_OBJECT pDevObj, IN PIRP pIrp) - { - NTSTATUS status; - - UNREFERENCED_PARAMETER(pDevObj); - - status = STATUS_INVALID_DEVICE_REQUEST; - - TraceIrp("c0cQueryInformation", pIrp, &status, TRACE_FLAG_PARAMS); - - pIrp->IoStatus.Information = 0; - pIrp->IoStatus.Status = status; - IoCompleteRequest(pIrp, IO_NO_INCREMENT); - - return status; - } - - NTSTATUS c0cSetInformation(IN PDEVICE_OBJECT pDevObj, IN PIRP pIrp) - { - NTSTATUS status; - - UNREFERENCED_PARAMETER(pDevObj); - - status = STATUS_INVALID_DEVICE_REQUEST; - - TraceIrp("c0cQueryInformation", pIrp, &status, TRACE_FLAG_PARAMS); - - pIrp->IoStatus.Information = 0; - pIrp->IoStatus.Status = status; - IoCompleteRequest(pIrp, IO_NO_INCREMENT); - - return status; - } - NTSTATUS c0cSystemControlDispatch(IN PDEVICE_OBJECT pDevObj, IN PIRP pIrp) { --- 107,110 ---- Index: tracetbl.c =================================================================== RCS file: /cvsroot/com0com/com0com/tracetbl.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tracetbl.c 6 Sep 2005 06:49:38 -0000 1.3 --- tracetbl.c 28 Sep 2005 10:06:42 -0000 1.4 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2005/09/28 10:06:42 vfrolov + * Implemented IRP_MJ_QUERY_INFORMATION and IRP_MJ_SET_INFORMATION + * * Revision 1.3 2005/09/06 06:49:38 vfrolov * Added codeNameTableErrors[] *************** *** 278,281 **** --- 281,333 ---- }; + CODE2NAME codeNameTableFileInformationClass[] = { + #ifndef _WDMDDK_ + TOCODE2NAME1(FileDirectoryInformation), + TOCODE2NAME1(FileFullDirectoryInformation), + TOCODE2NAME1(FileBothDirectoryInformation), + #endif + TOCODE2NAME1(FileBasicInformation), + TOCODE2NAME1(FileStandardInformation), + #ifndef _WDMDDK_ + TOCODE2NAME1(FileInternalInformation), + TOCODE2NAME1(FileEaInformation), + TOCODE2NAME1(FileAccessInformation), + TOCODE2NAME1(FileNameInformation), + TOCODE2NAME1(FileRenameInformation), + TOCODE2NAME1(FileLinkInformation), + TOCODE2NAME1(FileNamesInformation), + TOCODE2NAME1(FileDispositionInformation), + #endif + TOCODE2NAME1(FilePositionInformation), + #ifndef _WDMDDK_ + TOCODE2NAME1(FileFullEaInformation), + TOCODE2NAME1(FileModeInformation), + TOCODE2NAME1(FileAlignmentInformation), + TOCODE2NAME1(FileAllInformation), + TOCODE2NAME1(FileAllocationInformation), + #endif + TOCODE2NAME1(FileEndOfFileInformation), + #ifndef _WDMDDK_ + TOCODE2NAME1(FileAlternateNameInformation), + TOCODE2NAME1(FileStreamInformation), + TOCODE2NAME1(FilePipeInformation), + TOCODE2NAME1(FilePipeLocalInformation), + TOCODE2NAME1(FilePipeRemoteInformation), + TOCODE2NAME1(FileMailslotQueryInformation), + TOCODE2NAME1(FileMailslotSetInformation), + TOCODE2NAME1(FileCompressionInformation), + TOCODE2NAME1(FileObjectIdInformation), + TOCODE2NAME1(FileCompletionInformation), + TOCODE2NAME1(FileMoveClusterInformation), + TOCODE2NAME1(FileQuotaInformation), + TOCODE2NAME1(FileReparsePointInformation), + TOCODE2NAME1(FileNetworkOpenInformation), + TOCODE2NAME1(FileAttributeTagInformation), + TOCODE2NAME1(FileTrackingInformation), + TOCODE2NAME1(FileMaximumInformation), + #endif + {0, NULL} + }; + #else /* DBG */ #pragma warning(disable:4206) // nonstandard extension used : translation unit is empty Index: trace.c =================================================================== RCS file: /cvsroot/com0com/com0com/trace.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** trace.c 13 Sep 2005 08:55:41 -0000 1.13 --- trace.c 28 Sep 2005 10:06:42 -0000 1.14 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.14 2005/09/28 10:06:42 vfrolov + * Implemented IRP_MJ_QUERY_INFORMATION and IRP_MJ_SET_INFORMATION + * * Revision 1.13 2005/09/13 08:55:41 vfrolov * Disabled modem status tracing by default *************** *** 1347,1350 **** --- 1350,1368 ---- pDestStr = AnsiStrCopyStr(pDestStr, &size, " "); pDestStr = AnsiStrCopyCode(pDestStr, &size, code, codeNameTablePower, "POWER_", 10); + break; + } + case IRP_MJ_QUERY_INFORMATION: { + ULONG code = pIrpStack->Parameters.QueryFile.FileInformationClass; + + pDestStr = AnsiStrCopyStr(pDestStr, &size, " "); + pDestStr = AnsiStrCopyCode(pDestStr, &size, code, codeNameTableFileInformationClass, NULL, 10); + break; + } + case IRP_MJ_SET_INFORMATION: { + ULONG code = pIrpStack->Parameters.SetFile.FileInformationClass; + + pDestStr = AnsiStrCopyStr(pDestStr, &size, " "); + pDestStr = AnsiStrCopyCode(pDestStr, &size, code, codeNameTableFileInformationClass, NULL, 10); + break; } } Index: trace.h =================================================================== RCS file: /cvsroot/com0com/com0com/trace.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** trace.h 13 Sep 2005 08:55:41 -0000 1.5 --- trace.h 28 Sep 2005 10:06:42 -0000 1.6 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.6 2005/09/28 10:06:42 vfrolov + * Implemented IRP_MJ_QUERY_INFORMATION and IRP_MJ_SET_INFORMATION + * * Revision 1.5 2005/09/13 08:55:41 vfrolov * Disabled modem status tracing by default *************** *** 115,118 **** --- 118,122 ---- CODE2NAME codeNameTableDeviceText[]; CODE2NAME codeNameTableErrors[]; + CODE2NAME codeNameTableFileInformationClass[]; FIELD2NAME codeNameTableControlHandShake[]; Index: com0com.h =================================================================== RCS file: /cvsroot/com0com/com0com/com0com.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** com0com.h 13 Sep 2005 14:56:16 -0000 1.13 --- com0com.h 28 Sep 2005 10:06:42 -0000 1.14 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.14 2005/09/28 10:06:42 vfrolov + * Implemented IRP_MJ_QUERY_INFORMATION and IRP_MJ_SET_INFORMATION + * * Revision 1.13 2005/09/13 14:56:16 vfrolov * Implemented IRP_MJ_FLUSH_BUFFERS *************** *** 236,242 **** DeclareMajorFunction(c0cInternalIoControl); DeclareMajorFunction(c0cCleanup); ! ! DeclareMajorFunction(c0cQueryInformation); ! DeclareMajorFunction(c0cSetInformation); DeclareMajorFunction(c0cSystemControlDispatch); --- 239,243 ---- DeclareMajorFunction(c0cInternalIoControl); DeclareMajorFunction(c0cCleanup); ! DeclareMajorFunction(c0cFileInformation); DeclareMajorFunction(c0cSystemControlDispatch); |