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
June 2012
----- 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
11 participants
120 discussions
Start a n
N
ew thread
[ekohl] 56815: [SAMSRV] SamrSetInformationUser: Implement most information classes.
by ekohl@svn.reactos.org
Author: ekohl Date: Sat Jun 30 21:10:39 2012 New Revision: 56815 URL:
http://svn.reactos.org/svn/reactos?rev=56815&view=rev
Log: [SAMSRV] SamrSetInformationUser: Implement most information classes. Modified: trunk/reactos/dll/win32/samsrv/samrpc.c Modified: trunk/reactos/dll/win32/samsrv/samrpc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/samrpc.c?…
============================================================================== --- trunk/reactos/dll/win32/samsrv/samrpc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samsrv/samrpc.c [iso-8859-1] Sat Jun 30 21:10:39 2012 @@ -2177,27 +2177,6 @@ return STATUS_NOT_IMPLEMENTED; } - -static -NTSTATUS -SampSetPasswordInformation(PSAM_DB_OBJECT UserObject, - PSAMPR_USER_SET_PASSWORD_INFORMATION PasswordInfo) -{ - NTSTATUS Status; - - TRACE("Password: %S\n", PasswordInfo->Password.Buffer); - TRACE("PasswordExpired: %d\n", PasswordInfo->PasswordExpired); - - Status = SampSetObjectAttribute(UserObject, - L"Password", - REG_SZ, - PasswordInfo->Password.Buffer, - PasswordInfo->Password.MaximumLength); - - return Status; -} - - /* Function 37 */ NTSTATUS NTAPI @@ -2206,15 +2185,40 @@ IN PSAMPR_USER_INFO_BUFFER Buffer) { PSAM_DB_OBJECT UserObject; + ACCESS_MASK DesiredAccess; NTSTATUS Status; TRACE("SamrSetInformationUser(%p %lu %p)\n", UserHandle, UserInformationClass, Buffer); + + switch (UserInformationClass) + { + case UserNameInformation: + case UserAccountNameInformation: + case UserFullNameInformation: + case UserPrimaryGroupInformation: + case UserHomeInformation: + case UserScriptInformation: + case UserProfileInformation: + case UserAdminCommentInformation: + case UserWorkStationsInformation: + case UserControlInformation: + case UserExpiresInformation: + DesiredAccess = USER_WRITE_ACCOUNT; + break; + + case UserSetPasswordInformation: + DesiredAccess = USER_FORCE_PASSWORD_CHANGE; + break; + + default: + return STATUS_INVALID_INFO_CLASS; + } /* Validate the domain handle */ Status = SampValidateDbObject(UserHandle, SamDbUserObject, - USER_FORCE_PASSWORD_CHANGE, + DesiredAccess, &UserObject); if (!NT_SUCCESS(Status)) { @@ -2224,14 +2228,135 @@ switch (UserInformationClass) { +// case UserGeneralInformation: +// case UserPreferencesInformation: +// case UserLogonHoursInformation: + + case UserNameInformation: + Status = SampSetObjectAttribute(UserObject, + L"Name", + REG_SZ, + Buffer->Name.UserName.Buffer, + Buffer->Name.UserName.MaximumLength); + if (!NT_SUCCESS(Status)) + break; + + Status = SampSetObjectAttribute(UserObject, + L"FullName", + REG_SZ, + Buffer->Name.FullName.Buffer, + Buffer->Name.FullName.MaximumLength); + break; + + case UserAccountNameInformation: + Status = SampSetObjectAttribute(UserObject, + L"Name", + REG_SZ, + Buffer->AccountName.UserName.Buffer, + Buffer->AccountName.UserName.MaximumLength); + break; + + case UserFullNameInformation: + Status = SampSetObjectAttribute(UserObject, + L"FullName", + REG_SZ, + Buffer->FullName.FullName.Buffer, + Buffer->FullName.FullName.MaximumLength); + break; + + case UserPrimaryGroupInformation: + Status = SampSetObjectAttribute(UserObject, + L"PrimaryGroupId", + REG_DWORD, + &Buffer->PrimaryGroup.PrimaryGroupId, + sizeof(ULONG)); + break; + + case UserHomeInformation: + Status = SampSetObjectAttribute(UserObject, + L"HomeDirectory", + REG_SZ, + Buffer->Home.HomeDirectory.Buffer, + Buffer->Home.HomeDirectory.MaximumLength); + if (!NT_SUCCESS(Status)) + break; + + Status = SampSetObjectAttribute(UserObject, + L"HomeDirectoryDrive", + REG_SZ, + Buffer->Home.HomeDirectoryDrive.Buffer, + Buffer->Home.HomeDirectoryDrive.MaximumLength); + break; + + case UserScriptInformation: + Status = SampSetObjectAttribute(UserObject, + L"ScriptPath", + REG_SZ, + Buffer->Script.ScriptPath.Buffer, + Buffer->Script.ScriptPath.MaximumLength); + break; + + case UserProfileInformation: + Status = SampSetObjectAttribute(UserObject, + L"ProfilePath", + REG_SZ, + Buffer->Profile.ProfilePath.Buffer, + Buffer->Profile.ProfilePath.MaximumLength); + break; + + case UserAdminCommentInformation: + Status = SampSetObjectAttribute(UserObject, + L"AdminComment", + REG_SZ, + Buffer->AdminComment.AdminComment.Buffer, + Buffer->AdminComment.AdminComment.MaximumLength); + break; + + case UserWorkStationsInformation: + Status = SampSetObjectAttribute(UserObject, + L"WorkStations", + REG_SZ, + Buffer->WorkStations.WorkStations.Buffer, + Buffer->WorkStations.WorkStations.MaximumLength); + break; + case UserSetPasswordInformation: - Status = SampSetPasswordInformation(UserObject, - (PSAMPR_USER_SET_PASSWORD_INFORMATION)Buffer); - break; + TRACE("Password: %S\n", Buffer->SetPassword.Password.Buffer); + TRACE("PasswordExpired: %d\n", Buffer->SetPassword.PasswordExpired); + + Status = SampSetObjectAttribute(UserObject, + L"Password", + REG_SZ, + Buffer->SetPassword.Password.Buffer, + Buffer->SetPassword.Password.MaximumLength); + break; + + case UserControlInformation: + Status = SampSetObjectAttribute(UserObject, + L"UserAccountControl", + REG_DWORD, + &Buffer->Control.UserAccountControl, + sizeof(ULONG)); + break; + + case UserExpiresInformation: + Status = SampSetObjectAttribute(UserObject, + L"AccountExpires", + REG_BINARY, + &Buffer->Expires.AccountExpires, + sizeof(OLD_LARGE_INTEGER)); + break; + +// case UserInternal1Information: +// case UserParametersInformation: +// case UserAllInformation: +// case UserInternal4Information: +// case UserInternal5Information: +// case UserInternal4InformationNew: +// case UserInternal5InformationNew: default: Status = STATUS_INVALID_INFO_CLASS; - break; } return Status;
12 years, 5 months
1
0
0
0
[ekohl] 56814: [DDK] - Add generic rights for aliases, domains, SAM server and users. - Add generic and specific rights for groups.
by ekohl@svn.reactos.org
Author: ekohl Date: Sat Jun 30 14:16:38 2012 New Revision: 56814 URL:
http://svn.reactos.org/svn/reactos?rev=56814&view=rev
Log: [DDK] - Add generic rights for aliases, domains, SAM server and users. - Add generic and specific rights for groups. Modified: trunk/reactos/include/ddk/ntsam.h Modified: trunk/reactos/include/ddk/ntsam.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/ntsam.h?rev=56…
============================================================================== --- trunk/reactos/include/ddk/ntsam.h [iso-8859-1] (original) +++ trunk/reactos/include/ddk/ntsam.h [iso-8859-1] Sat Jun 30 14:16:38 2012 @@ -6,42 +6,162 @@ extern "C" { #endif -#define ALIAS_ADD_MEMBER 1 -#define ALIAS_REMOVE_MEMBER 2 -#define ALIAS_LIST_MEMBERS 4 -#define ALIAS_READ_INFORMATION 8 -#define ALIAS_WRITE_ACCOUNT 16 - -#define DOMAIN_READ_PASSWORD_PARAMETERS 1 -#define DOMAIN_WRITE_PASSWORD_PARAMS 2 -#define DOMAIN_READ_OTHER_PARAMETERS 4 -#define DOMAIN_WRITE_OTHER_PARAMETERS 8 -#define DOMAIN_CREATE_USER 16 -#define DOMAIN_CREATE_GROUP 32 -#define DOMAIN_CREATE_ALIAS 64 -#define DOMAIN_GET_ALIAS_MEMBERSHIP 128 -#define DOMAIN_LIST_ACCOUNTS 256 -#define DOMAIN_LOOKUP 512 -#define DOMAIN_ADMINISTER_SERVER 1024 - -#define SAM_SERVER_CONNECT 1 -#define SAM_SERVER_SHUTDOWN 2 -#define SAM_SERVER_INITIALIZE 4 -#define SAM_SERVER_CREATE_DOMAIN 8 -#define SAM_SERVER_ENUMERATE_DOMAINS 16 -#define SAM_SERVER_LOOKUP_DOMAIN 32 - -#define USER_READ_GENERAL 1 -#define USER_READ_PREFERENCES 2 -#define USER_WRITE_PREFERENCES 4 -#define USER_READ_LOGON 8 -#define USER_READ_ACCOUNT 16 -#define USER_WRITE_ACCOUNT 32 -#define USER_CHANGE_PASSWORD 64 -#define USER_FORCE_PASSWORD_CHANGE 128 -#define USER_LIST_GROUPS 256 -#define USER_READ_GROUP_INFORMATION 512 -#define USER_WRITE_GROUP_INFORMATION 1024 +#define ALIAS_ADD_MEMBER 0x00000001 +#define ALIAS_REMOVE_MEMBER 0x00000002 +#define ALIAS_LIST_MEMBERS 0x00000004 +#define ALIAS_READ_INFORMATION 0x00000008 +#define ALIAS_WRITE_ACCOUNT 0x00000010 + +#define ALIAS_READ (STANDARD_RIGHTS_READ |\ + ALIAS_LIST_MEMBERS) + +#define ALIAS_WRITE (STANDARD_RIGHTS_WRITE |\ + ALIAS_ADD_MEMBER |\ + ALIAS_REMOVE_MEMBER |\ + ALIAS_WRITE_ACCOUNT) + +#define ALIAS_EXECUTE (STANDARD_RIGHTS_EXECUTE |\ + ALIAS_READ_INFORMATION) + +#define ALIAS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\ + ALIAS_ADD_MEMBER |\ + ALIAS_REMOVE_MEMBER |\ + ALIAS_LIST_MEMBERS |\ + ALIAS_READ_INFORMATION |\ + ALIAS_WRITE_ACCOUNT) + +#define DOMAIN_READ_PASSWORD_PARAMETERS 0x00000001 +#define DOMAIN_WRITE_PASSWORD_PARAMS 0x00000002 +#define DOMAIN_READ_OTHER_PARAMETERS 0x00000004 +#define DOMAIN_WRITE_OTHER_PARAMETERS 0x00000008 +#define DOMAIN_CREATE_USER 0x00000010 +#define DOMAIN_CREATE_GROUP 0x00000020 +#define DOMAIN_CREATE_ALIAS 0x00000040 +#define DOMAIN_GET_ALIAS_MEMBERSHIP 0x00000080 +#define DOMAIN_LIST_ACCOUNTS 0x00000100 +#define DOMAIN_LOOKUP 0x00000200 +#define DOMAIN_ADMINISTER_SERVER 0x00000400 + +#define DOMAIN_READ (STANDARD_RIGHTS_READ |\ + DOMAIN_READ_OTHER_PARAMETERS |\ + DOMAIN_GET_ALIAS_MEMBERSHIP) + +#define DOMAIN_WRITE (STANDARD_RIGHTS_WRITE |\ + DOMAIN_WRITE_PASSWORD_PARAMS |\ + DOMAIN_WRITE_OTHER_PARAMETERS |\ + DOMAIN_CREATE_USER |\ + DOMAIN_CREATE_GROUP |\ + DOMAIN_CREATE_ALIAS |\ + DOMAIN_ADMINISTER_SERVER) + +#define DOMAIN_EXECUTE (STANDARD_RIGHTS_EXECUTE |\ + DOMAIN_READ_PASSWORD_PARAMETERS |\ + DOMAIN_LIST_ACCOUNTS |\ + DOMAIN_LOOKUP) + +#define DOMAIN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\ + DOMAIN_READ_PASSWORD_PARAMETERS |\ + DOMAIN_WRITE_PASSWORD_PARAMS |\ + DOMAIN_READ_OTHER_PARAMETERS |\ + DOMAIN_WRITE_OTHER_PARAMETERS |\ + DOMAIN_CREATE_USER |\ + DOMAIN_CREATE_GROUP |\ + DOMAIN_CREATE_ALIAS |\ + DOMAIN_GET_ALIAS_MEMBERSHIP |\ + DOMAIN_LIST_ACCOUNTS |\ + DOMAIN_LOOKUP |\ + DOMAIN_ADMINISTER_SERVER) + +#define GROUP_READ_INFORMATION 0x00000001 +#define GROUP_WRITE_ACCOUNT 0x00000002 +#define GROUP_ADD_MEMBER 0x00000004 +#define GROUP_REMOVE_MEMBER 0x00000008 +#define GROUP_LIST_MEMBERS 0x00000010 + +#define GROUP_READ (STANDARD_RIGHTS_READ |\ + GROUP_LIST_MEMBERS) + +#define GROUP_WRITE (STANDARD_RIGHTS_WRITE |\ + GROUP_WRITE_ACCOUNT |\ + GROUP_ADD_MEMBER |\ + GROUP_REMOVE_MEMBER) + +#define GROUP_EXECUTE (STANDARD_RIGHTS_EXECUTE |\ + GROUP_READ_INFORMATION) + +#define GROUP_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\ + GROUP_READ_INFORMATION |\ + GROUP_WRITE_ACCOUNT |\ + GROUP_ADD_MEMBER |\ + GROUP_REMOVE_MEMBER |\ + GROUP_LIST_MEMBERS) + +#define SAM_SERVER_CONNECT 0x00000001 +#define SAM_SERVER_SHUTDOWN 0x00000002 +#define SAM_SERVER_INITIALIZE 0x00000004 +#define SAM_SERVER_CREATE_DOMAIN 0x00000008 +#define SAM_SERVER_ENUMERATE_DOMAINS 0x00000010 +#define SAM_SERVER_LOOKUP_DOMAIN 0x00000020 + +#define SAM_SERVER_READ (STANDARD_RIGHTS_READ |\ + SAM_SERVER_ENUMERATE_DOMAINS) + +#define SAM_SERVER_WRITE (STANDARD_RIGHTS_WRITE |\ + SAM_SERVER_SHUTDOWN |\ + SAM_SERVER_INITIALIZE |\ + SAM_SERVER_CREATE_DOMAIN) + +#define SAM_SERVER_EXECUTE (STANDARD_RIGHTS_EXECUTE |\ + SAM_SERVER_CONNECT |\ + SAM_SERVER_LOOKUP_DOMAIN) + +#define SAM_SERVER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\ + SAM_SERVER_CONNECT |\ + SAM_SERVER_SHUTDOWN |\ + SAM_SERVER_INITIALIZE |\ + SAM_SERVER_CREATE_DOMAIN |\ + SAM_SERVER_ENUMERATE_DOMAINS |\ + SAM_SERVER_LOOKUP_DOMAIN) + +#define USER_READ_GENERAL 0x00000001 +#define USER_READ_PREFERENCES 0x00000002 +#define USER_WRITE_PREFERENCES 0x00000004 +#define USER_READ_LOGON 0x00000008 +#define USER_READ_ACCOUNT 0x00000010 +#define USER_WRITE_ACCOUNT 0x00000020 +#define USER_CHANGE_PASSWORD 0x00000040 +#define USER_FORCE_PASSWORD_CHANGE 0x00000080 +#define USER_LIST_GROUPS 0x00000100 +#define USER_READ_GROUP_INFORMATION 0x00000200 +#define USER_WRITE_GROUP_INFORMATION 0x00000400 + +#define USER_READ (STANDARD_RIGHTS_READ |\ + USER_READ_PREFERENCES |\ + USER_READ_LOGON |\ + USER_READ_ACCOUNT |\ + USER_LIST_GROUPS |\ + USER_READ_GROUP_INFORMATION) + +#define USER_WRITE (STANDARD_RIGHTS_WRITE |\ + USER_WRITE_PREFERENCES |\ + USER_CHANGE_PASSWORD) + +#define USER_EXECUTE (STANDARD_RIGHTS_EXECUTE |\ + USER_READ_GENERAL |\ + USER_CHANGE_PASSWORD) + +#define USER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\ + USER_READ_GENERAL |\ + USER_READ_PREFERENCES |\ + USER_WRITE_PREFERENCES |\ + USER_READ_LOGON |\ + USER_READ_ACCOUNT |\ + USER_WRITE_ACCOUNT |\ + USER_CHANGE_PASSWORD |\ + USER_FORCE_PASSWORD_CHANGE |\ + USER_LIST_GROUPS |\ + USER_READ_GROUP_INFORMATION |\ + USER_WRITE_GROUP_INFORMATION) typedef PVOID SAM_HANDLE, *PSAM_HANDLE; typedef ULONG SAM_ENUMERATE_HANDLE, *PSAM_ENUMERATE_HANDLE;
12 years, 5 months
1
0
0
0
[tkreuzer] 56813: [CRT] Add startup code to CRT
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sat Jun 30 14:04:19 2012 New Revision: 56813 URL:
http://svn.reactos.org/svn/reactos?rev=56813&view=rev
Log: [CRT] Add startup code to CRT Modified: trunk/reactos/lib/sdk/crt/crt.cmake Modified: trunk/reactos/lib/sdk/crt/crt.cmake URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/crt.cmake?rev=…
============================================================================== --- trunk/reactos/lib/sdk/crt/crt.cmake [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/crt.cmake [iso-8859-1] Sat Jun 30 14:04:19 2012 @@ -175,6 +175,32 @@ search/lsearch.c signal/signal.c signal/xcptinfo.c + startup/crtexe.c + startup/wcrtexe.c + startup/crt_handler.c + startup/crtdll.c + startup/_newmode.c + startup/wildcard.c + startup/tlssup.c + startup/mingw_helpers.c + startup/natstart.c + startup/charmax.c + startup/merr.c + startup/atonexit.c + startup/txtmode.c + startup/pesect.c + startup/tlsmcrt.c + startup/tlsthrd.c + startup/tlsmthread.c + startup/cinitexe.c + startup/gs_support.c + startup/dll_argv.c + startup/dllargv.c + startup/wdllargv.c + startup/crt0_c.c + startup/crt0_w.c + startup/dllentry.c + startup/reactos.c stdio/_flsbuf.c stdio/_flswbuf.c stdio/access.c
12 years, 5 months
1
0
0
0
[spetreolle] 56812: [ROSAPPS] Add notevil, ctm, kill and tlist to build. Patch by Hermes Belusca. Bug 7150.
by spetreolle@svn.reactos.org
Author: spetreolle Date: Sat Jun 30 11:33:33 2012 New Revision: 56812 URL:
http://svn.reactos.org/svn/reactos?rev=56812&view=rev
Log: [ROSAPPS] Add notevil, ctm, kill and tlist to build. Patch by Hermes Belusca. Bug 7150. Added: trunk/rosapps/applications/notevil/CMakeLists.txt (with props) trunk/rosapps/applications/sysutils/CMakeLists.txt (with props) trunk/rosapps/applications/sysutils/ctm/CMakeLists.txt (with props) trunk/rosapps/applications/sysutils/kill/CMakeLists.txt (with props) trunk/rosapps/applications/sysutils/tlist/CMakeLists.txt (with props) Modified: trunk/rosapps/applications/CMakeLists.txt Modified: trunk/rosapps/applications/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/CMakeLists.tx…
============================================================================== --- trunk/rosapps/applications/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rosapps/applications/CMakeLists.txt [iso-8859-1] Sat Jun 30 11:33:33 2012 @@ -2,7 +2,7 @@ #add_subdirectory(devutils) #add_subdirectory(fraginator) #add_subdirectory(net) -#add_subdirectory(notevil) +add_subdirectory(notevil) add_subdirectory(screensavers) -#add_subdirectory(sysutils) -#add_subdirectory(winfile) +add_subdirectory(sysutils) +#add_subdirectory(winfile) Added: trunk/rosapps/applications/notevil/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/notevil/CMake…
============================================================================== --- trunk/rosapps/applications/notevil/CMakeLists.txt (added) +++ trunk/rosapps/applications/notevil/CMakeLists.txt [iso-8859-1] Sat Jun 30 11:33:33 2012 @@ -1,0 +1,5 @@ + +add_executable(notevil notevil.c notevil.rc) +set_module_type(notevil win32cui) +add_importlibs(notevil user32 msvcrt kernel32) +add_cd_file(TARGET notevil DESTINATION reactos/system32 FOR all) Propchange: trunk/rosapps/applications/notevil/CMakeLists.txt ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rosapps/applications/sysutils/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/CMak…
============================================================================== --- trunk/rosapps/applications/sysutils/CMakeLists.txt (added) +++ trunk/rosapps/applications/sysutils/CMakeLists.txt [iso-8859-1] Sat Jun 30 11:33:33 2012 @@ -1,0 +1,17 @@ +#add_subdirectory(chkdsk) +#add_subdirectory(chklib) +add_subdirectory(ctm) +#add_subdirectory(gettype) +add_subdirectory(kill) +#add_subdirectory(logevent) +#add_subdirectory(lsdd) +#add_subdirectory(man) +#add_subdirectory(mkdosfs) +#add_subdirectory(pedump) +#add_subdirectory(regexpl) +#add_subdirectory(rosddt) +#add_subdirectory(screenshot) +#add_subdirectory(systeminfo) +#add_subdirectory(tcat) +add_subdirectory(tlist) +#add_subdirectory(utils) Propchange: trunk/rosapps/applications/sysutils/CMakeLists.txt ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rosapps/applications/sysutils/ctm/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/ctm/…
============================================================================== --- trunk/rosapps/applications/sysutils/ctm/CMakeLists.txt (added) +++ trunk/rosapps/applications/sysutils/ctm/CMakeLists.txt [iso-8859-1] Sat Jun 30 11:33:33 2012 @@ -1,0 +1,6 @@ + +add_executable(ctm ctm.c ctm.rc) +set_module_type(ctm win32cui UNICODE) +target_link_libraries(ctm epsapi) +add_importlibs(ctm ntdll user32 msvcrt kernel32) +add_cd_file(TARGET ctm DESTINATION reactos/system32 FOR all) Propchange: trunk/rosapps/applications/sysutils/ctm/CMakeLists.txt ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rosapps/applications/sysutils/kill/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/kill…
============================================================================== --- trunk/rosapps/applications/sysutils/kill/CMakeLists.txt (added) +++ trunk/rosapps/applications/sysutils/kill/CMakeLists.txt [iso-8859-1] Sat Jun 30 11:33:33 2012 @@ -1,0 +1,5 @@ + +add_executable(kill kill.c kill.rc) +set_module_type(kill win32cui) +add_importlibs(kill ntdll user32 msvcrt kernel32) +add_cd_file(TARGET kill DESTINATION reactos/system32 FOR all) Propchange: trunk/rosapps/applications/sysutils/kill/CMakeLists.txt ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/rosapps/applications/sysutils/tlist/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rosapps/applications/sysutils/tlis…
============================================================================== --- trunk/rosapps/applications/sysutils/tlist/CMakeLists.txt (added) +++ trunk/rosapps/applications/sysutils/tlist/CMakeLists.txt [iso-8859-1] Sat Jun 30 11:33:33 2012 @@ -1,0 +1,6 @@ + +add_executable(tlist tlist.c tlist.rc) +set_module_type(tlist win32cui) +target_link_libraries(tlist epsapi getopt) +add_importlibs(tlist ntdll user32 msvcrt kernel32) +add_cd_file(TARGET tlist DESTINATION reactos/system32 FOR all) Propchange: trunk/rosapps/applications/sysutils/tlist/CMakeLists.txt ------------------------------------------------------------------------------ svn:eol-style = native
12 years, 5 months
1
0
0
0
[tkreuzer] 56811: [PSDK/DDK] Add definitions for BitScanForward64
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sat Jun 30 11:19:28 2012 New Revision: 56811 URL:
http://svn.reactos.org/svn/reactos?rev=56811&view=rev
Log: [PSDK/DDK] Add definitions for BitScanForward64 Modified: trunk/reactos/include/ddk/wdm.h trunk/reactos/include/psdk/winnt.h trunk/reactos/include/xdk/interlocked.h Modified: trunk/reactos/include/ddk/wdm.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/wdm.h?rev=5681…
============================================================================== --- trunk/reactos/include/ddk/wdm.h [iso-8859-1] (original) +++ trunk/reactos/include/ddk/wdm.h [iso-8859-1] Sat Jun 30 11:19:28 2012 @@ -264,6 +264,8 @@ #define InterlockedBitTestAndReset _interlockedbittestandreset #ifdef _M_AMD64 +#define BitScanForward64 _BitScanForward64 +#define BitScanReverse64 _BitScanReverse64 #define BitTest64 _bittest64 #define BitTestAndComplement64 _bittestandcomplement64 #define BitTestAndSet64 _bittestandset64 @@ -9757,6 +9759,7 @@ #define KeGetDcacheFillSize() 1L #define YieldProcessor _mm_pause +#define MemoryBarrier __faststorefence #define FastFence __faststorefence #define LoadFence _mm_lfence #define MemoryFence _mm_mfence @@ -10206,8 +10209,8 @@ } #endif +NTKERNELAPI DECLSPEC_NORETURN -NTKERNELAPI VOID NTAPI KeBugCheckEx( Modified: trunk/reactos/include/psdk/winnt.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winnt.h?rev=5…
============================================================================== --- trunk/reactos/include/psdk/winnt.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/winnt.h [iso-8859-1] Sat Jun 30 11:19:28 2012 @@ -5312,6 +5312,10 @@ #define BitScanForward _BitScanForward #define BitScanReverse _BitScanReverse +#ifdef _M_AMD64 +#define BitScanForward64 _BitScanForward64 +#define BitScanReverse64 _BitScanReverse64 +#endif /* TODO: Other architectures than X86 */ #if defined(_M_IX86) Modified: trunk/reactos/include/xdk/interlocked.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/xdk/interlocked.h?…
============================================================================== --- trunk/reactos/include/xdk/interlocked.h [iso-8859-1] (original) +++ trunk/reactos/include/xdk/interlocked.h [iso-8859-1] Sat Jun 30 11:19:28 2012 @@ -57,6 +57,8 @@ #define InterlockedBitTestAndReset _interlockedbittestandreset #ifdef _M_AMD64 +#define BitScanForward64 _BitScanForward64 +#define BitScanReverse64 _BitScanReverse64 #define BitTest64 _bittest64 #define BitTestAndComplement64 _bittestandcomplement64 #define BitTestAndSet64 _bittestandset64
12 years, 5 months
1
0
0
0
[tfaber] 56810: [ADVAPI32_APITEST] - Use a define for the service name in QueryServiceConfig2 test. Patch by Hermes Belusca. Bug 7145. - Add LockDatabase test for Lock/UnlockServiceDatabase, QueryS...
by tfaber@svn.reactos.org
Author: tfaber Date: Fri Jun 29 11:48:35 2012 New Revision: 56810 URL:
http://svn.reactos.org/svn/reactos?rev=56810&view=rev
Log: [ADVAPI32_APITEST] - Use a define for the service name in QueryServiceConfig2 test. Patch by Hermes Belusca. Bug 7145. - Add LockDatabase test for Lock/UnlockServiceDatabase, QueryServiceLockStatus. Patch by Hermes Belusca. Bug 7146. Added: trunk/rostests/apitests/advapi32/LockDatabase.c (with props) Modified: trunk/rostests/apitests/advapi32/CMakeLists.txt trunk/rostests/apitests/advapi32/QueryServiceConfig2.c trunk/rostests/apitests/advapi32/testlist.c Modified: trunk/rostests/apitests/advapi32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/CMakeLi…
============================================================================== --- trunk/rostests/apitests/advapi32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/apitests/advapi32/CMakeLists.txt [iso-8859-1] Fri Jun 29 11:48:35 2012 @@ -1,6 +1,7 @@ list(APPEND SOURCE CreateService.c + LockDatabase.c QueryServiceConfig2.c testlist.c) Added: trunk/rostests/apitests/advapi32/LockDatabase.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/LockDat…
============================================================================== --- trunk/rostests/apitests/advapi32/LockDatabase.c (added) +++ trunk/rostests/apitests/advapi32/LockDatabase.c [iso-8859-1] Fri Jun 29 11:48:35 2012 @@ -1,0 +1,760 @@ +/* + * PROJECT: ReactOS api tests + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: Tests for Lock/UnlockServiceDatabase and QueryServiceLockStatusA/W + * PROGRAMMER: Hermès BÃLUSCA - MAÃTO + */ + +#include <wine/test.h> +#include <windows.h> +#include <strsafe.h> + +#define TESTING_SERVICE L"Spooler" + +static void Test_LockUnlockServiceDatabase(void) +{ + BOOL bError = FALSE; + + SC_HANDLE hScm = NULL; + SC_LOCK hLock = NULL; + + /* First of all, try to lock / unlock the services database with invalid handles */ + SetLastError(0xdeadbeef); + hScm = NULL; + hLock = LockServiceDatabase(hScm); + ok(hLock == NULL, "hLock = 0x%p, expected 0\n", hLock); + ok_err(ERROR_INVALID_HANDLE); + + SetLastError(0xdeadbeef); + hScm = (SC_HANDLE)0xdeadbeef; + hLock = LockServiceDatabase(hScm); + ok(hLock == NULL, "hLock = 0x%p, expected 0\n", hLock); + ok_err(ERROR_INVALID_HANDLE); + +/** This test seems to make this application crash on Windows 7... I do not know why... **/ + SetLastError(0xdeadbeef); + hLock = NULL; + bError = UnlockServiceDatabase(hLock); + ok(bError == FALSE, "bError = %u, expected FALSE\n", bError); + ok_err(ERROR_INVALID_SERVICE_LOCK); +/*****************************************************************************************/ + + SetLastError(0xdeadbeef); + hLock = (SC_LOCK)0xdeadbeef; + bError = UnlockServiceDatabase(hLock); + ok(bError == FALSE, "bError = %u, expected FALSE\n", bError); + ok_err(ERROR_INVALID_SERVICE_LOCK); + + + /* Then, try to lock the services database without having rights */ + SetLastError(0xdeadbeef); + hScm = OpenSCManagerW(NULL, NULL, SC_MANAGER_CONNECT); + ok(hScm != NULL, "Failed to open service manager, error=0x%08lx\n", GetLastError()); + if (!hScm) + { + skip("No service control manager; cannot proceed with LockUnlockServiceDatabase test\n"); + goto cleanup; + } + ok_err(ERROR_SUCCESS); + + SetLastError(0xdeadbeef); + hLock = LockServiceDatabase(hScm); + ok(hLock == NULL, "hLock = 0x%p, expected 0\n", hLock); + ok_err(ERROR_ACCESS_DENIED); + + if (hLock) + UnlockServiceDatabase(hLock); + CloseServiceHandle(hScm); + + /* Try to lock the services database with good rights */ + SetLastError(0xdeadbeef); + hScm = OpenSCManagerW(NULL, NULL, SC_MANAGER_LOCK); + ok(hScm != NULL, "Failed to open service manager, error=0x%08lx\n", GetLastError()); + if (!hScm) + { + skip("No service control manager; cannot proceed with LockUnlockServiceDatabase test\n"); + goto cleanup; + } + ok_err(ERROR_SUCCESS); + + SetLastError(0xdeadbeef); + hLock = LockServiceDatabase(hScm); + ok(hLock != NULL, "hLock = 0x%p, expected non-zero\n", hLock); + ok_err(ERROR_SUCCESS); + + /* Now unlock it */ + if (hLock) + { + SetLastError(0xdeadbeef); + bError = UnlockServiceDatabase(hLock); + ok(bError == TRUE, "bError = %u, expected TRUE\n", bError); + ok_err(ERROR_SUCCESS); + } + + +cleanup: + if (hScm) + CloseServiceHandle(hScm); + + return; +} + +static void Test_LockUnlockServiceDatabaseWithServiceStart(void) +{ + BOOL bError = FALSE; + + SC_HANDLE hScm = NULL; + SC_HANDLE hSvc = NULL; + SC_LOCK hLock = NULL; + + LPQUERY_SERVICE_CONFIGW lpConfig = NULL; + DWORD dwRequiredSize = 0; + SERVICE_STATUS status; + BOOL bWasRunning = FALSE; + DWORD dwOldStartType = 0; + + /* Open the services database */ + SetLastError(0xdeadbeef); + hScm = OpenSCManagerW(NULL, NULL, SC_MANAGER_LOCK); + ok(hScm != NULL, "Failed to open service manager, error=0x%08lx\n", GetLastError()); + if (!hScm) + { + skip("No service control manager; cannot proceed with LockUnlockServiceDatabaseWithServiceStart test\n"); + goto cleanup; + } + ok_err(ERROR_SUCCESS); + + /* Grab a handle to the testing service */ + SetLastError(0xdeadbeef); + hSvc = OpenServiceW(hScm, TESTING_SERVICE, SERVICE_START | SERVICE_STOP | SERVICE_CHANGE_CONFIG | SERVICE_QUERY_CONFIG | SERVICE_QUERY_STATUS); + ok(hSvc != NULL, "hSvc = 0x%p, expected non-null, error=0x%08lx\n", hSvc, GetLastError()); + if (!hSvc) + { + skip("Cannot open a handle to service %S; cannot proceed with LockUnlockServiceDatabaseWithServiceStart test\n", TESTING_SERVICE); + goto cleanup; + } + ok_err(ERROR_SUCCESS); + + /* Lock the services database */ + SetLastError(0xdeadbeef); + hLock = LockServiceDatabase(hScm); + ok(hLock != NULL, "hLock = 0x%p, expected non-zero, error=0x%08lx\n", hLock, GetLastError()); + if (!hLock) + { + skip("Cannot lock the services database; cannot proceed with LockUnlockServiceDatabaseWithServiceStart test\n"); + goto cleanup; + } + ok_err(ERROR_SUCCESS); + + /* To proceed further, firstly attempt to stop the testing service */ + QueryServiceConfigW(hSvc, NULL, 0, &dwRequiredSize); + lpConfig = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwRequiredSize); + QueryServiceConfigW(hSvc, lpConfig, dwRequiredSize, &dwRequiredSize); + dwOldStartType = lpConfig->dwStartType; + HeapFree(GetProcessHeap(), 0, lpConfig); + if (dwOldStartType == SERVICE_DISABLED) + { + ChangeServiceConfigW(hSvc, + SERVICE_NO_CHANGE, + SERVICE_DEMAND_START, + SERVICE_NO_CHANGE, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL); + } + QueryServiceStatus(hSvc, &status); + bWasRunning = (status.dwCurrentState != SERVICE_STOPPED); + if (bWasRunning) + { + ControlService(hSvc, SERVICE_CONTROL_STOP, &status); + Sleep(1000); /* Wait 1 second for the service to stop */ + } + + /* Now try to start it (this test won't work under Windows Vista / 7 / 8) */ + SetLastError(0xdeadbeef); + bError = StartServiceW(hSvc, 0, NULL); + ok(bError == FALSE, "bError = %u, expected FALSE\n", bError); + ok_err(ERROR_SERVICE_DATABASE_LOCKED); + Sleep(1000); /* Wait 1 second for the service to start */ + + /* Stop the testing service */ + ControlService(hSvc, SERVICE_CONTROL_STOP, &status); + Sleep(1000); /* Wait 1 second for the service to stop */ + + /* Now unlock the services database */ + SetLastError(0xdeadbeef); + bError = UnlockServiceDatabase(hLock); + ok(bError == TRUE, "bError = %u, expected TRUE\n", bError); + ok_err(ERROR_SUCCESS); + + /* Try to start again the service, this time the database unlocked */ + SetLastError(0xdeadbeef); + bError = StartServiceW(hSvc, 0, NULL); + ok(bError == TRUE, "bError = %u, expected TRUE\n", bError); + ok_err(ERROR_SUCCESS); + Sleep(1000); /* Wait 1 second for the service to start */ + + /* Stop the testing service */ + ControlService(hSvc, SERVICE_CONTROL_STOP, &status); + Sleep(1000); /* Wait 1 second for the service to stop */ + + /* Restore its original state */ + if (bWasRunning) + { + StartServiceW(hSvc, 0, NULL); + } + + if (dwOldStartType == SERVICE_DISABLED) + { + ChangeServiceConfigW(hSvc, + SERVICE_NO_CHANGE, + SERVICE_DISABLED, + SERVICE_NO_CHANGE, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL); + } + + +cleanup: + if (hSvc) + CloseServiceHandle(hSvc); + + if (hScm) + CloseServiceHandle(hScm); + + return; +} + +static void Test_QueryLockStatusW(void) +{ + BOOL bError = FALSE; + + SC_HANDLE hScm = NULL; + SC_LOCK hLock = NULL; + LPQUERY_SERVICE_LOCK_STATUSW lpLockStatus = NULL; + DWORD dwRequiredSize = 0; + + /* Firstly try to get lock status with invalid handles */ + SetLastError(0xdeadbeef); + bError = QueryServiceLockStatusW(hScm, + NULL, + 0, + &dwRequiredSize); + ok(bError == FALSE && GetLastError() == ERROR_INVALID_HANDLE, "(bError, GetLastError()) = (%u, 0x%08lx), expected (FALSE, 0x%08lx)\n", bError, GetLastError(), (DWORD)ERROR_INVALID_HANDLE); + ok(dwRequiredSize == 0, "dwRequiredSize is non-zero, expected zero\n"); + + /* Open the services database without having rights */ + SetLastError(0xdeadbeef); + hScm = OpenSCManagerW(NULL, NULL, SC_MANAGER_CONNECT); + ok(hScm != NULL, "Failed to open service manager, error=0x%08lx\n", GetLastError()); + if (!hScm) + { + skip("No service control manager; cannot proceed with QueryLockStatusW test\n"); + goto cleanup; + } + ok_err(ERROR_SUCCESS); + + /* Try to get lock status */ + SetLastError(0xdeadbeef); + bError = QueryServiceLockStatusW(hScm, + NULL, + 0, + &dwRequiredSize); + ok(bError == FALSE && GetLastError() == ERROR_ACCESS_DENIED, "(bError, GetLastError()) = (%u, 0x%08lx), expected (FALSE, 0x%08lx)\n", bError, GetLastError(), (DWORD)ERROR_ACCESS_DENIED); + ok(dwRequiredSize == 0, "dwRequiredSize is non-zero, expected zero\n"); + + CloseServiceHandle(hScm); + + + /* + * Query only the lock status. + */ + + SetLastError(0xdeadbeef); + hScm = OpenSCManagerW(NULL, NULL, SC_MANAGER_QUERY_LOCK_STATUS); + ok(hScm != NULL, "Failed to open service manager, error=0x%08lx\n", GetLastError()); + if (!hScm) + { + skip("No service control manager; cannot proceed with QueryLockStatusW test\n"); + goto cleanup; + } + ok_err(ERROR_SUCCESS); + + /* Get the needed size */ + SetLastError(0xdeadbeef); + bError = QueryServiceLockStatusW(hScm, + NULL, + 0, + &dwRequiredSize); + ok(bError == FALSE && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "(bError, GetLastError()) = (%u, 0x%08lx), expected (FALSE, 0x%08lx)\n", bError, GetLastError(), (DWORD)ERROR_INSUFFICIENT_BUFFER); + ok(dwRequiredSize != 0, "dwRequiredSize is zero, expected non-zero\n"); + if (dwRequiredSize == 0) + { + skip("Required size is null; cannot proceed with QueryLockStatusW test\n"); + goto cleanup; + } + + /* Allocate memory */ + lpLockStatus = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwRequiredSize); + if (lpLockStatus == NULL) + { + skip("Cannot allocate %lu bytes of memory\n", dwRequiredSize); + goto cleanup; + } + + /* Get the actual value */ + SetLastError(0xdeadbeef); + bError = QueryServiceLockStatusW(hScm, + lpLockStatus, + dwRequiredSize, + &dwRequiredSize); + ok(bError, "bError = %u, expected TRUE\n", bError); + + /* These conditions must be verified iff the services database wasn't previously locked */ + ok(lpLockStatus->fIsLocked == 0, "lpLockStatus->fIsLocked = %lu, expected 0\n", lpLockStatus->fIsLocked); + ok(lpLockStatus->lpLockOwner != NULL, "lpLockStatus->lpLockOwner is null, expected non-null\n"); + ok(lpLockStatus->lpLockOwner && *lpLockStatus->lpLockOwner == 0, "*lpLockStatus->lpLockOwner != \"\\0\", expected \"\\0\"\n"); + ok(lpLockStatus->dwLockDuration == 0, "lpLockStatus->dwLockDuration = %lu, expected 0\n", lpLockStatus->dwLockDuration); + + HeapFree(GetProcessHeap(), 0, lpLockStatus); + + CloseServiceHandle(hScm); + + + /* + * Now, try to lock the database and check its lock status. + */ + + SetLastError(0xdeadbeef); + hScm = OpenSCManagerW(NULL, NULL, SC_MANAGER_LOCK | SC_MANAGER_QUERY_LOCK_STATUS); + ok(hScm != NULL, "Failed to open service manager, error=0x%08lx\n", GetLastError()); + if (!hScm) + { + skip("No service control manager; cannot proceed with QueryLockStatusW test\n"); + goto cleanup; + } + ok_err(ERROR_SUCCESS); + + /* Get the needed size */ + SetLastError(0xdeadbeef); + bError = QueryServiceLockStatusW(hScm, + NULL, + 0, + &dwRequiredSize); + ok(bError == FALSE && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "(bError, GetLastError()) = (%u, 0x%08lx), expected (FALSE, 0x%08lx)\n", bError, GetLastError(), (DWORD)ERROR_INSUFFICIENT_BUFFER); + ok(dwRequiredSize != 0, "dwRequiredSize is zero, expected non-zero\n"); + if (dwRequiredSize == 0) + { + skip("Required size is null; cannot proceed with QueryLockStatusW test\n"); + goto cleanup; + } + + /* Allocate memory */ + lpLockStatus = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwRequiredSize); + if (lpLockStatus == NULL) + { + skip("Cannot allocate %lu bytes of memory\n", dwRequiredSize); + goto cleanup; + } + + /* Get the actual value */ + SetLastError(0xdeadbeef); + bError = QueryServiceLockStatusW(hScm, + lpLockStatus, + dwRequiredSize, + &dwRequiredSize); + ok(bError, "bError = %u, expected TRUE\n", bError); + + /* These conditions must be verified iff the services database wasn't previously locked */ + ok(lpLockStatus->fIsLocked == 0, "lpLockStatus->fIsLocked = %lu, expected 0\n", lpLockStatus->fIsLocked); + ok(lpLockStatus->lpLockOwner != NULL, "lpLockStatus->lpLockOwner is null, expected non-null\n"); + ok(lpLockStatus->lpLockOwner && *lpLockStatus->lpLockOwner == 0, "*lpLockStatus->lpLockOwner != \"\\0\", expected \"\\0\"\n"); + ok(lpLockStatus->dwLockDuration == 0, "lpLockStatus->dwLockDuration = %lu, expected 0\n", lpLockStatus->dwLockDuration); + + HeapFree(GetProcessHeap(), 0, lpLockStatus); + + + /* + * Try again, this time with the database locked. + */ + + SetLastError(0xdeadbeef); + hLock = LockServiceDatabase(hScm); + ok(hLock != NULL, "hLock = 0x%p, expected non-zero\n", hLock); + ok_err(ERROR_SUCCESS); + + Sleep(1000); /* Wait 1 second to let lpLockStatus->dwLockDuration increment */ + + /* Get the needed size */ + SetLastError(0xdeadbeef); + bError = QueryServiceLockStatusW(hScm, + NULL, + 0, + &dwRequiredSize); + ok(bError == FALSE && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "(bError, GetLastError()) = (%u, 0x%08lx), expected (FALSE, 0x%08lx)\n", bError, GetLastError(), (DWORD)ERROR_INSUFFICIENT_BUFFER); + ok(dwRequiredSize != 0, "dwRequiredSize is zero, expected non-zero\n"); + if (dwRequiredSize == 0) + { + skip("Required size is null; cannot proceed with QueryLockStatusW test\n"); + goto cleanup; + } + + /* Allocate memory */ + lpLockStatus = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwRequiredSize); + if (lpLockStatus == NULL) + { + skip("Cannot allocate %lu bytes of memory\n", dwRequiredSize); + goto cleanup; + } + + /* Get the actual value */ + SetLastError(0xdeadbeef); + bError = QueryServiceLockStatusW(hScm, + lpLockStatus, + dwRequiredSize, + &dwRequiredSize); + ok(bError, "bError = %u, expected TRUE\n", bError); + + /* These conditions must be verified iff the services database is locked */ + ok(lpLockStatus->fIsLocked != 0, "lpLockStatus->fIsLocked = %lu, expected non-zero\n", lpLockStatus->fIsLocked); + ok(lpLockStatus->lpLockOwner != NULL, "lpLockStatus->lpLockOwner is null, expected non-null\n"); + ok(lpLockStatus->lpLockOwner && *lpLockStatus->lpLockOwner != 0, "*lpLockStatus->lpLockOwner = \"\\0\", expected non-zero\n"); + ok(lpLockStatus->dwLockDuration != 0, "lpLockStatus->dwLockDuration = %lu, expected non-zero\n", lpLockStatus->dwLockDuration); + + HeapFree(GetProcessHeap(), 0, lpLockStatus); + + + /* + * Last try, with the database again unlocked. + */ + + SetLastError(0xdeadbeef); + bError = UnlockServiceDatabase(hLock); + ok(bError == TRUE, "bError = %u, expected TRUE\n", bError); + ok_err(ERROR_SUCCESS); + hLock = NULL; + + /* Get the needed size */ + SetLastError(0xdeadbeef); + bError = QueryServiceLockStatusW(hScm, + NULL, + 0, + &dwRequiredSize); + ok(bError == FALSE && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "(bError, GetLastError()) = (%u, 0x%08lx), expected (FALSE, 0x%08lx)\n", bError, GetLastError(), (DWORD)ERROR_INSUFFICIENT_BUFFER); + ok(dwRequiredSize != 0, "dwRequiredSize is zero, expected non-zero\n"); + if (dwRequiredSize == 0) + { + skip("Required size is null; cannot proceed with QueryLockStatusW test\n"); + goto cleanup; + } + + /* Allocate memory */ + lpLockStatus = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwRequiredSize); + if (lpLockStatus == NULL) + { + skip("Cannot allocate %lu bytes of memory\n", dwRequiredSize); + goto cleanup; + } + + /* Get the actual value */ + SetLastError(0xdeadbeef); + bError = QueryServiceLockStatusW(hScm, + lpLockStatus, + dwRequiredSize, + &dwRequiredSize); + ok(bError, "bError = %u, expected TRUE\n", bError); + + /* These conditions must be verified iff the services database is unlocked */ + ok(lpLockStatus->fIsLocked == 0, "lpLockStatus->fIsLocked = %lu, expected 0\n", lpLockStatus->fIsLocked); + ok(lpLockStatus->lpLockOwner != NULL, "lpLockStatus->lpLockOwner is null, expected non-null\n"); + ok(lpLockStatus->lpLockOwner && *lpLockStatus->lpLockOwner == 0, "*lpLockStatus->lpLockOwner != \"\\0\", expected \"\\0\"\n"); + ok(lpLockStatus->dwLockDuration == 0, "lpLockStatus->dwLockDuration = %lu, expected 0\n", lpLockStatus->dwLockDuration); + + HeapFree(GetProcessHeap(), 0, lpLockStatus); + + +cleanup: + if (hLock) + UnlockServiceDatabase(hLock); + + if (hScm) + CloseServiceHandle(hScm); + + return; +} + +static void Test_QueryLockStatusA(void) +{ + BOOL bError = FALSE; + + SC_HANDLE hScm = NULL; + SC_LOCK hLock = NULL; + LPQUERY_SERVICE_LOCK_STATUSA lpLockStatus = NULL; + DWORD dwRequiredSize = 0; + + /* Firstly try to get lock status with invalid handles */ + SetLastError(0xdeadbeef); + bError = QueryServiceLockStatusA(hScm, + NULL, + 0, + &dwRequiredSize); + ok(bError == FALSE && GetLastError() == ERROR_INVALID_HANDLE, "(bError, GetLastError()) = (%u, 0x%08lx), expected (FALSE, 0x%08lx)\n", bError, GetLastError(), (DWORD)ERROR_INVALID_HANDLE); + ok(dwRequiredSize == 0, "dwRequiredSize is non-zero, expected zero\n"); + + /* Open the services database without having rights */ + SetLastError(0xdeadbeef); + hScm = OpenSCManagerA(NULL, NULL, SC_MANAGER_CONNECT); + ok(hScm != NULL, "Failed to open service manager, error=0x%08lx\n", GetLastError()); + if (!hScm) + { + skip("No service control manager; cannot proceed with QueryLockStatusA test\n"); + goto cleanup; + } + ok_err(ERROR_SUCCESS); + + /* Try to get lock status */ + SetLastError(0xdeadbeef); + bError = QueryServiceLockStatusA(hScm, + NULL, + 0, + &dwRequiredSize); + ok(bError == FALSE && GetLastError() == ERROR_ACCESS_DENIED, "(bError, GetLastError()) = (%u, 0x%08lx), expected (FALSE, 0x%08lx)\n", bError, GetLastError(), (DWORD)ERROR_ACCESS_DENIED); + ok(dwRequiredSize == 0, "dwRequiredSize is non-zero, expected zero\n"); + + CloseServiceHandle(hScm); + + + /* + * Query only the lock status. + */ + + SetLastError(0xdeadbeef); + hScm = OpenSCManagerA(NULL, NULL, SC_MANAGER_QUERY_LOCK_STATUS); + ok(hScm != NULL, "Failed to open service manager, error=0x%08lx\n", GetLastError()); + if (!hScm) + { + skip("No service control manager; cannot proceed with QueryLockStatusA test\n"); + goto cleanup; + } + ok_err(ERROR_SUCCESS); + + /* Get the needed size */ + SetLastError(0xdeadbeef); + bError = QueryServiceLockStatusA(hScm, + NULL, + 0, + &dwRequiredSize); + ok(bError == FALSE && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "(bError, GetLastError()) = (%u, 0x%08lx), expected (FALSE, 0x%08lx)\n", bError, GetLastError(), (DWORD)ERROR_INSUFFICIENT_BUFFER); + ok(dwRequiredSize != 0, "dwRequiredSize is zero, expected non-zero\n"); + if (dwRequiredSize == 0) + { + skip("Required size is null; cannot proceed with QueryLockStatusA test\n"); + goto cleanup; + } + + /* Allocate memory */ + lpLockStatus = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwRequiredSize); + if (lpLockStatus == NULL) + { + skip("Cannot allocate %lu bytes of memory\n", dwRequiredSize); + goto cleanup; + } + + /* Get the actual value */ + SetLastError(0xdeadbeef); + bError = QueryServiceLockStatusA(hScm, + lpLockStatus, + dwRequiredSize, + &dwRequiredSize); + ok(bError, "bError = %u, expected TRUE\n", bError); + + /* These conditions must be verified iff the services database wasn't previously locked */ + ok(lpLockStatus->fIsLocked == 0, "lpLockStatus->fIsLocked = %lu, expected 0\n", lpLockStatus->fIsLocked); + ok(lpLockStatus->lpLockOwner != NULL, "lpLockStatus->lpLockOwner is null, expected non-null\n"); + ok(lpLockStatus->lpLockOwner && *lpLockStatus->lpLockOwner == 0, "*lpLockStatus->lpLockOwner != \"\\0\", expected \"\\0\"\n"); + ok(lpLockStatus->dwLockDuration == 0, "lpLockStatus->dwLockDuration = %lu, expected 0\n", lpLockStatus->dwLockDuration); + + HeapFree(GetProcessHeap(), 0, lpLockStatus); + + CloseServiceHandle(hScm); + + + /* + * Now, try to lock the database and check its lock status. + */ + + SetLastError(0xdeadbeef); + hScm = OpenSCManagerA(NULL, NULL, SC_MANAGER_LOCK | SC_MANAGER_QUERY_LOCK_STATUS); + ok(hScm != NULL, "Failed to open service manager, error=0x%08lx\n", GetLastError()); + if (!hScm) + { + skip("No service control manager; cannot proceed with QueryLockStatusA test\n"); + goto cleanup; + } + ok_err(ERROR_SUCCESS); + + /* Get the needed size */ + SetLastError(0xdeadbeef); + bError = QueryServiceLockStatusA(hScm, + NULL, + 0, + &dwRequiredSize); + ok(bError == FALSE && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "(bError, GetLastError()) = (%u, 0x%08lx), expected (FALSE, 0x%08lx)\n", bError, GetLastError(), (DWORD)ERROR_INSUFFICIENT_BUFFER); + ok(dwRequiredSize != 0, "dwRequiredSize is zero, expected non-zero\n"); + if (dwRequiredSize == 0) + { + skip("Required size is null; cannot proceed with QueryLockStatusA test\n"); + goto cleanup; + } + + /* Allocate memory */ + lpLockStatus = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwRequiredSize); + if (lpLockStatus == NULL) + { + skip("Cannot allocate %lu bytes of memory\n", dwRequiredSize); + goto cleanup; + } + + /* Get the actual value */ + SetLastError(0xdeadbeef); + bError = QueryServiceLockStatusA(hScm, + lpLockStatus, + dwRequiredSize, + &dwRequiredSize); + ok(bError, "bError = %u, expected TRUE\n", bError); + + /* These conditions must be verified iff the services database wasn't previously locked */ + ok(lpLockStatus->fIsLocked == 0, "lpLockStatus->fIsLocked = %lu, expected 0\n", lpLockStatus->fIsLocked); + ok(lpLockStatus->lpLockOwner != NULL, "lpLockStatus->lpLockOwner is null, expected non-null\n"); + ok(lpLockStatus->lpLockOwner && *lpLockStatus->lpLockOwner == 0, "*lpLockStatus->lpLockOwner != \"\\0\", expected \"\\0\"\n"); + ok(lpLockStatus->dwLockDuration == 0, "lpLockStatus->dwLockDuration = %lu, expected 0\n", lpLockStatus->dwLockDuration); + + HeapFree(GetProcessHeap(), 0, lpLockStatus); + + + /* + * Try again, this time with the database locked. + */ + + SetLastError(0xdeadbeef); + hLock = LockServiceDatabase(hScm); + ok(hLock != NULL, "hLock = 0x%p, expected non-zero\n", hLock); + ok_err(ERROR_SUCCESS); + + Sleep(1000); /* Wait 1 second to let lpLockStatus->dwLockDuration increment */ + + /* Get the needed size */ + SetLastError(0xdeadbeef); + bError = QueryServiceLockStatusA(hScm, + NULL, + 0, + &dwRequiredSize); + ok(bError == FALSE && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "(bError, GetLastError()) = (%u, 0x%08lx), expected (FALSE, 0x%08lx)\n", bError, GetLastError(), (DWORD)ERROR_INSUFFICIENT_BUFFER); + ok(dwRequiredSize != 0, "dwRequiredSize is zero, expected non-zero\n"); + if (dwRequiredSize == 0) + { + skip("Required size is null; cannot proceed with QueryLockStatusA test\n"); + goto cleanup; + } + + /* Allocate memory */ + lpLockStatus = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwRequiredSize); + if (lpLockStatus == NULL) + { + skip("Cannot allocate %lu bytes of memory\n", dwRequiredSize); + goto cleanup; + } + + /* Get the actual value */ + SetLastError(0xdeadbeef); + bError = QueryServiceLockStatusA(hScm, + lpLockStatus, + dwRequiredSize, + &dwRequiredSize); + ok(bError, "bError = %u, expected TRUE\n", bError); + + /* These conditions must be verified iff the services database is locked */ + ok(lpLockStatus->fIsLocked != 0, "lpLockStatus->fIsLocked = %lu, expected non-zero\n", lpLockStatus->fIsLocked); + ok(lpLockStatus->lpLockOwner != NULL, "lpLockStatus->lpLockOwner is null, expected non-null\n"); + ok(lpLockStatus->lpLockOwner && *lpLockStatus->lpLockOwner != 0, "*lpLockStatus->lpLockOwner = \"\\0\", expected non-zero\n"); + ok(lpLockStatus->dwLockDuration != 0, "lpLockStatus->dwLockDuration = %lu, expected non-zero\n", lpLockStatus->dwLockDuration); + + HeapFree(GetProcessHeap(), 0, lpLockStatus); + + + /* + * Last try, with the database again unlocked. + */ + + SetLastError(0xdeadbeef); + bError = UnlockServiceDatabase(hLock); + ok(bError == TRUE, "bError = %u, expected TRUE\n", bError); + ok_err(ERROR_SUCCESS); + hLock = NULL; + + /* Get the needed size */ + SetLastError(0xdeadbeef); + bError = QueryServiceLockStatusA(hScm, + NULL, + 0, + &dwRequiredSize); + ok(bError == FALSE && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "(bError, GetLastError()) = (%u, 0x%08lx), expected (FALSE, 0x%08lx)\n", bError, GetLastError(), (DWORD)ERROR_INSUFFICIENT_BUFFER); + ok(dwRequiredSize != 0, "dwRequiredSize is zero, expected non-zero\n"); + if (dwRequiredSize == 0) + { + skip("Required size is null; cannot proceed with QueryLockStatusA test\n"); + goto cleanup; + } + + /* Allocate memory */ + lpLockStatus = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwRequiredSize); + if (lpLockStatus == NULL) + { + skip("Cannot allocate %lu bytes of memory\n", dwRequiredSize); + goto cleanup; + } + + /* Get the actual value */ + SetLastError(0xdeadbeef); + bError = QueryServiceLockStatusA(hScm, + lpLockStatus, + dwRequiredSize, + &dwRequiredSize); + ok(bError, "bError = %u, expected TRUE\n", bError); + + /* These conditions must be verified iff the services database is unlocked */ + ok(lpLockStatus->fIsLocked == 0, "lpLockStatus->fIsLocked = %lu, expected 0\n", lpLockStatus->fIsLocked); + ok(lpLockStatus->lpLockOwner != NULL, "lpLockStatus->lpLockOwner is null, expected non-null\n"); + ok(lpLockStatus->lpLockOwner && *lpLockStatus->lpLockOwner == 0, "*lpLockStatus->lpLockOwner != \"\\0\", expected \"\\0\"\n"); + ok(lpLockStatus->dwLockDuration == 0, "lpLockStatus->dwLockDuration = %lu, expected 0\n", lpLockStatus->dwLockDuration); + + HeapFree(GetProcessHeap(), 0, lpLockStatus); + + +cleanup: + if (hLock) + UnlockServiceDatabase(hLock); + + if (hScm) + CloseServiceHandle(hScm); + + return; +} + + +START_TEST(LockDatabase) +{ + Test_LockUnlockServiceDatabase(); + Test_LockUnlockServiceDatabaseWithServiceStart(); + Test_QueryLockStatusW(); + Test_QueryLockStatusA(); +} Propchange: trunk/rostests/apitests/advapi32/LockDatabase.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/rostests/apitests/advapi32/QueryServiceConfig2.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/QuerySe…
============================================================================== --- trunk/rostests/apitests/advapi32/QueryServiceConfig2.c [iso-8859-1] (original) +++ trunk/rostests/apitests/advapi32/QueryServiceConfig2.c [iso-8859-1] Fri Jun 29 11:48:35 2012 @@ -2,12 +2,15 @@ * PROJECT: ReactOS api tests * LICENSE: GPLv2+ - See COPYING in the top level directory * PURPOSE: Test for QueryServiceConfig2A/W - * PROGRAMMER: Hermès BÉLUSCA - MAÏTO + * PROGRAMMER: Hermès BÃLUSCA - MAÃTO */ #include <wine/test.h> #include <windows.h> #include <strsafe.h> + +#define TESTING_SERVICEW L"Spooler" +#define TESTING_SERVICEA "Spooler" /* * Taken from base/system/services/config.c and adapted. @@ -495,7 +498,7 @@ ok_err(ERROR_SUCCESS); SetLastError(0xdeadbeef); - hService = OpenServiceW(hScm, L"Spooler", SERVICE_QUERY_CONFIG); + hService = OpenServiceW(hScm, TESTING_SERVICEW, SERVICE_QUERY_CONFIG); ok(hService != NULL, "Failed to open service handle, error=0x%08lx\n", GetLastError()); if (!hService) { @@ -505,10 +508,10 @@ ok_err(ERROR_SUCCESS); - if (QueryConfig2W(hService, L"Spooler", SERVICE_CONFIG_DESCRIPTION) != 0) - goto cleanup; - - if (QueryConfig2W(hService, L"Spooler", SERVICE_CONFIG_FAILURE_ACTIONS) != 0) + if (QueryConfig2W(hService, TESTING_SERVICEW, SERVICE_CONFIG_DESCRIPTION) != 0) + goto cleanup; + + if (QueryConfig2W(hService, TESTING_SERVICEW, SERVICE_CONFIG_FAILURE_ACTIONS) != 0) goto cleanup; cleanup: @@ -536,7 +539,7 @@ ok_err(ERROR_SUCCESS); SetLastError(0xdeadbeef); - hService = OpenServiceA(hScm, "Spooler", SERVICE_QUERY_CONFIG); + hService = OpenServiceA(hScm, TESTING_SERVICEA, SERVICE_QUERY_CONFIG); ok(hService != NULL, "Failed to open service handle, error=0x%08lx\n", GetLastError()); if (!hService) { @@ -546,10 +549,10 @@ ok_err(ERROR_SUCCESS); - if (QueryConfig2A(hService, "Spooler", SERVICE_CONFIG_DESCRIPTION) != 0) - goto cleanup; - - if (QueryConfig2A(hService, "Spooler", SERVICE_CONFIG_FAILURE_ACTIONS) != 0) + if (QueryConfig2A(hService, TESTING_SERVICEA, SERVICE_CONFIG_DESCRIPTION) != 0) + goto cleanup; + + if (QueryConfig2A(hService, TESTING_SERVICEA, SERVICE_CONFIG_FAILURE_ACTIONS) != 0) goto cleanup; cleanup: Modified: trunk/rostests/apitests/advapi32/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/testlis…
============================================================================== --- trunk/rostests/apitests/advapi32/testlist.c [iso-8859-1] (original) +++ trunk/rostests/apitests/advapi32/testlist.c [iso-8859-1] Fri Jun 29 11:48:35 2012 @@ -6,11 +6,13 @@ #include "wine/test.h" extern void func_CreateService(void); +extern void func_LockDatabase(void); extern void func_QueryServiceConfig2(void); const struct test winetest_testlist[] = { { "CreateService", func_CreateService }, + { "LockDatabase" , func_LockDatabase }, { "QueryServiceConfig2", func_QueryServiceConfig2 }, { 0, 0 }
12 years, 5 months
1
0
0
0
[tfaber] 56809: [ADVAPI32_APITEST] - Add test for QueryServiceConfig2 with SERVICE_CONFIG_DESCRIPTION and SERVICE_CONFIG_FAILURE_ACTIONS. Patch by Hermes Belusca. - Remove ok_lasterr in favor of ok...
by tfaber@svn.reactos.org
Author: tfaber Date: Wed Jun 27 14:55:22 2012 New Revision: 56809 URL:
http://svn.reactos.org/svn/reactos?rev=56809&view=rev
Log: [ADVAPI32_APITEST] - Add test for QueryServiceConfig2 with SERVICE_CONFIG_DESCRIPTION and SERVICE_CONFIG_FAILURE_ACTIONS. Patch by Hermes Belusca. - Remove ok_lasterr in favor of ok_err. See issue #7144 for more details. Added: trunk/rostests/apitests/advapi32/QueryServiceConfig2.c (with props) Modified: trunk/rostests/apitests/advapi32/ (props changed) trunk/rostests/apitests/advapi32/CMakeLists.txt trunk/rostests/apitests/advapi32/CreateService.c trunk/rostests/apitests/advapi32/testlist.c Propchange: trunk/rostests/apitests/advapi32/ ------------------------------------------------------------------------------ --- bugtraq:logregex (added) +++ bugtraq:logregex Wed Jun 27 14:55:22 2012 @@ -1,0 +1,2 @@ +([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))? +(\d+) Propchange: trunk/rostests/apitests/advapi32/ ------------------------------------------------------------------------------ bugtraq:message = See issue #%BUGID% for more details. Propchange: trunk/rostests/apitests/advapi32/ ------------------------------------------------------------------------------ bugtraq:url =
http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: trunk/rostests/apitests/advapi32/ ------------------------------------------------------------------------------ tsvn:logminsize = 10 Modified: trunk/rostests/apitests/advapi32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/CMakeLi…
============================================================================== --- trunk/rostests/apitests/advapi32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/apitests/advapi32/CMakeLists.txt [iso-8859-1] Wed Jun 27 14:55:22 2012 @@ -1,8 +1,7 @@ - -add_definitions(-D_DLL -D__USE_CRTIMP) list(APPEND SOURCE CreateService.c + QueryServiceConfig2.c testlist.c) add_executable(advapi32_apitest ${SOURCE}) Modified: trunk/rostests/apitests/advapi32/CreateService.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/CreateS…
============================================================================== --- trunk/rostests/apitests/advapi32/CreateService.c [iso-8859-1] (original) +++ trunk/rostests/apitests/advapi32/CreateService.c [iso-8859-1] Wed Jun 27 14:55:22 2012 @@ -8,8 +8,6 @@ #include <wine/test.h> #include <windows.h> #include <strsafe.h> - -#define ok_lasterr(err, s) ok(GetLastError() == (err), "%s GetLastError()=0x%08lx, expected 0x%08lx\n", s, GetLastError(), (DWORD)(err)) static int MakeService(SC_HANDLE hScm, const wchar_t *serviceName, SC_HANDLE *hService, DWORD *tag) { @@ -41,7 +39,7 @@ return 1; } - ok_lasterr(ERROR_SUCCESS, "CreateServiceW"); + ok_err(ERROR_SUCCESS); ok(*tag != 0, "tag is zero, expected nonzero\n"); @@ -98,7 +96,7 @@ goto cleanup; } - ok_lasterr(ERROR_SUCCESS, "OpenSCManagerW"); + ok_err(ERROR_SUCCESS); if (MakeService(hScm, L"advapi32_apitest_CreateService_Test_Service1", &hService1, &tag1)) goto cleanup; Added: trunk/rostests/apitests/advapi32/QueryServiceConfig2.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/QuerySe…
============================================================================== --- trunk/rostests/apitests/advapi32/QueryServiceConfig2.c (added) +++ trunk/rostests/apitests/advapi32/QueryServiceConfig2.c [iso-8859-1] Wed Jun 27 14:55:22 2012 @@ -1,0 +1,568 @@ +/* + * PROJECT: ReactOS api tests + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: Test for QueryServiceConfig2A/W + * PROGRAMMER: Hermès BÉLUSCA - MAÏTO + */ + +#include <wine/test.h> +#include <windows.h> +#include <strsafe.h> + +/* + * Taken from base/system/services/config.c and adapted. + */ +static DWORD +RegReadStringW(HKEY hKey, + LPWSTR lpValueName, + LPWSTR *lpValue) +{ + DWORD dwError; + DWORD dwSize; + DWORD dwType; + + *lpValue = NULL; + + dwSize = 0; + dwError = RegQueryValueExW(hKey, + lpValueName, + 0, + &dwType, + NULL, + &dwSize); + if (dwError != ERROR_SUCCESS) + return dwError; + + *lpValue = HeapAlloc(GetProcessHeap(), 0, dwSize); + if (*lpValue == NULL) + return ERROR_NOT_ENOUGH_MEMORY; + + dwError = RegQueryValueExW(hKey, + lpValueName, + 0, + &dwType, + (LPBYTE)*lpValue, + &dwSize); + if (dwError != ERROR_SUCCESS) + { + HeapFree(GetProcessHeap(), 0, *lpValue); + *lpValue = NULL; + } + + return dwError; +} + +static DWORD +RegReadStringA(HKEY hKey, + LPSTR lpValueName, + LPSTR *lpValue) +{ + DWORD dwError; + DWORD dwSize; + DWORD dwType; + + *lpValue = NULL; + + dwSize = 0; + dwError = RegQueryValueExA(hKey, + lpValueName, + 0, + &dwType, + NULL, + &dwSize); + if (dwError != ERROR_SUCCESS) + return dwError; + + *lpValue = HeapAlloc(GetProcessHeap(), 0, dwSize); + if (*lpValue == NULL) + return ERROR_NOT_ENOUGH_MEMORY; + + dwError = RegQueryValueExA(hKey, + lpValueName, + 0, + &dwType, + (LPBYTE)*lpValue, + &dwSize); + if (dwError != ERROR_SUCCESS) + { + HeapFree(GetProcessHeap(), 0, *lpValue); + *lpValue = NULL; + } + + return dwError; +} + + +static int QueryConfig2W(SC_HANDLE hService, LPCWSTR serviceName, DWORD dwInfoLevel) +{ + int iRet = 0; + LONG lRet = 0; + DWORD dwRet = 0; + BOOL bError = FALSE; + DWORD dwRequiredSize = 0; + LPBYTE lpBuffer = NULL; + + WCHAR keyName[256]; + HKEY hKey = NULL; + DWORD dwType = 0; + + /* Get the needed size */ + SetLastError(0xdeadbeef); + bError = QueryServiceConfig2W(hService, + dwInfoLevel, + NULL, + 0, + &dwRequiredSize); + ok(bError == FALSE && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "(bError, GetLastError()) = (%u, 0x%08lx), expected (FALSE, 0x%08lx)\n", bError, GetLastError(), (DWORD)ERROR_INSUFFICIENT_BUFFER); + ok(dwRequiredSize != 0, "dwRequiredSize is zero, expected non-zero\n"); + if (dwRequiredSize == 0) + { + skip("Required size is null; cannot proceed with QueryConfig2W --> %lu test\n", dwInfoLevel); + return 1; + } + + /* Allocate memory */ + lpBuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwRequiredSize); + if (lpBuffer == NULL) + { + skip("Cannot allocate %lu bytes of memory\n", dwRequiredSize); + return 2; + } + + /* Get the actual value */ + SetLastError(0xdeadbeef); + bError = QueryServiceConfig2W(hService, + dwInfoLevel, + lpBuffer, + dwRequiredSize, + &dwRequiredSize); + ok(bError, "bError = %u, expected TRUE\n", bError); + if (bError == FALSE) + { + skip("QueryServiceConfig2W returned an error; cannot proceed with QueryConfig2W --> %lu test\n", dwInfoLevel); + HeapFree(GetProcessHeap(), 0, lpBuffer); + return 3; + } + + /* Now we can compare the retrieved value with what it's actually stored in the registry */ + StringCbPrintfW(keyName, sizeof(keyName), L"System\\CurrentControlSet\\Services\\%s", serviceName); + SetLastError(0xdeadbeef); + lRet = RegOpenKeyExW(HKEY_LOCAL_MACHINE, keyName, 0, KEY_QUERY_VALUE, &hKey); + ok(lRet == ERROR_SUCCESS, "RegOpenKeyExW failed with 0x%08lx\n", lRet); + if (lRet != ERROR_SUCCESS) + { + skip("No regkey; cannot proceed with QueryConfig2W --> %lu test\n", dwInfoLevel); + HeapFree(GetProcessHeap(), 0, lpBuffer); + return 4; + } + + switch (dwInfoLevel) + { + case SERVICE_CONFIG_DESCRIPTION: + { + LPSERVICE_DESCRIPTIONW lpDescription = (LPSERVICE_DESCRIPTIONW)lpBuffer; + LPWSTR lpszDescription = NULL; + + /* Retrieve the description via the registry */ + dwRet = RegReadStringW(hKey, L"Description", &lpszDescription); + ok(dwRet == ERROR_SUCCESS, "RegReadStringW returned 0x%08lx\n", dwRet); + ok(lpszDescription != NULL, "lpszDescription is null, expected non-null\n"); + + /* Compare it with the description retrieved via QueryServiceConfig2 */ + if (lpszDescription) + iRet = wcscmp(lpDescription->lpDescription, lpszDescription); + else + iRet = 0; + + ok(iRet == 0, "Retrieved descriptions are different !\n"); + + + /* Memory cleanup */ + HeapFree(GetProcessHeap(), 0, lpszDescription); + + break; + } + + case SERVICE_CONFIG_FAILURE_ACTIONS: + { + LPSERVICE_FAILURE_ACTIONSW lpFailureActions1 = (LPSERVICE_FAILURE_ACTIONSW)lpBuffer; + LPSERVICE_FAILURE_ACTIONSW lpFailureActions2 = NULL; + LPWSTR lpRebootMessage = NULL; + LPWSTR lpFailureCommand = NULL; + DWORD i = 0; + + /* Retrieve the failure actions via the registry */ + lRet = RegQueryValueExW(hKey, + L"FailureActions", + NULL, + &dwType, + NULL, + &dwRequiredSize); + ok(lRet == ERROR_SUCCESS, "RegQueryValueExW returned 0x%08lx\n", lRet); + ok(dwType == REG_BINARY, "dwType = %lu, expected REG_BINARY\n", dwType); + ok(dwRequiredSize != 0, "dwRequiredSize is zero, expected non-zero\n"); + + lpFailureActions2 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwRequiredSize); + if (lpFailureActions2 == NULL) + { + skip("Cannot allocate %lu bytes of memory\n", dwRequiredSize); + break; + } + + lRet = RegQueryValueExW(hKey, + L"FailureActions", + NULL, + NULL, + (LPBYTE)lpFailureActions2, + &dwRequiredSize); + ok(lRet == ERROR_SUCCESS, "RegQueryValueExW returned 0x%08lx\n", lRet); + ok(dwRequiredSize != 0, "dwRequiredSize is zero, expected non-zero\n"); + + /* Get the strings */ + RegReadStringW(hKey, L"FailureCommand", &lpFailureCommand); + RegReadStringW(hKey, L"RebootMessage" , &lpRebootMessage ); + + /* Check the values */ + ok(lpFailureActions1->dwResetPeriod == lpFailureActions2->dwResetPeriod, "lpFailureActions1->dwResetPeriod != lpFailureActions2->dwResetPeriod\n"); + ok(lpFailureActions1->cActions == lpFailureActions2->cActions, "lpFailureActions1->cActions != lpFailureActions2->cActions\n"); + + /* Compare the actions */ + if (lpFailureActions1->cActions == lpFailureActions2->cActions) + { + lpFailureActions2->lpsaActions = (lpFailureActions2->cActions > 0 ? (LPSC_ACTION)(lpFailureActions2 + 1) : NULL); + + if (lpFailureActions1->cActions > 0 && + lpFailureActions1->lpsaActions != NULL) + { + for (i = 0; i < lpFailureActions1->cActions; ++i) + { + ok(lpFailureActions1->lpsaActions[i].Type == lpFailureActions2->lpsaActions[i].Type , "lpFailureActions1->lpsaActions[%lu].Type != lpFailureActions2->lpsaActions[%lu].Type\n" , i, i); + ok(lpFailureActions1->lpsaActions[i].Delay == lpFailureActions2->lpsaActions[i].Delay, "lpFailureActions1->lpsaActions[%lu].Delay != lpFailureActions2->lpsaActions[%lu].Delay\n", i, i); + } + } + } + + /* TODO: retrieve the strings if they are in MUI format */ + + /* Compare RebootMsg */ + if (lpFailureActions1->lpRebootMsg && lpRebootMessage) + iRet = wcscmp(lpFailureActions1->lpRebootMsg, lpRebootMessage); + else + iRet = 0; + + ok(iRet == 0, "Retrieved reboot messages are different !\n"); + + /* Compare Command */ + if (lpFailureActions1->lpCommand && lpFailureCommand) + iRet = wcscmp(lpFailureActions1->lpCommand, lpFailureCommand); + else + iRet = 0; + + ok(iRet == 0, "Retrieved commands are different !\n"); + + + /* Memory cleanup */ + if (lpRebootMessage) + HeapFree(GetProcessHeap(), 0, lpRebootMessage); + + if (lpFailureCommand) + HeapFree(GetProcessHeap(), 0, lpFailureCommand); + + HeapFree(GetProcessHeap(), 0, lpFailureActions2); + + break; + } + + default: + skip("Unknown dwInfoLevel %lu, cannot proceed with QueryConfig2W --> %lu test\n", dwInfoLevel, dwInfoLevel); + break; + } + + RegCloseKey(hKey); + + HeapFree(GetProcessHeap(), 0, lpBuffer); + + return 0; +} + +static int QueryConfig2A(SC_HANDLE hService, LPCSTR serviceName, DWORD dwInfoLevel) +{ + int iRet = 0; + LONG lRet = 0; + DWORD dwRet = 0; + BOOL bError = FALSE; + DWORD dwRequiredSize = 0; + LPBYTE lpBuffer = NULL; + + CHAR keyName[256]; + HKEY hKey = NULL; + DWORD dwType = 0; + + /* Get the needed size */ + SetLastError(0xdeadbeef); + bError = QueryServiceConfig2A(hService, + dwInfoLevel, + NULL, + 0, + &dwRequiredSize); + ok(bError == FALSE && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "(bError, GetLastError()) = (%u, 0x%08lx), expected (FALSE, 0x%08lx)\n", bError, GetLastError(), (DWORD)ERROR_INSUFFICIENT_BUFFER); + ok(dwRequiredSize != 0, "dwRequiredSize is zero, expected non-zero\n"); + if (dwRequiredSize == 0) + { + skip("Required size is null; cannot proceed with QueryConfig2A --> %lu test\n", dwInfoLevel); + return 1; + } + + /* Allocate memory */ + lpBuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwRequiredSize); + if (lpBuffer == NULL) + { + skip("Cannot allocate %lu bytes of memory\n", dwRequiredSize); + return 2; + } + + /* Get the actual value */ + SetLastError(0xdeadbeef); + bError = QueryServiceConfig2A(hService, + dwInfoLevel, + lpBuffer, + dwRequiredSize, + &dwRequiredSize); + ok(bError, "bError = %u, expected TRUE\n", bError); + if (bError == FALSE) + { + skip("QueryServiceConfig2A returned an error; cannot proceed with QueryConfig2A --> %lu test\n", dwInfoLevel); + HeapFree(GetProcessHeap(), 0, lpBuffer); + return 3; + } + + /* Now we can compare the retrieved value with what it's actually stored in the registry */ + StringCbPrintfA(keyName, sizeof(keyName), "System\\CurrentControlSet\\Services\\%s", serviceName); + SetLastError(0xdeadbeef); + lRet = RegOpenKeyExA(HKEY_LOCAL_MACHINE, keyName, 0, KEY_QUERY_VALUE, &hKey); + ok(lRet == ERROR_SUCCESS, "RegOpenKeyExA failed with 0x%08lx\n", lRet); + if (lRet != ERROR_SUCCESS) + { + skip("No regkey; cannot proceed with QueryConfig2A --> %lu test\n", dwInfoLevel); + HeapFree(GetProcessHeap(), 0, lpBuffer); + return 4; + } + + switch (dwInfoLevel) + { + case SERVICE_CONFIG_DESCRIPTION: + { + LPSERVICE_DESCRIPTIONA lpDescription = (LPSERVICE_DESCRIPTIONA)lpBuffer; + LPSTR lpszDescription = NULL; + + /* Retrieve the description via the registry */ + dwRet = RegReadStringA(hKey, "Description", &lpszDescription); + ok(dwRet == ERROR_SUCCESS, "RegReadStringA returned 0x%08lx\n", dwRet); + ok(lpszDescription != NULL, "lpszDescription is null, expected non-null\n"); + + /* Compare it with the description retrieved via QueryServiceConfig2 */ + if (lpszDescription) + iRet = strcmp(lpDescription->lpDescription, lpszDescription); + else + iRet = 0; + + ok(iRet == 0, "Retrieved descriptions are different !\n"); + + + /* Memory cleanup */ + HeapFree(GetProcessHeap(), 0, lpszDescription); + + break; + } + + case SERVICE_CONFIG_FAILURE_ACTIONS: + { + LPSERVICE_FAILURE_ACTIONSA lpFailureActions1 = (LPSERVICE_FAILURE_ACTIONSA)lpBuffer; + LPSERVICE_FAILURE_ACTIONSA lpFailureActions2 = NULL; + LPSTR lpRebootMessage = NULL; + LPSTR lpFailureCommand = NULL; + DWORD i = 0; + + /* Retrieve the failure actions via the registry */ + lRet = RegQueryValueExA(hKey, + "FailureActions", + NULL, + &dwType, + NULL, + &dwRequiredSize); + ok(lRet == ERROR_SUCCESS, "RegQueryValueExA returned 0x%08lx\n", lRet); + ok(dwType == REG_BINARY, "dwType = %lu, expected REG_BINARY\n", dwType); + ok(dwRequiredSize != 0, "dwRequiredSize is zero, expected non-zero\n"); + + lpFailureActions2 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwRequiredSize); + if (lpFailureActions2 == NULL) + { + skip("Cannot allocate %lu bytes of memory\n", dwRequiredSize); + break; + } + + lRet = RegQueryValueExA(hKey, + "FailureActions", + NULL, + NULL, + (LPBYTE)lpFailureActions2, + &dwRequiredSize); + ok(lRet == ERROR_SUCCESS, "RegQueryValueExA returned 0x%08lx\n", lRet); + ok(dwRequiredSize != 0, "dwRequiredSize is zero, expected non-zero\n"); + + /* Get the strings */ + RegReadStringA(hKey, "FailureCommand", &lpFailureCommand); + RegReadStringA(hKey, "RebootMessage" , &lpRebootMessage ); + + /* Check the values */ + ok(lpFailureActions1->dwResetPeriod == lpFailureActions2->dwResetPeriod, "lpFailureActions1->dwResetPeriod != lpFailureActions2->dwResetPeriod\n"); + ok(lpFailureActions1->cActions == lpFailureActions2->cActions, "lpFailureActions1->cActions != lpFailureActions2->cActions\n"); + + /* Compare the actions */ + if (lpFailureActions1->cActions == lpFailureActions2->cActions) + { + lpFailureActions2->lpsaActions = (lpFailureActions2->cActions > 0 ? (LPSC_ACTION)(lpFailureActions2 + 1) : NULL); + + if (lpFailureActions1->cActions > 0 && + lpFailureActions1->lpsaActions != NULL) + { + for (i = 0; i < lpFailureActions1->cActions; ++i) + { + ok(lpFailureActions1->lpsaActions[i].Type == lpFailureActions2->lpsaActions[i].Type , "lpFailureActions1->lpsaActions[%lu].Type != lpFailureActions2->lpsaActions[%lu].Type\n" , i, i); + ok(lpFailureActions1->lpsaActions[i].Delay == lpFailureActions2->lpsaActions[i].Delay, "lpFailureActions1->lpsaActions[%lu].Delay != lpFailureActions2->lpsaActions[%lu].Delay\n", i, i); + } + } + } + + /* TODO: retrieve the strings if they are in MUI format */ + + /* Compare RebootMsg */ + if (lpFailureActions1->lpRebootMsg && lpRebootMessage) + iRet = strcmp(lpFailureActions1->lpRebootMsg, lpRebootMessage); + else + iRet = 0; + + ok(iRet == 0, "Retrieved reboot messages are different !\n"); + + /* Compare Command */ + if (lpFailureActions1->lpCommand && lpFailureCommand) + iRet = strcmp(lpFailureActions1->lpCommand, lpFailureCommand); + else + iRet = 0; + + ok(iRet == 0, "Retrieved commands are different !\n"); + + + /* Memory cleanup */ + if (lpRebootMessage) + HeapFree(GetProcessHeap(), 0, lpRebootMessage); + + if (lpFailureCommand) + HeapFree(GetProcessHeap(), 0, lpFailureCommand); + + HeapFree(GetProcessHeap(), 0, lpFailureActions2); + + break; + } + + default: + skip("Unknown dwInfoLevel %lu, cannot proceed with QueryConfig2A --> %lu test\n", dwInfoLevel, dwInfoLevel); + break; + } + + RegCloseKey(hKey); + + HeapFree(GetProcessHeap(), 0, lpBuffer); + + return 0; +} + + +static void Test_QueryServiceConfig2W(void) +{ + SC_HANDLE hScm = NULL; + SC_HANDLE hService = NULL; + + SetLastError(0xdeadbeef); + hScm = OpenSCManagerW(NULL, NULL, SC_MANAGER_CONNECT); + ok(hScm != NULL, "Failed to open service manager, error=0x%08lx\n", GetLastError()); + if (!hScm) + { + skip("No service control manager; cannot proceed with QueryServiceConfig2W test\n"); + goto cleanup; + } + + ok_err(ERROR_SUCCESS); + + SetLastError(0xdeadbeef); + hService = OpenServiceW(hScm, L"Spooler", SERVICE_QUERY_CONFIG); + ok(hService != NULL, "Failed to open service handle, error=0x%08lx\n", GetLastError()); + if (!hService) + { + skip("Service not found; cannot proceed with QueryServiceConfig2W test\n"); + goto cleanup; + } + + ok_err(ERROR_SUCCESS); + + if (QueryConfig2W(hService, L"Spooler", SERVICE_CONFIG_DESCRIPTION) != 0) + goto cleanup; + + if (QueryConfig2W(hService, L"Spooler", SERVICE_CONFIG_FAILURE_ACTIONS) != 0) + goto cleanup; + +cleanup: + if (hService) + CloseServiceHandle(hService); + + if (hScm) + CloseServiceHandle(hScm); +} + +static void Test_QueryServiceConfig2A(void) +{ + SC_HANDLE hScm = NULL; + SC_HANDLE hService = NULL; + + SetLastError(0xdeadbeef); + hScm = OpenSCManagerA(NULL, NULL, SC_MANAGER_CONNECT); + ok(hScm != NULL, "Failed to open service manager, error=0x%08lx\n", GetLastError()); + if (!hScm) + { + skip("No service control manager; cannot proceed with QueryServiceConfig2A test\n"); + goto cleanup; + } + + ok_err(ERROR_SUCCESS); + + SetLastError(0xdeadbeef); + hService = OpenServiceA(hScm, "Spooler", SERVICE_QUERY_CONFIG); + ok(hService != NULL, "Failed to open service handle, error=0x%08lx\n", GetLastError()); + if (!hService) + { + skip("Service not found; cannot proceed with QueryServiceConfig2A test\n"); + goto cleanup; + } + + ok_err(ERROR_SUCCESS); + + if (QueryConfig2A(hService, "Spooler", SERVICE_CONFIG_DESCRIPTION) != 0) + goto cleanup; + + if (QueryConfig2A(hService, "Spooler", SERVICE_CONFIG_FAILURE_ACTIONS) != 0) + goto cleanup; + +cleanup: + if (hService) + CloseServiceHandle(hService); + + if (hScm) + CloseServiceHandle(hScm); +} + + +START_TEST(QueryServiceConfig2) +{ + Test_QueryServiceConfig2W(); + Test_QueryServiceConfig2A(); +} Propchange: trunk/rostests/apitests/advapi32/QueryServiceConfig2.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/rostests/apitests/advapi32/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/testlis…
============================================================================== --- trunk/rostests/apitests/advapi32/testlist.c [iso-8859-1] (original) +++ trunk/rostests/apitests/advapi32/testlist.c [iso-8859-1] Wed Jun 27 14:55:22 2012 @@ -6,10 +6,12 @@ #include "wine/test.h" extern void func_CreateService(void); +extern void func_QueryServiceConfig2(void); const struct test winetest_testlist[] = { { "CreateService", func_CreateService }, + { "QueryServiceConfig2", func_QueryServiceConfig2 }, { 0, 0 } };
12 years, 6 months
1
0
0
0
[spetreolle] 56808: [FORMAT] Handle read only devices and report them unsupported. Forbid the formatting of the system drive. Patch by Mikael Lyngvig. See bug 2081 for more details.
by spetreolle@svn.reactos.org
Author: spetreolle Date: Tue Jun 26 21:31:10 2012 New Revision: 56808 URL:
http://svn.reactos.org/svn/reactos?rev=56808&view=rev
Log: [FORMAT] Handle read only devices and report them unsupported. Forbid the formatting of the system drive. Patch by Mikael Lyngvig. See bug 2081 for more details. Modified: trunk/reactos/base/system/format/format.c Modified: trunk/reactos/base/system/format/format.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/format/format.…
============================================================================== --- trunk/reactos/base/system/format/format.c [iso-8859-1] (original) +++ trunk/reactos/base/system/format/format.c [iso-8859-1] Tue Jun 26 21:31:10 2012 @@ -370,25 +370,52 @@ // See if the drive is removable or not // driveType = GetDriveType( RootDirectory ); - - if( driveType == 0 ) { - LoadStringAndOem( GetModuleHandle(NULL), STRING_ERROR_DRIVE_TYPE, (LPTSTR) szMsg,RC_STRING_MAX_SIZE); - PrintWin32Error( szMsg, GetLastError()); - return -1; - } - else if ( driveType == 1 ) + switch (driveType) { - LoadString( GetModuleHandle(NULL), STRING_NO_VOLUME, (LPTSTR) szMsg,RC_STRING_MAX_SIZE); - PrintWin32Error( szMsg, GetLastError()); - return -1; - } - - if( driveType != DRIVE_FIXED ) { - LoadStringAndOem( GetModuleHandle(NULL), STRING_INSERT_DISK, (LPTSTR) szMsg,RC_STRING_MAX_SIZE); - _tprintf(szMsg, RootDirectory[0] ); - _fgetts( input, sizeof(input)/2, stdin ); - - media = FMIFS_FLOPPY; + case DRIVE_UNKNOWN : + LoadStringAndOem( GetModuleHandle(NULL), STRING_ERROR_DRIVE_TYPE, (LPTSTR) szMsg,RC_STRING_MAX_SIZE); + PrintWin32Error( szMsg, GetLastError()); + return -1; + + case DRIVE_REMOTE: + case DRIVE_CDROM: + LoadStringAndOem( GetModuleHandle(NULL), STRING_NO_SUPPORT, (LPTSTR) szMsg, RC_STRING_MAX_SIZE); + _tprintf(szMsg); + return -1; + + case DRIVE_NO_ROOT_DIR: + LoadString( GetModuleHandle(NULL), STRING_NO_VOLUME, (LPTSTR) szMsg,RC_STRING_MAX_SIZE); + PrintWin32Error( szMsg, GetLastError()); + return -1; + + case DRIVE_REMOVABLE: + LoadStringAndOem( GetModuleHandle(NULL), STRING_INSERT_DISK, (LPTSTR) szMsg,RC_STRING_MAX_SIZE); + _tprintf(szMsg, RootDirectory[0] ); + _fgetts( input, sizeof(input)/2, stdin ); + media = FMIFS_FLOPPY; + break; + + case DRIVE_FIXED: + case DRIVE_RAMDISK: + media = FMIFS_HARDDISK; + break; + } + + // Reject attempts to format the system drive + { + TCHAR path[MAX_PATH + 1]; + UINT rc; + rc = GetWindowsDirectory(path, MAX_PATH); + if (rc == 0 || rc > MAX_PATH) + // todo: Report "Unable to query system directory" + return -1; + if (_totlower(path[0]) == _totlower(Drive[0])) + { + // todo: report "Cannot format system drive" + LoadStringAndOem( GetModuleHandle(NULL), STRING_NO_SUPPORT, (LPTSTR) szMsg, RC_STRING_MAX_SIZE); + _tprintf(szMsg); + return -1; + } } // @@ -452,7 +479,6 @@ return 0; } } - media = FMIFS_HARDDISK; } //
12 years, 6 months
1
0
0
0
[tfaber] 56807: [NTOSKRNL:SE] - Do not dereference pointer before checking against NULL in SeSetSecurityDescriptorInfo
by tfaber@svn.reactos.org
Author: tfaber Date: Tue Jun 26 08:36:58 2012 New Revision: 56807 URL:
http://svn.reactos.org/svn/reactos?rev=56807&view=rev
Log: [NTOSKRNL:SE] - Do not dereference pointer before checking against NULL in SeSetSecurityDescriptorInfo Modified: trunk/reactos/ntoskrnl/se/sd.c Modified: trunk/reactos/ntoskrnl/se/sd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/sd.c?rev=56807…
============================================================================== --- trunk/reactos/ntoskrnl/se/sd.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/se/sd.c [iso-8859-1] Tue Jun 26 08:36:58 2012 @@ -882,11 +882,12 @@ SECURITY_INFORMATION SecurityInformation; ObjectSd = *ObjectsSecurityDescriptor; - ASSERT(ObjectSd->Control & SE_SELF_RELATIVE); /* The object does not have a security descriptor. */ if (!ObjectSd) return STATUS_NO_SECURITY_ON_OBJECT; + + ASSERT(ObjectSd->Control & SE_SELF_RELATIVE); SecurityInformation = *_SecurityInformation;
12 years, 6 months
1
0
0
0
[tfaber] 56806: [NTOSKRNL:SE] - Use the correct pool tags for allocations in SepCaptureAcl/SepCaptureSid See issue #7138 for more details.
by tfaber@svn.reactos.org
Author: tfaber Date: Tue Jun 26 07:21:45 2012 New Revision: 56806 URL:
http://svn.reactos.org/svn/reactos?rev=56806&view=rev
Log: [NTOSKRNL:SE] - Use the correct pool tags for allocations in SepCaptureAcl/SepCaptureSid See issue #7138 for more details. Modified: trunk/reactos/ntoskrnl/se/acl.c trunk/reactos/ntoskrnl/se/sid.c Modified: trunk/reactos/ntoskrnl/se/acl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/acl.c?rev=5680…
============================================================================== --- trunk/reactos/ntoskrnl/se/acl.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/se/acl.c [iso-8859-1] Tue Jun 26 07:21:45 2012 @@ -296,8 +296,9 @@ } _SEH2_END; - NewAcl = ExAllocatePool(PoolType, - AclSize); + NewAcl = ExAllocatePoolWithTag(PoolType, + AclSize, + TAG_ACL); if (NewAcl != NULL) { _SEH2_TRY @@ -329,8 +330,9 @@ { AclSize = InputAcl->AclSize; - NewAcl = ExAllocatePool(PoolType, - AclSize); + NewAcl = ExAllocatePoolWithTag(PoolType, + AclSize, + TAG_ACL); if (NewAcl != NULL) { Modified: trunk/reactos/ntoskrnl/se/sid.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/sid.c?rev=5680…
============================================================================== --- trunk/reactos/ntoskrnl/se/sid.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/se/sid.c [iso-8859-1] Tue Jun 26 07:21:45 2012 @@ -285,7 +285,7 @@ _SEH2_END; /* allocate a SID and copy it */ - NewSid = ExAllocatePool(PoolType, SidSize); + NewSid = ExAllocatePoolWithTag(PoolType, SidSize, TAG_SID); if (!NewSid) return STATUS_INSUFFICIENT_RESOURCES; @@ -312,7 +312,7 @@ SidSize = RtlLengthRequiredSid(Sid->SubAuthorityCount); /* allocate a SID and copy it */ - NewSid = ExAllocatePool(PoolType, SidSize); + NewSid = ExAllocatePoolWithTag(PoolType, SidSize, TAG_SID); if (NewSid == NULL) return STATUS_INSUFFICIENT_RESOURCES;
12 years, 6 months
1
0
0
0
← Newer
1
2
3
4
...
12
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
Results per page:
10
25
50
100
200