ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
June 2012
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
11 participants
120 discussions
Start a n
N
ew thread
[ekohl] 56785: [SAMLIB] - Implement SamGetAliasMembership, SamQueryInformationAlias and SamSetInformationAlias. - Add stub SamLookupNamesInDomain. [SAMSRV] - Implement SamrGetAliasMembership and Sa...
by ekohl@svn.reactos.org
Author: ekohl Date: Sat Jun 23 10:23:08 2012 New Revision: 56785 URL:
http://svn.reactos.org/svn/reactos?rev=56785&view=rev
Log: [SAMLIB] - Implement SamGetAliasMembership, SamQueryInformationAlias and SamSetInformationAlias. - Add stub SamLookupNamesInDomain. [SAMSRV] - Implement SamrGetAliasMembership and SamrSetInformationAlias. - Add stub for SamrQueryInformationAlias. - SamrCreateAliasInDomain and SAM setup code: Set the description attribute for aliases. Modified: trunk/reactos/dll/win32/samlib/samlib.c trunk/reactos/dll/win32/samlib/samlib.spec trunk/reactos/dll/win32/samsrv/samrpc.c trunk/reactos/dll/win32/samsrv/setup.c trunk/reactos/include/ddk/ntsam.h Modified: trunk/reactos/dll/win32/samlib/samlib.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samlib/samlib.c?…
============================================================================== --- trunk/reactos/dll/win32/samlib/samlib.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samlib/samlib.c [iso-8859-1] Sat Jun 23 10:23:08 2012 @@ -353,6 +353,57 @@ NTSTATUS NTAPI +SamGetAliasMembership(IN SAM_HANDLE DomainHandle, + IN ULONG PassedCount, + IN PSID *Sids, + OUT PULONG MembershipCount, + OUT PULONG *Aliases) +{ + SAMPR_PSID_ARRAY SidArray; + SAMPR_ULONG_ARRAY Membership; + NTSTATUS Status; + + TRACE("SamAliasMembership(%p %ul %p %p %p)\n", + DomainHandle, PassedCount, Sids, MembershipCount, Aliases); + + if (Sids == NULL || + MembershipCount == NULL || + Aliases == NULL) + return STATUS_INVALID_PARAMETER; + + Membership.Element = NULL; + + RpcTryExcept + { + SidArray.Count = PassedCount; + SidArray.Sids = (PSAMPR_SID_INFORMATION)Sids; + + Status = SamrGetAliasMembership((SAMPR_HANDLE)DomainHandle, + &SidArray, + &Membership); + if (NT_SUCCESS(Status)) + { + *MembershipCount = Membership.Count; + *Aliases = Membership.Element; + } + else + { + if (Membership.Element != NULL) + midl_user_free(Membership.Element); + } + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + Status = I_RpcMapWin32Status(RpcExceptionCode()); + } + RpcEndExcept; + + return Status; +} + + +NTSTATUS +NTAPI SamGetMembersInAlias(IN SAM_HANDLE AliasHandle, OUT PSID **MemberIds, OUT PULONG MemberCount) @@ -379,7 +430,7 @@ if (NT_SUCCESS(Status)) { *MemberCount = SidArray.Count; - *MemberIds = (PSID *)(SidArray.Sids); + *MemberIds = (PSID *)SidArray.Sids; } } @@ -417,6 +468,19 @@ RpcEndExcept; return Status; +} + + +NTSTATUS +NTAPI +SamLookupNamesInDomain(IN SAM_HANDLE DomainHandle, + IN ULONG Count, + IN PUNICODE_STRING Names, + OUT PULONG *RelativeIds, + OUT PSID_NAME_USE *Use) +{ + UNIMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; } @@ -509,6 +573,33 @@ NTSTATUS NTAPI +SamQueryInformationAlias(IN SAM_HANDLE AliasHandle, + IN ALIAS_INFORMATION_CLASS AliasInformationClass, + OUT PVOID *Buffer) +{ + NTSTATUS Status; + + TRACE("SamQueryInformationAlias(%p %lu %p)\n", + AliasHandle, AliasInformationClass, Buffer); + + RpcTryExcept + { + Status = SamrQueryInformationAlias((SAMPR_HANDLE)AliasHandle, + AliasInformationClass, + (PSAMPR_ALIAS_INFO_BUFFER *)Buffer); + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + Status = I_RpcMapWin32Status(RpcExceptionCode()); + } + RpcEndExcept; + + return Status; +} + + +NTSTATUS +NTAPI SamQueryInformationDomain(IN SAM_HANDLE DomainHandle, IN DOMAIN_INFORMATION_CLASS DomainInformationClass, OUT PVOID *Buffer) @@ -563,6 +654,33 @@ NTSTATUS NTAPI +SamSetInformationAlias(IN SAM_HANDLE AliasHandle, + IN ALIAS_INFORMATION_CLASS AliasInformationClass, + IN PVOID Buffer) +{ + NTSTATUS Status; + + TRACE("SamSetInformationAlias(%p %lu %p)\n", + AliasHandle, AliasInformationClass, Buffer); + + RpcTryExcept + { + Status = SamrSetInformationAlias((SAMPR_HANDLE)AliasHandle, + AliasInformationClass, + Buffer); + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + Status = I_RpcMapWin32Status(RpcExceptionCode()); + } + RpcEndExcept; + + return Status; +} + + +NTSTATUS +NTAPI SamSetInformationDomain(IN SAM_HANDLE DomainHandle, IN DOMAIN_INFORMATION_CLASS DomainInformationClass, IN PVOID DomainInformation) Modified: trunk/reactos/dll/win32/samlib/samlib.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samlib/samlib.sp…
============================================================================== --- trunk/reactos/dll/win32/samlib/samlib.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samlib/samlib.spec [iso-8859-1] Sat Jun 23 10:23:08 2012 @@ -19,7 +19,7 @@ @ stub SamEnumerateGroupsInDomain @ stub SamEnumerateUsersInDomain @ stdcall SamFreeMemory(ptr) -@ stub SamGetAliasMembership +@ stdcall SamGetAliasMembership(ptr long ptr ptr ptr) @ stub SamGetCompatibilityMode @ stub SamGetDisplayEnumerationIndex @ stub SamGetGroupsForUser @@ -27,13 +27,13 @@ @ stub SamGetMembersInGroup @ stdcall SamLookupDomainInSamServer(ptr ptr ptr) @ stub SamLookupIdsInDomain -@ stub SamLookupNamesInDomain +@ stdcall SamLookupNamesInDomain(ptr long ptr ptr ptr) @ stdcall SamOpenAlias(ptr long long ptr) @ stdcall SamOpenDomain(ptr long ptr ptr) @ stub SamOpenGroup @ stdcall SamOpenUser(ptr long long ptr) @ stub SamQueryDisplayInformation -@ stub SamQueryInformationAlias +@ stdcall SamQueryInformationAlias(ptr long ptr) @ stdcall SamQueryInformationDomain(ptr long ptr) @ stub SamQueryInformationGroup @ stdcall SamQueryInformationUser(ptr long ptr) @@ -43,7 +43,7 @@ @ stub SamRemoveMemberFromGroup @ stub SamRemoveMultipleMembersFromAlias @ stub SamRidToSid -@ stub SamSetInformationAlias +@ stdcall SamSetInformationAlias(ptr long ptr) @ stdcall SamSetInformationDomain(ptr long ptr) @ stub SamSetInformationGroup @ stdcall SamSetInformationUser(ptr long ptr) Modified: trunk/reactos/dll/win32/samsrv/samrpc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/samrpc.c?…
============================================================================== --- trunk/reactos/dll/win32/samsrv/samrpc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samsrv/samrpc.c [iso-8859-1] Sat Jun 23 10:23:08 2012 @@ -853,6 +853,7 @@ { PSAM_DB_OBJECT DomainObject; PSAM_DB_OBJECT AliasObject; + UNICODE_STRING EmptyString = RTL_CONSTANT_STRING(L""); ULONG ulSize; ULONG ulRid; WCHAR szRid[9]; @@ -941,7 +942,17 @@ return Status; } - /* FIXME: Set default alias attributes */ + /* Set the Description attribute */ + Status = SampSetObjectAttribute(AliasObject, + L"Description", + REG_SZ, + EmptyString.Buffer, + EmptyString.MaximumLength); + if (!NT_SUCCESS(Status)) + { + TRACE("failed with status 0x%08lx\n", Status); + return Status; + } if (NT_SUCCESS(Status)) { @@ -1198,8 +1209,142 @@ IN PSAMPR_PSID_ARRAY SidArray, OUT PSAMPR_ULONG_ARRAY Membership) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + PSAM_DB_OBJECT DomainObject; + HANDLE AliasesKeyHandle = NULL; + HANDLE MembersKeyHandle = NULL; + HANDLE MemberKeyHandle = NULL; + LPWSTR MemberSidString = NULL; + PULONG RidArray = NULL; + ULONG MaxSidCount = 0; + ULONG ValueCount; + ULONG DataLength; + ULONG i, j; + NTSTATUS Status; + + TRACE("SamrGetAliasMembership(%p %p %p)\n", + DomainHandle, SidArray, Membership); + + /* Validate the domain handle */ + Status = SampValidateDbObject(DomainHandle, + SamDbDomainObject, + DOMAIN_LOOKUP, + &DomainObject); + if (!NT_SUCCESS(Status)) + return Status; + + Status = SampRegOpenKey(DomainObject->KeyHandle, + L"Aliases", + KEY_READ, + &AliasesKeyHandle); + TRACE("SampRegOpenKey returned %08lX\n", Status); + if (!NT_SUCCESS(Status)) + goto done; + + Status = SampRegOpenKey(AliasesKeyHandle, + L"Members", + KEY_READ, + &MembersKeyHandle); + TRACE("SampRegOpenKey returned %08lX\n", Status); + if (!NT_SUCCESS(Status)) + goto done; + + for (i = 0; i < SidArray->Count; i++) + { + ConvertSidToStringSid(SidArray->Sids[i].SidPointer, &MemberSidString); +TRACE("Open %S\n", MemberSidString); + + Status = SampRegOpenKey(MembersKeyHandle, + MemberSidString, + KEY_READ, + &MemberKeyHandle); + TRACE("SampRegOpenKey returned %08lX\n", Status); + if (NT_SUCCESS(Status)) + { + Status = SampRegQueryKeyInfo(MemberKeyHandle, + NULL, + &ValueCount); + if (NT_SUCCESS(Status)) + { + TRACE("Found %lu values\n", ValueCount); + MaxSidCount += ValueCount; + } + + + NtClose(MemberKeyHandle); + } + + LocalFree(MemberSidString); + } + + TRACE("Maximum sid count: %lu\n", MaxSidCount); + RidArray = midl_user_allocate(MaxSidCount * sizeof(ULONG)); + if (RidArray == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto done; + } + + for (i = 0; i < SidArray->Count; i++) + { + ConvertSidToStringSid(SidArray->Sids[i].SidPointer, &MemberSidString); +TRACE("Open %S\n", MemberSidString); + + Status = SampRegOpenKey(MembersKeyHandle, + MemberSidString, + KEY_READ, + &MemberKeyHandle); + TRACE("SampRegOpenKey returned %08lX\n", Status); + if (NT_SUCCESS(Status)) + { + Status = SampRegQueryKeyInfo(MemberKeyHandle, + NULL, + &ValueCount); + if (NT_SUCCESS(Status)) + { + TRACE("Found %lu values\n", ValueCount); + + for (j = 0; j < ValueCount; j++) + { + DataLength = sizeof(ULONG); + Status = SampRegEnumerateValue(MemberKeyHandle, + j, + NULL, + NULL, + NULL, + (PVOID)&RidArray[j], + &DataLength); + } + } + + NtClose(MemberKeyHandle); + } + + LocalFree(MemberSidString); + } + + +done: + if (NT_SUCCESS(Status)) + { + Membership->Count = MaxSidCount; + Membership->Element = RidArray; + } + else + { + if (RidArray != NULL) + midl_user_free(RidArray); + } + + if (MembersKeyHandle != NULL) + NtClose(MembersKeyHandle); + + if (MembersKeyHandle != NULL) + NtClose(MembersKeyHandle); + + if (AliasesKeyHandle != NULL) + NtClose(AliasesKeyHandle); + + return Status; } /* Function 17 */ @@ -1368,8 +1513,76 @@ IN ALIAS_INFORMATION_CLASS AliasInformationClass, OUT PSAMPR_ALIAS_INFO_BUFFER *Buffer) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + PSAM_DB_OBJECT AliasObject; + NTSTATUS Status; + + TRACE("SamrQueryInformationAlias(%p %lu %p)\n", + AliasHandle, AliasInformationClass, Buffer); + + /* Validate the alias handle */ + Status = SampValidateDbObject(AliasHandle, + SamDbAliasObject, + ALIAS_READ_INFORMATION, + &AliasObject); + if (!NT_SUCCESS(Status)) + return Status; + + switch (AliasInformationClass) + { +#if 0 + case AliasGeneralInformation: + Status = SampQueryAliasGeneral(AliasObject, + &Buffer->General); + break; + + case AliasNameInformation: + Status = SampQueryAliasName(AliasObject, + &Buffer->Name); + break; + + case AliasAdminCommentInformation: + Status = SampQueryAliasAdminComment(AliasObject, + &Buffer->AdminComment); + break; +#endif + + default: + Status = STATUS_INVALID_INFO_CLASS; + break; + } + + return Status; +} + + +static NTSTATUS +SampSetAliasName(PSAM_DB_OBJECT AliasObject, + PSAMPR_ALIAS_NAME_INFORMATION AliasNameInfo) +{ + NTSTATUS Status; + + Status = SampSetObjectAttribute(AliasObject, + L"Name", + REG_SZ, + AliasNameInfo->Name.Buffer, + AliasNameInfo->Name.Length + sizeof(WCHAR)); + + return Status; +} + +static NTSTATUS +SampSetAliasAdminComment(PSAM_DB_OBJECT AliasObject, + PSAMPR_ALIAS_ADM_COMMENT_INFORMATION AliasAdminCommentInfo) +{ + NTSTATUS Status; + + Status = SampSetObjectAttribute(AliasObject, + L"Description", + REG_SZ, + AliasAdminCommentInfo->AdminComment.Buffer, + AliasAdminCommentInfo->AdminComment.Length + sizeof(WCHAR)); + + return Status; } /* Function 29 */ @@ -1379,8 +1592,38 @@ IN ALIAS_INFORMATION_CLASS AliasInformationClass, IN PSAMPR_ALIAS_INFO_BUFFER Buffer) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + PSAM_DB_OBJECT AliasObject; + NTSTATUS Status; + + TRACE("SamrSetInformationAlias(%p %lu %p)\n", + AliasHandle, AliasInformationClass, Buffer); + + /* Validate the alias handle */ + Status = SampValidateDbObject(AliasHandle, + SamDbAliasObject, + ALIAS_WRITE_ACCOUNT, + &AliasObject); + if (!NT_SUCCESS(Status)) + return Status; + + switch (AliasInformationClass) + { + case AliasNameInformation: + Status = SampSetAliasName(AliasObject, + &Buffer->Name); + break; + + case AliasAdminCommentInformation: + Status = SampSetAliasAdminComment(AliasObject, + &Buffer->AdminComment); + break; + + default: + Status = STATUS_INVALID_INFO_CLASS; + break; + } + + return Status; } /* Function 30 */ Modified: trunk/reactos/dll/win32/samsrv/setup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/setup.c?r…
============================================================================== --- trunk/reactos/dll/win32/samsrv/setup.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samsrv/setup.c [iso-8859-1] Sat Jun 23 10:23:08 2012 @@ -58,9 +58,110 @@ } +static PSID +AppendRidToSid(PSID SrcSid, + ULONG Rid) +{ + ULONG Rids[8] = {0, 0, 0, 0, 0, 0, 0, 0}; + UCHAR RidCount; + PSID DstSid; + ULONG i; + + RidCount = *RtlSubAuthorityCountSid(SrcSid); + if (RidCount >= 8) + return NULL; + + for (i = 0; i < RidCount; i++) + Rids[i] = *RtlSubAuthoritySid(SrcSid, i); + + Rids[RidCount] = Rid; + RidCount++; + + RtlAllocateAndInitializeSid(RtlIdentifierAuthoritySid(SrcSid), + RidCount, + Rids[0], + Rids[1], + Rids[2], + Rids[3], + Rids[4], + Rids[5], + Rids[6], + Rids[7], + &DstSid); + + return DstSid; +} + + +static BOOL +SampAddMemberToAlias(HKEY hDomainKey, + ULONG AliasId, + PSID MemberSid) +{ + DWORD dwDisposition; + LPWSTR MemberSidString = NULL; + WCHAR szKeyName[256]; + HKEY hMembersKey; + + ConvertSidToStringSidW(MemberSid, &MemberSidString); + + swprintf(szKeyName, L"Aliases\\%08lX\\Members", AliasId); + + if (!RegCreateKeyExW(hDomainKey, + szKeyName, + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, + NULL, + &hMembersKey, + &dwDisposition)) + { + RegSetValueEx(hMembersKey, + MemberSidString, + 0, + REG_BINARY, + (LPVOID)MemberSid, + RtlLengthSid(MemberSid)); + + RegCloseKey(hMembersKey); + } + + swprintf(szKeyName, L"Aliases\\Members\\%s", MemberSidString); + + if (!RegCreateKeyExW(hDomainKey, + szKeyName, + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, + NULL, + &hMembersKey, + &dwDisposition)) + { + swprintf(szKeyName, L"%08lX", AliasId); + + RegSetValueEx(hMembersKey, + szKeyName, + 0, + REG_BINARY, + (LPVOID)MemberSid, + RtlLengthSid(MemberSid)); + + RegCloseKey(hMembersKey); + } + + if (MemberSidString != NULL) + LocalFree(MemberSidString); + + return TRUE; +} + + static BOOL SampCreateAliasAccount(HKEY hDomainKey, LPCWSTR lpAccountName, + LPCWSTR lpDescription, ULONG ulRelativeId) { DWORD dwDisposition; @@ -86,6 +187,13 @@ REG_SZ, (LPVOID)lpAccountName, (wcslen(lpAccountName) + 1) * sizeof(WCHAR)); + + RegSetValueEx(hAccountKey, + L"Description", + 0, + REG_SZ, + (LPVOID)lpDescription, + (wcslen(lpDescription) + 1) * sizeof(WCHAR)); RegCloseKey(hAccountKey); } @@ -332,6 +440,7 @@ HKEY hDomainKey = NULL; PSID pBuiltinSid = NULL; BOOL bResult = TRUE; + PSID pSid; NTSTATUS Status; TRACE("SampInitializeSAM() called\n"); @@ -398,19 +507,36 @@ { SampCreateAliasAccount(hDomainKey, L"Administrators", + L"", DOMAIN_ALIAS_RID_ADMINS); SampCreateAliasAccount(hDomainKey, L"Users", + L"", DOMAIN_ALIAS_RID_USERS); SampCreateAliasAccount(hDomainKey, L"Guests", + L"", DOMAIN_ALIAS_RID_GUESTS); SampCreateAliasAccount(hDomainKey, L"Power Users", + L"", DOMAIN_ALIAS_RID_POWER_USERS); + + + pSid = AppendRidToSid(AccountDomainInfo->DomainSid, + DOMAIN_USER_RID_ADMIN); + if (pSid != NULL) + { + SampAddMemberToAlias(hDomainKey, + DOMAIN_ALIAS_RID_ADMINS, + pSid); + + RtlFreeHeap(RtlGetProcessHeap(), 0, pSid); + } + RegCloseKey(hDomainKey); } Modified: trunk/reactos/include/ddk/ntsam.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/ntsam.h?rev=56…
============================================================================== --- trunk/reactos/include/ddk/ntsam.h [iso-8859-1] (original) +++ trunk/reactos/include/ddk/ntsam.h [iso-8859-1] Sat Jun 23 10:23:08 2012 @@ -57,6 +57,31 @@ PSID Sid; UNICODE_STRING Name; } SAM_SID_ENUMERATION, *PSAM_SID_ENUMERATION; + +typedef enum _ALIAS_INFORMATION_CLASS +{ + AliasGeneralInformation = 1, + AliasNameInformation, + AliasAdminCommentInformation +} ALIAS_INFORMATION_CLASS, *PALIAS_INFORMATION_CLASS; + +typedef struct _SAMPR_ALIAS_GENERAL_INFORMATION +{ + UNICODE_STRING Name; + ULONG MemberCount; + UNICODE_STRING AdminComment; +} SAMPR_ALIAS_GENERAL_INFORMATION, *PSAMPR_ALIAS_GENERAL_INFORMATION; + +typedef struct _SAMPR_ALIAS_NAME_INFORMATION +{ + UNICODE_STRING Name; +} SAMPR_ALIAS_NAME_INFORMATION, *PSAMPR_ALIAS_NAME_INFORMATION; + +typedef struct _SAMPR_ALIAS_ADM_COMMENT_INFORMATION +{ + UNICODE_STRING AdminComment; +} SAMPR_ALIAS_ADM_COMMENT_INFORMATION, *PSAMPR_ALIAS_ADM_COMMENT_INFORMATION; + typedef enum _DOMAIN_INFORMATION_CLASS { @@ -174,6 +199,14 @@ NTSTATUS NTAPI +SamGetAliasMembership(IN SAM_HANDLE DomainHandle, + IN ULONG PassedCount, + IN PSID *Sids, + OUT PULONG MembershipCount, + OUT PULONG *Aliases); + +NTSTATUS +NTAPI SamGetMembersInAlias(IN SAM_HANDLE AliasHandle, OUT PSID **MemberIds, OUT PULONG MemberCount); @@ -183,6 +216,14 @@ SamLookupDomainInSamServer(IN SAM_HANDLE ServerHandle, IN PUNICODE_STRING Name, OUT PSID *DomainId); + +NTSTATUS +NTAPI +SamLookupNamesInDomain(IN SAM_HANDLE DomainHandle, + IN ULONG Count, + IN PUNICODE_STRING Names, + OUT PULONG *RelativeIds, + OUT PSID_NAME_USE *Use); NTSTATUS NTAPI @@ -207,6 +248,12 @@ NTSTATUS NTAPI +SamQueryInformationAlias(IN SAM_HANDLE AliasHandle, + IN ALIAS_INFORMATION_CLASS AliasInformationClass, + OUT PVOID *Buffer); + +NTSTATUS +NTAPI SamQueryInformationDomain(IN SAM_HANDLE DomainHandle, IN DOMAIN_INFORMATION_CLASS DomainInformationClass, OUT PVOID *Buffer); @@ -219,6 +266,12 @@ NTSTATUS NTAPI +SamSetInformationAlias(IN SAM_HANDLE AliasHandle, + IN ALIAS_INFORMATION_CLASS AliasInformationClass, + IN PVOID Buffer); + +NTSTATUS +NTAPI SamSetInformationDomain(IN SAM_HANDLE DomainHandle, IN DOMAIN_INFORMATION_CLASS DomainInformationClass, IN PVOID DomainInformation);
12 years, 6 months
1
0
0
0
[tfaber] 56784: [WS2_32] - Sync async.c to Wine 1.5.4. Fixes crash in ws2_32:sock
by tfaber@svn.reactos.org
Author: tfaber Date: Sat Jun 23 06:04:09 2012 New Revision: 56784 URL:
http://svn.reactos.org/svn/reactos?rev=56784&view=rev
Log: [WS2_32] - Sync async.c to Wine 1.5.4. Fixes crash in ws2_32:sock Modified: trunk/reactos/dll/win32/ws2_32/misc/async.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/ws2_32/misc/async.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/misc/asyn…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/misc/async.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/misc/async.c [iso-8859-1] Sat Jun 23 06:04:09 2012 @@ -2,6 +2,7 @@ * * Copyright (C) 1993,1994,1996,1997 John Brezak, Erik Bos, Alex Korobka. * Copyright (C) 1999 Marcus Meissner + * Copyright (C) 2009 Alexandre Julliard * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -35,117 +36,71 @@ #include <windows.h> -#define WS_FD_SETSIZE FD_SETSIZE -typedef struct hostent WS_hostent; -typedef struct servent WS_servent; -typedef struct protoent WS_protoent; - #include "wine/config.h" #include "wine/port.h" -#ifndef __REACTOS__ #include <stdarg.h> -#include <string.h> -#include <sys/types.h> -#ifdef HAVE_SYS_IPC_H -# include <sys/ipc.h> -#endif -#ifdef HAVE_SYS_IOCTL_H -# include <sys/ioctl.h> -#endif -#ifdef HAVE_SYS_FILIO_H -# include <sys/filio.h> -#endif -#if defined(__svr4__) -#include <sys/ioccom.h> -#ifdef HAVE_SYS_SOCKIO_H -# include <sys/sockio.h> -#endif -#endif - -#if defined(__EMX__) -# include <sys/so_ioctl.h> -#endif - -#ifdef HAVE_SYS_PARAM_H -# include <sys/param.h> -#endif - -#ifdef HAVE_SYS_MSG_H -# include <sys/msg.h> -#endif -#ifdef HAVE_SYS_WAIT_H -#include <sys/wait.h> -#endif -#ifdef HAVE_SYS_SOCKET_H -#include <sys/socket.h> -#endif -#ifdef HAVE_NETINET_IN_H -# include <netinet/in.h> -#endif -#ifdef HAVE_ARPA_INET_H -# include <arpa/inet.h> -#endif -#include <ctype.h> -#include <fcntl.h> -#include <errno.h> -#ifdef HAVE_SYS_ERRNO_H -#include <sys/errno.h> -#endif -#ifdef HAVE_NETDB_H -#include <netdb.h> -#endif -#ifdef HAVE_UNISTD_H -# include <unistd.h> -#endif -#include <stdlib.h> -#ifdef HAVE_ARPA_NAMESER_H -# include <arpa/nameser.h> -#endif -#ifdef HAVE_RESOLV_H -# include <resolv.h> -#endif -#endif - -#include "wine/winbase16.h" #include "windef.h" #include "winbase.h" #include "wingdi.h" #include "winuser.h" #include "winsock2.h" #include "ws2spi.h" -#include "wownt32.h" -#include "wine/winsock16.h" -#include "winnt.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(winsock); -/* protoptypes of some functions in socket.c - */ - -#define AQ_WIN16 0x00 -#define AQ_WIN32 0x04 -#define HB_WIN32(hb) (hb->flags & AQ_WIN32) -#define AQ_NUMBER 0x00 -#define AQ_NAME 0x08 -#define AQ_COPYPTR1 0x10 -#define AQ_DUPLOWPTR1 0x20 -#define AQ_MASKPTR1 0x30 -#define AQ_COPYPTR2 0x40 -#define AQ_DUPLOWPTR2 0x80 -#define AQ_MASKPTR2 0xC0 - -#define AQ_GETHOST 0 -#define AQ_GETPROTO 1 -#define AQ_GETSERV 2 -#define AQ_GETMASK 3 - -/* The handles used are pseudo-handles that can be simply casted. */ -/* 16-bit values are used internally (to be sure handle comparison works right in 16-bit apps). */ -#define WSA_H32(h16) ((HANDLE)(ULONG_PTR)(h16)) +struct async_query_header +{ + HWND hWnd; + UINT uMsg; + void *sbuf; + INT sbuflen; + HANDLE handle; +}; + +struct async_query_gethostbyname +{ + struct async_query_header query; + char *host_name; +}; + +struct async_query_gethostbyaddr +{ + struct async_query_header query; + char *host_addr; + int host_len; + int host_type; +}; + +struct async_query_getprotobyname +{ + struct async_query_header query; + char *proto_name; +}; + +struct async_query_getprotobynumber +{ + struct async_query_header query; + int proto_number; +}; + +struct async_query_getservbyname +{ + struct async_query_header query; + char *serv_name; + char *serv_proto; +}; + +struct async_query_getservbyport +{ + struct async_query_header query; + char *serv_proto; + int serv_port; +}; + /* ----------------------------------- helper functions - */ @@ -159,10 +114,8 @@ return j; } -static int list_dup(char** l_src, char* ref, char* base, int item_size) -{ - /* base is either either equal to ref or 0 or SEGPTR */ - +static int list_dup(char** l_src, char* ref, int item_size) +{ char* p = ref; char** l_to = (char**)ref; int i,j,k; @@ -170,313 +123,141 @@ for(j=0;l_src[j];j++) ; p += (j + 1) * sizeof(char*); for(i=0;i<j;i++) - { l_to[i] = base + (p - ref); + { l_to[i] = p; k = ( item_size ) ? item_size : strlen(l_src[i]) + 1; memcpy(p, l_src[i], k); p += k; } l_to[i] = NULL; return (p - ref); } +static DWORD finish_query( struct async_query_header *query, LPARAM lparam ) +{ + PostMessageW( query->hWnd, query->uMsg, (WPARAM)query->handle, lparam ); + HeapFree( GetProcessHeap(), 0, query ); + return 0; +} + /* ----- hostent */ -static int hostent_size(struct hostent* p_he) -{ - int size = 0; - if( p_he ) - { size = sizeof(struct hostent); - size += strlen(p_he->h_name) + 1; - size += list_size(p_he->h_aliases, 0); - size += list_size(p_he->h_addr_list, p_he->h_length ); } - return size; -} - -/* Copy hostent to p_to, fix up inside pointers using p_base (different for - * Win16 (linear vs. segmented). Return -neededsize on overrun. - */ -static int WS_copy_he(char *p_to,char *p_base,int t_size,struct hostent* p_he, int flag) -{ - char* p_name,*p_aliases,*p_addr,*p; - struct ws_hostent16 *p_to16 = (struct ws_hostent16*)p_to; - WS_hostent *p_to32 = (WS_hostent*)p_to; - int size = hostent_size(p_he) + - ( - (flag & AQ_WIN32) ? sizeof(WS_hostent) : sizeof(struct ws_hostent16) - - sizeof(struct hostent) - ); - - if (t_size < size) - return -size; - p = p_to; - p += (flag & AQ_WIN32) ? - sizeof(WS_hostent) : sizeof(struct ws_hostent16); - p_name = p; - strcpy(p, p_he->h_name); p += strlen(p) + 1; - p_aliases = p; - p += list_dup(p_he->h_aliases, p, p_base + (p - p_to), 0); - p_addr = p; - list_dup(p_he->h_addr_list, p, p_base + (p - p_to), p_he->h_length); - - if (flag & AQ_WIN32) - { - p_to32->h_addrtype = p_he->h_addrtype; - p_to32->h_length = p_he->h_length; - p_to32->h_name = (p_base + (p_name - p_to)); - p_to32->h_aliases = (char **)(p_base + (p_aliases - p_to)); - p_to32->h_addr_list = (char **)(p_base + (p_addr - p_to)); - } - else - { - p_to16->h_addrtype = (INT16)p_he->h_addrtype; - p_to16->h_length = (INT16)p_he->h_length; - p_to16->h_name = (SEGPTR)(p_base + (p_name - p_to)); - p_to16->h_aliases = (SEGPTR)(p_base + (p_aliases - p_to)); - p_to16->h_addr_list = (SEGPTR)(p_base + (p_addr - p_to)); - } - - return size; +static LPARAM copy_he(void *base, int size, const struct hostent *he) +{ + char *p; + int needed; + struct hostent *to = base; + + if (!he) return MAKELPARAM( 0, GetLastError() ); + + needed = sizeof(struct hostent) + strlen(he->h_name) + 1 + + list_size(he->h_aliases, 0) + + list_size(he->h_addr_list, he->h_length ); + if (size < needed) return MAKELPARAM( needed, WSAENOBUFS ); + + to->h_addrtype = he->h_addrtype; + to->h_length = he->h_length; + p = (char *)(to + 1); + to->h_name = p; + strcpy(p, he->h_name); p += strlen(p) + 1; + to->h_aliases = (char **)p; + p += list_dup(he->h_aliases, p, 0); + to->h_addr_list = (char **)p; + list_dup(he->h_addr_list, p, he->h_length); + return MAKELPARAM( needed, 0 ); +} + +static DWORD WINAPI async_gethostbyname(LPVOID arg) +{ + struct async_query_gethostbyname *aq = arg; + struct hostent *he = gethostbyname( aq->host_name ); + + return finish_query( &aq->query, copy_he( aq->query.sbuf, aq->query.sbuflen, he )); +} + +static DWORD WINAPI async_gethostbyaddr(LPVOID arg) +{ + struct async_query_gethostbyaddr *aq = arg; + struct hostent *he = gethostbyaddr( aq->host_addr, aq->host_len, aq->host_type ); + + return finish_query( &aq->query, copy_he( aq->query.sbuf, aq->query.sbuflen, he )); } /* ----- protoent */ -static int protoent_size(struct protoent* p_pe) -{ - int size = 0; - if( p_pe ) - { size = sizeof(struct protoent); - size += strlen(p_pe->p_name) + 1; - size += list_size(p_pe->p_aliases, 0); } - return size; -} - -/* Copy protoent to p_to, fix up inside pointers using p_base (different for - * Win16 (linear vs. segmented). Return -neededsize on overrun. - */ -static int WS_copy_pe(char *p_to,char *p_base,int t_size,struct protoent* p_pe, int flag) -{ - char* p_name,*p_aliases,*p; - struct ws_protoent16 *p_to16 = (struct ws_protoent16*)p_to; - WS_protoent *p_to32 = (WS_protoent*)p_to; - int size = protoent_size(p_pe) + - ( - (flag & AQ_WIN32) ? sizeof(WS_protoent) : sizeof(struct ws_protoent16) - - sizeof(struct protoent) - ); - - if (t_size < size) - return -size; - p = p_to; - p += (flag & AQ_WIN32) ? sizeof(WS_protoent) : sizeof(struct ws_protoent16); - p_name = p; - strcpy(p, p_pe->p_name); p += strlen(p) + 1; - p_aliases = p; - list_dup(p_pe->p_aliases, p, p_base + (p - p_to), 0); - - if (flag & AQ_WIN32) - { - p_to32->p_proto = p_pe->p_proto; - p_to32->p_name = (p_base) + (p_name - p_to); - p_to32->p_aliases = (char **)((p_base) + (p_aliases - p_to)); - } - else - { - p_to16->p_proto = (INT16)p_pe->p_proto; - p_to16->p_name = (SEGPTR)(p_base) + (p_name - p_to); - p_to16->p_aliases = (SEGPTR)((p_base) + (p_aliases - p_to)); - } - - return size; +static LPARAM copy_pe(void *base, int size, const struct protoent* pe) +{ + char *p; + int needed; + struct protoent *to = base; + + if (!pe) return MAKELPARAM( 0, GetLastError() ); + + needed = sizeof(struct protoent) + strlen(pe->p_name) + 1 + list_size(pe->p_aliases, 0); + if (size < needed) return MAKELPARAM( needed, WSAENOBUFS ); + + to->p_proto = pe->p_proto; + p = (char *)(to + 1); + to->p_name = p; + strcpy(p, pe->p_name); p += strlen(p) + 1; + to->p_aliases = (char **)p; + list_dup(pe->p_aliases, p, 0); + return MAKELPARAM( needed, 0 ); +} + +static DWORD WINAPI async_getprotobyname(LPVOID arg) +{ + struct async_query_getprotobyname *aq = arg; + struct protoent *pe = getprotobyname( aq->proto_name ); + + return finish_query( &aq->query, copy_pe( aq->query.sbuf, aq->query.sbuflen, pe )); +} + +static DWORD WINAPI async_getprotobynumber(LPVOID arg) +{ + struct async_query_getprotobynumber *aq = arg; + struct protoent *pe = getprotobynumber( aq->proto_number ); + + return finish_query( &aq->query, copy_pe( aq->query.sbuf, aq->query.sbuflen, pe )); } /* ----- servent */ -static int servent_size(struct servent* p_se) -{ - int size = 0; - if( p_se ) { - size += sizeof(struct servent); - size += strlen(p_se->s_proto) + strlen(p_se->s_name) + 2; - size += list_size(p_se->s_aliases, 0); - } - return size; -} - -/* Copy servent to p_to, fix up inside pointers using p_base (different for - * Win16 (linear vs. segmented). Return -neededsize on overrun. - * Take care of different Win16/Win32 servent structs (packing !) - */ -static int WS_copy_se(char *p_to,char *p_base,int t_size,struct servent* p_se, int flag) -{ - char* p_name,*p_aliases,*p_proto,*p; - struct ws_servent16 *p_to16 = (struct ws_servent16*)p_to; - WS_servent *p_to32 = (WS_servent*)p_to; - int size = servent_size(p_se) + - ( - (flag & AQ_WIN32) ? sizeof(WS_servent) : sizeof(struct ws_servent16) - - sizeof(struct servent) - ); - - if (t_size < size) - return -size; - p = p_to; - p += (flag & AQ_WIN32) ? sizeof(WS_servent) : sizeof(struct ws_servent16); - p_name = p; - strcpy(p, p_se->s_name); p += strlen(p) + 1; - p_proto = p; - strcpy(p, p_se->s_proto); p += strlen(p) + 1; - p_aliases = p; - list_dup(p_se->s_aliases, p, p_base + (p - p_to), 0); - - if (flag & AQ_WIN32) - { - p_to32->s_port = p_se->s_port; - p_to32->s_name = (p_base + (p_name - p_to)); - p_to32->s_proto = (p_base + (p_proto - p_to)); - p_to32->s_aliases = (char **)(p_base + (p_aliases - p_to)); - } - else - { - p_to16->s_port = (INT16)p_se->s_port; - p_to16->s_name = (SEGPTR)(p_base + (p_name - p_to)); - p_to16->s_proto = (SEGPTR)(p_base + (p_proto - p_to)); - p_to16->s_aliases = (SEGPTR)(p_base + (p_aliases - p_to)); - } - - return size; -} - -static HANDLE16 __ws_async_handle = 0xdead; - -/* Generic async query struct. we use symbolic names for the different queries - * for readability. - */ -typedef struct _async_query { - HWND16 hWnd; - UINT16 uMsg; - LPCSTR ptr1; -#define host_name ptr1 -#define host_addr ptr1 -#define serv_name ptr1 -#define proto_name ptr1 - LPCSTR ptr2; -#define serv_proto ptr2 - int int1; -#define host_len int1 -#define proto_number int1 -#define serv_port int1 - int int2; -#define host_type int2 - SEGPTR sbuf; - INT16 sbuflen; - - HANDLE16 async_handle; - int flags; - int qt; - char xbuf[1]; -} async_query; - - -/**************************************************************************** - * The async query function. - * - * It is either called as a thread startup routine or directly. It has - * to free the passed arg from the process heap and PostMessageA the async - * result or the error code. - * - * FIXME: - * - errorhandling not verified. - */ -static DWORD WINAPI _async_queryfun(LPVOID arg) { - async_query *aq = (async_query*)arg; - int size = 0; - WORD fail = 0; - char *targetptr = (HB_WIN32(aq)?(char*)aq->sbuf:0/*(char*)MapSL(aq->sbuf)*/); - - switch (aq->flags & AQ_GETMASK) { - case AQ_GETHOST: { - struct hostent *he; - char *copy_hostent = targetptr; - char buf[100]; - if( !(aq->host_name)) { - aq->host_name = buf; - if( gethostname( buf, 100) == -1) { - fail = WSAENOBUFS; /* appropriate ? */ - break; - } - } - he = (aq->flags & AQ_NAME) ? - gethostbyname(aq->host_name): - gethostbyaddr(aq->host_addr,aq->host_len,aq->host_type); - if (!he) fail = WSAGetLastError(); - if (he) { - size = WS_copy_he(copy_hostent,(char*)aq->sbuf,aq->sbuflen,he,aq->flags); - if (size < 0) { - fail = WSAENOBUFS; - size = -size; - } - } - } - break; - case AQ_GETPROTO: { -#if defined(HAVE_GETPROTOBYNAME) && defined(HAVE_GETPROTOBYNUMBER) - struct protoent *pe; - char *copy_protoent = targetptr; - pe = (aq->flags & AQ_NAME)? - getprotobyname(aq->proto_name) : - getprotobynumber(aq->proto_number); - if (pe) { - size = WS_copy_pe(copy_protoent,(char*)aq->sbuf,aq->sbuflen,pe,aq->flags); - if (size < 0) { - fail = WSAENOBUFS; - size = -size; - } - } else { - if (aq->flags & AQ_NAME) - MESSAGE("protocol %s not found; You might want to add " - "this to /etc/protocols\n", debugstr_a(aq->proto_name) ); - else - MESSAGE("protocol number %d not found; You might want to add " - "this to /etc/protocols\n", aq->proto_number ); - fail = WSANO_DATA; - } -#else - fail = WSANO_DATA; -#endif - } - break; - case AQ_GETSERV: { - struct servent *se; - char *copy_servent = targetptr; - se = (aq->flags & AQ_NAME)? - getservbyname(aq->serv_name,aq->serv_proto) : -#ifdef HAVE_GETSERVBYPORT - getservbyport(aq->serv_port,aq->serv_proto); -#else - NULL; -#endif - if (se) { - size = WS_copy_se(copy_servent,(char*)aq->sbuf,aq->sbuflen,se,aq->flags); - if (size < 0) { - fail = WSAENOBUFS; - size = -size; - } - } else { - if (aq->flags & AQ_NAME) - MESSAGE("service %s protocol %s not found; You might want to add " - "this to /etc/services\n", debugstr_a(aq->serv_name) , - aq->serv_proto ? debugstr_a(aq->serv_proto ):"*"); - else - MESSAGE("service on port %d protocol %s not found; You might want to add " - "this to /etc/services\n", aq->serv_port, - aq->serv_proto ? debugstr_a(aq->serv_proto ):"*"); - fail = WSANO_DATA; - } - } - break; - } - PostMessageA(HWND_32(aq->hWnd),aq->uMsg,(WPARAM) aq->async_handle,size|(fail<<16)); - HeapFree(GetProcessHeap(),0,arg); - return 0; -} +static LPARAM copy_se(void *base, int size, const struct servent* se) +{ + char *p; + int needed; + struct servent *to = base; + + if (!se) return MAKELPARAM( 0, GetLastError() ); + + needed = sizeof(struct servent) + strlen(se->s_proto) + strlen(se->s_name) + 2 + list_size(se->s_aliases, 0); + if (size < needed) return MAKELPARAM( needed, WSAENOBUFS ); + + to->s_port = se->s_port; + p = (char *)(to + 1); + to->s_name = p; + strcpy(p, se->s_name); p += strlen(p) + 1; + to->s_proto = p; + strcpy(p, se->s_proto); p += strlen(p) + 1; + to->s_aliases = (char **)p; + list_dup(se->s_aliases, p, 0); + return MAKELPARAM( needed, 0 ); +} + +static DWORD WINAPI async_getservbyname(LPVOID arg) +{ + struct async_query_getservbyname *aq = arg; + struct servent *se = getservbyname( aq->serv_name, aq->serv_proto ); + + return finish_query( &aq->query, copy_se( aq->query.sbuf, aq->query.sbuflen, se )); +} + +static DWORD WINAPI async_getservbyport(LPVOID arg) +{ + struct async_query_getservbyport *aq = arg; + struct servent *se = getservbyport( aq->serv_port, aq->serv_proto ); + + return finish_query( &aq->query, copy_se( aq->query.sbuf, aq->query.sbuflen, se )); +} + /**************************************************************************** * The main async help function. @@ -485,81 +266,33 @@ * with no thread support. This relies on the fact that PostMessage() does * not actually call the windowproc before the function returns. */ -static HANDLE16 __WSAsyncDBQuery( - HWND hWnd, UINT uMsg,INT int1,LPCSTR ptr1, INT int2, LPCSTR ptr2, - void *sbuf, INT sbuflen, UINT flags -) -{ - async_query* aq; - char* pto; - LPCSTR pfm; - int xbuflen = 0; - - /* allocate buffer to copy protocol- and service name to */ - /* note: this is done in the calling thread so we can return */ - /* a decent error code if the Alloc fails */ - - switch (flags & AQ_MASKPTR1) { - case 0: break; - case AQ_COPYPTR1: xbuflen += int1; break; - case AQ_DUPLOWPTR1: xbuflen += strlen(ptr1) + 1; break; - } - - switch (flags & AQ_MASKPTR2) { - case 0: break; - case AQ_COPYPTR2: xbuflen += int2; break; - case AQ_DUPLOWPTR2: xbuflen += strlen(ptr2) + 1; break; - } - - if(!(aq = HeapAlloc(GetProcessHeap(),0,sizeof(async_query) + xbuflen))) { - SetLastError(WSAEWOULDBLOCK); /* insufficient resources */ - return 0; - } - - pto = aq->xbuf; - if (ptr1) switch (flags & AQ_MASKPTR1) { - case 0: break; - case AQ_COPYPTR1: memcpy(pto, ptr1, int1); ptr1 = pto; pto += int1; break; - case AQ_DUPLOWPTR1: pfm = ptr1; ptr1 = pto; do *pto++ = tolower(*pfm); while (*pfm++); break; - } - if (ptr2) switch (flags & AQ_MASKPTR2) { - case 0: break; - case AQ_COPYPTR2: memcpy(pto, ptr2, int2); ptr2 = pto; pto += int2; break; - case AQ_DUPLOWPTR2: pfm = ptr2; ptr2 = pto; do *pto++ = tolower(*pfm); while (*pfm++); break; - } - - aq->hWnd = HWND_16(hWnd); - aq->uMsg = uMsg; - aq->int1 = int1; - aq->ptr1 = ptr1; - aq->int2 = int2; - aq->ptr2 = ptr2; - /* avoid async_handle = 0 */ - aq->async_handle = (++__ws_async_handle ? __ws_async_handle : ++__ws_async_handle); - aq->flags = flags; - aq->sbuf = (SEGPTR)sbuf; - aq->sbuflen = sbuflen; - -#if 1 - if (CreateThread(NULL,0,_async_queryfun,aq,0,NULL) == INVALID_HANDLE_VALUE) -#endif - _async_queryfun(aq); - return __ws_async_handle; -} - - -/*********************************************************************** - * WSAAsyncGetHostByAddr (WINSOCK.102) - */ -HANDLE16 WINAPI WSAAsyncGetHostByAddr16(HWND16 hWnd, UINT16 uMsg, LPCSTR addr, - INT16 len, INT16 type, SEGPTR sbuf, INT16 buflen) -{ - TRACE("hwnd %04x, msg %04x, addr %08x[%i]\n", - hWnd, uMsg, (unsigned)addr , len ); - return __WSAsyncDBQuery(HWND_32(hWnd),uMsg,len,addr,type,NULL, - (void*)sbuf,buflen, - AQ_NUMBER|AQ_COPYPTR1|AQ_WIN16|AQ_GETHOST); -} +static HANDLE run_query( HWND hWnd, UINT uMsg, LPTHREAD_START_ROUTINE func, + struct async_query_header *query, void *sbuf, INT sbuflen ) +{ + static LONG next_handle = 0xdead; + HANDLE thread; + ULONG handle; + do + handle = LOWORD( InterlockedIncrement( &next_handle )); + while (!handle); /* avoid handle 0 */ + + query->hWnd = hWnd; + query->uMsg = uMsg; + query->handle = UlongToHandle( handle ); + query->sbuf = sbuf; + query->sbuflen = sbuflen; + + thread = CreateThread( NULL, 0, func, query, 0, NULL ); + if (!thread) + { + SetLastError( WSAEWOULDBLOCK ); + HeapFree( GetProcessHeap(), 0, query ); + return 0; + } + CloseHandle( thread ); + return UlongToHandle( handle ); +} + /*********************************************************************** * WSAAsyncGetHostByAddr (WS2_32.102) @@ -567,23 +300,20 @@ HANDLE WINAPI WSAAsyncGetHostByAddr(HWND hWnd, UINT uMsg, LPCSTR addr, INT len, INT type, LPSTR sbuf, INT buflen) { - TRACE("hwnd %p, msg %04x, addr %08x[%i]\n", - hWnd, uMsg, (unsigned)addr , len ); - return WSA_H32( __WSAsyncDBQuery(hWnd,uMsg,len,addr,type,NULL,sbuf,buflen, - AQ_NUMBER|AQ_COPYPTR1|AQ_WIN32|AQ_GETHOST)); -} - -/*********************************************************************** - * WSAAsyncGetHostByName (WINSOCK.103) - */ -HANDLE16 WINAPI WSAAsyncGetHostByName16(HWND16 hWnd, UINT16 uMsg, LPCSTR name, - SEGPTR sbuf, INT16 buflen) -{ - TRACE("hwnd %04x, msg %04x, host %s, buffer %i\n", - hWnd, uMsg, (name)?name:"<null>", (int)buflen ); - return __WSAsyncDBQuery(HWND_32(hWnd),uMsg,0,name,0,NULL, - (void*)sbuf,buflen, - AQ_NAME|AQ_DUPLOWPTR1|AQ_WIN16|AQ_GETHOST); + struct async_query_gethostbyaddr *aq; + + TRACE("hwnd %p, msg %04x, addr %p[%i]\n", hWnd, uMsg, addr, len ); + + if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len ))) + { + SetLastError( WSAEWOULDBLOCK ); + return 0; + } + aq->host_addr = (char *)(aq + 1); + aq->host_len = len; + aq->host_type = type; + memcpy( aq->host_addr, addr, len ); + return run_query( hWnd, uMsg, async_gethostbyaddr, &aq->query, sbuf, buflen ); } /*********************************************************************** @@ -592,23 +322,19 @@ HANDLE WINAPI WSAAsyncGetHostByName(HWND hWnd, UINT uMsg, LPCSTR name, LPSTR sbuf, INT buflen) { - TRACE("hwnd %p, msg %08x, host %s, buffer %i\n", - hWnd, uMsg, (name)?name:"<null>", (int)buflen ); - return WSA_H32( __WSAsyncDBQuery(hWnd,uMsg,0,name,0,NULL,sbuf,buflen, - AQ_NAME|AQ_DUPLOWPTR1|AQ_WIN32|AQ_GETHOST)); -} - -/*********************************************************************** - * WSAAsyncGetProtoByName (WINSOCK.105) - */ -HANDLE16 WINAPI WSAAsyncGetProtoByName16(HWND16 hWnd, UINT16 uMsg, LPCSTR name, - SEGPTR sbuf, INT16 buflen) -{ - TRACE("hwnd %04x, msg %08x, protocol %s\n", - hWnd, uMsg, (name)?name:"<null>" ); - return __WSAsyncDBQuery(HWND_32(hWnd),uMsg,0,name,0,NULL, - (void*)sbuf,buflen, - AQ_NAME|AQ_DUPLOWPTR1|AQ_WIN16|AQ_GETPROTO); + struct async_query_gethostbyname *aq; + unsigned int len = strlen(name) + 1; + + TRACE("hwnd %p, msg %04x, host %s, buffer %i\n", hWnd, uMsg, debugstr_a(name), buflen ); + + if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len ))) + { + SetLastError( WSAEWOULDBLOCK ); + return 0; + } + aq->host_name = (char *)(aq + 1); + strcpy( aq->host_name, name ); + return run_query( hWnd, uMsg, async_gethostbyname, &aq->query, sbuf, buflen ); } /*********************************************************************** @@ -617,24 +343,21 @@ HANDLE WINAPI WSAAsyncGetProtoByName(HWND hWnd, UINT uMsg, LPCSTR name, LPSTR sbuf, INT buflen) { - TRACE("hwnd %p, msg %08x, protocol %s\n", - hWnd, uMsg, (name)?name:"<null>" ); - return WSA_H32( __WSAsyncDBQuery(hWnd,uMsg,0,name,0,NULL,sbuf,buflen, - AQ_NAME|AQ_DUPLOWPTR1|AQ_WIN32|AQ_GETPROTO)); -} - - -/*********************************************************************** - * WSAAsyncGetProtoByNumber (WINSOCK.104) - */ -HANDLE16 WINAPI WSAAsyncGetProtoByNumber16(HWND16 hWnd,UINT16 uMsg,INT16 number, - SEGPTR sbuf, INT16 buflen) -{ - TRACE("hwnd %04x, msg %04x, num %i\n", hWnd, uMsg, number ); - return __WSAsyncDBQuery(HWND_32(hWnd),uMsg,number,NULL,0,NULL, - (void*)sbuf,buflen, - AQ_GETPROTO|AQ_NUMBER|AQ_WIN16); -} + struct async_query_getprotobyname *aq; + unsigned int len = strlen(name) + 1; + + TRACE("hwnd %p, msg %04x, proto %s, buffer %i\n", hWnd, uMsg, debugstr_a(name), buflen ); + + if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len ))) + { + SetLastError( WSAEWOULDBLOCK ); + return 0; + } + aq->proto_name = (char *)(aq + 1); + strcpy( aq->proto_name, name ); + return run_query( hWnd, uMsg, async_getprotobyname, &aq->query, sbuf, buflen ); +} + /*********************************************************************** * WSAAsyncGetProtoByNumber (WS2_32.104) @@ -642,22 +365,17 @@ HANDLE WINAPI WSAAsyncGetProtoByNumber(HWND hWnd, UINT uMsg, INT number, LPSTR sbuf, INT buflen) { - TRACE("hwnd %p, msg %04x, num %i\n", hWnd, uMsg, number ); - return WSA_H32( __WSAsyncDBQuery(hWnd,uMsg,number,NULL,0,NULL,sbuf,buflen, - AQ_GETPROTO|AQ_NUMBER|AQ_WIN32)); -} - -/*********************************************************************** - * WSAAsyncGetServByName (WINSOCK.107) - */ -HANDLE16 WINAPI WSAAsyncGetServByName16(HWND16 hWnd, UINT16 uMsg, LPCSTR name, - LPCSTR proto, SEGPTR sbuf, INT16 buflen) -{ - TRACE("hwnd %04x, msg %04x, name %s, proto %s\n", - hWnd, uMsg, (name)?name:"<null>", (proto)?proto:"<null>"); - return __WSAsyncDBQuery(HWND_32(hWnd),uMsg,0,name,0,proto, - (void*)sbuf,buflen, - AQ_GETSERV|AQ_NAME|AQ_DUPLOWPTR1|AQ_DUPLOWPTR2|AQ_WIN16); + struct async_query_getprotobynumber *aq; + + TRACE("hwnd %p, msg %04x, num %i\n", hWnd, uMsg, number ); + + if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) ))) + { + SetLastError( WSAEWOULDBLOCK ); + return 0; + } + aq->proto_number = number; + return run_query( hWnd, uMsg, async_getprotobynumber, &aq->query, sbuf, buflen ); } /*********************************************************************** @@ -666,23 +384,30 @@ HANDLE WINAPI WSAAsyncGetServByName(HWND hWnd, UINT uMsg, LPCSTR name, LPCSTR proto, LPSTR sbuf, INT buflen) { - TRACE("hwnd %p, msg %04x, name %s, proto %s\n", - hWnd, uMsg, (name)?name:"<null>", (proto)?proto:"<null>"); - return WSA_H32( __WSAsyncDBQuery(hWnd,uMsg,0,name,0,proto,sbuf,buflen, - AQ_GETSERV|AQ_NAME|AQ_DUPLOWPTR1|AQ_DUPLOWPTR2|AQ_WIN32)); -} - -/*********************************************************************** - * WSAAsyncGetServByPort (WINSOCK.106) - */ -HANDLE16 WINAPI WSAAsyncGetServByPort16(HWND16 hWnd, UINT16 uMsg, INT16 port, - LPCSTR proto, SEGPTR sbuf, INT16 buflen) -{ - TRACE("hwnd %04x, msg %04x, port %i, proto %s\n", - hWnd, uMsg, port, (proto)?proto:"<null>" ); - return __WSAsyncDBQuery(HWND_32(hWnd),uMsg,port,NULL,0,proto, - (void*)sbuf,buflen, - AQ_GETSERV|AQ_NUMBER|AQ_DUPLOWPTR2|AQ_WIN16); + struct async_query_getservbyname *aq; + unsigned int len1 = strlen(name) + 1; + unsigned int len2 = proto ? strlen(proto) + 1 : 0; + + TRACE("hwnd %p, msg %04x, name %s, proto %s\n", hWnd, uMsg, debugstr_a(name), debugstr_a(proto)); + + if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len1 + len2 ))) + { + SetLastError( WSAEWOULDBLOCK ); + return 0; + } + + aq->serv_name = (char *)(aq + 1); + strcpy( aq->serv_name, name ); + + if (proto) + { + aq->serv_proto = aq->serv_name + len1; + strcpy( aq->serv_proto, proto ); + } + else + aq->serv_proto = NULL; + + return run_query( hWnd, uMsg, async_getservbyname, &aq->query, sbuf, buflen ); } /*********************************************************************** @@ -691,8 +416,26 @@ HANDLE WINAPI WSAAsyncGetServByPort(HWND hWnd, UINT uMsg, INT port, LPCSTR proto, LPSTR sbuf, INT buflen) { - TRACE("hwnd %p, msg %04x, port %i, proto %s\n", - hWnd, uMsg, port, (proto)?proto:"<null>" ); - return WSA_H32( __WSAsyncDBQuery(hWnd,uMsg,port,NULL,0,proto,sbuf,buflen, - AQ_GETSERV|AQ_NUMBER|AQ_DUPLOWPTR2|AQ_WIN32)); -} + struct async_query_getservbyport *aq; + unsigned int len = proto ? strlen(proto) + 1 : 0; + + TRACE("hwnd %p, msg %04x, port %i, proto %s\n", hWnd, uMsg, port, debugstr_a(proto)); + + if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len ))) + { + SetLastError( WSAEWOULDBLOCK ); + return 0; + } + + if (proto) + { + aq->serv_proto = (char *)(aq + 1); + strcpy( aq->serv_proto, proto ); + } + else + aq->serv_proto = NULL; + + aq->serv_port = port; + + return run_query( hWnd, uMsg, async_getservbyport, &aq->query, sbuf, buflen ); +} Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sat Jun 23 06:04:09 2012 @@ -277,6 +277,9 @@ reactos/dll/win32/user32/windows/text.c # Forked (lstr.c) reactos/dll/win32/user32/windows/winpos.c # Forked +ws2_32 - + reactos/dll/win32/ws2_32/misc/async.c # Synced to Wine-1.5.4 + Update process for autosync DLLs *** This process can only be done on Microsoft Windows ***
12 years, 6 months
1
0
0
0
[tkreuzer] 56783: [RTL/AMD64] - Fix bugs in RtlInterlockedFlushSList - Improve comments
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Fri Jun 22 10:26:00 2012 New Revision: 56783 URL:
http://svn.reactos.org/svn/reactos?rev=56783&view=rev
Log: [RTL/AMD64] - Fix bugs in RtlInterlockedFlushSList - Improve comments Modified: trunk/reactos/lib/rtl/amd64/slist.S Modified: trunk/reactos/lib/rtl/amd64/slist.S URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/amd64/slist.S?rev=…
============================================================================== --- trunk/reactos/lib/rtl/amd64/slist.S [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/amd64/slist.S [iso-8859-1] Fri Jun 22 10:26:00 2012 @@ -8,6 +8,44 @@ #include <asm.inc> #include <ksamd64.inc> + +/* +typedef union DECLSPEC_ALIGN(16) _SLIST_HEADER +{ + struct + { + ULONGLONG Alignment; + ULONGLONG Region; + }; + struct + { + ULONGLONG Depth:16; + ULONGLONG Sequence:9; + ULONGLONG NextEntry:39; + ULONGLONG HeaderType:1; + ULONGLONG Init:1; + ULONGLONG Reserved:59; + ULONGLONG Region:3; + } Header8; + struct + { + ULONGLONG Depth:16; + ULONGLONG Sequence:48; + ULONGLONG HeaderType:1; + ULONGLONG Init:1; + ULONGLONG Reserved:2; + ULONGLONG NextEntry:60; + } Header16; + struct + { + ULONGLONG Depth:16; + ULONGLONG Sequence:48; + ULONGLONG HeaderType:1; + ULONGLONG Reserved:3; + ULONGLONG NextEntry:60; + } HeaderX64; +} SLIST_HEADER, *PSLIST_HEADER; +*/ #define SLIST8A_DEPTH_MASK HEX(000000000000FFFF) #define SLIST8A_DEPTH_INC HEX(0000000000000001) @@ -26,7 +64,7 @@ #define SLIST16A_SEQUENCE_INC HEX(0000000000010000) #define SLIST16B_HEADERTYPE_MASK HEX(0000000000000001) #define SLIST16B_INIT_MASK HEX(0000000000000002) -#define SLIST16B_NEXTENTY_MASK HEX(FFFFFFFFFFFFFFF0) +#define SLIST16B_NEXTENTRY_MASK HEX(FFFFFFFFFFFFFFF0) /* FUNCTIONS ****************************************************************/ @@ -105,7 +143,7 @@ lock cmpxchg [rcx], r8 /* If not equal, retry with rax, being the content of [rcx] now */ - jnz ExpInterlockedPopEntrySListResume + jne ExpInterlockedPopEntrySListResume /* Shift the pointer bits in place */ and rax, SLIST8A_NEXTENTRY_MASK @@ -124,7 +162,10 @@ ret RtlInterlockedPopEntrySList16: - /* This is a 16 byte header */ + /* This is a 16 byte header + rcx == ListHead + rdx == ListHead->Region + rax == ListHead->Alignment */ /* Save rbx */ push rbx @@ -134,18 +175,18 @@ ExpInterlockedPopEntrySListResume16: - /* Check if ListHead->NextEntry is NULL */ + /* Set r9 = ListHead->NextEntry and check if it is NULL */ mov r9, rdx - and r9, SLIST16B_NEXTENTY_MASK + and r9, SLIST16B_NEXTENTRY_MASK jz RtlInterlockedPopEntrySListEmpty16 ExpInterlockedPopEntrySListFault16: - /* Get next pointer */ + /* Set NewListHead.Next = ListHead->NextEntry->Next */ mov rcx, [r9] - /* Set ListHead->HeaderType = 1 and ListHead->Init = 1 */ - or rcx, 3 + /* Set NewListHead.HeaderType = 1 and NewListHead.Init = 1 */ + or rcx, (SLIST16B_HEADERTYPE_MASK or SLIST16B_INIT_MASK) /* Copy Depth and Sequence number and adjust Depth */ lea rbx, [rax - SLIST16A_DEPTH_INC] @@ -156,11 +197,11 @@ lock cmpxchg16b [r8] /* If not equal, retry with rdx:rax, being the content of [r8] now */ - jnz ExpInterlockedPopEntrySListResume16 + jne ExpInterlockedPopEntrySListResume16 /* Copy the old NextEntry pointer to rax */ mov rax, rdx - and rax, SLIST16B_NEXTENTY_MASK + and rax, SLIST16B_NEXTENTRY_MASK /* Return */ pop rbx @@ -193,7 +234,7 @@ /* Load ListHead->Alignment into rax */ mov rax, [rcx] - /* Load ListHead->Region into rdx */ + /* Load ListHead->Region into r9 */ mov r9, [rcx + 8] /* Check what kind of header this is */ @@ -242,14 +283,18 @@ lock cmpxchg [rcx], r8 /* If not equal, retry with rax, being the content of [rcx] now */ - jnz RtlInterlockedPushEntrySListLoop + jne RtlInterlockedPushEntrySListLoop /* Return the old NextEntry pointer */ mov rax, r9 ret RtlInterlockedPushEntrySList16: - /* This is a 16 byte header */ + /* This is a 16 byte header + rcx = ListHead + rdx = ListEntry + rax = ListHead->Alignment + r9 = ListHead->Region */ /* Save rbx */ push rbx @@ -258,33 +303,41 @@ mov r8, rcx mov r9, rdx - /* Set ListHead->HeaderType = 1 and ListHead->Init = 1 */ + /* Set NewListHead.NextEntry = ListEntry */ mov rcx, rdx - or rcx, 3 - + + /* Set NewListHead.HeaderType = 1 and NewListHead.Init = 1 */ + or rcx, (SLIST16B_HEADERTYPE_MASK or SLIST16B_INIT_MASK) + + /* Set rdx = ListHead->Region */ mov rdx, [r8 + 8] RtlInterlockedPushEntrySListLoop16: + /* r8 = ListHead + r9 = ListEntry + rax = ListHead->Alignment + rdx = ListHead->Region + */ /* Move ListHead->NextEntry to rbx */ mov rbx, rdx - and rbx, SLIST16B_NEXTENTY_MASK - - /* Store next pointer in ListEntry->NextEntry */ + and rbx, SLIST16B_NEXTENTRY_MASK + + /* Store next pointer in ListEntry->Next */ mov [r9], rbx - /* Copy Depth and Sequence number and adjust Depth */ + /* Copy and increment Depth and Sequence number to rbx */ lea rbx, [rax + SLIST16A_DEPTH_INC + SLIST16A_SEQUENCE_INC] /* If [r8] equals rdx:rax, exchange it with rcx:rbx */ lock cmpxchg16b [r8] /* If not equal, retry with rdx:rax, being the content of [r8] now */ - jnz RtlInterlockedPushEntrySListLoop16 + jne RtlInterlockedPushEntrySListLoop16 /* Copy the old NextEntry pointer to rax */ mov rax, rdx - and rax, SLIST16B_NEXTENTY_MASK + and rax, SLIST16B_NEXTENTRY_MASK /* Return */ pop rbx @@ -294,46 +347,62 @@ /* PSLIST_ENTRY * NTAPI * RtlInterlockedFlushSList( - * IN PSINGLE_LIST_ENTRY ListHead); + * IN PSLIST_HEADER ListHead); */ RtlInterlockedFlushSList: ExpInterlockedFlushSList: /* Load ListHead->Region into rdx */ - mov rax, [rcx + 8] + mov rdx, [rcx + 8] + + /* Load ListHead->Alignment into rax */ + mov rax, [rcx] /* Check what kind of header this is */ - test rax, SLIST8B_HEADERTYPE_MASK + test rdx, SLIST8B_HEADERTYPE_MASK jnz RtlInterlockedFlushSList16 /* We have an 8 byte header */ RtlInterlockedFlushSListLoop: - /* Zero ListHead->Alignment */ + /* Zero NewListHead.Alignment */ xor r8, r8 /* If [rcx] equals rax, exchange it with r8 */ lock cmpxchg [rcx], r8 /* If not equal, retry with rax, being the content of [rcx] now */ - jnz RtlInterlockedFlushSListLoop - - /* Use rcx as pointer template */ - mov rdx, (not SLIST8_POINTER_MASK) - or rdx, rcx + jne RtlInterlockedFlushSListLoop + + /* Create a pointer template from rcx in rdx */ + mov rdx, (NOT SLIST8_POINTER_MASK) + and rdx, rcx + + /* Load the old NextEntry pointer into rax */ + and rax, SLIST8A_NEXTENTRY_MASK + shr rax, SLIST8A_NEXTENTRY_SHIFT /* Combine result and return */ or rax, rdx ret RtlInterlockedFlushSList16: - /* We have a 16 byte header */ + /* We have a 16 byte header + rcx = ListHead + rax = ListHead->Alignment + rdx = ListHead->Region + */ + + /* Save rbx */ push rbx - mov rdx, [rcx + 8] + /* Load ListHead into r8, as we need rcx for the exchange */ + mov r8, rcx + + /* Initialize an ampty NewListHead in rcx:rbx */ xor rbx, rbx - mov rcx, 3 + mov rcx, (SLIST16B_HEADERTYPE_MASK or SLIST16B_INIT_MASK) RtlInterlockedFlushSListLoop16: @@ -341,14 +410,15 @@ lock cmpxchg16b [r8] /* If not equal, retry with rdx:rax, being the content of [r8] now */ - jnz RtlInterlockedFlushSListLoop16 + jne RtlInterlockedFlushSListLoop16 /* Copy the old NextEntry pointer to rax */ mov rax, rdx - and rax, SLIST16B_NEXTENTY_MASK + and rax, SLIST16B_NEXTENTRY_MASK /* Return */ pop rbx ret END +
12 years, 6 months
1
0
0
0
[tfaber] 56782: [MSAFD] - Gracefully handle lpcbBytesReturned == NULL condition in WSPIoctl. Fixes crash in ws2_32:sock
by tfaber@svn.reactos.org
Author: tfaber Date: Thu Jun 21 23:43:24 2012 New Revision: 56782 URL:
http://svn.reactos.org/svn/reactos?rev=56782&view=rev
Log: [MSAFD] - Gracefully handle lpcbBytesReturned == NULL condition in WSPIoctl. Fixes crash in ws2_32:sock Modified: trunk/reactos/dll/win32/msafd/misc/dllmain.c Modified: trunk/reactos/dll/win32/msafd/misc/dllmain.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msafd/misc/dllma…
============================================================================== --- trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] Thu Jun 21 23:43:24 2012 @@ -1968,6 +1968,12 @@ BOOLEAN NeedsCompletion; BOOLEAN NonBlocking; + if (!lpcbBytesReturned) + { + *lpErrno = WSAEFAULT; + return SOCKET_ERROR; + } + /* Get the Socket Structure associate to this Socket*/ Socket = GetSocketStructure(Handle); if (!Socket)
12 years, 6 months
1
0
0
0
[pschweitzer] 56781: [NTOSKRNL] Properly export RtlVolumeDeviceToDosName by using IoVolumeDeviceToDosName. No need to reimplement RtlVolumeDeviceToDosName.
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Thu Jun 21 21:06:20 2012 New Revision: 56781 URL:
http://svn.reactos.org/svn/reactos?rev=56781&view=rev
Log: [NTOSKRNL] Properly export RtlVolumeDeviceToDosName by using IoVolumeDeviceToDosName. No need to reimplement RtlVolumeDeviceToDosName. Modified: trunk/reactos/lib/rtl/dos8dot3.c trunk/reactos/ntoskrnl/ntoskrnl.spec Modified: trunk/reactos/lib/rtl/dos8dot3.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/dos8dot3.c?rev=567…
============================================================================== --- trunk/reactos/lib/rtl/dos8dot3.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/dos8dot3.c [iso-8859-1] Thu Jun 21 21:06:20 2012 @@ -292,18 +292,4 @@ return TRUE; } -/* -* @unimplemented -*/ -NTSTATUS -NTAPI -RtlVolumeDeviceToDosName( - IN PVOID VolumeDeviceObject, - OUT PUNICODE_STRING DosName - ) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - /* EOF */ Modified: trunk/reactos/ntoskrnl/ntoskrnl.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntoskrnl.spec?rev…
============================================================================== --- trunk/reactos/ntoskrnl/ntoskrnl.spec [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ntoskrnl.spec [iso-8859-1] Thu Jun 21 21:06:20 2012 @@ -1326,7 +1326,7 @@ @ stdcall RtlValidSid(ptr) @ stdcall RtlVerifyVersionInfo(ptr long long long) @ cdecl -arch=x86_64 RtlVirtualUnwind(long double double ptr ptr ptr ptr ptr) -@ stdcall RtlVolumeDeviceToDosName(ptr ptr) +@ stdcall RtlVolumeDeviceToDosName(ptr ptr) IoVolumeDeviceToDosName @ stdcall RtlWalkFrameChain(ptr long long) @ stdcall RtlWriteRegistryValue(long wstr wstr long ptr long) @ stdcall RtlZeroHeap(ptr long)
12 years, 6 months
1
0
0
0
[tfaber] 56780: [WS2_32_WINETEST] - Sync to Wine 1.5.4. Helpfully, now contains getaddrinfo tests.
by tfaber@svn.reactos.org
Author: tfaber Date: Thu Jun 21 20:47:22 2012 New Revision: 56780 URL:
http://svn.reactos.org/svn/reactos?rev=56780&view=rev
Log: [WS2_32_WINETEST] - Sync to Wine 1.5.4. Helpfully, now contains getaddrinfo tests. Modified: trunk/rostests/winetests/ws2_32/sock.c [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/rostests/winetests/ws2_32/sock.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/ws2_32/sock.c?r…
12 years, 6 months
1
0
0
0
[tfaber] 56779: [PSDK] - Fix bogus initializer in IN4ADDR_SCOPE_ID (aka let's not copy MS's header bugs)
by tfaber@svn.reactos.org
Author: tfaber Date: Thu Jun 21 19:02:56 2012 New Revision: 56779 URL:
http://svn.reactos.org/svn/reactos?rev=56779&view=rev
Log: [PSDK] - Fix bogus initializer in IN4ADDR_SCOPE_ID (aka let's not copy MS's header bugs) Modified: trunk/reactos/include/psdk/mstcpip.h Modified: trunk/reactos/include/psdk/mstcpip.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/mstcpip.h?rev…
============================================================================== --- trunk/reactos/include/psdk/mstcpip.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/mstcpip.h [iso-8859-1] Thu Jun 21 19:02:56 2012 @@ -443,7 +443,7 @@ IN4ADDR_SCOPE_ID( IN CONST SOCKADDR_IN *a) { - SCOPE_ID UnspecifiedScopeId = {0}; + SCOPE_ID UnspecifiedScopeId = {{{0}}}; UNREFERENCED_PARAMETER(a); return UnspecifiedScopeId; }
12 years, 6 months
1
0
0
0
[tfaber] 56778: [PSDK] - Revert bcrypt.h. Our headers are doomed to be forever incompatible ; )
by tfaber@svn.reactos.org
Author: tfaber Date: Thu Jun 21 18:25:41 2012 New Revision: 56778 URL:
http://svn.reactos.org/svn/reactos?rev=56778&view=rev
Log: [PSDK] - Revert bcrypt.h. Our headers are doomed to be forever incompatible ;) Modified: trunk/reactos/include/psdk/bcrypt.h Modified: trunk/reactos/include/psdk/bcrypt.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/bcrypt.h?rev=…
============================================================================== --- trunk/reactos/include/psdk/bcrypt.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/bcrypt.h [iso-8859-1] Thu Jun 21 18:25:41 2012 @@ -16,8 +16,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef __BCRYPT_H__ -#define __BCRYPT_H__ +#ifndef __WINE_BCRYPT_H +#define __WINE_BCRYPT_H #ifndef WINAPI #define WINAPI __stdcall @@ -35,11 +35,6 @@ #define OPTIONAL #endif -#ifndef _NTDEF_ -typedef _Return_type_success_(return >= 0) LONG NTSTATUS; -typedef NTSTATUS *PNTSTATUS; -#endif - typedef struct _BCRYPT_ALGORITHM_IDENTIFIER { LPWSTR pszName; @@ -47,4 +42,4 @@ ULONG dwFlags; } BCRYPT_ALGORITHM_IDENTIFIER; -#endif /* __BCRYPT_H__ */ +#endif /* __WINE_BCRYPT_H */
12 years, 6 months
1
0
0
0
[tfaber] 56777: [PSDK][NDK] - Fix build
by tfaber@svn.reactos.org
Author: tfaber Date: Thu Jun 21 18:20:38 2012 New Revision: 56777 URL:
http://svn.reactos.org/svn/reactos?rev=56777&view=rev
Log: [PSDK][NDK] - Fix build Modified: trunk/reactos/include/ndk/umtypes.h trunk/reactos/include/psdk/bcrypt.h Modified: trunk/reactos/include/ndk/umtypes.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/umtypes.h?rev=…
============================================================================== --- trunk/reactos/include/ndk/umtypes.h [iso-8859-1] (original) +++ trunk/reactos/include/ndk/umtypes.h [iso-8859-1] Thu Jun 21 18:20:38 2012 @@ -128,7 +128,9 @@ // #if !defined(_NTSECAPI_H) && !defined(_SUBAUTH_H) && !defined(_NTSECAPI_) +#ifndef __BCRYPT_H__ typedef LONG NTSTATUS, *PNTSTATUS; +#endif typedef struct _UNICODE_STRING { Modified: trunk/reactos/include/psdk/bcrypt.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/bcrypt.h?rev=…
============================================================================== --- trunk/reactos/include/psdk/bcrypt.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/bcrypt.h [iso-8859-1] Thu Jun 21 18:20:38 2012 @@ -16,8 +16,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef __WINE_BCRYPT_H -#define __WINE_BCRYPT_H +#ifndef __BCRYPT_H__ +#define __BCRYPT_H__ #ifndef WINAPI #define WINAPI __stdcall @@ -47,4 +47,4 @@ ULONG dwFlags; } BCRYPT_ALGORITHM_IDENTIFIER; -#endif /* __WINE_BCRYPT_H */ +#endif /* __BCRYPT_H__ */
12 years, 6 months
1
0
0
0
[tfaber] 56776: [PSDK] - At least Wine's headers suck as much as ours
by tfaber@svn.reactos.org
Author: tfaber Date: Thu Jun 21 17:45:02 2012 New Revision: 56776 URL:
http://svn.reactos.org/svn/reactos?rev=56776&view=rev
Log: [PSDK] - At least Wine's headers suck as much as ours Modified: trunk/reactos/include/psdk/bcrypt.h Modified: trunk/reactos/include/psdk/bcrypt.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/bcrypt.h?rev=…
============================================================================== --- trunk/reactos/include/psdk/bcrypt.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/bcrypt.h [iso-8859-1] Thu Jun 21 17:45:02 2012 @@ -35,9 +35,9 @@ #define OPTIONAL #endif -#ifndef WINE_NTSTATUS_DECLARED -#define WINE_NTSTATUS_DECLARED -typedef LONG NTSTATUS; +#ifndef _NTDEF_ +typedef _Return_type_success_(return >= 0) LONG NTSTATUS; +typedef NTSTATUS *PNTSTATUS; #endif typedef struct _BCRYPT_ALGORITHM_IDENTIFIER
12 years, 6 months
1
0
0
0
← Newer
1
2
3
4
5
6
7
...
12
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
Results per page:
10
25
50
100
200