ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
October 2009
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
26 participants
641 discussions
Start a n
N
ew thread
[gschneider] 43347: - Various resource fixes (unclosed files, unchecked memory allocations, missing destructor, not freed memory) - Patch by Russell with some modifications by myself See issue #4662 for more details.
by gschneider@svn.reactos.org
Author: gschneider Date: Fri Oct 9 23:02:44 2009 New Revision: 43347 URL:
http://svn.reactos.org/svn/reactos?rev=43347&view=rev
Log: - Various resource fixes (unclosed files, unchecked memory allocations, missing destructor, not freed memory) - Patch by Russell with some modifications by myself See issue #4662 for more details. Modified: trunk/reactos/base/applications/downloader/xml.c trunk/reactos/base/services/dhcp/memory.c trunk/reactos/boot/freeldr/tools/deptool.c trunk/reactos/tools/buildno/buildno.cpp trunk/reactos/tools/cdmake/cdmake.c trunk/reactos/tools/mkconfig.c trunk/reactos/tools/rbuild/rbuild.h trunk/reactos/tools/stubgen.c Modified: trunk/reactos/base/applications/downloader/xml.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/download…
============================================================================== --- trunk/reactos/base/applications/downloader/xml.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/downloader/xml.c [iso-8859-1] Fri Oct 9 23:02:44 2009 @@ -203,6 +203,7 @@ if(!XML_Parse(parser, buffer, len, done)) { MessageBoxW(0,Strings[IDS_XMLERROR_2],0,0); + fclose(file); return FALSE; } } Modified: trunk/reactos/base/services/dhcp/memory.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/dhcp/memory.…
============================================================================== --- trunk/reactos/base/services/dhcp/memory.c [iso-8859-1] (original) +++ trunk/reactos/base/services/dhcp/memory.c [iso-8859-1] Fri Oct 9 23:02:44 2009 @@ -829,7 +829,11 @@ user_class_hash = new_hash (); if (!tname || !class || !vendor_class_hash || !user_class_hash) + { + if (tname != NULL) + free(tname); return (struct class *)0; + } memset (class, 0, sizeof *class); strcpy (tname, name); Modified: trunk/reactos/boot/freeldr/tools/deptool.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/tools/deptool…
============================================================================== --- trunk/reactos/boot/freeldr/tools/deptool.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/tools/deptool.c [iso-8859-1] Fri Oct 9 23:02:44 2009 @@ -50,6 +50,10 @@ if (!DependFileData || !NewDependFileData) { printf("deptool: Out of memory!\n"); + if (DependFileData != NULL) + free(DependFileData); + if (NewDependFileData != NULL) + free(NewDependFileData); fclose(DependFile); return ERROR_OUTOFMEMORY; } @@ -61,6 +65,8 @@ if (ferror(DependFile)) { printf("deptool: Dependency file read error.\n"); + free(DependFileData); + free(NewDependFileData); fclose(DependFile); return ERROR_READERROR; } @@ -121,9 +127,13 @@ { printf("deptool: Dependency file write error.\n"); fclose(DependFile); + free(DependFileData); + free(NewDependFileData); return ERROR_WRITEERROR; } fclose(DependFile); + free(DependFileData); + free(NewDependFileData); return ERROR_SUCCESS; } Modified: trunk/reactos/tools/buildno/buildno.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/buildno/buildno.cpp?…
============================================================================== --- trunk/reactos/tools/buildno/buildno.cpp [iso-8859-1] (original) +++ trunk/reactos/tools/buildno/buildno.cpp [iso-8859-1] Fri Oct 9 23:02:44 2009 @@ -236,14 +236,22 @@ char* orig; orig = (char *) malloc(length); + if (orig == NULL) + { + fclose(h); + free(s1); + return; + } fseek(h, 0, SEEK_SET); fread(orig, 1, length, h); if (memcmp(s1, orig, length) == 0) { fclose(h); free(s1); + free(orig); return; } + free(orig); } fclose(h); } @@ -259,7 +267,7 @@ return; } fwrite(s1, 1, strlen(s1), h); - fclose (h); + fclose(h); } void Modified: trunk/reactos/tools/cdmake/cdmake.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/cdmake/cdmake.c?rev=…
============================================================================== --- trunk/reactos/tools/cdmake/cdmake.c [iso-8859-1] (original) +++ trunk/reactos/tools/cdmake/cdmake.c [iso-8859-1] Fri Oct 9 23:02:44 2009 @@ -1259,7 +1259,10 @@ size = ftell(file); fseek(file, 0, SEEK_SET); if (size == 0 || (size % 2048)) + { + fclose(file); error_exit("Invalid boot image size (%lu bytes)\n", size); + } boot_image_size = size / 512; while (size > 0) { Modified: trunk/reactos/tools/mkconfig.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/mkconfig.c?rev=43347…
============================================================================== --- trunk/reactos/tools/mkconfig.c [iso-8859-1] (original) +++ trunk/reactos/tools/mkconfig.c [iso-8859-1] Fri Oct 9 23:02:44 2009 @@ -44,15 +44,18 @@ { fprintf(stderr, "Failed to read data\n"); fclose(out); + free(cmpbuf); return(1); } if (end == strlen(outbuf) && memcmp(cmpbuf, outbuf, end) == 0) { fclose(out); + free(cmpbuf); return(0); } fclose(out); + free(cmpbuf); out = fopen(filename, "wb"); if (out == NULL) { Modified: trunk/reactos/tools/rbuild/rbuild.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/rbuild.h?rev=…
============================================================================== --- trunk/reactos/tools/rbuild/rbuild.h [iso-8859-1] (original) +++ trunk/reactos/tools/rbuild/rbuild.h [iso-8859-1] Fri Oct 9 23:02:44 2009 @@ -455,6 +455,7 @@ void ParseToolsets ( const Project& project, const XMLElement& node ); public: + virtual ~ToolsetDirective() { } bool IsEnabled () const; }; @@ -469,6 +470,7 @@ public: CompilerDirective (): enabled ( true ) { } + virtual ~CompilerDirective() { } void SetCompiler ( CompilerType compiler ); void UnsetCompiler ( CompilerType compiler ); void SetAllCompilers (); Modified: trunk/reactos/tools/stubgen.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/stubgen.c?rev=43347&…
============================================================================== --- trunk/reactos/tools/stubgen.c [iso-8859-1] (original) +++ trunk/reactos/tools/stubgen.c [iso-8859-1] Fri Oct 9 23:02:44 2009 @@ -88,7 +88,13 @@ if( new_f ) continue; new_f = (stub *)malloc( sizeof(stub) ); - if( !new_f ) {fprintf( stderr, "Out of memory\n" ); return 1;} + if( !new_f ) + { + fprintf( stderr, "Out of memory\n" ); + fclose( out ); + pclose( make_f ); + return 1; + } new_f->name = strdup( line ); new_f->next = functions; @@ -129,7 +135,14 @@ if( new_f ) continue; new_f = (stub *)malloc( sizeof(stub) ); - if( !new_f ) {fprintf( stderr, "Out of memory\n" ); return 1;} + if( !new_f ) + { + fprintf( stderr, "Out of memory\n" ); + fclose( out ); + pclose( make_f ); + pclose( nm_f ); + return 1; + } new_f->name = strdup( import_sign + 1 ); new_f->origin = origin; @@ -137,7 +150,7 @@ imports = new_f; } - fclose( nm_f ); + pclose( nm_f ); } /* Now we have a list of unique functions and a list of imports, @@ -152,6 +165,6 @@ } fclose( out ); - + pclose( make_f ); return 0; }
15 years, 2 months
1
0
0
0
[sginsberg] 43346: - Hey, you know what? Dbg/NtQueryDebugFilterState returns TRUE/FALSE after all.
by sginsberg@svn.reactos.org
Author: sginsberg Date: Fri Oct 9 21:54:07 2009 New Revision: 43346 URL:
http://svn.reactos.org/svn/reactos?rev=43346&view=rev
Log: - Hey, you know what? Dbg/NtQueryDebugFilterState returns TRUE/FALSE after all. Modified: trunk/reactos/lib/drivers/ip/network/routines.c Modified: trunk/reactos/lib/drivers/ip/network/routines.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/network/rou…
============================================================================== --- trunk/reactos/lib/drivers/ip/network/routines.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/ip/network/routines.c [iso-8859-1] Fri Oct 9 21:54:07 2009 @@ -94,8 +94,8 @@ UINT Length; PCHAR Buffer; - if (!NT_SUCCESS(DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_PBUFFER | DPFLTR_MASK)) || - !NT_SUCCESS(DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_TCP | DPFLTR_MASK))) { + if (!(DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_PBUFFER | DPFLTR_MASK)) || + !(DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_TCP | DPFLTR_MASK))) { return; } @@ -139,8 +139,8 @@ PNDIS_BUFFER NextBuffer; PCHAR CharBuffer; - if (!NT_SUCCESS(DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_PBUFFER | DPFLTR_MASK)) || - !NT_SUCCESS(DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_IP | DPFLTR_MASK))) { + if (!(DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_PBUFFER | DPFLTR_MASK)) || + !(DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_IP | DPFLTR_MASK))) { return; }
15 years, 2 months
1
0
0
0
[gschneider] 43345: Correct MPEG1/2 video decoder filename, patch by Russell See issue #4878 for more details.
by gschneider@svn.reactos.org
Author: gschneider Date: Fri Oct 9 20:45:24 2009 New Revision: 43345 URL:
http://svn.reactos.org/svn/reactos?rev=43345&view=rev
Log: Correct MPEG1/2 video decoder filename, patch by Russell See issue #4878 for more details. Modified: trunk/reactos/boot/bootdata/system.ini Modified: trunk/reactos/boot/bootdata/system.ini URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/system.ini?r…
============================================================================== --- trunk/reactos/boot/bootdata/system.ini [iso-8859-1] (original) +++ trunk/reactos/boot/bootdata/system.ini [iso-8859-1] Fri Oct 9 20:45:24 2009 @@ -9,8 +9,8 @@ vidc.cvid=iccvid.dll [mci] -MPEGVideo=mciqtz.drv -MPEGVideo2=mciqtz.drv +MPEGVideo=mciqtz32.dll +MPEGVideo2=mciqtz32.dll AVIVideo=mciavi32.dll CDAudio=mcicda.dll Sequencer=mciseq.dll
15 years, 2 months
1
0
0
0
[janderwald] 43344: [KS] - Fix a bug when canceling irps
by janderwald@svn.reactos.org
Author: janderwald Date: Fri Oct 9 18:48:41 2009 New Revision: 43344 URL:
http://svn.reactos.org/svn/reactos?rev=43344&view=rev
Log: [KS] - Fix a bug when canceling irps Modified: trunk/reactos/drivers/ksfilter/ks/irp.c Modified: trunk/reactos/drivers/ksfilter/ks/irp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/irp.c?…
============================================================================== --- trunk/reactos/drivers/ksfilter/ks/irp.c [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/irp.c [iso-8859-1] Fri Oct 9 18:48:41 2009 @@ -1690,7 +1690,7 @@ RemoveEntryList(&Irp->Tail.Overlay.ListEntry); /* release spinlock */ - KeReleaseSpinLockFromDpcLevel(SpinLock); + KeReleaseSpinLock(SpinLock, Irp->CancelIrql); /* has the irp already been canceled */ if (Irp->IoStatus.Status != STATUS_CANCELLED)
15 years, 2 months
1
0
0
0
[fireball] 43343: [fastfat_new] - Add two names to an FCB - a short name, and a long name. - Start implementing FatSetFcbNames, currently deals with short names only. - Implement Fati8dot3ToString, with most of the code actually #if0ed, because FullFAT already does this conversion.
by fireball@svn.reactos.org
Author: fireball Date: Fri Oct 9 16:20:33 2009 New Revision: 43343 URL:
http://svn.reactos.org/svn/reactos?rev=43343&view=rev
Log: [fastfat_new] - Add two names to an FCB - a short name, and a long name. - Start implementing FatSetFcbNames, currently deals with short names only. - Implement Fati8dot3ToString, with most of the code actually #if0ed, because FullFAT already does this conversion. Modified: trunk/reactos/drivers/filesystems/fastfat_new/dir.c trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h trunk/reactos/drivers/filesystems/fastfat_new/fatstruc.h trunk/reactos/drivers/filesystems/fastfat_new/fcb.c Modified: trunk/reactos/drivers/filesystems/fastfat_new/dir.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat_new/dir.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat_new/dir.c [iso-8859-1] Fri Oct 9 16:20:33 2009 @@ -71,9 +71,9 @@ Dcb->FullFileName.Length = 1 * sizeof(WCHAR); Dcb->FullFileName.MaximumLength = 2 * sizeof(WCHAR); - Dcb->FileName.Name.Ansi.Buffer = "\\"; - Dcb->FileName.Name.Ansi.Length = 1; - Dcb->FileName.Name.Ansi.MaximumLength = 2 * sizeof(CHAR); + Dcb->ShortName.Name.Ansi.Buffer = "\\"; + Dcb->ShortName.Name.Ansi.Length = 1; + Dcb->ShortName.Name.Ansi.MaximumLength = 2 * sizeof(CHAR); /* Fill dirent attribute byte copy */ Dcb->DirentFatFlags = FILE_ATTRIBUTE_DIRECTORY; Modified: trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h [iso-8859-1] Fri Oct 9 16:20:33 2009 @@ -306,8 +306,14 @@ VOID NTAPI FatSetFcbNames(IN PFAT_IRP_CONTEXT IrpContext, + IN PUNICODE_STRING Lfn, IN PFCB Fcb); +VOID NTAPI +Fati8dot3ToString(IN PCHAR FileName, + IN BOOLEAN DownCase, + OUT POEM_STRING OutString); + /* ------------------------------------------------------------ rw.c */ NTSTATUS NTAPI Modified: trunk/reactos/drivers/filesystems/fastfat_new/fatstruc.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat_new/fatstruc.h [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat_new/fatstruc.h [iso-8859-1] Fri Oct 9 16:20:33 2009 @@ -269,10 +269,11 @@ /* Mcb mapping Vbo->Lbo */ LARGE_MCB Mcb; ULONG FirstCluster; - /* Links into FCB Trie */ - FCB_NAME_LINK FileName; + /* Links into FCB Tree */ + FCB_NAME_LINK ShortName; + FCB_NAME_LINK LongName; /* Buffer for the short name */ - WCHAR ShortNameBuffer[0xc]; + CHAR ShortNameBuffer[0xc]; /* Full file name */ UNICODE_STRING FullFileName; /* Long name with exact case */ Modified: trunk/reactos/drivers/filesystems/fastfat_new/fcb.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat_new/fcb.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat_new/fcb.c [iso-8859-1] Fri Oct 9 16:20:33 2009 @@ -150,7 +150,7 @@ Fcb->FatHandle = FileHandle; /* Set names */ - FatSetFcbNames(IrpContext, Fcb); + FatSetFcbNames(IrpContext, NULL, Fcb); return Fcb; } @@ -247,10 +247,125 @@ VOID NTAPI FatSetFcbNames(IN PFAT_IRP_CONTEXT IrpContext, + IN PUNICODE_STRING Lfn, IN PFCB Fcb) { - // Set the short name first - UNIMPLEMENTED; -} + FF_DIRENT DirEnt; + FF_ERROR Err; + POEM_STRING ShortName; + + /* Get the dir entry */ + Err = FF_GetEntry(Fcb->Vcb->Ioman, + Fcb->FatHandle->DirEntry, + Fcb->FatHandle->DirCluster, + &DirEnt); + + if (Err != FF_ERR_NONE) + { + DPRINT1("Error %d getting dirent of a file\n", Err); + return; + } + + /* Initialize short name string */ + ShortName = &Fcb->ShortName.Name.Ansi; + ShortName->Buffer = Fcb->ShortNameBuffer; + ShortName->Length = 0; + ShortName->MaximumLength = sizeof(Fcb->ShortNameBuffer); + + /* Convert dirent to the proper string */ + Fati8dot3ToString(DirEnt.FileName, FALSE, ShortName); + + // Unicode name + + // Add names to the splay tree +} + +VOID +NTAPI +Fati8dot3ToString(IN PCHAR FileName, + IN BOOLEAN DownCase, + OUT POEM_STRING OutString) +{ +#if 0 + ULONG BaseLen, ExtLen; + CHAR *cString = OutString->Buffer; + ULONG i; + + /* Calc base and ext lens */ + for (BaseLen = 8; BaseLen > 0; BaseLen--) + { + if (FileName[BaseLen - 1] != ' ') break; + } + + for (ExtLen = 3; ExtLen > 0; ExtLen--) + { + if (FileName[8 + ExtLen - 1] != ' ') break; + } + + /* Process base name */ + if (BaseLen) + { + RtlCopyMemory(cString, FileName, BaseLen); + + /* Substitute the e5 thing */ + if (cString[0] == 0x05) cString[0] = 0xe5; + + /* Downcase if asked to */ + if (DownCase) + { + /* Do it manually */ + for (i = 0; i < BaseLen; i++) + { + if (cString[i] >= 'A' && + cString[i] <= 'Z') + { + /* Lowercase it */ + cString[i] += 'a' - 'A'; + } + + } + } + } + + /* Process extension */ + if (ExtLen) + { + /* Add the dot */ + cString[BaseLen] = '.'; + BaseLen++; + + /* Copy the extension */ + for (i = 0; i < ExtLen; i++) + { + cString[BaseLen + i] = FileName[8 + i]; + } + + /* Lowercase the extension if asked to */ + if (DownCase) + { + /* Do it manually */ + for (i = BaseLen; i < BaseLen + ExtLen; i++) + { + if (cString[i] >= 'A' && + cString[i] <= 'Z') + { + /* Lowercase it */ + cString[i] += 'a' - 'A'; + } + } + } + } + + /* Set the length */ + OutString->Length = BaseLen + ExtLen; +#else + RtlCopyMemory(OutString->Buffer, FileName, 11); + OutString->Length = strlen(FileName); + ASSERT(OutString->Length <= 12); +#endif + + DPRINT1("'%s', len %d\n", OutString->Buffer, OutString->Length); +} + /* EOF */
15 years, 2 months
1
0
0
0
[janderwald] 43342: [PORTLCS] - KSCATEGORY_AUDIO should be the first device category so that wdmaud can correctly assign virtual device ids
by janderwald@svn.reactos.org
Author: janderwald Date: Fri Oct 9 14:36:26 2009 New Revision: 43342 URL:
http://svn.reactos.org/svn/reactos?rev=43342&view=rev
Log: [PORTLCS] - KSCATEGORY_AUDIO should be the first device category so that wdmaud can correctly assign virtual device ids Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.cpp trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.cpp trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavepci.cpp trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavert.cpp Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_topology.cpp [iso-8859-1] Fri Oct 9 14:36:26 2009 @@ -65,12 +65,12 @@ static GUID InterfaceGuids[2] = { { + /// KS_CATEGORY_AUDIO + 0x6994AD04, 0x93EF, 0x11D0, {0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96} + }, + { /// KS_CATEGORY_TOPOLOGY 0xDDA54A40, 0x1E4C, 0x11D1, {0xA0, 0x50, 0x40, 0x57, 0x05, 0xC1, 0x00, 0x00} - }, - { - /// KS_CATEGORY_AUDIO - 0x6994AD04, 0x93EF, 0x11D0, {0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96} } }; Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavecyclic.cpp [iso-8859-1] Fri Oct 9 14:36:26 2009 @@ -60,16 +60,16 @@ static GUID InterfaceGuids[4] = { { + //KS_CATEGORY_AUDIO + 0x6994AD04, 0x93EF, 0x11D0, {0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96} + }, + { /// KSCATEGORY_RENDER 0x65E8773EL, 0x8F56, 0x11D0, {0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96} }, { /// KSCATEGORY_CAPTURE 0x65E8773DL, 0x8F56, 0x11D0, {0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96} - }, - { - //KS_CATEGORY_AUDIO - 0x6994AD04, 0x93EF, 0x11D0, {0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96} }, { ///KSCATEGORY_AUDIO_DEVICE Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavepci.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavepci.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavepci.cpp [iso-8859-1] Fri Oct 9 14:36:26 2009 @@ -65,16 +65,16 @@ static GUID InterfaceGuids[3] = { { + /// KS_CATEGORY_AUDIO + 0x6994AD04, 0x93EF, 0x11D0, {0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96} + }, + { /// KSCATEGORY_RENDER 0x65E8773EL, 0x8F56, 0x11D0, {0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96} }, { /// KSCATEGORY_CAPTURE 0x65E8773DL, 0x8F56, 0x11D0, {0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96} - }, - { - /// KS_CATEGORY_AUDIO - 0x6994AD04, 0x93EF, 0x11D0, {0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96} } }; Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavert.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavert.cpp [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/port_wavert.cpp [iso-8859-1] Fri Oct 9 14:36:26 2009 @@ -58,16 +58,16 @@ static GUID InterfaceGuids[3] = { { + /// KS_CATEGORY_AUDIO + 0x6994AD04, 0x93EF, 0x11D0, {0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96} + }, + { /// KSCATEGORY_RENDER 0x65E8773EL, 0x8F56, 0x11D0, {0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96} }, { /// KSCATEGORY_CAPTURE 0x65E8773DL, 0x8F56, 0x11D0, {0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96} - }, - { - /// KS_CATEGORY_AUDIO - 0x6994AD04, 0x93EF, 0x11D0, {0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96} } };
15 years, 2 months
1
0
0
0
[sginsberg] 43341: - Fix DbgLoadImageSymbols -- it doesn't return anything. - Fix DbgQueryDebugFilterState -- it returns NTSTATUS, not BOOLEAN! Also fix the callers that depended on this.
by sginsberg@svn.reactos.org
Author: sginsberg Date: Fri Oct 9 13:51:07 2009 New Revision: 43341 URL:
http://svn.reactos.org/svn/reactos?rev=43341&view=rev
Log: - Fix DbgLoadImageSymbols -- it doesn't return anything. - Fix DbgQueryDebugFilterState -- it returns NTSTATUS, not BOOLEAN! Also fix the callers that depended on this. Modified: trunk/reactos/include/ddk/winddk.h trunk/reactos/include/ndk/rtlfuncs.h trunk/reactos/lib/drivers/ip/network/routines.c trunk/reactos/lib/rtl/debug.c Modified: trunk/reactos/include/ddk/winddk.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/winddk.h?rev=4…
============================================================================== --- trunk/reactos/include/ddk/winddk.h [iso-8859-1] (original) +++ trunk/reactos/include/ddk/winddk.h [iso-8859-1] Fri Oct 9 13:51:07 2009 @@ -10317,8 +10317,16 @@ IN PCH Format, IN ...); -NTKERNELAPI -BOOLEAN +ULONG +NTAPI +DbgPrompt( + IN PCCH Prompt, + OUT PCH Response, + IN ULONG MaximumResponseLength +); + +NTKERNELAPI +NTSTATUS NTAPI DbgQueryDebugFilterState( IN ULONG ComponentId, Modified: trunk/reactos/include/ndk/rtlfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/rtlfuncs.h?rev…
============================================================================== --- trunk/reactos/include/ndk/rtlfuncs.h [iso-8859-1] (original) +++ trunk/reactos/include/ndk/rtlfuncs.h [iso-8859-1] Fri Oct 9 13:51:07 2009 @@ -2666,7 +2666,7 @@ VOID ); -NTSTATUS +VOID NTAPI DbgLoadImageSymbols( IN PANSI_STRING Name, Modified: trunk/reactos/lib/drivers/ip/network/routines.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/network/rou…
============================================================================== --- trunk/reactos/lib/drivers/ip/network/routines.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/ip/network/routines.c [iso-8859-1] Fri Oct 9 13:51:07 2009 @@ -94,8 +94,8 @@ UINT Length; PCHAR Buffer; - if (!DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_PBUFFER | DPFLTR_MASK) || - !DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_TCP | DPFLTR_MASK)) { + if (!NT_SUCCESS(DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_PBUFFER | DPFLTR_MASK)) || + !NT_SUCCESS(DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_TCP | DPFLTR_MASK))) { return; } @@ -139,8 +139,8 @@ PNDIS_BUFFER NextBuffer; PCHAR CharBuffer; - if (!DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_PBUFFER | DPFLTR_MASK) || - !DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_IP | DPFLTR_MASK)) { + if (!NT_SUCCESS(DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_PBUFFER | DPFLTR_MASK)) || + !NT_SUCCESS(DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_IP | DPFLTR_MASK))) { return; } Modified: trunk/reactos/lib/rtl/debug.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/debug.c?rev=43341&…
============================================================================== --- trunk/reactos/lib/rtl/debug.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/debug.c [iso-8859-1] Fri Oct 9 13:51:07 2009 @@ -317,7 +317,7 @@ /* * @implemented */ -NTSTATUS +VOID NTAPI DbgLoadImageSymbols(IN PANSI_STRING Name, IN PVOID Base, @@ -346,7 +346,6 @@ /* Load the symbols */ DebugService2(Name, &SymbolInfo, BREAKPOINT_LOAD_SYMBOLS); - return STATUS_SUCCESS; } /*
15 years, 2 months
1
0
0
0
[sginsberg] 43340: Actually define STATUS_ASSERTION_FAILURE (missed in 43291).
by sginsberg@svn.reactos.org
Author: sginsberg Date: Fri Oct 9 13:27:41 2009 New Revision: 43340 URL:
http://svn.reactos.org/svn/reactos?rev=43340&view=rev
Log: Actually define STATUS_ASSERTION_FAILURE (missed in 43291). Modified: trunk/reactos/include/ddk/ntstatus.h trunk/reactos/include/psdk/ntstatus.h Modified: trunk/reactos/include/ddk/ntstatus.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/ntstatus.h?rev…
============================================================================== --- trunk/reactos/include/ddk/ntstatus.h [iso-8859-1] (original) +++ trunk/reactos/include/ddk/ntstatus.h [iso-8859-1] Fri Oct 9 13:27:41 2009 @@ -873,6 +873,7 @@ #define STATUS_PKINIT_CLIENT_FAILURE ((NTSTATUS)0xC000038CL) #define STATUS_SMARTCARD_CERT_EXPIRED ((NTSTATUS)0xC000038DL) #define STATUS_DRIVER_FAILED_PRIOR_UNLOAD ((NTSTATUS)0xC000038EL) +#define STATUS_ASSERTION_FAILURE ((NTSTATUS)0xC0000420L) #define STATUS_CALLBACK_POP_STACK ((NTSTATUS)0xC0000423L) #define STATUS_WOW_ASSERTION ((NTSTATUS)0xC0009898L) #define RPC_NT_INVALID_STRING_BINDING ((NTSTATUS)0xC0020001L) Modified: trunk/reactos/include/psdk/ntstatus.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/ntstatus.h?re…
============================================================================== --- trunk/reactos/include/psdk/ntstatus.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/ntstatus.h [iso-8859-1] Fri Oct 9 13:27:41 2009 @@ -922,6 +922,7 @@ #define STATUS_AUTHENTICATION_FIREWALL_FAILED ((NTSTATUS)0xC0000413) #define STATUS_VDM_DISALLOWED ((NTSTATUS)0xC0000414) #define STATUS_HUNG_DISPLAY_DRIVER_THREAD ((NTSTATUS)0xC0000415) +#define STATUS_ASSERTION_FAILURE ((NTSTATUS)0xC0000420L) #define STATUS_CALLBACK_POP_STACK ((NTSTATUS)0xC0000423) #define STATUS_WOW_ASSERTION ((NTSTATUS)0xC0009898)
15 years, 2 months
1
0
0
0
[cgutman] 43339: - Fix some typos from my last commit - Remove more hacks from iphlpapi
by cgutman@svn.reactos.org
Author: cgutman Date: Fri Oct 9 07:18:35 2009 New Revision: 43339 URL:
http://svn.reactos.org/svn/reactos?rev=43339&view=rev
Log: - Fix some typos from my last commit - Remove more hacks from iphlpapi Modified: trunk/reactos/dll/win32/iphlpapi/ipstats_reactos.c trunk/reactos/dll/win32/iphlpapi/route_reactos.c trunk/reactos/drivers/network/tcpip/include/info.h trunk/reactos/drivers/network/tcpip/include/router.h trunk/reactos/drivers/network/tcpip/tcpip/info.c trunk/reactos/drivers/network/tcpip/tcpip/ninfo.c trunk/reactos/lib/drivers/ip/network/router.c Modified: trunk/reactos/dll/win32/iphlpapi/ipstats_reactos.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/iphlpapi/ipstats…
============================================================================== --- trunk/reactos/dll/win32/iphlpapi/ipstats_reactos.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/iphlpapi/ipstats_reactos.c [iso-8859-1] Fri Oct 9 07:18:35 2009 @@ -423,7 +423,6 @@ { RouteTable *out_route_table; DWORD numRoutes = getNumRoutes(), routesAdded = 0; - IPSNMPInfo snmpInfo; TDIEntityID ent; HANDLE tcpFile; NTSTATUS status = openTcpFile( &tcpFile ); @@ -444,31 +443,28 @@ out_route_table->numRoutes = numRoutes; - for( i = 0; routesAdded < numRoutes; i++ ) { + for( i = 0; routesAdded < out_route_table->numRoutes; i++ ) { int j; IPRouteEntry *route_set; getNthIpEntity( tcpFile, i, &ent ); - tdiGetMibForIpEntity( tcpFile, &ent, &snmpInfo ); - - TRACE( "%d routes in instance %d\n", snmpInfo.ipsi_numroutes, i ); tdiGetRoutesForIpEntity( tcpFile, &ent, &route_set, &numRoutes ); - + if( !route_set ) { closeTcpFile( tcpFile ); HeapFree( GetProcessHeap(), 0, out_route_table ); return 0; } - TRACE("Route set returned\n"); + TRACE( "%d routes in instance %d\n", numRoutes, i ); #if 0 HexDump( route_set, sizeof( IPRouteEntry ) * snmpInfo.ipsi_numroutes ); #endif - for( j = 0; j < snmpInfo.ipsi_numroutes; j++ ) { + for( j = 0; j < numRoutes; j++ ) { int routeNum = j + routesAdded; out_route_table->routes[routeNum].dest = route_set[j].ire_dest; @@ -484,7 +480,7 @@ if( route_set ) tdiFreeThingSet( route_set ); - routesAdded += snmpInfo.ipsi_numroutes; + routesAdded += numRoutes; } closeTcpFile( tcpFile ); Modified: trunk/reactos/dll/win32/iphlpapi/route_reactos.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/iphlpapi/route_r…
============================================================================== --- trunk/reactos/dll/win32/iphlpapi/route_reactos.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/iphlpapi/route_reactos.c [iso-8859-1] Fri Oct 9 07:18:35 2009 @@ -64,14 +64,14 @@ TRACE("Called.\n"); if( NT_SUCCESS(status) ) { - status = getNthIpEntity( tcpFile, 0, &id ); + status = getNthIpEntity( tcpFile, pRoute->dwForwardIfIndex, &id ); if( NT_SUCCESS(status) ) { req.Req.ID.toi_class = INFO_CLASS_PROTOCOL; req.Req.ID.toi_type = INFO_TYPE_PROVIDER; req.Req.ID.toi_id = IP_MIB_ARPTABLE_ENTRY_ID; req.Req.ID.toi_entity.tei_instance = id.tei_instance; - req.Req.ID.toi_entity.tei_instance = CL_NL_ENTITY; + req.Req.ID.toi_entity.tei_entity = CL_NL_ENTITY; req.Req.BufferSize = sizeof(*rte); rte = (IPRouteEntry *)&req.Req.Buffer[0]; @@ -129,7 +129,7 @@ TRACE("Called.\n"); if( NT_SUCCESS(status) ) { - status = getNthIpEntity( tcpFile, 0, &id ); + status = getNthIpEntity( tcpFile, pRoute->dwForwardIfIndex, &id ); if( NT_SUCCESS(status) ) { req.Req.ID.toi_class = INFO_CLASS_PROTOCOL; Modified: trunk/reactos/drivers/network/tcpip/include/info.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/incl…
============================================================================== --- trunk/reactos/drivers/network/tcpip/include/info.h [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/include/info.h [iso-8859-1] Fri Oct 9 07:18:35 2009 @@ -152,13 +152,15 @@ PUINT BufferSize); TDI_STATUS InfoTdiQueryGetIPSnmpInfo( TDIEntityID ID, + PIP_INTERFACE IF, PNDIS_BUFFER Buffer, PUINT BufferSize ); -TDI_STATUS InfoTdiQueryGetRouteTable( PNDIS_BUFFER Buffer, +TDI_STATUS InfoTdiQueryGetRouteTable( PIP_INTERFACE IF, + PNDIS_BUFFER Buffer, PUINT BufferSize ); -TDI_STATUS InfoTdiSetRoute(PIPROUTE_ENTRY Route); +TDI_STATUS InfoTdiSetRoute(PIP_INTERFACE IF, PIPROUTE_ENTRY Route); TDI_STATUS InfoTdiQueryGetArptableMIB(TDIEntityID ID, PIP_INTERFACE Interface, Modified: trunk/reactos/drivers/network/tcpip/include/router.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/incl…
============================================================================== --- trunk/reactos/drivers/network/tcpip/include/router.h [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/include/router.h [iso-8859-1] Fri Oct 9 07:18:35 2009 @@ -43,9 +43,9 @@ NTSTATUS RouterShutdown( VOID); -UINT CountFIBs(VOID); +UINT CountFIBs(PIP_INTERFACE IF); -UINT CopyFIBs( PFIB_ENTRY Target ); +UINT CopyFIBs( PIP_INTERFACE IF, PFIB_ENTRY Target ); #endif /* __ROUTER_H */ Modified: trunk/reactos/drivers/network/tcpip/tcpip/info.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
============================================================================== --- trunk/reactos/drivers/network/tcpip/tcpip/info.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/tcpip/info.c [iso-8859-1] Fri Oct 9 07:18:35 2009 @@ -188,7 +188,10 @@ return TDI_INVALID_PARAMETER; else if (ID->toi_entity.tei_entity == CL_NL_ENTITY || ID->toi_entity.tei_entity == CO_NL_ENTITY) - return InfoTdiQueryGetIPSnmpInfo(ID->toi_entity, Buffer, BufferSize); + if ((EntityListContext = GetContext(ID->toi_entity))) + return InfoTdiQueryGetIPSnmpInfo(ID->toi_entity, EntityListContext, Buffer, BufferSize); + else + return TDI_INVALID_PARAMETER; else return TDI_INVALID_PARAMETER; @@ -214,7 +217,10 @@ return TDI_INVALID_PARAMETER; else if (ID->toi_entity.tei_entity == CO_NL_ENTITY || ID->toi_entity.tei_entity == CL_NL_ENTITY) - return InfoTdiQueryGetRouteTable(Buffer, BufferSize); + if ((EntityListContext = GetContext(ID->toi_entity))) + return InfoTdiQueryGetRouteTable(EntityListContext, Buffer, BufferSize); + else + return TDI_INVALID_PARAMETER; else return TDI_INVALID_PARAMETER; @@ -251,20 +257,25 @@ * Status of operation */ { + PVOID EntityListContext; + switch (ID->toi_class) { case INFO_CLASS_PROTOCOL: switch (ID->toi_id) { case IP_MIB_ARPTABLE_ENTRY_ID: - if (ID->toi_id != INFO_TYPE_PROVIDER) + if (ID->toi_type != INFO_TYPE_PROVIDER) return TDI_INVALID_PARAMETER; if (ID->toi_entity.tei_entity != CL_NL_ENTITY && ID->toi_entity.tei_entity != CO_NL_ENTITY) return TDI_INVALID_PARAMETER; - return InfoTdiSetRoute((PIPROUTE_ENTRY)Buffer); + if ((EntityListContext = GetContext(ID->toi_entity))) + return InfoTdiSetRoute(EntityListContext, (PIPROUTE_ENTRY)Buffer); + else + return TDI_INVALID_PARAMETER; default: return TDI_INVALID_REQUEST; Modified: trunk/reactos/drivers/network/tcpip/tcpip/ninfo.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
============================================================================== --- trunk/reactos/drivers/network/tcpip/tcpip/ninfo.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/tcpip/ninfo.c [iso-8859-1] Fri Oct 9 07:18:35 2009 @@ -16,16 +16,17 @@ /* Get IPRouteEntry s for each of the routes in the system */ -TDI_STATUS InfoTdiQueryGetRouteTable( PNDIS_BUFFER Buffer, PUINT BufferSize ) { +TDI_STATUS InfoTdiQueryGetRouteTable( PIP_INTERFACE IF, PNDIS_BUFFER Buffer, PUINT BufferSize ) { TDI_STATUS Status; KIRQL OldIrql; - UINT RtCount = CountFIBs(); + UINT RtCount = CountFIBs(IF); UINT Size = sizeof( IPROUTE_ENTRY ) * RtCount; PFIB_ENTRY RCache = exAllocatePool( NonPagedPool, sizeof( FIB_ENTRY ) * RtCount ), RCacheCur = RCache; PIPROUTE_ENTRY RouteEntries = exAllocatePool( NonPagedPool, Size ), RtCurrent = RouteEntries; + UINT i; TI_DbgPrint(DEBUG_INFO, ("Called, routes = %d, RCache = %08x\n", RtCount, RCache)); @@ -38,7 +39,7 @@ RtlZeroMemory( RouteEntries, Size ); - RtCount = CopyFIBs( RCache ); + RtCount = CopyFIBs( IF, RCache ); while( RtCurrent < RouteEntries + RtCount ) { ASSERT(RCacheCur->Router); @@ -66,13 +67,15 @@ RtCurrent->Metric1 )); TcpipAcquireSpinLock(&EntityListLock, &OldIrql); - for( RtCurrent->Index = EntityCount; - RtCurrent->Index > 0 && - RCacheCur->Router->Interface != - EntityList[RtCurrent->Index - 1].context; - RtCurrent->Index-- ); - - RtCurrent->Index = EntityList[RtCurrent->Index - 1].tei_instance; + for (i = 0; i < EntityCount; i++) + if (EntityList[i].context == IF) + break; + + if (i < EntityCount) + RtCurrent->Index = EntityList[i].tei_instance; + else + RtCurrent->Index = 0; + TcpipReleaseSpinLock(&EntityListLock, OldIrql); RtCurrent++; RCacheCur++; @@ -146,11 +149,12 @@ } TDI_STATUS InfoTdiQueryGetIPSnmpInfo( TDIEntityID ID, + PIP_INTERFACE IF, PNDIS_BUFFER Buffer, PUINT BufferSize ) { IPSNMP_INFO SnmpInfo; UINT IfCount = CountInterfaces(); - UINT RouteCount = CountFIBs(); + UINT RouteCount = CountFIBs(IF); TDI_STATUS Status = TDI_INVALID_REQUEST; TI_DbgPrint(DEBUG_INFO, ("Called.\n")); @@ -169,10 +173,9 @@ return Status; } -TDI_STATUS InfoTdiSetRoute(PIPROUTE_ENTRY Route) +TDI_STATUS InfoTdiSetRoute(PIP_INTERFACE IF, PIPROUTE_ENTRY Route) { IP_ADDRESS Address, Netmask, Router; - PNEIGHBOR_CACHE_ENTRY NCE; AddrInitIPv4( &Address, Route->Dest ); AddrInitIPv4( &Netmask, Route->Mask ); @@ -180,13 +183,8 @@ if( Route->Type == IP_ROUTE_TYPE_ADD ) { /* Add the route */ TI_DbgPrint(DEBUG_INFO,("Adding route (%s)\n", A2S(&Address))); - /* Find the existing route this belongs to */ - NCE = RouterGetRoute( &Router ); - if (!NCE) return TDI_INVALID_PARAMETER; - - /* Really add the route */ if (!RouterCreateRoute( &Address, &Netmask, &Router, - NCE->Interface, Route->Metric1)) + IF, Route->Metric1)) return TDI_NO_RESOURCES; return TDI_SUCCESS; Modified: trunk/reactos/lib/drivers/ip/network/router.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/network/rou…
============================================================================== --- trunk/reactos/lib/drivers/ip/network/router.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/ip/network/router.c [iso-8859-1] Fri Oct 9 07:18:35 2009 @@ -99,37 +99,41 @@ } -UINT CountFIBs() { +UINT CountFIBs(PIP_INTERFACE IF) { UINT FibCount = 0; PLIST_ENTRY CurrentEntry; PLIST_ENTRY NextEntry; - - /* Search the list and remove every FIB entry we find */ - CurrentEntry = FIBListHead.Flink; - while (CurrentEntry != &FIBListHead) { - NextEntry = CurrentEntry->Flink; + PFIB_ENTRY Current; + + CurrentEntry = FIBListHead.Flink; + while (CurrentEntry != &FIBListHead) { + NextEntry = CurrentEntry->Flink; + Current = CONTAINING_RECORD(CurrentEntry, FIB_ENTRY, ListEntry); + if (Current->Router->Interface == IF) + FibCount++; CurrentEntry = NextEntry; - FibCount++; } return FibCount; } -UINT CopyFIBs( PFIB_ENTRY Target ) { +UINT CopyFIBs( PIP_INTERFACE IF, PFIB_ENTRY Target ) { UINT FibCount = 0; PLIST_ENTRY CurrentEntry; PLIST_ENTRY NextEntry; PFIB_ENTRY Current; - /* Search the list and remove every FIB entry we find */ CurrentEntry = FIBListHead.Flink; while (CurrentEntry != &FIBListHead) { NextEntry = CurrentEntry->Flink; Current = CONTAINING_RECORD(CurrentEntry, FIB_ENTRY, ListEntry); - Target[FibCount] = *Current; + if (Current->Router->Interface == IF) + { + Target[FibCount] = *Current; + FibCount++; + } CurrentEntry = NextEntry; - FibCount++; } return FibCount;
15 years, 2 months
1
0
0
0
[cgutman] 43338: - Rewrite IOCTL_TCP_QUERY_INFORMATION_EX/IOCTL_TCP_SET_INFORMATION_EX handling - Remove duplicate defines for the same IOCTL - Remove unneeded code - Fix a completely wrong implementation of ENTITY_TYPE_ID - Perform parameter checking - Remove several hacks in iphlpapi that worked around bugs in the previous implementation - We now support retrieving interface-specific routing tables and ARP tables
by cgutman@svn.reactos.org
Author: cgutman Date: Fri Oct 9 04:40:38 2009 New Revision: 43338 URL:
http://svn.reactos.org/svn/reactos?rev=43338&view=rev
Log: - Rewrite IOCTL_TCP_QUERY_INFORMATION_EX/IOCTL_TCP_SET_INFORMATION_EX handling - Remove duplicate defines for the same IOCTL - Remove unneeded code - Fix a completely wrong implementation of ENTITY_TYPE_ID - Perform parameter checking - Remove several hacks in iphlpapi that worked around bugs in the previous implementation - We now support retrieving interface-specific routing tables and ARP tables Modified: trunk/reactos/dll/win32/iphlpapi/ifenum_reactos.c trunk/reactos/dll/win32/iphlpapi/iphlpapi_private.h trunk/reactos/dll/win32/iphlpapi/ipstats_reactos.c trunk/reactos/dll/win32/iphlpapi/route_reactos.c trunk/reactos/drivers/network/tcpip/include/info.h trunk/reactos/drivers/network/tcpip/include/tcpip.h trunk/reactos/drivers/network/tcpip/tcpip/iinfo.c trunk/reactos/drivers/network/tcpip/tcpip/info.c trunk/reactos/drivers/network/tcpip/tcpip/main.c trunk/reactos/drivers/network/tcpip/tcpip/ninfo.c Modified: trunk/reactos/dll/win32/iphlpapi/ifenum_reactos.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/iphlpapi/ifenum_…
============================================================================== --- trunk/reactos/dll/win32/iphlpapi/ifenum_reactos.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/iphlpapi/ifenum_reactos.c [iso-8859-1] Fri Oct 9 04:40:38 2009 @@ -323,36 +323,8 @@ loop_maybe, &entryInfo ); - return NT_SUCCESS(status) && (!entryInfo.ent.if_type || - entryInfo.ent.if_type == IFENT_SOFTWARE_LOOPBACK); -} - -NTSTATUS tdiGetEntityType( HANDLE tcpFile, TDIEntityID *ent, PULONG type ) { - TCP_REQUEST_QUERY_INFORMATION_EX req = TCP_REQUEST_QUERY_INFORMATION_INIT; - NTSTATUS status = STATUS_SUCCESS; - DWORD returnSize; - - TRACE("TdiGetEntityType(tcpFile %x,entityId %x)\n", - (DWORD)tcpFile, ent->tei_instance); - - req.ID.toi_class = INFO_CLASS_GENERIC; - req.ID.toi_type = INFO_TYPE_PROVIDER; - req.ID.toi_id = ENTITY_TYPE_ID; - req.ID.toi_entity.tei_entity = ent->tei_entity; - req.ID.toi_entity.tei_instance = ent->tei_instance; - - status = DeviceIoControl( tcpFile, - IOCTL_TCP_QUERY_INFORMATION_EX, - &req, - sizeof(req), - type, - sizeof(*type), - &returnSize, - NULL ); - - TRACE("TdiGetEntityType() => %08x %08x\n", *type, status); - - return (status ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL); + return NT_SUCCESS(status) && + (entryInfo.ent.if_type == IFENT_SOFTWARE_LOOPBACK); } BOOL hasArp( HANDLE tcpFile, TDIEntityID *arp_maybe ) { @@ -374,9 +346,9 @@ sizeof(type), &returnSize, NULL ); - if( !NT_SUCCESS(status) ) return FALSE; - return type == AT_ENTITY; + + return (type & AT_ARP); } static NTSTATUS getInterfaceInfoSet( HANDLE tcpFile, @@ -386,7 +358,6 @@ TDIEntityID *entIDSet = 0; NTSTATUS status = tdiGetEntityIDSet( tcpFile, &entIDSet, &numEntities ); IFInfo *infoSetInt = 0; - BOOL interfaceInfoComplete; int curInterf = 0, i; if (!NT_SUCCESS(status)) { @@ -412,8 +383,7 @@ TDIEntityID ip_ent; int j; - interfaceInfoComplete = FALSE; - status = getNthIpEntity( tcpFile, 0, &ip_ent ); + status = getNthIpEntity( tcpFile, curInterf, &ip_ent ); if( NT_SUCCESS(status) ) status = tdiGetIpAddrsForIpEntity ( tcpFile, &ip_ent, &addrs, &numAddrs ); Modified: trunk/reactos/dll/win32/iphlpapi/iphlpapi_private.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/iphlpapi/iphlpap…
============================================================================== --- trunk/reactos/dll/win32/iphlpapi/iphlpapi_private.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/iphlpapi/iphlpapi_private.h [iso-8859-1] Fri Oct 9 04:40:38 2009 @@ -59,8 +59,6 @@ #define TCP_REQUEST_QUERY_INFORMATION_INIT { { { 0 } } } #define TCP_REQUEST_SET_INFORMATION_INIT { { 0 } } - -#define IP_MIB_ROUTETABLE_ENTRY_ID 0x101 // As in the mib from RFC 1213 Modified: trunk/reactos/dll/win32/iphlpapi/ipstats_reactos.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/iphlpapi/ipstats…
============================================================================== --- trunk/reactos/dll/win32/iphlpapi/ipstats_reactos.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/iphlpapi/ipstats_reactos.c [iso-8859-1] Fri Oct 9 04:40:38 2009 @@ -62,30 +62,8 @@ #endif BOOL isIpEntity( HANDLE tcpFile, TDIEntityID *ent ) { - DWORD entityType, returnedLen; - NTSTATUS status; - TCP_REQUEST_QUERY_INFORMATION_EX req; - - req.ID.toi_class = INFO_CLASS_GENERIC; - req.ID.toi_type = INFO_TYPE_PROVIDER; - req.ID.toi_id = ENTITY_TYPE_ID; - req.ID.toi_entity = *ent; - - status = - DeviceIoControl - ( tcpFile, - IOCTL_TCP_QUERY_INFORMATION_EX, - &req, - sizeof(req), - &entityType, - sizeof(entityType), - &returnedLen, - NULL ); - - TRACE("Ent: %04x:d -> %04x\n", - ent->tei_entity, ent->tei_instance, entityType ); - - return NT_SUCCESS(status) && entityType == CL_NL_IP; + return (ent->tei_entity == CL_NL_ENTITY || + ent->tei_entity == CO_NL_ENTITY); } NTSTATUS getNthIpEntity( HANDLE tcpFile, DWORD index, TDIEntityID *ent ) { @@ -182,9 +160,9 @@ status = tdiGetSetOfThings( tcpFile, INFO_CLASS_PROTOCOL, INFO_TYPE_PROVIDER, - IP_MIB_ROUTETABLE_ENTRY_ID, - ent->tei_entity, - 0, + IP_MIB_ARPTABLE_ENTRY_ID, + CL_NL_ENTITY, + ent->tei_instance, 0, sizeof(IPRouteEntry), (PVOID *)routes, @@ -204,8 +182,8 @@ INFO_CLASS_PROTOCOL, INFO_TYPE_PROVIDER, IP_MIB_ADDRTABLE_ENTRY_ID, - ent->tei_entity, - 0, + CL_NL_ENTITY, + ent->tei_instance, 0, sizeof(IPAddrEntry), (PVOID *)addrs, Modified: trunk/reactos/dll/win32/iphlpapi/route_reactos.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/iphlpapi/route_r…
============================================================================== --- trunk/reactos/dll/win32/iphlpapi/route_reactos.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/iphlpapi/route_reactos.c [iso-8859-1] Fri Oct 9 04:40:38 2009 @@ -69,8 +69,9 @@ if( NT_SUCCESS(status) ) { req.Req.ID.toi_class = INFO_CLASS_PROTOCOL; req.Req.ID.toi_type = INFO_TYPE_PROVIDER; - req.Req.ID.toi_id = IP_MIB_ROUTETABLE_ENTRY_ID; - req.Req.ID.toi_entity = id; + req.Req.ID.toi_id = IP_MIB_ARPTABLE_ENTRY_ID; + req.Req.ID.toi_entity.tei_instance = id.tei_instance; + req.Req.ID.toi_entity.tei_instance = CL_NL_ENTITY; req.Req.BufferSize = sizeof(*rte); rte = (IPRouteEntry *)&req.Req.Buffer[0]; @@ -133,8 +134,9 @@ if( NT_SUCCESS(status) ) { req.Req.ID.toi_class = INFO_CLASS_PROTOCOL; req.Req.ID.toi_type = INFO_TYPE_PROVIDER; - req.Req.ID.toi_id = IP_MIB_ROUTETABLE_ENTRY_ID; - req.Req.ID.toi_entity = id; + req.Req.ID.toi_id = IP_MIB_ARPTABLE_ENTRY_ID; + req.Req.ID.toi_entity.tei_instance = id.tei_instance; + req.Req.ID.toi_entity.tei_entity = CL_NL_ENTITY; req.Req.BufferSize = sizeof(*rte); rte = (IPRouteEntry *)&req.Req.Buffer[0]; Modified: trunk/reactos/drivers/network/tcpip/include/info.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/incl…
============================================================================== --- trunk/reactos/drivers/network/tcpip/include/info.h [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/include/info.h [iso-8859-1] Fri Oct 9 04:40:38 2009 @@ -6,6 +6,8 @@ */ #ifndef __INFO_H #define __INFO_H + +#include <tcpioctl.h> #define MAX_PHYSADDR_LEN 8 #define MAX_IFDESCR_LEN 256 @@ -100,23 +102,6 @@ ULONG DescrLen; } IFENTRY, *PIFENTRY; -#define IP_MIB_STATS_ID 1 -#define IF_MIB_STATS_ID 1 - -#ifndef IP_MIB_ROUTETABLE_ENTRY_ID -#define IP_MIB_ROUTETABLE_ENTRY_ID 0x101 -#endif -#ifndef IP_MIB_ADDRTABLE_ENTRY_ID -#define IP_MIB_ADDRTABLE_ENTRY_ID 0x102 -#endif -#ifndef IP_MIB_ARPTABLE_ENTRY_ID -#define IP_MIB_ARPTABLE_ENTRY_ID 0x101 -#endif -#ifndef MAX_PHYSADDR_SIZE -#define MAX_PHYSADDR_SIZE 8 -#endif - - /* Only UDP is supported */ #define TDI_SERVICE_FLAGS (TDI_SERVICE_CONNECTIONLESS_MODE | \ TDI_SERVICE_BROADCAST_SUPPORTED) @@ -157,54 +142,28 @@ PVOID Buffer, UINT BufferSize); -/* Network layer info functions */ -TDI_STATUS InfoNetworkLayerTdiQueryEx( UINT InfoClass, - UINT InfoType, - UINT InfoId, - PVOID Context, - TDIEntityID *id, +TDI_STATUS InfoTdiQueryGetAddrTable(TDIEntityID ID, + PNDIS_BUFFER Buffer, + PUINT BufferSize); + +TDI_STATUS InfoTdiQueryGetInterfaceMIB(TDIEntityID ID, + PIP_INTERFACE Interface, PNDIS_BUFFER Buffer, - PUINT BufferSize ); + PUINT BufferSize); -TDI_STATUS InfoNetworkLayerTdiSetEx( UINT InfoClass, - UINT InfoType, - UINT InfoId, - PVOID Context, - TDIEntityID *id, - PCHAR Buffer, - UINT BufferSize ); +TDI_STATUS InfoTdiQueryGetIPSnmpInfo( TDIEntityID ID, + PNDIS_BUFFER Buffer, + PUINT BufferSize ); -TDI_STATUS InfoTransportLayerTdiQueryEx( UINT InfoClass, - UINT InfoType, - UINT InfoId, - PVOID Context, - TDIEntityID *id, - PNDIS_BUFFER Buffer, - PUINT BufferSize ); +TDI_STATUS InfoTdiQueryGetRouteTable( PNDIS_BUFFER Buffer, + PUINT BufferSize ); -TDI_STATUS InfoTransportLayerTdiSetEx( UINT InfoClass, - UINT InfoType, - UINT InfoId, - PVOID Context, - TDIEntityID *id, - PCHAR Buffer, - UINT BufferSize ); +TDI_STATUS InfoTdiSetRoute(PIPROUTE_ENTRY Route); -TDI_STATUS InfoInterfaceTdiQueryEx( UINT InfoClass, - UINT InfoType, - UINT InfoId, - PVOID Context, - TDIEntityID *id, - PNDIS_BUFFER Buffer, - PUINT BufferSize ); - -TDI_STATUS InfoInterfaceTdiSetEx( UINT InfoClass, - UINT InfoType, - UINT InfoId, - PVOID Context, - TDIEntityID *id, - PCHAR Buffer, - UINT BufferSize ); +TDI_STATUS InfoTdiQueryGetArptableMIB(TDIEntityID ID, + PIP_INTERFACE Interface, + PNDIS_BUFFER Buffer, + PUINT BufferSize); /* Insert and remove interface entities */ VOID InsertTDIInterfaceEntity( PIP_INTERFACE Interface ); Modified: trunk/reactos/drivers/network/tcpip/include/tcpip.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/incl…
============================================================================== --- trunk/reactos/drivers/network/tcpip/include/tcpip.h [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/include/tcpip.h [iso-8859-1] Fri Oct 9 04:40:38 2009 @@ -149,29 +149,12 @@ char sa_data[14]; }; -typedef TDI_STATUS (*InfoRequest_f)( UINT InfoClass, - UINT InfoType, - UINT InfoId, - PVOID Context, - TDIEntityID *id, - PNDIS_BUFFER Buffer, - PUINT BufferSize ); - -typedef TDI_STATUS (*InfoSet_f)( UINT InfoClass, - UINT InfoType, - UINT InfoId, - PVOID Context, - TDIEntityID *id, - PCHAR Buffer, - UINT BufferSize ); - /* Sufficient information to manage the entity list */ typedef struct { UINT tei_entity; UINT tei_instance; PVOID context; - InfoRequest_f info_req; - InfoSet_f info_set; + UINT flags; } TDIEntityInfo; #ifndef htons Modified: trunk/reactos/drivers/network/tcpip/tcpip/iinfo.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
============================================================================== --- trunk/reactos/drivers/network/tcpip/tcpip/iinfo.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/tcpip/iinfo.c [iso-8859-1] Fri Oct 9 04:40:38 2009 @@ -10,21 +10,26 @@ #include "precomp.h" -TDI_STATUS InfoTdiQueryGetInterfaceMIB(TDIEntityID *ID, +TDI_STATUS InfoTdiQueryGetInterfaceMIB(TDIEntityID ID, PIP_INTERFACE Interface, PNDIS_BUFFER Buffer, PUINT BufferSize) { TDI_STATUS Status = TDI_INVALID_REQUEST; PIFENTRY OutData; - PLAN_ADAPTER IF = (PLAN_ADAPTER)Interface->Context; + PLAN_ADAPTER IF; PCHAR IFDescr; ULONG Size; UINT DescrLenMax = MAX_IFDESCR_LEN - 1; NDIS_STATUS NdisStatus; + if (!Interface) + return TDI_INVALID_PARAMETER; + + IF = (PLAN_ADAPTER)Interface->Context; + TI_DbgPrint(DEBUG_INFO, ("Getting IFEntry MIB (IF %08x LA %08x) (%04x:%d)\n", - Interface, IF, ID->tei_entity, ID->tei_instance)); + Interface, IF, ID.tei_entity, ID.tei_instance)); OutData = (PIFENTRY)exAllocatePool( NonPagedPool, @@ -91,7 +96,7 @@ Size = IFDescr - (PCHAR)OutData + 1; TI_DbgPrint(DEBUG_INFO, ("Finished IFEntry MIB (%04x:%d) size %d\n", - ID->tei_entity, ID->tei_instance, Size)); + ID.tei_entity, ID.tei_instance, Size)); Status = InfoCopyOut( (PCHAR)OutData, Size, Buffer, BufferSize ); exFreePool( OutData ); @@ -101,7 +106,7 @@ return Status; } -TDI_STATUS InfoTdiQueryGetArptableMIB(TDIEntityID *ID, +TDI_STATUS InfoTdiQueryGetArptableMIB(TDIEntityID ID, PIP_INTERFACE Interface, PNDIS_BUFFER Buffer, PUINT BufferSize) { @@ -122,58 +127,106 @@ return Status; } -TDI_STATUS InfoTdiQueryGetArpCapability(TDIEntityID *ID, - PIP_INTERFACE Interface, - PNDIS_BUFFER Buffer, - PUINT BufferSize) { - NTSTATUS Status; - ULONG Capability = 0x280; - - TI_DbgPrint(MID_TRACE,("Copying out %d bytes (AT_ENTITY capability)\n", - sizeof(Capability))); - Status = InfoCopyOut - ( (PVOID)&Capability, sizeof(Capability), Buffer, BufferSize ); - - return Status; -} - -TDI_STATUS InfoInterfaceTdiQueryEx( UINT InfoClass, - UINT InfoType, - UINT InfoId, - PVOID Context, - TDIEntityID *id, - PNDIS_BUFFER Buffer, - PUINT BufferSize ) { - if( InfoClass == INFO_CLASS_GENERIC && - InfoType == INFO_TYPE_PROVIDER && - InfoId == ENTITY_TYPE_ID && - id->tei_entity == AT_ENTITY ) { - return InfoTdiQueryGetArpCapability( id, Context, Buffer, BufferSize ); - } else if( InfoClass == INFO_CLASS_PROTOCOL && - InfoType == INFO_TYPE_PROVIDER && - InfoId == IF_MIB_STATS_ID ) { - return InfoTdiQueryGetInterfaceMIB( id, Context, Buffer, BufferSize ); - } else if( InfoClass == INFO_CLASS_GENERIC && - InfoType == INFO_TYPE_PROVIDER && - InfoId == ENTITY_TYPE_ID ) { - ULONG Temp = IF_MIB; - return InfoCopyOut( (PCHAR)&Temp, sizeof(Temp), Buffer, BufferSize ); - } else if( InfoClass == INFO_CLASS_PROTOCOL && - InfoType == INFO_TYPE_PROVIDER && - InfoId == IP_MIB_ARPTABLE_ENTRY_ID ) { - return InfoTdiQueryGetArptableMIB( id, Context, Buffer, BufferSize ); - } else - return TDI_INVALID_REQUEST; -} - -TDI_STATUS InfoInterfaceTdiSetEx( UINT InfoClass, - UINT InfoType, - UINT InfoId, - PVOID Context, - TDIEntityID *id, - PCHAR Buffer, - UINT BufferSize ) { - TI_DbgPrint(DEBUG_INFO, ("Got Request: Class %x Type %x Id %x, EntityID %x:%x\n", - InfoClass, InfoId, id->tei_entity, id->tei_instance)); - return TDI_INVALID_REQUEST; -} +VOID InsertTDIInterfaceEntity( PIP_INTERFACE Interface ) { + KIRQL OldIrql; + UINT IFCount = 0, CLNLCount = 0, CLTLCount = 0, COTLCount = 0, ATCount = 0, ERCount = 0, i; + + TI_DbgPrint(DEBUG_INFO, + ("Inserting interface %08x (%d entities already)\n", + Interface, EntityCount)); + + TcpipAcquireSpinLock( &EntityListLock, &OldIrql ); + + /* Count IP Entities */ + for( i = 0; i < EntityCount; i++ ) + switch( EntityList[i].tei_entity ) + { + case IF_ENTITY: + IFCount++; + break; + + case CL_NL_ENTITY: + CLNLCount++; + break; + + case CL_TL_ENTITY: + CLTLCount++; + break; + + case CO_TL_ENTITY: + COTLCount++; + break; + + case AT_ENTITY: + ATCount++; + break; + + case ER_ENTITY: + ERCount++; + break; + + default: + break; + } + + EntityList[EntityCount].tei_entity = IF_ENTITY; + EntityList[EntityCount].tei_instance = IFCount; + EntityList[EntityCount].context = Interface; + EntityList[EntityCount].flags = IF_MIB; + EntityCount++; + EntityList[EntityCount].tei_entity = CL_NL_ENTITY; + EntityList[EntityCount].tei_instance = CLNLCount; + EntityList[EntityCount].context = Interface; + EntityList[EntityCount].flags = CL_NL_IP; + EntityCount++; + EntityList[EntityCount].tei_entity = CL_TL_ENTITY; + EntityList[EntityCount].tei_instance = CLTLCount; + EntityList[EntityCount].context = Interface; + EntityList[EntityCount].flags = CL_TL_UDP; + EntityCount++; + EntityList[EntityCount].tei_entity = CO_TL_ENTITY; + EntityList[EntityCount].tei_instance = COTLCount; + EntityList[EntityCount].context = Interface; + EntityList[EntityCount].flags = CO_TL_TCP; + EntityCount++; + EntityList[EntityCount].tei_entity = ER_ENTITY; + EntityList[EntityCount].tei_instance = ERCount; + EntityList[EntityCount].context = Interface; + EntityList[EntityCount].flags = ER_ICMP; + EntityCount++; + EntityList[EntityCount].tei_entity = AT_ENTITY; + EntityList[EntityCount].tei_instance = ATCount; + EntityList[EntityCount].context = Interface; + EntityList[EntityCount].flags = AT_ARP; + EntityCount++; + + TcpipReleaseSpinLock( &EntityListLock, OldIrql ); +} + +VOID RemoveTDIInterfaceEntity( PIP_INTERFACE Interface ) { + KIRQL OldIrql; + UINT i; + + TI_DbgPrint(DEBUG_INFO,("Removing TDI entry 0x%x\n", Interface)); + + TcpipAcquireSpinLock( &EntityListLock, &OldIrql ); + + /* Remove entities that have this interface as context + * In the future, this might include AT_ENTITY types, too + */ + for( i = 0; i < EntityCount; i++ ) { + TI_DbgPrint(DEBUG_INFO,("--> examining TDI entry 0x%x\n", EntityList[i].context)); + if( EntityList[i].context == Interface ) { + if( i != EntityCount-1 ) { + memcpy( &EntityList[i], + &EntityList[--EntityCount], + sizeof(EntityList[i]) ); + } else { + EntityCount--; + } + } + } + + TcpipReleaseSpinLock( &EntityListLock, OldIrql ); +} + Modified: trunk/reactos/drivers/network/tcpip/tcpip/info.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
============================================================================== --- trunk/reactos/drivers/network/tcpip/tcpip/info.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/tcpip/info.c [iso-8859-1] Fri Oct 9 04:40:38 2009 @@ -12,6 +12,35 @@ #include <debug.h> #include <route.h> +PVOID GetContext(TDIEntityID ID) +{ + UINT i; + KIRQL OldIrql; + PVOID Context; + + TcpipAcquireSpinLock(&EntityListLock, &OldIrql); + + for (i = 0; i < EntityCount; i++) + { + if (EntityList[i].tei_entity == ID.tei_entity && + EntityList[i].tei_instance == ID.tei_instance) + break; + } + + if (i == EntityCount) + { + TcpipReleaseSpinLock(&EntityListLock, OldIrql); + DbgPrint("WARNING: Unable to get context for %d %d\n", ID.tei_entity, ID.tei_instance); + return NULL; + } + + Context = EntityList[i].context; + + TcpipReleaseSpinLock(&EntityListLock, OldIrql); + + return Context; +} + TDI_STATUS InfoCopyOut( PCHAR DataOut, UINT SizeOut, PNDIS_BUFFER ClientBuf, PUINT ClientBufSize ) { UINT RememberedCBSize = *ClientBufSize; @@ -27,60 +56,38 @@ } } -VOID InsertTDIInterfaceEntity( PIP_INTERFACE Interface ) { +TDI_STATUS InfoTdiQueryEntityType(TDIEntityID ID, + PNDIS_BUFFER Buffer, + PUINT BufferSize) +{ KIRQL OldIrql; - UINT Count = 0, i; - - TI_DbgPrint(DEBUG_INFO, - ("Inserting interface %08x (%d entities already)\n", - Interface, EntityCount)); - - TcpipAcquireSpinLock( &EntityListLock, &OldIrql ); - - /* Count IP Entities */ - for( i = 0; i < EntityCount; i++ ) - if( EntityList[i].tei_entity == IF_ENTITY ) { - Count++; - TI_DbgPrint(DEBUG_INFO, ("Entity %d is an IF. Found %d\n", - i, Count)); - } - - EntityList[EntityCount].tei_entity = IF_ENTITY; - EntityList[EntityCount].tei_instance = Count; - EntityList[EntityCount].context = Interface; - EntityList[EntityCount].info_req = InfoInterfaceTdiQueryEx; - EntityList[EntityCount].info_set = InfoInterfaceTdiSetEx; - - EntityCount++; - - TcpipReleaseSpinLock( &EntityListLock, OldIrql ); -} - -VOID RemoveTDIInterfaceEntity( PIP_INTERFACE Interface ) { - KIRQL OldIrql; - UINT i; - - TI_DbgPrint(DEBUG_INFO,("Removing TDI entry 0x%x\n", Interface)); - - TcpipAcquireSpinLock( &EntityListLock, &OldIrql ); - - /* Remove entities that have this interface as context - * In the future, this might include AT_ENTITY types, too - */ - for( i = 0; i < EntityCount; i++ ) { - TI_DbgPrint(DEBUG_INFO,("--> examining TDI entry 0x%x\n", EntityList[i].context)); - if( EntityList[i].context == Interface ) { - if( i != EntityCount-1 ) { - memcpy( &EntityList[i], - &EntityList[--EntityCount], - sizeof(EntityList[i]) ); - } else { - EntityCount--; - } - } - } - - TcpipReleaseSpinLock( &EntityListLock, OldIrql ); + UINT i, Flags = 0; + + TcpipAcquireSpinLock(&EntityListLock, &OldIrql); + + for (i = 0; i < EntityCount; i++) + { + if (EntityList[i].tei_entity == ID.tei_entity && + EntityList[i].tei_instance == ID.tei_instance) + break; + } + + if (i == EntityCount) + { + TcpipReleaseSpinLock(&EntityListLock, OldIrql); + return TDI_INVALID_PARAMETER; + } + + Flags = EntityList[i].flags; + + InfoCopyOut((PCHAR)&Flags, + sizeof(ULONG), + Buffer, + BufferSize); + + TcpipReleaseSpinLock(&EntityListLock, OldIrql); + + return TDI_SUCCESS; } TDI_STATUS InfoTdiQueryListEntities(PNDIS_BUFFER Buffer, @@ -139,12 +146,7 @@ * Status of operation */ { - KIRQL OldIrql; - UINT i; - PVOID context = NULL; - NTSTATUS Status = TDI_INVALID_PARAMETER; - BOOLEAN FoundEntity = FALSE; - InfoRequest_f InfoRequest = NULL; + PVOID EntityListContext; TI_DbgPrint(DEBUG_INFO, ("InfoEx Req: %x %x %x!%04x:%d\n", @@ -154,79 +156,83 @@ ID->toi_entity.tei_entity, ID->toi_entity.tei_instance)); - /* Check wether it is a query for a list of entities */ - if (ID->toi_entity.tei_entity == GENERIC_ENTITY) - { - if ((ID->toi_class != INFO_CLASS_GENERIC) || - (ID->toi_type != INFO_TYPE_PROVIDER) || - (ID->toi_id != ENTITY_LIST_ID)) { - TI_DbgPrint(DEBUG_INFO,("Invalid parameter\n")); - Status = TDI_INVALID_PARAMETER; - } else - Status = InfoTdiQueryListEntities(Buffer, BufferSize); - } else if (ID->toi_entity.tei_entity == AT_ENTITY) { - TcpipAcquireSpinLock( &EntityListLock, &OldIrql ); - - for( i = 0; i < EntityCount; i++ ) { - if( EntityList[i].tei_entity == IF_ENTITY && - EntityList[i].tei_instance == ID->toi_entity.tei_instance ) { - InfoRequest = EntityList[i].info_req; - context = EntityList[i].context; - FoundEntity = TRUE; - break; - } - } - - TcpipReleaseSpinLock( &EntityListLock, OldIrql ); - - if( FoundEntity ) { - TI_DbgPrint(DEBUG_INFO, - ("Calling AT Entity %d (%04x:%d) InfoEx (%x,%x,%x)\n", - i, ID->toi_entity.tei_entity, - ID->toi_entity.tei_instance, - ID->toi_class, ID->toi_type, ID->toi_id)); - Status = InfoRequest( ID->toi_class, - ID->toi_type, - ID->toi_id, - context, - &ID->toi_entity, - Buffer, - BufferSize ); - } - } else { - TcpipAcquireSpinLock( &EntityListLock, &OldIrql ); - - for( i = 0; i < EntityCount; i++ ) { - if( EntityList[i].tei_entity == ID->toi_entity.tei_entity && - EntityList[i].tei_instance == ID->toi_entity.tei_instance ) { - InfoRequest = EntityList[i].info_req; - context = EntityList[i].context; - FoundEntity = TRUE; - break; - } - } - - TcpipReleaseSpinLock( &EntityListLock, OldIrql ); - - if( FoundEntity ) { - TI_DbgPrint(DEBUG_INFO, - ("Calling Entity %d (%04x:%d) InfoEx (%x,%x,%x)\n", - i, ID->toi_entity.tei_entity, - ID->toi_entity.tei_instance, - ID->toi_class, ID->toi_type, ID->toi_id)); - Status = InfoRequest( ID->toi_class, - ID->toi_type, - ID->toi_id, - context, - &ID->toi_entity, - Buffer, - BufferSize ); - } - } - - TI_DbgPrint(DEBUG_INFO,("Status: %08x\n", Status)); - - return Status; + switch (ID->toi_class) + { + case INFO_CLASS_GENERIC: + switch (ID->toi_id) + { + case ENTITY_LIST_ID: + if (ID->toi_type != INFO_TYPE_PROVIDER) + return TDI_INVALID_PARAMETER; + + return InfoTdiQueryListEntities(Buffer, BufferSize); + + case ENTITY_TYPE_ID: + if (ID->toi_type != INFO_TYPE_PROVIDER) + return TDI_INVALID_PARAMETER; + + return InfoTdiQueryEntityType(ID->toi_entity, Buffer, BufferSize); + + default: + return TDI_INVALID_REQUEST; + } + + case INFO_CLASS_PROTOCOL: + switch (ID->toi_id) + { + case IF_MIB_STATS_ID: + if (ID->toi_entity.tei_entity == IF_ENTITY) + if ((EntityListContext = GetContext(ID->toi_entity))) + return InfoTdiQueryGetInterfaceMIB(ID->toi_entity, EntityListContext, Buffer, BufferSize); + else + return TDI_INVALID_PARAMETER; + else if (ID->toi_entity.tei_entity == CL_NL_ENTITY || + ID->toi_entity.tei_entity == CO_NL_ENTITY) + return InfoTdiQueryGetIPSnmpInfo(ID->toi_entity, Buffer, BufferSize); + else + return TDI_INVALID_PARAMETER; + + case IP_MIB_ADDRTABLE_ENTRY_ID: + if (ID->toi_entity.tei_entity != CL_NL_ENTITY && + ID->toi_entity.tei_entity != CO_NL_ENTITY) + return TDI_INVALID_PARAMETER; + + if (ID->toi_type != INFO_TYPE_PROVIDER) + return TDI_INVALID_PARAMETER; + + return InfoTdiQueryGetAddrTable(ID->toi_entity, Buffer, BufferSize); + + case IP_MIB_ARPTABLE_ENTRY_ID: + if (ID->toi_type != INFO_TYPE_PROVIDER) + return TDI_INVALID_PARAMETER; + + if (ID->toi_entity.tei_entity == AT_ENTITY) + if ((EntityListContext = GetContext(ID->toi_entity))) + return InfoTdiQueryGetArptableMIB(ID->toi_entity, EntityListContext, + Buffer, BufferSize); + else + return TDI_INVALID_PARAMETER; + else if (ID->toi_entity.tei_entity == CO_NL_ENTITY || + ID->toi_entity.tei_entity == CL_NL_ENTITY) + return InfoTdiQueryGetRouteTable(Buffer, BufferSize); + else + return TDI_INVALID_PARAMETER; + +#if 0 + case IP_INTFC_INFO_ID: + if (ID->toi_type != INFO_TYPE_PROVIDER) + return TDI_INVALID_PARAMETER; + + return InfoTdiQueryGetIFInfo(Context, Buffer, BufferSize); +#endif + + default: + return TDI_INVALID_REQUEST; + } + + default: + return TDI_INVALID_REQUEST; + } } TDI_STATUS InfoTdiSetInformationEx @@ -245,24 +251,26 @@ * Status of operation */ { - switch( ID->toi_class ) { - case INFO_CLASS_PROTOCOL: - switch( ID->toi_type ) { - case INFO_TYPE_PROVIDER: - switch( ID->toi_id ) { - case IP_MIB_ROUTETABLE_ENTRY_ID: - return InfoNetworkLayerTdiSetEx - ( ID->toi_class, - ID->toi_type, - ID->toi_id, - NULL, - &ID->toi_entity, - Buffer, - BufferSize ); - } - } - break; - } - - return TDI_INVALID_PARAMETER; -} + switch (ID->toi_class) + { + case INFO_CLASS_PROTOCOL: + switch (ID->toi_id) + { + case IP_MIB_ARPTABLE_ENTRY_ID: + if (ID->toi_id != INFO_TYPE_PROVIDER) + return TDI_INVALID_PARAMETER; + + if (ID->toi_entity.tei_entity != CL_NL_ENTITY && + ID->toi_entity.tei_entity != CO_NL_ENTITY) + return TDI_INVALID_PARAMETER; + + return InfoTdiSetRoute((PIPROUTE_ENTRY)Buffer); + + default: + return TDI_INVALID_REQUEST; + } + + default: + return TDI_INVALID_REQUEST; + } +} Modified: trunk/reactos/drivers/network/tcpip/tcpip/main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
============================================================================== --- trunk/reactos/drivers/network/tcpip/tcpip/main.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/tcpip/main.c [iso-8859-1] Fri Oct 9 04:40:38 2009 @@ -699,17 +699,7 @@ return STATUS_INSUFFICIENT_RESOURCES; } - EntityList[0].tei_entity = CL_NL_ENTITY; - EntityList[0].tei_instance = 0; - EntityList[0].context = 0; - EntityList[0].info_req = InfoNetworkLayerTdiQueryEx; - EntityList[0].info_set = InfoNetworkLayerTdiSetEx; - EntityList[1].tei_entity = CL_TL_ENTITY; - EntityList[1].tei_instance = 0; - EntityList[1].context = 0; - EntityList[1].info_req = InfoTransportLayerTdiQueryEx; - EntityList[1].info_set = InfoTransportLayerTdiSetEx; - EntityCount = 2; + EntityCount = 0; EntityMax = MAX_TDI_ENTITIES; /* Allocate NDIS packet descriptors */ Modified: trunk/reactos/drivers/network/tcpip/tcpip/ninfo.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
============================================================================== --- trunk/reactos/drivers/network/tcpip/tcpip/ninfo.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/tcpip/ninfo.c [iso-8859-1] Fri Oct 9 04:40:38 2009 @@ -13,57 +13,7 @@ #define IP_ROUTE_TYPE_ADD 3 #define IP_ROUTE_TYPE_DEL 2 -TDI_STATUS InfoTdiQueryGetAddrTable( PNDIS_BUFFER Buffer, - PUINT BufferSize ) { - - TDI_STATUS Status = TDI_INVALID_REQUEST; - KIRQL OldIrql; - UINT Count = 0; - UINT IfCount = CountInterfaces(); - PIPADDR_ENTRY IpAddress = - exAllocatePool( NonPagedPool, sizeof( IPADDR_ENTRY ) * IfCount ); - PIPADDR_ENTRY IpCurrent = IpAddress; - IF_LIST_ITER(CurrentIF); - - TI_DbgPrint(DEBUG_INFO, ("Called.\n")); - - if (!IpAddress) - return TDI_NO_RESOURCES; - - TcpipAcquireSpinLock(&InterfaceListLock, &OldIrql); - - ForEachInterface(CurrentIF) { - IpCurrent->Index = CurrentIF->Index; - IpCurrent->Addr = 0; - IpCurrent->BcastAddr = 0; - IpCurrent->Mask = 0; - - /* Locate the diffrent addresses and put them the right place */ - GetInterfaceIPv4Address( CurrentIF, - ADE_UNICAST, - &IpCurrent->Addr ); - GetInterfaceIPv4Address( CurrentIF, - ADE_BROADCAST, - &IpCurrent->BcastAddr ); - GetInterfaceIPv4Address( CurrentIF, - ADE_ADDRMASK, - &IpCurrent->Mask ); - IpCurrent++; - Count++; - } EndFor(CurrentIF); - ASSERT( Count == IfCount ); - - TcpipReleaseSpinLock(&InterfaceListLock, OldIrql); - - Status = InfoCopyOut( (PCHAR)IpAddress, sizeof(*IpAddress) * IfCount, - Buffer, BufferSize ); - - exFreePool( IpAddress ); - - TI_DbgPrint(DEBUG_INFO, ("Returning %08x\n", Status)); - - return Status; -} + /* Get IPRouteEntry s for each of the routes in the system */ TDI_STATUS InfoTdiQueryGetRouteTable( PNDIS_BUFFER Buffer, PUINT BufferSize ) { @@ -138,7 +88,65 @@ return Status; } -TDI_STATUS InfoTdiQueryGetIPSnmpInfo( PNDIS_BUFFER Buffer, +TDI_STATUS InfoTdiQueryGetAddrTable(TDIEntityID ID, + PNDIS_BUFFER Buffer, + PUINT BufferSize) +{ + KIRQL OldIrql; + PIPADDR_ENTRY IPEntry; + PIP_INTERFACE CurrentIF; + UINT i; + + TI_DbgPrint(DEBUG_INFO, ("Called.\n")); + + + TcpipAcquireSpinLock(&EntityListLock, &OldIrql); + + for (i = 0; i < EntityCount; i++) + { + if (EntityList[i].tei_entity == ID.tei_entity && + EntityList[i].tei_instance == ID.tei_instance) + break; + } + + if (i == EntityCount) + { + TcpipReleaseSpinLock(&EntityListLock, OldIrql); + return TDI_INVALID_PARAMETER; + } + + IPEntry = exAllocatePool(NonPagedPool, sizeof(IPADDR_ENTRY)); + if (!IPEntry) + { + TcpipReleaseSpinLock(&EntityListLock, OldIrql); + return TDI_NO_RESOURCES; + } + + CurrentIF = EntityList[i].context; + + IPEntry->Index = CurrentIF->Index; + GetInterfaceIPv4Address(CurrentIF, + ADE_UNICAST, + &IPEntry->Addr); + GetInterfaceIPv4Address(CurrentIF, + ADE_ADDRMASK, + &IPEntry->Mask); + GetInterfaceIPv4Address(CurrentIF, + ADE_BROADCAST, + &IPEntry->BcastAddr); + + TcpipReleaseSpinLock(&EntityListLock, OldIrql); + + InfoCopyOut((PCHAR)IPEntry, sizeof(IPADDR_ENTRY), + Buffer, BufferSize); + + exFreePool(IPEntry); + + return TDI_SUCCESS; +} + +TDI_STATUS InfoTdiQueryGetIPSnmpInfo( TDIEntityID ID, + PNDIS_BUFFER Buffer, PUINT BufferSize ) { IPSNMP_INFO SnmpInfo; UINT IfCount = CountInterfaces(); @@ -161,95 +169,35 @@ return Status; } -TDI_STATUS InfoNetworkLayerTdiQueryEx( UINT InfoClass, - UINT InfoType, - UINT InfoId, - PVOID Context, - TDIEntityID *id, - PNDIS_BUFFER Buffer, - PUINT BufferSize ) { - TDI_STATUS Status = TDI_INVALID_REQUEST; - - TI_DbgPrint(DEBUG_INFO, ("Called.\n")); - - switch( InfoClass ) { - case INFO_CLASS_GENERIC: - if( InfoType == INFO_TYPE_PROVIDER && InfoId == ENTITY_TYPE_ID ) { - ULONG Return = CL_NL_IP; - Status = InfoCopyOut( (PCHAR)&Return, sizeof(Return), - Buffer, BufferSize ); - } - break; - - case INFO_CLASS_PROTOCOL: - switch( InfoType ) { - case INFO_TYPE_PROVIDER: - switch( InfoId ) { - case IP_MIB_ADDRTABLE_ENTRY_ID: - Status = InfoTdiQueryGetAddrTable( Buffer, BufferSize ); - break; - - case IP_MIB_ROUTETABLE_ENTRY_ID: - Status = InfoTdiQueryGetRouteTable( Buffer, BufferSize ); - break; - - case IP_MIB_STATS_ID: - Status = InfoTdiQueryGetIPSnmpInfo( Buffer, BufferSize ); - break; - } - break; - } - } - - TI_DbgPrint(DEBUG_INFO, ("Returning %08x\n", Status)); - - return Status; -} - -TDI_STATUS InfoNetworkLayerTdiSetEx( UINT InfoClass, - UINT InfoType, - UINT InfoId, - PVOID Context, - TDIEntityID *id, - PCHAR Buffer, - UINT BufferSize ) { - NTSTATUS Status = TDI_INVALID_REQUEST; - IP_ADDRESS Address; - IP_ADDRESS Netmask; - IP_ADDRESS Router; +TDI_STATUS InfoTdiSetRoute(PIPROUTE_ENTRY Route) +{ + IP_ADDRESS Address, Netmask, Router; PNEIGHBOR_CACHE_ENTRY NCE; - TI_DbgPrint(DEBUG_INFO,("Called\n")); - - //OskitDumpBuffer( (OSK_PCHAR)Buffer, BufferSize ); - - if( InfoClass == INFO_CLASS_PROTOCOL && - InfoType == INFO_TYPE_PROVIDER && - InfoId == IP_MIB_ROUTETABLE_ENTRY_ID && - id->tei_entity == CL_NL_ENTITY ) { /* Add or delete a route */ - PIPROUTE_ENTRY Route = (PIPROUTE_ENTRY)Buffer; - AddrInitIPv4( &Address, Route->Dest ); - AddrInitIPv4( &Netmask, Route->Mask ); - AddrInitIPv4( &Router, Route->Gw ); - - if( Route->Type == IP_ROUTE_TYPE_ADD ) { /* Add the route */ - TI_DbgPrint(DEBUG_INFO,("Adding route (%s)\n", A2S(&Address))); - /* Find the existing route this belongs to */ - NCE = RouterGetRoute( &Router ); - /* Really add the route */ - if( NCE && - RouterCreateRoute( &Address, &Netmask, &Router, - NCE->Interface, Route->Metric1 ) ) - Status = STATUS_SUCCESS; - else - Status = STATUS_UNSUCCESSFUL; - } else if( Route->Type == IP_ROUTE_TYPE_DEL ) { - TI_DbgPrint(DEBUG_INFO,("Removing route (%s)\n", A2S(&Address))); - Status = RouterRemoveRoute( &Address, &Router ); - } else Status = TDI_INVALID_REQUEST; - } - - TI_DbgPrint(DEBUG_INFO,("Returning %x\n", Status)); - - return Status; -} + AddrInitIPv4( &Address, Route->Dest ); + AddrInitIPv4( &Netmask, Route->Mask ); + AddrInitIPv4( &Router, Route->Gw ); + + if( Route->Type == IP_ROUTE_TYPE_ADD ) { /* Add the route */ + TI_DbgPrint(DEBUG_INFO,("Adding route (%s)\n", A2S(&Address))); + /* Find the existing route this belongs to */ + NCE = RouterGetRoute( &Router ); + if (!NCE) return TDI_INVALID_PARAMETER; + + /* Really add the route */ + if (!RouterCreateRoute( &Address, &Netmask, &Router, + NCE->Interface, Route->Metric1)) + return TDI_NO_RESOURCES; + + return TDI_SUCCESS; + } else if( Route->Type == IP_ROUTE_TYPE_DEL ) { + TI_DbgPrint(DEBUG_INFO,("Removing route (%s)\n", A2S(&Address))); + if (NT_SUCCESS(RouterRemoveRoute( &Address, &Router ))) + return TDI_SUCCESS; + else + return TDI_INVALID_PARAMETER; + } + + return TDI_INVALID_REQUEST; +} +
15 years, 2 months
1
0
0
0
← Newer
1
...
52
53
54
55
56
57
58
...
65
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
Results per page:
10
25
50
100
200