? objfre_wnet_x86_vh Index: cvsflt.c =================================================================== RCS file: /scotty/cvsflt/cvsflt/cvsflt.c,v retrieving revision 1.5 diff -c -r1.5 cvsflt.c *** cvsflt.c 10 Nov 2004 14:45:49 -0000 1.5 --- cvsflt.c 12 Sep 2012 12:40:18 -0000 *************** *** 8,13 **** --- 8,22 ---- // */ + #ifndef CVSTRIAL_MAX + // echo $((`date -d "1 Dec 2012" +%s` / 86400)) + #define CVSTRIAL_MAX 15675 + // echo $((`date -d "1 Feb 2013" +%s` / 86400)) + //#define CVSTRIAL_MAX 15736 + + #error CVSTRIAL_MAX should be defined in make. + #endif + /*++ Copyright (c) 1989-1993 Microsoft Corporation *************** *** 44,49 **** --- 53,59 ---- #include #include "cvsflt_pub.h" #include "cvsflt_int.h" + #include "cvsflt_msg.h" #define NTSTRSAFE_LIB #include *************** *** 350,355 **** --- 360,367 ---- ULONG gSfOsMajorVersion = 0; ULONG gSfOsMinorVersion = 0; + ULONG gSTrialExpired = 0; + // // Here is what the major and minor versions should be for the various OS versions: // *************** *** 1063,1068 **** --- 1075,1081 ---- BOOLEAN CvsIsPosixFileName ( IN PIRP Irp, + IN PDEVICE_OBJECT DeviceObject, IN PUNICODE_STRING FileName ); *************** *** 2160,2166 **** FileName = CvsGetFileName(Irp); if(FileName) { ! if(CvsIsPosixFileName(Irp,FileName)) { PIO_STACK_LOCATION irpStack; --- 2173,2179 ---- FileName = CvsGetFileName(Irp); if(FileName) { ! if(CvsIsPosixFileName(Irp,DeviceObject,FileName)) { PIO_STACK_LOCATION irpStack; *************** *** 4986,4992 **** FileName = CvsGetFileName(Irp); if(FileName) { ! if(CvsIsPosixFileName(Irp, FileName)) irpSp->Flags |= SL_CASE_SENSITIVE; if(CvsIsInuseFileName(Irp,FileName,&InuseFileName)) --- 4999,5005 ---- FileName = CvsGetFileName(Irp); if(FileName) { ! if(CvsIsPosixFileName(Irp, DeviceObject, FileName)) irpSp->Flags |= SL_CASE_SENSITIVE; if(CvsIsInuseFileName(Irp,FileName,&InuseFileName)) *************** *** 7249,7255 **** result = ObQueryNameString(irpSp->FileObject->RelatedFileObject, ObjectNameInfo, oniSize, &Length); if(result != STATUS_SUCCESS) { ! DbgPrint("CvsFlt!CvsIsPosixFileName: ObQueryNameString returned %08x\n",result); return FALSE; } ObjectNameInfo->Name.MaximumLength=oniSize-sizeof(OBJECT_NAME_INFORMATION); --- 7262,7268 ---- result = ObQueryNameString(irpSp->FileObject->RelatedFileObject, ObjectNameInfo, oniSize, &Length); if(result != STATUS_SUCCESS) { ! DbgPrint("CvsFlt!CvsGetFileName: ObQueryNameString returned %08x\n",result); return FALSE; } ObjectNameInfo->Name.MaximumLength=oniSize-sizeof(OBJECT_NAME_INFORMATION); *************** *** 7261,7267 **** result = ObQueryNameString(irpSp->FileObject->DeviceObject, ObjectNameInfo, oniSize, &Length); if(result != STATUS_SUCCESS) { ! DbgPrint("CvsFlt!CvsIsPosixFileName: ObQueryNameString returned %08x\n",result); return FALSE; } ObjectNameInfo->Name.MaximumLength=oniSize-sizeof(OBJECT_NAME_INFORMATION); --- 7274,7280 ---- result = ObQueryNameString(irpSp->FileObject->DeviceObject, ObjectNameInfo, oniSize, &Length); if(result != STATUS_SUCCESS) { ! DbgPrint("CvsFlt!CvsGetFileName: ObQueryNameString returned %08x\n",result); return FALSE; } ObjectNameInfo->Name.MaximumLength=oniSize-sizeof(OBJECT_NAME_INFORMATION); *************** *** 7293,7310 **** --- 7306,7394 ---- BOOLEAN CvsIsPosixFileName ( IN PIRP Irp, + IN PDEVICE_OBJECT DeviceObject, IN PUNICODE_STRING FileName ) { CVSFLT_DIRECTORY *DirBuf; KIRQL oldIrql; BOOLEAN bRet = FALSE; + PIO_ERROR_LOG_PACKET errlog_pkt; + PWSTR myname = L"expired"; + size_t mynamelen = 0, packetlen = 0; /* ULONG */ + + + LARGE_INTEGER CvsCurrentTime; + ULONG CvsElapsedSeconds = 0; UNREFERENCED_PARAMETER(Irp); /* Optimisation - we don't much care about multiprocessor here, because if we get a false negative or positive it only affects one call */ if(!gCvsDirectoryListRoot) + return FALSE; + + KeQuerySystemTime(&CvsCurrentTime); + RtlTimeToSecondsSince1970(&CvsCurrentTime,&CvsElapsedSeconds); + #ifdef CVSTRIAL_MAX + #if CVSTRIAL_MAX == 0 + if (0) + #pragma message( "Compiling with no expiry date " __FILE__ ) + #else + #pragma message( "Compiling with expiry date - ie: this is a TRIAL" ) + #endif + + /* 5266800 seconds is 2 months - ie: if the current time is > 2 months since compile, then barf */ + /* 7858800 seconds is 3 months - ie: if the current time is > 3 months since compile, then barf */ + if ((gSTrialExpired==0) && (CvsElapsedSeconds>(CVSTRIAL_MAX+7858800))) + { + gSTrialExpired=1; + RtlStringCbLengthW(myname,MAX_PATH*sizeof(WCHAR),&mynamelen); /* NTSTRSAFE_MAX_CCH cannot be found, so use MAX_PATH instead */ + packetlen = mynamelen + sizeof(WCHAR) + sizeof(IO_ERROR_LOG_PACKET) + sizeof(ULONG); // sizeof(ULONG)=4? + + if (packetlen > ERROR_LOG_MAXIMUM_SIZE) + return FALSE; + + errlog_pkt = (PIO_ERROR_LOG_PACKET) IoAllocateErrorLogEntry(DeviceObject, (UCHAR) packetlen); + + if (!errlog_pkt) + return FALSE; + + RtlZeroMemory( errlog_pkt, sizeof( IO_ERROR_LOG_PACKET ) ); + + // as defined in ntiologc.h (C:\WinDDK\5112\inc\api\ntiologc.h) + // or maybe defined in cvsflt_msg.h + // + // STATUS_SEVERITY_INFORMATIONAL (or maybe STATUS_SEVERITY_ERROR or even STATUS_SEVERITY_WARNING) + // FACILITY_IO_ERROR_CODE (ie: not RPC - remote procedure call, and not MCA - machine check + // IO_ERR_CONFIGURATION_ERROR (Driver or device is incorrectly configured for %1.) + // + + errlog_pkt->ErrorCode = CVSFLT_MSG_STRING; + errlog_pkt->DumpDataSize = sizeof(ULONG); // 4? + errlog_pkt->DumpData[0] = (ULONG)1; + errlog_pkt->StringOffset = sizeof(IO_ERROR_LOG_PACKET) + errlog_pkt->DumpDataSize; + errlog_pkt->NumberOfStrings = 1; + errlog_pkt->RetryCount = 0; + + // optional stuff + // errlog_pkt->MajorFunctionCode + // errlog_pkt->EventCategory + // errlog_pkt->UniqueErrorValue + // errlog_pkt->FinalStatus + // errlog_pkt->SequenceNumber + // errlog_pkt->IoControlCode + // errlog_pkt->DeviceOffset + + RtlStringCbCopyW((PWSTR) ((PUCHAR) errlog_pkt + errlog_pkt->StringOffset), mynamelen + sizeof(WCHAR), myname); + + IoWriteErrorLogEntry(errlog_pkt); + IoFreeErrorLogEntry(errlog_pkt); + CVS_LOG_PRINT(CVSDEBUG_TRACE_IOCTL,("CvsFlt!CvsIsPosixFileName: Trial License has expired\n")); + } + #endif + + if (gSTrialExpired!=0) return FALSE; try Index: cvsflt.rc =================================================================== RCS file: /scotty/cvsflt/cvsflt/cvsflt.rc,v retrieving revision 1.2 diff -c -r1.2 cvsflt.rc *** cvsflt.rc 12 Sep 2012 01:39:06 -0000 1.2 --- cvsflt.rc 12 Sep 2012 12:44:12 -0000 *************** *** 65,70 **** --- 65,71 ---- "#define PROJECTNAME ""cvsflt""\r\n" "#define PROJECTFILENAME ""cvsflt.sys""\r\n" "#include ""..\\..\\build\\VersionInfoCommon.rc2""\r\n" + "#include ""cvsflt_msg.rc""\r\n" "#endif\r\n" "\0" END *************** *** 84,89 **** --- 85,91 ---- #define PROJECTNAME "cvsflt" #define PROJECTFILENAME "cvsflt.sys" #include "..\..\build\VersionInfoCommon.rc2" + #include "cvsflt_msg.rc" #endif ///////////////////////////////////////////////////////////////////////////// Index: readme.txt =================================================================== RCS file: /scotty/cvsflt/cvsflt/readme.txt,v retrieving revision 1.1 diff -c -r1.1 readme.txt *** readme.txt 12 Sep 2012 01:39:06 -0000 1.1 --- readme.txt 12 Sep 2012 12:42:11 -0000 *************** *** 28,39 **** windows xp ----------- ! cmd /c "C:\WinDDK\5112\bin\setenv.bat C:\WinDDK\5112 fre WXP && cd /d d:\march-hare\cvsflt\cvsflt && rd /s /q objfre_wxp_x86_vh && nmake -f makefile && exit" windows 2003 ------------- ! cmd /c "C:\WinDDK\5112\bin\setenv.bat C:\WinDDK\5112 fre wnet && cd /d d:\march-hare\cvsflt\cvsflt && rd /s /q objfre_wnet_x86_vh && nmake -f makefile && exit" PROCESS x64: --- 28,44 ---- windows xp ----------- ! with a 3 month expiry: ! cmd /c "C:\WinDDK\5112\bin\setenv.bat C:\WinDDK\5112 fre WXP && cd /d d:\march-hare\cvsflt\cvsflt && nmake -f makefile.mak && exit" ! ! or with no expiry date: ! cmd /c "C:\WinDDK\5112\bin\setenv.bat C:\WinDDK\5112 fre WXP && cd /d d:\march-hare\cvsflt\cvsflt && nmake -f makefile.mak EXPIRY_MAX=0 && exit" windows 2003 ------------- ! with a 3 month expiry: ! cmd /c "C:\WinDDK\5112\bin\setenv.bat C:\WinDDK\5112 fre wnet && cd /d d:\march-hare\cvsflt\cvsflt && nmake -f makefile.mak && exit" PROCESS x64: *************** *** 49,55 **** WARNING: x64 Native compiling isn't supported (on windows xp x64) - it'll be using cross compilers. ! cmd /c "C:\WinDDK\5112\bin\setenv.bat C:\WinDDK\5112 fre AMD64 wnet && cd /d d:\march-hare\cvsflt\cvsflt && rd /s /q objfre_wnet_AMD64_vh && nmake -f makefile && exit" ALT PROCESS: --- 54,61 ---- WARNING: x64 Native compiling isn't supported (on windows xp x64) - it'll be using cross compilers. ! with a 3 month expiry: ! cmd /c "C:\WinDDK\5112\bin\setenv.bat C:\WinDDK\5112 fre AMD64 wnet && cd /d d:\march-hare\cvsflt\cvsflt && nmake -f makefile.mak && exit" ALT PROCESS: Index: sources =================================================================== RCS file: /scotty/cvsflt/cvsflt/sources,v retrieving revision 1.3 diff -c -r1.3 sources *** sources 6 Oct 2005 00:20:07 -0000 1.3 --- sources 12 Sep 2012 11:45:24 -0000 *************** *** 1,11 **** ROOTDIR=.. TARGETNAME=cvsflt TARGETPATH=$(ROOTDIR) TARGETTYPE=DRIVER DRIVERTYPE=FS ! SOURCES=cvsflt.c \ cvsflt.rc TARGETLIBS=$(DDK_LIB_PATH)\ntstrsafe.lib --- 1,31 ---- + # CVS_VERSION_ID("@(#)$Id$") + # --------------------------------------------------------------------------- + # Copyright (c) March Hare Software Limited, England. All rights reserved. + # + # A copy of license terms and conditions may be obtained from + # March Hare Software Limited, 85-87 Bayham Street, Camden Town, London + # NW1 0AG, or by electronic mail at license@march-hare.com. + # + + !Ifndef EXPIRY_MAX + + !ERROR EXPIRY_MAX is not defined, instead use: nmake makefile.mak + + !Else + + ROOTDIR=.. TARGETNAME=cvsflt + C_DEFINES=$(C_DEFINES) /DCVSTRIAL_MAX=$(EXPIRY_MAX) TARGETPATH=$(ROOTDIR) TARGETTYPE=DRIVER DRIVERTYPE=FS ! SOURCES=cvsflt_msg.mc \ ! cvsflt.c \ cvsflt.rc TARGETLIBS=$(DDK_LIB_PATH)\ntstrsafe.lib + + !Endif