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
2025
January
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
August 2005
----- 2025 -----
January 2025
----- 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
23 participants
669 discussions
Start a n
N
ew thread
[hbirr] 17308: Clear the memory after we know that the buffer was allocated.
by hbirr@svn.reactos.com
Clear the memory after we know that the buffer was allocated. Modified: trunk/reactos/ntoskrnl/se/semgr.c _____ Modified: trunk/reactos/ntoskrnl/se/semgr.c --- trunk/reactos/ntoskrnl/se/semgr.c 2005-08-11 20:35:00 UTC (rev 17307) +++ trunk/reactos/ntoskrnl/se/semgr.c 2005-08-11 20:37:09 UTC (rev 17308) @@ -719,8 +719,6 @@ Descriptor = ExAllocatePool(PagedPool, Length); - RtlZeroMemory( Descriptor, Length ); - if (Descriptor == NULL) { DPRINT1("ExAlloctePool() failed\n"); @@ -728,6 +726,7 @@ return STATUS_INSUFFICIENT_RESOURCES; } + RtlZeroMemory( Descriptor, Length ); RtlCreateSecurityDescriptor(Descriptor, SECURITY_DESCRIPTOR_REVISION);
19 years, 4 months
1
0
0
0
[hbirr] 17307: - Implemented MEMORY_AREA_PEB_OR_TEB and MEMORY_AREA_PAGED_POOL for MiQueryVirtualMemory.
by hbirr@svn.reactos.com
- Implemented MEMORY_AREA_PEB_OR_TEB and MEMORY_AREA_PAGED_POOL for MiQueryVirtualMemory. - Fixed the range check in ProbeForRead and ProbeForWrite. Modified: trunk/reactos/ntoskrnl/mm/virtual.c _____ Modified: trunk/reactos/ntoskrnl/mm/virtual.c --- trunk/reactos/ntoskrnl/mm/virtual.c 2005-08-11 20:29:08 UTC (rev 17306) +++ trunk/reactos/ntoskrnl/mm/virtual.c 2005-08-11 20:35:00 UTC (rev 17307) @@ -175,6 +175,7 @@ switch(MemoryArea->Type) { case MEMORY_AREA_VIRTUAL_MEMORY: + case MEMORY_AREA_PEB_OR_TEB: Status = MmQueryAnonMem(MemoryArea, Address, Info, ResultLength); break; @@ -230,6 +231,18 @@ Status = STATUS_SUCCESS; *ResultLength = sizeof(MEMORY_BASIC_INFORMATION); break; + case MEMORY_AREA_PAGED_POOL: + Info->Type = 0; + Info->State = MEM_COMMIT; + Info->Protect = MemoryArea->Attributes; + Info->AllocationProtect = MemoryArea->Attributes; + Info->BaseAddress = MemoryArea->StartingAddress; + Info->AllocationBase = MemoryArea->StartingAddress; + Info->RegionSize = (ULONG_PTR)MemoryArea->EndingAddress - + (ULONG_PTR)MemoryArea->StartingAddress; + Status = STATUS_SUCCESS; + *ResultLength = sizeof(MEMORY_BASIC_INFORMATION); + break; default: DPRINT1("unhandled memory area type: 0x%x\n", MemoryArea->Type); Status = STATUS_UNSUCCESSFUL; @@ -1001,7 +1014,7 @@ ExRaiseStatus (STATUS_DATATYPE_MISALIGNMENT); } else if ((ULONG_PTR)Address + Length - 1 < (ULONG_PTR)Address || - (ULONG_PTR)Address + Length - 1 > (ULONG_PTR)MmUserProbeAddress) + (ULONG_PTR)Address + Length - 1 >= (ULONG_PTR)MmUserProbeAddress) { ExRaiseStatus (STATUS_ACCESS_VIOLATION); } @@ -1031,7 +1044,7 @@ Last = (PCHAR)((ULONG_PTR)Address + Length - 1); if ((ULONG_PTR)Last < (ULONG_PTR)Address || - (ULONG_PTR)Last > (ULONG_PTR)MmUserProbeAddress) + (ULONG_PTR)Last >= (ULONG_PTR)MmUserProbeAddress) { ExRaiseStatus (STATUS_ACCESS_VIOLATION); }
19 years, 4 months
1
0
0
0
[hbirr] 17306: - Removed the hole pool allocation, because it needs to much memory and ros will not boot.
by hbirr@svn.reactos.com
- Removed the hole pool allocation, because it needs to much memory and ros will not boot. - Allocate short blocks in one page. - Split the used and free header. It makes it easier to implement a red zone check. Modified: trunk/reactos/ntoskrnl/mm/npool.c _____ Modified: trunk/reactos/ntoskrnl/mm/npool.c --- trunk/reactos/ntoskrnl/mm/npool.c 2005-08-11 20:23:13 UTC (rev 17305) +++ trunk/reactos/ntoskrnl/mm/npool.c 2005-08-11 20:29:08 UTC (rev 17306) @@ -8,6 +8,7 @@ * PROGRAMMERS: David Welch (welch(a)cwcom.net) * Iwan Fatahi (i_fatahi(a)hotmail.com) * Robert Bergkvist (fragdance(a)hotmail.com) + * Hartmut Birr */ /* INCLUDES ****************************************************************/ @@ -54,38 +55,33 @@ /* * fields present at the start of a block (this is for internal use only) */ -typedef struct _BLOCK_HDR +typedef struct _HDR { - ULONG Magic; - ULONG Size; - struct _BLOCK_HDR* previous; - union - { - struct - { - LIST_ENTRY ListEntry; - ULONG Tag; - PVOID Caller; - LIST_ENTRY TagListEntry; - BOOLEAN Dumped; - } - Used; - struct - { - NODE Node; - } - Free; - }; -} -BLOCK_HDR; + ULONG Magic; + ULONG Size; + struct _HDR* previous; +} HDR, *PHDR; -#define BLOCK_HDR_SIZE ROUND_UP(sizeof(BLOCK_HDR), MM_POOL_ALIGNMENT) +typedef struct _HDR_USED +{ + HDR hdr; + LIST_ENTRY ListEntry; + ULONG Tag; + PVOID Caller; + LIST_ENTRY TagListEntry; + BOOLEAN Dumped; +} HDR_USED, *PHDR_USED; -PVOID STDCALL -ExAllocateWholePageBlock(ULONG Size); -VOID STDCALL -ExFreeWholePageBlock(PVOID Addr); +typedef struct _HDR_FREE +{ + HDR hdr; + NODE Node; +} HDR_FREE, *PHDR_FREE; +#define HDR_FREE_SIZE ROUND_UP(sizeof(HDR_FREE), MM_POOL_ALIGNMENT) +#define HDR_USED_SIZE ROUND_UP(sizeof(HDR_USED), MM_POOL_ALIGNMENT) + + /* GLOBALS *****************************************************************/ extern PVOID MiNonPagedPoolStart; @@ -103,7 +99,6 @@ static LIST_ENTRY AddressListHead; -#ifndef WHOLE_PAGE_ALLOCATIONS /* * Count of free blocks */ @@ -113,7 +108,6 @@ * Count of used blocks */ static ULONG EiNrUsedBlocks = 0; -#endif /* * Lock that protects the non-paged pool data structures @@ -147,29 +141,23 @@ static LIST_ENTRY tag_hash_table[TAG_HASH_TABLE_SIZE]; #endif /* TAG_STATISTICS_TRACKING */ -#ifdef WHOLE_PAGE_ALLOCATIONS -static RTL_BITMAP NonPagedPoolAllocMap; -static ULONG NonPagedPoolAllocMapHint; -static ULONG MiCurrentNonPagedPoolLength = 0; -#else static PULONG MiNonPagedPoolAllocMap; static ULONG MiNonPagedPoolNrOfPages; -#endif /* WHOLE_PAGE_ALLOCATIONS */ /* avl helper functions ****************************************************/ void DumpFreeBlockNode(PNODE p) { static int count = 0; - BLOCK_HDR* blk; + HDR_FREE* blk; count++; if (p) { DumpFreeBlockNode(p->link[0]); - blk = CONTAINING_RECORD(p, BLOCK_HDR, Free.Node); - DbgPrint("%08x %8d (%d)\n", blk, blk->Size, count); + blk = CONTAINING_RECORD(p, HDR_FREE, Node); + DbgPrint("%08x %8d (%d)\n", blk, blk->hdr.Size, count); DumpFreeBlockNode(p->link[1]); } @@ -178,17 +166,17 @@ void DumpFreeBlockTree(void) { DbgPrint("--- Begin tree ------------------\n"); - DbgPrint("%08x\n", CONTAINING_RECORD(FreeBlockListRoot, BLOCK_HDR, Free.Node)); + DbgPrint("%08x\n", CONTAINING_RECORD(FreeBlockListRoot, HDR_FREE, Node)); DumpFreeBlockNode(FreeBlockListRoot); DbgPrint("--- End tree --------------------\n"); } int compare_node(PNODE p1, PNODE p2) { - BLOCK_HDR* blk1 = CONTAINING_RECORD(p1, BLOCK_HDR, Free.Node); - BLOCK_HDR* blk2 = CONTAINING_RECORD(p2, BLOCK_HDR, Free.Node); + HDR_FREE* blk1 = CONTAINING_RECORD(p1, HDR_FREE, Node); + HDR_FREE* blk2 = CONTAINING_RECORD(p2, HDR_FREE, Node); - if (blk1->Size == blk2->Size) + if (blk1->hdr.Size == blk2->hdr.Size) { if (blk1 < blk2) { @@ -201,11 +189,11 @@ } else { - if (blk1->Size < blk2->Size) + if (blk1->hdr.Size < blk2->hdr.Size) { return -1; } - if (blk1->Size > blk2->Size) + if (blk1->hdr.Size > blk2->hdr.Size) { return 1; } @@ -216,14 +204,14 @@ int compare_value(PVOID value, PNODE p) { - BLOCK_HDR* blk = CONTAINING_RECORD(p, BLOCK_HDR, Free.Node); + HDR_FREE* blk = CONTAINING_RECORD(p, HDR_FREE, Node); ULONG v = *(PULONG)value; - if (v < blk->Size) + if (v < blk->hdr.Size) { return -1; } - if (v > blk->Size) + if (v > blk->hdr.Size) { return 1; } @@ -730,39 +718,38 @@ #ifdef TAG_STATISTICS_TRACKING VOID -MiRemoveFromTagHashTable(BLOCK_HDR* block) +MiRemoveFromTagHashTable(HDR_USED* block) /* * Remove a block from the tag hash table */ { - if (block->Used.Tag == 0) + if (block->Tag == 0) { return; } - - RemoveEntryList(&block->Used.TagListEntry); + RemoveEntryList(&block->TagListEntry); } VOID -MiAddToTagHashTable(BLOCK_HDR* block) +MiAddToTagHashTable(HDR_USED* block) /* * Add a block to the tag hash table */ { ULONG hash; - if (block->Used.Tag == 0) + if (block->Tag == 0) { return; } - hash = block->Used.Tag % TAG_HASH_TABLE_SIZE; + hash = block->Tag % TAG_HASH_TABLE_SIZE; - InsertHeadList(&tag_hash_table[hash], &block->Used.TagListEntry); + InsertHeadList(&tag_hash_table[hash], &block->TagListEntry); } #endif /* TAG_STATISTICS_TRACKING */ -#if defined(TAG_STATISTICS_TRACKING) && !defined(WHOLE_PAGE_ALLOCATIONS) +#if defined(TAG_STATISTICS_TRACKING) VOID STATIC MiDumpTagStats(ULONG CurrentTag, ULONG CurrentNrBlocks, ULONG CurrentSize) { @@ -786,14 +773,14 @@ CurrentSize / CurrentNrBlocks); } } -#endif /* defined(TAG_STATISTICS_TRACKING) && !defined(WHOLE_PAGE_ALLOCATIONS); */ +#endif /* defined(TAG_STATISTICS_TRACKING) */ VOID MiDebugDumpNonPagedPoolStats(BOOLEAN NewOnly) { -#if defined(TAG_STATISTICS_TRACKING) && !defined(WHOLE_PAGE_ALLOCATIONS) +#if defined(TAG_STATISTICS_TRACKING) ULONG i; - BLOCK_HDR* current; + HDR_USED* current; ULONG CurrentTag; ULONG CurrentNrBlocks = 0; ULONG CurrentSize = 0; @@ -817,25 +804,25 @@ current_entry = tag_hash_table[i].Flink; while (current_entry != &tag_hash_table[i]) { - current = CONTAINING_RECORD(current_entry, BLOCK_HDR, Used.TagListEntry); + current = CONTAINING_RECORD(current_entry, HDR_USED, TagListEntry); current_entry = current_entry->Flink; if (CurrentTag == 0) { - CurrentTag = current->Used.Tag; + CurrentTag = current->Tag; CurrentNrBlocks = 0; CurrentSize = 0; } - if (current->Used.Tag == CurrentTag) + if (current->Tag == CurrentTag) { - RemoveEntryList(¤t->Used.TagListEntry); - InsertHeadList(&tmpListHead, ¤t->Used.TagListEntry); - if (!NewOnly || !current->Used.Dumped) + RemoveEntryList(¤t->TagListEntry); + InsertHeadList(&tmpListHead, ¤t->TagListEntry); + if (!NewOnly || !current->Dumped) { CurrentNrBlocks++; TotalBlocks++; - CurrentSize += current->Size; - TotalSize += current->Size; - current->Used.Dumped = TRUE; + CurrentSize += current->hdr.Size; + TotalSize += current->hdr.Size; + current->Dumped = TRUE; } } } @@ -866,14 +853,14 @@ DbgPrint("Freeblocks %d TotalFreeSize %d AverageFreeSize %d\n", EiNrFreeBlocks, Size, EiNrFreeBlocks ? Size / EiNrFreeBlocks : 0); DbgPrint("***************** Dump Complete ***************\n"); -#endif /* defined(TAG_STATISTICS_TRACKING) && !defined(WHOLE_PAGE_ALLOCATIONS) */ +#endif /* defined(TAG_STATISTICS_TRACKING) */ } VOID MiDebugDumpNonPagedPool(BOOLEAN NewOnly) { -#if defined(POOL_DEBUG_APIS) && !defined(WHOLE_PAGE_ALLOCATIONS) - BLOCK_HDR* current; +#if defined(POOL_DEBUG_APIS) + HDR_USED* current; PLIST_ENTRY current_entry; KIRQL oldIrql; @@ -883,45 +870,43 @@ current_entry = UsedBlockListHead.Flink; while (current_entry != &UsedBlockListHead) { - current = CONTAINING_RECORD(current_entry, BLOCK_HDR, Used.ListEntry); - if (!NewOnly || !current->Used.Dumped) + current = CONTAINING_RECORD(current_entry, HDR_USED, ListEntry); + if (!NewOnly || !current->Dumped) { CHAR c1, c2, c3, c4; - c1 = (CHAR)((current->Used.Tag >> 24) & 0xFF); - c2 = (CHAR)((current->Used.Tag >> 16) & 0xFF); - c3 = (CHAR)((current->Used.Tag >> 8) & 0xFF); - c4 = (CHAR)(current->Used.Tag & 0xFF); + c1 = (CHAR)((current->Tag >> 24) & 0xFF); + c2 = (CHAR)((current->Tag >> 16) & 0xFF); + c3 = (CHAR)((current->Tag >> 8) & 0xFF); + c4 = (CHAR)(current->Tag & 0xFF); if (isprint(c1) && isprint(c2) && isprint(c3) && isprint(c4)) { DbgPrint("Size 0x%x Tag 0x%x (%c%c%c%c) Allocator 0x%x\n", - current->Size, current->Used.Tag, c4, c3, c2, c1, - current->Used.Caller); + current->hdr.Size, current->Tag, c4, c3, c2, c1, + current->Caller); } else { DbgPrint("Size 0x%x Tag 0x%x Allocator 0x%x\n", - current->Size, current->Used.Tag, current->Used.Caller); + current->hdr.Size, current->Tag, current->Caller); } - current->Used.Dumped = TRUE; + current->Dumped = TRUE; } current_entry = current_entry->Flink; } DbgPrint("***************** Dump Complete ***************\n"); KeReleaseSpinLock(&MmNpoolLock, oldIrql); -#endif /* not WHOLE_PAGE_ALLOCATIONS */ +#endif } -#ifndef WHOLE_PAGE_ALLOCATIONS - #ifdef ENABLE_VALIDATE_POOL static void validate_free_list(void) /* * FUNCTION: Validate the integrity of the list of free blocks */ { - BLOCK_HDR* current; + HDR_FREE* current; unsigned int blocks_seen=0; PNODE p; @@ -931,10 +916,10 @@ { PVOID base_addr; - current = CONTAINING_RECORD(p, BLOCK_HDR, Free.Node); + current = CONTAINING_RECORD(p, HDR_FREE, Node); base_addr = (PVOID)current; - if (current->Magic != BLOCK_HDR_FREE_MAGIC) + if (current->hdr.Magic != BLOCK_HDR_FREE_MAGIC) { DbgPrint("Bad block magic (probable pool corruption) at %x\n", current); @@ -942,12 +927,12 @@ } if (base_addr < MiNonPagedPoolStart || - base_addr + BLOCK_HDR_SIZE + current->Size > MiNonPagedPoolStart + MiNonPagedPoolLength) + (ULONG_PTR)base_addr + current->hdr.Size > (ULONG_PTR)MiNonPagedPoolStart + MiNonPagedPoolLength) { DbgPrint("Block %x found outside pool area\n",current); - DbgPrint("Size %d\n",current->Size); + DbgPrint("Size %d\n",current->hdr.Size); DbgPrint("Limits are %x %x\n",MiNonPagedPoolStart, - MiNonPagedPoolStart+MiNonPagedPoolLength); + (ULONG_PTR)MiNonPagedPoolStart+MiNonPagedPoolLength); KEBUGCHECK(/*KBUG_POOL_FREE_LIST_CORRUPT*/0); } blocks_seen++; @@ -965,7 +950,7 @@ * FUNCTION: Validate the integrity of the list of used blocks */ { - BLOCK_HDR* current; + HDR_USED* current; PLIST_ENTRY current_entry; unsigned int blocks_seen=0; @@ -974,23 +959,23 @@ { PVOID base_addr; - current = CONTAINING_RECORD(current_entry, BLOCK_HDR, Used.ListEntry); + current = CONTAINING_RECORD(current_entry, HDR_USED, ListEntry); base_addr = (PVOID)current; - if (current->Magic != BLOCK_HDR_USED_MAGIC) + if (current->hdr.Magic != BLOCK_HDR_USED_MAGIC) { DbgPrint("Bad block magic (probable pool corruption) at %x\n", current); KEBUGCHECK(/*KBUG_POOL_FREE_LIST_CORRUPT*/0); } if (base_addr < MiNonPagedPoolStart || - (base_addr+BLOCK_HDR_SIZE+current->Size) > - MiNonPagedPoolStart+MiNonPagedPoolLength) + ((ULONG_PTR)base_addr+current->hdr.Size) > + (ULONG_PTR)MiNonPagedPoolStart+MiNonPagedPoolLength) { DbgPrint("Block %x found outside pool area\n",current); - DbgPrint("Size %d\n",current->Size); + DbgPrint("Size %d\n",current->hdr.Size); DbgPrint("Limits are %x %x\n",MiNonPagedPoolStart, - MiNonPagedPoolStart+MiNonPagedPoolLength); + (ULONG_PTR)MiNonPagedPoolStart+MiNonPagedPoolLength); KEBUGCHECK(/*KBUG_POOL_FREE_LIST_CORRUPT*/0); } blocks_seen++; @@ -999,13 +984,13 @@ DbgPrint("Too many blocks on used list\n"); KEBUGCHECK(/*KBUG_POOL_FREE_LIST_CORRUPT*/0); } - if (current->Used.ListEntry.Flink != &UsedBlockListHead && - current->Used.ListEntry.Flink->Blink != ¤t->Used.ListEntry) + if (current->ListEntry.Flink != &UsedBlockListHead && + current->ListEntry.Flink->Blink != ¤t->ListEntry) { DbgPrint("%s:%d:Break in list (current %x next %x " "current->next->previous %x)\n", - __FILE__,__LINE__,current, current->Used.ListEntry.Flink, - current->Used.ListEntry.Flink->Blink); + __FILE__,__LINE__,current, current->ListEntry.Flink, + current->ListEntry.Flink->Blink); KEBUGCHECK(/*KBUG_POOL_FREE_LIST_CORRUPT*/0); } @@ -1013,7 +998,7 @@ } } -static void check_duplicates(BLOCK_HDR* blk) +static void check_duplicates(HDR* blk) /* * FUNCTION: Check a block has no duplicates * ARGUMENTS: @@ -1021,33 +1006,32 @@ * NOTE: Bug checks if duplicates are found */ { - char* base = (char*)blk; - char* last = ((char*)blk) + BLOCK_HDR_SIZE + blk->Size; - BLOCK_HDR* current; + ULONG_PTR base = (ULONG_PTR)blk; + ULONG_PTR last = (ULONG_PTR)blk + blk->Size; PLIST_ENTRY current_entry; PNODE p; + HDR_FREE* free; + HDR_USED* used; p = avl_get_first(FreeBlockListRoot); while (p) { - current = CONTAINING_RECORD(p, BLOCK_HDR, Free.Node); - - if (current->Magic != BLOCK_HDR_FREE_MAGIC) + free = CONTAINING_RECORD(p, HDR_FREE, Node); + if (free->hdr.Magic != BLOCK_HDR_FREE_MAGIC) { DbgPrint("Bad block magic (probable pool corruption) at %x\n", - current); + free); KEBUGCHECK(/*KBUG_POOL_FREE_LIST_CORRUPT*/0); } - if ( (char*)current > base && (char*)current < last ) + if ( (ULONG_PTR)free > base && (ULONG_PTR)free < last ) { DbgPrint("intersecting blocks on list\n"); KEBUGCHECK(/*KBUG_POOL_FREE_LIST_CORRUPT*/0); } - if ( (char*)current < base && - ((char*)current + current->Size + BLOCK_HDR_SIZE) - > base ) + if ( (ULONG_PTR)free < base && + ((ULONG_PTR)free + free->hdr.Size) > base ) { DbgPrint("intersecting blocks on list\n"); KEBUGCHECK(/*KBUG_POOL_FREE_LIST_CORRUPT*/0); @@ -1058,16 +1042,15 @@ current_entry = UsedBlockListHead.Flink; while (current_entry != &UsedBlockListHead) { - current = CONTAINING_RECORD(current_entry, BLOCK_HDR, Used.ListEntry); + used = CONTAINING_RECORD(current_entry, HDR_USED, ListEntry); - if ( (char*)current > base && (char*)current < last ) + if ( (ULONG_PTR)used > base && (ULONG_PTR)used < last ) { DbgPrint("intersecting blocks on list\n"); KEBUGCHECK(/*KBUG_POOL_FREE_LIST_CORRUPT*/0); } - if ( (char*)current < base && - ((char*)current + current->Size + BLOCK_HDR_SIZE) - > base ) + if ( (ULONG_PTR)current < base && + ((ULONG_PTR)current + current->hdr.Size) > base ) { DbgPrint("intersecting blocks on list\n"); KEBUGCHECK(/*KBUG_POOL_FREE_LIST_CORRUPT*/0); @@ -1083,7 +1066,8 @@ * FUNCTION: Checks the integrity of the kernel memory heap */ { - BLOCK_HDR* current; + HDR_FREE* free; + HDR_USED* used; PLIST_ENTRY current_entry; PNODE p; @@ -1093,15 +1077,15 @@ p = avl_get_first(FreeBlockListRoot); while (p) { - current = CONTAINING_RECORD(p, BLOCK_HDR, Free.Node); - check_duplicates(current); + freet = CONTAINING_RECORD(p, HDR_FREE, Node); + check_duplicates(&free->hdr); p = avl_get_next(FreeBlockListRoot, p); } current_entry = UsedBlockListHead.Flink; while (current_entry != &UsedBlockListHead) { - current = CONTAINING_RECORD(current_entry, BLOCK_HDR, Used.ListEntry); - check_duplicates(current); + used = CONTAINING_RECORD(current_entry, HDR_USED, ListEntry); + check_duplicates(&used->hdr); current_entry = current_entry->Flink; } } @@ -1109,14 +1093,13 @@ #if 0 STATIC VOID -free_pages(BLOCK_HDR* blk) +free_pages(HDR_FREE* blk) { ULONG start; ULONG end; - ULONG i; - start = (ULONG)blk; - end = (ULONG)blk + BLOCK_HDR_SIZE + blk->Size; + start = (ULONG_PTR)blk; + end = (ULONG_PTR)blk + blk->hdr.Size; /* * If the block doesn't contain a whole page then there is nothing to do @@ -1128,20 +1111,20 @@ } #endif -static void remove_from_used_list(BLOCK_HDR* current) +static void remove_from_used_list(HDR_USED* current) { - RemoveEntryList(¤t->Used.ListEntry); - EiUsedNonPagedPool -= current->Size; + RemoveEntryList(¤t->ListEntry); + EiUsedNonPagedPool -= current->hdr.Size; EiNrUsedBlocks--; } -static void remove_from_free_list(BLOCK_HDR* current) +static void remove_from_free_list(HDR_FREE* current) { - DPRINT("remove_from_free_list %d\n", current->Size); + DPRINT("remove_from_free_list %d\n", current->hdr.Size); - avl_remove(&FreeBlockListRoot, ¤t->Free.Node, compare_node); + avl_remove(&FreeBlockListRoot, ¤t->Node, compare_node); - EiFreeNonPagedPool -= current->Size; + EiFreeNonPagedPool -= current->hdr.Size; EiNrFreeBlocks--; DPRINT("remove_from_free_list done\n"); #ifdef DUMP_AVL @@ -1151,49 +1134,48 @@ } static void -add_to_free_list(BLOCK_HDR* blk) +add_to_free_list(HDR_FREE* blk) /* * FUNCTION: add the block to the free list (internal) */ { - BLOCK_HDR* current; + HDR_FREE* current; BOOL UpdatePrevPtr = FALSE; - DPRINT("add_to_free_list (%d)\n", blk->Size); + DPRINT("add_to_free_list (%d)\n", blk->hdr.Size); EiNrFreeBlocks++; - current = blk->previous; - if (current && current->Magic == BLOCK_HDR_FREE_MAGIC) + current = (HDR_FREE*)blk->hdr.previous; + if (current && current->hdr.Magic == BLOCK_HDR_FREE_MAGIC) { remove_from_free_list(current); - current->Size = current->Size + BLOCK_HDR_SIZE + blk->Size; - current->Magic = BLOCK_HDR_USED_MAGIC; - memset(blk, 0xcc, BLOCK_HDR_SIZE); + current->hdr.Size = current->hdr.Size + blk->hdr.Size; + current->hdr.Magic = BLOCK_HDR_USED_MAGIC; + memset(blk, 0xcc, HDR_USED_SIZE); blk = current; UpdatePrevPtr = TRUE; } - current = (BLOCK_HDR*)((char*)blk + BLOCK_HDR_SIZE + blk->Size); + current = (HDR_FREE*)((ULONG_PTR)blk + blk->hdr.Size); if ((char*)current < (char*)MiNonPagedPoolStart + MiNonPagedPoolLength && - current->Magic == BLOCK_HDR_FREE_MAGIC) + current->hdr.Magic == BLOCK_HDR_FREE_MAGIC) { remove_from_free_list(current); - blk->Size += BLOCK_HDR_SIZE + current->Size; - memset(current, 0xcc, BLOCK_HDR_SIZE); + blk->hdr.Size += current->hdr.Size; + memset(current, 0xcc, HDR_FREE_SIZE); UpdatePrevPtr = TRUE; - current = (BLOCK_HDR*)((char*)blk + BLOCK_HDR_SIZE + blk->Size); + current = (HDR_FREE*)((ULONG_PTR)blk + blk->hdr.Size); } if (UpdatePrevPtr && (char*)current < (char*)MiNonPagedPoolStart + MiNonPagedPoolLength) { - current->previous = blk; + current->hdr.previous = &blk->hdr; } - DPRINT("%d\n", blk->Size); - blk->Magic = BLOCK_HDR_FREE_MAGIC; - EiFreeNonPagedPool += blk->Size; - avl_insert(&FreeBlockListRoot, &blk->Free.Node, compare_node); - + DPRINT("%d\n", blk->hdr.Size); + blk->hdr.Magic = BLOCK_HDR_FREE_MAGIC; + EiFreeNonPagedPool += blk->hdr.Size; + avl_insert(&FreeBlockListRoot, &blk->Node, compare_node); DPRINT("add_to_free_list done\n"); #ifdef DUMP_AVL @@ -1201,40 +1183,26 @@ #endif } -static void add_to_used_list(BLOCK_HDR* blk) +static void add_to_used_list(HDR_USED* blk) /* * FUNCTION: add the block to the used list (internal) */ { - InsertHeadList(&UsedBlockListHead, &blk->Used.ListEntry); - EiUsedNonPagedPool += blk->Size; + InsertHeadList(&UsedBlockListHead, &blk->ListEntry); + EiUsedNonPagedPool += blk->hdr.Size; EiNrUsedBlocks++; } -inline static void* block_to_address(BLOCK_HDR* blk) -/* - * FUNCTION: Translate a block header address to the corresponding block - * address (internal) - */ -{ - return ( (void *) ((char*)blk + BLOCK_HDR_SIZE)); -} -inline static BLOCK_HDR* address_to_block(void* addr) -{ - return (BLOCK_HDR *) - ( ((char*)addr) - BLOCK_HDR_SIZE ); -} - static BOOLEAN -grow_block(BLOCK_HDR* blk, PVOID end) +grow_block(HDR_FREE* blk, PVOID end) { NTSTATUS Status; PFN_TYPE Page[32]; ULONG_PTR StartIndex, EndIndex; ULONG i, j, k; - StartIndex = (ULONG_PTR)(PAGE_ROUND_UP((ULONG_PTR)blk + BLOCK_HDR_SIZE - (ULONG_PTR)MiNonPagedPoolStart)) / PAGE_SIZE; + StartIndex = (ULONG_PTR)(PAGE_ROUND_UP((ULONG_PTR)blk + HDR_FREE_SIZE - (ULONG_PTR)MiNonPagedPoolStart)) / PAGE_SIZE; EndIndex = ((ULONG_PTR)PAGE_ROUND_UP(end) - (ULONG_PTR)MiNonPagedPoolStart) / PAGE_SIZE; @@ -1285,72 +1253,86 @@ return TRUE; } -static BLOCK_HDR* get_block(unsigned int size, unsigned long alignment) +static HDR_USED* get_block(unsigned int size, unsigned long alignment) { - BLOCK_HDR *blk, *current, *previous = NULL, *next = NULL, *best = NULL; + HDR_FREE *blk, *current, *previous = NULL, *next = NULL, *best = NULL; ULONG previous_size = 0, current_size, next_size = 0, new_size; PVOID end; - PVOID addr, aligned_addr; + PVOID addr, aligned_addr, best_aligned_addr; PNODE p; DPRINT("get_block %d\n", size); - if (alignment == 0) + p = avl_find_equal_or_greater(FreeBlockListRoot, size + HDR_USED_SIZE, compare_value); + while (p) { - p = avl_find_equal_or_greater(FreeBlockListRoot, size, compare_value); - if (p) + current = CONTAINING_RECORD(p, HDR_FREE, Node); + addr = (PVOID)((ULONG_PTR)current + HDR_USED_SIZE); + /* calculate first aligned address available within this block */ + aligned_addr = alignment > 0 ? MM_ROUND_UP(addr, alignment) : addr; + if (size < PAGE_SIZE) { - best = CONTAINING_RECORD(p, BLOCK_HDR, Free.Node); - addr = block_to_address(best); + /* check that the block is in one page */ + if (PAGE_ROUND_DOWN(aligned_addr) != PAGE_ROUND_DOWN((ULONG_PTR)aligned_addr + size - 1)) + { + aligned_addr = (PVOID)PAGE_ROUND_UP(aligned_addr); + } } - } - else - { - p = avl_find_equal_or_greater(FreeBlockListRoot, size, compare_value); - - while(p) + DPRINT("%x %x\n", addr, aligned_addr); + if (aligned_addr != addr) { - current = CONTAINING_RECORD(p, BLOCK_HDR, Free.Node); - addr = block_to_address(current); - /* calculate first aligned address available within this block */ - aligned_addr = MM_ROUND_UP(addr, alignment); - /* check to see if this address is already aligned */ - if (addr == aligned_addr) + while((ULONG_PTR)aligned_addr - (ULONG_PTR)addr < HDR_FREE_SIZE) { - if (current->Size >= size && - (best == NULL || current->Size < best->Size)) + if (alignment == 0) { - best = current; + aligned_addr = (PVOID)((ULONG_PTR)current + HDR_USED_SIZE + HDR_FREE_SIZE); } - } - else - { - /* make sure there's enough room to make a free block by the space skipped - * from alignment. If not, calculate forward to the next alignment - * and see if we allocate there... - */ - new_size = (ULONG_PTR)aligned_addr - (ULONG_PTR)addr + size; - if ((ULONG_PTR)aligned_addr - (ULONG_PTR)addr < BLOCK_HDR_SIZE) + else { - /* not enough room for a free block header, add some more bytes */ - aligned_addr = MM_ROUND_UP(block_to_address((BLOCK_HDR*)((char*)current + BLOCK_HDR_SIZE)), alignment); - new_size = (ULONG_PTR)aligned_addr - (ULONG_PTR)addr + size; + aligned_addr = MM_ROUND_UP((PVOID)((ULONG_PTR)current + HDR_USED_SIZE + HDR_FREE_SIZE), alignment); } - if (current->Size >= new_size && - (best == NULL || current->Size < best->Size)) + if (size < PAGE_SIZE) { - best = current; + /* check that the block is in one page */ + if (PAGE_ROUND_DOWN(aligned_addr) != PAGE_ROUND_DOWN((ULONG_PTR)aligned_addr + size - 1)) + { + aligned_addr = (PVOID)PAGE_ROUND_UP(aligned_addr); + } } } - if (best && current->Size >= size + alignment + 2 * BLOCK_HDR_SIZE) + } + DPRINT("%x %x\n", addr, aligned_addr); + new_size = (ULONG_PTR)aligned_addr - (ULONG_PTR)addr + size; + if (current->hdr.Size >= new_size + HDR_USED_SIZE && + (best == NULL || current->hdr.Size < best->hdr.Size)) + { + best = current; + best_aligned_addr = aligned_addr; + if (new_size <= size + 2 * HDR_FREE_SIZE) { - break; + break; } - p = avl_get_next(FreeBlockListRoot, p); - } - } - + + if (best) + { + if (size < PAGE_SIZE) + { + if (current->hdr.Size >= 2 * PAGE_SIZE + HDR_FREE_SIZE) + { + break; + } + } + else + { + if (current->hdr.Size >= size + alignment + HDR_FREE_SIZE) + { + break; + } + } + } + p = avl_get_next(FreeBlockListRoot, p); + } /* * We didn't find anything suitable at all. */ @@ -1359,40 +1341,31 @@ return NULL; } - current = best; - current_size = current->Size; + DPRINT(":: blk %x blk->hdr.Size %d (%d) Size %d\n", best, best->hdr.Size, best->hdr.Size - HDR_USED_SIZE, size); - if (alignment > 0) + current = best; + current_size = current->hdr.Size - HDR_USED_SIZE; + addr = (PVOID)((ULONG_PTR)current + HDR_USED_SIZE); + if (addr != best_aligned_addr) { - addr = block_to_address(current); - aligned_addr = MM_ROUND_UP(addr, alignment); - if (addr != aligned_addr) - { - blk = address_to_block(aligned_addr); - if ((char*)blk < (char*)current + BLOCK_HDR_SIZE) - { - aligned_addr = MM_ROUND_UP(block_to_address((BLOCK_HDR*)((char*)current + BLOCK_HDR_SIZE)), alignment); - blk = address_to_block(aligned_addr); - } - /* - * if size-aligned, break off the preceding bytes into their own block... - */ - previous = current; - previous_size = (ULONG_PTR)blk - (ULONG_PTR)previous - BLOCK_HDR_SIZE; - current = blk; - current_size -= ((ULONG_PTR)current - (ULONG_PTR)previous); - } + blk = (HDR_FREE*)((ULONG_PTR)best_aligned_addr - HDR_USED_SIZE); + /* + * if size-aligned, break off the preceding bytes into their own block... + */ + previous = current; + previous_size = (ULONG_PTR)blk - (ULONG_PTR)previous - HDR_FREE_SIZE; + current = blk; + current_size -= ((ULONG_PTR)current - (ULONG_PTR)previous); } + end = (PVOID)((ULONG_PTR)current + HDR_USED_SIZE + size); - end = (char*)current + BLOCK_HDR_SIZE + size; - - if (current_size >= size + BLOCK_HDR_SIZE + MM_POOL_ALIGNMENT) + if (current_size >= size + HDR_FREE_SIZE + MM_POOL_ALIGNMENT) { /* create a new free block after our block, if the memory size is >= 4 byte for this block */ - next = (BLOCK_HDR*)((ULONG_PTR)current + size + BLOCK_HDR_SIZE); - next_size = current_size - size - BLOCK_HDR_SIZE; + next = (HDR_FREE*)((ULONG_PTR)current + size + HDR_USED_SIZE); + next_size = current_size - size - HDR_FREE_SIZE; current_size = size; - end = (char*)next + BLOCK_HDR_SIZE; + end = (PVOID)((ULONG_PTR)next + HDR_FREE_SIZE); } if (previous) @@ -1403,17 +1376,17 @@ add_to_free_list(previous); return NULL; } - memset(current, 0, BLOCK_HDR_SIZE); - current->Size = current_size; - current->Magic = BLOCK_HDR_USED_MAGIC; - current->previous = previous; - previous->Size = previous_size; + memset(current, 0, HDR_USED_SIZE); + current->hdr.Size = current_size + HDR_USED_SIZE; + current->hdr.Magic = BLOCK_HDR_USED_MAGIC; + current->hdr.previous = &previous->hdr; + previous->hdr.Size = previous_size + HDR_FREE_SIZE; if (next == NULL) { - blk = (BLOCK_HDR*)((char*)current + BLOCK_HDR_SIZE + current->Size); - if ((char*)blk < (char*)MiNonPagedPoolStart + MiNonPagedPoolLength) + blk = (HDR_FREE*)((ULONG_PTR)current + current->hdr.Size); + if ((ULONG_PTR)blk < (ULONG_PTR)MiNonPagedPoolStart + MiNonPagedPoolLength) { - blk->previous = current; + blk->hdr.previous = ¤t->hdr; } } @@ -1428,56 +1401,55 @@ add_to_free_list(current); return NULL; } - - current->Magic = BLOCK_HDR_USED_MAGIC; + current->hdr.Magic = BLOCK_HDR_USED_MAGIC; if (next) { - current->Size = current_size; + current->hdr.Size = current_size + HDR_USED_SIZE; } } if (next) { - memset(next, 0, BLOCK_HDR_SIZE); - - next->Size = next_size; - next->Magic = BLOCK_HDR_FREE_MAGIC; - next->previous = current; - blk = (BLOCK_HDR*)((char*)next + BLOCK_HDR_SIZE + next->Size); - if ((char*)blk < (char*)MiNonPagedPoolStart + MiNonPagedPoolLength) + memset(next, 0, HDR_FREE_SIZE); + next->hdr.Size = next_size + HDR_FREE_SIZE; + next->hdr.Magic = BLOCK_HDR_FREE_MAGIC; + next->hdr.previous = ¤t->hdr; + blk = (HDR_FREE*)((ULONG_PTR)next + next->hdr.Size); + if ((ULONG_PTR)blk < (ULONG_PTR)MiNonPagedPoolStart + MiNonPagedPoolLength) { - blk->previous = next; + blk->hdr.previous = &next->hdr; } add_to_free_list(next); } - add_to_used_list(current); + add_to_used_list((HDR_USED*)current); VALIDATE_POOL; - return current; + + if (size < PAGE_SIZE) + { + addr = (PVOID)((ULONG_PTR)current + HDR_USED_SIZE); + if (PAGE_ROUND_DOWN(addr) != PAGE_ROUND_DOWN((PVOID)((ULONG_PTR)addr + size - 1))) + { + DPRINT1("%x %x\n", addr, (ULONG_PTR)addr + size); + } + ASSERT (PAGE_ROUND_DOWN(addr) == PAGE_ROUND_DOWN((PVOID)((ULONG_PTR)addr + size - 1))); + } + if (alignment) + { + addr = (PVOID)((ULONG_PTR)current + HDR_USED_SIZE); + ASSERT(MM_ROUND_UP(addr, alignment) == addr); + } + return (HDR_USED*)current; } -#endif /* not WHOLE_PAGE_ALLOCATIONS */ - ULONG STDCALL ExRosQueryNonPagedPoolTag ( PVOID Addr ) { -#ifdef WHOLE_PAGE_ALLOCATIONS /* WHOLE_PAGE_ALLOCATIONS */ - - UNIMPLEMENTED; - return 0; - -#else /* not WHOLE_PAGE_ALLOCATIONS */ - - BLOCK_HDR* blk=address_to_block(Addr); - - if (blk->Magic != BLOCK_HDR_USED_MAGIC) + HDR_USED* blk=(HDR_USED*)((ULONG_PTR)Addr - HDR_USED_SIZE); + if (blk->hdr.Magic != BLOCK_HDR_USED_MAGIC) KEBUGCHECK(0); - if (blk->Magic == BLOCK_HDR_FREE_MAGIC) - KEBUGCHECK(0); - return blk->Used.Tag; [truncated at 1000 lines; 391 more skipped]
19 years, 4 months
1
0
0
0
[hbirr] 17305: Fixed a debug message.
by hbirr@svn.reactos.com
Fixed a debug message. Modified: trunk/reactos/ntoskrnl/ke/dpc.c _____ Modified: trunk/reactos/ntoskrnl/ke/dpc.c --- trunk/reactos/ntoskrnl/ke/dpc.c 2005-08-11 20:18:24 UTC (rev 17304) +++ trunk/reactos/ntoskrnl/ke/dpc.c 2005-08-11 20:23:13 UTC (rev 17305) @@ -199,7 +199,7 @@ /* Get the DPC Data */ if (InterlockedCompareExchangeUL(&Dpc->DpcData, &Prcb->DpcData[0].DpcLock, 0)) { - DPRINT("DPC Already Inserted"); + DPRINT("DPC Already Inserted\n"); #ifdef CONFIG_SMP KiReleaseSpinLock(&Prcb->DpcData[0].DpcLock); #endif
19 years, 4 months
1
0
0
0
[hbirr] 17304: Reenabled a debug message.
by hbirr@svn.reactos.com
Reenabled a debug message. Modified: trunk/reactos/hal/halx86/generic/processor.c _____ Modified: trunk/reactos/hal/halx86/generic/processor.c --- trunk/reactos/hal/halx86/generic/processor.c 2005-08-11 20:16:03 UTC (rev 17303) +++ trunk/reactos/hal/halx86/generic/processor.c 2005-08-11 20:18:24 UTC (rev 17304) @@ -39,9 +39,7 @@ HalStartNextProcessor(ULONG Unknown1, ULONG ProcessorStack) { -#if 0 - DPRINT("HalStartNextProcessor(%x %x)\n", ProcessorNumber, ProcessorStack); -#endif + DPRINT("HalStartNextProcessor(%x %x)\n", Unknown1, ProcessorStack); return TRUE; }
19 years, 4 months
1
0
0
0
[hbirr] 17303: Implemented (copied from NdisAllocatePacketPool) NdisAllocatePacketPoolEx.
by hbirr@svn.reactos.com
Implemented (copied from NdisAllocatePacketPool) NdisAllocatePacketPoolEx. Modified: trunk/reactos/drivers/net/ndis/ndis/buffer.c _____ Modified: trunk/reactos/drivers/net/ndis/ndis/buffer.c --- trunk/reactos/drivers/net/ndis/ndis/buffer.c 2005-08-11 20:13:26 UTC (rev 17302) +++ trunk/reactos/drivers/net/ndis/ndis/buffer.c 2005-08-11 20:16:03 UTC (rev 17303) @@ -469,6 +469,12 @@ NDIS_DbgPrint(MAX_TRACE, ("Status (0x%X) Packet (0x%X) PoolHandle (0x%X).\n", Status, Packet, PoolHandle)); + if (Pool == NULL) + { + *Status = NDIS_STATUS_FAILURE; + return; + } + KeAcquireSpinLock(&Pool->SpinLock.SpinLock, &OldIrql); if (Pool->FreeList) { @@ -563,7 +569,57 @@ * NDIS 5.0 */ { - UNIMPLEMENTED + PNDIS_PACKET_POOL Pool; + UINT Size, Length, i; + PNDIS_PACKET Packet, NextPacket; + + NDIS_DbgPrint(MAX_TRACE, ("Status (0x%X) PoolHandle (0x%X) " + "NumberOfDescriptors (%d) ProtocolReservedLength (%d).\n", + Status, PoolHandle, NumberOfDescriptors, ProtocolReservedLength)); + + if (NumberOfDescriptors > 0xffff) + { + *Status = NDIS_STATUS_RESOURCES; + } + else + { + NumberOfDescriptors += NumberOfOverflowDescriptors; + if (NumberOfDescriptors > 0xffff) + { + NumberOfDescriptors = 0xffff; + } + + Length = sizeof(NDIS_PACKET) + ProtocolReservedLength; + Size = sizeof(NDIS_PACKET_POOL) + Length * NumberOfDescriptors; + + Pool = ExAllocatePool(NonPagedPool, Size); + if (Pool) + { + KeInitializeSpinLock(&Pool->SpinLock.SpinLock); + Pool->PacketLength = Length; + + if (NumberOfDescriptors > 0) + { + Packet = (PNDIS_PACKET)&Pool->Buffer; + Pool->FreeList = Packet; + + NextPacket = (PNDIS_PACKET)((ULONG_PTR)Packet + Length); + for (i = 1; i < NumberOfDescriptors; i++) + { + Packet->Private.Head = (PNDIS_BUFFER)NextPacket; + Packet = NextPacket; + NextPacket = (PNDIS_PACKET)((ULONG_PTR)Packet + Length); + } + Packet->Private.Head = NULL; + } + else + Pool->FreeList = NULL; + + *Status = NDIS_STATUS_SUCCESS; + *PoolHandle = (PNDIS_HANDLE)Pool; + } else + *Status = NDIS_STATUS_RESOURCES; + } }
19 years, 4 months
1
0
0
0
[hpoussin] 17302: Remove debug output and some useless code
by hpoussin@svn.reactos.com
Remove debug output and some useless code Replace false by FALSE Modified: trunk/reactos/drivers/usb/cromwell/uhci/fdo.c Modified: trunk/reactos/drivers/usb/cromwell/uhci/uhci.c _____ Modified: trunk/reactos/drivers/usb/cromwell/uhci/fdo.c --- trunk/reactos/drivers/usb/cromwell/uhci/fdo.c 2005-08-11 20:13:16 UTC (rev 17301) +++ trunk/reactos/drivers/usb/cromwell/uhci/fdo.c 2005-08-11 20:13:26 UTC (rev 17302) @@ -344,7 +344,6 @@ &StringSize); if (NT_SUCCESS(Status) || Status == STATUS_BUFFER_TOO_SMALL) { - DPRINT("UHCI: IOCTL_GET_HCD_DRIVERKEY_NAME returns '%S'\n", StringDescriptor->DriverKeyName); StringDescriptor->ActualLength = StringSize + FIELD_OFFSET(USB_HCD_DRIVERKEY_NAME, DriverKeyName); Information = LengthOut; Status = STATUS_SUCCESS; @@ -385,18 +384,6 @@ } break; } - case IOCTL_USB_GET_NODE_CONNECTION_INFORMATION: - { - DPRINT1("UHCI: IOCTL_USB_GET_NODE_CONNECTION_INFORMATION\n"); - Status = STATUS_NOT_IMPLEMENTED; - break; - } - case IOCTL_USB_GET_NODE_CONNECTION_NAME: - { - DPRINT1("UHCI: IOCTL_USB_GET_NODE_CONNECTION_NAME\n"); - Status = STATUS_NOT_IMPLEMENTED; - break; - } default: { _____ Modified: trunk/reactos/drivers/usb/cromwell/uhci/uhci.c --- trunk/reactos/drivers/usb/cromwell/uhci/uhci.c 2005-08-11 20:13:16 UTC (rev 17301) +++ trunk/reactos/drivers/usb/cromwell/uhci/uhci.c 2005-08-11 20:13:26 UTC (rev 17302) @@ -49,7 +49,7 @@ DeviceExtension = (POHCI_DEVICE_EXTENSION)Pdo->DeviceExtension; RtlZeroMemory(DeviceExtension, sizeof(OHCI_DEVICE_EXTENSION)); - DeviceExtension->IsFDO = false; + DeviceExtension->IsFDO = FALSE; DeviceExtension->FunctionalDeviceObject = Fdo; Pdo->Flags &= ~DO_DEVICE_INITIALIZING;
19 years, 4 months
1
0
0
0
[hpoussin] 17301: Add DIF_* codes 40 to 42.
by hpoussin@svn.reactos.com
Add DIF_* codes 40 to 42. Reformat the whole list to align values Modified: trunk/reactos/w32api/include/setupapi.h _____ Modified: trunk/reactos/w32api/include/setupapi.h --- trunk/reactos/w32api/include/setupapi.h 2005-08-11 20:13:06 UTC (rev 17300) +++ trunk/reactos/w32api/include/setupapi.h 2005-08-11 20:13:16 UTC (rev 17301) @@ -110,45 +110,48 @@ #define DICS_START 4 #define DICS_FLAG_CONFIGGENERAL 4 #define DICS_STOP 5 -#define DIF_SELECTDEVICE 1 -#define DIF_INSTALLDEVICE 2 -#define DIF_ASSIGNRESOURCES 3 -#define DIF_PROPERTIES 4 -#define DIF_REMOVE 5 -#define DIF_FIRSTTIMESETUP 6 -#define DIF_FOUNDDEVICE 7 -#define DIF_SELECTCLASSDRIVERS 8 -#define DIF_VALIDATECLASSDRIVERS 9 -#define DIF_INSTALLCLASSDRIVERS 10 -#define DIF_CALCDISKSPACE 11 -#define DIF_DESTROYPRIVATEDATA 12 -#define DIF_VALIDATEDRIVER 13 -#define DIF_MOVEDEVICE 14 -#define DIF_DETECT 15 -#define DIF_INSTALLWIZARD 16 -#define DIF_DESTROYWIZARDDATA 17 -#define DIF_PROPERTYCHANGE 18 -#define DIF_ENABLECLASS 19 -#define DIF_DETECTVERIFY 20 -#define DIF_INSTALLDEVICEFILES 21 -#define DIF_UNREMOVE 22 -#define DIF_SELECTBESTCOMPATDRV 23 -#define DIF_ALLOW_INSTALL 24 -#define DIF_REGISTERDEVICE 25 -#define DIF_NEWDEVICEWIZARD_PRESELECT 26 -#define DIF_NEWDEVICEWIZARD_SELECT 27 -#define DIF_NEWDEVICEWIZARD_PREANALYZE 28 -#define DIF_NEWDEVICEWIZARD_POSTANALYZE 29 -#define DIF_NEWDEVICEWIZARD_FINISHINSTALL 30 -#define DIF_UNUSED1 31 -#define DIF_INSTALLINTERFACES 32 -#define DIF_DETECTCANCEL 33 -#define DIF_REGISTER_COINSTALLERS 34 -#define DIF_ADDPROPERTYPAGE_ADVANCED 35 -#define DIF_ADDPROPERTYPAGE_BASIC 36 -#define DIF_RESERVED1 37 -#define DIF_TROUBLESHOOTER 38 -#define DIF_POWERMESSAGEWAKE 39 +#define DIF_SELECTDEVICE 1 +#define DIF_INSTALLDEVICE 2 +#define DIF_ASSIGNRESOURCES 3 +#define DIF_PROPERTIES 4 +#define DIF_REMOVE 5 +#define DIF_FIRSTTIMESETUP 6 +#define DIF_FOUNDDEVICE 7 +#define DIF_SELECTCLASSDRIVERS 8 +#define DIF_VALIDATECLASSDRIVERS 9 +#define DIF_INSTALLCLASSDRIVERS 10 +#define DIF_CALCDISKSPACE 11 +#define DIF_DESTROYPRIVATEDATA 12 +#define DIF_VALIDATEDRIVER 13 +#define DIF_MOVEDEVICE 14 +#define DIF_DETECT 15 +#define DIF_INSTALLWIZARD 16 +#define DIF_DESTROYWIZARDDATA 17 +#define DIF_PROPERTYCHANGE 18 +#define DIF_ENABLECLASS 19 +#define DIF_DETECTVERIFY 20 +#define DIF_INSTALLDEVICEFILES 21 +#define DIF_UNREMOVE 22 +#define DIF_SELECTBESTCOMPATDRV 23 +#define DIF_ALLOW_INSTALL 24 +#define DIF_REGISTERDEVICE 25 +#define DIF_NEWDEVICEWIZARD_PRESELECT 26 +#define DIF_NEWDEVICEWIZARD_SELECT 27 +#define DIF_NEWDEVICEWIZARD_PREANALYZE 28 +#define DIF_NEWDEVICEWIZARD_POSTANALYZE 29 +#define DIF_NEWDEVICEWIZARD_FINISHINSTALL 30 +#define DIF_UNUSED1 31 +#define DIF_INSTALLINTERFACES 32 +#define DIF_DETECTCANCEL 33 +#define DIF_REGISTER_COINSTALLERS 34 +#define DIF_ADDPROPERTYPAGE_ADVANCED 35 +#define DIF_ADDPROPERTYPAGE_BASIC 36 +#define DIF_RESERVED1 37 +#define DIF_TROUBLESHOOTER 38 +#define DIF_POWERMESSAGEWAKE 39 +#define DIF_ADDREMOTEPROPERTYPAGE_ADVANCED 40 +#define DIF_UPDATEDRIVER_UI 41 +#define DIF_RESERVED2 42 #define DIGCF_DEFAULT 0x00000001 #define DIGCDP_FLAG_BASIC 0x00000001 #define DIGCF_PRESENT 0x00000002
19 years, 4 months
1
0
0
0
[hpoussin] 17300: Move usb controllers and cdrom classes parameters to their own .inf files. They would be regenerated during 2nd stage setup
by hpoussin@svn.reactos.com
Move usb controllers and cdrom classes parameters to their own .inf files. They would be regenerated during 2nd stage setup Fix a typo in mouse.inf Modified: trunk/reactos/bootdata/hivesys.inf Modified: trunk/reactos/bootdata/packages/reactos.dff Added: trunk/reactos/media/inf/cdrom.inf Modified: trunk/reactos/media/inf/inf.xml Modified: trunk/reactos/media/inf/mouse.inf Modified: trunk/reactos/media/inf/syssetup.inf Added: trunk/reactos/media/inf/usbport.inf _____ Modified: trunk/reactos/bootdata/hivesys.inf --- trunk/reactos/bootdata/hivesys.inf 2005-08-11 19:52:33 UTC (rev 17299) +++ trunk/reactos/bootdata/hivesys.inf 2005-08-11 20:13:06 UTC (rev 17300) @@ -4,17 +4,6 @@ [AddReg] ; Device classes (this list is incomplete... and should be generated from .inf files during installation) -HKLM,"SYSTEM\CurrentControlSet\Control\Class\{36FC9E60-C465-11CF-8056-4 44553540000}",,0x00000000,"USB Controllers" -HKLM,"SYSTEM\CurrentControlSet\Control\Class\{36FC9E60-C465-11CF-8056-4 44553540000}","Class",0x00000000,"USB" -HKLM,"SYSTEM\CurrentControlSet\Control\Class\{36FC9E60-C465-11CF-8056-4 44553540000}","Icon",0x00000000,"-20" -HKLM,"SYSTEM\CurrentControlSet\Control\Class\{36FC9E60-C465-11CF-8056-4 44553540000}","NoInstallClass",0x00000000,"1" - -HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E965-E325-11CE-BFC1-0 8002BE10318}",,0x00000000,"DVD/CD-ROM drives" -HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E965-E325-11CE-BFC1-0 8002BE10318}","Class",0x00000000,"CDROM" -HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E965-E325-11CE-BFC1-0 8002BE10318}","EnumPropPages32",0x00000000,"MmSys.Cpl,MediaPropPageProvi der" -HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E965-E325-11CE-BFC1-0 8002BE10318}","Icon",0x00000000,"-20" -HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E965-E325-11CE-BFC1-0 8002BE10318}","NoInstallClass",0x00000000,"1" - HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E973-E325-11CE-BFC1-08 002BE10318}",,0x00000000,"Network Client" HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E973-E325-11CE-BFC1-08 002BE10318}","Class",0x00000000,"NetClient" HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E973-E325-11CE-BFC1-08 002BE10318}","Icon",0x00000000,"-7" _____ Modified: trunk/reactos/bootdata/packages/reactos.dff --- trunk/reactos/bootdata/packages/reactos.dff 2005-08-11 19:52:33 UTC (rev 17299) +++ trunk/reactos/bootdata/packages/reactos.dff 2005-08-11 20:13:06 UTC (rev 17300) @@ -268,9 +268,11 @@ media\nls\c_28598.nls 1 media\nls\c_28599.nls 1 media\drivers\etc\services 5 +media\inf\cdrom.inf 6 media\inf\NET_NIC.inf 6 media\inf\layout.inf 6 media\inf\mouse.inf 6 media\inf\ports.inf 6 media\inf\scsi.inf 6 media\inf\syssetup.inf 6 +media\inf\usbport.inf 6 _____ Added: trunk/reactos/media/inf/cdrom.inf --- trunk/reactos/media/inf/cdrom.inf 2005-08-11 19:52:33 UTC (rev 17299) +++ trunk/reactos/media/inf/cdrom.inf 2005-08-11 20:13:06 UTC (rev 17300) @@ -0,0 +1,30 @@ +; CDROM.INF + +; Installation of CDROMs + +[Version] +Signature = "$Windows NT$" +;Signature = "$ReactOS$" +LayoutFile = layout.inf +Class = CDROM +ClassGUID = {4D36E965-E325-11CE-BFC1-08002BE10318} +Provider = %ReactOS% +DriverVer = 10/19/1999,5.00.2157.1 + +[DestinationDirs] +DefaultDestDir = 12 + +[ClassInstall32.NT] +AddReg = CDROMClass.NT.AddReg + +[CDROMClass.NT.AddReg] +HKR, , , 0, %CDROMClassName% +HKR, , EnumPropPages32,0, "MmSys.Cpl,MediaPropPageProvider" +HKR, , Icon, 0, "-51" +HKR, , NoInstallClass, 0, 1 + +;-------------------------------- STRINGS ------------------------------- + +[Strings] +ReactOS = "ReactOS Team" +CDROMClassName = "DVD/CD-ROM drives" \ No newline at end of file _____ Modified: trunk/reactos/media/inf/inf.xml --- trunk/reactos/media/inf/inf.xml 2005-08-11 19:52:33 UTC (rev 17299) +++ trunk/reactos/media/inf/inf.xml 2005-08-11 20:13:06 UTC (rev 17300) @@ -1,3 +1,4 @@ +<installfile base="inf">cdrom.inf</installfile> <installfile base="inf">layout.inf</installfile> <installfile base="inf">mouse.inf</installfile> <installfile base="inf">NET_NIC.inf</installfile> @@ -4,3 +5,4 @@ <installfile base="inf">ports.inf</installfile> <installfile base="inf">scsi.inf</installfile> <installfile base="inf">syssetup.inf</installfile> +<installfile base="inf">usbport.inf</installfile> \ No newline at end of file _____ Modified: trunk/reactos/media/inf/mouse.inf --- trunk/reactos/media/inf/mouse.inf 2005-08-11 19:52:33 UTC (rev 17299) +++ trunk/reactos/media/inf/mouse.inf 2005-08-11 20:13:06 UTC (rev 17300) @@ -25,7 +25,7 @@ [Manufacturer] %StdMfg% = StdMfg -%LogMfg% = LogMsf +%LogMfg% = LogMfg %MSMfg% = MSMfg [StdMfg] _____ Modified: trunk/reactos/media/inf/syssetup.inf --- trunk/reactos/media/inf/syssetup.inf 2005-08-11 19:52:33 UTC (rev 17299) +++ trunk/reactos/media/inf/syssetup.inf 2005-08-11 20:13:06 UTC (rev 17300) @@ -14,7 +14,9 @@ [DeviceInfsToInstall] ; MS uses netnovel.inf as class-installer INF for NICs ; we use a separate one to keep things clean +cdrom.inf mouse.inf NET_NIC.inf ports.inf scsi.inf +usbport.inf \ No newline at end of file _____ Added: trunk/reactos/media/inf/usbport.inf --- trunk/reactos/media/inf/usbport.inf 2005-08-11 19:52:33 UTC (rev 17299) +++ trunk/reactos/media/inf/usbport.inf 2005-08-11 20:13:06 UTC (rev 17300) @@ -0,0 +1,126 @@ +; USBPORT.INF + +; Installation of USB controllers + +[Version] +Signature = "$Windows NT$" +;Signature = "$ReactOS$" +LayoutFile = layout.inf +Class = USB +ClassGUID = {36FC9E60-C465-11CF-8056-444553540000} +Provider = %ReactOS% +DriverVer = 10/19/1999,5.00.2157.1 + +[DestinationDirs] +DefaultDestDir = 12 + +[ClassInstall32.NT] +AddReg = USBClass.NT.AddReg + +[USBClass.NT.AddReg] +HKR, , , 0, %USBClassName% +HKR, , Icon, 0, "-20" +HKR, , NoInstallClass, 0, 1 + +[Manufacturer] +%GenericMfg% = GenericMfg +%IntelMfg% = IntelMfg + +[GenericMfg] +%PCI\CC_0C0300.DeviceDesc%=UHCI_Inst,PCI\CC_0C0300 +%PCI\CC_0C0310.DeviceDesc%=OHCI_Inst,PCI\CC_0C0310 +%PCI\CC_0C0320.DeviceDesc%=EHCI_Inst,PCI\CC_0C0320 +%USB\ROOT_HUB.DeviceDesc%=RootHub_Inst,USB\ROOT_HUB + +[IntelMfg] +%PCI\VEN_8086&DEV_7112&CC_0C0300.DeviceDesc%=UHCI_Inst,PCI\VEN_8086&DEV _7112&CC_0C0300 + +;------------------------------ UHCI DRIVER ----------------------------- + +[UHCI_Inst.NT] +CopyFiles = UHCI_CopyFiles + +[UHCI_CopyFiles.NT] +usbcore.sys +usbuhci.sys + +[UHCI_Inst.NT.Services] +AddService = usbuhci, 0x00000002, usbuhci_Service_Inst + +[usbuhci_Service_Inst] +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\usbuhci.sys +LoadOrderGroup = Base + +;------------------------------ OHCI DRIVER ----------------------------- + +[OHCI_Inst.NT] +CopyFiles = OHCI_CopyFiles + +[OHCI_CopyFiles.NT] +usbcore.sys +usbohci.sys + +[OHCI_Inst.NT.Services] +AddService = usbohci, 0x00000002, usbohci_Service_Inst + +[usbohci_Service_Inst] +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\usbohci.sys +LoadOrderGroup = Base + +;------------------------------ EHCI DRIVER ----------------------------- + +[EHCI_Inst.NT] +CopyFiles = EHCI_CopyFiles + +[EHCI_CopyFiles.NT] +usbcore.sys +usbehci.sys + +[EHCI_Inst.NT.Services] +AddService = usbehci, 0x00000002, usbehci_Service_Inst + +[usbehci_Service_Inst] +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\usbehci.sys +LoadOrderGroup = Base + +;---------------------------- ROOT HUB DRIVER --------------------------- + +[RootHub_Inst.NT] +CopyFiles = RootHub_CopyFiles + +[RootHub_CopyFiles.NT] +usbhub.sys + +[RootHub_Inst.NT.Services] +AddService = usbhub, 0x00000002, usbhub_Service_Inst + +[usbhub_Service_Inst] +ServiceType = 1 +StartType = 3 +ErrorControl = 1 +ServiceBinary = %12%\usbhub.sys +LoadOrderGroup = Base + +;-------------------------------- STRINGS ------------------------------- + +[Strings] +ReactOS = "ReactOS Team" +USBClassName = "USB Controllers" + +GenericMfg = "(Generic USB devices)" +PCI\CC_0C0300.DeviceDesc = "UHCI USB controller" +PCI\CC_0C0310.DeviceDesc = "OHCI USB controller" +PCI\CC_0C0320.DeviceDesc = "EHCI USB controller" +USB\ROOT_HUB.DeviceDesc = "Root hub" + +IntelMfg = "Intel" +PCI\VEN_8086&DEV_7112&CC_0C0300.DeviceDesc = "Intel 82371AB/EB/MB PIIX4 USB controller" \ No newline at end of file
19 years, 4 months
1
0
0
0
[hbirr] 17299: Initialized the cnt value of the file structure.
by hbirr@svn.reactos.com
Initialized the cnt value of the file structure. Modified: trunk/reactos/lib/crt/stdio/vfprintf.c _____ Modified: trunk/reactos/lib/crt/stdio/vfprintf.c --- trunk/reactos/lib/crt/stdio/vfprintf.c 2005-08-11 19:49:47 UTC (rev 17298) +++ trunk/reactos/lib/crt/stdio/vfprintf.c 2005-08-11 19:52:33 UTC (rev 17299) @@ -22,7 +22,7 @@ if (f->_flag & _IONBF) { f->_flag &= ~_IONBF; f->_ptr = f->_base = localbuf; - f->_bufsiz = BUFSIZ; + f->_bufsiz = f->_cnt = BUFSIZ; len = __vfprintf(f, fmt, ap); (void)fflush(f); f->_flag |= _IONBF;
19 years, 4 months
1
0
0
0
← Newer
1
...
27
28
29
30
31
32
33
...
67
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
66
67
Results per page:
10
25
50
100
200