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
September 2014
----- 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
16 participants
413 discussions
Start a n
N
ew thread
[jgardou] 64420: [ADVAPI32] - Mark key create from HKCR subkeys as HKCR subkeys CORE-8582
by jgardou@svn.reactos.org
Author: jgardou Date: Tue Sep 30 20:00:54 2014 New Revision: 64420 URL:
http://svn.reactos.org/svn/reactos?rev=64420&view=rev
Log: [ADVAPI32] - Mark key create from HKCR subkeys as HKCR subkeys CORE-8582 Modified: trunk/reactos/dll/win32/advapi32/reg/reg.c Modified: trunk/reactos/dll/win32/advapi32/reg/reg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/reg/reg…
============================================================================== --- trunk/reactos/dll/win32/advapi32/reg/reg.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/reg/reg.c [iso-8859-1] Tue Sep 30 20:00:54 2014 @@ -1125,6 +1125,9 @@ return RtlNtStatusToDosError(Status); } + if (IsHKCRKey(ParentKey)) + MakeHKCRKey(phkResult); + return ERROR_SUCCESS; }
10 years, 2 months
1
0
0
0
[jgardou] 64419: [ADVAPI32] - Reimplement RegDeleteKeyA as a wrapper around RegDeleteKeyW CORE-8582
by jgardou@svn.reactos.org
Author: jgardou Date: Tue Sep 30 20:00:35 2014 New Revision: 64419 URL:
http://svn.reactos.org/svn/reactos?rev=64419&view=rev
Log: [ADVAPI32] - Reimplement RegDeleteKeyA as a wrapper around RegDeleteKeyW CORE-8582 Modified: trunk/reactos/dll/win32/advapi32/reg/reg.c Modified: trunk/reactos/dll/win32/advapi32/reg/reg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/reg/reg…
============================================================================== --- trunk/reactos/dll/win32/advapi32/reg/reg.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/reg/reg.c [iso-8859-1] Tue Sep 30 20:00:35 2014 @@ -1182,55 +1182,16 @@ RegDeleteKeyA(HKEY hKey, LPCSTR lpSubKey) { - OBJECT_ATTRIBUTES ObjectAttributes; + LONG ErrorCode; UNICODE_STRING SubKeyName; - HANDLE ParentKey; - HANDLE TargetKey; - NTSTATUS Status; - - /* Make sure we got a subkey */ - if (!lpSubKey) - { - /* Fail */ - return ERROR_INVALID_PARAMETER; - } - - Status = MapDefaultKey(&ParentKey, - hKey); - if (!NT_SUCCESS(Status)) - { - return RtlNtStatusToDosError(Status); - } - - RtlCreateUnicodeStringFromAsciiz(&SubKeyName, - (LPSTR)lpSubKey); - InitializeObjectAttributes(&ObjectAttributes, - &SubKeyName, - OBJ_CASE_INSENSITIVE, - ParentKey, - NULL); - - Status = NtOpenKey(&TargetKey, - DELETE, - &ObjectAttributes); + + RtlCreateUnicodeStringFromAsciiz(&SubKeyName, (LPSTR)lpSubKey); + + ErrorCode = RegDeleteKeyW(hKey, SubKeyName.Buffer); + RtlFreeUnicodeString(&SubKeyName); - if (!NT_SUCCESS(Status)) - { - goto Cleanup; - } - - Status = NtDeleteKey(TargetKey); - NtClose (TargetKey); - -Cleanup: - ClosePredefKey(ParentKey); - - if (!NT_SUCCESS(Status)) - { - return RtlNtStatusToDosError(Status); - } - - return ERROR_SUCCESS; + + return ErrorCode; }
10 years, 2 months
1
0
0
0
[jgardou] 64418: [ADVAPI32] - Implement RegOpenKeyEx for HKEY_CLASSES_ROOT subkeys CORE-8582
by jgardou@svn.reactos.org
Author: jgardou Date: Tue Sep 30 20:00:23 2014 New Revision: 64418 URL:
http://svn.reactos.org/svn/reactos?rev=64418&view=rev
Log: [ADVAPI32] - Implement RegOpenKeyEx for HKEY_CLASSES_ROOT subkeys CORE-8582 Added: trunk/reactos/dll/win32/advapi32/reg/hkcr.c (with props) Modified: trunk/reactos/dll/win32/advapi32/CMakeLists.txt trunk/reactos/dll/win32/advapi32/reg/reg.c trunk/reactos/dll/win32/advapi32/reg/reg.h Modified: trunk/reactos/dll/win32/advapi32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/CMakeLi…
============================================================================== --- trunk/reactos/dll/win32/advapi32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/CMakeLists.txt [iso-8859-1] Tue Sep 30 20:00:23 2014 @@ -28,6 +28,7 @@ misc/msi.c misc/shutdown.c misc/sysfunc.c + reg/hkcr.c reg/reg.c sec/ac.c sec/audit.c Added: trunk/reactos/dll/win32/advapi32/reg/hkcr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/reg/hkc…
============================================================================== --- trunk/reactos/dll/win32/advapi32/reg/hkcr.c (added) +++ trunk/reactos/dll/win32/advapi32/reg/hkcr.c [iso-8859-1] Tue Sep 30 20:00:23 2014 @@ -0,0 +1,269 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * FILE: lib/advapi32/reg/hkcr.c + * PURPOSE: Registry functions - HKEY_CLASSES_ROOT abstraction + * PROGRAMMER: Jerôme Gardou (jerome.gardou(a)reactos.org) + */ + +#include <advapi32.h> + +#include <ndk/cmfuncs.h> +#include <pseh/pseh2.h> + +#include "reg.h" + +WINE_DEFAULT_DEBUG_CHANNEL(reg); + +static const UNICODE_STRING HKLM_ClassesPath = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\Software\\Classes"); + +static +LONG +GetKeyName(HKEY hKey, PUNICODE_STRING KeyName) +{ + UNICODE_STRING InfoName; + PKEY_NAME_INFORMATION NameInformation; + ULONG InfoLength; + NTSTATUS Status; + + /* Get info length */ + InfoLength = 0; + Status = NtQueryKey(hKey, KeyNameInformation, NULL, 0, &InfoLength); + if (Status != STATUS_BUFFER_TOO_SMALL) + { + ERR("NtQueryKey returned unexpected Status: 0x%08x\n", Status); + return RtlNtStatusToDosError(Status); + } + + /* Get it for real */ + NameInformation = RtlAllocateHeap(RtlGetProcessHeap(), 0, InfoLength); + if (NameInformation == NULL) + { + ERR("Failed to allocate %lu bytes", InfoLength); + return ERROR_NOT_ENOUGH_MEMORY; + } + + Status = NtQueryKey(hKey, KeyNameInformation, NameInformation, InfoLength, &InfoLength); + if (!NT_SUCCESS(Status)) + { + ERR("NtQueryKey failed: 0x%08x\n", Status); + return RtlNtStatusToDosError(Status); + } + + /* Make it a proper UNICODE_STRING */ + InfoName.Length = NameInformation->NameLength; + InfoName.MaximumLength = NameInformation->NameLength; + InfoName.Buffer = NameInformation->Name; + + Status = RtlDuplicateUnicodeString(RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE, &InfoName, KeyName); + if (!NT_SUCCESS(Status)) + { + ERR("RtlDuplicateUnicodeString failed: 0x%08x\n", Status); + return RtlNtStatusToDosError(Status); + } + + RtlFreeHeap(RtlGetProcessHeap(), 0, NameInformation); + + return ERROR_SUCCESS; +} + +static +LONG +GetKeySam( + _In_ HKEY hKey, + _Out_ REGSAM* RegSam) +{ + NTSTATUS Status; + OBJECT_BASIC_INFORMATION ObjectInfo; + + Status = NtQueryObject(hKey, ObjectBasicInformation, &ObjectInfo, sizeof(ObjectInfo), NULL); + if (!NT_SUCCESS(Status)) + { + ERR("NtQueryObject failed, Status %x08x\n", Status); + return RtlNtStatusToDosError(Status); + } + + *RegSam = ObjectInfo.GrantedAccess; + return ERROR_SUCCESS; +} + +/* + * Gets a HKLM key from an HKCU key. + */ +static +LONG +GetFallbackHKCRKey( + _In_ HKEY hKey, + _Out_ HKEY* MachineKey) +{ + UNICODE_STRING KeyName; + LPWSTR SubKeyName; + LONG ErrorCode; + REGSAM SamDesired; + + /* Get the key name */ + ErrorCode = GetKeyName(hKey, &KeyName); + if (ErrorCode != ERROR_SUCCESS) + return ErrorCode; + + /* See if we really need a conversion */ + if (RtlPrefixUnicodeString(&HKLM_ClassesPath, &KeyName, TRUE)) + { + RtlFreeUnicodeString(&KeyName); + *MachineKey = hKey; + return ERROR_SUCCESS; + } + + SubKeyName = KeyName.Buffer + 15; /* 15 == wcslen(L"\\Registry\\User\\") */ + /* Skip the user token */ + while (*SubKeyName++ != L'\\') + { + if (!*SubKeyName) + { + ERR("Key name %S is invalid!\n", KeyName.Buffer); + return ERROR_INTERNAL_ERROR; + } + } + + /* Use the same access mask than the original key */ + ErrorCode = GetKeySam(hKey, &SamDesired); + if (ErrorCode != ERROR_SUCCESS) + { + RtlFreeUnicodeString(&KeyName); + return ErrorCode; + } + + /* Open the key. */ + ErrorCode = RegOpenKeyExW( + HKEY_LOCAL_MACHINE, + SubKeyName, + 0, + SamDesired, + MachineKey); + + RtlFreeUnicodeString(&KeyName); + + return ErrorCode; +} + +/* Get the HKCU key (if it exists) from an HKCR key */ +static +LONG +GetPreferredHKCRKey( + _In_ HKEY hKey, + _Out_ HKEY* PreferredKey) +{ + UNICODE_STRING KeyName; + LPWSTR SubKeyName; + LONG ErrorCode; + REGSAM SamDesired; + + /* Get the key name */ + ErrorCode = GetKeyName(hKey, &KeyName); + if (ErrorCode != ERROR_SUCCESS) + return ErrorCode; + + /* See if we really need a conversion */ + if (!RtlPrefixUnicodeString(&HKLM_ClassesPath, &KeyName, TRUE)) + { + RtlFreeUnicodeString(&KeyName); + *PreferredKey = hKey; + return ERROR_SUCCESS; + } + + /* 18 == wcslen(L"\\Registry\\Machine\\") */ + SubKeyName = KeyName.Buffer + 18; + + /* Use the same access mask than the original key */ + ErrorCode = GetKeySam(hKey, &SamDesired); + if (ErrorCode != ERROR_SUCCESS) + { + RtlFreeUnicodeString(&KeyName); + return ErrorCode; + } + + /* Open the key. */ + ErrorCode = RegOpenKeyExW( + HKEY_CURRENT_USER, + SubKeyName, + 0, + SamDesired, + PreferredKey); + + RtlFreeUnicodeString(&KeyName); + + return ErrorCode; +} + +/* Same as RegOpenKeyExW, but for HKEY_CLASSES_ROOT subkeys */ +LONG +WINAPI +OpenHKCRKey( + _In_ HKEY hKey, + _In_ LPCWSTR lpSubKey, + _In_ DWORD ulOptions, + _In_ REGSAM samDesired, + _In_ PHKEY phkResult) +{ + HKEY QueriedKey; + LONG ErrorCode; + + ASSERT(IsHKCRKey(hKey)); + + /* Remove the HKCR flag while we're working */ + hKey = (HKEY)(((ULONG_PTR)hKey) & ~0x2); + + ErrorCode = GetPreferredHKCRKey(hKey, &QueriedKey); + + if (ErrorCode == ERROR_FILE_NOT_FOUND) + { + /* The key doesn't exist on HKCU side, no chance for a subkey */ + ErrorCode = RegOpenKeyExW(hKey, lpSubKey, ulOptions, samDesired, phkResult); + if (ErrorCode == ERROR_SUCCESS) + MakeHKCRKey(phkResult); + return ErrorCode; + } + + if (ErrorCode != ERROR_SUCCESS) + { + /* Somehow we failed for another reason (maybe deleted key or whatever) */ + return ErrorCode; + } + + /* Try on the HKCU side */ + ErrorCode = RegOpenKeyExW(QueriedKey, lpSubKey, ulOptions, samDesired, phkResult); + if (ErrorCode == ERROR_SUCCESS) + MakeHKCRKey(phkResult); + + /* Close it if we must */ + if (QueriedKey != hKey) + { + /* The original key is on the machine view */ + RegCloseKey(QueriedKey); + } + + /* Anything else than ERROR_FILE_NOT_FOUND means that we found it, even if it is with failures. */ + if (ErrorCode != ERROR_FILE_NOT_FOUND) + return ErrorCode; + + /* If we're here, we must open from HKLM key. */ + ErrorCode = GetFallbackHKCRKey(hKey, &QueriedKey); + if (ErrorCode != ERROR_SUCCESS) + { + /* Maybe the key doesn't exist in the HKLM view */ + return ErrorCode; + } + + ErrorCode = RegOpenKeyExW(QueriedKey, lpSubKey, ulOptions, samDesired, phkResult); + if (ErrorCode == ERROR_SUCCESS) + MakeHKCRKey(phkResult); + + /* Close it if we must */ + if (QueriedKey != hKey) + { + /* The original key is on the machine view */ + RegCloseKey(QueriedKey); + } + + return ErrorCode; +} Propchange: trunk/reactos/dll/win32/advapi32/reg/hkcr.c ------------------------------------------------------------------------------ charset = UTF-8 Propchange: trunk/reactos/dll/win32/advapi32/reg/hkcr.c ------------------------------------------------------------------------------ svn:eol-style = native Propchange: trunk/reactos/dll/win32/advapi32/reg/hkcr.c ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: trunk/reactos/dll/win32/advapi32/reg/reg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/reg/reg…
============================================================================== --- trunk/reactos/dll/win32/advapi32/reg/reg.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/reg/reg.c [iso-8859-1] Tue Sep 30 20:00:23 2014 @@ -3483,6 +3483,9 @@ return RtlNtStatusToDosError(Status); } + if (IsHKCRKey(KeyHandle)) + return OpenHKCRKey(KeyHandle, lpSubKey, ulOptions, samDesired, phkResult); + if (ulOptions & REG_OPTION_OPEN_LINK) Attributes |= OBJ_OPENLINK; @@ -3500,10 +3503,12 @@ Status = NtOpenKey((PHANDLE)phkResult, samDesired, &ObjectAttributes); + if (!NT_SUCCESS(Status)) { ErrorCode = RtlNtStatusToDosError(Status); } + ClosePredefKey(KeyHandle); Modified: trunk/reactos/dll/win32/advapi32/reg/reg.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/reg/reg…
============================================================================== --- trunk/reactos/dll/win32/advapi32/reg/reg.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/reg/reg.h [iso-8859-1] Tue Sep 30 20:00:23 2014 @@ -19,5 +19,14 @@ void MakeHKCRKey(_Inout_ HKEY* hKey) { - *hKey = (HKEY)((ULONG_PTR)*hKey | 0x2); + *hKey = (HKEY)((ULONG_PTR)(*hKey) | 0x2); } + +LONG +WINAPI +OpenHKCRKey( + _In_ HKEY hKey, + _In_ LPCWSTR lpSubKey, + _In_ DWORD ulOptions, + _In_ REGSAM samDesired, + _In_ PHKEY phkResult);
10 years, 2 months
1
0
0
0
[jgardou] 64417: [ADVAPI32] - Mark the HKEY_CLASSES_ROOT key as belonging to the HKEY_CLASSES_ROOT tree. CORE-8582
by jgardou@svn.reactos.org
Author: jgardou Date: Tue Sep 30 20:00:17 2014 New Revision: 64417 URL:
http://svn.reactos.org/svn/reactos?rev=64417&view=rev
Log: [ADVAPI32] - Mark the HKEY_CLASSES_ROOT key as belonging to the HKEY_CLASSES_ROOT tree. CORE-8582 Added: trunk/reactos/dll/win32/advapi32/reg/reg.h (with props) Modified: trunk/reactos/dll/win32/advapi32/reg/reg.c Modified: trunk/reactos/dll/win32/advapi32/reg/reg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/reg/reg…
============================================================================== --- trunk/reactos/dll/win32/advapi32/reg/reg.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/reg/reg.c [iso-8859-1] Tue Sep 30 20:00:17 2014 @@ -18,6 +18,8 @@ #include <ndk/cmfuncs.h> #include <pseh/pseh2.h> +#include "reg.h" + WINE_DEFAULT_DEBUG_CHANNEL(reg); /* DEFINES ******************************************************************/ @@ -231,10 +233,11 @@ static NTSTATUS -OpenClassesRootKey(PHANDLE KeyHandle) +OpenClassesRootKey(_Out_ PHANDLE KeyHandle) { OBJECT_ATTRIBUTES Attributes; UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\Software\\CLASSES"); + NTSTATUS Status; TRACE("OpenClassesRootKey()\n"); @@ -243,9 +246,17 @@ OBJ_CASE_INSENSITIVE, NULL, NULL); - return NtOpenKey(KeyHandle, - MAXIMUM_ALLOWED, - &Attributes); + Status = NtOpenKey(KeyHandle, + MAXIMUM_ALLOWED, + &Attributes); + + if (!NT_SUCCESS(Status)) + return Status; + + /* Mark it as HKCR */ + MakeHKCRKey((HKEY*)KeyHandle); + + return Status; } Added: trunk/reactos/dll/win32/advapi32/reg/reg.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/reg/reg…
============================================================================== --- trunk/reactos/dll/win32/advapi32/reg/reg.h (added) +++ trunk/reactos/dll/win32/advapi32/reg/reg.h [iso-8859-1] Tue Sep 30 20:00:17 2014 @@ -0,0 +1,23 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * FILE: lib/advapi32/reg/reg.c + * PURPOSE: Registry functions + */ + +#pragma once + +/* FUNCTIONS ****************************************************************/ +FORCEINLINE +BOOL +IsHKCRKey(_In_ HKEY hKey) +{ + return ((ULONG_PTR)hKey & 0x2) != 0; +} + +FORCEINLINE +void +MakeHKCRKey(_Inout_ HKEY* hKey) +{ + *hKey = (HKEY)((ULONG_PTR)*hKey | 0x2); +} Propchange: trunk/reactos/dll/win32/advapi32/reg/reg.h ------------------------------------------------------------------------------ charset = UTF-8 Propchange: trunk/reactos/dll/win32/advapi32/reg/reg.h ------------------------------------------------------------------------------ svn:eol-style = native Propchange: trunk/reactos/dll/win32/advapi32/reg/reg.h ------------------------------------------------------------------------------ svn:mime-type = text/plain
10 years, 2 months
1
0
0
0
[jgardou] 64416: [NTOS/CM] - Put the loop inside SEH, and not vice-versa.
by jgardou@svn.reactos.org
Author: jgardou Date: Tue Sep 30 20:00:00 2014 New Revision: 64416 URL:
http://svn.reactos.org/svn/reactos?rev=64416&view=rev
Log: [NTOS/CM] - Put the loop inside SEH, and not vice-versa. Modified: trunk/reactos/ntoskrnl/config/cmapi.c 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 [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/config/cmapi.c [iso-8859-1] Tue Sep 30 20:00:00 2014 @@ -1556,12 +1556,13 @@ /* Do the real copy */ KeyNameInfo->NameLength = 0; CurrentKcb = Kcb; - while (CurrentKcb) - { - ULONG NameLength; - - _SEH2_TRY - { + + _SEH2_TRY + { + while (CurrentKcb) + { + ULONG NameLength; + if (CurrentKcb->NameBlock->Compressed) { NameLength = CmpCompressedNameSize(CurrentKcb->NameBlock->Name, CurrentKcb->NameBlock->NameLength); @@ -1585,15 +1586,15 @@ /* Add path separator */ KeyNameInfo->Name[NeededLength/sizeof(WCHAR)] = OBJ_NAME_PATH_SEPARATOR; KeyNameInfo->NameLength += NameLength + sizeof(OBJ_NAME_PATH_SEPARATOR); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - return _SEH2_GetExceptionCode(); - } - _SEH2_END; - - CurrentKcb = CurrentKcb->ParentKcb; - } + + CurrentKcb = CurrentKcb->ParentKcb; + } + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + return _SEH2_GetExceptionCode(); + } + _SEH2_END; /* Make sure we copied everything */ ASSERT(NeededLength == 0);
10 years, 2 months
1
0
0
0
[jgardou] 64415: [ADVAPI32] - Reimplement RegCreateKeyExA as a wrapper around RegCreateKeyExW CORE-8582
by jgardou@svn.reactos.org
Author: jgardou Date: Tue Sep 30 19:59:51 2014 New Revision: 64415 URL:
http://svn.reactos.org/svn/reactos?rev=64415&view=rev
Log: [ADVAPI32] - Reimplement RegCreateKeyExA as a wrapper around RegCreateKeyExW CORE-8582 Modified: trunk/reactos/dll/win32/advapi32/reg/reg.c Modified: trunk/reactos/dll/win32/advapi32/reg/reg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/reg/reg…
============================================================================== --- trunk/reactos/dll/win32/advapi32/reg/reg.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/reg/reg.c [iso-8859-1] Tue Sep 30 19:59:51 2014 @@ -1013,75 +1013,39 @@ * @implemented */ LONG WINAPI -RegCreateKeyExA(HKEY hKey, - LPCSTR lpSubKey, - DWORD Reserved, - LPSTR lpClass, - DWORD dwOptions, - REGSAM samDesired, - LPSECURITY_ATTRIBUTES lpSecurityAttributes, - PHKEY phkResult, - LPDWORD lpdwDisposition) +RegCreateKeyExA( + _In_ HKEY hKey, + _In_ LPCSTR lpSubKey, + _In_ DWORD Reserved, + _In_ LPSTR lpClass, + _In_ DWORD dwOptions, + _In_ REGSAM samDesired, + _In_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, + _Out_ PHKEY phkResult, + _Out_ LPDWORD lpdwDisposition) { UNICODE_STRING SubKeyString; UNICODE_STRING ClassString; - OBJECT_ATTRIBUTES ObjectAttributes; - HANDLE ParentKey; - ULONG Attributes = OBJ_CASE_INSENSITIVE; - NTSTATUS Status; - - TRACE("RegCreateKeyExA() called\n"); - - if (lpSecurityAttributes && lpSecurityAttributes->nLength != sizeof(SECURITY_ATTRIBUTES)) - return ERROR_INVALID_USER_BUFFER; - - /* get the real parent key */ - Status = MapDefaultKey(&ParentKey, - hKey); - if (!NT_SUCCESS(Status)) - { - return RtlNtStatusToDosError(Status); - } - - TRACE("ParentKey %p\n", ParentKey); - - if (lpClass != NULL) - { - RtlCreateUnicodeStringFromAsciiz(&ClassString, - lpClass); - } - - if (dwOptions & REG_OPTION_OPEN_LINK) - Attributes |= OBJ_OPENLINK; - - RtlCreateUnicodeStringFromAsciiz(&SubKeyString, - (LPSTR)lpSubKey); - InitializeObjectAttributes(&ObjectAttributes, - &SubKeyString, - Attributes, - (HANDLE)ParentKey, - lpSecurityAttributes ? (PSECURITY_DESCRIPTOR)lpSecurityAttributes->lpSecurityDescriptor : NULL); - Status = CreateNestedKey(phkResult, - &ObjectAttributes, - (lpClass == NULL)? NULL : &ClassString, - dwOptions, - samDesired, - lpdwDisposition); + DWORD ErrorCode; + + RtlCreateUnicodeStringFromAsciiz(&ClassString, lpClass); + RtlCreateUnicodeStringFromAsciiz(&SubKeyString, (LPSTR)lpSubKey); + + ErrorCode = RegCreateKeyExW( + hKey, + SubKeyString.Buffer, + Reserved, + ClassString.Buffer, + dwOptions, + samDesired, + lpSecurityAttributes, + phkResult, + lpdwDisposition); + RtlFreeUnicodeString(&SubKeyString); - if (lpClass != NULL) - { - RtlFreeUnicodeString(&ClassString); - } - - ClosePredefKey(ParentKey); - - TRACE("Status %x\n", Status); - if (!NT_SUCCESS(Status)) - { - return RtlNtStatusToDosError(Status); - } - - return ERROR_SUCCESS; + RtlFreeUnicodeString(&ClassString); + + return ErrorCode; }
10 years, 2 months
1
0
0
0
[jgardou] 64414: [ADVAPI32] - Rewrite RegOpenKeyExA as a wrapper around RegOpenKeyExW CORE-8582
by jgardou@svn.reactos.org
Author: jgardou Date: Tue Sep 30 19:59:35 2014 New Revision: 64414 URL:
http://svn.reactos.org/svn/reactos?rev=64414&view=rev
Log: [ADVAPI32] - Rewrite RegOpenKeyExA as a wrapper around RegOpenKeyExW CORE-8582 Modified: trunk/reactos/dll/win32/advapi32/reg/reg.c Modified: trunk/reactos/dll/win32/advapi32/reg/reg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/reg/reg…
============================================================================== --- trunk/reactos/dll/win32/advapi32/reg/reg.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/reg/reg.c [iso-8859-1] Tue Sep 30 19:59:35 2014 @@ -3452,54 +3452,25 @@ * @implemented */ LONG WINAPI -RegOpenKeyExA(HKEY hKey, - LPCSTR lpSubKey, - DWORD ulOptions, - REGSAM samDesired, - PHKEY phkResult) -{ - OBJECT_ATTRIBUTES ObjectAttributes; +RegOpenKeyExA( + _In_ HKEY hKey, + _In_ LPCSTR lpSubKey, + _In_ DWORD ulOptions, + _In_ REGSAM samDesired, + _Out_ PHKEY phkResult) +{ UNICODE_STRING SubKeyString; - HANDLE KeyHandle; - NTSTATUS Status; - ULONG Attributes = OBJ_CASE_INSENSITIVE; - LONG ErrorCode = ERROR_SUCCESS; + LONG ErrorCode; TRACE("RegOpenKeyExA hKey 0x%x lpSubKey %s ulOptions 0x%x samDesired 0x%x phkResult %p\n", hKey, lpSubKey, ulOptions, samDesired, phkResult); - if (!phkResult) - { - return ERROR_INVALID_PARAMETER; - } - - Status = MapDefaultKey(&KeyHandle, - hKey); - if (!NT_SUCCESS(Status)) - { - return RtlNtStatusToDosError(Status); - } - - if (ulOptions & REG_OPTION_OPEN_LINK) - Attributes |= OBJ_OPENLINK; RtlCreateUnicodeStringFromAsciiz(&SubKeyString, (LPSTR)lpSubKey); - InitializeObjectAttributes(&ObjectAttributes, - &SubKeyString, - Attributes, - KeyHandle, - NULL); - - Status = NtOpenKey((PHANDLE)phkResult, - samDesired, - &ObjectAttributes); + + ErrorCode = RegOpenKeyExW(hKey, SubKeyString.Buffer, ulOptions, samDesired, phkResult); + RtlFreeUnicodeString(&SubKeyString); - if (!NT_SUCCESS(Status)) - { - ErrorCode = RtlNtStatusToDosError(Status); - } - - ClosePredefKey(KeyHandle); return ErrorCode; }
10 years, 2 months
1
0
0
0
[jgardou] 64413: [ADVAPI32_APITEST] - Remove some tests that are broken if HKCU\software\classes\CLSID key exists. Better tests were added later anyway. CORE-8582
by jgardou@svn.reactos.org
Author: jgardou Date: Tue Sep 30 19:59:02 2014 New Revision: 64413 URL:
http://svn.reactos.org/svn/reactos?rev=64413&view=rev
Log: [ADVAPI32_APITEST] - Remove some tests that are broken if HKCU\software\classes\CLSID key exists. Better tests were added later anyway. CORE-8582 Modified: trunk/rostests/apitests/advapi32/HKEY_CLASSES_ROOT.c Modified: trunk/rostests/apitests/advapi32/HKEY_CLASSES_ROOT.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/HKEY_CL…
============================================================================== --- trunk/rostests/apitests/advapi32/HKEY_CLASSES_ROOT.c [iso-8859-1] (original) +++ trunk/rostests/apitests/advapi32/HKEY_CLASSES_ROOT.c [iso-8859-1] Tue Sep 30 19:59:02 2014 @@ -491,22 +491,6 @@ static void -Test_KeyName(void) -{ - HKEY KeyHandle; - DWORD ErrorCode; - - - ErrorCode = RegOpenKeyExW(HKEY_CLASSES_ROOT, L"CLSID", 0, KEY_READ, &KeyHandle); - ok_dec(ErrorCode, ERROR_SUCCESS); - ok(IS_HKCR(KeyHandle), "\n"); - ok_key_name(KeyHandle, &HKLM_ClassesPath, L"CLSID"); - - RegCloseKey(KeyHandle); -} - -static -void Test_DuplicateHandle(void) { HKEY KeyHandle, DupHandle; @@ -522,8 +506,6 @@ ok(DupHandle != NULL, "\n"); ok(!IS_HKCR(DupHandle), "\n"); - ok_key_name(DupHandle, &HKLM_ClassesPath, L"CLSID"); - RegCloseKey(KeyHandle); RegCloseKey(DupHandle); } @@ -546,5 +528,4 @@ Test_CreateOpenKey(); Test_DuplicateHandle(); - Test_KeyName(); -} +}
10 years, 2 months
1
0
0
0
[jgardou] 64412: [ADVAPI32_APITEST] - Skip tests if the user has no administrative rights - Add more tests for subkey creation
by jgardou@svn.reactos.org
Author: jgardou Date: Tue Sep 30 19:58:59 2014 New Revision: 64412 URL:
http://svn.reactos.org/svn/reactos?rev=64412&view=rev
Log: [ADVAPI32_APITEST] - Skip tests if the user has no administrative rights - Add more tests for subkey creation Modified: trunk/rostests/apitests/advapi32/HKEY_CLASSES_ROOT.c Modified: trunk/rostests/apitests/advapi32/HKEY_CLASSES_ROOT.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/HKEY_CL…
============================================================================== --- trunk/rostests/apitests/advapi32/HKEY_CLASSES_ROOT.c [iso-8859-1] (original) +++ trunk/rostests/apitests/advapi32/HKEY_CLASSES_ROOT.c [iso-8859-1] Tue Sep 30 19:58:59 2014 @@ -108,13 +108,15 @@ void Test_CreateOpenKey(void) { - HKEY MachineKey, UserKey, ClassesRootKey; + HKEY MachineKey, MachineSubKey; + HKEY UserKey, UserSubKey; + HKEY ClassesRootKey, ClassesRootSubKey; DWORD ErrorCode; /* First create a subkey in HKLM */ ErrorCode = RegCreateKeyExW( HKEY_LOCAL_MACHINE, - L"Software\\Classes\\Apitest_HKLM_Only", + L"Software\\Classes\\Apitest_HKLM", 0, NULL, 0, @@ -122,25 +124,32 @@ NULL, &MachineKey, NULL); + + if (ErrorCode == ERROR_ACCESS_DENIED) + { + win_skip("Please run those tests with Administrator rights\n"); + return; + } + ok_dec(ErrorCode, ERROR_SUCCESS); ok(!IS_HKCR(MachineKey), "\n"); /* Open it in HKCR */ ErrorCode = RegOpenKeyExW( HKEY_CLASSES_ROOT, - L"Apitest_HKLM_Only", + L"Apitest_HKLM", 0, MAXIMUM_ALLOWED, &ClassesRootKey); ok_dec(ErrorCode, ERROR_SUCCESS); ok(IS_HKCR(ClassesRootKey), "\n"); - ok_key_name(ClassesRootKey, &HKLM_ClassesPath, L"Apitest_HKLM_Only"); + ok_key_name(ClassesRootKey, &HKLM_ClassesPath, L"Apitest_HKLM"); /* Try opening it in HKCU */ UserKey = (HKEY)0xCAFEF00D; ErrorCode = RegOpenKeyExW( HKEY_CURRENT_USER, - L"Software\\Classes\\Apitest_HKLM_Only", + L"Software\\Classes\\Apitest_HKLM", 0, MAXIMUM_ALLOWED, &UserKey); @@ -150,7 +159,7 @@ /* Cleanup */ RegCloseKey(ClassesRootKey); RegCloseKey(MachineKey); - ErrorCode = DeleteSubKey(HKEY_LOCAL_MACHINE, L"Software\\Classes", L"Apitest_HKLM_Only"); + ErrorCode = DeleteSubKey(HKEY_LOCAL_MACHINE, L"Software\\Classes", L"Apitest_HKLM"); ok_dec(ErrorCode, ERROR_SUCCESS); /* Try creating in HKCR */ @@ -315,6 +324,169 @@ ok_dec(ErrorCode, ERROR_SUCCESS); ok_key_deleted(MachineKey); RegCloseKey(MachineKey); + + /* See what happens with subkeys */ + ErrorCode = RegCreateKeyExW( + HKEY_LOCAL_MACHINE, + L"Software\\Classes\\Apitest_HKLM", + 0, + NULL, + 0, + MAXIMUM_ALLOWED, + NULL, + &MachineKey, + NULL); + ok_dec(ErrorCode, ERROR_SUCCESS); + ok(!IS_HKCR(MachineKey), "\n"); + + /* Open it in HKCR */ + ErrorCode = RegOpenKeyExW( + HKEY_CLASSES_ROOT, + L"Apitest_HKLM", + 0, + MAXIMUM_ALLOWED, + &ClassesRootKey); + ok_dec(ErrorCode, ERROR_SUCCESS); + ok(IS_HKCR(ClassesRootKey), "\n"); + ok_key_name(ClassesRootKey, &HKLM_ClassesPath, L"Apitest_HKLM"); + + /* Create a corresponding subkey in HKCU */ + ErrorCode = RegCreateKeyExW( + HKEY_CURRENT_USER, + L"Software\\Classes\\Apitest_HKLM\\HKCU_Subkey", + 0, + NULL, + 0, + MAXIMUM_ALLOWED, + NULL, + &UserSubKey, + NULL); + ok_dec(ErrorCode, ERROR_SUCCESS); + ok(!IS_HKCR(UserSubKey), "\n"); + + /* Open it as an HKCR subkey */ + ErrorCode = RegOpenKeyExW( + ClassesRootKey, + L"HKCU_Subkey", + 0, + MAXIMUM_ALLOWED, + &ClassesRootSubKey); + ok_dec(ErrorCode, ERROR_SUCCESS); + ok(IS_HKCR(ClassesRootSubKey), "\n"); + ok_key_name(ClassesRootSubKey, &HKCU_ClassesPath, L"Apitest_HKLM\\HKCU_Subkey"); + + /* This one now exists */ + ErrorCode = RegOpenKeyExW( + HKEY_CURRENT_USER, + L"Software\\Classes\\Apitest_HKLM", + 0, + MAXIMUM_ALLOWED, + &UserKey); + ok_dec(ErrorCode, ERROR_SUCCESS); + ok(!IS_HKCR(UserKey), "\n"); + + /* Delete */ + ErrorCode = RegDeleteKeyW(UserKey, L"HKCU_Subkey"); + ok_dec(ErrorCode, ERROR_SUCCESS); + ok_key_deleted(UserSubKey); + ok_key_deleted(ClassesRootSubKey); + RegCloseKey(UserSubKey); + RegCloseKey(ClassesRootSubKey); + + /* See what this deletes */ + RegDeleteKeyW(HKEY_CLASSES_ROOT, L"Apitest_HKLM"); + ok_key_deleted(UserKey); + RegCloseKey(UserKey); + ok_key_not_deleted(ClassesRootKey); + ok_key_not_deleted(MachineKey); + + /* Once again */ + RegDeleteKeyW(HKEY_CLASSES_ROOT, L"Apitest_HKLM"); + ok_key_deleted(ClassesRootKey); + ok_key_deleted(MachineKey); + RegCloseKey(ClassesRootKey); + RegCloseKey(MachineKey); + + /* Same, but with HKCU first */ + ErrorCode = RegCreateKeyExW( + HKEY_CURRENT_USER, + L"Software\\Classes\\Apitest_HKCU", + 0, + NULL, + 0, + MAXIMUM_ALLOWED, + NULL, + &UserKey, + NULL); + ok_dec(ErrorCode, ERROR_SUCCESS); + ok(!IS_HKCR(UserKey), "\n"); + + /* Open it in HKCR */ + ErrorCode = RegOpenKeyExW( + HKEY_CLASSES_ROOT, + L"Apitest_HKCU", + 0, + MAXIMUM_ALLOWED, + &ClassesRootKey); + ok_dec(ErrorCode, ERROR_SUCCESS); + ok(IS_HKCR(ClassesRootKey), "\n"); + ok_key_name(ClassesRootKey, &HKCU_ClassesPath, L"Apitest_HKCU"); + + /* Create a corresponding subkey in HKLM */ + ErrorCode = RegCreateKeyExW( + HKEY_LOCAL_MACHINE, + L"Software\\Classes\\Apitest_HKCU\\HKLM_Subkey", + 0, + NULL, + 0, + MAXIMUM_ALLOWED, + NULL, + &MachineSubKey, + NULL); + ok_dec(ErrorCode, ERROR_SUCCESS); + ok(!IS_HKCR(MachineSubKey), "\n"); + + /* Open it as an HKCR subkey */ + ErrorCode = RegOpenKeyExW( + ClassesRootKey, + L"HKLM_Subkey", + 0, + MAXIMUM_ALLOWED, + &ClassesRootSubKey); + ok_dec(ErrorCode, ERROR_SUCCESS); + ok(IS_HKCR(ClassesRootSubKey), "\n"); + ok_key_name(ClassesRootSubKey, &HKLM_ClassesPath, L"Apitest_HKCU\\HKLM_Subkey"); + + /* This one now exists */ + ErrorCode = RegOpenKeyExW( + HKEY_LOCAL_MACHINE, + L"Software\\Classes\\Apitest_HKCU", + 0, + MAXIMUM_ALLOWED, + &MachineKey); + ok_dec(ErrorCode, ERROR_SUCCESS); + ok(!IS_HKCR(MachineKey), "\n"); + + /* Delete */ + ErrorCode = RegDeleteKeyW(MachineKey, L"HKLM_Subkey"); + ok_dec(ErrorCode, ERROR_SUCCESS); + ok_key_deleted(MachineSubKey); + ok_key_deleted(ClassesRootSubKey); + RegCloseKey(MachineSubKey); + RegCloseKey(ClassesRootSubKey); + + /* See what this deletes */ + RegDeleteKeyW(HKEY_CLASSES_ROOT, L"Apitest_HKCU"); + ok_key_deleted(UserKey); + RegCloseKey(UserKey); + ok_key_deleted(ClassesRootKey); + RegCloseKey(UserKey); + ok_key_not_deleted(MachineKey); + + /* Once again */ + RegDeleteKeyW(HKEY_CLASSES_ROOT, L"Apitest_HKCU"); + ok_key_deleted(MachineKey); + RegCloseKey(MachineKey); } static
10 years, 2 months
1
0
0
0
[ekohl] 64411: [KBHID] Fix indentation. No code changes!
by ekohl@svn.reactos.org
Author: ekohl Date: Tue Sep 30 18:09:31 2014 New Revision: 64411 URL:
http://svn.reactos.org/svn/reactos?rev=64411&view=rev
Log: [KBHID] Fix indentation. No code changes! Modified: trunk/reactos/drivers/hid/kbdhid/kbdhid.c Modified: trunk/reactos/drivers/hid/kbdhid/kbdhid.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/hid/kbdhid/kbdhid.…
============================================================================== --- trunk/reactos/drivers/hid/kbdhid/kbdhid.c [iso-8859-1] (original) +++ trunk/reactos/drivers/hid/kbdhid/kbdhid.c [iso-8859-1] Tue Sep 30 18:09:31 2014 @@ -368,60 +368,60 @@ switch (IoStack->Parameters.DeviceIoControl.IoControlCode) { case IOCTL_KEYBOARD_QUERY_ATTRIBUTES: - /* verify output buffer length */ - if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(MOUSE_ATTRIBUTES)) - { - /* invalid request */ - DPRINT1("[MOUHID] IOCTL_MOUSE_QUERY_ATTRIBUTES Buffer too small\n"); - Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return STATUS_BUFFER_TOO_SMALL; - } - - /* get output buffer */ - Attributes = Irp->AssociatedIrp.SystemBuffer; - - /* copy attributes */ + /* verify output buffer length */ + if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(MOUSE_ATTRIBUTES)) + { + /* invalid request */ + DPRINT1("[MOUHID] IOCTL_MOUSE_QUERY_ATTRIBUTES Buffer too small\n"); + Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_BUFFER_TOO_SMALL; + } + + /* get output buffer */ + Attributes = Irp->AssociatedIrp.SystemBuffer; + + /* copy attributes */ RtlCopyMemory(Attributes, &DeviceExtension->Attributes, sizeof(KEYBOARD_ATTRIBUTES)); - /* complete request */ - Irp->IoStatus.Information = sizeof(MOUSE_ATTRIBUTES); - Irp->IoStatus.Status = STATUS_SUCCESS; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return STATUS_SUCCESS; + /* complete request */ + Irp->IoStatus.Information = sizeof(MOUSE_ATTRIBUTES); + Irp->IoStatus.Status = STATUS_SUCCESS; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_SUCCESS; case IOCTL_INTERNAL_KEYBOARD_CONNECT: - /* verify input buffer length */ - if (IoStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(CONNECT_DATA)) - { - /* invalid request */ - Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return STATUS_INVALID_PARAMETER; - } - - /* is it already connected */ - if (DeviceExtension->ClassService) - { - /* already connected */ - Irp->IoStatus.Status = STATUS_SHARING_VIOLATION; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return STATUS_SHARING_VIOLATION; - } - - /* get connect data */ - Data = IoStack->Parameters.DeviceIoControl.Type3InputBuffer; - - /* store connect details */ - DeviceExtension->ClassDeviceObject = Data->ClassDeviceObject; - DeviceExtension->ClassService = Data->ClassService; - - /* completed successfully */ - Irp->IoStatus.Status = STATUS_SUCCESS; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return STATUS_SUCCESS; + /* verify input buffer length */ + if (IoStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(CONNECT_DATA)) + { + /* invalid request */ + Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_INVALID_PARAMETER; + } + + /* is it already connected */ + if (DeviceExtension->ClassService) + { + /* already connected */ + Irp->IoStatus.Status = STATUS_SHARING_VIOLATION; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_SHARING_VIOLATION; + } + + /* get connect data */ + Data = IoStack->Parameters.DeviceIoControl.Type3InputBuffer; + + /* store connect details */ + DeviceExtension->ClassDeviceObject = Data->ClassDeviceObject; + DeviceExtension->ClassService = Data->ClassService; + + /* completed successfully */ + Irp->IoStatus.Status = STATUS_SUCCESS; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_SUCCESS; case IOCTL_INTERNAL_KEYBOARD_DISCONNECT: /* not implemented */ @@ -444,11 +444,11 @@ case IOCTL_KEYBOARD_QUERY_INDICATORS: if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(KEYBOARD_INDICATOR_PARAMETERS)) { - /* invalid parameter */ - Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return STATUS_INVALID_PARAMETER; - } + /* invalid parameter */ + Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_INVALID_PARAMETER; + } /* copy indicators */ RtlCopyMemory(Irp->AssociatedIrp.SystemBuffer, @@ -464,10 +464,10 @@ case IOCTL_KEYBOARD_QUERY_TYPEMATIC: if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(KEYBOARD_TYPEMATIC_PARAMETERS)) { - /* invalid parameter */ - Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return STATUS_INVALID_PARAMETER; + /* invalid parameter */ + Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_INVALID_PARAMETER; } /* copy indicators */ @@ -477,17 +477,17 @@ /* done */ Irp->IoStatus.Status = STATUS_SUCCESS; - Irp->IoStatus.Information = sizeof(KEYBOARD_TYPEMATIC_PARAMETERS); - IoCompleteRequest(Irp, IO_NO_INCREMENT); + Irp->IoStatus.Information = sizeof(KEYBOARD_TYPEMATIC_PARAMETERS); + IoCompleteRequest(Irp, IO_NO_INCREMENT); return STATUS_SUCCESS; case IOCTL_KEYBOARD_SET_INDICATORS: if (IoStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(KEYBOARD_INDICATOR_PARAMETERS)) { - /* invalid parameter */ - Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return STATUS_INVALID_PARAMETER; + /* invalid parameter */ + Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_INVALID_PARAMETER; } /* copy indicators */ @@ -504,10 +504,10 @@ case IOCTL_KEYBOARD_SET_TYPEMATIC: if (IoStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(KEYBOARD_TYPEMATIC_PARAMETERS)) { - /* invalid parameter */ - Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return STATUS_INVALID_PARAMETER; + /* invalid parameter */ + Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_INVALID_PARAMETER; } /* copy indicators */ @@ -523,10 +523,10 @@ case IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION: /* not implemented */ - DPRINT1("IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION not implemented\n"); - Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return STATUS_NOT_IMPLEMENTED; + DPRINT1("IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION not implemented\n"); + Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_NOT_IMPLEMENTED; } /* unknown control code */
10 years, 2 months
1
0
0
0
← Newer
1
2
3
4
5
...
42
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
Results per page:
10
25
50
100
200