ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
October 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
20 participants
708 discussions
Start a n
N
ew thread
[hpoussin] 29951: Display status window only if it is not a console boot
by hpoussin@svn.reactos.org
Author: hpoussin Date: Mon Oct 29 15:54:47 2007 New Revision: 29951 URL:
http://svn.reactos.org/svn/reactos?rev=29951&view=rev
Log: Display status window only if it is not a console boot Modified: trunk/reactos/dll/win32/syssetup/install.c Modified: trunk/reactos/dll/win32/syssetup/install.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/syssetup/install…
============================================================================== --- trunk/reactos/dll/win32/syssetup/install.c (original) +++ trunk/reactos/dll/win32/syssetup/install.c Mon Oct 29 15:54:47 2007 @@ -546,6 +546,85 @@ return 0; } +static LONG +ReadRegSzKey( + IN HKEY hKey, + IN LPCWSTR pszKey, + OUT LPWSTR* pValue) +{ + LONG rc; + DWORD dwType; + DWORD cbData = 0; + LPWSTR Value; + + if (!pValue) + return ERROR_INVALID_PARAMETER; + + *pValue = NULL; + rc = RegQueryValueExW(hKey, pszKey, NULL, &dwType, NULL, &cbData); + if (rc != ERROR_SUCCESS) + return rc; + if (dwType != REG_SZ) + return ERROR_FILE_NOT_FOUND; + Value = HeapAlloc(GetProcessHeap(), 0, cbData + sizeof(WCHAR)); + if (!Value) + return ERROR_NOT_ENOUGH_MEMORY; + rc = RegQueryValueExW(hKey, pszKey, NULL, NULL, (LPBYTE)Value, &cbData); + if (rc != ERROR_SUCCESS) + { + HeapFree(GetProcessHeap(), 0, Value); + return rc; + } + /* NULL-terminate the string */ + Value[cbData / sizeof(WCHAR)] = '\0'; + + *pValue = Value; + return ERROR_SUCCESS; +} + +static BOOL +IsConsoleBoot(VOID) +{ + HKEY ControlKey = NULL; + LPWSTR SystemStartOptions = NULL; + LPWSTR CurrentOption, NextOption; /* Pointers into SystemStartOptions */ + BOOL ConsoleBoot = FALSE; + LONG rc; + + rc = RegOpenKeyExW( + HKEY_LOCAL_MACHINE, + L"SYSTEM\\CurrentControlSet\\Control", + 0, + KEY_QUERY_VALUE, + &ControlKey); + + rc = ReadRegSzKey(ControlKey, L"SystemStartOptions", &SystemStartOptions); + if (rc != ERROR_SUCCESS) + goto cleanup; + + /* Check for CMDCONS in SystemStartOptions */ + CurrentOption = SystemStartOptions; + while (CurrentOption) + { + NextOption = wcschr(CurrentOption, L' '); + if (NextOption) + *NextOption = L'\0'; + if (wcsicmp(CurrentOption, L"CONSOLE") == 0) + { + DPRINT("Found %S. Switching to console boot\n", CurrentOption); + ConsoleBoot = TRUE; + goto cleanup; + } + CurrentOption = NextOption ? NextOption + 1 : NULL; + } + +cleanup: + if (ControlKey != NULL) + RegCloseKey(ControlKey); + HeapFree(GetProcessHeap(), 0, SystemStartOptions); + return ConsoleBoot; +} + static BOOL CommonInstall(VOID) { @@ -576,13 +655,16 @@ return FALSE; } - CreateThread( - NULL, - 0, - ShowStatusMessageThread, - (LPVOID)&hWnd, - 0, - NULL); + if (!IsConsoleBoot()) + { + CreateThread( + NULL, + 0, + ShowStatusMessageThread, + (LPVOID)&hWnd, + 0, + NULL); + } if (!EnableUserModePnpManager()) {
17 years, 1 month
1
0
0
0
[gedmurphy] 29950: change text to something meaningful
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Mon Oct 29 15:15:55 2007 New Revision: 29950 URL:
http://svn.reactos.org/svn/reactos?rev=29950&view=rev
Log: change text to something meaningful Modified: trunk/reactos/dll/cpl/desk/lang/en-US.rc Modified: trunk/reactos/dll/cpl/desk/lang/en-US.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/lang/en-US.rc…
============================================================================== --- trunk/reactos/dll/cpl/desk/lang/en-US.rc (original) +++ trunk/reactos/dll/cpl/desk/lang/en-US.rc Mon Oct 29 15:15:55 2007 @@ -195,7 +195,7 @@ IDS_ELEMENT_4 "Caption of active windows" IDS_ELEMENT_5 "Border of active windows" IDS_ELEMENT_6 "Menu" - IDS_ELEMENT_7 "Hilited elements" + IDS_ELEMENT_7 "Selected Items" IDS_ELEMENT_8 "Windows" IDS_ELEMENT_9 "Scrollbars" IDS_ELEMENT_10 "3D objects"
17 years, 1 month
1
0
0
0
[hpoussin] 29949: Remove debug message
by hpoussin@svn.reactos.org
Author: hpoussin Date: Mon Oct 29 15:13:45 2007 New Revision: 29949 URL:
http://svn.reactos.org/svn/reactos?rev=29949&view=rev
Log: Remove debug message Modified: trunk/reactos/subsystems/win32/csrss/win32csr/tuiconsole.c Modified: trunk/reactos/subsystems/win32/csrss/win32csr/tuiconsole.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/win…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/win32csr/tuiconsole.c (original) +++ trunk/reactos/subsystems/win32/csrss/win32csr/tuiconsole.c Mon Oct 29 15:13:45 2007 @@ -284,7 +284,6 @@ msg.message == WM_KEYDOWN || msg.message == WM_KEYUP || msg.message == WM_SYSKEYDOWN || msg.message == WM_SYSKEYUP) { - CHECKPOINT1; ConioProcessKey(&msg, Console, TRUE); } }
17 years, 1 month
1
0
0
0
[hpoussin] 29948: Rename console boot switch to CONSOLE
by hpoussin@svn.reactos.org
Author: hpoussin Date: Mon Oct 29 14:55:06 2007 New Revision: 29948 URL:
http://svn.reactos.org/svn/reactos?rev=29948&view=rev
Log: Rename console boot switch to CONSOLE Modified: trunk/reactos/base/services/umpnpmgr/umpnpmgr.c trunk/reactos/base/system/userinit/userinit.c trunk/reactos/dll/win32/msgina/msgina.c Modified: trunk/reactos/base/services/umpnpmgr/umpnpmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/umpnpmgr/ump…
============================================================================== --- trunk/reactos/base/services/umpnpmgr/umpnpmgr.c (original) +++ trunk/reactos/base/services/umpnpmgr/umpnpmgr.c Mon Oct 29 14:55:06 2007 @@ -891,7 +891,7 @@ lstrcpyW(szKeyName, L"System\\CurrentControlSet\\Control\\Class"); lstrcatW(szKeyName, L"\\"); if(lstrlenW(ClassGuid) < sizeof(szKeyName)/sizeof(WCHAR)-lstrlenW(szKeyName)) - lstrcatW(szKeyName, ClassGuid); + lstrcatW(szKeyName, ClassGuid); else return CR_INVALID_DATA; if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, @@ -1486,7 +1486,7 @@ typedef BOOL (WINAPI *PDEV_INSTALL_W)(HWND, HINSTANCE, LPCWSTR, INT); static BOOL -InstallDevice(PCWSTR DeviceInstance, BOOL SetupIsActive) +InstallDevice(PCWSTR DeviceInstance, BOOL ShowWizard) { PLUGPLAY_CONTROL_STATUS_DATA PlugPlayData; HMODULE hNewDev = NULL; @@ -1520,7 +1520,7 @@ if (!DevInstallW) goto cleanup; - if (!DevInstallW(NULL, NULL, DeviceInstance, SetupIsActive ? SW_HIDE : SW_SHOWNOACTIVATE)) + if (!DevInstallW(NULL, NULL, DeviceInstance, ShowWizard ? SW_SHOWNOACTIVATE : SW_HIDE)) goto cleanup; DeviceInstalled = TRUE; @@ -1530,6 +1530,43 @@ FreeLibrary(hNewDev); return DeviceInstalled; +} + + +static LONG +ReadRegSzKey( + IN HKEY hKey, + IN LPCWSTR pszKey, + OUT LPWSTR* pValue) +{ + LONG rc; + DWORD dwType; + DWORD cbData = 0; + LPWSTR Value; + + if (!pValue) + return ERROR_INVALID_PARAMETER; + + *pValue = NULL; + rc = RegQueryValueExW(hKey, pszKey, NULL, &dwType, NULL, &cbData); + if (rc != ERROR_SUCCESS) + return rc; + if (dwType != REG_SZ) + return ERROR_FILE_NOT_FOUND; + Value = HeapAlloc(GetProcessHeap(), 0, cbData + sizeof(WCHAR)); + if (!Value) + return ERROR_NOT_ENOUGH_MEMORY; + rc = RegQueryValueExW(hKey, pszKey, NULL, NULL, (LPBYTE)Value, &cbData); + if (rc != ERROR_SUCCESS) + { + HeapFree(GetProcessHeap(), 0, Value); + return rc; + } + /* NULL-terminate the string */ + Value[cbData / sizeof(WCHAR)] = '\0'; + + *pValue = Value; + return ERROR_SUCCESS; } @@ -1564,6 +1601,50 @@ } +static BOOL +IsConsoleBoot(VOID) +{ + HKEY ControlKey = NULL; + LPWSTR SystemStartOptions = NULL; + LPWSTR CurrentOption, NextOption; /* Pointers into SystemStartOptions */ + BOOL ConsoleBoot = FALSE; + LONG rc; + + rc = RegOpenKeyExW( + HKEY_LOCAL_MACHINE, + L"SYSTEM\\CurrentControlSet\\Control", + 0, + KEY_QUERY_VALUE, + &ControlKey); + + rc = ReadRegSzKey(ControlKey, L"SystemStartOptions", &SystemStartOptions); + if (rc != ERROR_SUCCESS) + goto cleanup; + + /* Check for CMDCONS in SystemStartOptions */ + CurrentOption = SystemStartOptions; + while (CurrentOption) + { + NextOption = wcschr(CurrentOption, L' '); + if (NextOption) + *NextOption = L'\0'; + if (wcsicmp(CurrentOption, L"CONSOLE") == 0) + { + DPRINT("Found %S. Switching to console boot\n", CurrentOption); + ConsoleBoot = TRUE; + goto cleanup; + } + CurrentOption = NextOption ? NextOption + 1 : NULL; + } + +cleanup: + if (ControlKey != NULL) + RegCloseKey(ControlKey); + HeapFree(GetProcessHeap(), 0, SystemStartOptions); + return ConsoleBoot; +} + + /* Loop to install all queued devices installations */ static DWORD WINAPI DeviceInstallThread(LPVOID lpParameter) @@ -1574,11 +1655,11 @@ PLIST_ENTRY ListEntry; #endif DeviceInstallParams* Params; - BOOL setupActive; + BOOL showWizard; UNREFERENCED_PARAMETER(lpParameter); - setupActive = SetupIsActive(); + showWizard = !SetupIsActive() && !IsConsoleBoot(); SetEnvironmentVariable(L"USERPROFILE", L"."); /* FIXME: why is it needed? */ @@ -1601,7 +1682,7 @@ { ResetEvent(hNoPendingInstalls); Params = CONTAINING_RECORD(ListEntry, DeviceInstallParams, ListEntry); - InstallDevice(Params->DeviceIds, setupActive); + InstallDevice(Params->DeviceIds, showWizard); } } Modified: trunk/reactos/base/system/userinit/userinit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/userinit/useri…
============================================================================== --- trunk/reactos/base/system/userinit/userinit.c (original) +++ trunk/reactos/base/system/userinit/userinit.c Mon Oct 29 14:55:06 2007 @@ -88,14 +88,14 @@ if (rc != ERROR_SUCCESS) goto cleanup; - /* Check for CMDCONS in SystemStartOptions */ + /* Check for CONSOLE in SystemStartOptions */ CurrentOption = SystemStartOptions; while (CurrentOption) { NextOption = wcschr(CurrentOption, L' '); if (NextOption) *NextOption = L'\0'; - if (wcsicmp(CurrentOption, L"CMDCONS") == 0) + if (wcsicmp(CurrentOption, L"CONSOLE") == 0) { ret = TRUE; goto cleanup; Modified: trunk/reactos/dll/win32/msgina/msgina.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/msgina.c?…
============================================================================== --- trunk/reactos/dll/win32/msgina/msgina.c (original) +++ trunk/reactos/dll/win32/msgina/msgina.c Mon Oct 29 14:55:06 2007 @@ -118,7 +118,7 @@ NextOption = wcschr(CurrentOption, L' '); if (NextOption) *NextOption = L'\0'; - if (wcsicmp(CurrentOption, L"CMDCONS") == 0) + if (wcsicmp(CurrentOption, L"CONSOLE") == 0) { TRACE("Found %S. Switching to console boot\n", CurrentOption); ConsoleBoot = TRUE;
17 years, 1 month
1
0
0
0
[hpoussin] 29947: Add a virtual function table for UI, as already done for machine functions. This leads to simplification of initialization phase, remove some corner cases and (now) unneeded variables. This also lead to always have a UI to display messages (even maybe as simple as a printf() )
by hpoussin@svn.reactos.org
Author: hpoussin Date: Mon Oct 29 14:00:31 2007 New Revision: 29947 URL:
http://svn.reactos.org/svn/reactos?rev=29947&view=rev
Log: Add a virtual function table for UI, as already done for machine functions. This leads to simplification of initialization phase, remove some corner cases and (now) unneeded variables. This also lead to always have a UI to display messages (even maybe as simple as a printf() ) Added: trunk/reactos/boot/freeldr/freeldr/include/ui/minitui.h (with props) trunk/reactos/boot/freeldr/freeldr/include/ui/noui.h (with props) trunk/reactos/boot/freeldr/freeldr/ui/minitui.c (with props) trunk/reactos/boot/freeldr/freeldr/ui/noui.c (with props) Modified: trunk/reactos/boot/freeldr/freeldr/bootmgr.c trunk/reactos/boot/freeldr/freeldr/freeldr.c trunk/reactos/boot/freeldr/freeldr/freeldr_arch.rbuild trunk/reactos/boot/freeldr/freeldr/freeldr_base.rbuild trunk/reactos/boot/freeldr/freeldr/include/freeldr.h trunk/reactos/boot/freeldr/freeldr/include/ui.h trunk/reactos/boot/freeldr/freeldr/include/ui/gui.h trunk/reactos/boot/freeldr/freeldr/include/ui/tui.h trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c trunk/reactos/boot/freeldr/freeldr/ui/gui.c trunk/reactos/boot/freeldr/freeldr/ui/tui.c trunk/reactos/boot/freeldr/freeldr/ui/tuimenu.c trunk/reactos/boot/freeldr/freeldr/ui/ui.c Modified: trunk/reactos/boot/freeldr/freeldr/bootmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/bootm…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/bootmgr.c (original) +++ trunk/reactos/boot/freeldr/freeldr/bootmgr.c Mon Oct 29 14:00:31 2007 @@ -83,12 +83,6 @@ for (;;) { - /* If Timeout is 0, don't even bother loading any gui */ - if (!UserInterfaceUp) { - SelectedOperatingSystem = DefaultOperatingSystem; - goto NoGui; - } - // Redraw the backdrop UiDrawBackdrop(); @@ -99,7 +93,6 @@ goto reboot; } -NoGui: TimeOut = -1; // Try to open the operating system section in the .ini file Modified: trunk/reactos/boot/freeldr/freeldr/freeldr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/freel…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/freeldr.c (original) +++ trunk/reactos/boot/freeldr/freeldr/freeldr.c Mon Oct 29 14:00:31 2007 @@ -30,12 +30,18 @@ DbgPrint((DPRINT_WARNING, "BootMain() called.\n")); - if (!MmInitializeMemoryManager()) + if (!UiInitialize(FALSE)) { printf("Press any key to reboot.\n"); MachConsGetCh(); return; } + if (!MmInitializeMemoryManager()) + { + UiMessageBoxCritical("Unable to initialize memory manager"); + return; + } + RunLoader(); } Modified: trunk/reactos/boot/freeldr/freeldr/freeldr_arch.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/freel…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/freeldr_arch.rbuild (original) +++ trunk/reactos/boot/freeldr/freeldr/freeldr_arch.rbuild Mon Oct 29 14:00:31 2007 @@ -84,6 +84,7 @@ <file>hardware.c</file> <file>loader.c</file> <file>mach.c</file> + <file>portio.c</file> <file>video.c</file> </module> </if> Modified: trunk/reactos/boot/freeldr/freeldr/freeldr_base.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/freel…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/freeldr_base.rbuild (original) +++ trunk/reactos/boot/freeldr/freeldr/freeldr_base.rbuild Mon Oct 29 14:00:31 2007 @@ -55,6 +55,8 @@ </directory> <directory name="ui"> <file>gui.c</file> + <file>minitui.c</file> + <file>noui.c</file> <file>tui.c</file> <file>tuimenu.c</file> <file>ui.c</file> Modified: trunk/reactos/boot/freeldr/freeldr/include/freeldr.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/freeldr.h (original) +++ trunk/reactos/boot/freeldr/freeldr/include/freeldr.h Mon Oct 29 14:00:31 2007 @@ -57,8 +57,10 @@ #include <fs/ntfs.h> #include <fs/iso.h> /* ui support */ +#include <ui/gui.h> +#include <ui/minitui.h> +#include <ui/noui.h> #include <ui/tui.h> -#include <ui/gui.h> /* arch files */ #ifdef _X86_ #include <arch/i386/hardware.h> @@ -95,8 +97,6 @@ #define Ke386EraseFlags(x) __asm__ __volatile__("pushl $0 ; popfl\n") #endif -extern BOOLEAN UserInterfaceUp; /* Tells us if the user interface is displayed */ - VOID BootMain(LPSTR CmdLine); VOID RunLoader(VOID); Modified: trunk/reactos/boot/freeldr/freeldr/include/ui.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/ui.h (original) +++ trunk/reactos/boot/freeldr/freeldr/include/ui.h Mon Oct 29 14:00:31 2007 @@ -43,12 +43,9 @@ extern CHAR UiTitleBoxTitleText[260]; // Title box's title text -extern BOOLEAN UserInterfaceUp; // Tells us if the user interface is displayed - extern BOOLEAN UiUseSpecialEffects; // Tells us if we should use fade effects extern BOOLEAN UiCenterMenu; extern BOOLEAN UiMenuBox; -extern BOOLEAN UiMinimal; extern CHAR UiTimeText[]; extern BOOLEAN UiDrawTime; @@ -92,10 +89,92 @@ // Menu Functions // /////////////////////////////////////////////////////////////////////////////////////// -typedef BOOLEAN (*UiMenuKeyPressFilterCallback)(ULONG KeyPress); + +struct tagUI_MENU_INFO; +typedef struct tagUI_MENU_INFO UI_MENU_INFO, *PUI_MENU_INFO; + +typedef BOOLEAN (*UiMenuKeyPressFilterCallback)(ULONG KeyPress); BOOLEAN UiDisplayMenu(PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter); +/////////////////////////////////////////////////////////////////////////////////////// +// +// UI virtual table +// +/////////////////////////////////////////////////////////////////////////////////////// +typedef struct tagUIVTBL +{ + BOOLEAN (*Initialize)(VOID); + VOID (*UnInitialize)(VOID); + VOID (*DrawBackdrop)(VOID); + VOID (*FillArea)(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr); + VOID (*DrawShadow)(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom); + VOID (*DrawBox)(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr); + VOID (*DrawText)(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr); + VOID (*DrawCenteredText)(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCSTR TextString, UCHAR Attr); + VOID (*DrawStatusText)(PCSTR StatusText); + VOID (*UpdateDateTime)(VOID); + VOID (*MessageBox)(PCSTR MessageText); + VOID (*MessageBoxCritical)(PCSTR MessageText); + VOID (*DrawProgressBarCenter)(ULONG Position, ULONG Range, PCHAR ProgressText); + VOID (*DrawProgressBar)(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText); + BOOLEAN (*EditBox)(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length); + UCHAR (*TextToColor)(PCSTR ColorText); + UCHAR (*TextToFillStyle)(PCSTR FillStyleText); + VOID (*FadeInBackdrop)(VOID); + VOID (*FadeOut)(VOID); + + BOOLEAN (*DisplayMenu)(PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter); + VOID (*DrawMenu)(PUI_MENU_INFO MenuInfo); +} UIVTBL, *PUIVTBL; + +VOID UiInit(const char *CmdLine); + +extern UIVTBL UiVtbl; + +/* + * Combines the foreground and background colors into a single attribute byte + */ +#define ATTR(cFore, cBack) ((cBack << 4)|cFore) + +/* + * Fill styles for DrawBackdrop() + */ +#define LIGHT_FILL 0xB0 +#define MEDIUM_FILL 0xB1 +#define DARK_FILL 0xB2 + +/* + * Screen colors + */ +#define COLOR_BLACK 0 +#define COLOR_BLUE 1 +#define COLOR_GREEN 2 +#define COLOR_CYAN 3 +#define COLOR_RED 4 +#define COLOR_MAGENTA 5 +#define COLOR_BROWN 6 +#define COLOR_GRAY 7 + +#define COLOR_DARKGRAY 8 +#define COLOR_LIGHTBLUE 9 +#define COLOR_LIGHTGREEN 10 +#define COLOR_LIGHTCYAN 11 +#define COLOR_LIGHTRED 12 +#define COLOR_LIGHTMAGENTA 13 +#define COLOR_YELLOW 14 +#define COLOR_WHITE 15 + +/* Add COLOR_BLINK to a background to cause blinking */ +//#define COLOR_BLINK 8 + +/* + * Defines for IBM box drawing characters + */ +#define HORZ (0xc4) /* Single horizontal line */ +#define D_HORZ (0xcd) /* Double horizontal line.*/ +#define VERT (0xb3) /* Single vertical line */ +#define D_VERT (0xba) /* Double vertical line. */ #endif // #defined __UI_H Modified: trunk/reactos/boot/freeldr/freeldr/include/ui/gui.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/ui/gui.h (original) +++ trunk/reactos/boot/freeldr/freeldr/include/ui/gui.h Mon Oct 29 14:00:31 2007 @@ -51,6 +51,6 @@ /////////////////////////////////////////////////////////////////////////////////////// BOOLEAN GuiDisplayMenu(PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem); - +extern const UIVTBL GuiVtbl; #endif // #defined __GUI_H Added: trunk/reactos/boot/freeldr/freeldr/include/ui/minitui.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/ui/minitui.h (added) +++ trunk/reactos/boot/freeldr/freeldr/include/ui/minitui.h Mon Oct 29 14:00:31 2007 @@ -1,0 +1,33 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: FreeLoader + * FILE: freeldr/include/ui/minitui.h + * PURPOSE: Mini Text UI interface header + * PROGRAMMERS: Hervé Poussineau + */ + +#ifndef __MINITUI_H +#define __MINITUI_H + +/////////////////////////////////////////////////////////////////////////////////////// +// +// Textual User Interface Functions +// +/////////////////////////////////////////////////////////////////////////////////////// + +VOID MiniTuiDrawBackdrop(VOID); +VOID MiniTuiDrawStatusText(PCSTR StatusText); +VOID MiniTuiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressText); +VOID MiniTuiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText); + +/////////////////////////////////////////////////////////////////////////////////////// +// +// Menu Functions +// +/////////////////////////////////////////////////////////////////////////////////////// + +VOID MiniTuiDrawMenu(PUI_MENU_INFO MenuInfo); + +extern const UIVTBL MiniTuiVtbl; + +#endif // #defined __TUI_H Propchange: trunk/reactos/boot/freeldr/freeldr/include/ui/minitui.h ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/boot/freeldr/freeldr/include/ui/noui.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/ui/noui.h (added) +++ trunk/reactos/boot/freeldr/freeldr/include/ui/noui.h Mon Oct 29 14:00:31 2007 @@ -1,0 +1,51 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: FreeLoader + * FILE: freeldr/include/ui/noui.h + * PURPOSE: No UI interface header + * PROGRAMMERS: Hervé Poussineau + */ + +#ifndef _NOUI_H_ +#define _NOUI_H_ + +/////////////////////////////////////////////////////////////////////////////////////// +// +// No User Interface Functions +// +/////////////////////////////////////////////////////////////////////////////////////// + +BOOLEAN NoUiInitialize(VOID); +VOID NoUiUnInitialize(VOID); + +VOID NoUiDrawBackdrop(VOID); +VOID NoUiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr); +VOID NoUiDrawShadow(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom); +VOID NoUiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr); +VOID NoUiDrawText(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr); +VOID NoUiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCSTR TextString, UCHAR Attr); +VOID NoUiDrawStatusText(PCSTR StatusText); +VOID NoUiUpdateDateTime(VOID); +VOID NoUiMessageBox(PCSTR MessageText); +VOID NoUiMessageBoxCritical(PCSTR MessageText); +VOID NoUiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressText); +VOID NoUiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText); +BOOLEAN NoUiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length); +UCHAR NoUiTextToColor(PCSTR ColorText); +UCHAR NoUiTextToFillStyle(PCSTR FillStyleText); +VOID NoUiFadeInBackdrop(VOID); +VOID NoUiFadeOut(VOID); + +BOOLEAN NoUiDisplayMenu(PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter); +VOID NoUiDrawMenu(PUI_MENU_INFO MenuInfo); + +/////////////////////////////////////////////////////////////////////////////////////// +// +// Menu Functions +// +/////////////////////////////////////////////////////////////////////////////////////// + +BOOLEAN NoUiDisplayMenu(PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter); +VOID NoUiDrawMenu(PUI_MENU_INFO MenuInfo); + +#endif /* _NOUI_H_ */ Propchange: trunk/reactos/boot/freeldr/freeldr/include/ui/noui.h ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/boot/freeldr/freeldr/include/ui/tui.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/ui/tui.h (original) +++ trunk/reactos/boot/freeldr/freeldr/include/ui/tui.h Mon Oct 29 14:00:31 2007 @@ -59,7 +59,7 @@ // /////////////////////////////////////////////////////////////////////////////////////// -typedef struct +struct tagUI_MENU_INFO { PCSTR *MenuItemList; ULONG MenuItemCount; @@ -71,59 +71,20 @@ ULONG Right; ULONG Bottom; -} TUI_MENU_INFO, *PTUI_MENU_INFO; +}; -VOID NTAPI TuiCalcMenuBoxSize(PTUI_MENU_INFO MenuInfo); -VOID NTAPI TuiDrawMenu(PTUI_MENU_INFO MenuInfo); -VOID NTAPI TuiDrawMenuBox(PTUI_MENU_INFO MenuInfo); -VOID NTAPI TuiDrawMenuItem(PTUI_MENU_INFO MenuInfo, ULONG MenuItemNumber); -ULONG NTAPI TuiProcessMenuKeyboardEvent(PTUI_MENU_INFO MenuInfo, UiMenuKeyPressFilterCallback KeyPressFilter); -BOOLEAN NTAPI TuiDisplayMenu(PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter); +VOID NTAPI TuiCalcMenuBoxSize(PUI_MENU_INFO MenuInfo); +VOID TuiDrawMenu(PUI_MENU_INFO MenuInfo); +VOID NTAPI TuiDrawMenuBox(PUI_MENU_INFO MenuInfo); +VOID NTAPI TuiDrawMenuItem(PUI_MENU_INFO MenuInfo, ULONG MenuItemNumber); +ULONG NTAPI TuiProcessMenuKeyboardEvent(PUI_MENU_INFO MenuInfo, UiMenuKeyPressFilterCallback KeyPressFilter); +BOOLEAN TuiDisplayMenu(PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter); -/* - * Combines the foreground and background colors into a single attribute byte - */ -#define ATTR(cFore, cBack) ((cBack << 4)|cFore) -/* - * Fill styles for DrawBackdrop() - */ -#define LIGHT_FILL 0xB0 -#define MEDIUM_FILL 0xB1 -#define DARK_FILL 0xB2 -/* - * Screen colors - */ -#define COLOR_BLACK 0 -#define COLOR_BLUE 1 -#define COLOR_GREEN 2 -#define COLOR_CYAN 3 -#define COLOR_RED 4 -#define COLOR_MAGENTA 5 -#define COLOR_BROWN 6 -#define COLOR_GRAY 7 -#define COLOR_DARKGRAY 8 -#define COLOR_LIGHTBLUE 9 -#define COLOR_LIGHTGREEN 10 -#define COLOR_LIGHTCYAN 11 -#define COLOR_LIGHTRED 12 -#define COLOR_LIGHTMAGENTA 13 -#define COLOR_YELLOW 14 -#define COLOR_WHITE 15 -/* Add COLOR_BLINK to a background to cause blinking */ -#define COLOR_BLINK 8 - -/* - * Defines for IBM box drawing characters - */ -#define HORZ (0xc4) /* Single horizontal line */ -#define D_HORZ (0xcd) /* Double horizontal line.*/ -#define VERT (0xb3) /* Single vertical line */ -#define D_VERT (0xba) /* Double vertical line. */ /* Definitions for corners, depending on HORIZ and VERT */ #define UL (0xda) @@ -146,5 +107,6 @@ #define VD_LL (0xd3) #define VD_LR (0xbd) +extern const UIVTBL TuiVtbl; #endif // #defined __TUI_H Modified: trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/react…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c (original) +++ trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c Mon Oct 29 14:00:31 2007 @@ -103,9 +103,7 @@ LoadNlsFile(PCSTR szSourcePath, PCSTR szFileName, PCSTR szModuleName) { CHAR szFullName[256]; -#ifdef USE_UI CHAR szBuffer[80]; -#endif PFILE FilePointer; PCSTR szShortName; @@ -150,12 +148,8 @@ /* * Update the status bar with the current file */ -#ifdef USE_UI sprintf(szBuffer, "Setup is loading files (%s)", szShortName); UiDrawStatusText(szBuffer); -#else - printf("Reading %s\n", szShortName); -#endif /* Load the driver */ FrLdrLoadModule(FilePointer, szModuleName, NULL); @@ -221,8 +215,8 @@ #ifdef USE_UI SetupUiInitialize(); +#endif UiDrawStatusText(""); -#endif extern BOOLEAN FrLdrBootType; FrLdrBootType = TRUE; @@ -231,15 +225,9 @@ RegInitializeRegistry(); /* Detect hardware */ -#ifdef USE_UI UiDrawStatusText("Detecting hardware..."); -#else - printf("Detecting hardware...\n\n"); -#endif MachHwDetect(); -#ifdef USE_UI UiDrawStatusText(""); -#endif /* set boot device */ MachDiskGetBootDevice(&LoaderBlock.BootDevice); @@ -247,11 +235,7 @@ /* Open boot drive */ if (!FsOpenBootVolume()) { -#ifdef USE_UI UiMessageBox("Failed to open boot drive."); -#else - printf("Failed to open boot drive."); -#endif return; } @@ -338,21 +322,12 @@ /* Insert boot disk 2 */ if (MachDiskBootingFromFloppy()) { -#ifdef USE_UI UiMessageBox("Please insert \"ReactOS Boot Disk 2\" and press ENTER"); -#else - printf("\n\n Please insert \"ReactOS Boot Disk 2\" and press ENTER\n"); - MachConsGetCh(); -#endif /* Open boot drive */ if (!FsOpenBootVolume()) { -#ifdef USE_UI UiMessageBox("Failed to open boot drive."); -#else - printf("Failed to open boot drive."); -#endif return; } @@ -381,11 +356,7 @@ /* Load ANSI codepage file */ if (!LoadNlsFile(SourcePath, LoadOptions, "ansi.nls")) { -#ifdef USE_UI UiMessageBox("Failed to load the ANSI codepage file."); -#else - printf("Failed to load the ANSI codepage file."); -#endif return; } @@ -410,11 +381,7 @@ /* Load OEM codepage file */ if (!LoadNlsFile(SourcePath, LoadOptions, "oem.nls")) { -#ifdef USE_UI UiMessageBox("Failed to load the OEM codepage file."); -#else - printf("Failed to load the OEM codepage file."); -#endif return; } @@ -439,11 +406,7 @@ /* Load Unicode casemap file */ if (!LoadNlsFile(SourcePath, LoadOptions, "casemap.nls")) { -#ifdef USE_UI UiMessageBox("Failed to load the Unicode casemap file."); -#else - printf("Failed to load the Unicode casemap file."); -#endif return; } @@ -480,9 +443,7 @@ } while (InfFindNextLine(&InfContext, &InfContext)); } -#ifdef USE_UI UiUnInitialize("Booting ReactOS..."); -#endif /* Now boot the kernel */ DiskStopFloppyMotor(); Modified: trunk/reactos/boot/freeldr/freeldr/ui/gui.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/ui/gu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/ui/gui.c (original) +++ trunk/reactos/boot/freeldr/freeldr/ui/gui.c Mon Oct 29 14:00:31 2007 @@ -76,3 +76,27 @@ { return 0; } + +const UIVTBL GuiVtbl = +{ + /*GuiInitialize, + GuiUnInitialize, + GuiDrawBackdrop, + GuiFillArea, + GuiDrawShadow, + GuiDrawBox, + GuiDrawText, + GuiDrawCenteredText, + GuiDrawStatusText, + GuiUpdateDateTime, + GuiMessageBox, + GuiMessageBoxCritical, + GuiDrawProgressBarCenter, + GuiDrawProgressBar, + GuiEditBox, + GuiTextToColor, + GuiTextToFillStyle, + GuiFadeInBackdrop, + GuiFadeOut, + GuiDisplayMenu,*/ +}; Added: trunk/reactos/boot/freeldr/freeldr/ui/minitui.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/ui/mi…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/ui/minitui.c (added) +++ trunk/reactos/boot/freeldr/freeldr/ui/minitui.c Mon Oct 29 14:00:31 2007 @@ -1,0 +1,156 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: FreeLoader + * FILE: freeldr/ui/minitui.c + * PURPOSE: Mini Text UI interface + * PROGRAMMERS: Brian Palmer <brianp(a)sginet.com> + * Hervé Poussineau + */ + +#include <freeldr.h> + +VOID MiniTuiDrawBackdrop(VOID) +{ + // + // Fill in a black background + // + TuiFillArea(0, + 0, + UiScreenWidth - 1, + UiScreenHeight - 1, + 0, + 0); + + // + // Update the screen buffer + // + VideoCopyOffScreenBufferToVRAM(); +} + +VOID MiniTuiDrawStatusText(PCSTR StatusText) +{ + // + // Minimal UI doesn't have a status bar + // +} + +VOID MiniTuiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressText) +{ + ULONG Left, Top, Right, Bottom; + ULONG Width = 50; // Allow for 50 "bars" + ULONG Height = 2; + + Width = 80; + Left = 0; + Right = Left + Width; + Top = UiScreenHeight - Height - 4; + Bottom = Top + Height + 1; + + MiniTuiDrawProgressBar(Left, Top, Right, Bottom, Position, Range, ProgressText); +} + +VOID MiniTuiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText) +{ + ULONG i; + ULONG ProgressBarWidth = (Right - Left) - 3; + + // First make sure the progress bar text fits + UiTruncateStringEllipsis(ProgressText, ProgressBarWidth - 4); + + if (Position > Range) + { + Position = Range; + } + + // + // Draw the "Loading..." text + // + TuiDrawCenteredText(Left + 2, Top + 1, Right - 2, Top + 1, "ReactOS is loading files...", ATTR(7, 0)); + + // Draw the percent complete + for (i=0; i<(Position*ProgressBarWidth)/Range; i++) + { + TuiDrawText(Left+2+i, Top+2, "\xDB", ATTR(UiTextColor, UiMenuBgColor)); + } + + TuiUpdateDateTime(); + VideoCopyOffScreenBufferToVRAM(); +} + +VOID +MiniTuiDrawMenu(PUI_MENU_INFO MenuInfo) +{ + ULONG i; + + // + // Draw the backdrop + // + UiDrawBackdrop(); + + // + // No GUI status bar text, just minimal text. first to tell the user to + // choose. + // + UiVtbl.DrawText(0, + MenuInfo->Top - 2, + "Please select the operating system to start:", + ATTR(UiMenuFgColor, UiMenuBgColor)); + + // + // Now tell him how to choose + // + UiVtbl.DrawText(0, + MenuInfo->Bottom + 1, + "Use the up and down arrow keys to move the highlight to " + "your choice.", + ATTR(UiMenuFgColor, UiMenuBgColor)); + UiVtbl.DrawText(0, + MenuInfo->Bottom + 2, + "Press ENTER to choose.", + ATTR(UiMenuFgColor, UiMenuBgColor)); + + // + // And offer F8 options + // + UiVtbl.DrawText(0, + UiScreenHeight - 4, + "For troubleshooting and advanced startup options for " + "ReactOS, press F8.", + ATTR(UiMenuFgColor, UiMenuBgColor)); + + // + // Draw the menu box + // + TuiDrawMenuBox(MenuInfo); + + // + // Draw each line of the menu + // + for (i = 0; i < MenuInfo->MenuItemCount; i++) TuiDrawMenuItem(MenuInfo, i); + VideoCopyOffScreenBufferToVRAM(); +} + +const UIVTBL MiniTuiVtbl = +{ + TuiInitialize, + TuiUnInitialize, + MiniTuiDrawBackdrop, + TuiFillArea, + TuiDrawShadow, + TuiDrawBox, + TuiDrawText, + TuiDrawCenteredText, + MiniTuiDrawStatusText, + TuiUpdateDateTime, + TuiMessageBox, + TuiMessageBoxCritical, + MiniTuiDrawProgressBarCenter, + MiniTuiDrawProgressBar, + TuiEditBox, + TuiTextToColor, + TuiTextToFillStyle, + TuiFadeInBackdrop, + TuiFadeOut, + TuiDisplayMenu, + MiniTuiDrawMenu, +}; Propchange: trunk/reactos/boot/freeldr/freeldr/ui/minitui.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/boot/freeldr/freeldr/ui/noui.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/ui/no…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/ui/noui.c (added) +++ trunk/reactos/boot/freeldr/freeldr/ui/noui.c Mon Oct 29 14:00:31 2007 @@ -1,0 +1,120 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: FreeLoader + * FILE: freeldr/ui/noui.c + * PURPOSE: No Text UI interface + * PROGRAMMERS: Hervé Poussineau + */ + +#include <freeldr.h> + +BOOLEAN NoUiInitialize(VOID) +{ + return TRUE; +} + +VOID NoUiUnInitialize(VOID) +{ +} + +VOID NoUiDrawBackdrop(VOID) +{ +} + +VOID NoUiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr) +{ +} + +VOID NoUiDrawShadow(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom) +{ +} + +VOID NoUiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr) +{ +} + +VOID NoUiDrawText(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr) +{ +} + +VOID NoUiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCSTR TextString, UCHAR Attr) +{ +} + +VOID NoUiDrawStatusText(PCSTR StatusText) +{ + printf(StatusText); +} + +VOID NoUiUpdateDateTime(VOID) +{ +} + +VOID NoUiMessageBox(PCSTR MessageText) +{ + // We have not yet displayed the user interface + // We are probably still reading the .ini file + // and have encountered an error. Just use printf() + // and return. + printf("%s\n", MessageText); + printf("Press any key\n"); + MachConsGetCh(); +} + +VOID NoUiMessageBoxCritical(PCSTR MessageText) +{ + // We have not yet displayed the user interface + // We are probably still reading the .ini file + // and have encountered an error. Just use printf() + // and return. + printf("%s\n", MessageText); + printf("Press any key\n"); + MachConsGetCh(); +} + +VOID NoUiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressText) +{ +} + +VOID NoUiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText) +{ +} + +BOOLEAN NoUiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length) +{ + return FALSE; +} + +UCHAR NoUiTextToColor(PCSTR ColorText) +{ + return 0; +} + +UCHAR NoUiTextToFillStyle(PCSTR FillStyleText) +{ + return 0; +} + +VOID NoUiFadeInBackdrop(VOID) +{ +} + +VOID NoUiFadeOut(VOID) +{ +} + +/////////////////////////////////////////////////////////////////////////////////////// +// +// Menu Functions +// +/////////////////////////////////////////////////////////////////////////////////////// + +BOOLEAN NoUiDisplayMenu(PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter) +{ + *SelectedMenuItem = DefaultMenuItem; + return TRUE; +} + +VOID NoUiDrawMenu(PUI_MENU_INFO MenuInfo) +{ +} Propchange: trunk/reactos/boot/freeldr/freeldr/ui/noui.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/boot/freeldr/freeldr/ui/tui.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/ui/tu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/ui/tui.c (original) +++ trunk/reactos/boot/freeldr/freeldr/ui/tui.c Mon Oct 29 14:00:31 2007 @@ -20,7 +20,6 @@ #include <freeldr.h> PVOID TextVideoBuffer = NULL; -extern BOOLEAN UiMinimal; /* * printf() - prints formatted text to stdout @@ -112,25 +111,6 @@ VOID TuiDrawBackdrop(VOID) { - if (UiMinimal) - { - // - // Fill in a black background - // - TuiFillArea(0, - 0, - UiScreenWidth - 1, - UiScreenHeight - 1, - 0, - 0); - - // - // Update the screen buffer - // - VideoCopyOffScreenBufferToVRAM(); - return; - } - // // Fill in the background (excluding title box & status bar) // @@ -449,11 +429,6 @@ { ULONG i; - // - // Minimal UI doesn't have a status bar - // - if (UiMinimal) return; - TuiDrawText(0, UiScreenHeight-1, " ", ATTR(UiStatusBarFgColor, UiStatusBarBgColor)); TuiDrawText(1, UiScreenHeight-1, StatusText, ATTR(UiStatusBarFgColor, UiStatusBarBgColor)); @@ -691,28 +666,10 @@ ULONG Width = 50; // Allow for 50 "bars" ULONG Height = 2; - // - // Is this the minimal UI? - // - if (UiMinimal) - { - // - // Use alternate settings - // - Width = 80; - Left = 0; - Right = Left + Width; - Top = UiScreenHeight - Height - 4; - Bottom = Top + Height + 1; - } - else - { - Left = (UiScreenWidth - Width - 4) / 2; - Right = Left + Width + 3; - Top = (UiScreenHeight - Height - 2) / 2; - Top += 2; - } - + Left = (UiScreenWidth - Width - 4) / 2; + Right = Left + Width + 3; + Top = (UiScreenHeight - Height - 2) / 2; + Top += 2; Bottom = Top + Height + 1; TuiDrawProgressBar(Left, Top, Right, Bottom, Position, Range, ProgressText); @@ -731,26 +688,13 @@ Position = Range; } - // - // Minimal UI has no box, and only generic loading text - // - if (!UiMinimal) - { - // Draw the box - TuiDrawBox(Left, Top, Right, Bottom, VERT, HORZ, TRUE, TRUE, ATTR(UiMenuFgColor, UiMenuBgColor)); - - // - // Draw the "Loading..." text - // - TuiDrawCenteredText(Left + 2, Top + 2, Right - 2, Top + 2, ProgressText, ATTR(UiTextColor, UiMenuBgColor)); - } - else - { - // - // Draw the "Loading..." text - // - TuiDrawCenteredText(Left + 2, Top + 1, Right - 2, Top + 1, "ReactOS is loading files...", ATTR(7, 0)); - } + // Draw the box + TuiDrawBox(Left, Top, Right, Bottom, VERT, HORZ, TRUE, TRUE, ATTR(UiMenuFgColor, UiMenuBgColor)); + + // + // Draw the "Loading..." text + // + TuiDrawCenteredText(Left + 2, Top + 2, Right - 2, Top + 2, ProgressText, ATTR(UiTextColor, UiMenuBgColor)); // Draw the percent complete for (i=0; i<(Position*ProgressBarWidth)/Range; i++) @@ -758,14 +702,11 @@ TuiDrawText(Left+2+i, Top+2, "\xDB", ATTR(UiTextColor, UiMenuBgColor)); } - // Draw the shadow for non-minimal UI - if (!UiMinimal) - { - for (; i<ProgressBarWidth; i++) - { - TuiDrawText(Left+2+i, Top+2, "\xB2", ATTR(UiTextColor, UiMenuBgColor)); - } - } + // Draw the shadow + for (; i<ProgressBarWidth; i++) + { + TuiDrawText(Left+2+i, Top+2, "\xB2", ATTR(UiTextColor, UiMenuBgColor)); + } TuiUpdateDateTime(); VideoCopyOffScreenBufferToVRAM(); @@ -1045,3 +986,28 @@ return ReturnCode; } + +const UIVTBL TuiVtbl = +{ + TuiInitialize, + TuiUnInitialize, + TuiDrawBackdrop, + TuiFillArea, + TuiDrawShadow, + TuiDrawBox, + TuiDrawText, + TuiDrawCenteredText, + TuiDrawStatusText, + TuiUpdateDateTime, + TuiMessageBox, + TuiMessageBoxCritical, + TuiDrawProgressBarCenter, + TuiDrawProgressBar, + TuiEditBox, + TuiTextToColor, + TuiTextToFillStyle, + TuiFadeInBackdrop, + TuiFadeOut, + TuiDisplayMenu, + TuiDrawMenu, +}; Modified: trunk/reactos/boot/freeldr/freeldr/ui/tuimenu.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/ui/tu…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/ui/tuimenu.c (original) +++ trunk/reactos/boot/freeldr/freeldr/ui/tuimenu.c Mon Oct 29 14:00:31 2007 @@ -14,7 +14,6 @@ /* FUNCTIONS *****************************************************************/ BOOLEAN -NTAPI TuiDisplayMenu(PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, @@ -23,7 +22,7 @@ BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter) { - TUI_MENU_INFO MenuInformation; + UI_MENU_INFO MenuInformation; ULONG LastClockSecond; ULONG CurrentClockSecond; ULONG KeyPress; @@ -55,7 +54,7 @@ // // Draw the menu // - TuiDrawMenu(&MenuInformation); + UiVtbl.DrawMenu(&MenuInformation); // // Get the current second of time @@ -136,7 +135,7 @@ VOID NTAPI -TuiCalcMenuBoxSize(PTUI_MENU_INFO MenuInfo) +TuiCalcMenuBoxSize(PUI_MENU_INFO MenuInfo) { ULONG i; ULONG Width = 0; @@ -195,8 +194,7 @@ } VOID -NTAPI -TuiDrawMenu(PTUI_MENU_INFO MenuInfo) +TuiDrawMenu(PUI_MENU_INFO MenuInfo) { ULONG i; @@ -206,48 +204,9 @@ UiDrawBackdrop(); // - // Check if this is the minimal (console) UI - // - if (UiMinimal) - { - // - // No GUI status bar text, just minimal text. first to tell the user to - // choose. - // - TuiDrawText(0, - MenuInfo->Top - 2, - "Please select the operating system to start:", - ATTR(UiMenuFgColor, UiMenuBgColor)); - - // - // Now tell him how to choose - // - TuiDrawText(0, - MenuInfo->Bottom + 1, - "Use the up and down arrow keys to move the highlight to " - "your choice.", - ATTR(UiMenuFgColor, UiMenuBgColor)); - TuiDrawText(0, - MenuInfo->Bottom + 2, - "Press ENTER to choose.", - ATTR(UiMenuFgColor, UiMenuBgColor)); - - // - // And offer F8 options - // - TuiDrawText(0, - UiScreenHeight - 4, - "For troubleshooting and advanced startup options for " - "ReactOS, press F8.", - ATTR(UiMenuFgColor, UiMenuBgColor)); - } - else - { - // - // Update the status bar - // - UiDrawStatusText("Use \x18\x19 to select, then press ENTER."); - } + // Update the status bar + // + UiVtbl.DrawStatusText("Use \x18\x19 to select, then press ENTER."); // // Draw the menu box @@ -263,7 +222,7 @@ VOID NTAPI -TuiDrawMenuBox(PTUI_MENU_INFO MenuInfo) +TuiDrawMenuBox(PUI_MENU_INFO MenuInfo) { CHAR MenuLineText[80]; CHAR TempString[80]; @@ -361,7 +320,7 @@ VOID NTAPI -TuiDrawMenuItem(PTUI_MENU_INFO MenuInfo, +TuiDrawMenuItem(PUI_MENU_INFO MenuInfo, ULONG MenuItemNumber) { ULONG i; @@ -441,7 +400,7 @@ ULONG NTAPI -TuiProcessMenuKeyboardEvent(PTUI_MENU_INFO MenuInfo, +TuiProcessMenuKeyboardEvent(PUI_MENU_INFO MenuInfo, UiMenuKeyPressFilterCallback KeyPressFilter) { ULONG KeyEvent = 0; @@ -483,7 +442,7 @@ // // It processed the key character, so redraw and exit // - TuiDrawMenu(MenuInfo); + UiVtbl.DrawMenu(MenuInfo); return 0; } Modified: trunk/reactos/boot/freeldr/freeldr/ui/ui.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/ui/ui…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/ui/ui.c (original) +++ trunk/reactos/boot/freeldr/freeldr/ui/ui.c Mon Oct 29 14:00:31 2007 @@ -21,8 +21,8 @@ #include <debug.h> -ULONG UiScreenWidth = 80; // Screen Width -ULONG UiScreenHeight = 25; // Screen Height +ULONG UiScreenWidth; // Screen Width +ULONG UiScreenHeight; // Screen Height UCHAR UiStatusBarFgColor = COLOR_BLACK; // Status bar foreground color UCHAR UiStatusBarBgColor = COLOR_CYAN; // Status bar background color @@ -43,34 +43,54 @@ CHAR UiTitleBoxTitleText[260] = "Boot Menu"; // Title box's title text -BOOLEAN UserInterfaceUp = FALSE; // Tells us if the user interface is displayed - -VIDEODISPLAYMODE UiDisplayMode = VideoTextMode; // Tells us if we are in text or graphics mode - BOOLEAN UiUseSpecialEffects = FALSE; // Tells us if we should use fade effects BOOLEAN UiDrawTime = TRUE; // Tells us if we should draw the time -BOOLEAN UiMinimal = FALSE; // Tells us if we should use a minimal console-like UI BOOLEAN UiCenterMenu = TRUE; // Tells us if we should use a centered or left-aligned menu BOOLEAN UiMenuBox = TRUE; // Tells us if we shuld draw a box around the menu CHAR UiTimeText[260] = "[Time Remaining: ] "; const CHAR UiMonthNames[12][15] = { "January ", "February ", "March ", "April ", "May ", "June ", "July ", "August ", "September ", "October ", "November ", "December " }; +UIVTBL UiVtbl = +{ + NoUiInitialize, + NoUiUnInitialize, + NoUiDrawBackdrop, + NoUiFillArea, + NoUiDrawShadow, + NoUiDrawBox, + NoUiDrawText, + NoUiDrawCenteredText, + NoUiDrawStatusText, + NoUiUpdateDateTime, + NoUiMessageBox, + NoUiMessageBoxCritical, + NoUiDrawProgressBarCenter, + NoUiDrawProgressBar, + NoUiEditBox, + NoUiTextToColor, + NoUiTextToFillStyle, + NoUiFadeInBackdrop, + NoUiFadeOut, + NoUiDisplayMenu, + NoUiDrawMenu, +}; BOOLEAN UiInitialize(BOOLEAN ShowGui) { + VIDEODISPLAYMODE UiDisplayMode; // Tells us if we are in text or graphics mode + BOOLEAN UiMinimal = FALSE; // Tells us if we should use a minimal console-like UI ULONG SectionId; CHAR DisplayModeText[260]; CHAR SettingText[260]; ULONG Depth; if (!ShowGui) { - if (!TuiInitialize()) + if (!UiVtbl.Initialize()) { MachVideoSetDisplayMode(NULL, FALSE); return FALSE; } - UserInterfaceUp = FALSE; return TRUE; } @@ -85,132 +105,15 @@ { DisplayModeText[0] = '\0'; } - - if (IniReadSettingByName(SectionId, "TitleText", SettingText, sizeof(SettingText))) - { - strcpy(UiTitleBoxTitleText, SettingText); - } - if (IniReadSettingByName(SectionId, "TimeText", SettingText, sizeof(SettingText))) - { - strcpy(UiTimeText, SettingText); - } - if (IniReadSettingByName(SectionId, "StatusBarColor", SettingText, sizeof(SettingText))) - { - UiStatusBarBgColor = UiTextToColor(SettingText); - } - if (IniReadSettingByName(SectionId, "StatusBarTextColor", SettingText, sizeof(SettingText))) - { - UiStatusBarFgColor = UiTextToColor(SettingText); - } - if (IniReadSettingByName(SectionId, "BackdropTextColor", SettingText, sizeof(SettingText))) - { - UiBackdropFgColor = UiTextToColor(SettingText); - } - if (IniReadSettingByName(SectionId, "BackdropColor", SettingText, sizeof(SettingText))) - { - UiBackdropBgColor = UiTextToColor(SettingText); - } - if (IniReadSettingByName(SectionId, "BackdropFillStyle", SettingText, sizeof(SettingText))) - { - UiBackdropFillStyle = UiTextToFillStyle(SettingText); - } - if (IniReadSettingByName(SectionId, "TitleBoxTextColor", SettingText, sizeof(SettingText))) - { - UiTitleBoxFgColor = UiTextToColor(SettingText); - } - if (IniReadSettingByName(SectionId, "TitleBoxColor", SettingText, sizeof(SettingText))) - { - UiTitleBoxBgColor = UiTextToColor(SettingText); - } - if (IniReadSettingByName(SectionId, "MessageBoxTextColor", SettingText, sizeof(SettingText))) - { - UiMessageBoxFgColor = UiTextToColor(SettingText); - } - if (IniReadSettingByName(SectionId, "MessageBoxColor", SettingText, sizeof(SettingText))) - { - UiMessageBoxBgColor = UiTextToColor(SettingText); - } - if (IniReadSettingByName(SectionId, "MenuTextColor", SettingText, sizeof(SettingText))) - { - UiMenuFgColor = UiTextToColor(SettingText); - } - if (IniReadSettingByName(SectionId, "MenuColor", SettingText, sizeof(SettingText))) - { - UiMenuBgColor = UiTextToColor(SettingText); - } - if (IniReadSettingByName(SectionId, "TextColor", SettingText, sizeof(SettingText))) - { - UiTextColor = UiTextToColor(SettingText); - } - if (IniReadSettingByName(SectionId, "SelectedTextColor", SettingText, sizeof(SettingText))) - { - UiSelectedTextColor = UiTextToColor(SettingText); - } - if (IniReadSettingByName(SectionId, "SelectedColor", SettingText, sizeof(SettingText))) - { - UiSelectedTextBgColor = UiTextToColor(SettingText); - } - if (IniReadSettingByName(SectionId, "EditBoxTextColor", SettingText, sizeof(SettingText))) - { - UiEditBoxTextColor = UiTextToColor(SettingText); - } - if (IniReadSettingByName(SectionId, "EditBoxColor", SettingText, sizeof(SettingText))) - { - UiEditBoxBgColor = UiTextToColor(SettingText); - } - if (IniReadSettingByName(SectionId, "SpecialEffects", SettingText, sizeof(SettingText))) + if (IniReadSettingByName(SectionId, "MinimalUI", SettingText, sizeof(SettingText))) { if (_stricmp(SettingText, "Yes") == 0 && strlen(SettingText) == 3) { - UiUseSpecialEffects = TRUE; + UiMinimal = TRUE; } else { - UiUseSpecialEffects = FALSE; - } - } - if (IniReadSettingByName(SectionId, "ShowTime", SettingText, sizeof(SettingText))) - { - if (_stricmp(SettingText, "Yes") == 0 && strlen(SettingText) == 3) - { - UiDrawTime = TRUE; - } - else - { - UiDrawTime = FALSE; - } - } - if (IniReadSettingByName(SectionId, "MinimalUI", SettingText, sizeof(SettingText))) - { - if (_stricmp(SettingText, "Yes") == 0 && strlen(SettingText) == 3) - { - UiMinimal = TRUE; - } - else - { UiMinimal = FALSE; - } - } - if (IniReadSettingByName(SectionId, "MenuBox", SettingText, sizeof(SettingText))) - { - if (_stricmp(SettingText, "Yes") == 0 && strlen(SettingText) == 3) - { - UiMenuBox = TRUE; - } - else - { - UiMenuBox = FALSE; - } - } - if (IniReadSettingByName(SectionId, "CenterMenu", SettingText, sizeof(SettingText))) - { - if (_stricmp(SettingText, "Yes") == 0 && strlen(SettingText) == 3) - { - UiCenterMenu = TRUE; - } - else - { - UiCenterMenu = FALSE; } } } @@ -218,37 +121,147 @@ UiDisplayMode = MachVideoSetDisplayMode(DisplayModeText, TRUE); MachVideoGetDisplaySize(&UiScreenWidth, &UiScreenHeight, &Depth); - if (VideoTextMode == UiDisplayMode) - { - if (!TuiInitialize()) - { - MachVideoSetDisplayMode(NULL, FALSE); - return FALSE; - } - } + UiVtbl = UiMinimal ? MiniTuiVtbl : TuiVtbl; else - { - UNIMPLEMENTED(); - //if (!GuiInitialize()) - //{ - // MachSetDisplayMode(NULL, FALSE); - // return FALSE; - //} + UiVtbl = GuiVtbl; + + if (!UiVtbl.Initialize()) + { + MachVideoSetDisplayMode(NULL, FALSE); + return FALSE; + } + + if (IniOpenSection("Display", &SectionId)) + { + if (IniReadSettingByName(SectionId, "TitleText", SettingText, sizeof(SettingText))) + { + strcpy(UiTitleBoxTitleText, SettingText); + } + if (IniReadSettingByName(SectionId, "TimeText", SettingText, sizeof(SettingText))) + { + strcpy(UiTimeText, SettingText); + } + if (IniReadSettingByName(SectionId, "StatusBarColor", SettingText, sizeof(SettingText))) + { + UiStatusBarBgColor = UiTextToColor(SettingText); + } + if (IniReadSettingByName(SectionId, "StatusBarTextColor", SettingText, sizeof(SettingText))) + { + UiStatusBarFgColor = UiTextToColor(SettingText); + } + if (IniReadSettingByName(SectionId, "BackdropTextColor", SettingText, sizeof(SettingText))) + { + UiBackdropFgColor = UiTextToColor(SettingText); + } + if (IniReadSettingByName(SectionId, "BackdropColor", SettingText, sizeof(SettingText))) + { + UiBackdropBgColor = UiTextToColor(SettingText); + } + if (IniReadSettingByName(SectionId, "BackdropFillStyle", SettingText, sizeof(SettingText))) + { + UiBackdropFillStyle = UiTextToFillStyle(SettingText); + } + if (IniReadSettingByName(SectionId, "TitleBoxTextColor", SettingText, sizeof(SettingText))) + { + UiTitleBoxFgColor = UiTextToColor(SettingText); + } + if (IniReadSettingByName(SectionId, "TitleBoxColor", SettingText, sizeof(SettingText))) + { + UiTitleBoxBgColor = UiTextToColor(SettingText); + } + if (IniReadSettingByName(SectionId, "MessageBoxTextColor", SettingText, sizeof(SettingText))) + { + UiMessageBoxFgColor = UiTextToColor(SettingText); + } + if (IniReadSettingByName(SectionId, "MessageBoxColor", SettingText, sizeof(SettingText))) + { + UiMessageBoxBgColor = UiTextToColor(SettingText); + } + if (IniReadSettingByName(SectionId, "MenuTextColor", SettingText, sizeof(SettingText))) + { + UiMenuFgColor = UiTextToColor(SettingText); + } + if (IniReadSettingByName(SectionId, "MenuColor", SettingText, sizeof(SettingText))) + { + UiMenuBgColor = UiTextToColor(SettingText); + } + if (IniReadSettingByName(SectionId, "TextColor", SettingText, sizeof(SettingText))) + { + UiTextColor = UiTextToColor(SettingText); + } + if (IniReadSettingByName(SectionId, "SelectedTextColor", SettingText, sizeof(SettingText))) + { + UiSelectedTextColor = UiTextToColor(SettingText); + } + if (IniReadSettingByName(SectionId, "SelectedColor", SettingText, sizeof(SettingText))) + { + UiSelectedTextBgColor = UiTextToColor(SettingText); + } + if (IniReadSettingByName(SectionId, "EditBoxTextColor", SettingText, sizeof(SettingText))) + { + UiEditBoxTextColor = UiTextToColor(SettingText); + } + if (IniReadSettingByName(SectionId, "EditBoxColor", SettingText, sizeof(SettingText))) + { + UiEditBoxBgColor = UiTextToColor(SettingText); + } + if (IniReadSettingByName(SectionId, "SpecialEffects", SettingText, sizeof(SettingText))) + { + if (_stricmp(SettingText, "Yes") == 0 && strlen(SettingText) == 3) + { + UiUseSpecialEffects = TRUE; + } + else + { + UiUseSpecialEffects = FALSE; + } + } + if (IniReadSettingByName(SectionId, "ShowTime", SettingText, sizeof(SettingText))) + { + if (_stricmp(SettingText, "Yes") == 0 && strlen(SettingText) == 3) + { + UiDrawTime = TRUE; + } + else + { + UiDrawTime = FALSE; + } + } + if (IniReadSettingByName(SectionId, "MenuBox", SettingText, sizeof(SettingText))) + { + if (_stricmp(SettingText, "Yes") == 0 && strlen(SettingText) == 3) + { + UiMenuBox = TRUE; + } + else + { + UiMenuBox = FALSE; + } + } + if (IniReadSettingByName(SectionId, "CenterMenu", SettingText, sizeof(SettingText))) + { + if (_stricmp(SettingText, "Yes") == 0 && strlen(SettingText) == 3) + { + UiCenterMenu = TRUE; + } + else + { + UiCenterMenu = FALSE; + } + } } // Draw the backdrop and fade it in if special effects are enabled UiFadeInBackdrop(); - UserInterfaceUp = TRUE; - DbgPrint((DPRINT_UI, "UiInitialize() returning TRUE.\n")); return TRUE; } BOOLEAN SetupUiInitialize(VOID) { - + VIDEODISPLAYMODE UiDisplayMode; CHAR DisplayModeText[260]; ULONG Depth; @@ -259,10 +272,11 @@ UiDisplayMode = MachVideoSetDisplayMode(DisplayModeText, TRUE); MachVideoGetDisplaySize(&UiScreenWidth, &UiScreenHeight, &Depth); - TuiInitialize(); + UiVtbl = TuiVtbl; + UiVtbl.Initialize(); // Draw the backdrop and fade it in if special effects are enabled - TuiFillArea(0, + UiVtbl.FillArea(0, 0, UiScreenWidth - 1, UiScreenHeight - 2, @@ -271,10 +285,9 @@ UiDrawTime = FALSE; UiStatusBarBgColor = 7; - UserInterfaceUp = TRUE; - - TuiDrawText(4, 1, "ReactOS " KERNEL_VERSION_STR " Setup", ATTR(COLOR_GRAY, UiBackdropBgColor)); - TuiDrawText(3, 2, "\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD", ATTR(COLOR_GRAY, UiBackdropBgColor)); + + UiVtbl.DrawText(4, 1, "ReactOS " KERNEL_VERSION_STR " Setup", ATTR(COLOR_GRAY, UiBackdropBgColor)); + UiVtbl.DrawText(3, 2, "\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD", ATTR(COLOR_GRAY, UiBackdropBgColor)); DbgPrint((DPRINT_UI, "UiInitialize() returning TRUE.\n")); @@ -287,123 +300,47 @@ UiDrawStatusText("Booting..."); UiInfoBox(BootText); - if (VideoTextMode == UiDisplayMode) - { - TuiUnInitialize(); - } - else - { - UNIMPLEMENTED(); - //GuiUnInitialize(); - } + UiVtbl.UnInitialize(); } VOID UiDrawBackdrop(VOID) { - if (!UserInterfaceUp) return; - - if (VideoTextMode == UiDisplayMode) - { - TuiDrawBackdrop(); - } - else - { - UNIMPLEMENTED(); - //GuiDrawBackdrop(); - } + UiVtbl.DrawBackdrop(); } VOID UiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, CHAR FillChar, UCHAR Attr /* Color Attributes */) { - if (VideoTextMode == UiDisplayMode) - { - TuiFillArea(Left, Top, Right, Bottom, FillChar, Attr); - } - else - { - UNIMPLEMENTED(); - //GuiFillArea(Left, Top, Right, Bottom, FillChar, Attr); - } + UiVtbl.FillArea(Left, Top, Right, Bottom, FillChar, Attr); } VOID UiDrawShadow(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom) { - if (VideoTextMode == UiDisplayMode) - { - TuiDrawShadow(Left, Top, Right, Bottom); - } - else - { - UNIMPLEMENTED(); - //GuiDrawShadow(Left, Top, Right, Bottom); - } + UiVtbl.DrawShadow(Left, Top, Right, Bottom); } VOID UiDrawBox(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR VertStyle, UCHAR HorzStyle, BOOLEAN Fill, BOOLEAN Shadow, UCHAR Attr) { - if (VideoTextMode == UiDisplayMode) - { - TuiDrawBox(Left, Top, Right, Bottom, VertStyle, HorzStyle, Fill, Shadow, Attr); - } - else - { - UNIMPLEMENTED(); - //GuiDrawBox(Left, Top, Right, Bottom, VertStyle, HorzStyle, Fill, Shadow, Attr); - } + UiVtbl.DrawBox(Left, Top, Right, Bottom, VertStyle, HorzStyle, Fill, Shadow, Attr); } VOID UiDrawText(ULONG X, ULONG Y, PCSTR Text, UCHAR Attr) { - if (VideoTextMode == UiDisplayMode) - { - TuiDrawText(X, Y, Text, Attr); - } - else - { - UNIMPLEMENTED(); - //GuiDrawText(X, Y, Text, Attr); - } + UiVtbl.DrawText(X, Y, Text, Attr); } VOID UiDrawCenteredText(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, PCSTR TextString, UCHAR Attr) { - if (VideoTextMode == UiDisplayMode) - { - TuiDrawCenteredText(Left, Top, Right, Bottom, TextString, Attr); - } - else - { - UNIMPLEMENTED(); - //GuiDrawCenteredText(Left, Top, Right, Bottom, TextString, Attr); - } + UiVtbl.DrawCenteredText(Left, Top, Right, Bottom, TextString, Attr); } VOID UiDrawStatusText(PCSTR StatusText) { - if (!UserInterfaceUp) return; - - if (VideoTextMode == UiDisplayMode) - { - TuiDrawStatusText(StatusText); - } - else - { - UNIMPLEMENTED(); - //GuiDrawStatusText(StatusText); - } + UiVtbl.DrawStatusText(StatusText); } VOID UiUpdateDateTime(VOID) { - if (VideoTextMode == UiDisplayMode) - { - TuiUpdateDateTime(); - } - else - { - UNIMPLEMENTED(); - //GuiUpdateDateTime(); - } + UiVtbl.UpdateDateTime(); } VOID UiInfoBox(PCSTR MessageText) @@ -469,108 +406,32 @@ VOID UiMessageBox(PCSTR MessageText) { - // We have not yet displayed the user interface - // We are probably still reading the .ini file - // and have encountered an error. Just use printf() - // and return. - if (!UserInterfaceUp) - { - printf("%s\n", MessageText); - printf("Press any key\n"); - MachConsGetCh(); - return; - } - - if (VideoTextMode == UiDisplayMode) - { - TuiMessageBox(MessageText); - } - else - { - UNIMPLEMENTED(); - //GuiMessageBox(MessageText); - } + UiVtbl.MessageBox(MessageText); } VOID UiMessageBoxCritical(PCSTR MessageText) { - // We have not yet displayed the user interface - // We are probably still reading the .ini file - // and have encountered an error. Just use printf() - // and return. - if (!UserInterfaceUp) - { - printf("%s\n", MessageText); - printf("Press any key\n"); - MachConsGetCh(); - return; - } - - if (VideoTextMode == UiDisplayMode) - { - TuiMessageBoxCritical(MessageText); - } - else - { - UNIMPLEMENTED(); - //GuiMessageBoxCritical(MessageText); - } + UiVtbl.MessageBoxCritical(MessageText); } UCHAR UiTextToColor(PCSTR ColorText) { - if (VideoTextMode == UiDisplayMode) - { - return TuiTextToColor(ColorText); - } - else - { - UNIMPLEMENTED(); - return 0; - //return GuiTextToColor(ColorText); - } + return UiVtbl.TextToColor(ColorText); } UCHAR UiTextToFillStyle(PCSTR FillStyleText) { - if (VideoTextMode == UiDisplayMode) - { - return TuiTextToFillStyle(FillStyleText); - } - else - { - UNIMPLEMENTED(); - return 0; - //return GuiTextToFillStyle(FillStyleText); - } + return UiVtbl.TextToFillStyle(FillStyleText); } VOID UiDrawProgressBarCenter(ULONG Position, ULONG Range, PCHAR ProgressText) { - if (!UserInterfaceUp) return; - - if (VideoTextMode == UiDisplayMode) - { - TuiDrawProgressBarCenter(Position, Range, ProgressText); - } - else - { - UNIMPLEMENTED(); - //GuiDrawProgressBarCenter(Position, Range, ProgressText); - } + UiVtbl.DrawProgressBarCenter(Position, Range, ProgressText); } VOID UiDrawProgressBar(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, ULONG Position, ULONG Range, PCHAR ProgressText) { - if (VideoTextMode == UiDisplayMode) - { - TuiDrawProgressBar(Left, Top, Right, Bottom, Position, Range, ProgressText); - } - else - { - UNIMPLEMENTED(); - //GuiDrawProgressBar(Left, Top, Right, Bottom, Position, Range, ProgressText); - } + UiVtbl.DrawProgressBar(Left, Top, Right, Bottom, Position, Range, ProgressText); } VOID UiShowMessageBoxesInSection(PCSTR SectionName) @@ -653,54 +514,20 @@ BOOLEAN UiDisplayMenu(PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter) { - if (VideoTextMode == UiDisplayMode) - { - return TuiDisplayMenu(MenuItemList, MenuItemCount, DefaultMenuItem, MenuTimeOut, SelectedMenuItem, CanEscape, KeyPressFilter); - } - else - { - UNIMPLEMENTED(); - return FALSE; - //return GuiDisplayMenu(MenuItemList, MenuItemCount, DefaultMenuItem, MenuTimeOut, SelectedMenuItem, CanEscape, KeyPressFilter); - } + return UiVtbl.DisplayMenu(MenuItemList, MenuItemCount, DefaultMenuItem, MenuTimeOut, SelectedMenuItem, CanEscape, KeyPressFilter); } VOID UiFadeInBackdrop(VOID) { - if (VideoTextMode == UiDisplayMode) - { - TuiFadeInBackdrop(); - } - else - { - UNIMPLEMENTED(); - //GuiFadeInBackdrop(); - } + UiVtbl.FadeInBackdrop(); } VOID UiFadeOut(VOID) { - if (VideoTextMode == UiDisplayMode) - { - TuiFadeOut(); - } - else - { - UNIMPLEMENTED(); - //GuiFadeInOut(); - } + UiVtbl.FadeOut(); } BOOLEAN UiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length) { - if (VideoTextMode == UiDisplayMode) - { - return TuiEditBox(MessageText, EditTextBuffer, Length); - } - else - { - UNIMPLEMENTED(); - return FALSE; - //return GuiEditBox(MessageText, EditTextBuffer, Length); - } -} + return UiVtbl.EditBox(MessageText, EditTextBuffer, Length); +}
17 years, 1 month
1
0
0
0
[hpoussin] 29946: Initialize CurrentDirectory before sending it to CreateProcessAsUserW()
by hpoussin@svn.reactos.org
Author: hpoussin Date: Mon Oct 29 13:59:10 2007 New Revision: 29946 URL:
http://svn.reactos.org/svn/reactos?rev=29946&view=rev
Log: Initialize CurrentDirectory before sending it to CreateProcessAsUserW() Modified: trunk/reactos/dll/win32/msgina/msgina.c Modified: trunk/reactos/dll/win32/msgina/msgina.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/msgina.c?…
============================================================================== --- trunk/reactos/dll/win32/msgina/msgina.c (original) +++ trunk/reactos/dll/win32/msgina/msgina.c Mon Oct 29 13:59:10 2007 @@ -222,6 +222,7 @@ } ZeroMemory(&StartupInfo, sizeof(STARTUPINFOW)); + ZeroMemory(&ProcessInformation, sizeof(PROCESS_INFORMATION)); StartupInfo.cb = sizeof(STARTUPINFOW); StartupInfo.lpTitle = pszCmdLine; StartupInfo.dwX = StartupInfo.dwY = StartupInfo.dwXSize = StartupInfo.dwYSize = 0L; @@ -229,6 +230,12 @@ StartupInfo.wShowWindow = SW_SHOW; StartupInfo.lpDesktop = pszDesktopName; + len = GetWindowsDirectoryW(CurrentDirectory, MAX_PATH); + if (len == 0 || len > MAX_PATH) + { + WARN("GetWindowsDirectoryW() failed\n"); + return FALSE; + } ret = CreateProcessAsUserW( hAppToken, pszCmdLine, @@ -413,7 +420,7 @@ BOOL bResult; if (!LogonUserW(UserName, Domain, Password, - LOGON32_LOGON_INTERACTIVE, /* FIXME - use LOGON32_LOGON_UNLOCK instead! */ + LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, &pgContext->UserToken)) {
17 years, 1 month
1
0
0
0
[arty] 29945: lower IRQL at appropriate time.
by arty@svn.reactos.org
Author: arty Date: Mon Oct 29 02:23:51 2007 New Revision: 29945 URL:
http://svn.reactos.org/svn/reactos?rev=29945&view=rev
Log: lower IRQL at appropriate time. Modified: trunk/reactos/ntoskrnl/ke/powerpc/kiinit.c Modified: trunk/reactos/ntoskrnl/ke/powerpc/kiinit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/powerpc/kiinit…
============================================================================== --- trunk/reactos/ntoskrnl/ke/powerpc/kiinit.c (original) +++ trunk/reactos/ntoskrnl/ke/powerpc/kiinit.c Mon Oct 29 02:23:51 2007 @@ -141,6 +141,9 @@ /* Set the current MP Master KPRCB to the Boot PRCB */ Prcb->MultiThreadSetMaster = Prcb; + /* Lower to APC_LEVEL */ + KeLowerIrql(APC_LEVEL); + /* Initialize portable parts of the OS */ KiInitSystem();
17 years, 1 month
1
0
0
0
[fireball] 29944: - Include config/cm.h for cm based code, and remove all duplicated types and prototypes. - Get rid of EREGISTRY_HIVE, and use CMHIVE instead. Although the current ReactOS code doesn't make use of any of the functionality it offers, it's compatible with EREGISTRY_HIVE (our version was a subset) and allows us to get rid of another ros-specifc type, as well as being able to merge code from the cm-branch much more easily. - Merge cmwraprs.c from the cm-branch, since the only differ
by fireball@svn.reactos.org
Author: fireball Date: Mon Oct 29 01:38:20 2007 New Revision: 29944 URL:
http://svn.reactos.org/svn/reactos?rev=29944&view=rev
Log: - Include config/cm.h for cm based code, and remove all duplicated types and prototypes. - Get rid of EREGISTRY_HIVE, and use CMHIVE instead. Although the current ReactOS code doesn't make use of any of the functionality it offers, it's compatible with EREGISTRY_HIVE (our version was a subset) and allows us to get rid of another ros-specifc type, as well as being able to merge code from the cm-branch much more easily. - Merge cmwraprs.c from the cm-branch, since the only differences were the filehandle fields in EREGISTRY_HIVE vs CMHIVE. - Enable the #if'ed out code in cminit.c since it now applies to CMHIVE. Modified: trunk/reactos/boot/freeldr/freeldr/reactos/binhive.c trunk/reactos/lib/cmlib/cmlib.h trunk/reactos/ntoskrnl/cm/cm.h trunk/reactos/ntoskrnl/cm/ntfunc.c trunk/reactos/ntoskrnl/cm/regfile.c trunk/reactos/ntoskrnl/cm/registry.c trunk/reactos/ntoskrnl/cm/regobj.c trunk/reactos/ntoskrnl/config/cm.h trunk/reactos/ntoskrnl/config/cmapi.c trunk/reactos/ntoskrnl/config/cminit.c trunk/reactos/ntoskrnl/config/cmparse.c trunk/reactos/ntoskrnl/config/cmsysini.c trunk/reactos/ntoskrnl/config/cmwraprs.c trunk/reactos/tools/mkhive/binhive.c trunk/reactos/tools/mkhive/binhive.h trunk/reactos/tools/mkhive/cmi.c trunk/reactos/tools/mkhive/cmi.h trunk/reactos/tools/mkhive/registry.c trunk/reactos/tools/mkhive/registry.h Modified: trunk/reactos/boot/freeldr/freeldr/reactos/binhive.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/react…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/reactos/binhive.c (original) +++ trunk/reactos/boot/freeldr/freeldr/reactos/binhive.c Mon Oct 29 01:38:20 2007 @@ -710,13 +710,13 @@ FRLDRHKEY SystemKey; ULONG i; LONG Error; - PEREGISTRY_HIVE CmHive; + PCMHIVE CmHive; PHHIVE Hive; NTSTATUS Status; DbgPrint((DPRINT_REGISTRY, "RegImportBinaryHive(%x, %u) called\n",ChunkBase,ChunkSize)); - CmHive = CmpAllocate(sizeof(EREGISTRY_HIVE), TRUE, 0); + CmHive = CmpAllocate(sizeof(CMHIVE), TRUE, 0); Status = HvInitialize (&CmHive->Hive, HINIT_FLAT, 0, @@ -818,13 +818,13 @@ PCHAR ChunkBase, ULONG* ChunkSize) { - PEREGISTRY_HIVE CmHive; + PCMHIVE CmHive; PHHIVE Hive; NTSTATUS Status; DbgPrint((DPRINT_REGISTRY, "Creating binary hardware hive\n")); - CmHive = CmpAllocate(sizeof(EREGISTRY_HIVE), TRUE, 0); + CmHive = CmpAllocate(sizeof(CMHIVE), TRUE, 0); Status = HvInitialize (&CmHive->Hive, HINIT_CREATE, 0, Modified: trunk/reactos/lib/cmlib/cmlib.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/cmlib.h?rev=2994…
============================================================================== --- trunk/reactos/lib/cmlib/cmlib.h (original) +++ trunk/reactos/lib/cmlib/cmlib.h Mon Oct 29 01:38:20 2007 @@ -27,6 +27,7 @@ #ifndef _TYPEDEFS_HOST_H #include <ntddk.h> + #else #define REG_OPTION_VOLATILE 1 #define OBJ_CASE_INSENSITIVE 0x00000040L @@ -60,6 +61,14 @@ #define RtlCheckBit(BMH,BP) (((((PLONG)(BMH)->Buffer)[(BP) / 32]) >> ((BP) % 32)) & 0x1) +#define PKTHREAD PVOID +#define PKGUARDED_MUTEX PVOID +#define PERESOURCE PVOID +#define PFILE_OBJECT PVOID +#define PKEVENT PVOID +#define PWORK_QUEUE_ITEM PVOID +#define EX_PUSH_LOCK PULONG_PTR + #endif #ifndef ROUND_UP @@ -75,26 +84,87 @@ #include "hivedata.h" #include "cmdata.h" -#ifndef _CM_ -typedef struct _EREGISTRY_HIVE +#if defined(_TYPEDEFS_HOST_H) || defined(__FREELDR_H) + +#define PCM_KEY_SECURITY_CACHE_ENTRY PVOID +#define PCM_KEY_CONTROL_BLOCK PVOID +#define CMP_SECURITY_HASH_LISTS 64 +#define PCM_CELL_REMAP_BLOCK PVOID + +// +// Use Count Log and Entry +// +typedef struct _CM_USE_COUNT_LOG_ENTRY { - HHIVE Hive; - LIST_ENTRY HiveList; - UNICODE_STRING HiveFileName; - UNICODE_STRING LogFileName; - PCM_KEY_SECURITY RootSecurityCell; - ULONG Flags; - HANDLE HiveHandle; - HANDLE LogHandle; -} EREGISTRY_HIVE, *PEREGISTRY_HIVE; -#endif + HCELL_INDEX Cell; + PVOID Stack[7]; +} CM_USE_COUNT_LOG_ENTRY, *PCM_USE_COUNT_LOG_ENTRY; + +typedef struct _CM_USE_COUNT_LOG +{ + USHORT Next; + USHORT Size; + CM_USE_COUNT_LOG_ENTRY Log[32]; +} CM_USE_COUNT_LOG, *PCM_USE_COUNT_LOG; + +// +// Configuration Manager Hive Structure +// +typedef struct _CMHIVE +{ + HHIVE Hive; + HANDLE FileHandles[3]; + LIST_ENTRY NotifyList; + LIST_ENTRY HiveList; + EX_PUSH_LOCK HiveLock; + PKTHREAD HiveLockOwner; + PKGUARDED_MUTEX ViewLock; + PKTHREAD ViewLockOwner; + EX_PUSH_LOCK WriterLock; + PKTHREAD WriterLockOwner; + PERESOURCE FlusherLock; + EX_PUSH_LOCK SecurityLock; + PKTHREAD HiveSecurityLockOwner; + LIST_ENTRY LRUViewListHead; + LIST_ENTRY PinViewListHead; + PFILE_OBJECT FileObject; + UNICODE_STRING FileFullPath; + UNICODE_STRING FileUserName; + USHORT MappedViews; + USHORT PinnedViews; + ULONG UseCount; + ULONG SecurityCount; + ULONG SecurityCacheSize; + LONG SecurityHitHint; + PCM_KEY_SECURITY_CACHE_ENTRY SecurityCache; + LIST_ENTRY SecurityHash[CMP_SECURITY_HASH_LISTS]; + PKEVENT UnloadEvent; + PCM_KEY_CONTROL_BLOCK RootKcb; + BOOLEAN Frozen; + PWORK_QUEUE_ITEM UnloadWorkItem; + BOOLEAN GrowOnlyMode; + ULONG GrowOffset; + LIST_ENTRY KcbConvertListHead; + LIST_ENTRY KnodeConvertListHead; + PCM_CELL_REMAP_BLOCK CellRemapArray; + CM_USE_COUNT_LOG UseCountLog; + CM_USE_COUNT_LOG LockHiveLog; + ULONG Flags; + LIST_ENTRY TrustClassEntry; + ULONG FlushCount; + BOOLEAN HiveIsLoading; + PKTHREAD CreatorOwner; +} CMHIVE, *PCMHIVE; + +#endif + /* * Public functions. */ NTSTATUS CMAPI HvInitialize( - PHHIVE RegistryHive, + PHHIVE RegistryHive, ULONG Operation, ULONG HiveType, ULONG HiveFlags, Modified: trunk/reactos/ntoskrnl/cm/cm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/cm.h?rev=29944…
============================================================================== --- trunk/reactos/ntoskrnl/cm/cm.h (original) +++ trunk/reactos/ntoskrnl/cm/cm.h Mon Oct 29 01:38:20 2007 @@ -1,7 +1,7 @@ #ifndef __INCLUDE_CM_H #define __INCLUDE_CM_H -#include <cmlib.h> +#include "ntoskrnl/config/cm.h" #ifdef DBG #define CHECKED 1 @@ -48,116 +48,12 @@ #define IsNoFileHive(Hive) ((Hive)->Flags & HIVE_NO_FILE) #define IsNoSynchHive(Hive) ((Hive)->Flags & HIVE_NO_SYNCH) -// -// Cached Child List -// -typedef struct _CACHED_CHILD_LIST -{ - ULONG Count; - union - { - ULONG ValueList; - //struct _CM_KEY_CONTROL_BLOCK *RealKcb; - struct _KEY_OBJECT *RealKcb; - }; -} CACHED_CHILD_LIST, *PCACHED_CHILD_LIST; /* KEY_OBJECT.Flags */ /* When set, the key is scheduled for deletion, and all attempts to access the key must not succeed */ #define KO_MARKED_FOR_DELETE 0x00000001 - -/* Type defining the Object Manager Key Object */ -typedef struct _KEY_OBJECT -{ - /* Fields used by the Object Manager */ - CSHORT Type; - CSHORT Size; - - /* Key flags */ - ULONG Flags; - - /* Key name */ - UNICODE_STRING Name; - - /* Registry hive the key belongs to */ - PEREGISTRY_HIVE RegistryHive; - - /* Block offset of the key cell this key belongs in */ - HCELL_INDEX KeyCellOffset; - - /* CM_KEY_NODE this key belong in */ - PCM_KEY_NODE KeyCell; - - /* Link to the parent KEY_OBJECT for this key */ - struct _KEY_OBJECT *ParentKey; - - /* List entry into the global key object list */ - LIST_ENTRY ListEntry; - - /* Subkeys loaded in SubKeys */ - ULONG SubKeyCounts; - - /* Space allocated in SubKeys */ - ULONG SizeOfSubKeys; - - /* List of subkeys loaded */ - struct _KEY_OBJECT **SubKeys; - - /* Time stamp for the last access by the parse routine */ - ULONG TimeStamp; - - /* List entry for connected hives */ - LIST_ENTRY HiveList; - - CACHED_CHILD_LIST ValueCache; -} KEY_OBJECT, *PKEY_OBJECT; - -// -// Key Control Block (KCB) for old Cm (just so it can talk to New CM) -// -typedef struct _CM_KEY_CONTROL_BLOCK -{ - USHORT RefCount; - USHORT Flags; - ULONG ExtFlags:8; - ULONG PrivateAlloc:1; - ULONG Delete:1; - ULONG DelayedCloseIndex:12; - ULONG TotalLevels:10; - union - { - //CM_KEY_HASH KeyHash; - struct - { - ULONG ConvKey; - PVOID NextHash; - PHHIVE KeyHive; - HCELL_INDEX KeyCell; - }; - }; - struct _CM_KEY_CONTROL_BLOCK *ParentKcb; - PVOID NameBlock; - PVOID CachedSecurity; - CACHED_CHILD_LIST ValueCache; - PVOID IndexHint; - ULONG HashKey; - ULONG SubKeyCount; - union - { - LIST_ENTRY KeyBodyListHead; - LIST_ENTRY FreeListEntry; - }; - PVOID KeyBodyArray[4]; - PVOID DelayCloseEntry; - LARGE_INTEGER KcbLastWriteTime; - USHORT KcbMaxNameLen; - USHORT KcbMaxValueNameLen; - ULONG KcbMaxValueDataLen; - ULONG InDelayClose; -} CM_KEY_CONTROL_BLOCK, *PCM_KEY_CONTROL_BLOCK; - /* Bits 31-22 (top 10 bits) of the cell index is the directory index */ #define CmiDirectoryIndex(CellIndex)(CellIndex & 0xffc000000) @@ -167,11 +63,8 @@ #define CmiByteOffset(Cellndex)(CellIndex & 0x00000fff) -extern PEREGISTRY_HIVE CmiVolatileHive; extern POBJECT_TYPE CmpKeyObjectType; extern KSPIN_LOCK CmiKeyListLock; - -extern LIST_ENTRY CmpHiveListHead; extern ERESOURCE CmpRegistryLock; extern EX_PUSH_LOCK CmpHiveListHeadLock; @@ -224,24 +117,10 @@ ULONG Flags); NTSTATUS -CmiFlushRegistryHive(PEREGISTRY_HIVE RegistryHive); - -ULONG -CmiGetMaxNameLength(IN PHHIVE RegistryHive, IN PCM_KEY_NODE KeyCell); - -ULONG -CmiGetMaxClassLength(IN PHHIVE RegistryHive, IN PCM_KEY_NODE KeyCell); - -ULONG -CmiGetMaxValueNameLength(IN PHHIVE RegistryHive, - IN PCM_KEY_NODE KeyCell); - -ULONG -CmiGetMaxValueDataLength(IN PHHIVE RegistryHive, - IN PCM_KEY_NODE KeyCell); +CmiFlushRegistryHive(PCMHIVE RegistryHive); NTSTATUS -CmiScanForSubKey(IN PEREGISTRY_HIVE RegistryHive, +CmiScanForSubKey(IN PCMHIVE RegistryHive, IN PCM_KEY_NODE KeyCell, OUT PCM_KEY_NODE *SubKeyCell, OUT HCELL_INDEX *BlockOffset, @@ -250,110 +129,19 @@ IN ULONG Attributes); NTSTATUS -CmiAddSubKey(IN PEREGISTRY_HIVE RegistryHive, - IN PKEY_OBJECT ParentKey, - OUT PKEY_OBJECT SubKey, - IN PUNICODE_STRING SubKeyName, - IN ULONG TitleIndex, - IN PUNICODE_STRING Class, - IN ULONG CreateOptions); - -NTSTATUS -CmiScanKeyForValue(IN PEREGISTRY_HIVE RegistryHive, +CmiScanKeyForValue(IN PCMHIVE RegistryHive, IN PCM_KEY_NODE KeyCell, IN PUNICODE_STRING ValueName, OUT PCM_KEY_VALUE *ValueCell, OUT HCELL_INDEX *VBOffset); -NTSTATUS -NTAPI -CmDeleteValueKey(IN PCM_KEY_CONTROL_BLOCK Kcb, - IN UNICODE_STRING ValueName); - -NTSTATUS -NTAPI -CmQueryValueKey(IN PCM_KEY_CONTROL_BLOCK Kcb, - IN UNICODE_STRING ValueName, - IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, - IN PVOID KeyValueInformation, - IN ULONG Length, - IN PULONG ResultLength); - -NTSTATUS -NTAPI -CmEnumerateValueKey(IN PCM_KEY_CONTROL_BLOCK Kcb, - IN ULONG Index, - IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, - IN PVOID KeyValueInformation, - IN ULONG Length, - IN PULONG ResultLength); - -NTSTATUS -NTAPI -CmSetValueKey(IN PCM_KEY_CONTROL_BLOCK Kcb, - IN PUNICODE_STRING ValueName, - IN ULONG Type, - IN PVOID Data, - IN ULONG DataSize); - -NTSTATUS -NTAPI -CmQueryKey(IN PCM_KEY_CONTROL_BLOCK Kcb, - IN KEY_INFORMATION_CLASS KeyInformationClass, - IN PVOID KeyInformation, - IN ULONG Length, - IN PULONG ResultLength); - -NTSTATUS -NTAPI -CmEnumerateKey(IN PCM_KEY_CONTROL_BLOCK Kcb, - IN ULONG Index, - IN KEY_INFORMATION_CLASS KeyInformationClass, - IN PVOID KeyInformation, - IN ULONG Length, - IN PULONG ResultLength); - -NTSTATUS -NTAPI -CmDeleteKey(IN PCM_KEY_CONTROL_BLOCK Kcb); NTSTATUS CmiConnectHive(POBJECT_ATTRIBUTES KeyObjectAttributes, - PEREGISTRY_HIVE RegistryHive); + PCMHIVE RegistryHive); NTSTATUS CmiInitHives(BOOLEAN SetupBoot); - -NTSTATUS -NTAPI -CmpDoCreate( - IN PHHIVE Hive, - IN HCELL_INDEX Cell, - IN PACCESS_STATE AccessState, - IN PUNICODE_STRING Name, - IN KPROCESSOR_MODE AccessMode, - IN PUNICODE_STRING Class, - IN ULONG CreateOptions, - IN PKEY_OBJECT Parent, - IN PVOID OriginatingHive OPTIONAL, - OUT PVOID *Object -); - -HCELL_INDEX -NTAPI -CmpFindValueByName( - IN PHHIVE Hive, - IN PCM_KEY_NODE KeyNode, - IN PUNICODE_STRING Name -); - -HCELL_INDEX -NTAPI -CmpFindSubKeyByName( - IN PHHIVE Hive, - IN PCM_KEY_NODE Parent, - IN PCUNICODE_STRING SearchName -); VOID CmiSyncHives(VOID); @@ -370,49 +158,8 @@ IN PVOID ParseContext ); -NTSTATUS -NTAPI -CmpOpenHiveFiles(IN PCUNICODE_STRING BaseName, - IN PCWSTR Extension OPTIONAL, - IN PHANDLE Primary, - IN PHANDLE Log, - IN PULONG PrimaryDisposition, - IN PULONG LogDisposition, - IN BOOLEAN CreateAllowed, - IN BOOLEAN MarkAsSystemHive, - IN BOOLEAN NoBuffering, - OUT PULONG ClusterSize OPTIONAL); - -NTSTATUS -NTAPI -CmpInitHiveFromFile(IN PCUNICODE_STRING HiveName, - IN ULONG HiveFlags, - OUT PEREGISTRY_HIVE *Hive, - IN OUT PBOOLEAN New, - IN ULONG CheckFlags); - // Some Ob definitions for debug messages in Cm #define ObGetObjectPointerCount(x) OBJECT_TO_OBJECT_HEADER(x)->PointerCount #define ObGetObjectHandleCount(x) OBJECT_TO_OBJECT_HEADER(x)->HandleCount -// -// System Control Vector -// -typedef struct _CM_SYSTEM_CONTROL_VECTOR -{ - PWCHAR KeyPath; - PWCHAR ValueName; - PVOID Buffer; - PULONG BufferLength; - PULONG Type; -} CM_SYSTEM_CONTROL_VECTOR, *PCM_SYSTEM_CONTROL_VECTOR; - -VOID -NTAPI -CmGetSystemControlValues( - IN PVOID SystemHiveData, - IN PCM_SYSTEM_CONTROL_VECTOR ControlVector -); - -extern CM_SYSTEM_CONTROL_VECTOR CmControlVector[]; #endif /*__INCLUDE_CM_H*/ 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 Mon Oct 29 01:38:20 2007 @@ -412,7 +412,7 @@ { NTSTATUS Status; PKEY_OBJECT KeyObject; - PEREGISTRY_HIVE RegistryHive; + PCMHIVE RegistryHive; KPROCESSOR_MODE PreviousMode; PAGED_CODE(); 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 Mon Oct 29 01:38:20 2007 @@ -12,9 +12,7 @@ #include <ntoskrnl.h> #define NDEBUG #include <internal/debug.h> - #include "cm.h" -#include "../config/cm.h" /* LOCAL MACROS *************************************************************/ @@ -29,7 +27,7 @@ IN PCUNICODE_STRING FileName, IN ULONG Flags) { - PEREGISTRY_HIVE Hive = NULL; + PCMHIVE Hive = NULL; NTSTATUS Status; BOOLEAN Allocate = TRUE; @@ -61,14 +59,14 @@ } VOID -CmCloseHiveFiles(PEREGISTRY_HIVE RegistryHive) -{ - ZwClose(RegistryHive->HiveHandle); - ZwClose(RegistryHive->LogHandle); +CmCloseHiveFiles(PCMHIVE RegistryHive) +{ + ZwClose(RegistryHive->FileHandles[HFILE_TYPE_PRIMARY]); + ZwClose(RegistryHive->FileHandles[HFILE_TYPE_LOG]); } NTSTATUS -CmiFlushRegistryHive(PEREGISTRY_HIVE RegistryHive) +CmiFlushRegistryHive(PCMHIVE RegistryHive) { BOOLEAN Success; NTSTATUS Status; @@ -81,10 +79,10 @@ return(STATUS_SUCCESS); } - Status = CmpOpenHiveFiles(&RegistryHive->HiveFileName, + Status = CmpOpenHiveFiles(&RegistryHive->FileFullPath, L".LOG", - &RegistryHive->HiveHandle, - &RegistryHive->LogHandle, + &RegistryHive->FileHandles[HFILE_TYPE_PRIMARY], + &RegistryHive->FileHandles[HFILE_TYPE_LOG], &Disposition, &Disposition, FALSE, @@ -255,7 +253,7 @@ } NTSTATUS -CmiScanKeyForValue(IN PEREGISTRY_HIVE RegistryHive, +CmiScanKeyForValue(IN PCMHIVE RegistryHive, IN PCM_KEY_NODE KeyCell, IN PUNICODE_STRING ValueName, OUT PCM_KEY_VALUE *ValueCell, @@ -278,7 +276,7 @@ } NTSTATUS -CmiScanForSubKey(IN PEREGISTRY_HIVE RegistryHive, +CmiScanForSubKey(IN PCMHIVE RegistryHive, IN PCM_KEY_NODE KeyCell, OUT PCM_KEY_NODE *SubKeyCell, OUT HCELL_INDEX *BlockOffset, Modified: trunk/reactos/ntoskrnl/cm/registry.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/registry.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/cm/registry.c (original) +++ trunk/reactos/ntoskrnl/cm/registry.c Mon Oct 29 01:38:20 2007 @@ -18,7 +18,6 @@ #include <internal/debug.h> #include "cm.h" -#include "../config/cm.h" #if defined (ALLOC_PRAGMA) #pragma alloc_text(INIT, CmInitSystem1) @@ -29,7 +28,7 @@ extern BOOLEAN ExpInTextModeSetup; POBJECT_TYPE CmpKeyObjectType = NULL; -PEREGISTRY_HIVE CmiVolatileHive = NULL; +PCMHIVE CmiVolatileHive = NULL; LIST_ENTRY CmpHiveListHead; @@ -245,7 +244,7 @@ NTAPI CmpLinkHiveToMaster(IN PUNICODE_STRING LinkName, IN HANDLE RootDirectory, - IN PEREGISTRY_HIVE RegistryHive, + IN PCMHIVE RegistryHive, IN BOOLEAN Allocate, IN PSECURITY_DESCRIPTOR SecurityDescriptor) { @@ -267,7 +266,7 @@ NTSTATUS CmiConnectHive(IN POBJECT_ATTRIBUTES KeyObjectAttributes, - IN PEREGISTRY_HIVE RegistryHive) + IN PCMHIVE RegistryHive) { UNICODE_STRING RemainingPath; PKEY_OBJECT ParentKey; @@ -671,7 +670,7 @@ VOID CmShutdownRegistry(VOID) { - PEREGISTRY_HIVE Hive; + PCMHIVE Hive; PLIST_ENTRY Entry; DPRINT("CmShutdownRegistry() called\n"); @@ -692,7 +691,7 @@ Entry = CmpHiveListHead.Flink; while (Entry != &CmpHiveListHead) { - Hive = CONTAINING_RECORD(Entry, EREGISTRY_HIVE, HiveList); + Hive = CONTAINING_RECORD(Entry, CMHIVE, HiveList); if (!(IsNoFileHive(Hive) || IsNoSynchHive(Hive))) { @@ -713,7 +712,7 @@ NTAPI CmiHiveSyncRoutine(PVOID DeferredContext) { - PEREGISTRY_HIVE Hive; + PCMHIVE Hive; PLIST_ENTRY Entry; DPRINT("CmiHiveSyncRoutine() called\n"); @@ -726,7 +725,7 @@ Entry = CmpHiveListHead.Flink; while (Entry != &CmpHiveListHead) { - Hive = CONTAINING_RECORD(Entry, EREGISTRY_HIVE, HiveList); + Hive = CONTAINING_RECORD(Entry, CMHIVE, HiveList); if (!(IsNoFileHive(Hive) || IsNoSynchHive(Hive))) { 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 Mon Oct 29 01:38:20 2007 @@ -21,7 +21,7 @@ extern ULONG CmiTimer; static NTSTATUS -CmiGetLinkTarget(PEREGISTRY_HIVE RegistryHive, +CmiGetLinkTarget(PCMHIVE RegistryHive, PCM_KEY_NODE KeyCell, PUNICODE_STRING TargetPath); @@ -809,7 +809,7 @@ } static NTSTATUS -CmiGetLinkTarget(PEREGISTRY_HIVE RegistryHive, +CmiGetLinkTarget(PCMHIVE RegistryHive, PCM_KEY_NODE KeyCell, PUNICODE_STRING TargetPath) { 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 Mon Oct 29 01:38:20 2007 @@ -92,8 +92,6 @@ PAGE_SIZE / sizeof(CM_KEY_CONTROL_BLOCK) #define CM_DELAYS_PER_PAGE \ PAGE_SIZE / sizeof(CM_DELAYED_CLOSE_ENTRY) - -#ifndef __INCLUDE_CM_H // // Value Search Results @@ -496,24 +494,13 @@ #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; - LIST_ENTRY HiveList; - UNICODE_STRING HiveFileName; - UNICODE_STRING LogFileName; - PCM_KEY_SECURITY RootSecurityCell; - ULONG Flags; - HANDLE HiveHandle; - HANDLE LogHandle; -} EREGISTRY_HIVE, *PEREGISTRY_HIVE; typedef struct _KEY_OBJECT { CSHORT Type; CSHORT Size; ULONG Flags; UNICODE_STRING Name; - PEREGISTRY_HIVE RegistryHive; + PCMHIVE RegistryHive; HCELL_INDEX KeyCellOffset; PCM_KEY_NODE KeyCell; struct _KEY_OBJECT *ParentKey; @@ -525,7 +512,7 @@ LIST_ENTRY HiveList; CACHED_CHILD_LIST ValueCache; } KEY_OBJECT, *PKEY_OBJECT; -extern PEREGISTRY_HIVE CmiVolatileHive; +extern PCMHIVE CmiVolatileHive; extern LIST_ENTRY CmiKeyObjectListHead, CmiConnectedHiveList; extern KTIMER CmiWorkerTimer; VOID NTAPI CmiWorkerThread(IN PVOID Param); @@ -755,8 +742,6 @@ IN PSECURITY_DESCRIPTOR SecurityDescriptor ); -/* NOTE: This function declaration is currently duplicated in both */ -/* cm/cm.h and config/cm.h. TODO: Pick one single place to declare it. */ NTSTATUS NTAPI CmpOpenHiveFiles( @@ -772,6 +757,16 @@ OUT PULONG ClusterSize OPTIONAL ); +NTSTATUS +NTAPI +CmpInitHiveFromFile( + IN PCUNICODE_STRING HiveName, + IN ULONG HiveFlags, + OUT PCMHIVE *Hive, + IN OUT PBOOLEAN New, + IN ULONG CheckFlags +); + // // Registry Utility Functions // @@ -832,7 +827,7 @@ #if 0 IN PCM_KEY_BODY KeyObject, #else - IN PVOID KeyObject, + IN PKEY_OBJECT KeyObject, #endif IN ULONG Flags ); @@ -918,11 +913,27 @@ ); // +// Open/Create Routines +// +NTSTATUS +NTAPI +CmpDoCreate( + IN PHHIVE Hive, + IN HCELL_INDEX Cell, + IN PACCESS_STATE AccessState, + IN PUNICODE_STRING Name, + IN KPROCESSOR_MODE AccessMode, + IN PUNICODE_STRING Class, + IN ULONG CreateOptions, + IN PKEY_OBJECT Parent, + IN PCMHIVE OriginatingHive OPTIONAL, + OUT PVOID *Object +); + +// // Cell Index Routines // -/* NOTE: This function declaration is currently duplicated in both */ -/* cm/cm.h and config/cm.h. TODO: Pick one single place to declare it. */ HCELL_INDEX NTAPI CmpFindSubKeyByName( @@ -1063,6 +1074,14 @@ IN PUNICODE_STRING SelectKeyName, OUT PBOOLEAN AutoSelect ); + +VOID +NTAPI +CmGetSystemControlValues( + IN PVOID SystemHiveData, + IN PCM_SYSTEM_CONTROL_VECTOR ControlVector +); + // // Hardware Configuration Routines @@ -1152,6 +1171,71 @@ IN ULONG FileType, IN OUT PLARGE_INTEGER FileOffset, IN ULONG Length +); + +// +// Configuration Manager side of Registry System Calls +// +NTSTATUS +NTAPI +CmEnumerateValueKey( + IN PCM_KEY_CONTROL_BLOCK Kcb, + IN ULONG Index, + IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, + IN PVOID KeyValueInformation, + IN ULONG Length, + IN PULONG ResultLength); + +NTSTATUS +NTAPI +CmSetValueKey( + IN PCM_KEY_CONTROL_BLOCK Kcb, + IN PUNICODE_STRING ValueName, + IN ULONG Type, + IN PVOID Data, + IN ULONG DataSize); + +NTSTATUS +NTAPI +CmQueryKey(IN PCM_KEY_CONTROL_BLOCK Kcb, + IN KEY_INFORMATION_CLASS KeyInformationClass, + IN PVOID KeyInformation, + IN ULONG Length, + IN PULONG ResultLength +); + +NTSTATUS +NTAPI +CmEnumerateKey(IN PCM_KEY_CONTROL_BLOCK Kcb, + IN ULONG Index, + IN KEY_INFORMATION_CLASS KeyInformationClass, + IN PVOID KeyInformation, + IN ULONG Length, + IN PULONG ResultLength +); + +NTSTATUS +NTAPI +CmDeleteKey( + IN PCM_KEY_CONTROL_BLOCK Kcb +); + +NTSTATUS +NTAPI +CmDeleteValueKey( + IN PCM_KEY_CONTROL_BLOCK Kcb, + IN UNICODE_STRING ValueName +); + +NTSTATUS +NTAPI +CmQueryValueKey( + IN PCM_KEY_CONTROL_BLOCK Kcb, + IN UNICODE_STRING ValueName, + IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, + IN PVOID KeyValueInformation, + IN ULONG Length, + IN PULONG ResultLength ); // @@ -1197,5 +1281,3 @@ // Inlined functions // #include "cm_x.h" - -#endif 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 Mon Oct 29 01:38:20 2007 @@ -1052,8 +1052,8 @@ } /* Make sure we're file-backed */ - if (!(IsNoFileHive((PEREGISTRY_HIVE)Kcb->KeyHive)) || - !(IsNoFileHive((PEREGISTRY_HIVE)Kcb->ParentKcb->KeyHive))) + if (!(IsNoFileHive((PCMHIVE)Kcb->KeyHive)) || + !(IsNoFileHive((PCMHIVE)Kcb->ParentKcb->KeyHive))) { /* Sync up the hives */ CmiSyncHives(); Modified: trunk/reactos/ntoskrnl/config/cminit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cminit.c?r…
============================================================================== --- trunk/reactos/ntoskrnl/config/cminit.c (original) +++ trunk/reactos/ntoskrnl/config/cminit.c Mon Oct 29 01:38:20 2007 @@ -28,12 +28,8 @@ IN PCUNICODE_STRING FileName OPTIONAL, IN ULONG CheckFlags) { -#if 0 PCMHIVE Hive; -#else - PEREGISTRY_HIVE Hive; FILE_STANDARD_INFORMATION FileInformation; -#endif IO_STATUS_BLOCK IoStatusBlock; FILE_FS_SIZE_INFORMATION FileSizeInformation; NTSTATUS Status; @@ -89,9 +85,9 @@ } /* Allocate the hive */ - Hive = ExAllocatePoolWithTag(NonPagedPool, sizeof(EREGISTRY_HIVE), TAG_CM); + Hive = ExAllocatePoolWithTag(NonPagedPool, sizeof(CMHIVE), TAG_CM); if (!Hive) return STATUS_INSUFFICIENT_RESOURCES; -#if 0 + /* Setup null fields */ Hive->UnloadEvent = NULL; Hive->RootKcb = NULL; @@ -142,11 +138,11 @@ ExInitializeResourceLite(Hive->FlusherLock); /* Setup hive locks */ - ExInitializePushLock(&Hive->HiveLock); + ExInitializePushLock((PULONG_PTR)&Hive->HiveLock); Hive->HiveLockOwner = NULL; - ExInitializePushLock(&Hive->WriterLock); + ExInitializePushLock((PULONG_PTR)&Hive->WriterLock); Hive->WriterLockOwner = NULL; - ExInitializePushLock(&Hive->SecurityLock); + ExInitializePushLock((PULONG_PTR)&Hive->SecurityLock); Hive->HiveSecurityLockOwner = NULL; /* Clear file names */ @@ -154,22 +150,17 @@ RtlInitEmptyUnicodeString(&Hive->FileFullPath, NULL, 0); /* Initialize the view list */ - CmpInitializeHiveViewList(Hive); + CmpInitHiveViewList(Hive); /* Initailize the security cache */ - CmpInitializeSecurityCache(Hive); + CmpInitSecurityCache(Hive); /* Setup flags */ Hive->Flags = 0; Hive->FlushCount = 0; -#else - /* Clear it */ - RtlZeroMemory(Hive, sizeof(EREGISTRY_HIVE)); /* Set flags */ Hive->Flags = HiveFlags; - Hive->HiveHandle = Primary; - Hive->LogHandle = Log; /* Check how large the file is */ ZwQueryInformationFile(Primary, @@ -178,7 +169,6 @@ sizeof(FileInformation), FileStandardInformation); Cluster = FileInformation.EndOfFile.LowPart; -#endif /* Initialize it */ Status = HvInitialize(&Hive->Hive, @@ -197,10 +187,8 @@ if (!NT_SUCCESS(Status)) { /* Clear allocations and fail */ -#if 0 ExFreePool(Hive->ViewLock); ExFreePool(Hive->FlusherLock); -#endif ExFreePool(Hive); return Status; } @@ -215,10 +203,8 @@ if (CmCheckRegistry((PCMHIVE)Hive, TRUE)) { /* Free all alocations */ -#if 0 ExFreePool(Hive->ViewLock); ExFreePool(Hive->FlusherLock); -#endif ExFreePool(Hive); return STATUS_REGISTRY_CORRUPT; } Modified: trunk/reactos/ntoskrnl/config/cmparse.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmparse.c?…
============================================================================== --- trunk/reactos/ntoskrnl/config/cmparse.c (original) +++ trunk/reactos/ntoskrnl/config/cmparse.c Mon Oct 29 01:38:20 2007 @@ -267,7 +267,7 @@ if (!Class) Class = &LocalClass; /* Acquire the flusher lock */ - //ExAcquirePushLockShared((PVOID)&((PCMHIVE)Hive)->FlusherLock); + ExAcquirePushLockShared((PVOID)&((PCMHIVE)Hive)->FlusherLock); /* Check if the parent is being deleted */ #define KO_MARKED_FOR_DELETE 0x00000001 @@ -397,6 +397,6 @@ Exit: /* Release the flusher lock and return status */ - //ExReleasePushLock((PVOID)&((PCMHIVE)Hive)->FlusherLock); + ExReleasePushLock((PVOID)&((PCMHIVE)Hive)->FlusherLock); return Status; } Modified: trunk/reactos/ntoskrnl/config/cmsysini.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmsysini.c…
============================================================================== --- trunk/reactos/ntoskrnl/config/cmsysini.c (original) +++ trunk/reactos/ntoskrnl/config/cmsysini.c Mon Oct 29 01:38:20 2007 @@ -32,7 +32,7 @@ HANDLE FileHandle = NULL, LogHandle = NULL; NTSTATUS Status; ULONG Operation, FileType; - PEREGISTRY_HIVE NewHive; + PCMHIVE NewHive; PAGED_CODE(); /* Assume failure */ @@ -110,24 +110,24 @@ } /* Success, return hive */ - *Hive = (PCMHIVE)NewHive; + *Hive = NewHive; /* ROS: Init root key cell and prepare the hive */ if (Operation == HINIT_CREATE) CmCreateRootNode(&NewHive->Hive, L""); CmPrepareHive(&NewHive->Hive); /* Duplicate the hive name */ - NewHive->HiveFileName.Buffer = ExAllocatePoolWithTag(PagedPool, + NewHive->FileFullPath.Buffer = ExAllocatePoolWithTag(PagedPool, HiveName->Length, TAG_CM); - if (NewHive->HiveFileName.Buffer) + if (NewHive->FileFullPath.Buffer) { /* Copy the string */ - RtlCopyMemory(NewHive->HiveFileName.Buffer, + RtlCopyMemory(NewHive->FileFullPath.Buffer, HiveName->Buffer, HiveName->Length); - NewHive->HiveFileName.Length = HiveName->Length; - NewHive->HiveFileName.MaximumLength = HiveName->MaximumLength; + NewHive->FileFullPath.Length = HiveName->Length; + NewHive->FileFullPath.MaximumLength = HiveName->MaximumLength; } /* ROS: Close the hive files */ @@ -434,7 +434,7 @@ NTSTATUS Status; BOOLEAN Allocate; UNICODE_STRING KeyName; - PEREGISTRY_HIVE SystemHive = NULL; + PCMHIVE SystemHive = NULL; UNICODE_STRING HiveName = RTL_CONSTANT_STRING(L"SYSTEM"); PSECURITY_DESCRIPTOR SecurityDescriptor; PAGED_CODE(); @@ -479,7 +479,7 @@ CmPrepareHive(&SystemHive->Hive); /* Set the hive filename */ - RtlCreateUnicodeString(&SystemHive->HiveFileName, SYSTEM_REG_FILE); + RtlCreateUnicodeString(&SystemHive->FileFullPath, SYSTEM_REG_FILE); /* We imported, no need to create a new hive */ Allocate = FALSE; @@ -756,7 +756,7 @@ LARGE_INTEGER DueTime; HANDLE ThreadHandle; CLIENT_ID ThreadId; - PEREGISTRY_HIVE HardwareHive; + PCMHIVE HardwareHive; PVOID BaseAddress; ULONG Length; PSECURITY_DESCRIPTOR SecurityDescriptor; Modified: trunk/reactos/ntoskrnl/config/cmwraprs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmwraprs.c…
============================================================================== --- trunk/reactos/ntoskrnl/config/cmwraprs.c (original) +++ trunk/reactos/ntoskrnl/config/cmwraprs.c Mon Oct 29 01:38:20 2007 @@ -77,8 +77,8 @@ OUT PVOID Buffer, IN SIZE_T BufferLength) { - PEREGISTRY_HIVE CmHive = (PEREGISTRY_HIVE)RegistryHive; - HANDLE HiveHandle = FileType == HFILE_TYPE_PRIMARY ? CmHive->HiveHandle : CmHive->LogHandle; + PCMHIVE CmHive = (PCMHIVE)RegistryHive; + HANDLE HiveHandle = CmHive->FileHandles[FileType]; LARGE_INTEGER _FileOffset; IO_STATUS_BLOCK IoStatusBlock; NTSTATUS Status; @@ -97,8 +97,8 @@ IN PVOID Buffer, IN SIZE_T BufferLength) { - PEREGISTRY_HIVE CmHive = (PEREGISTRY_HIVE)RegistryHive; - HANDLE HiveHandle = FileType == HFILE_TYPE_PRIMARY ? CmHive->HiveHandle : CmHive->LogHandle; + PCMHIVE CmHive = (PCMHIVE)RegistryHive; + HANDLE HiveHandle = CmHive->FileHandles[FileType]; LARGE_INTEGER _FileOffset; IO_STATUS_BLOCK IoStatusBlock; NTSTATUS Status; @@ -116,8 +116,8 @@ IN ULONG FileSize, IN ULONG OldFileSize) { - PEREGISTRY_HIVE CmHive = (PEREGISTRY_HIVE)RegistryHive; - HANDLE HiveHandle = FileType == HFILE_TYPE_PRIMARY ? CmHive->HiveHandle : CmHive->LogHandle; + PCMHIVE CmHive = (PCMHIVE)RegistryHive; + HANDLE HiveHandle = CmHive->FileHandles[FileType]; FILE_END_OF_FILE_INFORMATION EndOfFileInfo; FILE_ALLOCATION_INFORMATION FileAllocationInfo; IO_STATUS_BLOCK IoStatusBlock; @@ -149,8 +149,8 @@ IN OUT PLARGE_INTEGER FileOffset, IN ULONG Length) { - PEREGISTRY_HIVE CmHive = (PEREGISTRY_HIVE)RegistryHive; - HANDLE HiveHandle = FileType == HFILE_TYPE_PRIMARY ? CmHive->HiveHandle : CmHive->LogHandle; + PCMHIVE CmHive = (PCMHIVE)RegistryHive; + HANDLE HiveHandle = CmHive->FileHandles[FileType]; IO_STATUS_BLOCK IoStatusBlock; NTSTATUS Status; Modified: trunk/reactos/tools/mkhive/binhive.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/mkhive/binhive.c?rev…
============================================================================== --- trunk/reactos/tools/mkhive/binhive.c (original) +++ trunk/reactos/tools/mkhive/binhive.c Mon Oct 29 01:38:20 2007 @@ -32,7 +32,7 @@ BOOL ExportBinaryHive( IN PCSTR FileName, - IN PEREGISTRY_HIVE Hive) + IN PCMHIVE Hive) { FILE *File; BOOL ret; @@ -49,7 +49,7 @@ fseek (File, 0, SEEK_SET); - Hive->HiveHandle = (HANDLE)File; + Hive->FileHandles[HFILE_TYPE_PRIMARY] = (HANDLE)File; ret = HvWriteHive(&Hive->Hive); fclose (File); return ret; Modified: trunk/reactos/tools/mkhive/binhive.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/mkhive/binhive.h?rev…
============================================================================== --- trunk/reactos/tools/mkhive/binhive.h (original) +++ trunk/reactos/tools/mkhive/binhive.h Mon Oct 29 01:38:20 2007 @@ -29,7 +29,7 @@ BOOL ExportBinaryHive( IN PCSTR FileName, - IN PEREGISTRY_HIVE Hive); + IN PCMHIVE Hive); #endif /* __BINHIVE_H__ */ Modified: trunk/reactos/tools/mkhive/cmi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/mkhive/cmi.c?rev=299…
============================================================================== --- trunk/reactos/tools/mkhive/cmi.c (original) +++ trunk/reactos/tools/mkhive/cmi.c Mon Oct 29 01:38:20 2007 @@ -67,8 +67,8 @@ IN PVOID Buffer, IN SIZE_T BufferLength) { - PEREGISTRY_HIVE CmHive = (PEREGISTRY_HIVE)RegistryHive; - FILE *File = CmHive->HiveHandle; + PCMHIVE CmHive = (PCMHIVE)RegistryHive; + FILE *File = CmHive->FileHandles[HFILE_TYPE_PRIMARY]; if (0 != fseek (File, *FileOffset, SEEK_SET)) return FALSE; return BufferLength == fwrite (Buffer, 1, BufferLength, File); @@ -94,20 +94,20 @@ PLARGE_INTEGER FileOffset, ULONG Length) { - PEREGISTRY_HIVE CmHive = (PEREGISTRY_HIVE)RegistryHive; - FILE *File = CmHive->HiveHandle; + PCMHIVE CmHive = (PCMHIVE)RegistryHive; + FILE *File = CmHive->FileHandles[HFILE_TYPE_PRIMARY]; return 0 == fflush (File); } NTSTATUS CmiInitializeTempHive( - IN OUT PEREGISTRY_HIVE Hive) + IN OUT PCMHIVE Hive) { NTSTATUS Status; RtlZeroMemory ( Hive, - sizeof(EREGISTRY_HIVE)); + sizeof(CMHIVE)); DPRINT("Hive 0x%p\n", Hive); @@ -149,7 +149,7 @@ static NTSTATUS CmiAddKeyToHashTable( - IN PEREGISTRY_HIVE RegistryHive, + IN PCMHIVE RegistryHive, IN OUT PCM_KEY_FAST_INDEX HashCell, IN PCM_KEY_NODE KeyCell, IN HSTORAGE_TYPE StorageType, @@ -189,7 +189,7 @@ static NTSTATUS CmiAllocateHashTableCell ( - IN PEREGISTRY_HIVE RegistryHive, + IN PCMHIVE RegistryHive, OUT PCM_KEY_FAST_INDEX *HashBlock, OUT HCELL_INDEX *HBOffset, IN USHORT SubKeyCount, @@ -223,7 +223,7 @@ NTSTATUS CmiAddSubKey( - IN PEREGISTRY_HIVE RegistryHive, + IN PCMHIVE RegistryHive, IN PCM_KEY_NODE ParentKeyCell, IN HCELL_INDEX ParentKeyCellOffset, IN PCUNICODE_STRING SubKeyName, @@ -513,7 +513,7 @@ NTSTATUS CmiScanForSubKey( - IN PEREGISTRY_HIVE RegistryHive, + IN PCMHIVE RegistryHive, IN PCM_KEY_NODE KeyCell, IN PCUNICODE_STRING SubKeyName, IN ULONG Attributes, @@ -611,7 +611,7 @@ static NTSTATUS CmiAllocateValueCell( - IN PEREGISTRY_HIVE RegistryHive, + IN PCMHIVE RegistryHive, OUT PCM_KEY_VALUE *ValueCell, OUT HCELL_INDEX *VBOffset, IN PCUNICODE_STRING ValueName, @@ -666,7 +666,7 @@ NTSTATUS CmiAddValueKey( - IN PEREGISTRY_HIVE RegistryHive, + IN PCMHIVE RegistryHive, IN PCM_KEY_NODE KeyCell, IN HCELL_INDEX KeyCellOffset, IN PCUNICODE_STRING ValueName, @@ -780,7 +780,7 @@ NTSTATUS CmiScanForValueKey( - IN PEREGISTRY_HIVE RegistryHive, + IN PCMHIVE RegistryHive, IN PCM_KEY_NODE KeyCell, IN PCUNICODE_STRING ValueName, OUT PCM_KEY_VALUE *pValueCell, Modified: trunk/reactos/tools/mkhive/cmi.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/mkhive/cmi.h?rev=299…
============================================================================== --- trunk/reactos/tools/mkhive/cmi.h (original) +++ trunk/reactos/tools/mkhive/cmi.h Mon Oct 29 01:38:20 2007 @@ -28,11 +28,11 @@ NTSTATUS CmiInitializeTempHive( - IN OUT PEREGISTRY_HIVE Hive); + IN OUT PCMHIVE Hive); NTSTATUS CmiAddSubKey( - IN PEREGISTRY_HIVE RegistryHive, + IN PCMHIVE RegistryHive, IN PCM_KEY_NODE ParentKeyCell, IN HCELL_INDEX ParentKeyCellOffset, IN PCUNICODE_STRING SubKeyName, @@ -42,7 +42,7 @@ NTSTATUS CmiScanForSubKey( - IN PEREGISTRY_HIVE RegistryHive, + IN PCMHIVE RegistryHive, IN PCM_KEY_NODE KeyCell, IN PCUNICODE_STRING SubKeyName, IN ULONG Attributes, @@ -51,7 +51,7 @@ NTSTATUS CmiAddValueKey( - IN PEREGISTRY_HIVE RegistryHive, + IN PCMHIVE RegistryHive, IN PCM_KEY_NODE KeyCell, IN HCELL_INDEX KeyCellOffset, IN PCUNICODE_STRING ValueName, @@ -60,7 +60,7 @@ NTSTATUS CmiScanForValueKey( - IN PEREGISTRY_HIVE RegistryHive, + IN PCMHIVE RegistryHive, IN PCM_KEY_NODE KeyCell, IN PCUNICODE_STRING ValueName, OUT PCM_KEY_VALUE *pValueCell, Modified: trunk/reactos/tools/mkhive/registry.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/mkhive/registry.c?re…
============================================================================== --- trunk/reactos/tools/mkhive/registry.c (original) +++ trunk/reactos/tools/mkhive/registry.c Mon Oct 29 01:38:20 2007 @@ -40,17 +40,17 @@ #define REG_DATA_SIZE_MASK 0x7FFFFFFF #define REG_DATA_IN_OFFSET 0x80000000 -static EREGISTRY_HIVE RootHive; +static CMHIVE RootHive; static MEMKEY RootKey; -EREGISTRY_HIVE DefaultHive; /* \Registry\User\.DEFAULT */ -EREGISTRY_HIVE SamHive; /* \Registry\Machine\SAM */ -EREGISTRY_HIVE SecurityHive; /* \Registry\Machine\SECURITY */ -EREGISTRY_HIVE SoftwareHive; /* \Registry\Machine\SOFTWARE */ -EREGISTRY_HIVE SystemHive; /* \Registry\Machine\SYSTEM */ +CMHIVE DefaultHive; /* \Registry\User\.DEFAULT */ +CMHIVE SamHive; /* \Registry\Machine\SAM */ +CMHIVE SecurityHive; /* \Registry\Machine\SECURITY */ +CMHIVE SoftwareHive; /* \Registry\Machine\SOFTWARE */ +CMHIVE SystemHive; /* \Registry\Machine\SYSTEM */ static MEMKEY CreateInMemoryStructure( - IN PEREGISTRY_HIVE RegistryHive, + IN PCMHIVE RegistryHive, IN HCELL_INDEX KeyCellOffset, IN PCUNICODE_STRING KeyName) { @@ -569,7 +569,7 @@ static BOOL ConnectRegistry( IN HKEY RootKey, - IN PEREGISTRY_HIVE HiveToConnect, + IN PCMHIVE HiveToConnect, IN LPCWSTR Path) { NTSTATUS Status; @@ -599,7 +599,7 @@ static BOOL MyExportBinaryHive (PCHAR FileName, - PEREGISTRY_HIVE RootHive) + PCMHIVE RootHive) { FILE *File; BOOL ret; @@ -614,7 +614,7 @@ fseek (File, 0, SEEK_SET); - RootHive->HiveHandle = (HANDLE)File; + RootHive->FileHandles[HFILE_TYPE_PRIMARY] = (HANDLE)File; ret = HvWriteHive(&RootHive->Hive); fclose (File); return ret; Modified: trunk/reactos/tools/mkhive/registry.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/mkhive/registry.h?re…
============================================================================== --- trunk/reactos/tools/mkhive/registry.h (original) +++ trunk/reactos/tools/mkhive/registry.h Mon Oct 29 01:38:20 2007 @@ -41,7 +41,7 @@ /* Information on hard disk structure */ HCELL_INDEX KeyCellOffset; PCM_KEY_NODE KeyCell; - PEREGISTRY_HIVE RegistryHive; + PCMHIVE RegistryHive; /* Used when linking to another key */ struct _REG_KEY* LinkedKey; @@ -50,11 +50,11 @@ #define HKEY_TO_MEMKEY(hKey) ((MEMKEY)(hKey)) #define MEMKEY_TO_HKEY(memKey) ((HKEY)(memKey)) -extern EREGISTRY_HIVE DefaultHive; /* \Registry\User\.DEFAULT */ -extern EREGISTRY_HIVE SamHive; /* \Registry\Machine\SAM */ -extern EREGISTRY_HIVE SecurityHive; /* \Registry\Machine\SECURITY */ -extern EREGISTRY_HIVE SoftwareHive; /* \Registry\Machine\SOFTWARE */ -extern EREGISTRY_HIVE SystemHive; /* \Registry\Machine\SYSTEM */ +extern CMHIVE DefaultHive; /* \Registry\User\.DEFAULT */ +extern CMHIVE SamHive; /* \Registry\Machine\SAM */ +extern CMHIVE SecurityHive; /* \Registry\Machine\SECURITY */ +extern CMHIVE SoftwareHive; /* \Registry\Machine\SOFTWARE */ +extern CMHIVE SystemHive; /* \Registry\Machine\SYSTEM */ #define ERROR_SUCCESS 0L #define ERROR_UNSUCCESSFUL 1L @@ -127,3 +127,4 @@ /* EOF */ +
17 years, 1 month
1
0
0
0
[fireball] 29943: - Move registry shareable types (not internal to ntoskrnl's configuration manager) to cmdata.h, so that freeldr/mkhive can access them too. - Remove all the ReactOS-specific versions of those types. - Change all code referencing the ReactOS-specific versions to use the real NT versions, and fix any related code to properly use the new fields.
by fireball@svn.reactos.org
Author: fireball Date: Mon Oct 29 00:31:46 2007 New Revision: 29943 URL:
http://svn.reactos.org/svn/reactos?rev=29943&view=rev
Log: - Move registry shareable types (not internal to ntoskrnl's configuration manager) to cmdata.h, so that freeldr/mkhive can access them too. - Remove all the ReactOS-specific versions of those types. - Change all code referencing the ReactOS-specific versions to use the real NT versions, and fix any related code to properly use the new fields. Modified: trunk/reactos/boot/freeldr/freeldr/reactos/binhive.c trunk/reactos/include/host/typedefs.h trunk/reactos/lib/cmlib/cmdata.h trunk/reactos/lib/cmlib/cminit.c trunk/reactos/lib/cmlib/cmlib.h trunk/reactos/lib/cmlib/hivedata.h 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/cmsysini.c trunk/reactos/tools/mkhive/cmi.c trunk/reactos/tools/mkhive/registry.c Modified: trunk/reactos/boot/freeldr/freeldr/reactos/binhive.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/react…
============================================================================== --- trunk/reactos/boot/freeldr/freeldr/reactos/binhive.c (original) +++ trunk/reactos/boot/freeldr/freeldr/reactos/binhive.c Mon Oct 29 00:31:46 2007 @@ -23,6 +23,9 @@ #include <cmlib.h> #include <debug.h> +#define REG_DATA_SIZE_MASK 0x7FFFFFFF +#define REG_DATA_IN_OFFSET 0x80000000 + /* FUNCTIONS ****************************************************************/ static PVOID @@ -46,20 +49,20 @@ PHCELL_INDEX HBOffset, ULONG SubKeyCount) { - PHASH_TABLE_CELL HashCell; + PCM_KEY_FAST_INDEX HashCell; ULONG NewHashSize; - NewHashSize = sizeof(HASH_TABLE_CELL) + - (SubKeyCount * sizeof(HASH_RECORD)); + NewHashSize = sizeof(CM_KEY_FAST_INDEX) + + (SubKeyCount * sizeof(CM_INDEX)); *HBOffset = HvAllocateCell (Hive, NewHashSize, Stable, HCELL_NIL); if (*HBOffset == HCELL_NIL) { return FALSE; } - HashCell = (PHASH_TABLE_CELL)HvGetCell (Hive, *HBOffset); - HashCell->Id = REG_HASH_TABLE_CELL_ID; - HashCell->HashTableSize = SubKeyCount; + HashCell = (PCM_KEY_FAST_INDEX)HvGetCell (Hive, *HBOffset); + HashCell->Signature = CM_KEY_FAST_LEAF; + HashCell->Count = SubKeyCount; return TRUE; } @@ -71,21 +74,21 @@ PCM_KEY_NODE NewKeyCell, HCELL_INDEX NKBOffset) { - PHASH_TABLE_CELL HashBlock; + PCM_KEY_FAST_INDEX HashBlock; PCM_KEY_NODE ParentKeyCell; ULONG i; ParentKeyCell = (PVOID)HvGetCell (Hive, Parent); HashBlock = (PVOID)HvGetCell (Hive, ParentKeyCell->SubKeyLists[Stable]); - for (i = 0; i < HashBlock->HashTableSize; i++) - { - if (HashBlock->Table[i].KeyOffset == 0) - { - HashBlock->Table[i].KeyOffset = NKBOffset; - memcpy (&HashBlock->Table[i].HashValue, + for (i = 0; i < HashBlock->Count; i++) + { + if (HashBlock->List[i].Cell == 0) + { + HashBlock->List[i].Cell = NKBOffset; + memcpy (&HashBlock->List[i].HashKey, NewKeyCell->Name, - min(NewKeyCell->NameSize, sizeof(ULONG))); + min(NewKeyCell->NameLength, sizeof(ULONG))); ParentKeyCell->SubKeyCounts[Stable]++; return TRUE; } @@ -122,21 +125,21 @@ PWCHAR ValueName) { PCM_KEY_VALUE NewValueCell; - ULONG NameSize; + ULONG NameLength; BOOLEAN Packable = TRUE; ULONG i; - NameSize = (ValueName == NULL) ? 0 : wcslen (ValueName); - for (i = 0; i < NameSize; i++) + NameLength = (ValueName == NULL) ? 0 : wcslen (ValueName); + for (i = 0; i < NameLength; i++) { if (ValueName[i] & 0xFF00) { - NameSize *= sizeof(WCHAR); + NameLength *= sizeof(WCHAR); Packable = FALSE; break; } } - *ValueCellOffset = HvAllocateCell (Hive, sizeof(CM_KEY_VALUE) + NameSize, Stable, HCELL_NIL); + *ValueCellOffset = HvAllocateCell (Hive, sizeof(CM_KEY_VALUE) + NameLength, Stable, HCELL_NIL); if (*ValueCellOffset == HCELL_NIL) { DbgPrint((DPRINT_REGISTRY, "CmiAllocateCell() failed\n")); @@ -144,29 +147,29 @@ } NewValueCell = (PCM_KEY_VALUE) HvGetCell (Hive, *ValueCellOffset); - NewValueCell->Id = REG_VALUE_CELL_ID; - NewValueCell->NameSize = NameSize; + NewValueCell->Signature = CM_KEY_VALUE_SIGNATURE; + NewValueCell->NameLength = NameLength; NewValueCell->Flags = 0; - if (NameSize > 0) + if (NameLength > 0) { if (Packable) { - for (i = 0; i < NameSize; i++) + for (i = 0; i < NameLength; i++) { ((PCHAR)NewValueCell->Name)[i] = (CHAR)ValueName[i]; } - NewValueCell->Flags |= REG_VALUE_NAME_PACKED; + NewValueCell->Flags |= VALUE_COMP_NAME; } else { memcpy (NewValueCell->Name, ValueName, - NameSize); + NameLength); } } - NewValueCell->DataType = 0; - NewValueCell->DataSize = 0; - NewValueCell->DataOffset = -1; + NewValueCell->Type = 0; + NewValueCell->DataLength = 0; + NewValueCell->Data = -1; *ValueCell = NewValueCell; @@ -212,13 +215,13 @@ HCELL_INDEX DataCellOffset; PCM_KEY_VALUE ValueCell; PVOID DataCell; - ULONG DataSize; - ULONG DataType; + ULONG DataLength; + ULONG Type; PCHAR Data; DbgPrint((DPRINT_REGISTRY, "CmiExportValue('%S') called\n", (Value == NULL) ? "<default>" : (PCHAR)Value->Name)); - DbgPrint((DPRINT_REGISTRY, "DataSize %lu\n", + DbgPrint((DPRINT_REGISTRY, "DataLength %lu\n", (Value == NULL) ? Key->DataSize : Value->DataSize)); /* Allocate value cell */ @@ -234,42 +237,42 @@ if (Value == NULL) { - DataType = Key->DataType; - DataSize = Key->DataSize; + Type = Key->DataType; + DataLength = Key->DataSize; Data = Key->Data; } else { - DataType = Value->DataType; - DataSize = Value->DataSize; + Type = Value->DataType; + DataLength = Value->DataSize; Data = Value->Data; } - if (DataSize <= sizeof(HCELL_INDEX)) - { - ValueCell->DataSize = DataSize | REG_DATA_IN_OFFSET; - ValueCell->DataType = DataType; - memcpy (&ValueCell->DataOffset, + if (DataLength <= sizeof(HCELL_INDEX)) + { + ValueCell->DataLength = DataLength | REG_DATA_IN_OFFSET; + ValueCell->Type = Type; + memcpy (&ValueCell->Data, &Data, - DataSize); + DataLength); } else { /* Allocate data cell */ - DataCellOffset = HvAllocateCell (Hive, DataSize, Stable, HCELL_NIL); + DataCellOffset = HvAllocateCell (Hive, DataLength, Stable, HCELL_NIL); if (DataCellOffset == HCELL_NIL) { return FALSE; } - ValueCell->DataOffset = DataCellOffset; - ValueCell->DataSize = DataSize; - ValueCell->DataType = DataType; + ValueCell->Data = DataCellOffset; + ValueCell->DataLength = DataLength; + ValueCell->Type = Type; DataCell = (PVOID)HvGetCell (Hive, DataCellOffset); memcpy (DataCell, Data, - DataSize); + DataLength); } return TRUE; @@ -292,7 +295,7 @@ PVALUE Value; BOOLEAN Packable = TRUE; ULONG i; - ULONG NameSize; + ULONG NameLength; DbgPrint((DPRINT_REGISTRY, "CmiExportSubKey('%S') called\n", Key->Name)); @@ -300,19 +303,19 @@ if (Key->DataType == REG_LINK) return TRUE; - NameSize = (Key->NameSize - sizeof(WCHAR)) / sizeof(WCHAR); - for (i = 0; i < NameSize; i++) + NameLength = (Key->NameSize - sizeof(WCHAR)) / sizeof(WCHAR); + for (i = 0; i < NameLength; i++) { if (Key->Name[i] & 0xFF00) { Packable = FALSE; - NameSize *= sizeof(WCHAR); + NameLength *= sizeof(WCHAR); break; } } /* Allocate key cell */ - KeyCellSize = sizeof(CM_KEY_NODE) + NameSize; + KeyCellSize = sizeof(CM_KEY_NODE) + NameLength; NKBOffset = HvAllocateCell (Hive, KeyCellSize, Stable, HCELL_NIL); if (NKBOffset == HCELL_NIL) { @@ -322,7 +325,7 @@ /* Initialize key cell */ NewKeyCell = (PCM_KEY_NODE) HvGetCell (Hive, NKBOffset); - NewKeyCell->Id = REG_KEY_CELL_ID; + NewKeyCell->Signature = CM_KEY_NODE_SIGNATURE; NewKeyCell->Flags = 0; NewKeyCell->LastWriteTime.QuadPart = 0ULL; NewKeyCell->Parent = Parent; @@ -330,24 +333,24 @@ NewKeyCell->SubKeyLists[Stable] = -1; NewKeyCell->ValueList.Count = 0; NewKeyCell->ValueList.List = -1; - NewKeyCell->SecurityKeyOffset = -1; - NewKeyCell->ClassNameOffset = -1; - NewKeyCell->NameSize = NameSize; - NewKeyCell->ClassSize = 0; + NewKeyCell->Security = -1; + NewKeyCell->Class = -1; + NewKeyCell->NameLength = NameLength; + NewKeyCell->ClassLength = 0; if (Packable) { - for (i = 0; i < NameSize; i++) + for (i = 0; i < NameLength; i++) { ((PCHAR)NewKeyCell->Name)[i] = (CHAR)Key->Name[i]; } - NewKeyCell->Flags |= REG_KEY_NAME_PACKED; + NewKeyCell->Flags |= KEY_COMP_NAME; } else { memcpy (NewKeyCell->Name, Key->Name, - NameSize); + NameLength); } /* Add key cell to the parent key's hash table */ @@ -527,45 +530,45 @@ PVOID DataCell; PWCHAR wName; LONG Error; - ULONG DataSize; + ULONG DataLength; ULONG i; - if (ValueCell->Id != REG_VALUE_CELL_ID) + if (ValueCell->Signature != CM_KEY_VALUE_SIGNATURE) { DbgPrint((DPRINT_REGISTRY, "Invalid key cell!\n")); return FALSE; } - if (ValueCell->Flags & REG_VALUE_NAME_PACKED) - { - wName = MmAllocateMemory ((ValueCell->NameSize + 1)*sizeof(WCHAR)); - for (i = 0; i < ValueCell->NameSize; i++) + if (ValueCell->Flags & VALUE_COMP_NAME) + { + wName = MmAllocateMemory ((ValueCell->NameLength + 1)*sizeof(WCHAR)); + for (i = 0; i < ValueCell->NameLength; i++) { wName[i] = ((PCHAR)ValueCell->Name)[i]; } - wName[ValueCell->NameSize] = 0; + wName[ValueCell->NameLength] = 0; } else { - wName = MmAllocateMemory (ValueCell->NameSize + sizeof(WCHAR)); + wName = MmAllocateMemory (ValueCell->NameLength + sizeof(WCHAR)); memcpy (wName, ValueCell->Name, - ValueCell->NameSize); - wName[ValueCell->NameSize / sizeof(WCHAR)] = 0; - } - - DataSize = ValueCell->DataSize & REG_DATA_SIZE_MASK; + ValueCell->NameLength); + wName[ValueCell->NameLength / sizeof(WCHAR)] = 0; + } + + DataLength = ValueCell->DataLength & REG_DATA_SIZE_MASK; DbgPrint((DPRINT_REGISTRY, "ValueName: '%S'\n", wName)); - DbgPrint((DPRINT_REGISTRY, "DataSize: %u\n", DataSize)); - - if (DataSize <= sizeof(HCELL_INDEX) && (ValueCell->DataSize & REG_DATA_IN_OFFSET)) + DbgPrint((DPRINT_REGISTRY, "DataLength: %u\n", DataLength)); + + if (DataLength <= sizeof(HCELL_INDEX) && (ValueCell->DataLength & REG_DATA_IN_OFFSET)) { Error = RegSetValue(Key, wName, - ValueCell->DataType, - (PCHAR)&ValueCell->DataOffset, - DataSize); + ValueCell->Type, + (PCHAR)&ValueCell->Data, + DataLength); if (Error != ERROR_SUCCESS) { DbgPrint((DPRINT_REGISTRY, "RegSetValue() failed!\n")); @@ -575,14 +578,14 @@ } else { - DataCell = (PVOID)HvGetCell (Hive, ValueCell->DataOffset); + DataCell = (PVOID)HvGetCell (Hive, ValueCell->Data); DbgPrint((DPRINT_REGISTRY, "DataCell: %x\n", DataCell)); Error = RegSetValue (Key, wName, - ValueCell->DataType, + ValueCell->Type, DataCell, - DataSize); + DataLength); if (Error != ERROR_SUCCESS) { @@ -603,7 +606,7 @@ PCM_KEY_NODE KeyCell, FRLDRHKEY ParentKey) { - PHASH_TABLE_CELL HashCell; + PCM_KEY_FAST_INDEX HashCell; PCM_KEY_NODE SubKeyCell; PVALUE_LIST_CELL ValueListCell; PCM_KEY_VALUE ValueCell = NULL; @@ -614,29 +617,29 @@ DbgPrint((DPRINT_REGISTRY, "KeyCell: %x\n", KeyCell)); - DbgPrint((DPRINT_REGISTRY, "KeyCell->Id: %x\n", KeyCell->Id)); - if (KeyCell->Id != REG_KEY_CELL_ID) - { - DbgPrint((DPRINT_REGISTRY, "Invalid key cell id!\n")); - return FALSE; - } - - if (KeyCell->Flags & REG_KEY_NAME_PACKED) - { - wName = MmAllocateMemory ((KeyCell->NameSize + 1) * sizeof(WCHAR)); - for (i = 0; i < KeyCell->NameSize; i++) + DbgPrint((DPRINT_REGISTRY, "KeyCell->Signature: %x\n", KeyCell->Signature)); + if (KeyCell->Signature != CM_KEY_NODE_SIGNATURE) + { + DbgPrint((DPRINT_REGISTRY, "Invalid key cell Signature!\n")); + return FALSE; + } + + if (KeyCell->Flags & KEY_COMP_NAME) + { + wName = MmAllocateMemory ((KeyCell->NameLength + 1) * sizeof(WCHAR)); + for (i = 0; i < KeyCell->NameLength; i++) { wName[i] = ((PCHAR)KeyCell->Name)[i]; } - wName[KeyCell->NameSize] = 0; + wName[KeyCell->NameLength] = 0; } else { - wName = MmAllocateMemory (KeyCell->NameSize + sizeof(WCHAR)); + wName = MmAllocateMemory (KeyCell->NameLength + sizeof(WCHAR)); memcpy (wName, KeyCell->Name, - KeyCell->NameSize); - wName[KeyCell->NameSize/sizeof(WCHAR)] = 0; + KeyCell->NameLength); + wName[KeyCell->NameLength/sizeof(WCHAR)] = 0; } DbgPrint((DPRINT_REGISTRY, "KeyName: '%S'\n", wName)); @@ -676,15 +679,15 @@ /* Enumerate and add subkeys */ if (KeyCell->SubKeyCounts[Stable] > 0) { - HashCell = (PHASH_TABLE_CELL) HvGetCell (Hive, KeyCell->SubKeyLists[Stable]); + HashCell = (PCM_KEY_FAST_INDEX) HvGetCell (Hive, KeyCell->SubKeyLists[Stable]); DbgPrint((DPRINT_REGISTRY, "HashCell: %x\n", HashCell)); DbgPrint((DPRINT_REGISTRY, "SubKeyCounts: %x\n", KeyCell->SubKeyCounts)); for (i = 0; i < KeyCell->SubKeyCounts[Stable]; i++) { - DbgPrint((DPRINT_REGISTRY, "KeyOffset[%d]: %x\n", i, HashCell->Table[i].KeyOffset)); - - SubKeyCell = (PCM_KEY_NODE) HvGetCell (Hive, HashCell->Table[i].KeyOffset); + DbgPrint((DPRINT_REGISTRY, "Cell[%d]: %x\n", i, HashCell->List[i].Cell)); + + SubKeyCell = (PCM_KEY_NODE) HvGetCell (Hive, HashCell->List[i].Cell); DbgPrint((DPRINT_REGISTRY, "SubKeyCell[%d]: %x\n", i, SubKeyCell)); @@ -702,7 +705,7 @@ ULONG ChunkSize) { PCM_KEY_NODE KeyCell; - PHASH_TABLE_CELL HashCell; + PCM_KEY_FAST_INDEX HashCell; PCM_KEY_NODE SubKeyCell; FRLDRHKEY SystemKey; ULONG i; @@ -729,17 +732,17 @@ NULL); if (!NT_SUCCESS(Status)) { - DbgPrint((DPRINT_REGISTRY, "Invalid hive id!\n")); + DbgPrint((DPRINT_REGISTRY, "Invalid hive Signature!\n")); return FALSE; } Hive = &CmHive->Hive; KeyCell = (PCM_KEY_NODE)HvGetCell (Hive, Hive->BaseBlock->RootCell); DbgPrint((DPRINT_REGISTRY, "KeyCell: %x\n", KeyCell)); - DbgPrint((DPRINT_REGISTRY, "KeyCell->Id: %x\n", KeyCell->Id)); - if (KeyCell->Id != REG_KEY_CELL_ID) - { - DbgPrint((DPRINT_REGISTRY, "Invalid key cell id!\n")); + DbgPrint((DPRINT_REGISTRY, "KeyCell->Signature: %x\n", KeyCell->Signature)); + if (KeyCell->Signature != CM_KEY_NODE_SIGNATURE) + { + DbgPrint((DPRINT_REGISTRY, "Invalid key cell Signature!\n")); return FALSE; } @@ -759,15 +762,15 @@ /* Enumerate and add subkeys */ if (KeyCell->SubKeyCounts[Stable] > 0) { - HashCell = (PHASH_TABLE_CELL)HvGetCell (Hive, KeyCell->SubKeyLists[Stable]); + HashCell = (PCM_KEY_FAST_INDEX)HvGetCell (Hive, KeyCell->SubKeyLists[Stable]); DbgPrint((DPRINT_REGISTRY, "HashCell: %x\n", HashCell)); DbgPrint((DPRINT_REGISTRY, "SubKeyCounts: %x\n", KeyCell->SubKeyCounts[Stable])); for (i = 0; i < KeyCell->SubKeyCounts[Stable]; i++) { - DbgPrint((DPRINT_REGISTRY, "KeyOffset[%d]: %x\n", i, HashCell->Table[i].KeyOffset)); - - SubKeyCell = (PCM_KEY_NODE)HvGetCell (Hive, HashCell->Table[i].KeyOffset); + DbgPrint((DPRINT_REGISTRY, "Cell[%d]: %x\n", i, HashCell->List[i].Cell)); + + SubKeyCell = (PCM_KEY_NODE)HvGetCell (Hive, HashCell->List[i].Cell); DbgPrint((DPRINT_REGISTRY, "SubKeyCell[%d]: %x\n", i, SubKeyCell)); Modified: trunk/reactos/include/host/typedefs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/host/typedefs.h?re…
============================================================================== --- trunk/reactos/include/host/typedefs.h (original) +++ trunk/reactos/include/host/typedefs.h Mon Oct 29 00:31:46 2007 @@ -50,6 +50,8 @@ /* FIXME: this value is target specific, host tools MUST not use it * and this line has to be removed */ #define PAGE_SIZE 4096 + +#define ANYSIZE_ARRAY 1 typedef void VOID, *PVOID, *HANDLE; typedef HANDLE HKEY, *PHKEY; Modified: trunk/reactos/lib/cmlib/cmdata.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/cmdata.h?rev=299…
============================================================================== --- trunk/reactos/lib/cmlib/cmdata.h (original) +++ trunk/reactos/lib/cmlib/cmdata.h Mon Oct 29 00:31:46 2007 @@ -13,12 +13,39 @@ #define REG_EXTEND_HASH_TABLE_SIZE 4 #define REG_VALUE_LIST_CELL_MULTIPLE 4 -#define REG_KEY_CELL_ID 0x6b6e -#define REG_HASH_TABLE_CELL_ID 0x666c -#define REG_VALUE_CELL_ID 0x6b76 -#define REG_SECURITY_CELL_ID 0x6b73 +// +// Key Types +// +#define CM_KEY_INDEX_ROOT 0x6972 +#define CM_KEY_INDEX_LEAF 0x696c +#define CM_KEY_FAST_LEAF 0x666c +#define CM_KEY_HASH_LEAF 0x686c -#ifndef _CM_ +// +// Key Signatures +// +#define CM_KEY_NODE_SIGNATURE 0x6B6E +#define CM_LINK_NODE_SIGNATURE 0x6B6C +#define CM_KEY_VALUE_SIGNATURE 0x6B76 + +// +// CM_KEY_NODE Flags +// +#define KEY_IS_VOLATILE 0x01 +#define KEY_HIVE_EXIT 0x02 +#define KEY_HIVE_ENTRY 0x04 +#define KEY_NO_DELETE 0x08 +#define KEY_SYM_LINK 0x10 +#define KEY_COMP_NAME 0x20 +#define KEY_PREFEF_HANDLE 0x40 +#define KEY_VIRT_MIRRORED 0x80 +#define KEY_VIRT_TARGET 0x100 +#define KEY_VIRTUAL_STORE 0x200 + +// +// CM_KEY_VALUE Flags +// +#define VALUE_COMP_NAME 0x0001 #ifdef CMLIB_HOST #include <host/pshpack1.h> @@ -26,6 +53,9 @@ #include <pshpack1.h> #endif +// +// For memory-mapped Hives +// typedef struct _CM_VIEW_OF_FILE { LIST_ENTRY LRUViewList; @@ -37,111 +67,69 @@ ULONG UseCount; } CM_VIEW_OF_FILE, *PCM_VIEW_OF_FILE; +// +// Children of Key Notes +// typedef struct _CHILD_LIST { ULONG Count; HCELL_INDEX List; } CHILD_LIST, *PCHILD_LIST; +// +// Node Key +// typedef struct _CM_KEY_NODE { - /* Key cell identifier "kn" (0x6b6e) */ - USHORT Id; - - /* Flags */ - USHORT Flags; - - /* Time of last flush */ - LARGE_INTEGER LastWriteTime; - - ULONG Spare; - - /* BlockAddress offset of parent key cell */ - HCELL_INDEX Parent; - - /* Count of sub keys for the key in this key cell (stable & volatile) */ - ULONG SubKeyCounts[HTYPE_COUNT]; - - /* BlockAddress offset of has table for FIXME: subkeys/values? (stable & volatile) */ - HCELL_INDEX SubKeyLists[HTYPE_COUNT]; - - CHILD_LIST ValueList; - - /* BlockAddress offset of security cell */ - HCELL_INDEX SecurityKeyOffset; - - /* BlockAddress offset of registry key class */ - HCELL_INDEX ClassNameOffset; - - ULONG MaxNameLen; - ULONG MaxClassLen; - ULONG MaxValueNameLen; - ULONG MaxValueDataLen; - ULONG WorkVar; - - /* Size in bytes of key name */ - USHORT NameSize; - - /* Size of class name in bytes */ - USHORT ClassSize; - - /* Name of key (not zero terminated) */ - UCHAR Name[0]; + USHORT Signature; + USHORT Flags; + LARGE_INTEGER LastWriteTime; + ULONG Spare; + HCELL_INDEX Parent; + ULONG SubKeyCounts[HTYPE_COUNT]; + HCELL_INDEX SubKeyLists[HTYPE_COUNT]; + CHILD_LIST ValueList; + HCELL_INDEX Security; + HCELL_INDEX Class; + ULONG MaxNameLen; + ULONG MaxClassLen; + ULONG MaxValueNameLen; + ULONG MaxValueDataLen; + ULONG WorkVar; + USHORT NameLength; + USHORT ClassLength; + WCHAR Name[0]; } CM_KEY_NODE, *PCM_KEY_NODE; -/* CM_KEY_NODE.Flags constants */ -#define REG_KEY_VOLATILE_CELL 0x01 -#define REG_KEY_ROOT_CELL 0x0C -#define REG_KEY_LINK_CELL 0x10 -#define REG_KEY_NAME_PACKED 0x20 - -/* - * Hash record - * - * HashValue: - * packed name: four letters of value's name - * otherwise: Zero! - */ -typedef struct _HASH_RECORD -{ - HCELL_INDEX KeyOffset; - ULONG HashValue; -} HASH_RECORD, *PHASH_RECORD; - -typedef struct _HASH_TABLE_CELL -{ - USHORT Id; - USHORT HashTableSize; - HASH_RECORD Table[0]; -} HASH_TABLE_CELL, *PHASH_TABLE_CELL; - +// +// Value List +// typedef struct _VALUE_LIST_CELL { - HCELL_INDEX ValueOffset[0]; + HCELL_INDEX ValueOffset[0]; } VALUE_LIST_CELL, *PVALUE_LIST_CELL; +// +// Value Key +// typedef struct _CM_KEY_VALUE { - USHORT Id; // "kv" - USHORT NameSize; // length of Name - ULONG DataSize; // length of datas in the cell pointed by DataOffset - HCELL_INDEX DataOffset;// datas are here if high bit of DataSize is set - ULONG DataType; - USHORT Flags; - USHORT Unused1; - UCHAR Name[0]; /* warning : not zero terminated */ + USHORT Signature; + USHORT NameLength; + ULONG DataLength; + HCELL_INDEX Data; + ULONG Type; + USHORT Flags; + USHORT Unused1; + WCHAR Name[0]; } CM_KEY_VALUE, *PCM_KEY_VALUE; -/* CM_KEY_VALUE.Flags constants */ -#define REG_VALUE_NAME_PACKED 0x0001 - -/* CM_KEY_VALUE.DataSize mask constants */ -#define REG_DATA_SIZE_MASK 0x7FFFFFFF -#define REG_DATA_IN_OFFSET 0x80000000 - +// +// Security Key +// typedef struct _CM_KEY_SECURITY { - USHORT Signature; // "sk" + USHORT Signature; USHORT Reserved; HCELL_INDEX Flink; HCELL_INDEX Blink; @@ -157,6 +145,53 @@ #include <poppack.h> #endif -#endif +// +// Generic Index Entry +// +typedef struct _CM_INDEX +{ + HCELL_INDEX Cell; + union + { + UCHAR NameHint[4]; + ULONG HashKey; + }; +} CM_INDEX, *PCM_INDEX; + +// +// Key Index +// +typedef struct _CM_KEY_INDEX +{ + USHORT Signature; + USHORT Count; + HCELL_INDEX List[ANYSIZE_ARRAY]; +} CM_KEY_INDEX, *PCM_KEY_INDEX; + +// +// Fast/Hash Key Index +// +typedef struct _CM_KEY_FAST_INDEX +{ + USHORT Signature; + USHORT Count; + CM_INDEX List[ANYSIZE_ARRAY]; +} CM_KEY_FAST_INDEX, *PCM_KEY_FAST_INDEX; + +// +// Cell Data +// +typedef struct _CELL_DATA +{ + union + { + CM_KEY_NODE KeyNode; + CM_KEY_VALUE KeyValue; + CM_KEY_SECURITY KeySecurity; + CM_KEY_INDEX KeyIndex; + HCELL_INDEX KeyList[ANYSIZE_ARRAY]; + WCHAR KeyString[ANYSIZE_ARRAY]; + } u; +} CELL_DATA, *PCELL_DATA; #endif /* CMLIB_CMDATA_H */ Modified: trunk/reactos/lib/cmlib/cminit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/cminit.c?rev=299…
============================================================================== --- trunk/reactos/lib/cmlib/cminit.c (original) +++ trunk/reactos/lib/cmlib/cminit.c Mon Oct 29 00:31:46 2007 @@ -16,34 +16,47 @@ HCELL_INDEX RootCellIndex; SIZE_T NameSize; + /* Allocate the cell */ NameSize = wcslen(Name) * sizeof(WCHAR); RootCellIndex = HvAllocateCell(Hive, - sizeof(CM_KEY_NODE) + NameSize, + FIELD_OFFSET(CM_KEY_NODE, Name) + NameSize, Stable, HCELL_NIL); - if (RootCellIndex == HCELL_NIL) - return FALSE; + if (RootCellIndex == HCELL_NIL) return FALSE; + /* Seutp the base block */ Hive->BaseBlock->RootCell = RootCellIndex; Hive->BaseBlock->CheckSum = HvpHiveHeaderChecksum(Hive->BaseBlock); + /* Get the key cell */ KeyCell = (PCM_KEY_NODE)HvGetCell(Hive, RootCellIndex); - KeyCell->Id = REG_KEY_CELL_ID; - KeyCell->Flags = REG_KEY_ROOT_CELL; + if (!KeyCell) return FALSE; + + /* Setup the cell */ + KeyCell->Signature = (USHORT)CM_KEY_NODE_SIGNATURE; + KeyCell->Flags = KEY_HIVE_ENTRY | KEY_NO_DELETE; KeyCell->LastWriteTime.QuadPart = 0; KeyCell->Parent = HCELL_NIL; - KeyCell->SubKeyCounts[0] = 0; - KeyCell->SubKeyCounts[1] = 0; - KeyCell->SubKeyLists[0] = HCELL_NIL; - KeyCell->SubKeyLists[1] = HCELL_NIL; + KeyCell->SubKeyCounts[Stable] = 0; + KeyCell->SubKeyCounts[Volatile] = 0; + KeyCell->SubKeyLists[Stable] = HCELL_NIL; + KeyCell->SubKeyLists[Volatile] = HCELL_NIL; KeyCell->ValueList.Count = 0; KeyCell->ValueList.List = HCELL_NIL; - KeyCell->SecurityKeyOffset = HCELL_NIL; - KeyCell->ClassNameOffset = HCELL_NIL; - KeyCell->NameSize = (USHORT)NameSize; - KeyCell->ClassSize = 0; + KeyCell->Security = HCELL_NIL; + KeyCell->Class = HCELL_NIL; + KeyCell->ClassLength = 0; + KeyCell->MaxNameLen = 0; + KeyCell->MaxClassLen = 0; + KeyCell->MaxValueNameLen = 0; + KeyCell->MaxValueDataLen = 0; + + /* Write the name */ + KeyCell->NameLength = (USHORT)NameSize; memcpy(KeyCell->Name, Name, NameSize); + /* Return success */ + HvReleaseCell(Hive, RootCellIndex); return TRUE; } @@ -53,10 +66,10 @@ PCM_KEY_NODE KeyCell) { PCM_KEY_NODE SubKeyCell; - PHASH_TABLE_CELL HashCell; + PCM_KEY_FAST_INDEX HashCell; ULONG i; - ASSERT(KeyCell->Id == REG_KEY_CELL_ID); + ASSERT(KeyCell->Signature == CM_KEY_NODE_SIGNATURE); KeyCell->SubKeyLists[Volatile] = HCELL_NIL; KeyCell->SubKeyCounts[Volatile] = 0; @@ -68,7 +81,7 @@ for (i = 0; i < KeyCell->SubKeyCounts[Stable]; i++) { - SubKeyCell = HvGetCell(RegistryHive, HashCell->Table[i].KeyOffset); + SubKeyCell = HvGetCell(RegistryHive, HashCell->List[i].Cell); CmpPrepareKey(RegistryHive, SubKeyCell); } } Modified: trunk/reactos/lib/cmlib/cmlib.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/cmlib.h?rev=2994…
============================================================================== --- trunk/reactos/lib/cmlib/cmlib.h (original) +++ trunk/reactos/lib/cmlib/cmlib.h Mon Oct 29 00:31:46 2007 @@ -62,10 +62,6 @@ #endif -#include <wchar.h> -#include "hivedata.h" -#include "cmdata.h" - #ifndef ROUND_UP #define ROUND_UP(a,b) ((((a)+(b)-1)/(b))*(b)) #define ROUND_DOWN(a,b) (((a)/(b))*(b)) @@ -75,112 +71,9 @@ #define CMAPI NTAPI -struct _HHIVE; - -typedef struct _CELL_DATA* (CMAPI *PGET_CELL_ROUTINE)( - struct _HHIVE *Hive, - HCELL_INDEX Cell); - -typedef VOID (CMAPI *PRELEASE_CELL_ROUTINE)( - struct _HHIVE *Hive, - HCELL_INDEX Cell); - -typedef PVOID (CMAPI *PALLOCATE_ROUTINE)( - SIZE_T Size, - BOOLEAN Paged, - ULONG Tag); - -typedef VOID (CMAPI *PFREE_ROUTINE)( - PVOID Ptr, - ULONG Quota); - -typedef BOOLEAN (CMAPI *PFILE_READ_ROUTINE)( - struct _HHIVE *RegistryHive, - ULONG FileType, - PULONG FileOffset, - PVOID Buffer, - SIZE_T BufferLength); - -typedef BOOLEAN (CMAPI *PFILE_WRITE_ROUTINE)( - struct _HHIVE *RegistryHive, - ULONG FileType, - PULONG FileOffset, - PVOID Buffer, - SIZE_T BufferLength); - -typedef BOOLEAN (CMAPI *PFILE_SET_SIZE_ROUTINE)( - struct _HHIVE *RegistryHive, - ULONG FileType, - ULONG FileSize, - ULONG OldfileSize); - -typedef BOOLEAN (CMAPI *PFILE_FLUSH_ROUTINE)( - struct _HHIVE *RegistryHive, - ULONG FileType, - PLARGE_INTEGER FileOffset, - ULONG Length); - -typedef struct _HMAP_ENTRY -{ - ULONG_PTR BlockAddress; - ULONG_PTR BinAddress; - struct _CM_VIEW_OF_FILE *CmView; - ULONG MemAlloc; -} HMAP_ENTRY, *PHMAP_ENTRY; - -typedef struct _HMAP_TABLE -{ - HMAP_ENTRY Table[512]; -} HMAP_TABLE, *PHMAP_TABLE; - -typedef struct _HMAP_DIRECTORY -{ - PHMAP_TABLE Directory[2048]; -} HMAP_DIRECTORY, *PHMAP_DIRECTORY; - -typedef struct _DUAL -{ - ULONG Length; - PHMAP_DIRECTORY Map; - PHMAP_ENTRY BlockList; // PHMAP_TABLE SmallDir; - ULONG Guard; - HCELL_INDEX FreeDisplay[24]; //FREE_DISPLAY FreeDisplay[24]; - ULONG FreeSummary; - LIST_ENTRY FreeBins; -} DUAL, *PDUAL; - -typedef struct _HHIVE -{ - ULONG Signature; - PGET_CELL_ROUTINE GetCellRoutine; - PRELEASE_CELL_ROUTINE ReleaseCellRoutine; - PALLOCATE_ROUTINE Allocate; - PFREE_ROUTINE Free; - PFILE_READ_ROUTINE FileRead; - PFILE_WRITE_ROUTINE FileWrite; - PFILE_SET_SIZE_ROUTINE FileSetSize; - PFILE_FLUSH_ROUTINE FileFlush; - PHBASE_BLOCK BaseBlock; - RTL_BITMAP DirtyVector; - ULONG DirtyCount; - ULONG DirtyAlloc; - ULONG BaseBlockAlloc; - ULONG Cluster; - BOOLEAN Flat; - BOOLEAN ReadOnly; - BOOLEAN Log; - BOOLEAN DirtyFlag; - ULONG HvBinHeadersUse; - ULONG HvFreeCellsUse; - ULONG HvUsedcellsUse; - ULONG CmUsedCellsUse; - ULONG HiveFlags; - ULONG LogSize; - ULONG RefreshCount; - ULONG StorageTypeCount; - ULONG Version; - DUAL Storage[HTYPE_COUNT]; -} HHIVE, *PHHIVE; +#include <wchar.h> +#include "hivedata.h" +#include "cmdata.h" #ifndef _CM_ typedef struct _EREGISTRY_HIVE Modified: trunk/reactos/lib/cmlib/hivedata.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/hivedata.h?rev=2…
============================================================================== --- trunk/reactos/lib/cmlib/hivedata.h (original) +++ trunk/reactos/lib/cmlib/hivedata.h Mon Oct 29 00:31:46 2007 @@ -24,6 +24,9 @@ #define HIVE_VOLATILE 1 #define HIVE_NOLAZYFLUSH 2 #define HIVE_HAS_BEEN_REPLACED 4 +#define HIVE_HAS_BEEN_FREED 8 +#define HIVE_UNKNOWN 0x10 +#define HIVE_IS_UNLOADING 0x20 // // Hive types @@ -190,6 +193,114 @@ #include <poppack.h> #endif +struct _HHIVE; + +typedef struct _CELL_DATA* (CMAPI *PGET_CELL_ROUTINE)( + struct _HHIVE *Hive, + HCELL_INDEX Cell); + +typedef VOID (CMAPI *PRELEASE_CELL_ROUTINE)( + struct _HHIVE *Hive, + HCELL_INDEX Cell); + +typedef PVOID (CMAPI *PALLOCATE_ROUTINE)( + SIZE_T Size, + BOOLEAN Paged, + ULONG Tag); + +typedef VOID (CMAPI *PFREE_ROUTINE)( + PVOID Ptr, + ULONG Quota); + +typedef BOOLEAN (CMAPI *PFILE_READ_ROUTINE)( + struct _HHIVE *RegistryHive, + ULONG FileType, + PULONG FileOffset, + PVOID Buffer, + SIZE_T BufferLength); + +typedef BOOLEAN (CMAPI *PFILE_WRITE_ROUTINE)( + struct _HHIVE *RegistryHive, + ULONG FileType, + PULONG FileOffset, + PVOID Buffer, + SIZE_T BufferLength); + +typedef BOOLEAN (CMAPI *PFILE_SET_SIZE_ROUTINE)( + struct _HHIVE *RegistryHive, + ULONG FileType, + ULONG FileSize, + ULONG OldfileSize); + +typedef BOOLEAN (CMAPI *PFILE_FLUSH_ROUTINE)( + struct _HHIVE *RegistryHive, + ULONG FileType, + PLARGE_INTEGER FileOffset, + ULONG Length +); + +typedef struct _HMAP_ENTRY +{ + ULONG_PTR BlockAddress; + ULONG_PTR BinAddress; + struct _CM_VIEW_OF_FILE *CmView; + ULONG MemAlloc; +} HMAP_ENTRY, *PHMAP_ENTRY; + +typedef struct _HMAP_TABLE +{ + HMAP_ENTRY Table[512]; +} HMAP_TABLE, *PHMAP_TABLE; + +typedef struct _HMAP_DIRECTORY +{ + PHMAP_TABLE Directory[2048]; +} HMAP_DIRECTORY, *PHMAP_DIRECTORY; + +typedef struct _DUAL +{ + ULONG Length; + PHMAP_DIRECTORY Map; + PHMAP_ENTRY BlockList; // PHMAP_TABLE SmallDir; + ULONG Guard; + HCELL_INDEX FreeDisplay[24]; //FREE_DISPLAY FreeDisplay[24]; + ULONG FreeSummary; + LIST_ENTRY FreeBins; +} DUAL, *PDUAL; + +typedef struct _HHIVE +{ + ULONG Signature; + PGET_CELL_ROUTINE GetCellRoutine; + PRELEASE_CELL_ROUTINE ReleaseCellRoutine; + PALLOCATE_ROUTINE Allocate; + PFREE_ROUTINE Free; + PFILE_READ_ROUTINE FileRead; + PFILE_WRITE_ROUTINE FileWrite; + PFILE_SET_SIZE_ROUTINE FileSetSize; + PFILE_FLUSH_ROUTINE FileFlush; + PHBASE_BLOCK BaseBlock; + RTL_BITMAP DirtyVector; + ULONG DirtyCount; + ULONG DirtyAlloc; + ULONG BaseBlockAlloc; + ULONG Cluster; + BOOLEAN Flat; + BOOLEAN ReadOnly; + BOOLEAN Log; + BOOLEAN DirtyFlag; + ULONG HvBinHeadersUse; + ULONG HvFreeCellsUse; + ULONG HvUsedcellsUse; + ULONG CmUsedCellsUse; + ULONG HiveFlags; + ULONG LogSize; + ULONG RefreshCount; + ULONG StorageTypeCount; + ULONG Version; + DUAL Storage[HTYPE_COUNT]; +} HHIVE, *PHHIVE; + #define IsFreeCell(Cell)(Cell->Size >= 0) #define IsUsedCell(Cell)(Cell->Size < 0) Modified: trunk/reactos/ntoskrnl/cm/cm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/cm.h?rev=29943…
============================================================================== --- trunk/reactos/ntoskrnl/cm/cm.h (original) +++ trunk/reactos/ntoskrnl/cm/cm.h Mon Oct 29 00:31:46 2007 @@ -192,9 +192,9 @@ IN PVOID Argument2); #define VERIFY_BIN_HEADER(x) ASSERT(x->HeaderId == REG_BIN_ID) -#define VERIFY_KEY_CELL(x) ASSERT(x->Id == REG_KEY_CELL_ID) -#define VERIFY_ROOT_KEY_CELL(x) ASSERT(x->Id == REG_KEY_CELL_ID) -#define VERIFY_VALUE_CELL(x) ASSERT(x->Id == REG_VALUE_CELL_ID) +#define VERIFY_KEY_CELL(x) ASSERT(x->Signature == CM_KEY_NODE_SIGNATURE) +#define VERIFY_ROOT_KEY_CELL(x) ASSERT(x->Signature == CM_KEY_NODE_SIGNATURE) +#define VERIFY_VALUE_CELL(x) ASSERT(x->Signature == CM_KEY_VALUE_SIGNATURE) #define VERIFY_VALUE_LIST_CELL(x) #define VERIFY_KEY_OBJECT(x) #define VERIFY_REGISTRY_HIVE(x) @@ -316,21 +316,6 @@ NTSTATUS NTAPI CmDeleteKey(IN PCM_KEY_CONTROL_BLOCK Kcb); - -NTSTATUS -CmiAllocateHashTableCell(IN PEREGISTRY_HIVE RegistryHive, - OUT PHASH_TABLE_CELL *HashBlock, - OUT HCELL_INDEX *HBOffset, - IN ULONG HashTableSize, - IN HSTORAGE_TYPE Storage); - -NTSTATUS -CmiAddKeyToHashTable(PEREGISTRY_HIVE RegistryHive, - PHASH_TABLE_CELL HashCell, - PCM_KEY_NODE KeyCell, - HSTORAGE_TYPE StorageType, - PCM_KEY_NODE NewKeyCell, - HCELL_INDEX NKBOffset); NTSTATUS CmiConnectHive(POBJECT_ATTRIBUTES KeyObjectAttributes, 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 Mon Oct 29 00:31:46 2007 @@ -333,7 +333,7 @@ RtlCreateUnicodeString(&KeyObject->Name, Start); KeyObject->KeyCell->Parent = KeyObject->ParentKey->KeyCellOffset; - KeyObject->KeyCell->SecurityKeyOffset = KeyObject->ParentKey->KeyCell->SecurityKeyOffset; + KeyObject->KeyCell->Security = KeyObject->ParentKey->KeyCell->Security; KeyObject->ValueCache.ValueList = KeyObject->KeyCell->ValueList.List; KeyObject->ValueCache.Count = KeyObject->KeyCell->ValueList.Count; 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 Mon Oct 29 00:31:46 2007 @@ -19,6 +19,8 @@ /* LOCAL MACROS *************************************************************/ #define ABS_VALUE(V) (((V) < 0) ? -(V) : (V)) +#define REG_DATA_SIZE_MASK 0x7FFFFFFF +#define REG_DATA_IN_OFFSET 0x80000000 /* FUNCTIONS ****************************************************************/ @@ -105,10 +107,10 @@ CmiGetMaxNameLength(PHHIVE Hive, PCM_KEY_NODE KeyCell) { - PHASH_TABLE_CELL HashBlock; + PCM_KEY_FAST_INDEX HashBlock; PCM_KEY_NODE CurSubKeyCell; ULONG MaxName; - ULONG NameSize; + ULONG NameLength; ULONG i; ULONG Storage; @@ -117,18 +119,18 @@ { if (KeyCell->SubKeyLists[Storage] != HCELL_NIL) { - HashBlock = (PHASH_TABLE_CELL)HvGetCell (Hive, KeyCell->SubKeyLists[Storage]); - ASSERT(HashBlock->Id == REG_HASH_TABLE_CELL_ID); + HashBlock = (PCM_KEY_FAST_INDEX)HvGetCell (Hive, KeyCell->SubKeyLists[Storage]); + ASSERT(HashBlock->Signature == CM_KEY_FAST_LEAF); for (i = 0; i < KeyCell->SubKeyCounts[Storage]; i++) { CurSubKeyCell = (PCM_KEY_NODE)HvGetCell (Hive, - HashBlock->Table[i].KeyOffset); - NameSize = CurSubKeyCell->NameSize; - if (CurSubKeyCell->Flags & REG_KEY_NAME_PACKED) - NameSize *= sizeof(WCHAR); - if (NameSize > MaxName) - MaxName = NameSize; + HashBlock->List[i].Cell); + NameLength = CurSubKeyCell->NameLength; + if (CurSubKeyCell->Flags & KEY_COMP_NAME) + NameLength *= sizeof(WCHAR); + if (NameLength > MaxName) + MaxName = NameLength; } } } @@ -142,7 +144,7 @@ CmiGetMaxClassLength(PHHIVE Hive, PCM_KEY_NODE KeyCell) { - PHASH_TABLE_CELL HashBlock; + PCM_KEY_FAST_INDEX HashBlock; PCM_KEY_NODE CurSubKeyCell; ULONG MaxClass; ULONG i; @@ -153,18 +155,18 @@ { if (KeyCell->SubKeyLists[Storage] != HCELL_NIL) { - HashBlock = (PHASH_TABLE_CELL)HvGetCell (Hive, + HashBlock = (PCM_KEY_FAST_INDEX)HvGetCell (Hive, KeyCell->SubKeyLists[Storage]); - ASSERT(HashBlock->Id == REG_HASH_TABLE_CELL_ID); + ASSERT(HashBlock->Signature == CM_KEY_FAST_LEAF); for (i = 0; i < KeyCell->SubKeyCounts[Storage]; i++) { CurSubKeyCell = (PCM_KEY_NODE)HvGetCell (Hive, - HashBlock->Table[i].KeyOffset); - - if (MaxClass < CurSubKeyCell->ClassSize) + HashBlock->List[i].Cell); + + if (MaxClass < CurSubKeyCell->ClassLength) { - MaxClass = CurSubKeyCell->ClassSize; + MaxClass = CurSubKeyCell->ClassLength; } } } @@ -205,8 +207,8 @@ if (CurValueCell != NULL) { - Size = CurValueCell->NameSize; - if (CurValueCell->Flags & REG_VALUE_NAME_PACKED) + Size = CurValueCell->NameLength; + if (CurValueCell->Flags & VALUE_COMP_NAME) { Size *= sizeof(WCHAR); } @@ -243,9 +245,9 @@ { CurValueCell = (PCM_KEY_VALUE)HvGetCell (Hive, ValueListCell->ValueOffset[i]); - if ((MaxValueData < (LONG)(CurValueCell->DataSize & REG_DATA_SIZE_MASK))) - { - MaxValueData = CurValueCell->DataSize & REG_DATA_SIZE_MASK; + if ((MaxValueData < (LONG)(CurValueCell->DataLength & REG_DATA_SIZE_MASK))) + { + MaxValueData = CurValueCell->DataLength & REG_DATA_SIZE_MASK; } } @@ -299,252 +301,4 @@ return STATUS_SUCCESS; } -NTSTATUS -CmiAddSubKey(PEREGISTRY_HIVE RegistryHive, - PKEY_OBJECT ParentKey, - PKEY_OBJECT SubKey, - PUNICODE_STRING SubKeyName, - ULONG TitleIndex, - PUNICODE_STRING Class, - ULONG CreateOptions) -{ - PHASH_TABLE_CELL HashBlock; - HCELL_INDEX NKBOffset; - PCM_KEY_NODE NewKeyCell; - ULONG NewBlockSize; - PCM_KEY_NODE ParentKeyCell; - PVOID ClassCell; - NTSTATUS Status; - USHORT NameSize; - PWSTR NamePtr; - BOOLEAN Packable; - HSTORAGE_TYPE Storage; - ULONG i; - - ParentKeyCell = ParentKey->KeyCell; - - VERIFY_KEY_CELL(ParentKeyCell); - - /* Skip leading backslash */ - if (SubKeyName->Buffer[0] == L'\\') - { - NamePtr = &SubKeyName->Buffer[1]; - NameSize = SubKeyName->Length - sizeof(WCHAR); - } - else - { - NamePtr = SubKeyName->Buffer; - NameSize = SubKeyName->Length; - } - - /* Check whether key name can be packed */ - Packable = TRUE; - for (i = 0; i < NameSize / sizeof(WCHAR); i++) - { - if (NamePtr[i] & 0xFF00) - { - Packable = FALSE; - break; - } - } - - /* Adjust name size */ - if (Packable) - { - NameSize = NameSize / sizeof(WCHAR); - } - - DPRINT("Key %S Length %lu %s\n", NamePtr, NameSize, (Packable)?"True":"False"); - - Status = STATUS_SUCCESS; - - Storage = (CreateOptions & REG_OPTION_VOLATILE) ? Volatile : Stable; - NewBlockSize = sizeof(CM_KEY_NODE) + NameSize; - NKBOffset = HvAllocateCell (&RegistryHive->Hive, NewBlockSize, Storage, HCELL_NIL); - if (NKBOffset == HCELL_NIL) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - } - else - { - NewKeyCell = (PCM_KEY_NODE)HvGetCell (&RegistryHive->Hive, NKBOffset); - NewKeyCell->Id = REG_KEY_CELL_ID; - if (CreateOptions & REG_OPTION_VOLATILE) - { - NewKeyCell->Flags = REG_KEY_VOLATILE_CELL; - } - else - { - NewKeyCell->Flags = 0; - } - KeQuerySystemTime(&NewKeyCell->LastWriteTime); - NewKeyCell->Parent = HCELL_NIL; - NewKeyCell->SubKeyCounts[Stable] = 0; - NewKeyCell->SubKeyCounts[Volatile] = 0; - NewKeyCell->SubKeyLists[Stable] = HCELL_NIL; - NewKeyCell->SubKeyLists[Volatile] = HCELL_NIL; - NewKeyCell->ValueList.Count = 0; - NewKeyCell->ValueList.List = HCELL_NIL; - NewKeyCell->SecurityKeyOffset = HCELL_NIL; - NewKeyCell->ClassNameOffset = HCELL_NIL; - - /* Pack the key name */ - NewKeyCell->NameSize = NameSize; - if (Packable) - { - NewKeyCell->Flags |= REG_KEY_NAME_PACKED; - for (i = 0; i < NameSize; i++) - { - NewKeyCell->Name[i] = (CHAR)(NamePtr[i] & 0x00FF); - } - } - else - { - RtlCopyMemory(NewKeyCell->Name, - NamePtr, - NameSize); - } - - VERIFY_KEY_CELL(NewKeyCell); - - if (Class != NULL && Class->Length) - { - NewKeyCell->ClassSize = Class->Length; - NewKeyCell->ClassNameOffset = HvAllocateCell( - &RegistryHive->Hive, NewKeyCell->ClassSize, Stable, HCELL_NIL); - ASSERT(NewKeyCell->ClassNameOffset != HCELL_NIL); /* FIXME */ - - ClassCell = (PVOID)HvGetCell(&RegistryHive->Hive, NewKeyCell->ClassNameOffset); - RtlCopyMemory (ClassCell, - Class->Buffer, - Class->Length); - } - } - - if (!NT_SUCCESS(Status)) - { - return Status; - } - - SubKey->KeyCell = NewKeyCell; - SubKey->KeyCellOffset = NKBOffset; - - if (ParentKeyCell->SubKeyLists[Storage] == HCELL_NIL) - { - Status = CmiAllocateHashTableCell (RegistryHive, - &HashBlock, - &ParentKeyCell->SubKeyLists[Storage], - REG_INIT_HASH_TABLE_SIZE, - Storage); - if (!NT_SUCCESS(Status)) - { - return(Status); - } - } - else - { - HashBlock = (PHASH_TABLE_CELL)HvGetCell (&RegistryHive->Hive, - ParentKeyCell->SubKeyLists[Storage]); - ASSERT(HashBlock->Id == REG_HASH_TABLE_CELL_ID); - - if (((ParentKeyCell->SubKeyCounts[Storage] + 1) >= HashBlock->HashTableSize)) - { - PHASH_TABLE_CELL NewHashBlock; - HCELL_INDEX HTOffset; - - /* Reallocate the hash table cell */ - Status = CmiAllocateHashTableCell (RegistryHive, - &NewHashBlock, - &HTOffset, - HashBlock->HashTableSize + - REG_EXTEND_HASH_TABLE_SIZE, - Storage); - if (!NT_SUCCESS(Status)) - { - return Status; - } - - RtlZeroMemory(&NewHashBlock->Table[0], - sizeof(NewHashBlock->Table[0]) * NewHashBlock->HashTableSize); - RtlCopyMemory(&NewHashBlock->Table[0], - &HashBlock->Table[0], - sizeof(NewHashBlock->Table[0]) * HashBlock->HashTableSize); - HvFreeCell (&RegistryHive->Hive, ParentKeyCell->SubKeyLists[Storage]); - ParentKeyCell->SubKeyLists[Storage] = HTOffset; - HashBlock = NewHashBlock; - } - } - - Status = CmiAddKeyToHashTable(RegistryHive, - HashBlock, - ParentKeyCell, - Storage, - NewKeyCell, - NKBOffset); - if (NT_SUCCESS(Status)) - { - ParentKeyCell->SubKeyCounts[Storage]++; - } - - KeQuerySystemTime (&ParentKeyCell->LastWriteTime); - HvMarkCellDirty (&RegistryHive->Hive, ParentKey->KeyCellOffset, FALSE); - - return(Status); -} - -NTSTATUS -CmiAllocateHashTableCell (IN PEREGISTRY_HIVE RegistryHive, - OUT PHASH_TABLE_CELL *HashBlock, - OUT HCELL_INDEX *HBOffset, - IN ULONG SubKeyCount, - IN HSTORAGE_TYPE Storage) -{ - PHASH_TABLE_CELL NewHashBlock; - ULONG NewHashSize; - NTSTATUS Status; - - Status = STATUS_SUCCESS; - *HashBlock = NULL; - NewHashSize = sizeof(HASH_TABLE_CELL) + - (SubKeyCount * sizeof(HASH_RECORD)); - *HBOffset = HvAllocateCell (&RegistryHive->Hive, NewHashSize, Storage, HCELL_NIL); - - if (*HBOffset == HCELL_NIL) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - } - else - { - ASSERT(SubKeyCount <= 0xffff); /* should really be USHORT_MAX or similar */ - NewHashBlock = (PHASH_TABLE_CELL)HvGetCell (&RegistryHive->Hive, *HBOffset); - NewHashBlock->Id = REG_HASH_TABLE_CELL_ID; - NewHashBlock->HashTableSize = (USHORT)SubKeyCount; - *HashBlock = NewHashBlock; - } - - return Status; -} - -NTSTATUS -CmiAddKeyToHashTable(PEREGISTRY_HIVE RegistryHive, - PHASH_TABLE_CELL HashCell, - PCM_KEY_NODE KeyCell, - HSTORAGE_TYPE StorageType, - PCM_KEY_NODE NewKeyCell, - HCELL_INDEX NKBOffset) -{ - ULONG i = KeyCell->SubKeyCounts[StorageType]; - - HashCell->Table[i].KeyOffset = NKBOffset; - HashCell->Table[i].HashValue = 0; - if (NewKeyCell->Flags & REG_KEY_NAME_PACKED) - { - RtlCopyMemory(&HashCell->Table[i].HashValue, - NewKeyCell->Name, - min(NewKeyCell->NameSize, sizeof(ULONG))); - } - HvMarkCellDirty(&RegistryHive->Hive, KeyCell->SubKeyLists[StorageType], FALSE); - return STATUS_SUCCESS; -} - /* 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 Mon Oct 29 00:31:46 2007 @@ -432,7 +432,7 @@ return(STATUS_UNSUCCESSFUL); } - if ((SubKeyCell->Flags & REG_KEY_LINK_CELL) && + if ((SubKeyCell->Flags & KEY_SYM_LINK) && !((Attributes & OBJ_OPENLINK) && (EndPtr == NULL))) { RtlInitUnicodeString(&LinkPath, NULL); @@ -526,7 +526,7 @@ } else { - if ((FoundObject->KeyCell->Flags & REG_KEY_LINK_CELL) && + if ((FoundObject->KeyCell->Flags & KEY_SYM_LINK) && !((Attributes & OBJ_OPENLINK) && (EndPtr == NULL))) { DPRINT("Found link\n"); @@ -832,7 +832,7 @@ return(Status); } - if (ValueCell->DataType != REG_LINK) + if (ValueCell->Type != REG_LINK) { DPRINT1("Type != REG_LINK\n!"); return(STATUS_UNSUCCESSFUL); @@ -841,17 +841,17 @@ if (TargetPath->Buffer == NULL && TargetPath->MaximumLength == 0) { TargetPath->Length = 0; - TargetPath->MaximumLength = (USHORT)ValueCell->DataSize + sizeof(WCHAR); + TargetPath->MaximumLength = (USHORT)ValueCell->DataLength + sizeof(WCHAR); TargetPath->Buffer = ExAllocatePool(NonPagedPool, TargetPath->MaximumLength); } TargetPath->Length = min((USHORT)TargetPath->MaximumLength - sizeof(WCHAR), - (USHORT)ValueCell->DataSize); - - if (ValueCell->DataSize > 0) - { - DataCell = HvGetCell (&RegistryHive->Hive, ValueCell->DataOffset); + (USHORT)ValueCell->DataLength); + + if (ValueCell->DataLength > 0) + { + DataCell = HvGetCell (&RegistryHive->Hive, ValueCell->Data); RtlCopyMemory(TargetPath->Buffer, DataCell, TargetPath->Length); @@ -860,7 +860,7 @@ else { RtlCopyMemory(TargetPath->Buffer, - &ValueCell->DataOffset, + &ValueCell->Data, TargetPath->Length); TargetPath->Buffer[TargetPath->Length / sizeof(WCHAR)] = 0; } 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 Mon Oct 29 00:31:46 2007 @@ -44,14 +44,6 @@ ASSERTMSG("Big keys not supported!", !CmpIsKeyValueBig(h, s)); // -// Key Types -// -#define CM_KEY_INDEX_ROOT 0x6972 -#define CM_KEY_INDEX_LEAF 0x696c -#define CM_KEY_FAST_LEAF 0x666c -#define CM_KEY_HASH_LEAF 0x686c - -// // CM_KEY_CONTROL_BLOCK Flags // #define CM_KCB_NO_SUBKEY 0x01 @@ -64,29 +56,11 @@ #define CM_KEY_READ_ONLY_KEY 0x80 // -// CM_KEY_NODE Signature and Flags -// -#define CM_KEY_NODE_SIGNATURE 0x6B6E -#define CM_LINK_NODE_SIGNATURE 0x6B6C -#define KEY_IS_VOLATILE 0x01 -#define KEY_HIVE_EXIT 0x02 -#define KEY_HIVE_ENTRY 0x04 -#define KEY_NO_DELETE 0x08 -#define KEY_SYM_LINK 0x10 -#define KEY_COMP_NAME 0x20 -#define KEY_PREFEF_HANDLE 0x40 -#define KEY_VIRT_MIRRORED 0x80 -#define KEY_VIRT_TARGET 0x100 -#define KEY_VIRTUAL_STORE 0x200 - -// -// CM_KEY_VALUE Signature and Flags -// -#define CM_KEY_VALUE_SIGNATURE 0x6b76 +// CM_KEY_VALUE Types +// #define CM_KEY_VALUE_SMALL 0x4 #define CM_KEY_VALUE_BIG 0x3FD8 #define CM_KEY_VALUE_SPECIAL_SIZE 0x80000000 -#define VALUE_COMP_NAME 0x0001 // // Number of various lists and hashes @@ -419,127 +393,6 @@ PKTHREAD CreatorOwner; } CMHIVE, *PCMHIVE; -#include <pshpack1.h> - -typedef struct _CM_VIEW_OF_FILE -{ - LIST_ENTRY LRUViewList; - LIST_ENTRY PinViewList; - ULONG FileOffset; - ULONG Size; - PULONG ViewAddress; - PVOID Bcb; - ULONG UseCount; -} CM_VIEW_OF_FILE, *PCM_VIEW_OF_FILE; - -typedef struct _CHILD_LIST -{ - ULONG Count; - HCELL_INDEX List; -} CHILD_LIST, *PCHILD_LIST; - -typedef struct _CM_KEY_NODE -{ - USHORT Signature; - USHORT Flags; - LARGE_INTEGER LastWriteTime; - ULONG Spare; - HCELL_INDEX Parent; - ULONG SubKeyCounts[HTYPE_COUNT]; - HCELL_INDEX SubKeyLists[HTYPE_COUNT]; - CHILD_LIST ValueList; - HCELL_INDEX Security; - HCELL_INDEX Class; - ULONG MaxNameLen; - ULONG MaxClassLen; - ULONG MaxValueNameLen; - ULONG MaxValueDataLen; - ULONG WorkVar; - USHORT NameLength; - USHORT ClassLength; - WCHAR Name[0]; -} CM_KEY_NODE, *PCM_KEY_NODE; - -typedef struct _VALUE_LIST_CELL -{ - HCELL_INDEX ValueOffset[0]; -} VALUE_LIST_CELL, *PVALUE_LIST_CELL; - -typedef struct _CM_KEY_VALUE -{ - USHORT Signature; // "kv" - USHORT NameLength; // length of Name - ULONG DataLength; // length of datas in the cell pointed by DataOffset - HCELL_INDEX Data;// datas are here if high bit of DataSize is set - ULONG Type; - USHORT Flags; - USHORT Unused1; - WCHAR Name[0]; /* warning : not zero terminated */ -} CM_KEY_VALUE, *PCM_KEY_VALUE; - -typedef struct _CM_KEY_SECURITY -{ - USHORT Signature; // "sk" - USHORT Reserved; - HCELL_INDEX Flink; - HCELL_INDEX Blink; - ULONG ReferenceCount; - ULONG DescriptorLength; - //SECURITY_DESCRIPTOR_RELATIVE Descriptor; - UCHAR Data[0]; -} CM_KEY_SECURITY, *PCM_KEY_SECURITY; - -#include <poppack.h> - -// -// Generic Index Entry -// -typedef struct _CM_INDEX -{ - HCELL_INDEX Cell; - union - { - UCHAR NameHint[4]; - ULONG HashKey; - }; -} CM_INDEX, *PCM_INDEX; - -// -// Key Index -// -typedef struct _CM_KEY_INDEX -{ - USHORT Signature; - USHORT Count; - HCELL_INDEX List[ANYSIZE_ARRAY]; -} CM_KEY_INDEX, *PCM_KEY_INDEX; - -// -// Fast/Hash Key Index -// -typedef struct _CM_KEY_FAST_INDEX -{ - USHORT Signature; - USHORT Count; - CM_INDEX List[ANYSIZE_ARRAY]; -} CM_KEY_FAST_INDEX, *PCM_KEY_FAST_INDEX; - -// -// Cell Data -// -typedef struct _CELL_DATA -{ - union - { - CM_KEY_NODE KeyNode; - CM_KEY_VALUE KeyValue; - CM_KEY_SECURITY KeySecurity; - CM_KEY_INDEX KeyIndex; - HCELL_INDEX KeyList[ANYSIZE_ARRAY]; - WCHAR KeyString[ANYSIZE_ARRAY]; - } u; -} CELL_DATA, *PCELL_DATA; - // // Cached Value Index // Modified: trunk/reactos/ntoskrnl/config/cmsysini.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmsysini.c…
============================================================================== --- trunk/reactos/ntoskrnl/config/cmsysini.c (original) +++ trunk/reactos/ntoskrnl/config/cmsysini.c Mon Oct 29 00:31:46 2007 @@ -607,7 +607,7 @@ if (!KeyCell) return FALSE; /* Setup the cell */ - KeyCell->Signature = (USHORT)CM_KEY_NODE_SIGNATURE;; + KeyCell->Signature = (USHORT)CM_KEY_NODE_SIGNATURE; KeyCell->Flags = KEY_HIVE_ENTRY | KEY_NO_DELETE; KeQuerySystemTime(&SystemTime); KeyCell->LastWriteTime = SystemTime; Modified: trunk/reactos/tools/mkhive/cmi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/mkhive/cmi.c?rev=299…
============================================================================== --- trunk/reactos/tools/mkhive/cmi.c (original) +++ trunk/reactos/tools/mkhive/cmi.c Mon Oct 29 00:31:46 2007 @@ -150,39 +150,39 @@ static NTSTATUS CmiAddKeyToHashTable( IN PEREGISTRY_HIVE RegistryHive, - IN OUT PHASH_TABLE_CELL HashCell, + IN OUT PCM_KEY_FAST_INDEX HashCell, IN PCM_KEY_NODE KeyCell, IN HSTORAGE_TYPE StorageType, IN PCM_KEY_NODE NewKeyCell, IN HCELL_INDEX NKBOffset) { ULONG i = KeyCell->SubKeyCounts[StorageType]; - ULONG HashValue; - - if (NewKeyCell->Flags & REG_KEY_NAME_PACKED) + ULONG HashKey; + + if (NewKeyCell->Flags & KEY_COMP_NAME) { RtlCopyMemory( - &HashValue, + &HashKey, NewKeyCell->Name, - min(NewKeyCell->NameSize, sizeof(ULONG))); + min(NewKeyCell->NameLength, sizeof(ULONG))); } for (i = 0; i < KeyCell->SubKeyCounts[StorageType]; i++) { - if (HashCell->Table[i].HashValue > HashValue) + if (HashCell->List[i].HashKey > HashKey) break; } if (i < KeyCell->SubKeyCounts[StorageType]) { - RtlMoveMemory(HashCell->Table + i + 1, - HashCell->Table + i, - (HashCell->HashTableSize - 1 - i) * - sizeof(HashCell->Table[0])); - } - - HashCell->Table[i].KeyOffset = NKBOffset; - HashCell->Table[i].HashValue = HashValue; + RtlMoveMemory(HashCell->List + i + 1, + HashCell->List + i, + (HashCell->Count - 1 - i) * + sizeof(HashCell->List[0])); + } + + HashCell->List[i].Cell = NKBOffset; + HashCell->List[i].HashKey = HashKey; HvMarkCellDirty(&RegistryHive->Hive, KeyCell->SubKeyLists[StorageType], FALSE); return STATUS_SUCCESS; } @@ -190,19 +190,19 @@ static NTSTATUS CmiAllocateHashTableCell ( IN PEREGISTRY_HIVE RegistryHive, - OUT PHASH_TABLE_CELL *HashBlock, + OUT PCM_KEY_FAST_INDEX *HashBlock, OUT HCELL_INDEX *HBOffset, IN USHORT SubKeyCount, IN HSTORAGE_TYPE Storage) { - PHASH_TABLE_CELL NewHashBlock; + PCM_KEY_FAST_INDEX NewHashBlock; ULONG NewHashSize; NTSTATUS Status; Status = STATUS_SUCCESS; *HashBlock = NULL; - NewHashSize = sizeof(HASH_TABLE_CELL) + - (SubKeyCount * sizeof(HASH_RECORD)); + NewHashSize = sizeof(CM_KEY_FAST_INDEX) + + (SubKeyCount * sizeof(CM_INDEX)); *HBOffset = HvAllocateCell(&RegistryHive->Hive, NewHashSize, Storage, HCELL_NIL); if (*HBOffset == HCELL_NIL) @@ -212,9 +212,9 @@ else { ASSERT(SubKeyCount <= USHORT_MAX); - NewHashBlock = (PHASH_TABLE_CELL)HvGetCell (&RegistryHive->Hive, *HBOffset); - NewHashBlock->Id = REG_HASH_TABLE_CELL_ID; - NewHashBlock->HashTableSize = SubKeyCount; + NewHashBlock = (PCM_KEY_FAST_INDEX)HvGetCell (&RegistryHive->Hive, *HBOffset); + NewHashBlock->Signature = CM_KEY_FAST_LEAF; + NewHashBlock->Count = SubKeyCount; *HashBlock = NewHashBlock; } @@ -231,12 +231,12 @@ OUT PCM_KEY_NODE *pSubKeyCell, OUT HCELL_INDEX *pBlockOffset) { - PHASH_TABLE_CELL HashBlock; + PCM_KEY_FAST_INDEX HashBlock; HCELL_INDEX NKBOffset; PCM_KEY_NODE NewKeyCell; ULONG NewBlockSize; NTSTATUS Status; - USHORT NameSize; + USHORT NameLength; PWSTR NamePtr; BOOLEAN Packable; HSTORAGE_TYPE Storage; @@ -250,17 +250,17 @@ if (SubKeyName->Buffer[0] == L'\\') { NamePtr = &SubKeyName->Buffer[1]; - NameSize = SubKeyName->Length - sizeof(WCHAR); + NameLength = SubKeyName->Length - sizeof(WCHAR); } else { NamePtr = SubKeyName->Buffer; - NameSize = SubKeyName->Length; + NameLength = SubKeyName->Length; } /* Check whether key name can be packed */ Packable = TRUE; - for (i = 0; i < NameSize / sizeof(WCHAR); i++) + for (i = 0; i < NameLength / sizeof(WCHAR); i++) { if (NamePtr[i] & 0xFF00) { @@ -272,13 +272,13 @@ /* Adjust name size */ if (Packable) { - NameSize = NameSize / sizeof(WCHAR); + NameLength = NameLength / sizeof(WCHAR); } Status = STATUS_SUCCESS; Storage = (CreateOptions & REG_OPTION_VOLATILE) ? Volatile : Stable; - NewBlockSize = sizeof(CM_KEY_NODE) + NameSize; + NewBlockSize = sizeof(CM_KEY_NODE) + NameLength; NKBOffset = HvAllocateCell(&RegistryHive->Hive, NewBlockSize, Storage, HCELL_NIL); if (NKBOffset == HCELL_NIL) { @@ -287,10 +287,10 @@ else { NewKeyCell = (PCM_KEY_NODE)HvGetCell (&RegistryHive->Hive, NKBOffset); - NewKeyCell->Id = REG_KEY_CELL_ID; + NewKeyCell->Signature = CM_KEY_NODE_SIGNATURE; if (CreateOptions & REG_OPTION_VOLATILE) { - NewKeyCell->Flags = REG_KEY_VOLATILE_CELL; + NewKeyCell->Flags = KEY_IS_VOLATILE; } else { @@ -304,17 +304,17 @@ NewKeyCell->SubKeyLists[Volatile] = HCELL_NIL; NewKeyCell->ValueList.Count = 0; NewKeyCell->ValueList.List = HCELL_NIL; - NewKeyCell->SecurityKeyOffset = HCELL_NIL; - NewKeyCell->ClassNameOffset = HCELL_NIL; + NewKeyCell->Security = HCELL_NIL; + NewKeyCell->Class = HCELL_NIL; /* Pack the key name */ - NewKeyCell->NameSize = NameSize; + NewKeyCell->NameLength = NameLength; if (Packable) { - NewKeyCell->Flags |= REG_KEY_NAME_PACKED; - for (i = 0; i < NameSize; i++) + NewKeyCell->Flags |= KEY_COMP_NAME; + for (i = 0; i < NameLength; i++) { - NewKeyCell->Name[i] = (CHAR)(NamePtr[i] & 0x00FF); + ((PCHAR)NewKeyCell->Name)[i] = (CHAR)(NamePtr[i] & 0x00FF); } } else @@ -322,7 +322,7 @@ RtlCopyMemory( NewKeyCell->Name, NamePtr, - NameSize); + NameLength); } VERIFY_KEY_CELL(NewKeyCell); @@ -348,14 +348,14 @@ } else { - HashBlock = (PHASH_TABLE_CELL)HvGetCell ( + HashBlock = (PCM_KEY_FAST_INDEX)HvGetCell ( &RegistryHive->Hive, ParentKeyCell->SubKeyLists[Storage]); - ASSERT(HashBlock->Id == REG_HASH_TABLE_CELL_ID); - - if (((ParentKeyCell->SubKeyCounts[Storage] + 1) >= HashBlock->HashTableSize)) - { - PHASH_TABLE_CELL NewHashBlock; + ASSERT(HashBlock->Signature == CM_KEY_FAST_LEAF); + + if (((ParentKeyCell->SubKeyCounts[Storage] + 1) >= HashBlock->Count)) + { + PCM_KEY_FAST_INDEX NewHashBlock; HCELL_INDEX HTOffset; /* Reallocate the hash table cell */ @@ -363,7 +363,7 @@ RegistryHive, &NewHashBlock, &HTOffset, - HashBlock->HashTableSize + + HashBlock->Count + REG_EXTEND_HASH_TABLE_SIZE, Storage); if (!NT_SUCCESS(Status)) @@ -372,12 +372,12 @@ } RtlZeroMemory( - &NewHashBlock->Table[0], - sizeof(NewHashBlock->Table[0]) * NewHashBlock->HashTableSize); + &NewHashBlock->List[0], + sizeof(NewHashBlock->List[0]) * NewHashBlock->Count); RtlCopyMemory( - &NewHashBlock->Table[0], - &HashBlock->Table[0], - sizeof(NewHashBlock->Table[0]) * HashBlock->HashTableSize); + &NewHashBlock->List[0], + &HashBlock->List[0], + sizeof(NewHashBlock->List[0]) * HashBlock->Count); HvFreeCell (&RegistryHive->Hive, ParentKeyCell->SubKeyLists[Storage]); ParentKeyCell->SubKeyLists[Storage] = HTOffset; HashBlock = NewHashBlock; @@ -443,24 +443,24 @@ PWCHAR UnicodeName; USHORT i; - if (KeyCell->Flags & REG_KEY_NAME_PACKED) - { - if (KeyName->Length != KeyCell->NameSize * sizeof(WCHAR)) + if (KeyCell->Flags & KEY_COMP_NAME) + { + if (KeyName->Length != KeyCell->NameLength * sizeof(WCHAR)) return FALSE; - for (i = 0; i < KeyCell->NameSize; i++) - { - if (KeyName->Buffer[i] != (WCHAR)KeyCell->Name[i]) + for (i = 0; i < KeyCell->NameLength; i++) + { + if (((PCHAR)KeyName->Buffer)[i] != (WCHAR)KeyCell->Name[i]) return FALSE; } } else { - if (KeyName->Length != KeyCell->NameSize) + if (KeyName->Length != KeyCell->NameLength) return FALSE; UnicodeName = (PWCHAR)KeyCell->Name; - for (i = 0; i < KeyCell->NameSize / sizeof(WCHAR); i++) + for (i = 0; i < KeyCell->NameLength / sizeof(WCHAR); i++) { if (KeyName->Buffer[i] != UnicodeName[i]) return FALSE; @@ -480,27 +480,27 @@ DPRINT("Flags: %hx\n", KeyCell->Flags); - if (KeyCell->Flags & REG_KEY_NAME_PACKED) - { - if (KeyName->Length != KeyCell->NameSize * sizeof(WCHAR)) + if (KeyCell->Flags & KEY_COMP_NAME) + { + if (KeyName->Length != KeyCell->NameLength * sizeof(WCHAR)) return FALSE; /* FIXME: use _strnicmp */ - for (i = 0; i < KeyCell->NameSize; i++) - { - if (RtlUpcaseUnicodeChar(KeyName->Buffer[i]) != + for (i = 0; i < KeyCell->NameLength; i++) + { + if (RtlUpcaseUnicodeChar(((PCHAR)KeyName->Buffer)[i]) != RtlUpcaseUnicodeChar((WCHAR)KeyCell->Name[i])) return FALSE; } } else { - if (KeyName->Length != KeyCell->NameSize) + if (KeyName->Length != KeyCell->NameLength) return FALSE; UnicodeName = (PWCHAR)KeyCell->Name; /* FIXME: use _strnicmp */ - for (i = 0; i < KeyCell->NameSize / sizeof(WCHAR); i++) + for (i = 0; i < KeyCell->NameLength / sizeof(WCHAR); i++) { if (RtlUpcaseUnicodeChar(KeyName->Buffer[i]) != RtlUpcaseUnicodeChar(UnicodeName[i])) @@ -520,7 +520,7 @@ OUT PCM_KEY_NODE *pSubKeyCell, OUT HCELL_INDEX *pBlockOffset) { - PHASH_TABLE_CELL HashBlock; + PCM_KEY_FAST_INDEX HashBlock; PCM_KEY_NODE CurSubKeyCell; ULONG Storage; ULONG i; @@ -542,42 +542,42 @@ } /* Get hash table */ - HashBlock = (PHASH_TABLE_CELL)HvGetCell (&RegistryHive->Hive, KeyCell->SubKeyLists[Storage]); - if (!HashBlock || HashBlock->Id != REG_HASH_TABLE_CELL_ID) + HashBlock = (PCM_KEY_FAST_INDEX)HvGetCell (&RegistryHive->Hive, KeyCell->SubKeyLists[Storage]); + if (!HashBlock || HashBlock->Signature != CM_KEY_FAST_LEAF) return STATUS_UNSUCCESSFUL; for (i = 0; i < KeyCell->SubKeyCounts[Storage]; i++) { if (Attributes & OBJ_CASE_INSENSITIVE) { - if ((HashBlock->Table[i].HashValue == 0 - || CmiCompareHashI(SubKeyName, (PCHAR)&HashBlock->Table[i].HashValue))) + if ((HashBlock->List[i].HashKey == 0 + || CmiCompareHashI(SubKeyName, (PCHAR)&HashBlock->List[i].HashKey))) { CurSubKeyCell = (PCM_KEY_NODE)HvGetCell ( &RegistryHive->Hive, - HashBlock->Table[i].KeyOffset); + HashBlock->List[i].Cell); if (CmiCompareKeyNamesI(SubKeyName, CurSubKeyCell)) { *pSubKeyCell = CurSubKeyCell; - *pBlockOffset = HashBlock->Table[i].KeyOffset; + *pBlockOffset = HashBlock->List[i].Cell; return STATUS_SUCCESS; } } } else { - if ((HashBlock->Table[i].HashValue == 0 - || CmiCompareHash(SubKeyName, (PCHAR)&HashBlock->Table[i].HashValue))) + if ((HashBlock->List[i].HashKey == 0 + || CmiCompareHash(SubKeyName, (PCHAR)&HashBlock->List[i].HashKey))) { CurSubKeyCell = (PCM_KEY_NODE)HvGetCell ( &RegistryHive->Hive, - HashBlock->Table[i].KeyOffset); + HashBlock->List[i].Cell); if (CmiCompareKeyNames(SubKeyName, CurSubKeyCell)) { *pSubKeyCell = CurSubKeyCell; - *pBlockOffset = HashBlock->Table[i].KeyOffset; + *pBlockOffset = HashBlock->List[i].Cell; return STATUS_SUCCESS; } } @@ -619,32 +619,32 @@ { PCM_KEY_VALUE NewValueCell; BOOLEAN Packable; - USHORT NameSize, i; + USHORT NameLength, i; NTSTATUS Status; Status = STATUS_SUCCESS; - NameSize = CmiGetPackedNameLength(ValueName, &Packable); - - DPRINT("ValueName->Length %lu NameSize %lu\n", ValueName->Length, NameSize); - - *VBOffset = HvAllocateCell(&RegistryHive->Hive, sizeof(CM_KEY_VALUE) + NameSize, Storage, HCELL_NIL); + NameLength = CmiGetPackedNameLength(ValueName, &Packable); + + DPRINT("ValueName->Length %lu NameLength %lu\n", ValueName->Length, NameLength); + + *VBOffset = HvAllocateCell(&RegistryHive->Hive, sizeof(CM_KEY_VALUE) + NameLength, Storage, HCELL_NIL); if (*VBOffset == HCELL_NIL) { Status = STATUS_INSUFFICIENT_RESOURCES; } else { - ASSERT(NameSize <= USHORT_MAX); + ASSERT(NameLength <= USHORT_MAX); NewValueCell = (PCM_KEY_VALUE)HvGetCell (&RegistryHive->Hive, *VBOffset); - NewValueCell->Id = REG_VALUE_CELL_ID; - NewValueCell->NameSize = (USHORT)NameSize; + NewValueCell->Signature = CM_KEY_VALUE_SIGNATURE; + NewValueCell->NameLength = (USHORT)NameLength; if (Packable) { /* Pack the value name */ - for (i = 0; i < NameSize; i++) - NewValueCell->Name[i] = (CHAR)ValueName->Buffer[i]; - NewValueCell->Flags |= REG_VALUE_NAME_PACKED; + for (i = 0; i < NameLength; i++) + ((PCHAR)NewValueCell->Name)[i] = (CHAR)ValueName->Buffer[i]; + NewValueCell->Flags |= VALUE_COMP_NAME; } else { @@ -652,12 +652,12 @@ RtlCopyMemory( NewValueCell->Name, ValueName->Buffer, - NameSize); + NameLength); NewValueCell->Flags = 0; } - NewValueCell->DataType = 0; - NewValueCell->DataSize = 0; - NewValueCell->DataOffset = HCELL_NIL; + NewValueCell->Type = 0; + NewValueCell->DataLength = 0; + NewValueCell->Data = HCELL_NIL; *ValueCell = NewValueCell; } @@ -681,7 +681,7 @@ HSTORAGE_TYPE Storage; NTSTATUS Status; - Storage = (KeyCell->Flags & REG_KEY_VOLATILE_CELL) ? Volatile : Stable; + Storage = (KeyCell->Flags & KEY_IS_VOLATILE) ? Volatile : Stable; if (KeyCell->ValueList.List == HCELL_NIL) { /* Allocate some room for the value list */ @@ -811,9 +811,9 @@ if (CmiComparePackedNames( ValueName, - CurValueCell->Name, - CurValueCell->NameSize, - (BOOLEAN)((CurValueCell->Flags & REG_VALUE_NAME_PACKED) ? TRUE : FALSE))) + (PUCHAR)CurValueCell->Name, + CurValueCell->NameLength, + (BOOLEAN)((CurValueCell->Flags & VALUE_COMP_NAME) ? TRUE : FALSE))) { *pValueCell = CurValueCell; *pValueCellOffset = ValueListCell->ValueOffset[i]; Modified: trunk/reactos/tools/mkhive/registry.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/mkhive/registry.c?re…
============================================================================== --- trunk/reactos/tools/mkhive/registry.c (original) +++ trunk/reactos/tools/mkhive/registry.c Mon Oct 29 00:31:46 2007 @@ -37,6 +37,9 @@ #define NDEBUG #include "mkhive.h" +#define REG_DATA_SIZE_MASK 0x7FFFFFFF +#define REG_DATA_IN_OFFSET 0x80000000 + static EREGISTRY_HIVE RootHive; static MEMKEY RootKey; EREGISTRY_HIVE DefaultHive; /* \Registry\User\.DEFAULT */ @@ -362,10 +365,10 @@ return ERROR_UNSUCCESSFUL; /* Get size of the allocated cellule (if any) */ - if (!(ValueCell->DataSize & REG_DATA_IN_OFFSET) && - (ValueCell->DataSize & REG_DATA_SIZE_MASK) != 0) - { - DataCell = HvGetCell(&Key->RegistryHive->Hive, ValueCell->DataOffset); + if (!(ValueCell->DataLength & REG_DATA_IN_OFFSET) && + (ValueCell->DataLength & REG_DATA_SIZE_MASK) != 0) + { + DataCell = HvGetCell(&Key->RegistryHive->Hive, ValueCell->Data); if (!DataCell) return ERROR_UNSUCCESSFUL; DataCellSize = -HvGetCellSize(&Key->RegistryHive->Hive, DataCell); @@ -379,13 +382,13 @@ if (cbData <= sizeof(HCELL_INDEX)) { /* If data size <= sizeof(HCELL_INDEX) then store data in the data offset */ - DPRINT("ValueCell->DataSize %lu\n", ValueCell->DataSize); + DPRINT("ValueCell->DataLength %lu\n", ValueCell->DataLength); if (DataCell) - HvFreeCell(&Key->RegistryHive->Hive, ValueCell->DataOffset); - - RtlCopyMemory(&ValueCell->DataOffset, lpData, cbData); - ValueCell->DataSize = (ULONG)(cbData | REG_DATA_IN_OFFSET); - ValueCell->DataType = dwType; + HvFreeCell(&Key->RegistryHive->Hive, ValueCell->Data); + + RtlCopyMemory(&ValueCell->Data, lpData, cbData); + ValueCell->DataLength = (ULONG)(cbData | REG_DATA_IN_OFFSET); + ValueCell->Type = dwType; HvMarkCellDirty(&Key->RegistryHive->Hive, ValueCellOffset, FALSE); } else @@ -396,7 +399,7 @@ * data block and allocate a new one. */ HCELL_INDEX NewOffset; - DPRINT("ValueCell->DataSize %lu\n", ValueCell->DataSize); + DPRINT("ValueCell->DataLength %lu\n", ValueCell->DataLength); NewOffset = HvAllocateCell(&Key->RegistryHive->Hive, cbData, Stable, HCELL_NIL); if (NewOffset == HCELL_NIL) @@ -406,17 +409,17 @@ } if (DataCell) - HvFreeCell(&Key->RegistryHive->Hive, ValueCell->DataOffset); - - ValueCell->DataOffset = NewOffset; + HvFreeCell(&Key->RegistryHive->Hive, ValueCell->Data); + + ValueCell->Data = NewOffset; DataCell = (PVOID)HvGetCell(&Key->RegistryHive->Hive, NewOffset); } /* Copy new contents to cellule */ RtlCopyMemory(DataCell, lpData, cbData); - ValueCell->DataSize = (ULONG)(cbData & REG_DATA_SIZE_MASK); - ValueCell->DataType = dwType; - HvMarkCellDirty(&Key->RegistryHive->Hive, ValueCell->DataOffset, FALSE); + ValueCell->DataLength = (ULONG)(cbData & REG_DATA_SIZE_MASK); + ValueCell->Type = dwType; + HvMarkCellDirty(&Key->RegistryHive->Hive, ValueCell->Data, FALSE); HvMarkCellDirty(&Key->RegistryHive->Hive, ValueCellOffset, FALSE); }
17 years, 1 month
1
0
0
0
[jimtabor] 29942: Sorry I did not want to change that part of the object.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Mon Oct 29 00:12:11 2007 New Revision: 29942 URL:
http://svn.reactos.org/svn/reactos?rev=29942&view=rev
Log: Sorry I did not want to change that part of the object. Modified: trunk/reactos/subsystems/win32/win32k/include/dc.h Modified: trunk/reactos/subsystems/win32/win32k/include/dc.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/dc.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/dc.h Mon Oct 29 00:12:11 2007 @@ -60,9 +60,9 @@ typedef struct _DC { HGDIOBJ hHmgr; // Handle for this DC object. -// PVOID pvEntry; -// ULONG lucExcLock; -// ULONG Tid; + PVOID pvEntry; + ULONG lucExcLock; + ULONG Tid; DHPDEV PDev; INT DC_Type;
17 years, 1 month
1
0
0
0
← Newer
1
...
6
7
8
9
10
11
12
...
71
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
68
69
70
71
Results per page:
10
25
50
100
200