Index: cvsflt.c =================================================================== RCS file: /scotty/cvsflt/cvsflt/cvsflt.c,v retrieving revision 1.13 diff -c -r1.13 cvsflt.c *** cvsflt.c 2 Oct 2012 05:13:09 -0000 1.13 --- cvsflt.c 2 Oct 2012 06:13:56 -0000 *************** *** 6933,6941 **** { try { CVSFLT_DIRECTORY *DirBuf; CVSFLT_DIRECTORY *DirLoopTmp; - UNICODE_STRING strlooptmp; KIRQL oldIrql; size_t Len; --- 6933,6941 ---- { try { + UNICODE_STRING str1; CVSFLT_DIRECTORY *DirBuf; CVSFLT_DIRECTORY *DirLoopTmp; KIRQL oldIrql; size_t Len; *************** *** 6961,6982 **** if(Temporary) DirBuf->FileObject = FileObject; ! /* right here would be a good place to loop through the existing gCvsDirectoryListRoot */ ! /* and check for a duplicate in the list */ DirLoopTmp = gCvsDirectoryListRoot; - if(Dir) - RtlInitUnicodeString(&strlooptmp,Dir); while(DirLoopTmp) { if(((!Temporary && !DirLoopTmp->Temporary) || (Temporary && DirLoopTmp->Temporary && FileObject==DirLoopTmp->FileObject)) ! && (!Dir || !RtlCompareUnicodeString(&strlooptmp,&DirLoopTmp->Directory,TRUE))) { /* found a duplicate entry, so ignore this */ CVS_LOG_PRINT(CVSDEBUG_TRACE_ESSENTIAL,("CvsFlt!CvsAddPosixDirectory: Ignore %S\n",Dir)); return STATUS_SUCCESS; } ! else ! DirLoopTmp = DirLoopTmp->Next; } CVS_LOG_PRINT(CVSDEBUG_TRACE_ESSENTIAL,("CvsFlt!CvsAddPosixDirectory: Add %S\n",Dir)); --- 6961,6986 ---- if(Temporary) DirBuf->FileObject = FileObject; ! /* loop through the existing gCvsDirectoryListRoot and check for a duplicate in the list */ ! /* we want to find not only exact matches - but matches at a 'higher' level */ DirLoopTmp = gCvsDirectoryListRoot; while(DirLoopTmp) { + str1 = DirBuf->Directory; + if(str1.Length>DirLoopTmp->Directory.Length) + str1.Length=DirLoopTmp->Directory.Length; if(((!Temporary && !DirLoopTmp->Temporary) || (Temporary && DirLoopTmp->Temporary && FileObject==DirLoopTmp->FileObject)) ! && (!Dir || !RtlCompareUnicodeString(&str1,&DirLoopTmp->Directory,TRUE))) { /* found a duplicate entry, so ignore this */ CVS_LOG_PRINT(CVSDEBUG_TRACE_ESSENTIAL,("CvsFlt!CvsAddPosixDirectory: Ignore %S\n",Dir)); + if(DirBuf->Directory.Length>DirLoopTmp->Directory.Length) + CVS_EVENT_LOG(CVSDEBUG_TRACE_MOREEVENTS,CVSFLT_NOADDPOSIXSUB,DirBuf->wsz); + else + CVS_EVENT_LOG(CVSDEBUG_TRACE_MOREEVENTS,CVSFLT_NOADDPOSIX,DirBuf->wsz); return STATUS_SUCCESS; } ! DirLoopTmp = DirLoopTmp->Next; } CVS_LOG_PRINT(CVSDEBUG_TRACE_ESSENTIAL,("CvsFlt!CvsAddPosixDirectory: Add %S\n",Dir)); *************** *** 7281,7286 **** --- 7285,7292 ---- if(Info->Name.Length>NameOutSize) Info->Name.Length=(USHORT)NameOutSize; RtlZeroMemory( NameOut, NameOutSize ); + // if you get a compile error here with error C4013: 'RtlStringCbCopyUnicodeString' undefined; + // then it means that your DDK is too old - try using the Windows XP/VISTA/7 DDK: 7600.16385.1 RtlStringCbCopyUnicodeString( NameOut, NameOutSize, &Info->Name ); //memcpy(NameOut,Info->Name.Buffer,Info->Name.Length); *NameOutLen=Info->Name.Length; *************** *** 7519,7526 **** /* a little debugging test - see if the final 5 characters are the same this is a bit like an in built debugging filter - it helps - trust me */ ! if((FlagOn(SfDebug,(CVSDEBUG_TRACE_TAILPOSIX))&&(str1.Length>(sizeof(WCHAR)*29))&&(DirBuf->Directory.Length>(sizeof(WCHAR)*29))&&(str1.Length>=DirBuf->Directory.Length)) { bTailMatch=TRUE; dirptr = DirBuf->Directory.Buffer + ( DirBuf->Directory.Length - (sizeof(WCHAR)*6) ); str1ptr = str1.Buffer + ( DirBuf->Directory.Length - (sizeof(WCHAR)*6) ); --- 7525,7534 ---- /* a little debugging test - see if the final 5 characters are the same this is a bit like an in built debugging filter - it helps - trust me */ ! if(FlagOn(SfDebug,(CVSDEBUG_TRACE_TAILPOSIX))) { + if((str1.Length>(sizeof(WCHAR)*29))&&(DirBuf->Directory.Length>(sizeof(WCHAR)*29))&&(str1.Length>=DirBuf->Directory.Length)) + { bTailMatch=TRUE; dirptr = DirBuf->Directory.Buffer + ( DirBuf->Directory.Length - (sizeof(WCHAR)*6) ); str1ptr = str1.Buffer + ( DirBuf->Directory.Length - (sizeof(WCHAR)*6) ); *************** *** 7534,7539 **** --- 7542,7548 ---- bTailMatch=FALSE; kk+=sizeof(WCHAR); } + } } if(str1.Length>DirBuf->Directory.Length) str1.Length=DirBuf->Directory.Length; Index: cvsflt_msg.mc =================================================================== RCS file: /scotty/cvsflt/cvsflt/cvsflt_msg.mc,v retrieving revision 1.4 diff -c -r1.4 cvsflt_msg.mc *** cvsflt_msg.mc 26 Sep 2012 07:32:08 -0000 1.4 --- cvsflt_msg.mc 2 Oct 2012 05:19:43 -0000 *************** *** 103,105 **** --- 103,122 ---- Language=English unload driver %2 OK. . + + MessageId=0xb + SymbolicName=CVSFLT_NOADDPOSIX + Severity=Informational + Facility=IO_ERROR + Language=English + not adding duplicate directory %2 OK. + . + + MessageId=0xc + SymbolicName=CVSFLT_NOADDPOSIXSUB + Severity=Informational + Facility=IO_ERROR + Language=English + not adding duplicate sub-directory %2 OK. + . +