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
July 2021
----- 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
18 participants
142 discussions
Start a n
N
ew thread
[reactos] 01/01: [SAMSRV] Older functions should call newer functions
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ccde294b24c166b5e30ae…
commit ccde294b24c166b5e30aed914c261fffebca53df Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sun Jul 11 12:54:28 2021 +0200 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sun Jul 11 12:54:28 2021 +0200 [SAMSRV] Older functions should call newer functions --- dll/win32/samsrv/samrpc.c | 886 +++++++++++++++++++++++----------------------- 1 file changed, 443 insertions(+), 443 deletions(-) diff --git a/dll/win32/samsrv/samrpc.c b/dll/win32/samsrv/samrpc.c index a693324f1d3..d67c84b7312 100644 --- a/dll/win32/samsrv/samrpc.c +++ b/dll/win32/samsrv/samrpc.c @@ -7345,190 +7345,12 @@ SamrQueryInformationUser(IN SAMPR_HANDLE UserHandle, IN USER_INFORMATION_CLASS UserInformationClass, OUT PSAMPR_USER_INFO_BUFFER *Buffer) { - PSAM_DB_OBJECT UserObject; - ACCESS_MASK DesiredAccess; - NTSTATUS Status; - TRACE("SamrQueryInformationUser(%p %lu %p)\n", UserHandle, UserInformationClass, Buffer); - switch (UserInformationClass) - { - case UserGeneralInformation: - case UserNameInformation: - case UserAccountNameInformation: - case UserFullNameInformation: - case UserPrimaryGroupInformation: - case UserAdminCommentInformation: - DesiredAccess = USER_READ_GENERAL; - break; - - case UserLogonHoursInformation: - case UserHomeInformation: - case UserScriptInformation: - case UserProfileInformation: - case UserWorkStationsInformation: - DesiredAccess = USER_READ_LOGON; - break; - - case UserControlInformation: - case UserExpiresInformation: - case UserParametersInformation: - DesiredAccess = USER_READ_ACCOUNT; - break; - - case UserPreferencesInformation: - DesiredAccess = USER_READ_GENERAL | - USER_READ_PREFERENCES; - break; - - case UserLogonInformation: - case UserAccountInformation: - DesiredAccess = USER_READ_GENERAL | - USER_READ_PREFERENCES | - USER_READ_LOGON | - USER_READ_ACCOUNT; - break; - - case UserInternal1Information: - case UserInternal2Information: - case UserAllInformation: - DesiredAccess = 0; - break; - - default: - return STATUS_INVALID_INFO_CLASS; - } - - RtlAcquireResourceShared(&SampResource, - TRUE); - - /* Validate the domain handle */ - Status = SampValidateDbObject(UserHandle, - SamDbUserObject, - DesiredAccess, - &UserObject); - if (!NT_SUCCESS(Status)) - { - TRACE("failed with status 0x%08lx\n", Status); - goto done; - } - - switch (UserInformationClass) - { - case UserGeneralInformation: - Status = SampQueryUserGeneral(UserObject, - Buffer); - break; - - case UserPreferencesInformation: - Status = SampQueryUserPreferences(UserObject, - Buffer); - break; - - case UserLogonInformation: - Status = SampQueryUserLogon(UserObject, - Buffer); - break; - - case UserLogonHoursInformation: - Status = SampQueryUserLogonHours(UserObject, - Buffer); - break; - - case UserAccountInformation: - Status = SampQueryUserAccount(UserObject, - Buffer); - break; - - case UserNameInformation: - Status = SampQueryUserName(UserObject, - Buffer); - break; - - case UserAccountNameInformation: - Status = SampQueryUserAccountName(UserObject, - Buffer); - break; - - case UserFullNameInformation: - Status = SampQueryUserFullName(UserObject, - Buffer); - break; - - case UserPrimaryGroupInformation: - Status = SampQueryUserPrimaryGroup(UserObject, - Buffer); - break; - - case UserHomeInformation: - Status = SampQueryUserHome(UserObject, - Buffer); - break; - - case UserScriptInformation: - Status = SampQueryUserScript(UserObject, - Buffer); - break; - - case UserProfileInformation: - Status = SampQueryUserProfile(UserObject, - Buffer); - break; - - case UserAdminCommentInformation: - Status = SampQueryUserAdminComment(UserObject, - Buffer); - break; - - case UserWorkStationsInformation: - Status = SampQueryUserWorkStations(UserObject, - Buffer); - break; - - case UserControlInformation: - Status = SampQueryUserControl(UserObject, - Buffer); - break; - - case UserExpiresInformation: - Status = SampQueryUserExpires(UserObject, - Buffer); - break; - - case UserInternal1Information: - Status = SampQueryUserInternal1(UserObject, - Buffer); - break; - - case UserInternal2Information: - Status = SampQueryUserInternal2(UserObject, - Buffer); - break; - - case UserParametersInformation: - Status = SampQueryUserParameters(UserObject, - Buffer); - break; - - case UserAllInformation: - Status = SampQueryUserAll(UserObject, - Buffer); - break; - -// case UserInternal4Information: -// case UserInternal5Information: -// case UserInternal4InformationNew: -// case UserInternal5InformationNew: - - default: - Status = STATUS_INVALID_INFO_CLASS; - } - -done: - RtlReleaseResource(&SampResource); - - return Status; + return SamrQueryInformationUser2(UserHandle, + UserInformationClass, + Buffer); } @@ -8137,244 +7959,55 @@ SamrSetInformationUser(IN SAMPR_HANDLE UserHandle, IN USER_INFORMATION_CLASS UserInformationClass, 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 UserLogonHoursInformation: - case UserNameInformation: - case UserAccountNameInformation: - case UserFullNameInformation: - case UserPrimaryGroupInformation: - case UserHomeInformation: - case UserScriptInformation: - case UserProfileInformation: - case UserAdminCommentInformation: - case UserWorkStationsInformation: - case UserControlInformation: - case UserExpiresInformation: - case UserParametersInformation: - DesiredAccess = USER_WRITE_ACCOUNT; - break; + return SamrSetInformationUser2(UserHandle, + UserInformationClass, + Buffer); +} - case UserGeneralInformation: - DesiredAccess = USER_WRITE_ACCOUNT | - USER_WRITE_PREFERENCES; - break; - case UserPreferencesInformation: - DesiredAccess = USER_WRITE_PREFERENCES; - break; +/* Function 38 */ +NTSTATUS +NTAPI +SamrChangePasswordUser(IN SAMPR_HANDLE UserHandle, + IN unsigned char LmPresent, + IN PENCRYPTED_LM_OWF_PASSWORD OldLmEncryptedWithNewLm, + IN PENCRYPTED_LM_OWF_PASSWORD NewLmEncryptedWithOldLm, + IN unsigned char NtPresent, + IN PENCRYPTED_NT_OWF_PASSWORD OldNtEncryptedWithNewNt, + IN PENCRYPTED_NT_OWF_PASSWORD NewNtEncryptedWithOldNt, + IN unsigned char NtCrossEncryptionPresent, + IN PENCRYPTED_NT_OWF_PASSWORD NewNtEncryptedWithNewLm, + IN unsigned char LmCrossEncryptionPresent, + IN PENCRYPTED_LM_OWF_PASSWORD NewLmEncryptedWithNewNt) +{ + ENCRYPTED_LM_OWF_PASSWORD StoredLmPassword; + ENCRYPTED_NT_OWF_PASSWORD StoredNtPassword; + LM_OWF_PASSWORD OldLmPassword; + LM_OWF_PASSWORD NewLmPassword; + NT_OWF_PASSWORD OldNtPassword; + NT_OWF_PASSWORD NewNtPassword; + BOOLEAN StoredLmPresent = FALSE; + BOOLEAN StoredNtPresent = FALSE; + BOOLEAN StoredLmEmpty = TRUE; + BOOLEAN StoredNtEmpty = TRUE; + PSAM_DB_OBJECT UserObject; + ULONG Length; + SAM_USER_FIXED_DATA UserFixedData; + SAM_DOMAIN_FIXED_DATA DomainFixedData; + LARGE_INTEGER SystemTime; + NTSTATUS Status; - case UserSetPasswordInformation: - case UserInternal1Information: - DesiredAccess = USER_FORCE_PASSWORD_CHANGE; - break; + DBG_UNREFERENCED_LOCAL_VARIABLE(StoredLmPresent); + DBG_UNREFERENCED_LOCAL_VARIABLE(StoredNtPresent); + DBG_UNREFERENCED_LOCAL_VARIABLE(StoredLmEmpty); - case UserAllInformation: - case UserInternal2Information: - DesiredAccess = 0; /* FIXME */ - break; - - default: - return STATUS_INVALID_INFO_CLASS; - } - - RtlAcquireResourceExclusive(&SampResource, - TRUE); - - /* Validate the domain handle */ - Status = SampValidateDbObject(UserHandle, - SamDbUserObject, - DesiredAccess, - &UserObject); - if (!NT_SUCCESS(Status)) - { - TRACE("failed with status 0x%08lx\n", Status); - goto done; - } - - switch (UserInformationClass) - { - case UserGeneralInformation: - Status = SampSetUserGeneral(UserObject, - Buffer); - break; - - case UserPreferencesInformation: - Status = SampSetUserPreferences(UserObject, - Buffer); - break; - - case UserLogonHoursInformation: - Status = SampSetLogonHoursAttribute(UserObject, - &Buffer->LogonHours.LogonHours); - break; - - case UserNameInformation: - Status = SampSetUserName(UserObject, - &Buffer->Name.UserName); - if (!NT_SUCCESS(Status)) - break; - - Status = SampSetObjectAttributeString(UserObject, - L"FullName", - &Buffer->Name.FullName); - break; - - case UserAccountNameInformation: - Status = SampSetUserName(UserObject, - &Buffer->AccountName.UserName); - break; - - case UserFullNameInformation: - Status = SampSetObjectAttributeString(UserObject, - L"FullName", - &Buffer->FullName.FullName); - break; - - case UserPrimaryGroupInformation: - Status = SampSetUserPrimaryGroup(UserObject, - Buffer); - break; - - case UserHomeInformation: - Status = SampSetObjectAttributeString(UserObject, - L"HomeDirectory", - &Buffer->Home.HomeDirectory); - if (!NT_SUCCESS(Status)) - break; - - Status = SampSetObjectAttributeString(UserObject, - L"HomeDirectoryDrive", - &Buffer->Home.HomeDirectoryDrive); - break; - - case UserScriptInformation: - Status = SampSetObjectAttributeString(UserObject, - L"ScriptPath", - &Buffer->Script.ScriptPath); - break; - - case UserProfileInformation: - Status = SampSetObjectAttributeString(UserObject, - L"ProfilePath", - &Buffer->Profile.ProfilePath); - break; - - case UserAdminCommentInformation: - Status = SampSetObjectAttributeString(UserObject, - L"AdminComment", - &Buffer->AdminComment.AdminComment); - break; - - case UserWorkStationsInformation: - Status = SampSetObjectAttributeString(UserObject, - L"WorkStations", - &Buffer->WorkStations.WorkStations); - break; - - case UserSetPasswordInformation: - TRACE("Password: %S\n", Buffer->SetPassword.Password.Buffer); - TRACE("PasswordExpired: %d\n", Buffer->SetPassword.PasswordExpired); - - Status = SampSetObjectAttributeString(UserObject, - L"Password", - &Buffer->SetPassword.Password); - break; - - case UserControlInformation: - Status = SampSetUserControl(UserObject, - Buffer); - break; - - case UserExpiresInformation: - Status = SampSetUserExpires(UserObject, - Buffer); - break; - - case UserInternal1Information: - Status = SampSetUserInternal1(UserObject, - Buffer); - break; - - case UserInternal2Information: - Status = SampSetUserInternal2(UserObject, - Buffer); - break; - - case UserParametersInformation: - Status = SampSetObjectAttributeString(UserObject, - L"Parameters", - &Buffer->Parameters.Parameters); - break; - - case UserAllInformation: - Status = SampSetUserAll(UserObject, - Buffer); - break; - -// case UserInternal4Information: -// case UserInternal5Information: -// case UserInternal4InformationNew: -// case UserInternal5InformationNew: - - default: - Status = STATUS_INVALID_INFO_CLASS; - } - -done: - RtlReleaseResource(&SampResource); - - return Status; -} - - -/* Function 38 */ -NTSTATUS -NTAPI -SamrChangePasswordUser(IN SAMPR_HANDLE UserHandle, - IN unsigned char LmPresent, - IN PENCRYPTED_LM_OWF_PASSWORD OldLmEncryptedWithNewLm, - IN PENCRYPTED_LM_OWF_PASSWORD NewLmEncryptedWithOldLm, - IN unsigned char NtPresent, - IN PENCRYPTED_NT_OWF_PASSWORD OldNtEncryptedWithNewNt, - IN PENCRYPTED_NT_OWF_PASSWORD NewNtEncryptedWithOldNt, - IN unsigned char NtCrossEncryptionPresent, - IN PENCRYPTED_NT_OWF_PASSWORD NewNtEncryptedWithNewLm, - IN unsigned char LmCrossEncryptionPresent, - IN PENCRYPTED_LM_OWF_PASSWORD NewLmEncryptedWithNewNt) -{ - ENCRYPTED_LM_OWF_PASSWORD StoredLmPassword; - ENCRYPTED_NT_OWF_PASSWORD StoredNtPassword; - LM_OWF_PASSWORD OldLmPassword; - LM_OWF_PASSWORD NewLmPassword; - NT_OWF_PASSWORD OldNtPassword; - NT_OWF_PASSWORD NewNtPassword; - BOOLEAN StoredLmPresent = FALSE; - BOOLEAN StoredNtPresent = FALSE; - BOOLEAN StoredLmEmpty = TRUE; - BOOLEAN StoredNtEmpty = TRUE; - PSAM_DB_OBJECT UserObject; - ULONG Length; - SAM_USER_FIXED_DATA UserFixedData; - SAM_DOMAIN_FIXED_DATA DomainFixedData; - LARGE_INTEGER SystemTime; - NTSTATUS Status; - - DBG_UNREFERENCED_LOCAL_VARIABLE(StoredLmPresent); - DBG_UNREFERENCED_LOCAL_VARIABLE(StoredNtPresent); - DBG_UNREFERENCED_LOCAL_VARIABLE(StoredLmEmpty); - - TRACE("SamrChangePasswordUser(%p %u %p %p %u %p %p %u %p %u %p)\n", - UserHandle, LmPresent, OldLmEncryptedWithNewLm, NewLmEncryptedWithOldLm, - NtPresent, OldNtEncryptedWithNewNt, NewNtEncryptedWithOldNt, NtCrossEncryptionPresent, - NewNtEncryptedWithNewLm, LmCrossEncryptionPresent, NewLmEncryptedWithNewNt); + TRACE("SamrChangePasswordUser(%p %u %p %p %u %p %p %u %p %u %p)\n", + UserHandle, LmPresent, OldLmEncryptedWithNewLm, NewLmEncryptedWithOldLm, + NtPresent, OldNtEncryptedWithNewNt, NewNtEncryptedWithOldNt, NtCrossEncryptionPresent, + NewNtEncryptedWithNewLm, LmCrossEncryptionPresent, NewLmEncryptedWithNewNt); RtlAcquireResourceExclusive(&SampResource, TRUE); @@ -8925,42 +8558,220 @@ SamrRemoveMemberFromForeignDomain(IN SAMPR_HANDLE DomainHandle, TRACE("SampRemoveMemberFromAllAliases failed with status 0x%08lx\n", Status); } -done: - RtlReleaseResource(&SampResource); +done: + RtlReleaseResource(&SampResource); + + return Status; +} + + +/* Function 46 */ +NTSTATUS +NTAPI +SamrQueryInformationDomain2(IN SAMPR_HANDLE DomainHandle, + IN DOMAIN_INFORMATION_CLASS DomainInformationClass, + OUT PSAMPR_DOMAIN_INFO_BUFFER *Buffer) +{ + TRACE("SamrQueryInformationDomain2(%p %lu %p)\n", + DomainHandle, DomainInformationClass, Buffer); + + return SamrQueryInformationDomain(DomainHandle, + DomainInformationClass, + Buffer); +} + + +/* Function 47 */ +NTSTATUS +NTAPI +SamrQueryInformationUser2(IN SAMPR_HANDLE UserHandle, + IN USER_INFORMATION_CLASS UserInformationClass, + OUT PSAMPR_USER_INFO_BUFFER *Buffer) +{ + PSAM_DB_OBJECT UserObject; + ACCESS_MASK DesiredAccess; + NTSTATUS Status; + + TRACE("SamrQueryInformationUser2(%p %lu %p)\n", + UserHandle, UserInformationClass, Buffer); + + switch (UserInformationClass) + { + case UserGeneralInformation: + case UserNameInformation: + case UserAccountNameInformation: + case UserFullNameInformation: + case UserPrimaryGroupInformation: + case UserAdminCommentInformation: + DesiredAccess = USER_READ_GENERAL; + break; + + case UserLogonHoursInformation: + case UserHomeInformation: + case UserScriptInformation: + case UserProfileInformation: + case UserWorkStationsInformation: + DesiredAccess = USER_READ_LOGON; + break; + + case UserControlInformation: + case UserExpiresInformation: + case UserParametersInformation: + DesiredAccess = USER_READ_ACCOUNT; + break; + + case UserPreferencesInformation: + DesiredAccess = USER_READ_GENERAL | + USER_READ_PREFERENCES; + break; + + case UserLogonInformation: + case UserAccountInformation: + DesiredAccess = USER_READ_GENERAL | + USER_READ_PREFERENCES | + USER_READ_LOGON | + USER_READ_ACCOUNT; + break; + + case UserInternal1Information: + case UserInternal2Information: + case UserAllInformation: + DesiredAccess = 0; + break; + + default: + return STATUS_INVALID_INFO_CLASS; + } + + RtlAcquireResourceShared(&SampResource, + TRUE); + + /* Validate the domain handle */ + Status = SampValidateDbObject(UserHandle, + SamDbUserObject, + DesiredAccess, + &UserObject); + if (!NT_SUCCESS(Status)) + { + TRACE("failed with status 0x%08lx\n", Status); + goto done; + } + + switch (UserInformationClass) + { + case UserGeneralInformation: + Status = SampQueryUserGeneral(UserObject, + Buffer); + break; + + case UserPreferencesInformation: + Status = SampQueryUserPreferences(UserObject, + Buffer); + break; + + case UserLogonInformation: + Status = SampQueryUserLogon(UserObject, + Buffer); + break; + + case UserLogonHoursInformation: + Status = SampQueryUserLogonHours(UserObject, + Buffer); + break; + + case UserAccountInformation: + Status = SampQueryUserAccount(UserObject, + Buffer); + break; + + case UserNameInformation: + Status = SampQueryUserName(UserObject, + Buffer); + break; + + case UserAccountNameInformation: + Status = SampQueryUserAccountName(UserObject, + Buffer); + break; + + case UserFullNameInformation: + Status = SampQueryUserFullName(UserObject, + Buffer); + break; + + case UserPrimaryGroupInformation: + Status = SampQueryUserPrimaryGroup(UserObject, + Buffer); + break; + + case UserHomeInformation: + Status = SampQueryUserHome(UserObject, + Buffer); + break; + + case UserScriptInformation: + Status = SampQueryUserScript(UserObject, + Buffer); + break; + + case UserProfileInformation: + Status = SampQueryUserProfile(UserObject, + Buffer); + break; + + case UserAdminCommentInformation: + Status = SampQueryUserAdminComment(UserObject, + Buffer); + break; + + case UserWorkStationsInformation: + Status = SampQueryUserWorkStations(UserObject, + Buffer); + break; + + case UserControlInformation: + Status = SampQueryUserControl(UserObject, + Buffer); + break; - return Status; -} + case UserExpiresInformation: + Status = SampQueryUserExpires(UserObject, + Buffer); + break; + case UserInternal1Information: + Status = SampQueryUserInternal1(UserObject, + Buffer); + break; -/* Function 46 */ -NTSTATUS -NTAPI -SamrQueryInformationDomain2(IN SAMPR_HANDLE DomainHandle, - IN DOMAIN_INFORMATION_CLASS DomainInformationClass, - OUT PSAMPR_DOMAIN_INFO_BUFFER *Buffer) -{ - TRACE("SamrQueryInformationDomain2(%p %lu %p)\n", - DomainHandle, DomainInformationClass, Buffer); + case UserInternal2Information: + Status = SampQueryUserInternal2(UserObject, + Buffer); + break; - return SamrQueryInformationDomain(DomainHandle, - DomainInformationClass, + case UserParametersInformation: + Status = SampQueryUserParameters(UserObject, + Buffer); + break; + + case UserAllInformation: + Status = SampQueryUserAll(UserObject, Buffer); -} + break; +// case UserInternal4Information: +// case UserInternal5Information: +// case UserInternal4InformationNew: +// case UserInternal5InformationNew: -/* Function 47 */ -NTSTATUS -NTAPI -SamrQueryInformationUser2(IN SAMPR_HANDLE UserHandle, - IN USER_INFORMATION_CLASS UserInformationClass, - OUT PSAMPR_USER_INFO_BUFFER *Buffer) -{ - TRACE("SamrQueryInformationUser2(%p %lu %p)\n", - UserHandle, UserInformationClass, Buffer); + default: + Status = STATUS_INVALID_INFO_CLASS; + } - return SamrQueryInformationUser(UserHandle, - UserInformationClass, - Buffer); +done: + RtlReleaseResource(&SampResource); + + return Status; } @@ -9658,12 +9469,201 @@ SamrSetInformationUser2(IN SAMPR_HANDLE UserHandle, IN USER_INFORMATION_CLASS UserInformationClass, IN PSAMPR_USER_INFO_BUFFER Buffer) { + PSAM_DB_OBJECT UserObject; + ACCESS_MASK DesiredAccess; + NTSTATUS Status; + TRACE("SamrSetInformationUser2(%p %lu %p)\n", UserHandle, UserInformationClass, Buffer); - return SamrSetInformationUser(UserHandle, - UserInformationClass, - Buffer); + switch (UserInformationClass) + { + case UserLogonHoursInformation: + case UserNameInformation: + case UserAccountNameInformation: + case UserFullNameInformation: + case UserPrimaryGroupInformation: + case UserHomeInformation: + case UserScriptInformation: + case UserProfileInformation: + case UserAdminCommentInformation: + case UserWorkStationsInformation: + case UserControlInformation: + case UserExpiresInformation: + case UserParametersInformation: + DesiredAccess = USER_WRITE_ACCOUNT; + break; + + case UserGeneralInformation: + DesiredAccess = USER_WRITE_ACCOUNT | + USER_WRITE_PREFERENCES; + break; + + case UserPreferencesInformation: + DesiredAccess = USER_WRITE_PREFERENCES; + break; + + case UserSetPasswordInformation: + case UserInternal1Information: + DesiredAccess = USER_FORCE_PASSWORD_CHANGE; + break; + + case UserAllInformation: + case UserInternal2Information: + DesiredAccess = 0; /* FIXME */ + break; + + default: + return STATUS_INVALID_INFO_CLASS; + } + + RtlAcquireResourceExclusive(&SampResource, + TRUE); + + /* Validate the domain handle */ + Status = SampValidateDbObject(UserHandle, + SamDbUserObject, + DesiredAccess, + &UserObject); + if (!NT_SUCCESS(Status)) + { + TRACE("failed with status 0x%08lx\n", Status); + goto done; + } + + switch (UserInformationClass) + { + case UserGeneralInformation: + Status = SampSetUserGeneral(UserObject, + Buffer); + break; + + case UserPreferencesInformation: + Status = SampSetUserPreferences(UserObject, + Buffer); + break; + + case UserLogonHoursInformation: + Status = SampSetLogonHoursAttribute(UserObject, + &Buffer->LogonHours.LogonHours); + break; + + case UserNameInformation: + Status = SampSetUserName(UserObject, + &Buffer->Name.UserName); + if (!NT_SUCCESS(Status)) + break; + + Status = SampSetObjectAttributeString(UserObject, + L"FullName", + &Buffer->Name.FullName); + break; + + case UserAccountNameInformation: + Status = SampSetUserName(UserObject, + &Buffer->AccountName.UserName); + break; + + case UserFullNameInformation: + Status = SampSetObjectAttributeString(UserObject, + L"FullName", + &Buffer->FullName.FullName); + break; + + case UserPrimaryGroupInformation: + Status = SampSetUserPrimaryGroup(UserObject, + Buffer); + break; + + case UserHomeInformation: + Status = SampSetObjectAttributeString(UserObject, + L"HomeDirectory", + &Buffer->Home.HomeDirectory); + if (!NT_SUCCESS(Status)) + break; + + Status = SampSetObjectAttributeString(UserObject, + L"HomeDirectoryDrive", + &Buffer->Home.HomeDirectoryDrive); + break; + + case UserScriptInformation: + Status = SampSetObjectAttributeString(UserObject, + L"ScriptPath", + &Buffer->Script.ScriptPath); + break; + + case UserProfileInformation: + Status = SampSetObjectAttributeString(UserObject, + L"ProfilePath", + &Buffer->Profile.ProfilePath); + break; + + case UserAdminCommentInformation: + Status = SampSetObjectAttributeString(UserObject, + L"AdminComment", + &Buffer->AdminComment.AdminComment); + break; + + case UserWorkStationsInformation: + Status = SampSetObjectAttributeString(UserObject, + L"WorkStations", + &Buffer->WorkStations.WorkStations); + break; + + case UserSetPasswordInformation: + TRACE("Password: %S\n", Buffer->SetPassword.Password.Buffer); + TRACE("PasswordExpired: %d\n", Buffer->SetPassword.PasswordExpired); + + Status = SampSetObjectAttributeString(UserObject, + L"Password", + &Buffer->SetPassword.Password); + break; + + case UserControlInformation: + Status = SampSetUserControl(UserObject, + Buffer); + break; + + case UserExpiresInformation: + Status = SampSetUserExpires(UserObject, + Buffer); + break; + + case UserInternal1Information: + Status = SampSetUserInternal1(UserObject, + Buffer); + break; + + case UserInternal2Information: + Status = SampSetUserInternal2(UserObject, + Buffer); + break; + + case UserParametersInformation: + Status = SampSetObjectAttributeString(UserObject, + L"Parameters", + &Buffer->Parameters.Parameters); + break; + + case UserAllInformation: + Status = SampSetUserAll(UserObject, + Buffer); + break; + +// case UserInternal4Information: +// case UserInternal5Information: +// case UserInternal4InformationNew: +// case UserInternal5InformationNew: + + default: + Status = STATUS_INVALID_INFO_CLASS; + } + +done: + RtlReleaseResource(&SampResource); + + return Status; }
3 years, 5 months
1
0
0
0
[reactos] 01/01: [BROWSEUI] Multithreaded auto-completion (#3794)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e2d8837986e19dd2fdd94…
commit e2d8837986e19dd2fdd943bb8692afb3829de1b8 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sun Jul 11 13:00:00 2021 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Sun Jul 11 13:00:00 2021 +0900 [BROWSEUI] Multithreaded auto-completion (#3794) - Make auto-completion multi-threaded. CORE-9281 --- dll/win32/browseui/CAutoComplete.cpp | 435 +++++++++++++++++++---------------- dll/win32/browseui/CAutoComplete.h | 48 +++- 2 files changed, 279 insertions(+), 204 deletions(-) diff --git a/dll/win32/browseui/CAutoComplete.cpp b/dll/win32/browseui/CAutoComplete.cpp index e7a078c10a3..a6d6bc84817 100644 --- a/dll/win32/browseui/CAutoComplete.cpp +++ b/dll/win32/browseui/CAutoComplete.cpp @@ -21,6 +21,7 @@ */ #include "precomp.h" +#include <process.h> // _beginthreadex /* TODO: @@ -32,7 +33,6 @@ #define CX_LIST 30160 // width of m_hwndList (very wide but alright) #define CY_LIST 288 // maximum height of drop-down window #define CY_ITEM 18 // default height of listview item -#define COMPLETION_TIMEOUT 300 // in milliseconds #define MAX_ITEM_COUNT 1000 // the maximum number of items #define WATCH_TIMER_ID 0xFEEDBEEF // timer ID to watch m_rcEdit #define WATCH_INTERVAL 300 // in milliseconds @@ -53,7 +53,7 @@ static const PREFIX_INFO s_prefixes[] = { L"www.", 4 }, }; -static inline BOOL DropPrefix(const CStringW& str, CStringW& strBody) +static BOOL DropPrefix(const CStringW& str, CStringW& strBody) { for (size_t iPrefix = 0; iPrefix < _countof(s_prefixes); ++iPrefix) { @@ -69,6 +69,21 @@ static inline BOOL DropPrefix(const CStringW& str, CStringW& strBody) return FALSE; } +static BOOL DoesMatch(const CStringW& strTarget, const CStringW& strText) +{ + CStringW strBody; + if (DropPrefix(strTarget, strBody)) + { + if (::StrCmpNIW(strBody, strText, strText.GetLength()) == 0) + return TRUE; + } + else if (::StrCmpNIW(strTarget, strText, strText.GetLength()) == 0) + { + return TRUE; + } + return FALSE; +} + // mouse hook procedure to watch the mouse click //
https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/m…
static LRESULT CALLBACK MouseProc(INT nCode, WPARAM wParam, LPARAM lParam) @@ -291,7 +306,7 @@ LRESULT CAutoComplete::EditWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l return OnEditChar(wParam, lParam); case WM_CUT: case WM_PASTE: case WM_CLEAR: ret = ::DefSubclassProc(hwnd, uMsg, wParam, lParam); // do default - UpdateCompletion(TRUE); + StartCompletion(TRUE); return ret; case WM_GETDLGCODE: ret = ::DefSubclassProc(hwnd, uMsg, wParam, lParam); // do default @@ -640,7 +655,7 @@ CAutoComplete::CAutoComplete() , m_bDowner(TRUE), m_dwOptions(ACO_AUTOAPPEND | ACO_AUTOSUGGEST) , m_bEnabled(TRUE), m_hwndCombo(NULL), m_hFont(NULL), m_bResized(FALSE) , m_hwndEdit(NULL), m_fnOldEditProc(NULL), m_fnOldWordBreakProc(NULL) - , m_bPartialList(FALSE), m_dwTick(0) + , m_hThread(NULL), m_pThread(NULL) { } @@ -658,6 +673,11 @@ HWND CAutoComplete::CreateDropDown() CAutoComplete::~CAutoComplete() { TRACE("CAutoComplete::~CAutoComplete(%p)\n", this); + if (m_hThread) + { + CloseHandle(m_hThread); + m_hThread = NULL; + } if (m_hFont) { ::DeleteObject(m_hFont); @@ -763,7 +783,7 @@ VOID CAutoComplete::SelectItem(INT iItem) m_hwndList.EnsureVisible(iItem, FALSE); } -VOID CAutoComplete::DoAutoAppend() +VOID CAutoComplete::DoAutoAppend(AC_THREAD *pThread) { if (!CanAutoAppend()) // can we auto-append? return; // don't append @@ -772,7 +792,7 @@ VOID CAutoComplete::DoAutoAppend() if (strText.IsEmpty()) return; // don't append - INT cItems = m_innerList.GetSize(); // get the number of items + INT cItems = m_outerList.GetSize(); // get the number of items if (cItems == 0) return; // don't append @@ -781,7 +801,7 @@ VOID CAutoComplete::DoAutoAppend() BOOL bFound = FALSE; for (INT iItem = 0; iItem < cItems; ++iItem) { - const CStringW& strItem = m_innerList[iItem]; // get the text of the item + const CStringW& strItem = m_outerList[iItem]; // get the text of the item CStringW strBody; if (DropPrefix(strItem, strBody) && @@ -950,7 +970,7 @@ BOOL CAutoComplete::OnEditKeyDown(WPARAM wParam, LPARAM lParam) if (!CanAutoSuggest()) return FALSE; // do default ::DefSubclassProc(m_hwndEdit, WM_KEYDOWN, VK_DELETE, 0); // do default - UpdateCompletion(FALSE); + StartCompletion(FALSE); return TRUE; // eat } case VK_BACK: @@ -973,7 +993,7 @@ LRESULT CAutoComplete::OnEditChar(WPARAM wParam, LPARAM lParam) return 0; // eat LRESULT ret = ::DefSubclassProc(m_hwndEdit, WM_CHAR, wParam, lParam); // do default if (CanAutoSuggest() || CanAutoAppend()) - UpdateCompletion(wParam != VK_BACK); + StartCompletion(wParam != VK_BACK); return ret; } @@ -1212,7 +1232,8 @@ STDMETHODIMP CAutoComplete::ResetEnumerator() FIXME("(%p): stub\n", this); Reset(); - m_innerList.RemoveAll(); + m_hwndList.SendMessageW(LVM_SETITEMCOUNT, 0, 0); + m_outerList.RemoveAll(); return S_OK; } @@ -1444,217 +1465,59 @@ VOID CAutoComplete::RepositionDropDown() ShowWindow(SW_SHOWNOACTIVATE); } -inline BOOL -CAutoComplete::DoesMatch(const CStringW& strTarget, const CStringW& strText) const +VOID +CAutoComplete::ExtractInnerList(CSimpleArray<CStringW>& outerList, + const CSimpleArray<CStringW>& innerList, + const CString& strText) { - CStringW strBody; - if (DropPrefix(strTarget, strBody)) - { - if (::StrCmpNIW(strBody, strText, strText.GetLength()) == 0) - return TRUE; - } - else if (::StrCmpNIW(strTarget, strText, strText.GetLength()) == 0) + for (INT iItem = 0; iItem < innerList.GetSize(); ++iItem) { - return TRUE; - } - return FALSE; -} + if (m_pThread || !m_hThread) + break; -VOID CAutoComplete::ScrapeOffList(const CStringW& strText, CSimpleArray<CStringW>& array) -{ - for (INT iItem = array.GetSize() - 1; iItem >= 0; --iItem) - { - if (!DoesMatch(array[iItem], strText)) - array.RemoveAt(iItem); + const CStringW& strTarget = innerList[iItem]; + if (DoesMatch(strTarget, strText)) + { + outerList.Add(strTarget); + + if (outerList.GetSize() >= MAX_ITEM_COUNT) + break; + } } } -VOID CAutoComplete::ReLoadInnerList(const CStringW& strText) +VOID CAutoComplete::ReLoadInnerList(PAC_THREAD pThread) { - m_innerList.RemoveAll(); // clear contents - m_bPartialList = FALSE; + pThread->m_innerList.RemoveAll(); // clear contents - if (!m_pEnum || strText.IsEmpty()) + if (!m_pEnum || pThread->m_strText.IsEmpty()) return; // reload the items LPWSTR pszItem; ULONG cGot; - CStringW strTarget; HRESULT hr; - for (;;) + CSimpleArray<CStringW>& innerList = pThread->m_innerList; + while (!m_pThread && m_hThread) { // get next item hr = m_pEnum->Next(1, &pszItem, &cGot); - //TRACE("m_pEnum->Next(%p): 0x%08lx\n", reinterpret_cast<IUnknown *>(m_pEnum), hr); if (hr != S_OK) break; - strTarget = pszItem; + innerList.Add(pszItem); // append item to innerList ::CoTaskMemFree(pszItem); // free - - if (m_bPartialList) // if items are too many - { - // do filter the items - if (DoesMatch(strTarget, strText)) - { - m_innerList.Add(strTarget); - - if (m_innerList.GetSize() >= MAX_ITEM_COUNT) - break; - } - } - else - { - m_innerList.Add(strTarget); // append item to m_innerList - - // if items are too many - if (m_innerList.GetSize() >= MAX_ITEM_COUNT) - { - // filter the items now - m_bPartialList = TRUE; - ScrapeOffList(strText, m_innerList); - - if (m_innerList.GetSize() >= MAX_ITEM_COUNT) - break; - } - } - - // check the timeout - if (::GetTickCount() - m_dwTick >= COMPLETION_TIMEOUT) - break; // too late } } -// update inner list and m_strText and m_strStemText -VOID CAutoComplete::UpdateInnerList(const CStringW& strText) +VOID CAutoComplete::StartCompletion(BOOL bAppendOK) { - BOOL bReset = FALSE, bExpand = FALSE; // flags - - // if previous text was empty - if (m_strText.IsEmpty()) - { - bReset = TRUE; - } - // save text - m_strText = strText; - - // do expand the items if the stem is changed - CStringW strStemText = GetStemText(strText); - if (m_strStemText.CompareNoCase(strStemText) != 0) - { - m_strStemText = strStemText; - bReset = TRUE; - bExpand = !m_strStemText.IsEmpty(); - } - - // if the previous enumeration is too large - if (m_bPartialList) - bReset = bExpand = TRUE; // retry enumeratation - - // reset if necessary - if (bReset && m_pEnum) - { - HRESULT hr = m_pEnum->Reset(); // IEnumString::Reset - TRACE("m_pEnum->Reset(%p): 0x%08lx\n", - static_cast<IUnknown *>(m_pEnum), hr); - } - - // update ac list if necessary - if (bExpand && m_pACList) - { - HRESULT hr = m_pACList->Expand(strStemText); // IACList::Expand - TRACE("m_pACList->Expand(%p, %S): 0x%08lx\n", - static_cast<IUnknown *>(m_pACList), - static_cast<LPCWSTR>(strStemText), hr); - } - - if (bExpand || m_innerList.GetSize() == 0) - { - // reload the inner list - ReLoadInnerList(strText); - } -} + TRACE("CAutoComplete::StartCompletion(%p, %d)\n", this, bAppendOK); -VOID CAutoComplete::UpdateOuterList(const CStringW& strText) -{ - if (strText.IsEmpty()) - { - m_outerList.RemoveAll(); + if (!m_pEnum || (!CanAutoSuggest() && !CanAutoAppend())) return; - } - - if (m_bPartialList) - { - // it is already filtered - m_outerList = m_innerList; - } - else - { - // do filtering - m_outerList.RemoveAll(); - for (INT iItem = 0; iItem < m_innerList.GetSize(); ++iItem) - { - const CStringW& strTarget = m_innerList[iItem]; - - if (DoesMatch(strTarget, strText)) - m_outerList.Add(strTarget); - // check the timeout - if (::GetTickCount() - m_dwTick >= COMPLETION_TIMEOUT) - break; // too late - } - } - - if (::GetTickCount() - m_dwTick < COMPLETION_TIMEOUT) - { - // sort and unique - DoSort(m_outerList); - DoUniqueAndTrim(m_outerList); - } - - // set the item count of the virtual listview - m_hwndList.SendMessageW(LVM_SETITEMCOUNT, m_outerList.GetSize(), 0); -} - -VOID CAutoComplete::UpdateCompletion(BOOL bAppendOK) -{ - TRACE("CAutoComplete::UpdateCompletion(%p, %d)\n", this, bAppendOK); - - m_dwTick = GetTickCount(); // to check the timeout - - CStringW strText = GetEditText(); - if (m_strText.CompareNoCase(strText) == 0) - { - // no change - return; - } - - // update inner list - UpdateInnerList(strText); - if (m_innerList.GetSize() <= 0) // no items - { - HideDropDown(); - return; - } - - if (CanAutoSuggest()) // can we auto-suggest? - { - m_bInSelectItem = TRUE; // don't respond - SelectItem(-1); // select none - m_bInSelectItem = FALSE; - - UpdateOuterList(strText); - if (m_outerList.GetSize() > 0) - RepositionDropDown(); - else - HideDropDown(); - } - - if (CanAutoAppend() && bAppendOK) // can we auto-append? - { - DoAutoAppend(); - } + ::SendMessageW(m_hWnd, AUTOCOMP_START, bAppendOK, 0); } ////////////////////////////////////////////////////////////////////////////// @@ -2116,3 +1979,189 @@ LRESULT CAutoComplete::OnVScroll(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & } return 0; } + +static inline PAC_THREAD +InterlockedExchangeThreadData(volatile PAC_THREAD *Target, PAC_THREAD Value) +{ + return reinterpret_cast<PAC_THREAD>( + ::InterlockedExchangePointer(reinterpret_cast<volatile PVOID *>(Target), Value)); +} + +static unsigned __stdcall AutoCompThreadProc(void *arg) +{ + CAutoComplete* pThis = reinterpret_cast<CAutoComplete*>(arg); + pThis->AutoCompThreadProc(); + return 0; +} + +VOID CAutoComplete::AutoCompThreadProc() +{ + for (;;) + { + PAC_THREAD pThread = InterlockedExchangeThreadData(&m_pThread, NULL); + if (!pThread) + break; + DoThreadWork(pThread); + } +} + +VOID CAutoComplete::DoThreadWork(PAC_THREAD pThread) +{ + if (pThread->m_bExpand || m_innerList.GetSize() == 0) + { + ReLoadInnerList(pThread); + } + else + { + pThread->m_innerList = m_innerList; + } + + if (m_pThread || !m_hThread) + { + delete pThread; + return; + } + + ExtractInnerList(pThread->m_outerList, pThread->m_innerList, pThread->m_strText); + + if (m_pThread || !m_hThread) + { + delete pThread; + return; + } + + DoSort(pThread->m_outerList); + DoUniqueAndTrim(pThread->m_outerList); + + if (m_pThread || !m_hThread || + !::PostMessageW(m_hWnd, AUTOCOMP_FINISH, 0, (LPARAM)pThread)) + { + delete pThread; + } +} + +// AUTOCOMP_START +LRESULT CAutoComplete::OnAutoCompStart(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) +{ + BOOL bAppendOK = (BOOL)wParam; + + CStringW strText = GetEditText(); + if (m_strText.CompareNoCase(strText) == 0) + { + // no change + return 0; + } + + PAC_THREAD pThread = new AC_THREAD { this, bAppendOK, strText }; + + // if previous text was empty + if (m_strText.IsEmpty()) + { + pThread->m_bReset = TRUE; + } + m_strText = strText; + + // do expand the items if the stem is changed + CStringW strStemText = GetStemText(pThread->m_strText); + if (m_strStemText.CompareNoCase(strStemText) != 0) + { + pThread->m_bReset = TRUE; + pThread->m_bExpand = !strStemText.IsEmpty(); + m_strStemText = strStemText; + } + + // reset if necessary + if (pThread->m_bReset && m_pEnum) + { + HRESULT hr = m_pEnum->Reset(); // IEnumString::Reset + TRACE("m_pEnum->Reset(%p): 0x%08lx\n", + static_cast<IUnknown *>(m_pEnum), hr); + } + + // update ac list if necessary + if (pThread->m_bExpand && m_pACList) + { + HRESULT hr = m_pACList->Expand(strStemText); // IACList::Expand + TRACE("m_pACList->Expand(%p, %S): 0x%08lx\n", + static_cast<IUnknown *>(m_pACList), + static_cast<LPCWSTR>(strStemText), hr); + } + + PAC_THREAD pOld = InterlockedExchangeThreadData(&m_pThread, pThread); + if (pOld) + delete pOld; + + BOOL bDoStart = FALSE; + DWORD dwWait = WaitForSingleObject(m_hThread, 0); + if (dwWait != WAIT_TIMEOUT) + { + CloseHandle(m_hThread); + bDoStart = TRUE; + } + else if (!m_hThread) + { + bDoStart = TRUE; + } + + if (bDoStart) + m_hThread = (HANDLE)_beginthreadex(NULL, 0, ::AutoCompThreadProc, this, 0, NULL); + + return 0; +} + +// AUTOCOMP_FINISH +LRESULT CAutoComplete::OnAutoCompFinish(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) +{ + PAC_THREAD pThread = reinterpret_cast<PAC_THREAD>(lParam); + if (m_pThread == NULL) + { + FinishCompletion(pThread); + } + CloseHandle(m_hThread); + m_hThread = NULL; + delete pThread; + return 0; +} + +VOID CAutoComplete::FinishCompletion(PAC_THREAD pThread) +{ + if (m_pThread || !m_hThread) + return; + + if (!CanAutoSuggest() && !CanAutoAppend()) + return; + + if (m_pThread || !m_hThread) + return; + + // set inner list + m_innerList = pThread->m_innerList; + + if (m_pThread || !m_hThread) + return; + + // set the items of the virtual listview + m_outerList = pThread->m_outerList; // FIXME: We need more speed! + m_hwndList.SendMessageW(LVM_SETITEMCOUNT, m_outerList.GetSize(), 0); + + // save text + m_strText = pThread->m_strText; + m_strStemText = GetStemText(m_strText); + + if (CanAutoSuggest()) // can we auto-suggest? + { + m_bInSelectItem = TRUE; // don't respond + SelectItem(-1); // select none + m_bInSelectItem = FALSE; + + if (m_outerList.GetSize() > 0) + RepositionDropDown(); + else + HideDropDown(); + } + + if (CanAutoAppend() && pThread->m_bAppendOK) // can we auto-append? + { + DoAutoAppend(pThread); + } +} diff --git a/dll/win32/browseui/CAutoComplete.h b/dll/win32/browseui/CAutoComplete.h index 51ef81b135a..586a878d154 100644 --- a/dll/win32/browseui/CAutoComplete.h +++ b/dll/win32/browseui/CAutoComplete.h @@ -116,11 +116,30 @@ protected: LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); }; +////////////////////////////////////////////////////////////////////////////// +// AC_THREAD --- Thread data for CAutoComplete + +typedef struct AC_THREAD +{ + CAutoComplete *m_pThis; + BOOL m_bAppendOK; + CStringW m_strText; + CSimpleArray<CStringW> m_innerList; // internal list + CSimpleArray<CStringW> m_outerList; // outer list + BOOL m_bReset; + BOOL m_bExpand; + + VOID ReLoadInnerList(const CStringW& strText); +} AC_THREAD, *PAC_THREAD; + ////////////////////////////////////////////////////////////////////////////// // CAutoComplete --- auto-completion drop-down window #define WC_DROPDOWNW L"Auto-Suggest Dropdown" // the window class name +#define AUTOCOMP_START (WM_USER + 1) +#define AUTOCOMP_FINISH (WM_USER + 2) + class CAutoComplete : public CComCoClass<CAutoComplete, &CLSID_AutoComplete> , public CComObjectRootEx<CComMultiThreadModelNoCS> @@ -156,10 +175,15 @@ public: VOID ShowDropDown(); VOID HideDropDown(); VOID SelectItem(INT iItem); - VOID DoAutoAppend(); + VOID DoAutoAppend(PAC_THREAD pThread); + VOID DoThreadWork(PAC_THREAD pThread); VOID DoBackWord(); VOID UpdateScrollBar(); + VOID StartCompletion(BOOL bAppendOK); + VOID AutoCompThreadProc(); + VOID FinishCompletion(PAC_THREAD pThread); + LRESULT EditWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); LRESULT OnEditChar(WPARAM wParam, LPARAM lParam); BOOL OnEditKeyDown(WPARAM wParam, LPARAM lParam); @@ -194,8 +218,8 @@ protected: HWND m_hwndEdit; // the textbox WNDPROC m_fnOldEditProc; // old textbox procedure EDITWORDBREAKPROCW m_fnOldWordBreakProc; - BOOL m_bPartialList; // is the list partial? - DWORD m_dwTick; // to check timeout + HANDLE m_hThread; + AC_THREAD *m_pThread; // The following variables are non-POD: CStringW m_strText; // internal text (used in selecting item and reverting text) CStringW m_strStemText; // dirname + '\\' @@ -205,22 +229,22 @@ protected: CACSizeBox m_hwndSizeBox; // the size grip CComPtr<IEnumString> m_pEnum; // used for enumeration CComPtr<IACList> m_pACList; // for IACList::Expand to update the list - CSimpleArray<CStringW> m_innerList; // internal list - CSimpleArray<CStringW> m_outerList; // owner data for virtual listview + CSimpleArray<CStringW> m_innerList; // inner list + CSimpleArray<CStringW> m_outerList; // outer list // protected methods VOID UpdateDropDownState(); VOID CalcRects(BOOL bDowner, RECT& rcListView, RECT& rcScrollBar, RECT& rcSizeBox) const; VOID LoadQuickComplete(LPCWSTR pwszRegKeyPath, LPCWSTR pwszQuickComplete); CStringW GetQuickEdit(LPCWSTR pszText) const; VOID RepositionDropDown(); - VOID ReLoadInnerList(const CStringW& strText); - VOID UpdateInnerList(const CStringW& strText); - VOID UpdateOuterList(const CStringW& strText); - VOID UpdateCompletion(BOOL bAppendOK); - VOID ScrapeOffList(const CStringW& strText, CSimpleArray<CStringW>& array); - BOOL DoesMatch(const CStringW& strTarget, const CStringW& strText) const; + VOID ReLoadInnerList(PAC_THREAD pThread); + VOID ExtractInnerList(CSimpleArray<CStringW>& outerList, + const CSimpleArray<CStringW>& innerList, + const CString& strText); // message map BEGIN_MSG_MAP(CAutoComplete) + MESSAGE_HANDLER(AUTOCOMP_START, OnAutoCompStart) + MESSAGE_HANDLER(AUTOCOMP_FINISH, OnAutoCompFinish) MESSAGE_HANDLER(WM_CREATE, OnCreate) MESSAGE_HANDLER(WM_NCDESTROY, OnNCDestroy) MESSAGE_HANDLER(WM_DRAWITEM, OnDrawItem) @@ -253,6 +277,8 @@ protected: LRESULT OnShowWindow(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); LRESULT OnVScroll(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); + LRESULT OnAutoCompStart(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); + LRESULT OnAutoCompFinish(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); DECLARE_REGISTRY_RESOURCEID(IDR_AUTOCOMPLETE) DECLARE_NOT_AGGREGATABLE(CAutoComplete)
3 years, 5 months
1
0
0
0
[reactos] 01/01: [IMM32] Add some candidate handlings (#3799)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=92393a75176f0f49f33b9…
commit 92393a75176f0f49f33b90333ebc78afeaf49ba0 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sun Jul 11 09:48:15 2021 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Sun Jul 11 09:48:15 2021 +0900 [IMM32] Add some candidate handlings (#3799) - Implement ImmGetCandidateListA and ImmGetCandidateListW, by using newly added ImmGetCandidateListAW function. - Implement ImmLockClientImc and ImmUnlockClientImc functions. - Modify imm32.spec. - Remove #ifdef's. CORE-11700 --- dll/win32/imm32/imm.c | 563 +++++++++++++++++++++++--------------- dll/win32/imm32/imm32.spec | 4 +- media/doc/WINESYNC.txt | 2 +- sdk/include/reactos/imm32_undoc.h | 20 +- win32ss/include/ntuser.h | 7 +- win32ss/user/ntuser/misc.c | 3 + win32ss/user/ntuser/ntstubs.c | 6 +- 7 files changed, 373 insertions(+), 232 deletions(-) diff --git a/dll/win32/imm32/imm.c b/dll/win32/imm32/imm.c index e26e6872f3c..e7ad9746680 100644 --- a/dll/win32/imm32/imm.c +++ b/dll/win32/imm32/imm.c @@ -22,28 +22,25 @@ #include <stdarg.h> #include <stdio.h> -#ifdef __REACTOS__ #define WIN32_NO_STATUS -#endif -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "winerror.h" -#include "wine/debug.h" -#include "imm.h" -#include "ddk/imm.h" -#include "winnls.h" -#include "winreg.h" -#include "wine/list.h" -#ifdef __REACTOS__ +#include <windef.h> +#include <winbase.h> +#include <wingdi.h> +#include <winuser.h> +#include <winerror.h> +#include <wine/debug.h> +#include <imm.h> +#include <ddk/imm.h> +#include <winnls.h> +#include <winreg.h> +#include <wine/list.h> #include <stdlib.h> #include <ndk/umtypes.h> #include <ndk/pstypes.h> +#include <ndk/rtlfuncs.h> #include "../../../win32ss/include/ntuser.h" #include <imm32_undoc.h> #include <strsafe.h> -#endif WINE_DEFAULT_DEBUG_CHANNEL(imm); @@ -853,19 +850,7 @@ BOOL WINAPI ImmDestroyContext(HIMC hIMC) */ BOOL WINAPI ImmDisableIME(DWORD idThread) { -#ifdef __REACTOS__ return NtUserDisableThreadIme(idThread); -#else - if (idThread == (DWORD)-1) - disable_ime = TRUE; - else { - IMMThreadData *thread_data = IMM_GetThreadData(NULL, idThread); - if (!thread_data) return FALSE; - thread_data->disableIME = TRUE; - LeaveCriticalSection(&threaddata_cs); - } - return TRUE; -#endif } /*********************************************************************** @@ -1017,45 +1002,323 @@ LRESULT WINAPI ImmEscapeW( return 0; } -/*********************************************************************** - * ImmGetCandidateListA (IMM32.@) - */ -DWORD WINAPI ImmGetCandidateListA( - HIMC hIMC, DWORD dwIndex, - LPCANDIDATELIST lpCandList, DWORD dwBufLen) +#define ROUNDUP4(n) (((n) + 3) & ~3) /* DWORD alignment */ + +HANDLE g_hImm32Heap = NULL; + +LPVOID APIENTRY Imm32HeapAlloc(DWORD dwFlags, DWORD dwBytes) +{ + if (!g_hImm32Heap) + { + g_hImm32Heap = GetProcessHeap(); // FIXME: Use TEB + if (g_hImm32Heap == NULL) + return NULL; + } + return HeapAlloc(g_hImm32Heap, dwFlags, dwBytes); +} + +static DWORD_PTR APIENTRY +Imm32GetThreadState(DWORD Routine) +{ + return NtUserGetThreadState(Routine); +} + +static DWORD APIENTRY +Imm32UpdateInputContext(HIMC hIMC, DWORD Unknown1, PCLIENTIMC pClientImc) +{ + return NtUserUpdateInputContext(hIMC, Unknown1, pClientImc); +} + +static PCLIENTIMC APIENTRY Imm32GetClientImcCache(void) +{ + // FIXME: Do something properly here + return NULL; +} + +PCLIENTIMC WINAPI ImmLockClientImc(HIMC hImc) +{ + PCLIENTIMC pClientImc; + + TRACE("ImmLockClientImc(%p)\n", hImc); + + if (hImc == NULL) + return NULL; + + pClientImc = Imm32GetClientImcCache(); + if (!pClientImc) + { + pClientImc = Imm32HeapAlloc(HEAP_ZERO_MEMORY, sizeof(CLIENTIMC)); + if (!pClientImc) + return NULL; + + RtlInitializeCriticalSection(&pClientImc->cs); + pClientImc->unknown = Imm32GetThreadState(THREADSTATE_UNKNOWN13); + + if (!Imm32UpdateInputContext(hImc, 0, pClientImc)) + { + HeapFree(g_hImm32Heap, 0, pClientImc); + return NULL; + } + + pClientImc->dwFlags |= CLIENTIMC_UNKNOWN2; + } + else + { + if (pClientImc->dwFlags & CLIENTIMC_DISABLED) + return NULL; + } + + InterlockedIncrement(&pClientImc->cLockObj); + return pClientImc; +} + +VOID WINAPI ImmUnlockClientImc(PCLIENTIMC pClientImc) +{ + LONG cLocks; + HIMC hImc; + + TRACE("ImmUnlockClientImc(%p)\n", pClientImc); + + cLocks = InterlockedDecrement(&pClientImc->cLockObj); + if (cLocks != 0 || (pClientImc->dwFlags & CLIENTIMC_DISABLED)) + return; + + hImc = pClientImc->hImc; + if (hImc) + LocalFree(hImc); + + RtlDeleteCriticalSection(&pClientImc->cs); + HeapFree(g_hImm32Heap, 0, pClientImc); +} + +static DWORD APIENTRY +CandidateListWideToAnsi(const CANDIDATELIST *pWideCL, LPCANDIDATELIST pAnsiCL, DWORD dwBufLen, + UINT uCodePage) +{ + BOOL bUsedDefault; + DWORD dwSize, dwIndex, cbGot, cbLeft; + const BYTE *pbWide; + LPBYTE pbAnsi; + LPDWORD pibOffsets; + + /* calculate total ansi size */ + if (pWideCL->dwCount > 0) + { + dwSize = sizeof(CANDIDATELIST) + ((pWideCL->dwCount - 1) * sizeof(DWORD)); + for (dwIndex = 0; dwIndex < pWideCL->dwCount; ++dwIndex) + { + pbWide = (const BYTE *)pWideCL + pWideCL->dwOffset[dwIndex]; + cbGot = WideCharToMultiByte(uCodePage, 0, (LPCWSTR)pbWide, -1, NULL, 0, + NULL, &bUsedDefault); + dwSize += cbGot; + } + } + else + { + dwSize = sizeof(CANDIDATELIST); + } + + dwSize = ROUNDUP4(dwSize); + if (dwBufLen == 0) + return dwSize; + if (dwBufLen < dwSize) + return 0; + + /* store to ansi */ + pAnsiCL->dwSize = dwBufLen; + pAnsiCL->dwStyle = pWideCL->dwStyle; + pAnsiCL->dwCount = pWideCL->dwCount; + pAnsiCL->dwSelection = pWideCL->dwSelection; + pAnsiCL->dwPageStart = pWideCL->dwPageStart; + pAnsiCL->dwPageSize = pWideCL->dwPageSize; + + pibOffsets = pAnsiCL->dwOffset; + if (pWideCL->dwCount > 0) + { + pibOffsets[0] = sizeof(CANDIDATELIST) + ((pWideCL->dwCount - 1) * sizeof(DWORD)); + cbLeft = dwBufLen - pibOffsets[0]; + + for (dwIndex = 0; dwIndex < pWideCL->dwCount; ++dwIndex) + { + pbWide = (const BYTE *)pWideCL + pWideCL->dwOffset[dwIndex]; + pbAnsi = (LPBYTE)pAnsiCL + pibOffsets[dwIndex]; + + /* convert to ansi */ + cbGot = WideCharToMultiByte(uCodePage, 0, (LPCWSTR)pbWide, -1, + (LPSTR)pbAnsi, cbLeft, NULL, &bUsedDefault); + cbLeft -= cbGot; + + if (dwIndex < pWideCL->dwCount - 1) + pibOffsets[dwIndex + 1] = pibOffsets[dwIndex] + cbGot; + } + } + else + { + pibOffsets[0] = sizeof(CANDIDATELIST); + } + + return dwBufLen; +} + +static DWORD APIENTRY +CandidateListAnsiToWide(const CANDIDATELIST *pAnsiCL, LPCANDIDATELIST pWideCL, DWORD dwBufLen, + UINT uCodePage) +{ + DWORD dwSize, dwIndex, cchGot, cbGot, cbLeft; + const BYTE *pbAnsi; + LPBYTE pbWide; + LPDWORD pibOffsets; + + /* calculate total wide size */ + if (pAnsiCL->dwCount > 0) + { + dwSize = sizeof(CANDIDATELIST) + ((pAnsiCL->dwCount - 1) * sizeof(DWORD)); + for (dwIndex = 0; dwIndex < pAnsiCL->dwCount; ++dwIndex) + { + pbAnsi = (const BYTE *)pAnsiCL + pAnsiCL->dwOffset[dwIndex]; + cchGot = MultiByteToWideChar(uCodePage, MB_PRECOMPOSED, (LPCSTR)pbAnsi, -1, NULL, 0); + dwSize += cchGot * sizeof(WCHAR); + } + } + else + { + dwSize = sizeof(CANDIDATELIST); + } + + dwSize = ROUNDUP4(dwSize); + if (dwBufLen == 0) + return dwSize; + if (dwBufLen < dwSize) + return 0; + + /* store to wide */ + pWideCL->dwSize = dwBufLen; + pWideCL->dwStyle = pAnsiCL->dwStyle; + pWideCL->dwCount = pAnsiCL->dwCount; + pWideCL->dwSelection = pAnsiCL->dwSelection; + pWideCL->dwPageStart = pAnsiCL->dwPageStart; + pWideCL->dwPageSize = pAnsiCL->dwPageSize; + + pibOffsets = pWideCL->dwOffset; + if (pAnsiCL->dwCount > 0) + { + pibOffsets[0] = sizeof(CANDIDATELIST) + ((pWideCL->dwCount - 1) * sizeof(DWORD)); + cbLeft = dwBufLen - pibOffsets[0]; + + for (dwIndex = 0; dwIndex < pAnsiCL->dwCount; ++dwIndex) + { + pbAnsi = (const BYTE *)pAnsiCL + pAnsiCL->dwOffset[dwIndex]; + pbWide = (LPBYTE)pWideCL + pibOffsets[dwIndex]; + + /* convert to wide */ + cchGot = MultiByteToWideChar(uCodePage, MB_PRECOMPOSED, (LPCSTR)pbAnsi, -1, + (LPWSTR)pbWide, cbLeft / sizeof(WCHAR)); + cbGot = cchGot * sizeof(WCHAR); + cbLeft -= cbGot; + + if (dwIndex + 1 < pAnsiCL->dwCount) + pibOffsets[dwIndex + 1] = pibOffsets[dwIndex] + cbGot; + } + } + else + { + pibOffsets[0] = sizeof(CANDIDATELIST); + } + + return dwBufLen; +} + +static DWORD APIENTRY +ImmGetCandidateListAW(HIMC hIMC, DWORD dwIndex, LPCANDIDATELIST lpCandList, DWORD dwBufLen, + BOOL bAnsi) { - InputContextData *data = get_imc_data(hIMC); - LPCANDIDATEINFO candinfo; - LPCANDIDATELIST candlist; DWORD ret = 0; + LPINPUTCONTEXT pIC; + PCLIENTIMC pClientImc; + LPCANDIDATEINFO pCI; + LPCANDIDATELIST pCL; + DWORD dwSize; - TRACE("%p, %d, %p, %d\n", hIMC, dwIndex, lpCandList, dwBufLen); + pClientImc = ImmLockClientImc(hIMC); + if (!pClientImc) + return 0; - if (!data || !data->IMC.hCandInfo) - return 0; + pIC = ImmLockIMC(hIMC); + if (pIC == NULL) + { + ImmUnlockClientImc(pClientImc); + return 0; + } - candinfo = ImmLockIMCC(data->IMC.hCandInfo); - if (dwIndex >= candinfo->dwCount || dwIndex >= ARRAY_SIZE(candinfo->dwOffset)) - goto done; + pCI = ImmLockIMCC(pIC->hCandInfo); + if (pCI == NULL) + { + ImmUnlockIMC(hIMC); + ImmUnlockClientImc(pClientImc); + return 0; + } - candlist = (LPCANDIDATELIST)((LPBYTE)candinfo + candinfo->dwOffset[dwIndex]); - if ( !candlist->dwSize || !candlist->dwCount ) - goto done; + if (pCI->dwSize < sizeof(CANDIDATEINFO) || pCI->dwCount <= dwIndex) + goto Quit; - if ( !is_himc_ime_unicode(data) ) + /* get required size */ + pCL = (LPCANDIDATELIST)((LPBYTE)pCI + pCI->dwOffset[dwIndex]); + if (bAnsi) { - ret = candlist->dwSize; - if ( lpCandList && dwBufLen >= ret ) - memcpy(lpCandList, candlist, ret); + if (pClientImc->dwFlags & CLIENTIMC_WIDE) + dwSize = CandidateListAnsiToWide(pCL, NULL, 0, CP_ACP); + else + dwSize = pCL->dwSize; } else - ret = convert_candidatelist_WtoA( candlist, lpCandList, dwBufLen); + { + if (pClientImc->dwFlags & CLIENTIMC_WIDE) + dwSize = pCL->dwSize; + else + dwSize = CandidateListWideToAnsi(pCL, NULL, 0, CP_ACP); + } -done: - ImmUnlockIMCC(data->IMC.hCandInfo); + if (dwBufLen != 0 && dwSize != 0) + { + if (lpCandList == NULL || dwBufLen < dwSize) + goto Quit; + + /* store */ + if (bAnsi) + { + if (pClientImc->dwFlags & CLIENTIMC_WIDE) + CandidateListAnsiToWide(pCL, lpCandList, dwSize, CP_ACP); + else + RtlCopyMemory(lpCandList, pCL, dwSize); + } + else + { + if (pClientImc->dwFlags & CLIENTIMC_WIDE) + RtlCopyMemory(lpCandList, pCL, dwSize); + else + CandidateListWideToAnsi(pCL, lpCandList, dwSize, CP_ACP); + } + } + + ret = dwSize; + +Quit: + ImmUnlockIMCC(pIC->hCandInfo); + ImmUnlockIMC(hIMC); + ImmUnlockClientImc(pClientImc); return ret; } +/*********************************************************************** + * ImmGetCandidateListA (IMM32.@) + */ +DWORD WINAPI ImmGetCandidateListA( + HIMC hIMC, DWORD dwIndex, + LPCANDIDATELIST lpCandList, DWORD dwBufLen) +{ + return ImmGetCandidateListAW(hIMC, dwIndex, lpCandList, dwBufLen, TRUE); +} + /*********************************************************************** * ImmGetCandidateListCountA (IMM32.@) */ @@ -1127,36 +1390,7 @@ DWORD WINAPI ImmGetCandidateListW( HIMC hIMC, DWORD dwIndex, LPCANDIDATELIST lpCandList, DWORD dwBufLen) { - InputContextData *data = get_imc_data(hIMC); - LPCANDIDATEINFO candinfo; - LPCANDIDATELIST candlist; - DWORD ret = 0; - - TRACE("%p, %d, %p, %d\n", hIMC, dwIndex, lpCandList, dwBufLen); - - if (!data || !data->IMC.hCandInfo) - return 0; - - candinfo = ImmLockIMCC(data->IMC.hCandInfo); - if (dwIndex >= candinfo->dwCount || dwIndex >= ARRAY_SIZE(candinfo->dwOffset)) - goto done; - - candlist = (LPCANDIDATELIST)((LPBYTE)candinfo + candinfo->dwOffset[dwIndex]); - if ( !candlist->dwSize || !candlist->dwCount ) - goto done; - - if ( is_himc_ime_unicode(data) ) - { - ret = candlist->dwSize; - if ( lpCandList && dwBufLen >= ret ) - memcpy(lpCandList, candlist, ret); - } - else - ret = convert_candidatelist_AtoW( candlist, lpCandList, dwBufLen); - -done: - ImmUnlockIMCC(data->IMC.hCandInfo); - return ret; + return ImmGetCandidateListAW(hIMC, dwIndex, lpCandList, dwBufLen, FALSE); } /*********************************************************************** @@ -1641,7 +1875,6 @@ DWORD WINAPI ImmGetConversionListW( BOOL WINAPI ImmGetConversionStatus( HIMC hIMC, LPDWORD lpfdwConversion, LPDWORD lpfdwSentence) { -#ifdef __REACTOS__ LPINPUTCONTEXT pIC; TRACE("ImmGetConversionStatus(%p %p %p)\n", hIMC, lpfdwConversion, lpfdwSentence); @@ -1657,21 +1890,6 @@ BOOL WINAPI ImmGetConversionStatus( ImmUnlockIMC(hIMC); return TRUE; -#else - InputContextData *data = get_imc_data(hIMC); - - TRACE("%p %p %p\n", hIMC, lpfdwConversion, lpfdwSentence); - - if (!data) - return FALSE; - - if (lpfdwConversion) - *lpfdwConversion = data->IMC.fdwConversion; - if (lpfdwSentence) - *lpfdwSentence = data->IMC.fdwSentence; - - return TRUE; -#endif } static BOOL needs_ime_window(HWND hwnd) @@ -1786,13 +2004,12 @@ HWND WINAPI ImmGetDefaultIMEWnd(HWND hWnd) UINT WINAPI ImmGetDescriptionA( HKL hKL, LPSTR lpszDescription, UINT uBufLen) { -#ifdef __REACTOS__ IMEINFOEX info; size_t cch; TRACE("ImmGetDescriptionA(%p,%p,%d)\n", hKL, lpszDescription, uBufLen); - if (!ImmGetImeInfoEx(&info, ImeInfoExKeyboardLayout, &hKL) || !IS_IME_KBDLAYOUT(hKL)) + if (!ImmGetImeInfoEx(&info, ImeInfoExKeyboardLayout, &hKL) || !IS_IME_HKL(hKL)) return 0; StringCchLengthW(info.wszImeDescription, _countof(info.wszImeDescription), &cch); @@ -1801,36 +2018,6 @@ UINT WINAPI ImmGetDescriptionA( if (uBufLen) lpszDescription[cch] = 0; return cch; -#else - WCHAR *buf; - DWORD len; - - TRACE("%p %p %d\n", hKL, lpszDescription, uBufLen); - - /* find out how many characters in the unicode buffer */ - len = ImmGetDescriptionW( hKL, NULL, 0 ); - if (!len) - return 0; - - /* allocate a buffer of that size */ - buf = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof (WCHAR) ); - if( !buf ) - return 0; - - /* fetch the unicode buffer */ - len = ImmGetDescriptionW( hKL, buf, len + 1 ); - - /* convert it back to ASCII */ - len = WideCharToMultiByte( CP_ACP, 0, buf, len + 1, - lpszDescription, uBufLen, NULL, NULL ); - - HeapFree( GetProcessHeap(), 0, buf ); - - if (len == 0) - return 0; - - return len - 1; -#endif } /*********************************************************************** @@ -1838,13 +2025,12 @@ UINT WINAPI ImmGetDescriptionA( */ UINT WINAPI ImmGetDescriptionW(HKL hKL, LPWSTR lpszDescription, UINT uBufLen) { -#ifdef __REACTOS__ IMEINFOEX info; size_t cch; TRACE("ImmGetDescriptionW(%p, %p, %d)\n", hKL, lpszDescription, uBufLen); - if (!ImmGetImeInfoEx(&info, ImeInfoExKeyboardLayout, &hKL) || !IS_IME_KBDLAYOUT(hKL)) + if (!ImmGetImeInfoEx(&info, ImeInfoExKeyboardLayout, &hKL) || !IS_IME_HKL(hKL)) return 0; if (uBufLen != 0) @@ -1852,16 +2038,6 @@ UINT WINAPI ImmGetDescriptionW(HKL hKL, LPWSTR lpszDescription, UINT uBufLen) StringCchLengthW(info.wszImeDescription, _countof(info.wszImeDescription), &cch); return (UINT)cch; -#else - static const WCHAR name[] = { 'W','i','n','e',' ','X','I','M',0 }; - - FIXME("(%p, %p, %d): semi stub\n", hKL, lpszDescription, uBufLen); - - if (!hKL) return 0; - if (!uBufLen) return lstrlenW( name ); - lstrcpynW( lpszDescription, name, uBufLen ); - return lstrlenW( lpszDescription ); -#endif } /*********************************************************************** @@ -1973,7 +2149,6 @@ UINT WINAPI ImmGetIMEFileNameW(HKL hKL, LPWSTR lpszFileName, UINT uBufLen) */ BOOL WINAPI ImmGetOpenStatus(HIMC hIMC) { -#ifdef __REACTOS__ BOOL ret; LPINPUTCONTEXT pIC; @@ -1990,20 +2165,6 @@ BOOL WINAPI ImmGetOpenStatus(HIMC hIMC) ImmUnlockIMC(hIMC); return ret; -#else - InputContextData *data = get_imc_data(hIMC); - static int i; - - if (!data) - return FALSE; - - TRACE("(%p): semi-stub\n", hIMC); - - if (!i++) - FIXME("(%p): semi-stub\n", hIMC); - - return data->IMC.fOpen; -#endif } /*********************************************************************** @@ -2219,16 +2380,9 @@ HKL WINAPI ImmInstallIMEW( */ BOOL WINAPI ImmIsIME(HKL hKL) { -#ifdef __REACTOS__ IMEINFOEX info; TRACE("ImmIsIME(%p)\n", hKL); return !!ImmGetImeInfoEx(&info, ImeInfoExImeWindow, &hKL); -#else - ImmHkl *ptr; - TRACE("(%p):\n", hKL); - ptr = IMM_GetImmHkl(hKL); - return (ptr && ptr->hIME); -#endif } /*********************************************************************** @@ -2759,14 +2913,8 @@ HWND WINAPI ImmCreateSoftKeyboard(UINT uType, UINT hOwner, int x, int y) */ BOOL WINAPI ImmDestroySoftKeyboard(HWND hSoftWnd) { -#ifdef __REACTOS__ TRACE("(%p)\n", hSoftWnd); return DestroyWindow(hSoftWnd); -#else - FIXME("(%p): stub\n", hSoftWnd); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -#endif } /*********************************************************************** @@ -2774,14 +2922,9 @@ BOOL WINAPI ImmDestroySoftKeyboard(HWND hSoftWnd) */ BOOL WINAPI ImmShowSoftKeyboard(HWND hSoftWnd, int nCmdShow) { -#ifdef __REACTOS__ TRACE("(%p, %d)\n", hSoftWnd, nCmdShow); if (hSoftWnd) return ShowWindow(hSoftWnd, nCmdShow); -#else - FIXME("(%p, %d): stub\n", hSoftWnd, nCmdShow); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); -#endif return FALSE; } @@ -3013,12 +3156,19 @@ LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC) */ BOOL WINAPI ImmUnlockIMC(HIMC hIMC) { - InputContextData *data = get_imc_data(hIMC); + PCLIENTIMC pClientIMC; + HIMC hClientImc; - if (!data) + pClientIMC = ImmLockClientImc(hIMC); + if (pClientIMC == NULL) return FALSE; - if (data->dwLock) - data->dwLock--; + + hClientImc = pClientIMC->hImc; + if (hClientImc) + LocalUnlock(hClientImc); + + InterlockedDecrement(&pClientIMC->cLockObj); + ImmUnlockClientImc(pClientIMC); return TRUE; } @@ -3027,10 +3177,21 @@ BOOL WINAPI ImmUnlockIMC(HIMC hIMC) */ DWORD WINAPI ImmGetIMCLockCount(HIMC hIMC) { - InputContextData *data = get_imc_data(hIMC); - if (!data) + DWORD ret; + HIMC hClientImc; + PCLIENTIMC pClientImc; + + pClientImc = ImmLockClientImc(hIMC); + if (pClientImc == NULL) return 0; - return data->dwLock; + + ret = 0; + hClientImc = pClientImc->hImc; + if (hClientImc) + ret = (LocalFlags(hClientImc) & LMEM_LOCKCOUNT); + + ImmUnlockClientImc(pClientImc); + return ret; } /*********************************************************************** @@ -3038,13 +3199,9 @@ DWORD WINAPI ImmGetIMCLockCount(HIMC hIMC) */ HIMCC WINAPI ImmCreateIMCC(DWORD size) { -#ifdef __REACTOS__ if (size < 4) size = 4; return LocalAlloc(LHND, size); -#else - return GlobalAlloc(GMEM_ZEROINIT | GMEM_MOVEABLE, size); -#endif } /*********************************************************************** @@ -3052,13 +3209,9 @@ HIMCC WINAPI ImmCreateIMCC(DWORD size) */ HIMCC WINAPI ImmDestroyIMCC(HIMCC block) { -#ifdef __REACTOS__ if (block) return LocalFree(block); return NULL; -#else - return GlobalFree(block); -#endif } /*********************************************************************** @@ -3066,13 +3219,9 @@ HIMCC WINAPI ImmDestroyIMCC(HIMCC block) */ LPVOID WINAPI ImmLockIMCC(HIMCC imcc) { -#ifdef __REACTOS__ if (imcc) return LocalLock(imcc); return NULL; -#else - return GlobalLock(imcc); -#endif } /*********************************************************************** @@ -3080,13 +3229,9 @@ LPVOID WINAPI ImmLockIMCC(HIMCC imcc) */ BOOL WINAPI ImmUnlockIMCC(HIMCC imcc) { -#ifdef __REACTOS__ if (imcc) return LocalUnlock(imcc); return FALSE; -#else - return GlobalUnlock(imcc); -#endif } /*********************************************************************** @@ -3094,11 +3239,7 @@ BOOL WINAPI ImmUnlockIMCC(HIMCC imcc) */ DWORD WINAPI ImmGetIMCCLockCount(HIMCC imcc) { -#ifdef __REACTOS__ return LocalFlags(imcc) & LMEM_LOCKCOUNT; -#else - return GlobalFlags(imcc) & GMEM_LOCKCOUNT; -#endif } /*********************************************************************** @@ -3106,13 +3247,9 @@ DWORD WINAPI ImmGetIMCCLockCount(HIMCC imcc) */ HIMCC WINAPI ImmReSizeIMCC(HIMCC imcc, DWORD size) { -#ifdef __REACTOS__ if (!imcc) return NULL; return LocalReAlloc(imcc, size, LHND); -#else - return GlobalReAlloc(imcc, size, GMEM_ZEROINIT | GMEM_MOVEABLE); -#endif } /*********************************************************************** @@ -3120,13 +3257,9 @@ HIMCC WINAPI ImmReSizeIMCC(HIMCC imcc, DWORD size) */ DWORD WINAPI ImmGetIMCCSize(HIMCC imcc) { -#ifdef __REACTOS__ if (imcc) return LocalSize(imcc); return 0; -#else - return GlobalSize(imcc); -#endif } /*********************************************************************** @@ -3302,7 +3435,6 @@ BOOL WINAPI ImmEnumInputContext(DWORD idThread, IMCENUMPROC lpfn, LPARAM lParam) * ImmGetHotKey(IMM32.@) */ -#ifdef __REACTOS__ BOOL WINAPI ImmGetHotKey(IN DWORD dwHotKey, OUT LPUINT lpuModifiers, @@ -3314,13 +3446,6 @@ ImmGetHotKey(IN DWORD dwHotKey, return NtUserGetImeHotKey(dwHotKey, lpuModifiers, lpuVKey, lphKL); return FALSE; } -#else -BOOL WINAPI ImmGetHotKey(DWORD hotkey, UINT *modifiers, UINT *key, HKL hkl) -{ - FIXME("%x, %p, %p, %p: stub\n", hotkey, modifiers, key, hkl); - return FALSE; -} -#endif /*********************************************************************** * ImmDisableLegacyIME(IMM32.@) @@ -3331,7 +3456,6 @@ BOOL WINAPI ImmDisableLegacyIME(void) return TRUE; } -#ifdef __REACTOS__ /*********************************************************************** * ImmSetActiveContext(IMM32.@) */ @@ -3392,4 +3516,3 @@ ImmGetImeInfoEx(PIMEINFOEX pImeInfoEx, } return NtUserGetImeInfoEx(pImeInfoEx, SearchType); } -#endif diff --git a/dll/win32/imm32/imm32.spec b/dll/win32/imm32/imm32.spec index b9c0fe55516..b41e2ee2049 100644 --- a/dll/win32/imm32/imm32.spec +++ b/dll/win32/imm32/imm32.spec @@ -68,7 +68,7 @@ @ stdcall ImmIsUIMessageW(long long long long) @ stdcall -stub ImmLoadIME(long) @ stdcall -stub ImmLoadLayout(long ptr) -@ stub ImmLockClientImc +@ stdcall ImmLockClientImc(ptr) @ stdcall ImmLockIMC(ptr) @ stdcall ImmLockIMCC(ptr) @ stdcall -stub ImmLockImeDpi(long) @@ -102,7 +102,7 @@ @ stdcall ImmSimulateHotKey(ptr long) @ stdcall -stub ImmSystemHandler(ptr long long) @ stdcall ImmTranslateMessage(ptr long long long) -@ stub ImmUnlockClientImc +@ stdcall ImmUnlockClientImc(ptr) @ stdcall ImmUnlockIMC(ptr) @ stdcall ImmUnlockIMCC(ptr) @ stdcall -stub ImmUnlockImeDpi(ptr) diff --git a/media/doc/WINESYNC.txt b/media/doc/WINESYNC.txt index 1b78cfd0cfd..6d3e209eb8c 100644 --- a/media/doc/WINESYNC.txt +++ b/media/doc/WINESYNC.txt @@ -79,7 +79,7 @@ dll/win32/iccvid # Synced to WineStaging-4.0 dll/win32/ieframe # Synced to WineStaging-4.18 dll/win32/imaadp32.acm # Synced to WineStaging-4.0 dll/win32/imagehlp # Synced to WineStaging-4.18 -dll/win32/imm32 # Synced to WineStaging-4.18 +dll/win32/imm32 # Forked at WineStaging-4.18 dll/win32/inetcomm # Synced to WineStaging-4.18 dll/win32/inetmib1 # Synced to WineStaging-4.18 dll/win32/initpki # Synced to WineStaging-4.18 diff --git a/sdk/include/reactos/imm32_undoc.h b/sdk/include/reactos/imm32_undoc.h index 32858af1068..8332d6bfde9 100644 --- a/sdk/include/reactos/imm32_undoc.h +++ b/sdk/include/reactos/imm32_undoc.h @@ -7,9 +7,23 @@ #pragma once -#define KBDLAYOUT_MASK 0xF000 -#define KBDLAYOUT_IME 0xE000 -#define IS_IME_KBDLAYOUT(hKL) ((HIWORD(hKL) & KBDLAYOUT_MASK) == KBDLAYOUT_IME) +/* unconfirmed */ +typedef struct tagCLIENTIMC +{ + HIMC hImc; + LONG cLockObj; + DWORD dwFlags; + DWORD unknown; + RTL_CRITICAL_SECTION cs; + DWORD unknown2; + DWORD unknown3; + BOOL bUnknown4; +} CLIENTIMC, *PCLIENTIMC; + +/* flags for CLIENTIMC */ +#define CLIENTIMC_WIDE (1 << 0) +#define CLIENTIMC_DISABLED (1 << 6) +#define CLIENTIMC_UNKNOWN2 (1 << 8) #ifdef __cplusplus extern "C" { diff --git a/win32ss/include/ntuser.h b/win32ss/include/ntuser.h index ff34bd12a5a..54499388337 100644 --- a/win32ss/include/ntuser.h +++ b/win32ss/include/ntuser.h @@ -2464,7 +2464,8 @@ enum ThreadStateRoutines THREADSTATE_UPTIMELASTREAD, THREADSTATE_FOREGROUNDTHREAD, THREADSTATE_GETCURSOR, - THREADSTATE_GETMESSAGEEXTRAINFO + THREADSTATE_GETMESSAGEEXTRAINFO, + THREADSTATE_UNKNOWN13 }; DWORD_PTR @@ -3445,9 +3446,9 @@ NtUserUnregisterUserApiHook(VOID); DWORD NTAPI NtUserUpdateInputContext( - DWORD Unknown0, + HIMC hIMC, DWORD Unknown1, - DWORD Unknown2); + LPVOID pClientImc); DWORD NTAPI diff --git a/win32ss/user/ntuser/misc.c b/win32ss/user/ntuser/misc.c index c0e332b369e..f8c0d3e1ec3 100644 --- a/win32ss/user/ntuser/misc.c +++ b/win32ss/user/ntuser/misc.c @@ -314,6 +314,9 @@ NtUserGetThreadState( case THREADSTATE_GETMESSAGEEXTRAINFO: ret = (DWORD_PTR)MsqGetMessageExtraInfo(); break; + case THREADSTATE_UNKNOWN13: + ret = FALSE; /* FIXME: See imm32 */ + break; } TRACE("Leave NtUserGetThreadState, ret=%lu\n", ret); diff --git a/win32ss/user/ntuser/ntstubs.c b/win32ss/user/ntuser/ntstubs.c index 44cbb5af3b2..87d2c3ed11a 100644 --- a/win32ss/user/ntuser/ntstubs.c +++ b/win32ss/user/ntuser/ntstubs.c @@ -356,9 +356,9 @@ NtUserSetSysColors( DWORD APIENTRY NtUserUpdateInputContext( - DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2) + HIMC hIMC, + DWORD Unknown1, + LPVOID pClientImc) { STUB
3 years, 5 months
1
0
0
0
[reactos] 01/01: [VIDEOPRT] Write correct MaxObjectNumber to registry
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8379c87b0bb1559efac21…
commit 8379c87b0bb1559efac214171268241fcb74d731 Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sat Jul 10 19:01:11 2021 +0200 Commit: Hervé Poussineau <hpoussin(a)reactos.org> CommitDate: Sat Jul 10 19:03:37 2021 +0200 [VIDEOPRT] Write correct MaxObjectNumber to registry VideoPortMaxObjectNumber variable will be updated later in the function, if everything went fine. --- win32ss/drivers/videoprt/videoprt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/win32ss/drivers/videoprt/videoprt.c b/win32ss/drivers/videoprt/videoprt.c index c0a1d446116..d49cd20f033 100644 --- a/win32ss/drivers/videoprt/videoprt.c +++ b/win32ss/drivers/videoprt/videoprt.c @@ -86,8 +86,8 @@ IntVideoPortAddDeviceMapLink( L"VIDEO", L"MaxObjectNumber", REG_DWORD, - &VideoPortMaxObjectNumber, - sizeof(VideoPortMaxObjectNumber)); + &DeviceNumber, + sizeof(DeviceNumber)); if (!NT_SUCCESS(Status)) { ERR_(VIDEOPRT, "Failed to write MaxObjectNumber: 0x%X\n", Status); @@ -101,7 +101,7 @@ IntVideoPortAddDeviceMapLink( Status = IoCreateSymbolicLink(&SymlinkName, &DeviceName); if (!NT_SUCCESS(Status)) { - ERR_(VIDEOPRT, "Failed to write MaxObjectNumber: 0x%X\n", Status); + ERR_(VIDEOPRT, "Failed to create symbolic link: 0x%X\n", Status); return Status; }
3 years, 5 months
1
0
0
0
[reactos] 04/04: [GDI32_APITEST] Clean up loaded fonts
by Timo Kreuzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9e6b0b16e93db21f7e74d…
commit 9e6b0b16e93db21f7e74d4a87369075ae298c8bc Author: Timo Kreuzer <timo.kreuzer(a)reactos.org> AuthorDate: Sat Jul 10 16:04:16 2021 +0200 Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org> CommitDate: Sat Jul 10 18:41:12 2021 +0200 [GDI32_APITEST] Clean up loaded fonts --- modules/rostests/apitests/gdi32/AddFontResource.c | 74 ++++++++++------------- 1 file changed, 32 insertions(+), 42 deletions(-) diff --git a/modules/rostests/apitests/gdi32/AddFontResource.c b/modules/rostests/apitests/gdi32/AddFontResource.c index ee9264ab47a..0172d6302c1 100644 --- a/modules/rostests/apitests/gdi32/AddFontResource.c +++ b/modules/rostests/apitests/gdi32/AddFontResource.c @@ -11,25 +11,18 @@ void Test_AddFontResourceA() { - CHAR szFileNameA[MAX_PATH*2 + 3]; - CHAR szFileNameFont1A[MAX_PATH]; - CHAR szFileNameFont2A[MAX_PATH]; + CHAR szCurrentDir[MAX_PATH]; + CHAR szFileNameFont1[MAX_PATH]; + CHAR szFileNameFont2[MAX_PATH]; + CHAR szFileName[MAX_PATH*2 + 3]; int result; - GetCurrentDirectoryA(MAX_PATH, szFileNameA); + GetCurrentDirectoryA(MAX_PATH, szCurrentDir); - memcpy(szFileNameFont1A, szFileNameA, MAX_PATH ); - strcat(szFileNameFont1A, "\\testdata\\test.ttf"); + snprintf(szFileNameFont1, MAX_PATH, "%s\\testdata\\test.ttf", szCurrentDir); + snprintf(szFileNameFont2, MAX_PATH, "%s\\testdata\\test.otf", szCurrentDir); - memcpy(szFileNameFont2A, szFileNameA, MAX_PATH ); - strcat(szFileNameFont2A, "\\testdata\\test.otf"); - - RtlZeroMemory(szFileNameA, sizeof(szFileNameA)); - - /* - * Start testing Ansi version - * - */ + //RtlZeroMemory(szFileNameA, sizeof(szFileNameA)); /* Testing NULL pointer */ SetLastError(ERROR_SUCCESS); @@ -57,64 +50,61 @@ void Test_AddFontResourceA() /* Testing one ttf font */ SetLastError(ERROR_SUCCESS); - result = AddFontResourceA(szFileNameFont1A); - ok(result == 1, "AddFontResourceA(\"%s\") failed, result=%d\n", szFileNameFont1A, result); + result = AddFontResourceA(szFileNameFont1); + ok(result == 1, "AddFontResourceA(\"%s\") failed, result=%d\n", szFileNameFont1, result); ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError()); + RemoveFontResourceA(szFileNameFont1); /* Testing one otf font */ SetLastError(ERROR_SUCCESS); - result = AddFontResourceA(szFileNameFont2A); + result = AddFontResourceA(szFileNameFont2); ok(result == 1, "AddFontResourceA failed, result=%d\n", result); ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError()); + RemoveFontResourceA(szFileNameFont2); /* Testing two fonts */ SetLastError(ERROR_SUCCESS); - sprintf(szFileNameA,"%s|%s",szFileNameFont1A, szFileNameFont2A); - result = AddFontResourceA(szFileNameA); + sprintf(szFileName,"%s|%s",szFileNameFont1, szFileNameFont2); + result = AddFontResourceA(szFileName); ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result); ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError()); SetLastError(ERROR_SUCCESS); - sprintf(szFileNameA,"%s |%s",szFileNameFont1A, szFileNameFont2A); - result = AddFontResourceA(szFileNameA); + sprintf(szFileName,"%s |%s",szFileNameFont1, szFileNameFont2); + result = AddFontResourceA(szFileName); ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result); ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError()); SetLastError(ERROR_SUCCESS); - sprintf(szFileNameA,"%s | %s",szFileNameFont1A, szFileNameFont2A); - result = AddFontResourceA(szFileNameA); + sprintf(szFileName,"%s | %s",szFileNameFont1, szFileNameFont2); + result = AddFontResourceA(szFileName); ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result); ok(GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError()=%ld\n", GetLastError()); - - GetCurrentDirectoryA(MAX_PATH, szFileNameA); - strcpy(szFileNameFont1A, szFileNameA); - strcat(szFileNameFont1A, "\\testdata\\test.pfm"); - - strcpy(szFileNameFont2A, szFileNameA); - strcat(szFileNameFont2A, "\\testdata\\test.pfb"); + snprintf(szFileNameFont1, MAX_PATH, "%s\\testdata\\test.pfm", szCurrentDir); + snprintf(szFileNameFont2, MAX_PATH, "%s\\testdata\\test.pfb", szCurrentDir); SetLastError(ERROR_SUCCESS); - sprintf(szFileNameA,"%s|%s", szFileNameFont1A, szFileNameFont2A); - result = AddFontResourceA(szFileNameA); + sprintf(szFileName,"%s|%s", szFileNameFont1, szFileNameFont2); + result = AddFontResourceA(szFileName); ok(result == 1, "AddFontResourceA(\"%s|%s\") failed, result=%d\n", - szFileNameFont1A, szFileNameFont2A, result); + szFileNameFont1, szFileNameFont2, result); ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError()); + RemoveFontResourceA(szFileName); - sprintf(szFileNameA,"%s | %s", szFileNameFont1A, szFileNameFont2A); - result = AddFontResourceA(szFileNameA); + sprintf(szFileName,"%s | %s", szFileNameFont1, szFileNameFont2); + result = AddFontResourceA(szFileName); ok(result == 0, "AddFontResourceA(\"%s | %s\") succeeded, result=%d\n", - szFileNameFont1A, szFileNameFont2A, result); + szFileNameFont1, szFileNameFont2, result); ok(GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError()=%ld\n", GetLastError()); + RemoveFontResourceA(szFileName); - sprintf(szFileNameA,"%s|%s", szFileNameFont2A, szFileNameFont1A); - result = AddFontResourceA(szFileNameA); + sprintf(szFileName,"%s|%s", szFileNameFont2, szFileNameFont1); + result = AddFontResourceA(szFileName); ok(result == 0, "AddFontResourceA(\"%s|%s\") succeeded, result=%d\n", - szFileNameFont2A, szFileNameFont1A, result); + szFileNameFont2, szFileNameFont1, result); ok(GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError()=%ld\n", GetLastError()); - - } START_TEST(AddFontResource)
3 years, 5 months
1
0
0
0
[reactos] 03/04: [ROSTESTS] Skip some test on x64
by Timo Kreuzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8a437ac528539287aa73b…
commit 8a437ac528539287aa73ba60a4bcb3c2edf168f2 Author: Timo Kreuzer <timo.kreuzer(a)reactos.org> AuthorDate: Fri Jul 2 18:12:24 2021 +0200 Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org> CommitDate: Sat Jul 10 18:41:12 2021 +0200 [ROSTESTS] Skip some test on x64 --- modules/rostests/apitests/localspl/service.c | 8 ++++++++ modules/rostests/apitests/localspl/tests.c | 24 +++++++++++++++++++++++ modules/rostests/apitests/ntdll/NtSetValueKey.c | 8 ++++++++ modules/rostests/kmtests/ntos_ex/ExFastMutex.c | 8 ++++++++ modules/rostests/kmtests/ntos_po/PoIrp_user.c | 8 ++++++++ modules/rostests/winetests/kernel32/pipe.c | 8 ++++++++ modules/rostests/winetests/kernel32/process.c | 26 ++++++++++++++++++++++--- modules/rostests/winetests/kernel32/sync.c | 8 ++++++++ modules/rostests/winetests/kernel32/virtual.c | 8 ++++++++ 9 files changed, 103 insertions(+), 3 deletions(-) diff --git a/modules/rostests/apitests/localspl/service.c b/modules/rostests/apitests/localspl/service.c index 54ccaad287d..3a114d4c5cc 100644 --- a/modules/rostests/apitests/localspl/service.c +++ b/modules/rostests/apitests/localspl/service.c @@ -162,6 +162,14 @@ START_TEST(service) int argc; char** argv; +#if defined(_M_AMD64) + if (!winetest_interactive) + { + skip("ROSTESTS-366: Skipping localspl_apitest:service because it hangs on Windows Server 2003 x64-Testbot. Set winetest_interactive to run it anyway.\n"); + return; + } +#endif + SERVICE_TABLE_ENTRYW ServiceTable[] = { { SERVICE_NAME, _ServiceMain }, diff --git a/modules/rostests/apitests/localspl/tests.c b/modules/rostests/apitests/localspl/tests.c index c992bcce20b..9d36edbb4ed 100644 --- a/modules/rostests/apitests/localspl/tests.c +++ b/modules/rostests/apitests/localspl/tests.c @@ -210,15 +210,39 @@ Cleanup: START_TEST(fpEnumPrinters) { +#if defined(_M_AMD64) + if (!winetest_interactive) + { + skip("ROSTESTS-366: Skipping localspl_apitest:fpEnumPrinters because it hangs on Windows Server 2003 x64-Testbot. Set winetest_interactive to run it anyway.\n"); + return; + } +#endif + _RunRemoteTest("fpEnumPrinters"); } START_TEST(fpGetPrintProcessorDirectory) { +#if defined(_M_AMD64) + if (!winetest_interactive) + { + skip("ROSTESTS-366: Skipping localspl_apitest:fpGetPrintProcessorDirectory because it hangs on Windows Server 2003 x64-Testbot. Set winetest_interactive to run it anyway.\n"); + return; + } +#endif + _RunRemoteTest("fpGetPrintProcessorDirectory"); } START_TEST(fpSetJob) { +#if defined(_M_AMD64) + if (!winetest_interactive) + { + skip("ROSTESTS-366: Skipping localspl_apitest:fpSetJob because it hangs on Windows Server 2003 x64-Testbot. Set winetest_interactive to run it anyway.\n"); + return; + } +#endif + _RunRemoteTest("fpSetJob"); } diff --git a/modules/rostests/apitests/ntdll/NtSetValueKey.c b/modules/rostests/apitests/ntdll/NtSetValueKey.c index fc4d29181d2..6c56a5024de 100644 --- a/modules/rostests/apitests/ntdll/NtSetValueKey.c +++ b/modules/rostests/apitests/ntdll/NtSetValueKey.c @@ -64,6 +64,14 @@ START_TEST(NtSetValueKey) }; ULONG i; +#if defined(_M_AMD64) + if (!winetest_interactive) + { + skip("ROSTESTS-365: Skipping ntdll_apitest:NtSetValueKey because it hangs on Windows Server 2003 x64-Testbot. Set winetest_interactive to run it anyway.\n"); + return; + } +#endif + Status = RtlOpenCurrentUser(READ_CONTROL, &ParentKeyHandle); ok(Status == STATUS_SUCCESS, "RtlOpenCurrentUser returned %lx\n", Status); if (!NT_SUCCESS(Status)) diff --git a/modules/rostests/kmtests/ntos_ex/ExFastMutex.c b/modules/rostests/kmtests/ntos_ex/ExFastMutex.c index 04de7a9a16f..76eaa71f10c 100644 --- a/modules/rostests/kmtests/ntos_ex/ExFastMutex.c +++ b/modules/rostests/kmtests/ntos_ex/ExFastMutex.c @@ -310,6 +310,14 @@ TestFastMutexConcurrent( START_TEST(ExFastMutex) { +#if defined(_M_AMD64) + if (TRUE) + { + skip(FALSE, "ROSTESTS-367: Skipping kmtest:ExFastMutex because it hangs on Windows Server 2003 x64-Testbot.\n"); + return; + } +#endif + FAST_MUTEX Mutex; KIRQL Irql; diff --git a/modules/rostests/kmtests/ntos_po/PoIrp_user.c b/modules/rostests/kmtests/ntos_po/PoIrp_user.c index ed945ea7c76..ee6a1ad57bf 100644 --- a/modules/rostests/kmtests/ntos_po/PoIrp_user.c +++ b/modules/rostests/kmtests/ntos_po/PoIrp_user.c @@ -10,6 +10,14 @@ START_TEST(PoIrp) { +#if defined(_M_AMD64) + if (TRUE) + { + skip(FALSE, "ROSTESTS-368: Skipping kmtest:PoIrp because it crashes on Windows Server 2003 x64-Testbot.\n"); + return; + } +#endif + KmtLoadDriver(L"PoIrp", TRUE); KmtOpenDriver(); KmtSendToDriver(IOCTL_RUN_TEST); diff --git a/modules/rostests/winetests/kernel32/pipe.c b/modules/rostests/winetests/kernel32/pipe.c index b2f673400a5..66106ce5111 100644 --- a/modules/rostests/winetests/kernel32/pipe.c +++ b/modules/rostests/winetests/kernel32/pipe.c @@ -3165,6 +3165,14 @@ START_TEST(pipe) int argc; HMODULE hmod; +#if defined(__REACTOS__) && defined(_M_AMD64) + if (!winetest_interactive) + { + skip("ROSTESTS-370: Skipping kernel32_winetest:pipe because it hangs on Windows Server 2003 x64-Testbot. Set winetest_interactive to run it anyway.\n"); + return; + } +#endif + hmod = GetModuleHandleA("advapi32.dll"); pDuplicateTokenEx = (void *) GetProcAddress(hmod, "DuplicateTokenEx"); hmod = GetModuleHandleA("kernel32.dll"); diff --git a/modules/rostests/winetests/kernel32/process.c b/modules/rostests/winetests/kernel32/process.c index b0bf22a0951..2944c9bf4cb 100644 --- a/modules/rostests/winetests/kernel32/process.c +++ b/modules/rostests/winetests/kernel32/process.c @@ -3,7 +3,7 @@ * * Copyright 2002 Eric Pouech * Copyright 2006 Dmitry Timoshkov - * Copyright 2014 Michael M�ller + * Copyright 2014 Michael Müller * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -921,7 +921,7 @@ static void test_CommandLine(void) startup.dwFlags = STARTF_USESHOWWINDOW; startup.wShowWindow = SW_SHOWNORMAL; - /* from Fran�ois */ + /* from François */ get_file_name(resfile); sprintf(buffer, "\"%s\" tests/process.c dump \"%s\" \"a\\\"b\\\\\" c\\\" d", selfname, resfile); ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n"); @@ -1148,6 +1148,14 @@ static void test_Toolhelp(void) DWORD ret; int i; +#if defined(__REACTOS__) && defined(_M_AMD64) + if (!winetest_interactive) + { + skip("ROSTESTS-372: Skipping test in kernel32_winetest:process test_Toolhelp because it leaves a process behind on Windows Server 2003 x64-Testbot. Set winetest_interactive to run it anyway.\n"); + //return; + } +#endif + memset(&startup, 0, sizeof(startup)); startup.cb = sizeof(startup); startup.dwFlags = STARTF_USESHOWWINDOW; @@ -1171,6 +1179,15 @@ static void test_Toolhelp(void) release_memory(); DeleteFileA(resfile); +#if defined(__REACTOS__) && defined(_M_AMD64) + if (!winetest_interactive) + { + skip("ROSTESTS-371: Skipping kernel32_winetest:sync test_apc_deadlock because it fails on Windows Server 2003 x64-Testbot. Set winetest_interactive to run it anyway.\n"); + } + else + { +#endif + get_file_name(resfile); sprintf(buffer, "\"%s\" tests/process.c nested \"%s\"", selfname, resfile); ok(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess failed\n"); @@ -1182,6 +1199,9 @@ static void test_Toolhelp(void) CloseHandle(info.hProcess); CloseHandle(info.hThread); +#if defined(__REACTOS__) && defined(_M_AMD64) + } +#endif for (i = 0; i < 20; i++) { @@ -3959,7 +3979,7 @@ START_TEST(process) test_Startup(); test_CommandLine(); test_Directory(); - test_Toolhelp(); + test_Toolhelp(); // test_Environment(); test_SuspendFlag(); test_DebuggingFlag(); diff --git a/modules/rostests/winetests/kernel32/sync.c b/modules/rostests/winetests/kernel32/sync.c index 9056c3d1bbe..e03ebae1f9f 100644 --- a/modules/rostests/winetests/kernel32/sync.c +++ b/modules/rostests/winetests/kernel32/sync.c @@ -2596,6 +2596,14 @@ static void test_apc_deadlock(void) char **argv; int i; +#if defined(__REACTOS__) && defined(_M_AMD64) + if (!winetest_interactive) + { + skip("ROSTESTS-371: Skipping kernel32_winetest:sync test_apc_deadlock because it fails on Windows Server 2003 x64-Testbot. Set winetest_interactive to run it anyway.\n"); + return; + } +#endif + winetest_get_mainargs(&argv); sprintf(cmdline, "\"%s\" sync apc_deadlock", argv[0]); success = CreateProcessA(argv[0], cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); diff --git a/modules/rostests/winetests/kernel32/virtual.c b/modules/rostests/winetests/kernel32/virtual.c index f2c504eac99..81e09f4e1a9 100644 --- a/modules/rostests/winetests/kernel32/virtual.c +++ b/modules/rostests/winetests/kernel32/virtual.c @@ -4110,6 +4110,14 @@ START_TEST(virtual) char **argv; argc = winetest_get_mainargs( &argv ); +#if defined(__REACTOS__) && defined(_M_AMD64) + if (!winetest_interactive) + { + skip("ROSTESTS-369: Skipping kernel32_winetest:virtual because it crashes on Windows Server 2003 x64-Testbot. Set winetest_interactive to run it anyway.\n"); + return; + } +#endif + if (argc >= 3) { if (!strcmp(argv[2], "sleep"))
3 years, 5 months
1
0
0
0
[reactos] 02/04: [NTDLL_WINETEST] Unhack exception test and include it in x64
by Timo Kreuzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=699041b2214ec0c59e589…
commit 699041b2214ec0c59e5898e65616ad6cfb7febb1 Author: Timo Kreuzer <timo.kreuzer(a)reactos.org> AuthorDate: Fri Jul 9 10:58:15 2021 +0200 Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org> CommitDate: Sat Jul 10 18:41:12 2021 +0200 [NTDLL_WINETEST] Unhack exception test and include it in x64 This removes the use of a precompiled header, as it causes problems with different usages of NONAMELESSUNION, which had to be hacked already, but this is still causing problems with GCC x64. It's just not worth the hassle to keep reactos specific hacks to save a few ms of compile time. --- modules/rostests/winetests/ntdll/CMakeLists.txt | 10 +++------ modules/rostests/winetests/ntdll/exception.c | 28 ++----------------------- modules/rostests/winetests/ntdll/precomp.h | 20 ------------------ modules/rostests/winetests/ntdll/testlist.c | 2 -- 4 files changed, 5 insertions(+), 55 deletions(-) diff --git a/modules/rostests/winetests/ntdll/CMakeLists.txt b/modules/rostests/winetests/ntdll/CMakeLists.txt index f7b435eee5a..b835ed34331 100644 --- a/modules/rostests/winetests/ntdll/CMakeLists.txt +++ b/modules/rostests/winetests/ntdll/CMakeLists.txt @@ -8,6 +8,7 @@ list(APPEND SOURCE directory.c env.c error.c + exception.c file.c info.c large_int.c @@ -21,20 +22,16 @@ list(APPEND SOURCE rtlbitmap.c rtlstr.c string.c + testlist.c time.c) if(ARCH STREQUAL "i386") list(APPEND SOURCE - exception.c generated.c) endif() -list(APPEND PCH_SKIP_SOURCE - testlist.c) - add_executable(ntdll_winetest - ${SOURCE} - ${PCH_SKIP_SOURCE}) + ${SOURCE}) target_link_libraries(ntdll_winetest pseh) @@ -49,5 +46,4 @@ endif() set_module_type(ntdll_winetest win32cui) add_importlibs(ntdll_winetest user32 ole32 advapi32 msvcrt kernel32 ntdll) -add_pch(ntdll_winetest precomp.h "${PCH_SKIP_SOURCE}") add_rostests_file(TARGET ntdll_winetest) diff --git a/modules/rostests/winetests/ntdll/exception.c b/modules/rostests/winetests/ntdll/exception.c index 142913f7db1..3074646858b 100644 --- a/modules/rostests/winetests/ntdll/exception.c +++ b/modules/rostests/winetests/ntdll/exception.c @@ -1731,13 +1731,8 @@ static void call_virtual_unwind( int testnum, const struct unwind_test *test ) if (j == rsp) /* rsp is special */ { -#ifndef __REACTOS__ ok( !ctx_ptr.u2.IntegerContext[j], "%u/%u: rsp should not be set in ctx_ptr\n", testnum, i ); -#else - ok(!ctx_ptr.IntegerContext[j], - "%u/%u: rsp should not be set in ctx_ptr\n", testnum, i); -#endif // __REACTOS__ ok( context.Rsp == (ULONG64)fake_stack + test->results[i].regs[k][1], "%u/%u: register rsp wrong %p/%p\n", @@ -1745,11 +1740,7 @@ static void call_virtual_unwind( int testnum, const struct unwind_test *test ) continue; } -#ifndef __REACTOS__ if (ctx_ptr.u2.IntegerContext[j]) -#else - if (ctx_ptr.IntegerContext[j]) -#endif // __REACTOS__ { ok( k < nb_regs, "%u/%u: register %s should not be set to %lx\n", testnum, i, reg_names[j], *(&context.Rax + j) ); @@ -1961,7 +1952,6 @@ static void test_restore_context(void) fltsave = &buf.Xmm6; for (i = 0; i < 10; i++) { -#ifndef __REACTOS__ ok(fltsave[i].Part[0] == ctx.u.FltSave.XmmRegisters[i + 6].Low, "longjmp failed for Xmm%d, expected %lx, got %lx\n", i + 6, fltsave[i].Part[0], ctx.u.FltSave.XmmRegisters[i + 6].Low); @@ -1969,15 +1959,6 @@ static void test_restore_context(void) ok(fltsave[i].Part[1] == ctx.u.FltSave.XmmRegisters[i + 6].High, "longjmp failed for Xmm%d, expected %lx, got %lx\n", i + 6, fltsave[i].Part[1], ctx.u.FltSave.XmmRegisters[i + 6].High); -#else - ok(fltsave[i].Part[0] == ctx.FltSave.XmmRegisters[i + 6].Low, - "longjmp failed for Xmm%d, expected %lx, got %lx\n", i + 6, - fltsave[i].Part[0], ctx.FltSave.XmmRegisters[i + 6].Low); - - ok(fltsave[i].Part[1] == ctx.FltSave.XmmRegisters[i + 6].High, - "longjmp failed for Xmm%d, expected %lx, got %lx\n", i + 6, - fltsave[i].Part[1], ctx.FltSave.XmmRegisters[i + 6].High); -#endif } } else @@ -2171,14 +2152,9 @@ static void test___C_specific_handler(void) rec.ExceptionFlags = 2; /* EH_UNWINDING */ frame = 0x1234; memset(&dispatch, 0, sizeof(dispatch)); -#ifndef __REACTOS__ dispatch.ImageBase = (ULONG_PTR)GetModuleHandleA(NULL); dispatch.ControlPc = dispatch.ImageBase + 0x200; -#else - dispatch.ImageBase = GetModuleHandleA(NULL); - dispatch.ControlPc = (ULONG_PTR)dispatch.ImageBase + 0x200; -#endif - dispatch.HandlerData = &scope_table; + dispatch.HandlerData = &scope_table; dispatch.ContextRecord = &context; scope_table.Count = 1; scope_table.ScopeRecord[0].BeginAddress = 0x200; @@ -2712,7 +2688,7 @@ START_TEST(exception) HMODULE hmsvcrt = LoadLibraryA("msvcrt.dll"); #endif -#ifdef __REACTOS__ +#if defined(__REACTOS__) && !defined(_M_AMD64) if (!winetest_interactive && !strcmp(winetest_platform, "windows")) { diff --git a/modules/rostests/winetests/ntdll/precomp.h b/modules/rostests/winetests/ntdll/precomp.h deleted file mode 100644 index 1f8e9ce5524..00000000000 --- a/modules/rostests/winetests/ntdll/precomp.h +++ /dev/null @@ -1,20 +0,0 @@ - -#ifndef _NTDLL_WINETEST_PRECOMP_H_ -#define _NTDLL_WINETEST_PRECOMP_H_ - -#include <stdio.h> -#include <ntstatus.h> - -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - -#define COBJMACROS - -#include "ntdll_test.h" - -#include <winuser.h> -#include <winnls.h> -#include <winioctl.h> - -#endif /* !_NTDLL_WINETEST_PRECOMP_H_ */ diff --git a/modules/rostests/winetests/ntdll/testlist.c b/modules/rostests/winetests/ntdll/testlist.c index fb64074ac4f..989040c562a 100644 --- a/modules/rostests/winetests/ntdll/testlist.c +++ b/modules/rostests/winetests/ntdll/testlist.c @@ -32,9 +32,7 @@ const struct test winetest_testlist[] = { "directory", func_directory }, { "env", func_env }, { "error", func_error }, -#ifdef _M_IX86 { "exception", func_exception }, -#endif { "file", func_file }, #ifdef _M_IX86 { "generated", func_generated },
3 years, 5 months
1
0
0
0
[reactos] 01/04: [RPCRT4_WINETEST] Fix 64 bit build
by Timo Kreuzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a656d23debe192cac3dcf…
commit a656d23debe192cac3dcf1c81f7d4f2f56aeebd9 Author: Timo Kreuzer <timo.kreuzer(a)reactos.org> AuthorDate: Fri Jul 9 10:29:58 2021 +0200 Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org> CommitDate: Sat Jul 10 18:41:12 2021 +0200 [RPCRT4_WINETEST] Fix 64 bit build "Should be sent to wine"(tm) --- modules/rostests/winetests/CMakeLists.txt | 4 +--- modules/rostests/winetests/rpcrt4/server.c | 8 ++++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/rostests/winetests/CMakeLists.txt b/modules/rostests/winetests/CMakeLists.txt index 580e81e4b5c..c6a7ab402f3 100644 --- a/modules/rostests/winetests/CMakeLists.txt +++ b/modules/rostests/winetests/CMakeLists.txt @@ -99,9 +99,7 @@ add_subdirectory(reg) add_subdirectory(regedit) add_subdirectory(riched20) add_subdirectory(riched32) -if(NOT ARCH STREQUAL "amd64") - add_subdirectory(rpcrt4) -endif() +add_subdirectory(rpcrt4) add_subdirectory(rsaenh) add_subdirectory(schannel) add_subdirectory(scrrun) diff --git a/modules/rostests/winetests/rpcrt4/server.c b/modules/rostests/winetests/rpcrt4/server.c index 05252877d4e..0622e81877b 100644 --- a/modules/rostests/winetests/rpcrt4/server.c +++ b/modules/rostests/winetests/rpcrt4/server.c @@ -2261,7 +2261,11 @@ static HANDLE create_server_process(void) ready_event = CreateEventW(&sec_attr, TRUE, FALSE, NULL); ok(ready_event != NULL, "CreateEvent failed: %u\n", GetLastError()); +#ifdef __REACTOS__ + sprintf(cmdline, "%s server run %Ix", progname, (UINT_PTR)ready_event); +#else sprintf(cmdline, "%s server run %lx", progname, (UINT_PTR)ready_event); +#endif trace("running server process...\n"); ok(CreateProcessA(NULL, cmdline, NULL, NULL, TRUE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n"); ret = WaitForSingleObject(ready_event, 10000); @@ -2517,7 +2521,11 @@ START_TEST(server) else if(!strcmp(argv[2], "run")) { UINT_PTR event; +#ifdef __REACTOS__ + sscanf(argv[3], "%Ix", &event); +#else sscanf(argv[3], "%lx", &event); +#endif run_server((HANDLE)event); } }
3 years, 5 months
1
0
0
0
[reactos] 09/09: [WIN32K] HACK: create a DC on all display devices and display wallpaper
by Hervé Poussineau
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0f6b9664cd1e7c44ed255…
commit 0f6b9664cd1e7c44ed255353304a1f9c37c67841 Author: Hervé Poussineau <hpoussin(a)reactos.org> AuthorDate: Sat Jun 19 18:18:14 2021 +0200 Commit: Hervé Poussineau <hpoussin(a)reactos.org> CommitDate: Sat Jul 10 16:27:44 2021 +0200 [WIN32K] HACK: create a DC on all display devices and display wallpaper --- win32ss/gdi/eng/device.c | 11 +++++++++++ win32ss/user/ntuser/winsta.c | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/win32ss/gdi/eng/device.c b/win32ss/gdi/eng/device.c index a02ef9d3a32..46b9716016f 100644 --- a/win32ss/gdi/eng/device.c +++ b/win32ss/gdi/eng/device.c @@ -439,6 +439,17 @@ EngpRegisterGraphicsDevice( EngReleaseSemaphore(ghsemGraphicsDeviceList); TRACE("Prepared %lu modes for %ls\n", pGraphicsDevice->cDevModes, pGraphicsDevice->pwszDescription); + /* HACK: already in graphic mode; display wallpaper on this new display */ + if (ScreenDeviceContext) + { + UNICODE_STRING DriverName = RTL_CONSTANT_STRING(L"DISPLAY"); + UNICODE_STRING DisplayName; + HDC hdc; + RtlInitUnicodeString(&DisplayName, pGraphicsDevice->szWinDeviceName); + hdc = IntGdiCreateDC(&DriverName, &DisplayName, NULL, NULL, FALSE); + IntPaintDesktop(hdc); + } + return pGraphicsDevice; } diff --git a/win32ss/user/ntuser/winsta.c b/win32ss/user/ntuser/winsta.c index b5854f3dc22..b6f5f5d1459 100644 --- a/win32ss/user/ntuser/winsta.c +++ b/win32ss/user/ntuser/winsta.c @@ -327,6 +327,22 @@ co_IntInitializeDesktopGraphics(VOID) ASSERT(pdesk); co_IntShowDesktop(pdesk, gpsi->aiSysMet[SM_CXSCREEN], gpsi->aiSysMet[SM_CYSCREEN], TRUE); + /* HACK: display wallpaper on all secondary displays */ + { + PGRAPHICS_DEVICE pGraphicsDevice; + UNICODE_STRING DriverName = RTL_CONSTANT_STRING(L"DISPLAY"); + UNICODE_STRING DisplayName; + HDC hdc; + ULONG iDevNum; + + for (iDevNum = 1; (pGraphicsDevice = EngpFindGraphicsDevice(NULL, iDevNum, 0)) != NULL; iDevNum++) + { + RtlInitUnicodeString(&DisplayName, pGraphicsDevice->szWinDeviceName); + hdc = IntGdiCreateDC(&DriverName, &DisplayName, NULL, NULL, FALSE); + IntPaintDesktop(hdc); + } + } + return TRUE; }
3 years, 5 months
1
0
0
0
[reactos] 08/09: [VIDEOPRT] Do not attach secondary devices to the device stack
by Timo Kreuzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=49c16e661acf0d73f1b9b…
commit 49c16e661acf0d73f1b9b475dce8ab1271ccb2d3 Author: Timo Kreuzer <timo.kreuzer(a)reactos.org> AuthorDate: Sun Jul 4 20:26:32 2021 +0200 Commit: Hervé Poussineau <hpoussin(a)reactos.org> CommitDate: Sat Jul 10 16:27:44 2021 +0200 [VIDEOPRT] Do not attach secondary devices to the device stack This fixes display on the primary screen. --- win32ss/drivers/videoprt/videoprt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win32ss/drivers/videoprt/videoprt.c b/win32ss/drivers/videoprt/videoprt.c index e36e0ce6c7c..c0a1d446116 100644 --- a/win32ss/drivers/videoprt/videoprt.c +++ b/win32ss/drivers/videoprt/videoprt.c @@ -298,7 +298,7 @@ IntVideoPortCreateAdapterDeviceObject( KeInitializeMutex(&DeviceExtension->DeviceLock, 0); /* Attach the device. */ - if (PhysicalDeviceObject != NULL) + if ((PhysicalDeviceObject != NULL) && (DisplayNumber == 0)) DeviceExtension->NextDeviceObject = IoAttachDeviceToDeviceStack( *DeviceObject, PhysicalDeviceObject);
3 years, 5 months
1
0
0
0
← Newer
1
...
6
7
8
9
10
11
12
...
15
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Results per page:
10
25
50
100
200