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
May 2007
----- 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
17 participants
322 discussions
Start a n
N
ew thread
[ion] 26817: - Implement NtDeleteKey as a simpler wrapper around CmDeleteKey. - Add cmkeydel.c to handle key deletion. Will proably move to cmkcbncb.c later. Implemented CmpMarkKeyDirty, CmpFreeKeyBody, CmpFreeKeyByCell. - Implement CmpMarkIndexDirty, CmpRemoveSubKey in cmindex.c. - Implement CmDeleteKey (which uses CmpFreeKeyByCell for all the work). - Remove CmiRemoveKeyFromList, CmiRemoveSubKey, CmiRemoveKeyFromHashTable, CmiSaveTempHive.
by ion@svn.reactos.org
Author: ion Date: Thu May 17 04:27:14 2007 New Revision: 26817 URL:
http://svn.reactos.org/svn/reactos?rev=26817&view=rev
Log: - Implement NtDeleteKey as a simpler wrapper around CmDeleteKey. - Add cmkeydel.c to handle key deletion. Will proably move to cmkcbncb.c later. Implemented CmpMarkKeyDirty, CmpFreeKeyBody, CmpFreeKeyByCell. - Implement CmpMarkIndexDirty, CmpRemoveSubKey in cmindex.c. - Implement CmDeleteKey (which uses CmpFreeKeyByCell for all the work). - Remove CmiRemoveKeyFromList, CmiRemoveSubKey, CmiRemoveKeyFromHashTable, CmiSaveTempHive. Added: trunk/reactos/ntoskrnl/config/cmkeydel.c Modified: trunk/reactos/lib/cmlib/hivecell.c trunk/reactos/ntoskrnl/cm/cm.h trunk/reactos/ntoskrnl/cm/ntfunc.c trunk/reactos/ntoskrnl/cm/regfile.c trunk/reactos/ntoskrnl/cm/regobj.c trunk/reactos/ntoskrnl/config/cm.h trunk/reactos/ntoskrnl/config/cmapi.c trunk/reactos/ntoskrnl/config/cmindex.c trunk/reactos/ntoskrnl/ntoskrnl.rbuild Modified: trunk/reactos/lib/cmlib/hivecell.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/hivecell.c?rev=2…
============================================================================== --- trunk/reactos/lib/cmlib/hivecell.c (original) +++ trunk/reactos/lib/cmlib/hivecell.c Thu May 17 04:27:14 2007 @@ -221,7 +221,7 @@ pFreeCellOffset = FreeCellData; } - ASSERT(FALSE); + //ASSERT(FALSE); } static HCELL_INDEX CMAPI Modified: trunk/reactos/ntoskrnl/cm/cm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/cm.h?rev=26817…
============================================================================== --- trunk/reactos/ntoskrnl/cm/cm.h (original) +++ trunk/reactos/ntoskrnl/cm/cm.h Thu May 17 04:27:14 2007 @@ -168,9 +168,6 @@ IN PKEY_OBJECT NewKey); NTSTATUS -CmiRemoveKeyFromList(IN PKEY_OBJECT NewKey); - -NTSTATUS CmiScanKeyList(IN PKEY_OBJECT Parent, IN PUNICODE_STRING KeyName, IN ULONG Attributes, @@ -183,9 +180,6 @@ NTSTATUS CmiFlushRegistryHive(PEREGISTRY_HIVE RegistryHive); - -ULONG -CmiGetNumberOfSubKeys(PKEY_OBJECT KeyObject); ULONG CmiGetMaxNameLength(IN PHHIVE RegistryHive, IN PCM_KEY_NODE KeyCell); @@ -220,11 +214,6 @@ IN ULONG CreateOptions); NTSTATUS -CmiRemoveSubKey(IN PEREGISTRY_HIVE RegistryHive, - IN PKEY_OBJECT Parent, - IN PKEY_OBJECT SubKey); - -NTSTATUS CmiScanKeyForValue(IN PEREGISTRY_HIVE RegistryHive, IN PCM_KEY_NODE KeyCell, IN PUNICODE_STRING ValueName, @@ -280,6 +269,10 @@ IN PULONG ResultLength); NTSTATUS +NTAPI +CmDeleteKey(IN PKEY_OBJECT KeyObject); + +NTSTATUS CmiAllocateHashTableCell(IN PEREGISTRY_HIVE RegistryHive, OUT PHASH_TABLE_CELL *HashBlock, OUT HCELL_INDEX *HBOffset, @@ -295,16 +288,6 @@ HCELL_INDEX NKBOffset); NTSTATUS -CmiRemoveKeyFromHashTable(PEREGISTRY_HIVE RegistryHive, - PHASH_TABLE_CELL HashBlock, - HCELL_INDEX NKBOffset); - -NTSTATUS -CmiDestroyValueCell(PEREGISTRY_HIVE RegistryHive, - PCM_KEY_VALUE ValueCell, - HCELL_INDEX VBOffset); - -NTSTATUS CmiConnectHive(POBJECT_ATTRIBUTES KeyObjectAttributes, PEREGISTRY_HIVE RegistryHive); @@ -329,10 +312,6 @@ VOID CmiSyncHives(VOID); - -NTSTATUS -CmiSaveTempHive (PEREGISTRY_HIVE Hive, - HANDLE FileHandle); NTSTATUS NTAPI Modified: trunk/reactos/ntoskrnl/cm/ntfunc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/ntfunc.c?rev=2…
============================================================================== --- trunk/reactos/ntoskrnl/cm/ntfunc.c (original) +++ trunk/reactos/ntoskrnl/cm/ntfunc.c Thu May 17 04:27:14 2007 @@ -435,115 +435,6 @@ return Status; } - -NTSTATUS STDCALL -NtDeleteKey(IN HANDLE KeyHandle) -{ - KPROCESSOR_MODE PreviousMode; - PKEY_OBJECT KeyObject; - NTSTATUS Status; - REG_DELETE_KEY_INFORMATION DeleteKeyInfo; - REG_POST_OPERATION_INFORMATION PostOperationInfo; - - PAGED_CODE(); - - DPRINT("NtDeleteKey(KeyHandle 0x%p) called\n", KeyHandle); - - PreviousMode = ExGetPreviousMode(); - - /* Verify that the handle is valid and is a registry key */ - Status = ObReferenceObjectByHandle(KeyHandle, - DELETE, - CmpKeyObjectType, - PreviousMode, - (PVOID *)&KeyObject, - NULL); - if (!NT_SUCCESS(Status)) - { - DPRINT1("ObReferenceObjectByHandle() failed (Status %lx)\n", Status); - return Status; - } - - PostOperationInfo.Object = (PVOID)KeyObject; - DeleteKeyInfo.Object = (PVOID)KeyObject; - Status = CmiCallRegisteredCallbacks(RegNtPreDeleteKey, &DeleteKeyInfo); - if (!NT_SUCCESS(Status)) - { - PostOperationInfo.Status = Status; - CmiCallRegisteredCallbacks(RegNtPostDeleteKey, &PostOperationInfo); - ObDereferenceObject(KeyObject); - return Status; - } - - /* Acquire hive lock */ - KeEnterCriticalRegion(); - ExAcquireResourceExclusiveLite(&CmpRegistryLock, TRUE); - - VERIFY_KEY_OBJECT(KeyObject); - - /* Check for subkeys */ - if (KeyObject->KeyCell->SubKeyCounts[HvStable] != 0 || - KeyObject->KeyCell->SubKeyCounts[HvVolatile] != 0) - { - Status = STATUS_CANNOT_DELETE; - } - else - { - PKEY_OBJECT ParentKeyObject = KeyObject->ParentKey; - - if (!NT_SUCCESS(CmiRemoveKeyFromList(KeyObject))) - { - DPRINT1("Key not found in parent list ???\n"); - } - - CmiRemoveSubKey(KeyObject->RegistryHive, - ParentKeyObject, - KeyObject); - - KeQuerySystemTime (&ParentKeyObject->KeyCell->LastWriteTime); - HvMarkCellDirty(&ParentKeyObject->RegistryHive->Hive, - ParentKeyObject->KeyCellOffset); - - if (!IsNoFileHive (KeyObject->RegistryHive) || - !IsNoFileHive (ParentKeyObject->RegistryHive)) - { - CmiSyncHives (); - } - - Status = STATUS_SUCCESS; - } - - /* Release hive lock */ - ExReleaseResourceLite(&CmpRegistryLock); - KeLeaveCriticalRegion(); - - DPRINT("PointerCount %lu\n", ObGetObjectPointerCount((PVOID)KeyObject)); - - /* Remove the keep-alive reference */ - ObDereferenceObject(KeyObject); - - if (KeyObject->RegistryHive != KeyObject->ParentKey->RegistryHive) - ObDereferenceObject(KeyObject); - - PostOperationInfo.Status = Status; - CmiCallRegisteredCallbacks(RegNtPostDeleteKey, &PostOperationInfo); - - /* Dereference the object */ - ObDereferenceObject(KeyObject); - - DPRINT("PointerCount %lu\n", ObGetObjectPointerCount((PVOID)KeyObject)); - DPRINT("HandleCount %lu\n", ObGetObjectHandleCount((PVOID)KeyObject)); - - /* - * Note: - * Hive-Synchronization will not be triggered here. This is done in - * CmpDeleteKeyObject() (in regobj.c) after all key-related structures - * have been released. - */ - - return Status; -} - NTSTATUS STDCALL NtFlushKey(IN HANDLE KeyHandle) { @@ -810,6 +701,52 @@ CmiRegistryInitialized = TRUE; return Status; +} + +NTSTATUS +NTAPI +NtDeleteKey(IN HANDLE KeyHandle) +{ + PKEY_OBJECT KeyObject; + NTSTATUS Status; + REG_DELETE_KEY_INFORMATION DeleteKeyInfo; + REG_POST_OPERATION_INFORMATION PostOperationInfo; + PAGED_CODE(); + + /* Verify that the handle is valid and is a registry key */ + Status = ObReferenceObjectByHandle(KeyHandle, + DELETE, + CmpKeyObjectType, + ExGetPreviousMode(), + (PVOID *)&KeyObject, + NULL); + if (!NT_SUCCESS(Status)) return Status; + + /* Setup the callback */ + PostOperationInfo.Object = (PVOID)KeyObject; + DeleteKeyInfo.Object = (PVOID)KeyObject; + Status = CmiCallRegisteredCallbacks(RegNtPreDeleteKey, &DeleteKeyInfo); + if (NT_SUCCESS(Status)) + { + /* Call the internal API */ + Status = CmDeleteKey(KeyObject); + + /* Remove the keep-alive reference */ + ObDereferenceObject(KeyObject); + if (KeyObject->RegistryHive != KeyObject->ParentKey->RegistryHive) + { + /* Dereference again */ + ObDereferenceObject(KeyObject); + } + + /* Do post callback */ + PostOperationInfo.Status = Status; + CmiCallRegisteredCallbacks(RegNtPostDeleteKey, &PostOperationInfo); + } + + /* Dereference the object */ + ObDereferenceObject(KeyObject); + return Status; } NTSTATUS Modified: trunk/reactos/ntoskrnl/cm/regfile.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/regfile.c?rev=…
============================================================================== --- trunk/reactos/ntoskrnl/cm/regfile.c (original) +++ trunk/reactos/ntoskrnl/cm/regfile.c Thu May 17 04:27:14 2007 @@ -66,7 +66,6 @@ ZwClose(RegistryHive->LogHandle); } - NTSTATUS CmiFlushRegistryHive(PEREGISTRY_HIVE RegistryHive) { @@ -103,26 +102,6 @@ return Success ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL; } - -ULONG -CmiGetNumberOfSubKeys(PKEY_OBJECT KeyObject) -{ - PCM_KEY_NODE KeyCell; - ULONG SubKeyCount; - - VERIFY_KEY_OBJECT(KeyObject); - - KeyCell = KeyObject->KeyCell; - VERIFY_KEY_CELL(KeyCell); - - SubKeyCount = (KeyCell == NULL) ? 0 : - KeyCell->SubKeyCounts[HvStable] + - KeyCell->SubKeyCounts[HvVolatile]; - - return SubKeyCount; -} - - ULONG CmiGetMaxNameLength(PHHIVE Hive, PCM_KEY_NODE KeyCell) @@ -160,7 +139,6 @@ return MaxName; } - ULONG CmiGetMaxClassLength(PHHIVE Hive, PCM_KEY_NODE KeyCell) @@ -195,7 +173,6 @@ return MaxClass; } - ULONG CmiGetMaxValueNameLength(PHHIVE Hive, @@ -243,7 +220,6 @@ return MaxValueName; } - ULONG CmiGetMaxValueDataLength(PHHIVE Hive, @@ -518,109 +494,6 @@ } NTSTATUS -CmiRemoveSubKey(PEREGISTRY_HIVE RegistryHive, - PKEY_OBJECT ParentKey, - PKEY_OBJECT SubKey) -{ - PHASH_TABLE_CELL HashBlock; - PVALUE_LIST_CELL ValueList; - PCM_KEY_VALUE ValueCell; - HV_STORAGE_TYPE Storage; - ULONG i; - - DPRINT("CmiRemoveSubKey() called\n"); - - Storage = (SubKey->KeyCell->Flags & REG_KEY_VOLATILE_CELL) ? HvVolatile : HvStable; - - /* Remove all values */ - if (SubKey->KeyCell->ValueList.Count != 0) - { - /* Get pointer to the value list cell */ - ValueList = HvGetCell (&RegistryHive->Hive, SubKey->KeyCell->ValueList.List); - - /* Enumerate all values */ - for (i = 0; i < SubKey->KeyCell->ValueList.Count; i++) - { - /* Get pointer to value cell */ - ValueCell = HvGetCell(&RegistryHive->Hive, - ValueList->ValueOffset[i]); - - if (!(ValueCell->DataSize & REG_DATA_IN_OFFSET) - && ValueCell->DataSize > sizeof(HCELL_INDEX) - && ValueCell->DataOffset != HCELL_NULL) - { - /* Destroy data cell */ - HvFreeCell (&RegistryHive->Hive, ValueCell->DataOffset); - } - - /* Destroy value cell */ - HvFreeCell (&RegistryHive->Hive, ValueList->ValueOffset[i]); - } - - /* Destroy value list cell */ - HvFreeCell (&RegistryHive->Hive, SubKey->KeyCell->ValueList.List); - - SubKey->KeyCell->ValueList.Count = 0; - SubKey->KeyCell->ValueList.List = (HCELL_INDEX)-1; - - HvMarkCellDirty(&RegistryHive->Hive, SubKey->KeyCellOffset); - } - - /* Remove the key from the parent key's hash block */ - if (ParentKey->KeyCell->SubKeyLists[Storage] != HCELL_NULL) - { - DPRINT("ParentKey SubKeyLists %lx\n", ParentKey->KeyCell->SubKeyLists[Storage]); - HashBlock = HvGetCell (&ParentKey->RegistryHive->Hive, - ParentKey->KeyCell->SubKeyLists[Storage]); - ASSERT(HashBlock->Id == REG_HASH_TABLE_CELL_ID); - DPRINT("ParentKey HashBlock %p\n", HashBlock); - CmiRemoveKeyFromHashTable(ParentKey->RegistryHive, - HashBlock, - SubKey->KeyCellOffset); - HvMarkCellDirty(&ParentKey->RegistryHive->Hive, - ParentKey->KeyCell->SubKeyLists[Storage]); - } - - /* Remove the key's hash block */ - if (SubKey->KeyCell->SubKeyLists[Storage] != HCELL_NULL) - { - DPRINT("SubKey SubKeyLists %lx\n", SubKey->KeyCell->SubKeyLists[Storage]); - HvFreeCell (&RegistryHive->Hive, SubKey->KeyCell->SubKeyLists[Storage]); - SubKey->KeyCell->SubKeyLists[Storage] = HCELL_NULL; - } - - /* Decrement the number of the parent key's sub keys */ - if (ParentKey != NULL) - { - DPRINT("ParentKey %p\n", ParentKey); - ParentKey->KeyCell->SubKeyCounts[Storage]--; - - /* Remove the parent key's hash table */ - if (ParentKey->KeyCell->SubKeyCounts[Storage] == 0 && - ParentKey->KeyCell->SubKeyLists[Storage] != HCELL_NULL) - { - DPRINT("ParentKey SubKeyLists %lx\n", ParentKey->KeyCell->SubKeyLists); - HvFreeCell (&ParentKey->RegistryHive->Hive, - ParentKey->KeyCell->SubKeyLists[Storage]); - ParentKey->KeyCell->SubKeyLists[Storage] = HCELL_NULL; - } - - KeQuerySystemTime(&ParentKey->KeyCell->LastWriteTime); - HvMarkCellDirty(&ParentKey->RegistryHive->Hive, - ParentKey->KeyCellOffset); - } - - /* Destroy key cell */ - HvFreeCell (&RegistryHive->Hive, SubKey->KeyCellOffset); - SubKey->KeyCell = NULL; - SubKey->KeyCellOffset = (HCELL_INDEX)-1; - - DPRINT("CmiRemoveSubKey() done\n"); - - return STATUS_SUCCESS; -} - -NTSTATUS CmiAllocateHashTableCell (IN PEREGISTRY_HIVE RegistryHive, OUT PHASH_TABLE_CELL *HashBlock, OUT HCELL_INDEX *HBOffset, @@ -675,34 +548,4 @@ return STATUS_SUCCESS; } -NTSTATUS -CmiRemoveKeyFromHashTable(PEREGISTRY_HIVE RegistryHive, - PHASH_TABLE_CELL HashBlock, - HCELL_INDEX NKBOffset) -{ - ULONG i; - - for (i = 0; i < HashBlock->HashTableSize; i++) - { - if (HashBlock->Table[i].KeyOffset == NKBOffset) - { - RtlMoveMemory(HashBlock->Table + i, - HashBlock->Table + i + 1, - (HashBlock->HashTableSize - i - 1) * - sizeof(HashBlock->Table[0])); - return STATUS_SUCCESS; - } - } - - return STATUS_UNSUCCESSFUL; -} - -NTSTATUS -CmiSaveTempHive (PEREGISTRY_HIVE Hive, - HANDLE FileHandle) -{ - Hive->HiveHandle = FileHandle; - return HvWriteHive(&Hive->Hive) ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL; -} - /* EOF */ Modified: trunk/reactos/ntoskrnl/cm/regobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/regobj.c?rev=2…
============================================================================== --- trunk/reactos/ntoskrnl/cm/regobj.c (original) +++ trunk/reactos/ntoskrnl/cm/regobj.c Thu May 17 04:27:14 2007 @@ -633,20 +633,9 @@ RemoveEntryList(&KeyObject->ListEntry); RtlFreeUnicodeString(&KeyObject->Name); - if (!NT_SUCCESS(CmiRemoveKeyFromList(KeyObject))) - { - DPRINT1("Key not found in parent list ???\n"); - } - - - ASSERT((KeyObject->Flags & KO_MARKED_FOR_DELETE) == FALSE); + ASSERT((KeyObject->Flags & KO_MARKED_FOR_DELETE) == FALSE); ObDereferenceObject (ParentKeyObject); - - if (KeyObject->SubKeyCounts) - { - KEBUGCHECK(REGISTRY_ERROR); - } if (KeyObject->SizeOfSubKeys) { @@ -767,36 +756,6 @@ KernelMode); NewKey->ParentKey = ParentKey; } - - -NTSTATUS -CmiRemoveKeyFromList(PKEY_OBJECT KeyToRemove) -{ - PKEY_OBJECT ParentKey; - ULONG Index; - - ParentKey = KeyToRemove->ParentKey; - /* FIXME: If list maintained in alphabetic order, use dichotomic search */ - for (Index = 0; Index < ParentKey->SubKeyCounts; Index++) - { - if (ParentKey->SubKeys[Index] == KeyToRemove) - { - if (Index < ParentKey->SubKeyCounts-1) - RtlMoveMemory(&ParentKey->SubKeys[Index], - &ParentKey->SubKeys[Index + 1], - (ParentKey->SubKeyCounts - Index - 1) * sizeof(PKEY_OBJECT)); - ParentKey->SubKeyCounts--; - - DPRINT("Dereference parent key: 0x%x\n", ParentKey); - - ObDereferenceObject(ParentKey); - return STATUS_SUCCESS; - } - } - - return STATUS_UNSUCCESSFUL; -} - NTSTATUS CmiScanKeyList(PKEY_OBJECT Parent, Modified: trunk/reactos/ntoskrnl/config/cm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cm.h?rev=2…
============================================================================== --- trunk/reactos/ntoskrnl/config/cm.h (original) +++ trunk/reactos/ntoskrnl/config/cm.h Thu May 17 04:27:14 2007 @@ -693,6 +693,7 @@ #define SYSTEM_LOG_FILE L"\\SystemRoot\\System32\\Config\\SYSTEM.log" #define REG_SYSTEM_KEY_NAME L"\\Registry\\Machine\\SYSTEM" #define REG_HARDWARE_KEY_NAME L"\\Registry\\Machine\\HARDWARE" +#define IsNoFileHive(Hive) ((Hive)->Flags & HIVE_NO_FILE) typedef struct _EREGISTRY_HIVE { HHIVE Hive; @@ -1032,6 +1033,14 @@ IN ULONG Flags ); +NTSTATUS +NTAPI +CmpFreeKeyByCell( + IN PHHIVE Hive, + IN HCELL_INDEX Cell, + IN BOOLEAN Unlink +); + // // Name Functions // @@ -1129,6 +1138,22 @@ IN ULONG Hash, IN PUNICODE_STRING Name, IN BOOLEAN AllowSeparators +); + +BOOLEAN +NTAPI +CmpRemoveSubKey( + IN PHHIVE Hive, + IN HCELL_INDEX ParentKey, + IN HCELL_INDEX TargetKey +); + +BOOLEAN +NTAPI +CmpMarkIndexDirty( + IN PHHIVE Hive, + HCELL_INDEX ParentKey, + HCELL_INDEX TargetKey ); // Modified: trunk/reactos/ntoskrnl/config/cmapi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmapi.c?re…
============================================================================== --- trunk/reactos/ntoskrnl/config/cmapi.c (original) +++ trunk/reactos/ntoskrnl/config/cmapi.c Thu May 17 04:27:14 2007 @@ -983,3 +983,87 @@ KeLeaveCriticalRegion(); return Status; } + +NTSTATUS +NTAPI +CmDeleteKey(IN PKEY_OBJECT KeyObject) +{ + NTSTATUS Status; + PHHIVE Hive; + PCM_KEY_NODE Node, Parent; + HCELL_INDEX Cell, ParentCell; + + /* Acquire hive lock */ + KeEnterCriticalRegion(); + ExAcquireResourceExclusiveLite(&CmpRegistryLock, TRUE); + + /* Get the hive and node */ + Hive = &KeyObject->RegistryHive->Hive; + Cell = KeyObject->KeyCellOffset; + + /* Check if we have no parent */ + if (!KeyObject->ParentKey) + { + /* This is an attempt to delete \Registry itself! */ + Status = STATUS_CANNOT_DELETE; + goto Quickie; + } + + /* Get the key node */ + Node = (PCM_KEY_NODE)HvGetCell(Hive, Cell); + if (!Node) + { + /* Fail */ + Status = STATUS_INSUFFICIENT_RESOURCES; + goto Quickie; + } + + /* Check if we don't have any children */ + if (!(Node->SubKeyCounts[HvStable] + Node->SubKeyCounts[HvVolatile])) + { + /* Get the parent and free the cell */ + ParentCell = Node->Parent; + Status = CmpFreeKeyByCell(Hive, Cell, TRUE); + if (NT_SUCCESS(Status)) + { + /* Get the parent node */ + Parent = (PCM_KEY_NODE)HvGetCell(Hive, ParentCell); + if (Parent) + { + /* Make sure we're dirty */ + ASSERT(HvIsCellDirty(Hive, ParentCell)); + + /* Update the write time */ + KeQuerySystemTime(&Parent->LastWriteTime); + + /* Release the cell */ + HvReleaseCell(Hive, ParentCell); + } + + /* Clear the cell */ + KeyObject->KeyCellOffset = HCELL_NIL; + } + } + else + { + /* Fail */ + Status = STATUS_CANNOT_DELETE; + } + +Quickie: + /* Release the cell */ + HvReleaseCell(Hive, Cell); + + /* Make sure we're file-backed */ + if (!(IsNoFileHive(KeyObject->RegistryHive)) || + !(IsNoFileHive(KeyObject->ParentKey->RegistryHive))) + { + /* Sync up the hives */ + CmiSyncHives(); + } + + /* Release hive lock */ + ExReleaseResourceLite(&CmpRegistryLock); + KeLeaveCriticalRegion(); + return Status; +} Modified: trunk/reactos/ntoskrnl/config/cmindex.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmindex.c?…
============================================================================== --- trunk/reactos/ntoskrnl/config/cmindex.c (original) +++ trunk/reactos/ntoskrnl/config/cmindex.c Thu May 17 04:27:14 2007 @@ -703,12 +703,6 @@ { /* Get the Index */ IndexRoot = (PCM_KEY_INDEX)HvGetCell(Hive, Parent->SubKeyLists[i]); -#if 0 - /* Make sure we have one and that the cell is allocated */ - ASSERT((IndexRoot == NULL) || - HvIsCellAllocated(Hive, Parent->SubKeyLists[i])); -#endif - /* Fail if we don't actually have an index root */ if (!IndexRoot) return HCELL_NIL; /* Get the cell we'll need to release */ @@ -777,3 +771,343 @@ /* If we got here, then we failed */ return HCELL_NIL; } + +BOOLEAN +NTAPI +CmpMarkIndexDirty(IN PHHIVE Hive, + IN HCELL_INDEX ParentKey, + IN HCELL_INDEX TargetKey) +{ + PCM_KEY_NODE Node; + UNICODE_STRING SearchName; + BOOLEAN IsCompressed; + ULONG i, Result; + PCM_KEY_INDEX Index; + HCELL_INDEX IndexCell, Child = HCELL_NIL, CellToRelease = HCELL_NIL; + + /* Get the target key node */ + Node = (PCM_KEY_NODE)HvGetCell(Hive, TargetKey); + if (!Node) return FALSE; + + /* Check if it's compressed */ + if (Node->Flags & KEY_COMP_NAME) + { + /* Remember this for later */ + IsCompressed = TRUE; + + /* Build the search name */ + SearchName.Length = CmpCompressedNameSize(Node->Name, + Node->NameLength); + SearchName.MaximumLength = SearchName.Length; + SearchName.Buffer = ExAllocatePoolWithTag(PagedPool, + SearchName.Length, + TAG_CM); + if (!SearchName.Buffer) + { + /* Fail */ + HvReleaseCell(Hive, TargetKey); + return FALSE; + } + + /* Copy it */ + CmpCopyCompressedName(SearchName.Buffer, + SearchName.MaximumLength, + Node->Name, + Node->NameLength); + } + else + { + /* Name isn't compressed, build it directly from the node */ + IsCompressed = FALSE; + SearchName.Length = Node->NameLength; + SearchName.MaximumLength = Node->NameLength; + SearchName.Buffer = Node->Name; + } + + /* We can release the target key now */ + HvReleaseCell(Hive, TargetKey); + + /* Now get the parent key node */ + Node = (PCM_KEY_NODE)HvGetCell(Hive, ParentKey); + if (!Node) goto Quickie; + + /* Loop all hive storage */ + for (i = 0; i < Hive->StorageTypeCount; i++) + { + /* Check if any subkeys are in this index */ + if (Node->SubKeyCounts[i]) + { + /* Get the cell index */ + //ASSERT(HvIsCellAllocated(Hive, Node->SubKeyLists[i])); + IndexCell = Node->SubKeyLists[i]; + + /* Check if we had anything to release from before */ + if (CellToRelease != HCELL_NIL) + { + /* Release it now */ + HvReleaseCell(Hive, CellToRelease); + CellToRelease = HCELL_NIL; + } + + /* Get the key index for the cell */ + Index = (PCM_KEY_INDEX)HvGetCell(Hive, IndexCell); + if (!Index) goto Quickie; + + /* Release it at the next iteration or below */ + CellToRelease = IndexCell; + + /* Check if this is a root */ + if (Index->Signature == CM_KEY_INDEX_ROOT) + { + /* Get the child inside the root */ + Result = CmpFindSubKeyInRoot(Hive, Index, &SearchName, &Child); + if (Result & 0x80000000) goto Quickie; + if (Child == HCELL_NIL) continue; + + /* We found it, mark the cell dirty */ + HvMarkCellDirty(Hive, IndexCell); + + /* Check if we had anything to release from before */ + if (CellToRelease != HCELL_NIL) + { + /* Release it now */ + HvReleaseCell(Hive, CellToRelease); + CellToRelease = HCELL_NIL; + } + + /* Now this child is the index, get the actual key index */ + IndexCell = Child; + Index = (PCM_KEY_INDEX)HvGetCell(Hive, Child); + if (!Index) goto Quickie; + + /* Release it later */ + CellToRelease = Child; + } + + /* Make sure this is a valid index */ + ASSERT((Index->Signature == CM_KEY_INDEX_LEAF) || + (Index->Signature == CM_KEY_FAST_LEAF) || + (Index->Signature == CM_KEY_HASH_LEAF)); + + /* Find the child in the leaf */ + Result = CmpFindSubKeyInLeaf(Hive, Index, &SearchName, &Child); + if (Result & 0x80000000) goto Quickie; + if (Child != HCELL_NIL) + { + /* We found it, free the name now */ + if (IsCompressed) ExFreePool(SearchName.Buffer); + + /* Release the parent key */ + HvReleaseCell(Hive, ParentKey); + + /* Check if we had a left over cell to release */ + if (CellToRelease != HCELL_NIL) + { + /* Release it */ + HvReleaseCell(Hive, CellToRelease); + } + + /* And mark the index cell dirty */ + HvMarkCellDirty(Hive, IndexCell); + return TRUE; + } + } + } + +Quickie: + /* Release any cells that we still hold */ + if (Node) HvReleaseCell(Hive, ParentKey); + if (CellToRelease != HCELL_NIL) HvReleaseCell(Hive, CellToRelease); + + /* Free the search name and return failure */ + if (IsCompressed) ExFreePool(SearchName.Buffer); + return FALSE; +} + +BOOLEAN +NTAPI +CmpRemoveSubKey(IN PHHIVE Hive, + IN HCELL_INDEX ParentKey, + IN HCELL_INDEX TargetKey) +{ + PCM_KEY_NODE Node; + UNICODE_STRING SearchName; + BOOLEAN IsCompressed; + WCHAR Buffer[50]; + HCELL_INDEX RootCell = HCELL_NIL, LeafCell, ChildCell; + PCM_KEY_INDEX Root = NULL, Leaf; + PCM_KEY_FAST_INDEX Child; + ULONG Storage, RootIndex = 0x80000000, LeafIndex; + BOOLEAN Result = FALSE; + HCELL_INDEX CellToRelease1 = HCELL_NIL, CellToRelease2 = HCELL_NIL; + + /* Get the target key node */ + Node = (PCM_KEY_NODE)HvGetCell(Hive, TargetKey); + if (!Node) return FALSE; + + /* Make sure it's dirty, then release it */ + ASSERT(HvIsCellDirty(Hive, TargetKey)); + HvReleaseCell(Hive, TargetKey); + + /* Check if the name is compressed */ + if (Node->Flags & KEY_COMP_NAME) + { + /* Remember for later */ + IsCompressed = TRUE; + + /* Build the search name */ + SearchName.Length = CmpCompressedNameSize(Node->Name, + Node->NameLength); + SearchName.MaximumLength = SearchName.Length; + + /* Do we need an extra bufer? */ + if (SearchName.MaximumLength > sizeof(Buffer)) + { + /* Allocate one */ + SearchName.Buffer = ExAllocatePoolWithTag(PagedPool, + SearchName.Length, + TAG_CM); + if (!SearchName.Buffer) return FALSE; + } + else + { + /* Otherwise, use our local stack buffer */ + SearchName.Buffer = Buffer; + } + + /* Copy the compressed name */ + CmpCopyCompressedName(SearchName.Buffer, + SearchName.MaximumLength, + Node->Name, + Node->NameLength); + } + else + { + /* It's not compressed, build the name directly from the node */ + IsCompressed = FALSE; + SearchName.Length = Node->NameLength; + SearchName.MaximumLength = Node->NameLength; + SearchName.Buffer = Node->Name; + } + + /* Now get the parent node */ + Node = (PCM_KEY_NODE)HvGetCell(Hive, ParentKey); + if (!Node) goto Exit; + + /* Make sure it's dirty, then release it */ + ASSERT(HvIsCellDirty(Hive, ParentKey)); + HvReleaseCell(Hive, ParentKey); + + /* Get the storage type and make sure it's not empty */ + Storage = HvGetCellType(TargetKey); + ASSERT(Node->SubKeyCounts[Storage] != 0); + //ASSERT(HvIsCellAllocated(Hive, Node->SubKeyLists[Storage])); + + /* Get the leaf cell now */ + LeafCell = Node->SubKeyLists[Storage]; + Leaf = (PCM_KEY_INDEX)HvGetCell(Hive, LeafCell); + if (!Leaf) goto Exit; + + /* Remember to release it later */ + CellToRelease1 = LeafCell; + + /* Check if the leaf is a root */ + if (Leaf->Signature == CM_KEY_INDEX_ROOT) + { + /* Find the child inside the root */ + RootIndex = CmpFindSubKeyInRoot(Hive, Leaf, &SearchName, &ChildCell); + if (RootIndex & 0x80000000) goto Exit; + ASSERT(ChildCell != FALSE); + + /* The root cell is now this leaf */ + Root = Leaf; + RootCell = LeafCell; + + /* And the new leaf is now this child */ + LeafCell = ChildCell; + Leaf = (PCM_KEY_INDEX)HvGetCell(Hive, LeafCell); + if (!Leaf) goto Exit; + + /* Remember to release it later */ + CellToRelease2 = LeafCell; + } + + /* Make sure the leaf is valid */ + ASSERT((Leaf->Signature == CM_KEY_INDEX_LEAF) || + (Leaf->Signature == CM_KEY_FAST_LEAF) || + (Leaf->Signature == CM_KEY_HASH_LEAF)); + + /* Now get the child in the leaf */ + LeafIndex = CmpFindSubKeyInLeaf(Hive, Leaf, &SearchName, &ChildCell); + if (LeafIndex & 0x80000000) goto Exit; + ASSERT(ChildCell != HCELL_NIL); + + /* Decrement key counts and check if this was the last leaf entry */ + Node->SubKeyCounts[Storage]--; + if (!(--Leaf->Count)) + { + /* Free the leaf */ + HvFreeCell(Hive, LeafCell); + + /* Check if we were inside a root */ + if (Root) + { + /* Decrease the root count too, since the leaf is going away */ + if (!(--Root->Count)) + { + /* The root is gone too,n ow */ + HvFreeCell(Hive, RootCell); + Node->SubKeyLists[Storage] = HCELL_NIL; + } + else if (RootIndex < Root->Count) + { + /* Bring everything up by one */ + RtlMoveMemory(&Root->List[RootIndex], + &Root->List[RootIndex + 1], + (Root->Count - RootIndex) * sizeof(HCELL_INDEX)); + } + } + else + { + /* Otherwise, just clear the cell */ + Node->SubKeyLists[Storage] = HCELL_NIL; + } + } + else if (LeafIndex < Leaf->Count) + { + /* Was the leaf a normal index? */ + if (Leaf->Signature == CM_KEY_INDEX_LEAF) + { + /* Bring everything up by one */ + RtlMoveMemory(&Leaf->List[LeafIndex], + &Leaf->List[LeafIndex + 1], + (Leaf->Count - LeafIndex) * sizeof(HCELL_INDEX)); + } + else + { + /* This is a fast index, bring everything up by one */ + Child = (PCM_KEY_FAST_INDEX)Leaf; + RtlMoveMemory(&Child->List[LeafIndex], + &Child->List[LeafIndex+1], + (Child->Count - LeafIndex) * sizeof(CM_INDEX)); + } + } + + /* If we got here, now we're done */ + Result = TRUE; + +Exit: + /* Release any cells we may have been holding */ + if (CellToRelease1 != HCELL_NIL) HvReleaseCell(Hive, CellToRelease1); + if (CellToRelease2 != HCELL_NIL) HvReleaseCell(Hive, CellToRelease2); + + /* Check if the name was compressed and not inside our local buffer */ + if ((IsCompressed) && (SearchName.MaximumLength > sizeof(Buffer))) + { + /* Free the buffer we allocated */ + ExFreePool(SearchName.Buffer); + } + + /* Return the result */ + return Result; +} Added: trunk/reactos/ntoskrnl/config/cmkeydel.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmkeydel.c…
============================================================================== --- trunk/reactos/ntoskrnl/config/cmkeydel.c (added) +++ trunk/reactos/ntoskrnl/config/cmkeydel.c Thu May 17 04:27:14 2007 @@ -1,0 +1,221 @@ +/* + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory + * FILE: ntoskrnl/config/cmkeydel.c + * PURPOSE: Configuration Manager - Key Body Deletion + * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include "ntoskrnl.h" +#include "cm.h" +#define NDEBUG +#include "debug.h" + +/* FUNCTIONS *****************************************************************/ + +BOOLEAN +NTAPI +CmpMarkKeyDirty(IN PHHIVE Hive, + IN HCELL_INDEX Cell, + IN BOOLEAN CheckNoSubkeys) +{ + PCELL_DATA CellData, ListData, SecurityData, ValueData; + ULONG i; + + /* Get the cell data for our target */ + CellData = HvGetCell(Hive, Cell); + if (!CellData) return FALSE; + + /* Check if sanity checks requested */ + if (CheckNoSubkeys) + { + /* Do them */ + ASSERT(CellData->u.KeyNode.SubKeyCounts[HvStable] == 0); + ASSERT(CellData->u.KeyNode.SubKeyCounts[HvVolatile] == 0); + } + + /* If this is an exit hive, there's nothing to do */ + if (CellData->u.KeyNode.Flags & KEY_HIVE_EXIT) + { + /* Release the cell and get out */ + HvReleaseCell(Hive, Cell); + return TRUE; + } + + /* Otherwise, mark it dirty and release it */ + HvMarkCellDirty(Hive, Cell); + HvReleaseCell(Hive, Cell); + + /* Check if we have a class */ + if (CellData->u.KeyNode.Class != HCELL_NIL) + { + /* Mark it dirty */ + HvMarkCellDirty(Hive, CellData->u.KeyNode.Class); + } + + /* Check if we have security */ + if (CellData->u.KeyNode.Security != HCELL_NIL) + { + /* Mark it dirty */ + HvMarkCellDirty(Hive, CellData->u.KeyNode.Security); + + /* Get the security data and release it */ + SecurityData = HvGetCell(Hive, CellData->u.KeyNode.Security); + if (!SecurityData) ASSERT(FALSE); + HvReleaseCell(Hive, CellData->u.KeyNode.Security); + + /* Mark the security links dirty too */ + HvMarkCellDirty(Hive, SecurityData->u.KeySecurity.Flink); + HvMarkCellDirty(Hive, SecurityData->u.KeySecurity.Blink); + } + + /* Check if we have any values */ + if (CellData->u.KeyNode.ValueList.Count > 0) + { + /* Dirty the value list */ + HvMarkCellDirty(Hive, CellData->u.KeyNode.ValueList.List); + + /* Get the list data itself, and release it */ + ListData = HvGetCell(Hive, CellData->u.KeyNode.ValueList.List); + if (!ListData) ASSERT(FALSE); + HvReleaseCell(Hive, CellData->u.KeyNode.ValueList.List); + + /* Loop all values */ + for (i = 0; i < CellData->u.KeyNode.ValueList.Count; i++) + { + /* Dirty each value */ + HvMarkCellDirty(Hive, ListData->u.KeyList[i]); + + /* Get the value data and release it */ + ValueData = HvGetCell(Hive, ListData->u.KeyList[i]); + if (ValueData) ASSERT(FALSE); + HvReleaseCell(Hive,ListData->u.KeyList[i]); + + /* Mark the value data dirty too */ + if (!CmpMarkValueDataDirty(Hive, &ValueData->u.KeyValue)) + { + /* Failure */ + return FALSE; + } + } + } + + /* If this is an entry hive, we're done */ + if (CellData->u.KeyNode.Flags & KEY_HIVE_ENTRY) return TRUE; + + /* Otherwise mark the index dirty too */ + if (!CmpMarkIndexDirty(Hive, CellData->u.KeyNode.Parent, Cell)) + { + /* Failure */ + return FALSE; + } + + /* Finally, mark the parent dirty */ + HvMarkCellDirty(Hive, CellData->u.KeyNode.Parent); + return TRUE; +} + +BOOLEAN +NTAPI +CmpFreeKeyBody(IN PHHIVE Hive, + IN HCELL_INDEX Cell) +{ + PCELL_DATA CellData; + + /* Get the key node */ + CellData = HvGetCell(Hive, Cell); + if (!CellData) ASSERT(FALSE); + + /* Check if we can delete the child cells */ + if (!(CellData->u.KeyNode.Flags & KEY_HIVE_EXIT)) + { + /* Check if we have a security cell */ + if (CellData->u.KeyNode.Security != HCELL_NIL) + { + /* Free the security cell */ + HvFreeCell(Hive, CellData->u.KeyNode.Security); + } + + /* Check if we have a class */ + if (CellData->u.KeyNode.ClassLength > 0) + { + /* Free it */ + HvFreeCell(Hive, CellData->u.KeyNode.Class); + } + } + + /* Release and free the cell */ + HvReleaseCell(Hive, Cell); + HvFreeCell(Hive, Cell); + return TRUE; +} + +NTSTATUS +NTAPI +CmpFreeKeyByCell(IN PHHIVE Hive, + IN HCELL_INDEX Cell, + IN BOOLEAN Unlink) +{ + PCELL_DATA CellData, ParentData, ListData; + ULONG i; + BOOLEAN Result; + + /* Mark the entire key dirty */ + CmpMarkKeyDirty(Hive, Cell ,TRUE); + + /* Get the target node and release it */ + CellData = HvGetCell(Hive, Cell); + if (!CellData) ASSERT(FALSE); + HvReleaseCell(Hive, Cell); + + /* Make sure we don't have subkeys */ + ASSERT((CellData->u.KeyNode.SubKeyCounts[HvStable] + + CellData->u.KeyNode.SubKeyCounts[HvVolatile]) == 0); + + /* Check if we have to unlink */ + if (Unlink) + { + /* Remove the subkey */ + Result = CmpRemoveSubKey(Hive, CellData->u.KeyNode.Parent, Cell); + if (!Result) return STATUS_INSUFFICIENT_RESOURCES; + + /* Get the parent node and release it */ + ParentData = HvGetCell(Hive, CellData->u.KeyNode.Parent); + if (!ParentData) ASSERT(FALSE); + HvReleaseCell(Hive, CellData->u.KeyNode.Parent); + + /* Check if the parent node has no more subkeys */ + if (!(ParentData->u.KeyNode.SubKeyCounts[HvStable] + + ParentData->u.KeyNode.SubKeyCounts[HvVolatile])) + { + /* Then free the cached name/class lengths */ + ParentData->u.KeyNode.MaxNameLen = 0; + ParentData->u.KeyNode.MaxClassLen = 0; + } + } + + /* Check if we have any values */ + if (CellData->u.KeyNode.ValueList.Count > 0) + { + /* Get the value list and release it */ + ListData = HvGetCell(Hive, CellData->u.KeyNode.ValueList.List); + if (!ListData) ASSERT(FALSE); + HvReleaseCell(Hive, CellData->u.KeyNode.ValueList.List); + + /* Loop every value */ + for (i = 0; i < CellData->u.KeyNode.ValueList.Count; i++) + { + /* Free it */ + if (!CmpFreeValue(Hive, ListData->u.KeyList[i])) ASSERT(FALSE); + } + + /* Free the value list */ + HvFreeCell(Hive, CellData->u.KeyNode.ValueList.List); + } + + /* Free the key body itself, and then return our status */ + if (!CmpFreeKeyBody(Hive, Cell)) return STATUS_INSUFFICIENT_RESOURCES; + return STATUS_SUCCESS; +} Modified: trunk/reactos/ntoskrnl/ntoskrnl.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl.rbuild?r…
============================================================================== --- trunk/reactos/ntoskrnl/ntoskrnl.rbuild (original) +++ trunk/reactos/ntoskrnl/ntoskrnl.rbuild Thu May 17 04:27:14 2007 @@ -99,6 +99,7 @@ <file>cminit.c</file> <file>cmhook.c</file> <file>cmkcbncb.c</file> + <file>cmkeydel.c</file> <file>cmmapvw.c</file> <file>cmname.c</file> <file>cmparse.c</file>
17 years, 7 months
1
0
0
0
[greatlrd] 26816: fixing some smaller bugs found by the regress test
by greatlrd@svn.reactos.org
Author: greatlrd Date: Thu May 17 02:58:25 2007 New Revision: 26816 URL:
http://svn.reactos.org/svn/reactos?rev=26816&view=rev
Log: fixing some smaller bugs found by the regress test Modified: trunk/reactos/dll/directx/ddraw/Surface/createsurface.c trunk/reactos/dll/directx/ddraw/main.c trunk/reactos/dll/directx/ddraw/startup.c Modified: trunk/reactos/dll/directx/ddraw/Surface/createsurface.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Surface/…
============================================================================== --- trunk/reactos/dll/directx/ddraw/Surface/createsurface.c (original) +++ trunk/reactos/dll/directx/ddraw/Surface/createsurface.c Thu May 17 02:58:25 2007 @@ -81,6 +81,8 @@ desc.dwFlags = desc.dwFlags & DDSD_ALL; } + + /* more code will follow */ Modified: trunk/reactos/dll/directx/ddraw/main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/main.c?r…
============================================================================== --- trunk/reactos/dll/directx/ddraw/main.c (original) +++ trunk/reactos/dll/directx/ddraw/main.c Thu May 17 02:58:25 2007 @@ -40,11 +40,6 @@ */ DX_WINDBG_trace(); - /* check the pointer if it vaild to read from */ - if (IsBadWritePtr( lplpDD, sizeof( LPVOID )) ) - { - return DDERR_INVALIDPARAMS; - } /* check see if pUnkOuter is null or not */ if (pUnkOuter) @@ -74,12 +69,6 @@ this api is finish and is working as it should */ DX_WINDBG_trace(); - - /* check the pointer if it vaild to read from */ - if (IsBadWritePtr( lplpDD, sizeof( LPVOID )) ) - { - return DDERR_INVALIDPARAMS; - } /* check see if pUnkOuter is null or not */ if (pUnkOuter) Modified: trunk/reactos/dll/directx/ddraw/startup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/startup.…
============================================================================== --- trunk/reactos/dll/directx/ddraw/startup.c (original) +++ trunk/reactos/dll/directx/ddraw/startup.c Thu May 17 02:58:25 2007 @@ -25,12 +25,21 @@ Create_DirectDraw (LPGUID pGUID, LPDIRECTDRAW* pIface, REFIID id, BOOL ex) { - LPDDRAWI_DIRECTDRAW_INT This = (LPDDRAWI_DIRECTDRAW_INT)*pIface; + LPDDRAWI_DIRECTDRAW_INT This; DX_WINDBG_trace(); - if (This == NULL) - { + if ((IsBadReadPtr(pIface,sizeof(LPDIRECTDRAW))) || + (IsBadWritePtr(pIface,sizeof(LPDIRECTDRAW)))) + { + return DDERR_INVALIDPARAMS; + } + + This = (LPDDRAWI_DIRECTDRAW_INT)*pIface; + + if (IsBadReadPtr(This,sizeof(LPDIRECTDRAW))) + { + DX_STUB_str("1. no linking\n"); /* We do not have a DirectDraw interface, we need alloc it*/ LPDDRAWI_DIRECTDRAW_INT memThis; @@ -47,6 +56,7 @@ } else { + DX_STUB_str("2.linking\n"); /* We got the DirectDraw interface alloc and we need create the link */ LPDDRAWI_DIRECTDRAW_INT newThis; newThis = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT)); @@ -269,7 +279,7 @@ This->lpLcl->hDD = This->lpLcl->lpGbl->hDD; ddgbl.hDD = This->lpLcl->lpGbl->hDD; - DX_STUB_str("DD_OK"); + DX_STUB_str("DD_OK\n"); return DD_OK; } @@ -374,10 +384,13 @@ if (reenable == FALSE) { - ddgbl.lpDDCBtmp = DxHeapMemAlloc(sizeof(DDHAL_CALLBACKS)); - if ( ddgbl.lpDDCBtmp == NULL) - { - return DD_FALSE; + if (ddgbl.lpDDCBtmp == NULL) + { + ddgbl.lpDDCBtmp = DxHeapMemAlloc(sizeof(DDHAL_CALLBACKS)); + if ( ddgbl.lpDDCBtmp == NULL) + { + return DD_FALSE; + } } } else @@ -425,7 +438,7 @@ /* Alloc mpFourCC */ mpFourCC = NULL; - if (mHALInfo.ddCaps.dwNumFourCCCodes) + if (mHALInfo.ddCaps.dwNumFourCCCodes > 0 ) { mpFourCC = (DWORD *) DxHeapMemAlloc(sizeof(DWORD) * mHALInfo.ddCaps.dwNumFourCCCodes); if (mpFourCC == NULL) @@ -438,8 +451,7 @@ /* Alloc mpTextures */ mpTextures = NULL; - - if (mD3dDriverData.dwNumTextureFormats) + if (mD3dDriverData.dwNumTextureFormats > 0) { mpTextures = (DDSURFACEDESC*) DxHeapMemAlloc(sizeof(DDSURFACEDESC) * mD3dDriverData.dwNumTextureFormats); if (mpTextures == NULL)
17 years, 7 months
1
0
0
0
[mbosma] 26815: GetAvailableVidMem-Test
by mbosma@svn.reactos.org
Author: mbosma Date: Thu May 17 02:19:07 2007 New Revision: 26815 URL:
http://svn.reactos.org/svn/reactos?rev=26815&view=rev
Log: GetAvailableVidMem-Test Modified: trunk/rostests/dxtest/ddraw/testlist.cpp trunk/rostests/dxtest/ddraw/tests/CreateDDraw.cpp Modified: trunk/rostests/dxtest/ddraw/testlist.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dxtest/ddraw/testlist.cpp…
============================================================================== --- trunk/rostests/dxtest/ddraw/testlist.cpp (original) +++ trunk/rostests/dxtest/ddraw/testlist.cpp Thu May 17 02:19:07 2007 @@ -14,6 +14,7 @@ { { "IDirectDraw: COM Stuff", Test_CreateDDraw }, { "IDirectDraw: Display Modes", Test_DisplayModes }, + { "IDirectDraw: Available Video Memory", Test_GetAvailableVidMem }, { "IDirectDraw: Cooperative Levels", Test_SetCooperativeLevel }, { "IDirectDraw: CreateSurface", Test_CreateSurface }, }; Modified: trunk/rostests/dxtest/ddraw/tests/CreateDDraw.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dxtest/ddraw/tests/Create…
============================================================================== --- trunk/rostests/dxtest/ddraw/tests/CreateDDraw.cpp (original) +++ trunk/rostests/dxtest/ddraw/tests/CreateDDraw.cpp Thu May 17 02:19:07 2007 @@ -79,6 +79,32 @@ return TRUE; } +BOOL Test_GetAvailableVidMem (INT* passed, INT* failed) +{ + LPDIRECTDRAW7 DirectDraw; + + /* Preparations */ + if (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL) != DD_OK) + { + printf("ERROR: Failed to set up ddraw\n"); + return FALSE; + } + + /* Here we go */ + DWORD Total, Free; + DDSCAPS2 Caps = { 0 }; + TEST (DirectDraw->GetAvailableVidMem(&Caps, NULL, NULL) == DDERR_INVALIDPARAMS); + TEST (DirectDraw->GetAvailableVidMem(NULL, &Total, &Free) == DDERR_INVALIDPARAMS); + TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK && Total == 0 && Free == 0 ); + + Caps.dwCaps = DDSCAPS_VIDEOMEMORY; + TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK ); + + DirectDraw->Release(); + + return TRUE; +} + LONG WINAPI BasicWindowProc (HWND hwnd, UINT message, UINT wParam, LONG lParam) { switch (message)
17 years, 7 months
1
0
0
0
[greatlrd] 26814: Fixing a msvc7 comping issue
by greatlrd@svn.reactos.org
Author: greatlrd Date: Thu May 17 01:03:02 2007 New Revision: 26814 URL:
http://svn.reactos.org/svn/reactos?rev=26814&view=rev
Log: Fixing a msvc7 comping issue Added: trunk/rostests/dxtest/ddraw/ddraw_test.cpp - copied, changed from r26809, trunk/rostests/dxtest/ddraw/ddraw_test.c Removed: trunk/rostests/dxtest/ddraw/ddraw_test.c Modified: trunk/rostests/dxtest/ddraw/ddraw.rbuild trunk/rostests/dxtest/ddraw/testlist.cpp Modified: trunk/rostests/dxtest/ddraw/ddraw.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dxtest/ddraw/ddraw.rbuild…
============================================================================== --- trunk/rostests/dxtest/ddraw/ddraw.rbuild (original) +++ trunk/rostests/dxtest/ddraw/ddraw.rbuild Thu May 17 01:03:02 2007 @@ -7,6 +7,6 @@ <library>gdi32</library> <library>ddraw</library> <library>dxguid</library> - <file>ddraw_test.c</file> + <file>ddraw_test.cpp</file> <file>testlist.cpp</file> </module> Removed: trunk/rostests/dxtest/ddraw/ddraw_test.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dxtest/ddraw/ddraw_test.c…
============================================================================== --- trunk/rostests/dxtest/ddraw/ddraw_test.c (original) +++ trunk/rostests/dxtest/ddraw/ddraw_test.c (removed) @@ -1,51 +1,0 @@ -#include <stdio.h> -#include <stdlib.h> - -#include "ddrawtest.h" - -INT NumTests(void); - -int main(int argc, char *argv[]) -{ - INT Num = NumTests(); - INT i, j; - INT passed, failed, opassed, ofailed; - - opassed = 0; - ofailed = 0; - printf("DirectDraw tests\n"); - if (argc > 1) - { - for (i = 1; i < argc; i++) - { - for (j = 0; j < NumTests(); j++) - { - if (stricmp(argv[i], TestList[j].Test) == 0) - { - passed = 0; - failed = 0; - TestList[j].Proc(&passed, &failed); - opassed += passed; - ofailed += failed; - printf(" tests: %d, passed: %d, failed: %d\n\n", passed+failed, passed, failed); - } - } - } - } - else - { - for (i = 0; i < Num; i++) - { - passed = 0; - failed = 0; - printf("Test: %s\n", TestList[i].Test); - TestList[i].Proc(&passed, &failed); - opassed += passed; - ofailed += failed; - printf(" tests: %d, passed: %d, failed: %d\n\n", passed+failed, passed, failed); - } - } - printf("\nOverall tests: %d, passed: %d, failed: %d\n", opassed+ofailed, opassed, ofailed); - - return ofailed; -} Copied: trunk/rostests/dxtest/ddraw/ddraw_test.cpp (from r26809, trunk/rostests/dxtest/ddraw/ddraw_test.c) URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dxtest/ddraw/ddraw_test.c…
============================================================================== --- trunk/rostests/dxtest/ddraw/ddraw_test.c (original) +++ trunk/rostests/dxtest/ddraw/ddraw_test.cpp Thu May 17 01:03:02 2007 @@ -20,7 +20,7 @@ { for (j = 0; j < NumTests(); j++) { - if (stricmp(argv[i], TestList[j].Test) == 0) + if (_stricmp(argv[i], TestList[j].Test) == 0) { passed = 0; failed = 0; Modified: trunk/rostests/dxtest/ddraw/testlist.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dxtest/ddraw/testlist.cpp…
============================================================================== --- trunk/rostests/dxtest/ddraw/testlist.cpp (original) +++ trunk/rostests/dxtest/ddraw/testlist.cpp Thu May 17 01:03:02 2007 @@ -19,7 +19,7 @@ }; /* The function that gives us the number of tests */ -extern "C" INT NumTests(void) +INT NumTests(void) { return sizeof(TestList) / sizeof(TEST); }
17 years, 7 months
1
0
0
0
[mbosma] 26813: fix typo.
by mbosma@svn.reactos.org
Author: mbosma Date: Thu May 17 00:59:01 2007 New Revision: 26813 URL:
http://svn.reactos.org/svn/reactos?rev=26813&view=rev
Log: fix typo. Modified: trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp Modified: trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dxtest/ddraw/tests/Displa…
============================================================================== --- trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp (original) +++ trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp Thu May 17 00:59:01 2007 @@ -25,7 +25,7 @@ TEST ( Context->DirectDraw->SetDisplayMode (pDDSD->dwWidth, pDDSD->dwHeight, pDDSD->ddpfPixelFormat.dwRGBBitCount, pDDSD->dwRefreshRate, 0) == DD_OK); TEST ( Context->DirectDraw->GetMonitorFrequency (&lpdwFrequency) == DD_OK && lpdwFrequency == pDDSD->dwRefreshRate); TEST ( Context->DirectDraw->GetDisplayMode (&DisplayMode) == DD_OK - && pDDSD->dwWidth == DisplayMode.dwHeight + && pDDSD->dwHeight == DisplayMode.dwHeight && pDDSD->dwWidth == DisplayMode.dwWidth && pDDSD->dwRefreshRate == DisplayMode.dwRefreshRate && pDDSD->ddpfPixelFormat.dwRGBBitCount == DisplayMode.ddpfPixelFormat.dwRGBBitCount);
17 years, 7 months
1
0
0
0
[mbosma] 26812: - Comment out tests which works does not work for me under xp. - Release returns ref count and no HRESULT (my bad).
by mbosma@svn.reactos.org
Author: mbosma Date: Thu May 17 00:54:20 2007 New Revision: 26812 URL:
http://svn.reactos.org/svn/reactos?rev=26812&view=rev
Log: - Comment out tests which works does not work for me under xp. - Release returns ref count and no HRESULT (my bad). Modified: trunk/rostests/dxtest/ddraw/tests/CreateSurface.cpp Modified: trunk/rostests/dxtest/ddraw/tests/CreateSurface.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dxtest/ddraw/tests/Create…
============================================================================== --- trunk/rostests/dxtest/ddraw/tests/CreateSurface.cpp (original) +++ trunk/rostests/dxtest/ddraw/tests/CreateSurface.cpp Thu May 17 00:54:20 2007 @@ -44,11 +44,79 @@ TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS); Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK); + TEST ( DirectDrawSurface && DirectDrawSurface->Release() == 0 ); + DirectDrawSurface = NULL; + + Desc.dwFlags = DDSD_CAPS; + Desc.ddsCaps.dwCaps = DDSCAPS_3DDEVICE; + TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS); + Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; + TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK); + TEST ( DirectDrawSurface && DirectDrawSurface->Release() == 0 ); + DirectDrawSurface = NULL; + + Desc.dwFlags = DDSD_CAPS; + Desc.ddsCaps.dwCaps = DDSCAPS_ALLOCONLOAD; + TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS); + + Desc.dwFlags = DDSD_CAPS; + Desc.ddsCaps.dwCaps = DDSCAPS_ALPHA; + TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS); + + Desc.dwFlags = DDSD_CAPS; + Desc.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER; + TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS); + + Desc.dwFlags = DDSD_CAPS; + Desc.ddsCaps.dwCaps = DDSCAPS_COMPLEX; + TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS); + + Desc.dwFlags = DDSD_CAPS; + Desc.ddsCaps.dwCaps = DDSCAPS_FLIP; + TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS); + + Desc.dwFlags = DDSD_CAPS; + Desc.ddsCaps.dwCaps = DDSCAPS_FRONTBUFFER; + TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS); + + Desc.dwFlags = DDSD_CAPS; + Desc.ddsCaps.dwCaps = DDSCAPS_HWCODEC; + TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS); + Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; + TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK); + TEST ( DirectDrawSurface && DirectDrawSurface->Release() == 0 ); + DirectDrawSurface = NULL; + + Desc.dwFlags = DDSD_CAPS; + Desc.ddsCaps.dwCaps = DDSCAPS_LIVEVIDEO; + TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS); + Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; + TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK); + TEST ( DirectDrawSurface && DirectDrawSurface->Release() == 0 ); + DirectDrawSurface = NULL; + + Desc.dwFlags = DDSD_CAPS; + Desc.ddsCaps.dwCaps = DDSCAPS_LOCALVIDMEM; + TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS); + + Desc.dwFlags = DDSD_CAPS; + Desc.ddsCaps.dwCaps = DDSCAPS_MIPMAP; + TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS); + + Desc.dwFlags = DDSD_CAPS; + Desc.ddsCaps.dwCaps = DDSCAPS_MODEX; + TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS); + Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; + TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK); TEST ( DirectDrawSurface && DirectDrawSurface->Release() == DD_OK ); DirectDrawSurface = NULL; Desc.dwFlags = DDSD_CAPS; - Desc.ddsCaps.dwCaps = DDSCAPS_3DDEVICE; + Desc.ddsCaps.dwCaps = DDSCAPS_NONLOCALVIDMEM; + TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS); + + Desc.dwFlags = DDSD_CAPS; + Desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS); Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK); @@ -56,74 +124,6 @@ DirectDrawSurface = NULL; Desc.dwFlags = DDSD_CAPS; - Desc.ddsCaps.dwCaps = DDSCAPS_ALLOCONLOAD; - TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS); - - Desc.dwFlags = DDSD_CAPS; - Desc.ddsCaps.dwCaps = DDSCAPS_ALPHA; - TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS); - - Desc.dwFlags = DDSD_CAPS; - Desc.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER; - TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS); - - Desc.dwFlags = DDSD_CAPS; - Desc.ddsCaps.dwCaps = DDSCAPS_COMPLEX; - TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS); - - Desc.dwFlags = DDSD_CAPS; - Desc.ddsCaps.dwCaps = DDSCAPS_FLIP; - TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS); - - Desc.dwFlags = DDSD_CAPS; - Desc.ddsCaps.dwCaps = DDSCAPS_FRONTBUFFER; - TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS); - - Desc.dwFlags = DDSD_CAPS; - Desc.ddsCaps.dwCaps = DDSCAPS_HWCODEC; - TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS); - Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; - TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK); - TEST ( DirectDrawSurface && DirectDrawSurface->Release() == DD_OK ); - DirectDrawSurface = NULL; - - Desc.dwFlags = DDSD_CAPS; - Desc.ddsCaps.dwCaps = DDSCAPS_LIVEVIDEO; - TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS); - Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; - TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK); - TEST ( DirectDrawSurface && DirectDrawSurface->Release() == DD_OK ); - DirectDrawSurface = NULL; - - Desc.dwFlags = DDSD_CAPS; - Desc.ddsCaps.dwCaps = DDSCAPS_LOCALVIDMEM; - TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS); - - Desc.dwFlags = DDSD_CAPS; - Desc.ddsCaps.dwCaps = DDSCAPS_MIPMAP; - TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS); - - Desc.dwFlags = DDSD_CAPS; - Desc.ddsCaps.dwCaps = DDSCAPS_MODEX; - TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS); - Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; - TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK); - TEST ( DirectDrawSurface && DirectDrawSurface->Release() == DD_OK ); - DirectDrawSurface = NULL; - - Desc.dwFlags = DDSD_CAPS; - Desc.ddsCaps.dwCaps = DDSCAPS_NONLOCALVIDMEM; - TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS); - - Desc.dwFlags = DDSD_CAPS; - Desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; - TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS); - Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; - TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK); - TEST ( DirectDrawSurface && DirectDrawSurface->Release() == DD_OK ); - DirectDrawSurface = NULL; - - Desc.dwFlags = DDSD_CAPS; Desc.ddsCaps.dwCaps = DDSCAPS_OPTIMIZED; TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS); @@ -131,9 +131,11 @@ Desc.ddsCaps.dwCaps = DDSCAPS_OVERLAY; TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS); Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; - TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK); - TEST ( DirectDrawSurface && DirectDrawSurface->Release() == DD_OK ); - DirectDrawSurface = NULL; +#if 0 + TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK); + TEST ( DirectDrawSurface && DirectDrawSurface->Release() == 0 ); + DirectDrawSurface = NULL; +#endif Desc.dwFlags = DDSD_CAPS; Desc.ddsCaps.dwCaps = DDSCAPS_OWNDC; @@ -146,7 +148,7 @@ Desc.dwFlags = DDSD_CAPS; Desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK ); - TEST ( DirectDrawSurface && DirectDrawSurface->Release() == DD_OK ); + TEST ( DirectDrawSurface && DirectDrawSurface->Release() == 0 ); DirectDrawSurface = NULL; Desc.dwFlags = DDSD_CAPS; @@ -154,7 +156,7 @@ TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS); Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK); - TEST ( DirectDrawSurface && DirectDrawSurface->Release() == DD_OK ); + TEST ( DirectDrawSurface && DirectDrawSurface->Release() == 0 ); DirectDrawSurface = NULL; Desc.dwFlags = DDSD_CAPS; @@ -162,7 +164,7 @@ TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS); Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK); - TEST ( DirectDrawSurface && DirectDrawSurface->Release() == DD_OK ); + TEST ( DirectDrawSurface && DirectDrawSurface->Release() == 0 ); DirectDrawSurface = NULL; DirectDrawSurface = NULL; @@ -171,7 +173,7 @@ TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS); Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK ); - TEST ( DirectDrawSurface && DirectDrawSurface->Release() == DD_OK ); + TEST ( DirectDrawSurface && DirectDrawSurface->Release() == 0 ); DirectDrawSurface = NULL; Desc.dwFlags = DDSD_CAPS; @@ -179,7 +181,7 @@ TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS); Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK); - TEST ( DirectDrawSurface && DirectDrawSurface->Release() == DD_OK ); + TEST ( DirectDrawSurface && DirectDrawSurface->Release() == 0 ); DirectDrawSurface = NULL; Desc.dwFlags = DDSD_CAPS; @@ -187,7 +189,7 @@ TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS); Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK); - TEST ( DirectDrawSurface && DirectDrawSurface->Release() == DD_OK ); + TEST ( DirectDrawSurface && DirectDrawSurface->Release() == 0 ); DirectDrawSurface = NULL; Desc.dwFlags = DDSD_CAPS;
17 years, 7 months
1
0
0
0
[mbosma] 26811: Forgot to commit this one.
by mbosma@svn.reactos.org
Author: mbosma Date: Thu May 17 00:47:02 2007 New Revision: 26811 URL:
http://svn.reactos.org/svn/reactos?rev=26811&view=rev
Log: Forgot to commit this one. Modified: trunk/rostests/dxtest/ddraw/testlist.cpp Modified: trunk/rostests/dxtest/ddraw/testlist.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dxtest/ddraw/testlist.cpp…
============================================================================== --- trunk/rostests/dxtest/ddraw/testlist.cpp (original) +++ trunk/rostests/dxtest/ddraw/testlist.cpp Thu May 17 00:47:02 2007 @@ -12,11 +12,10 @@ /* The List of tests */ TEST TestList[] = { - { "DirectDrawCreate(Ex)", Test_CreateDDraw }, - { "IDirectDraw::SetCooperativeLevel", Test_SetCooperativeLevel }, - { "IDirectDraw::EnumDisplayModes/SetDisplayMode", Test_DisplayModes }, - { "IDirectDraw::CreateSurface", Test_CreateSurface }, - { "IDirectDraw::GetMonitorFrequency", Test_GetMonitorFrequency }, + { "IDirectDraw: COM Stuff", Test_CreateDDraw }, + { "IDirectDraw: Display Modes", Test_DisplayModes }, + { "IDirectDraw: Cooperative Levels", Test_SetCooperativeLevel }, + { "IDirectDraw: CreateSurface", Test_CreateSurface }, }; /* The function that gives us the number of tests */
17 years, 7 months
1
0
0
0
[mbosma] 26810: - Tests for Compact, TestCooperativeLevel, Initialize, GetDisplayMode, RestoreDisplayMode - Merge GetMonitorFrequency Test with other Display Mode Tests
by mbosma@svn.reactos.org
Author: mbosma Date: Thu May 17 00:42:33 2007 New Revision: 26810 URL:
http://svn.reactos.org/svn/reactos?rev=26810&view=rev
Log: - Tests for Compact, TestCooperativeLevel, Initialize, GetDisplayMode, RestoreDisplayMode - Merge GetMonitorFrequency Test with other Display Mode Tests Modified: trunk/rostests/dxtest/ddraw/tests/CreateDDraw.cpp trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp Modified: trunk/rostests/dxtest/ddraw/tests/CreateDDraw.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dxtest/ddraw/tests/Create…
============================================================================== --- trunk/rostests/dxtest/ddraw/tests/CreateDDraw.cpp (original) +++ trunk/rostests/dxtest/ddraw/tests/CreateDDraw.cpp Thu May 17 00:42:33 2007 @@ -18,6 +18,7 @@ TEST (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL) == DD_OK); if(DirectDraw) { + TEST (DirectDraw->Initialize(NULL) == DDERR_ALREADYINITIALIZED); TEST (DirectDraw->Release() == 0); } @@ -65,9 +66,13 @@ TEST ( DirectDraw->SetCooperativeLevel ((HWND)0xdeadbeef, DDSCL_NORMAL) == DDERR_INVALIDPARAMS); TEST ( DirectDraw->SetCooperativeLevel (hwnd, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE) == DD_OK); + TEST ( DirectDraw->Compact() == DD_OK ); TEST ( DirectDraw->SetCooperativeLevel (hwnd, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_ALLOWMODEX) == DD_OK); TEST ( DirectDraw->SetCooperativeLevel (NULL, DDSCL_NORMAL) == DD_OK ); TEST ( DirectDraw->SetCooperativeLevel (hwnd, DDSCL_NORMAL) == DD_OK ); + TEST ( DirectDraw->Compact() == DDERR_NOEXCLUSIVEMODE ); + + TEST ( DirectDraw->TestCooperativeLevel() == DD_OK ); // I do not get what this API does it always seems to return DD_OK DirectDraw->Release(); Modified: trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dxtest/ddraw/tests/Displa…
============================================================================== --- trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp (original) +++ trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp Thu May 17 00:42:33 2007 @@ -12,12 +12,24 @@ HRESULT CALLBACK EnumDisplayModes( LPDDSURFACEDESC2 pDDSD, ENUMCONTEXT* Context ) { + DWORD lpdwFrequency = 0; INT* passed = Context->passed; INT* failed = Context->failed; static int setcout = 0; + + DDSURFACEDESC2 DisplayMode = {0}; + DisplayMode.dwSize = sizeof(DDSURFACEDESC2); + if(setcout < 5) { TEST ( Context->DirectDraw->SetDisplayMode (pDDSD->dwWidth, pDDSD->dwHeight, pDDSD->ddpfPixelFormat.dwRGBBitCount, pDDSD->dwRefreshRate, 0) == DD_OK); + TEST ( Context->DirectDraw->GetMonitorFrequency (&lpdwFrequency) == DD_OK && lpdwFrequency == pDDSD->dwRefreshRate); + TEST ( Context->DirectDraw->GetDisplayMode (&DisplayMode) == DD_OK + && pDDSD->dwWidth == DisplayMode.dwHeight + && pDDSD->dwWidth == DisplayMode.dwWidth + && pDDSD->dwRefreshRate == DisplayMode.dwRefreshRate + && pDDSD->ddpfPixelFormat.dwRGBBitCount == DisplayMode.ddpfPixelFormat.dwRGBBitCount); + } setcout++; return DDENUMRET_OK; @@ -39,52 +51,31 @@ /* The Test */ - // First try with some generic display modes + /* First try with some generic display modes */ TEST ( DirectDraw->SetDisplayMode (1586, 895, 0, 0, 0) == DDERR_UNSUPPORTED ); TEST ( DirectDraw->SetDisplayMode (0, 0, 0, 0, 0x123) == DDERR_INVALIDPARAMS ); + // does this change the display mode to DDSCL_EXCLUSIVE ? TEST ( DirectDraw->SetDisplayMode (0, 0, 0, 0, 0) == DD_OK ); TEST ( DirectDraw->SetDisplayMode (800, 600, 0, 0, 0) == DD_OK ); TEST ( DirectDraw->SetDisplayMode (0, 0, 16, 0, 0) == DD_OK ); - // does this change the display mode to DDSCL_EXCLUSIVE ? + TEST ( DirectDraw->GetMonitorFrequency (NULL) == DDERR_INVALIDPARAMS ); + TEST ( DirectDraw->GetDisplayMode (NULL) == DDERR_INVALIDPARAMS ); + DDSURFACEDESC2 DisplayMode = {0}; + TEST ( DirectDraw->GetDisplayMode (&DisplayMode) == DDERR_INVALIDPARAMS ); - // Now try getting vaild modes from driver + //* Now try getting vaild modes from drive */ TEST (DirectDraw->EnumDisplayModes(DDEDM_STANDARDVGAMODES, NULL, (PVOID)&Context, NULL) == DDERR_INVALIDPARAMS); TEST (DirectDraw->EnumDisplayModes(0, NULL, (PVOID)&Context, (LPDDENUMMODESCALLBACK2)DummyEnumDisplayModes) == DD_OK ); TEST (DirectDraw->EnumDisplayModes(DDEDM_REFRESHRATES, NULL, (PVOID)&Context, (LPDDENUMMODESCALLBACK2)DummyEnumDisplayModes) == DD_OK ); TEST (DirectDraw->EnumDisplayModes(DDEDM_STANDARDVGAMODES, NULL, (PVOID)&Context, (LPDDENUMMODESCALLBACK2)DummyEnumDisplayModes) == DD_OK ); TEST (DirectDraw->EnumDisplayModes(DDEDM_STANDARDVGAMODES|DDEDM_REFRESHRATES, NULL, (PVOID)&Context, (LPDDENUMMODESCALLBACK2)EnumDisplayModes) == DD_OK); + TEST (DirectDraw->RestoreDisplayMode() == DD_OK); + DirectDraw->Release(); + return TRUE; } - -BOOL Test_GetMonitorFrequency (INT* passed, INT* failed) -{ - HWND hwnd; - DWORD lpdwFrequency; - LPDIRECTDRAW7 DirectDraw; - - /* Preparations */ - if (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL) != DD_OK) - { - printf("ERROR: Failed to set up ddraw\n"); - return FALSE; - } - - if(!( hwnd = CreateBasicWindow() )) - { - printf("ERROR: Failed to create window\n"); - DirectDraw->Release(); - return FALSE; - } - - /* The Test */ - TEST ( DirectDraw->GetMonitorFrequency (NULL) == DDERR_INVALIDPARAMS ); - TEST ( DirectDraw->GetMonitorFrequency (&lpdwFrequency) == DD_OK ); - TEST ( lpdwFrequency != 0 ); - - return TRUE; -}
17 years, 7 months
1
0
0
0
[mbosma] 26809: - Enable display mode tests but do not tests all of them, but only the first five onces. - Add tests for AddRef, QueryInterface, Release
by mbosma@svn.reactos.org
Author: mbosma Date: Wed May 16 22:57:21 2007 New Revision: 26809 URL:
http://svn.reactos.org/svn/reactos?rev=26809&view=rev
Log: - Enable display mode tests but do not tests all of them, but only the first five onces. - Add tests for AddRef, QueryInterface, Release Modified: trunk/rostests/dxtest/ddraw/testlist.cpp trunk/rostests/dxtest/ddraw/tests/CreateDDraw.cpp trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp Modified: trunk/rostests/dxtest/ddraw/testlist.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dxtest/ddraw/testlist.cpp…
============================================================================== --- trunk/rostests/dxtest/ddraw/testlist.cpp (original) +++ trunk/rostests/dxtest/ddraw/testlist.cpp Wed May 16 22:57:21 2007 @@ -14,7 +14,7 @@ { { "DirectDrawCreate(Ex)", Test_CreateDDraw }, { "IDirectDraw::SetCooperativeLevel", Test_SetCooperativeLevel }, - // { "IDirectDraw::EnumDisplayModes/SetDisplayMode", Test_DisplayModes }, // uncomment this test if you have enough time and patience + { "IDirectDraw::EnumDisplayModes/SetDisplayMode", Test_DisplayModes }, { "IDirectDraw::CreateSurface", Test_CreateSurface }, { "IDirectDraw::GetMonitorFrequency", Test_GetMonitorFrequency }, }; Modified: trunk/rostests/dxtest/ddraw/tests/CreateDDraw.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dxtest/ddraw/tests/Create…
============================================================================== --- trunk/rostests/dxtest/ddraw/tests/CreateDDraw.cpp (original) +++ trunk/rostests/dxtest/ddraw/tests/CreateDDraw.cpp Wed May 16 22:57:21 2007 @@ -4,18 +4,35 @@ BOOL Test_CreateDDraw (INT* passed, INT* failed) { - LPDIRECTDRAW7 DirectDraw = NULL; - IDirectDraw* DirectDraw2 = NULL; + LPDIRECTDRAW7 DirectDraw; + IDirectDraw* DirectDraw2; /*** FIXME: Test first parameter using EnumDisplayDrivers ***/ + DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL); TEST (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, (IUnknown*)0xdeadbeef) == CLASS_E_NOAGGREGATION); TEST (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw4, NULL) == DDERR_INVALIDPARAMS); TEST (DirectDrawCreateEx(NULL, NULL, IID_IDirectDraw7, NULL) == DDERR_INVALIDPARAMS); + + DirectDraw = NULL; TEST (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL) == DD_OK); - //TEST (DirectDraw && DirectDraw->Release()); + if(DirectDraw) + { + TEST (DirectDraw->Release() == 0); + } + + DirectDraw2 = NULL; TEST (DirectDrawCreate(NULL ,&DirectDraw2, NULL) == DD_OK); - //TEST (DirectDraw2 && DirectDraw2->Release()); + if(DirectDraw2) + { + TEST (DirectDraw2->QueryInterface(IID_IDirectDraw7, (PVOID*)&DirectDraw) == 0); + TEST (DirectDraw2->AddRef() == 2); + TEST (DirectDraw->AddRef() == 2); + TEST (DirectDraw->Release() == 1); + TEST (DirectDraw->Release() == 0); + TEST (DirectDraw2->Release() == 1); + TEST (DirectDraw2->Release() == 0); + } return TRUE; } Modified: trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dxtest/ddraw/tests/Displa…
============================================================================== --- trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp (original) +++ trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp Wed May 16 22:57:21 2007 @@ -14,7 +14,12 @@ { INT* passed = Context->passed; INT* failed = Context->failed; - TEST ( Context->DirectDraw->SetDisplayMode (pDDSD->dwWidth, pDDSD->dwHeight, pDDSD->ddpfPixelFormat.dwRGBBitCount, pDDSD->dwRefreshRate, 0) == DD_OK); + static int setcout = 0; + if(setcout < 5) + { + TEST ( Context->DirectDraw->SetDisplayMode (pDDSD->dwWidth, pDDSD->dwHeight, pDDSD->ddpfPixelFormat.dwRGBBitCount, pDDSD->dwRefreshRate, 0) == DD_OK); + } + setcout++; return DDENUMRET_OK; }
17 years, 7 months
1
0
0
0
[mbosma] 26808: Add downloader.xml again.
by mbosma@svn.reactos.org
Author: mbosma Date: Wed May 16 22:11:25 2007 New Revision: 26808 URL:
http://svn.reactos.org/svn/reactos?rev=26808&view=rev
Log: Add downloader.xml again. Modified: trunk/reactos/boot/bootdata/packages/reactos.dff Modified: trunk/reactos/boot/bootdata/packages/reactos.dff URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/packages/rea…
============================================================================== --- trunk/reactos/boot/bootdata/packages/reactos.dff (original) +++ trunk/reactos/boot/bootdata/packages/reactos.dff Wed May 16 22:11:25 2007 @@ -444,6 +444,7 @@ modules\rosapps\devutils\zoomin\zoomin.exe 1 optional modules\rosapps\dflat32\edit.exe 1 optional modules\rosapps\downloader\downloader.exe 1 optional +modules\rosapps\downloader\downloader.xml 1 optional modules\rosapps\gettype\gettype.exe 1 optional modules\rosapps\green\green.sys 1 optional modules\rosapps\imagesoft\imagesoft.exe 1 optional
17 years, 7 months
1
0
0
0
← Newer
1
...
9
10
11
12
13
14
15
...
33
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
Results per page:
10
25
50
100
200