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
November 2005
----- 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
27 participants
875 discussions
Start a n
N
ew thread
[gvg] 18974: Oops, used wrong tag
by gvg@svn.reactos.com
Oops, used wrong tag Deleted: tags/ReactOS-0.2.7/ros-branch-0_2_8/
19 years, 1 month
1
0
0
0
[gvg] 18973: Tag ReactOS release 0.2.8
by gvg@svn.reactos.com
Tag ReactOS release 0.2.8 Added: tags/ReactOS-0.2.7/ros-branch-0_2_8/ _____ Copied: tags/ReactOS-0.2.7/ros-branch-0_2_8 (from rev 18972, branches/ros-branch-0_2_8)
19 years, 1 month
1
0
0
0
[weiden] 18972: add all ACEs to their principals
by weiden@svn.reactos.com
add all ACEs to their principals Modified: trunk/reactos/lib/aclui/aclui.c Modified: trunk/reactos/lib/aclui/checklist.c Modified: trunk/reactos/lib/aclui/precomp.h _____ Modified: trunk/reactos/lib/aclui/aclui.c --- trunk/reactos/lib/aclui/aclui.c 2005-11-03 02:36:09 UTC (rev 18971) +++ trunk/reactos/lib/aclui/aclui.c 2005-11-03 11:28:56 UTC (rev 18972) @@ -30,6 +30,45 @@ HINSTANCE hDllInstance; +static PSID +AceHeaderToSID(IN PACE_HEADER AceHeader) +{ + PSID Sid = NULL; + switch (AceHeader->AceType) + { + case ACCESS_ALLOWED_ACE_TYPE: + Sid = (PSID)&((PACCESS_ALLOWED_ACE)AceHeader)->SidStart; + break; +#if 0 + case ACCESS_ALLOWED_CALLBACK_ACE_TYPE: + Sid = (PSID)&((PACCESS_ALLOWED_CALLBACK_ACE)AceHeader)->SidStart; + break; + case ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE: + Sid = (PSID)&((PACCESS_ALLOWED_CALLBACK_OBJECT_ACE)AceHeader)->SidStart; + break; +#endif + case ACCESS_ALLOWED_OBJECT_ACE_TYPE: + Sid = (PSID)&((PACCESS_ALLOWED_OBJECT_ACE)AceHeader)->SidStart; + break; + case ACCESS_DENIED_ACE_TYPE: + Sid = (PSID)&((PACCESS_DENIED_ACE)AceHeader)->SidStart; + break; +#if 0 + case ACCESS_DENIED_CALLBACK_ACE_TYPE: + Sid = (PSID)&((PACCESS_DENIED_CALLBACK_ACE)AceHeader)->SidStart; + break; + case ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE: + Sid = (PSID)&((PACCESS_DENIED_CALLBACK_OBJECT_ACE)AceHeader)->SidStart; + break; +#endif + case SYSTEM_AUDIT_OBJECT_ACE_TYPE: + Sid = (PSID)&((PACCESS_DENIED_OBJECT_ACE)AceHeader)->SidStart; + break; + } + + return Sid; +} + static VOID DestroySecurityPage(IN PSECURITY_PAGE sp) { @@ -49,10 +88,22 @@ FreePrincipalsList(IN PPRINCIPAL_LISTITEM *PrincipalsListHead) { PPRINCIPAL_LISTITEM CurItem, NextItem; + PACE_ENTRY AceEntry, NextAceEntry; CurItem = *PrincipalsListHead; while (CurItem != NULL) { + /* Free all ACEs */ + AceEntry = CurItem->ACEs; + while (AceEntry != NULL) + { + NextAceEntry = AceEntry->Next; + HeapFree(GetProcessHeap(), + 0, + AceEntry); + AceEntry = NextAceEntry; + } + /* free the SID string if present */ if (CurItem->DisplayString != NULL) { @@ -70,9 +121,40 @@ *PrincipalsListHead = NULL; } +static PACE_ENTRY +AddAceToPrincipal(IN PPRINCIPAL_LISTITEM Principal, + IN PACE_HEADER AceHeader) +{ + PACE_ENTRY AceEntry, *AceLink; + + AceEntry = HeapAlloc(GetProcessHeap(), + 0, + sizeof(ACE_ENTRY) + AceHeader->AceSize); + if (AceEntry != NULL) + { + AceEntry->Next = NULL; + + /* copy the ACE */ + CopyMemory(AceEntry + 1, + AceHeader, + AceHeader->AceSize); + + /* append it to the list */ + AceLink = &Principal->ACEs; + while (*AceLink != NULL) + { + AceLink = &(*AceLink)->Next; + } + *AceLink = AceEntry; + } + + return AceEntry; +} + static PPRINCIPAL_LISTITEM -FindSidInPrincipalsList(IN PPRINCIPAL_LISTITEM PrincipalsListHead, - IN PSID Sid) +FindSidInPrincipalsListAddAce(IN PPRINCIPAL_LISTITEM PrincipalsListHead, + IN PSID Sid, + IN PACE_HEADER AceHeader) { PPRINCIPAL_LISTITEM CurItem; @@ -83,7 +165,14 @@ if (EqualSid((PSID)(CurItem + 1), Sid)) { - return CurItem; + if (AddAceToPrincipal(CurItem, + AceHeader) != NULL) + { + return CurItem; + } + + /* unable to add the ACE to the principal */ + break; } } @@ -92,15 +181,21 @@ static BOOL AddPrincipalToList(IN PSECURITY_PAGE sp, - IN PSID Sid) + IN PSID Sid, + IN PACE_HEADER AceHeader) { - if (!FindSidInPrincipalsList(sp->PrincipalsListHead, - Sid)) + PPRINCIPAL_LISTITEM PrincipalListItem = NULL; + PACE_ENTRY AceEntry = NULL; + BOOL Ret = FALSE; + + if (!FindSidInPrincipalsListAddAce(sp->PrincipalsListHead, + Sid, + AceHeader)) { DWORD SidLength, AccountNameSize, DomainNameSize; SID_NAME_USE SidNameUse; DWORD LookupResult; - PPRINCIPAL_LISTITEM AceListItem, *NextAcePtr; + PPRINCIPAL_LISTITEM PrincipalListItem, *PrincipalLink; AccountNameSize = 0; DomainNameSize = 0; @@ -118,69 +213,82 @@ if (LookupResult != ERROR_NONE_MAPPED && LookupResult != ERROR_INSUFFICIENT_BUFFER) { - return FALSE; + goto Cleanup; } } - NextAcePtr = &sp->PrincipalsListHead; - for (AceListItem = sp->PrincipalsListHead; - AceListItem != NULL; - AceListItem = AceListItem->Next) + PrincipalLink = &sp->PrincipalsListHead; + while (*PrincipalLink != NULL) { - NextAcePtr = &AceListItem->Next; + PrincipalLink = &(*PrincipalLink)->Next; } SidLength = GetLengthSid(Sid); - /* allocate the ace */ - AceListItem = HeapAlloc(GetProcessHeap(), - 0, - sizeof(PRINCIPAL_LISTITEM) + SidLength + - ((AccountNameSize + DomainNameSize) * sizeof(WCHAR))); - if (AceListItem != NULL) + /* allocate the principal */ + PrincipalListItem = HeapAlloc(GetProcessHeap(), + 0, + sizeof(PRINCIPAL_LISTITEM) + SidLength + + ((AccountNameSize + DomainNameSize) * sizeof(WCHAR))); + if (PrincipalListItem != NULL) { - AceListItem->AccountName = (LPWSTR)((ULONG_PTR)(AceListItem + 1) + SidLength); - AceListItem->DomainName = AceListItem->AccountName + AccountNameSize; + PrincipalListItem->AccountName = (LPWSTR)((ULONG_PTR)(PrincipalListItem + 1) + SidLength); + PrincipalListItem->DomainName = PrincipalListItem->AccountName + AccountNameSize; CopySid(SidLength, - (PSID)(AceListItem + 1), + (PSID)(PrincipalListItem + 1), Sid); LookupResult = ERROR_SUCCESS; if (!LookupAccountSid(sp->ServerName, Sid, - AceListItem->AccountName, + PrincipalListItem->AccountName, &AccountNameSize, - AceListItem->DomainName, + PrincipalListItem->DomainName, &DomainNameSize, &SidNameUse)) { LookupResult = GetLastError(); if (LookupResult != ERROR_NONE_MAPPED) { - HeapFree(GetProcessHeap(), - 0, - AceListItem); - return FALSE; + goto Cleanup; } } if (AccountNameSize == 0) { - AceListItem->AccountName = NULL; + PrincipalListItem->AccountName = NULL; } if (DomainNameSize == 0) { - AceListItem->DomainName = NULL; + PrincipalListItem->DomainName = NULL; } - AceListItem->Next = NULL; + /* allocate some memory for the ACE and copy it */ + AceEntry = HeapAlloc(GetProcessHeap(), + 0, + sizeof(ACE_ENTRY) + AceHeader->AceSize); + if (AceEntry == NULL) + { + goto Cleanup; + } + AceEntry->Next = NULL; + CopyMemory(AceEntry + 1, + AceHeader, + AceHeader->AceSize); + + /* add the ACE to the list */ + PrincipalListItem->ACEs = AceEntry; + + PrincipalListItem->Next = NULL; + Ret = TRUE; + if (LookupResult == ERROR_NONE_MAPPED) { if (!ConvertSidToStringSid(Sid, - &AceListItem->DisplayString)) + &PrincipalListItem->DisplayString)) { - AceListItem->DisplayString = NULL; + PrincipalListItem->DisplayString = NULL; } } else @@ -188,7 +296,7 @@ LSA_HANDLE LsaHandle; NTSTATUS Status; - AceListItem->DisplayString = NULL; + PrincipalListItem->DisplayString = NULL; /* read the domain of the SID */ if (OpenLSAPolicyHandle(sp->ServerName, @@ -220,7 +328,7 @@ DomainName = NULL; } - AceListItem->SidNameUse = Names->Use; + PrincipalListItem->SidNameUse = Names->Use; switch (Names->Use) { @@ -236,7 +344,7 @@ DomainName = &PolicyAccountDomainInfo->DomainName; /* make the user believe this is a group */ - AceListItem->SidNameUse = SidTypeGroup; + PrincipalListItem->SidNameUse = SidTypeGroup; } } /* fall through */ @@ -247,19 +355,19 @@ { SIZE_T Size = (AccountNameSize + DomainName->Length + Names->Name.Length + 6) * sizeof(WCHAR); - AceListItem->DisplayString = (LPWSTR)LocalAlloc(LMEM_FIXED, + PrincipalListItem->DisplayString = (LPWSTR)LocalAlloc(LMEM_FIXED, Size); - if (AceListItem->DisplayString != NULL) + if (PrincipalListItem->DisplayString != NULL) { WCHAR *s; /* NOTE: LSA_UNICODE_STRINGs are not always NULL-terminated! */ - wcscpy(AceListItem->DisplayString, - AceListItem->AccountName); - wcscat(AceListItem->DisplayString, + wcscpy(PrincipalListItem->DisplayString, + PrincipalListItem->AccountName); + wcscat(PrincipalListItem->DisplayString, L" ("); - s = AceListItem->DisplayString + wcslen(AceListItem->DisplayString); + s = PrincipalListItem->DisplayString + wcslen(PrincipalListItem->DisplayString); CopyMemory(s, DomainName->Buffer, DomainName->Length); @@ -272,12 +380,17 @@ *(s++) = L')'; *s = L'\0'; } + else + { + Ret = FALSE; + break; + } /* mark the ace as a user unless it's a BUILTIN account */ if (PolicyAccountDomainInfo == NULL) { - AceListItem->SidNameUse = SidTypeUser; + PrincipalListItem->SidNameUse = SidTypeUser; } } break; @@ -286,7 +399,7 @@ case SidTypeWellKnownGroup: { /* make the user believe this is a group */ - AceListItem->SidNameUse = SidTypeGroup; + PrincipalListItem->SidNameUse = SidTypeGroup; break; } @@ -309,12 +422,38 @@ } } - /* append item to the cached ACL */ - *NextAcePtr = AceListItem; + if (Ret) + { + /* append item to the principals list */ + *PrincipalLink = PrincipalListItem; + } } } - return TRUE; + if (!Ret) + { +Cleanup: + if (PrincipalListItem != NULL) + { + if (PrincipalListItem->DisplayString != NULL) + { + LocalFree((HLOCAL)PrincipalListItem->DisplayString); + } + + HeapFree(GetProcessHeap(), + 0, + PrincipalListItem); + } + + if (AceEntry != NULL) + { + HeapFree(GetProcessHeap(), + 0, + AceEntry); + } + } + + return Ret; } static VOID @@ -342,21 +481,24 @@ DaclPresent && Dacl != NULL) { PSID Sid; - PVOID Ace; + PACE_HEADER AceHeader; ULONG AceIndex; for (AceIndex = 0; AceIndex < Dacl->AceCount; AceIndex++) { - GetAce(Dacl, - AceIndex, - &Ace); + if (GetAce(Dacl, + AceIndex, + (LPVOID*)&AceHeader) && + AceHeader != NULL) + { + Sid = AceHeaderToSID(AceHeader); - Sid = (PSID)&((PACCESS_ALLOWED_ACE)Ace)->SidStart; - - AddPrincipalToList(sp, - Sid); + AddPrincipalToList(sp, + Sid, + AceHeader); + } } } LocalFree((HLOCAL)SecurityDescriptor); @@ -534,18 +676,21 @@ HRESULT hRet; PSI_ACCESS AccessList; ULONG nAccessList, DefaultAccessIndex; - + WCHAR szSpecialPermissions[255]; + BOOLEAN SpecialPermissionsPresent = FALSE; + ACCESS_MASK SpecialPermissionsMask = 0; + /* clear the permissions list */ - + SendMessage(sp->hAceCheckList, CLM_CLEAR, 0, 0); - + /* query the access rights from the server */ hRet = sp->psi->lpVtbl->GetAccessRights(sp->psi, GuidObjectType, - dwFlags, + dwFlags, /* FIXME */ &AccessList, &nAccessList, &DefaultAccessIndex); @@ -554,13 +699,13 @@ LPCWSTR NameStr; PSI_ACCESS CurAccess, LastAccess; WCHAR NameBuffer[MAX_PATH]; - + /* save the default access rights to be used when adding ACEs later */ if (DefaultAccess != NULL) { *DefaultAccess = AccessList[DefaultAccessIndex]; } - + LastAccess = AccessList + nAccessList; for (CurAccess = &AccessList[0]; CurAccess != LastAccess; @@ -590,11 +735,38 @@ SendMessage(sp->hAceCheckList, CLM_ADDITEM, - CIS_NONE, + (WPARAM)CurAccess->mask, (LPARAM)NameStr); } + else if (CurAccess->dwFlags & SI_ACCESS_SPECIFIC) + { + SpecialPermissionsPresent = TRUE; + SpecialPermissionsMask |= CurAccess->mask; + } } } + + /* add the special permissions check item in case the specific access rights + aren't displayed */ + if (SpecialPermissionsPresent && + LoadString(hDllInstance, + IDS_SPECIAL_PERMISSIONS, + szSpecialPermissions, + sizeof(szSpecialPermissions) / sizeof(szSpecialPermissions[0]))) + { + /* add the special permissions check item */ + sp->SpecialPermCheckIndex = (INT)SendMessage(sp->hAceCheckList, + CLM_ADDITEM, + (WPARAM)SpecialPermissionsMask, + (LPARAM)szSpecialPermissions); + if (sp->SpecialPermCheckIndex != -1) + { + SendMessage(sp->hAceCheckList, + CLM_SETITEMSTATE, + (WPARAM)sp->SpecialPermCheckIndex, + CIS_ALLOWDISABLED | CIS_DENYDISABLED | CIS_NONE); + } + } } static VOID @@ -839,17 +1011,63 @@ hWndDeny); } +static PACE_HEADER +BuildDefaultPrincipalAce(IN PSECURITY_PAGE sp, + IN PSID pSid) +{ + PACCESS_ALLOWED_ACE Ace; + DWORD SidLen; + WORD AceSize; + + SidLen = GetLengthSid(pSid); + AceSize = sizeof(ACCESS_ALLOWED_ACE) + (WORD)SidLen - sizeof(DWORD); + Ace = HeapAlloc(GetProcessHeap(), + 0, + AceSize); + if (Ace != NULL) + { + Ace->Header.AceType = ACCESS_ALLOWED_ACE_TYPE; + Ace->Header.AceFlags = 0; /* FIXME */ + Ace->Header.AceSize = AceSize; + Ace->Mask = sp->DefaultAccess.mask; + + if (CopySid(SidLen, + (PSID)&Ace->SidStart, + pSid)) + { + return &Ace->Header; + } + + HeapFree(GetProcessHeap(), + 0, + Ace); + } + + return NULL; +} + static BOOL AddSelectedPrincipal(IN IDsObjectPicker *pDsObjectPicker, IN HWND hwndParent OPTIONAL, IN PSID pSid, IN PVOID Context OPTIONAL) { + PACE_HEADER AceHeader; PSECURITY_PAGE sp = (PSECURITY_PAGE)Context; - AddPrincipalToList(sp, - pSid); + AceHeader = BuildDefaultPrincipalAce(sp, + pSid); + if (AceHeader != NULL) + { + AddPrincipalToList(sp, + pSid, + AceHeader); + HeapFree(GetProcessHeap(), + 0, + AceHeader); + } + return TRUE; } @@ -1041,23 +1259,9 @@ /* hide controls in case the flags aren't present */ if (sp->ObjectInfo.dwFlags & SI_ADVANCED) { - WCHAR szSpecialPermissions[255]; - /* editing the permissions is least the user can do when the advanced button is showed */ sp->ObjectInfo.dwFlags |= SI_EDIT_PERMS; - - if (LoadString(hDllInstance, - IDS_SPECIAL_PERMISSIONS, - szSpecialPermissions, - sizeof(szSpecialPermissions) / sizeof(szSpecialPermissions[0]))) - { - /* add the special permissions check item */ - sp->SpecialPermCheckIndex = (INT)SendMessage(sp->hAceCheckList, - CLM_ADDITEM, - CIS_ALLOWDISABLED | CIS_DENYDISABLED | CIS_NONE, - (LPARAM)szSpecialPermissions); - } } else { @@ -1254,7 +1458,8 @@ return Ret; } -BOOL STDCALL +BOOL +WINAPI DllMain(IN HINSTANCE hinstDLL, IN DWORD dwReason, IN LPVOID lpvReserved) _____ Modified: trunk/reactos/lib/aclui/checklist.c --- trunk/reactos/lib/aclui/checklist.c 2005-11-03 02:36:09 UTC (rev 18971) +++ trunk/reactos/lib/aclui/checklist.c 2005-11-03 11:28:56 UTC (rev 18972) @@ -41,6 +41,7 @@ typedef struct _CHECKITEM { struct _CHECKITEM *Next; + ACCESS_MASK AccessMask; DWORD State; WCHAR Name[1]; } CHECKITEM, *PCHECKITEM; @@ -145,6 +146,29 @@ return Found; } +static UINT +FindCheckItemIndexByAccessMask(IN PCHECKLISTWND infoPtr, + IN ACCESS_MASK AccessMask) +{ + PCHECKITEM Item; + UINT Index = 0, Found = -1; + + for (Item = infoPtr->CheckItemListHead; + Item != NULL; + Item = Item->Next) + { + if (Item->AccessMask == AccessMask) + { + Found = Index; + break; + } + + Index++; + } + + return Found; +} + static INT CheckItemToIndex(IN PCHECKLISTWND infoPtr, IN PCHECKITEM Item) @@ -469,6 +493,7 @@ AddCheckItem(IN PCHECKLISTWND infoPtr, IN LPWSTR Name, IN DWORD State, + IN ACCESS_MASK AccessMask, OUT INT *Index) { PCHECKITEM CurItem; @@ -488,6 +513,7 @@ } Item->Next = NULL; + Item->AccessMask = AccessMask; Item->State = State & CIS_MASK; wcscpy(Item->Name, Name); @@ -1692,7 +1718,8 @@ INT Index = -1; PCHECKITEM Item = AddCheckItem(infoPtr, (LPWSTR)lParam, - (DWORD)wParam, + CIS_NONE, + (ACCESS_MASK)wParam, &Index); if (Item != NULL) { @@ -1824,6 +1851,13 @@ break; } + case CLM_FINDITEMBYACCESSMASK: + { + Ret = (LRESULT)FindCheckItemIndexByAccessMask(infoPtr, + (ACCESS_MASK)wParam); + break; + } + case WM_SETFONT: { Ret = (LRESULT)RetChangeControlFont(infoPtr, @@ -2129,7 +2163,7 @@ MakeCheckItemVisible(infoPtr, infoPtr->FocusedCheckItem); - OtherBox = ((infoPtr->FocusedCheckItemBox == CLB_ALLOW) ? CLB_DENY : CLB_ALLOW); + OtherBox = ((infoPtr->FocusedCheckItemBox == CLB_ALLOW) ? CLB_DENY : CLB_ALLOW); OtherStateMask = ((OtherBox == CLB_ALLOW) ? (CIS_ALLOW | CIS_ALLOWDISABLED) : (CIS_DENY | CIS_DENYDISABLED)); _____ Modified: trunk/reactos/lib/aclui/precomp.h --- trunk/reactos/lib/aclui/precomp.h 2005-11-03 02:36:09 UTC (rev 18971) +++ trunk/reactos/lib/aclui/precomp.h 2005-11-03 11:28:56 UTC (rev 18972) @@ -27,9 +27,15 @@ extern HINSTANCE hDllInstance; +typedef struct _ACE_ENTRY +{ + struct _ACE_ENTRY *Next; +} ACE_ENTRY, *PACE_ENTRY; + typedef struct _PRINCIPAL_LISTITEM { struct _PRINCIPAL_LISTITEM *Next; + PACE_ENTRY ACEs; SID_NAME_USE SidNameUse; WCHAR *DisplayString; WCHAR *AccountName; @@ -130,6 +136,7 @@ #define CLM_ENABLEQUICKSEARCH (WM_USER + 9) #define CLM_SETQUICKSEARCH_TIMEOUT_RESET (WM_USER + 10) #define CLM_SETQUICKSEARCH_TIMEOUT_SETFOCUS (WM_USER + 11) +#define CLM_FINDITEMBYACCESSMASK (WM_USER + 12) #define CLN_CHANGINGITEMCHECKBOX (101) @@ -148,4 +155,12 @@ VOID UnregisterCheckListControl(VOID); +/* DLLMAIN ********************************************************************/ + +BOOL +WINAPI +DllMain(IN HINSTANCE hinstDLL, + IN DWORD dwReason, + IN LPVOID lpvReserved); + /* EOF */
19 years, 1 month
1
0
0
0
[turner] 18971: rewrite of gettype. Beginnings of support for remote computers. Big thanks to Alex and KJK.
by turner@svn.reactos.com
rewrite of gettype. Beginnings of support for remote computers. Big thanks to Alex and KJK. Modified: trunk/reactos/subsys/system/gettype/gettype.c Modified: trunk/reactos/subsys/system/gettype/gettype.xml _____ Modified: trunk/reactos/subsys/system/gettype/gettype.c --- trunk/reactos/subsys/system/gettype/gettype.c 2005-11-03 01:50:13 UTC (rev 18970) +++ trunk/reactos/subsys/system/gettype/gettype.c 2005-11-03 02:36:09 UTC (rev 18971) @@ -15,6 +15,8 @@ #include <windows.h> #include <tchar.h> #include <stdio.h> +#include <lm.h> +#include <shellapi.h> enum { @@ -28,33 +30,164 @@ GETTYPE_BUILD = 0x080 }; -void GetBasicInfo(OSVERSIONINFOEX osvi, char * HostName, char * OSName, char * Version, char * Role, char * Components) +INT +GetVersionNumber(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102) { + INT VersionNumber = 255; + if(pBuf102 != NULL && !bLocal) + { + VersionNumber = pBuf102->sv102_version_major * 1000; + VersionNumber += (pBuf102->sv102_version_minor * 100); + } + else if(bLocal) + { + VersionNumber = osvi->dwMajorVersion * 1000; + VersionNumber += (osvi->dwMinorVersion * 100); + } + + return VersionNumber; +} + +INT +GetMajValue(BOOL Major, BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102) +{ + INT VersionNumber = 255; + if(pBuf102 != NULL && !bLocal) + { + if(Major) + VersionNumber = pBuf102->sv102_version_major * 1000; + else + VersionNumber = pBuf102->sv102_version_minor * 100; + } + else + { + if(Major) + VersionNumber = osvi->dwMajorVersion * 1000; + else + VersionNumber = osvi->dwMinorVersion * 100; + } + return VersionNumber; +} + +INT +GetSystemRole(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102) +{ + + if(pBuf102 != NULL && !bLocal) + { + if ((pBuf102->sv102_type & SV_TYPE_DOMAIN_CTRL) || + (pBuf102->sv102_type & SV_TYPE_DOMAIN_BAKCTRL)) + return 1; + else if(pBuf102->sv102_type & SV_TYPE_SERVER_NT) + return 2; + else + return 3; + } + else + { + if(osvi->wProductType == VER_NT_DOMAIN_CONTROLLER) + return 1; + else if(osvi->wProductType == VER_NT_SERVER) + return 2; + else if(osvi->wProductType == VER_NT_WORKSTATION) + return 3; + } + return 255; + +} + +INT +GetServicePack(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102, TCHAR * Server) +{ + INT SPNumber = 255; + if(!bLocal) + { + /* FIXME: Use Registry to get value */ + } + else + { + SPNumber = osvi->wServicePackMajor; + } + return SPNumber; +} + +INT +GetBuildNumber(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102) +{ + INT BuildNum = 255; + if(!bLocal) + { + /* FIXME: Use Registry to get value */ + } + else + { + BuildNum = osvi->dwBuildNumber; + } + return BuildNum; +} + +INT GetType(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102) +{ + if(bLocal) + { + if(osvi->dwMajorVersion == 5) + { + if(osvi->dwMinorVersion == 1) + { + if(osvi->wSuiteMask & VER_SUITE_PERSONAL) + return 1; + else + return 2; + } + else if(osvi->dwMinorVersion == 2) + { + if(osvi->wSuiteMask & VER_SUITE_BLADE) + return 6; + else if(osvi->wSuiteMask & VER_SUITE_DATACENTER) + return 5; + else if(osvi->wSuiteMask & VER_SUITE_ENTERPRISE) + return 4; + else + return 3; + } + } + } + else + { + /* FIXME: Get this value from registry */ + } + return 255; +} + +VOID +GetBasicInfo(LPOSVERSIONINFOEX osvi, TCHAR * HostName, TCHAR * OSName, TCHAR * Version, TCHAR * Role, TCHAR * Components) +{ /* Host Name - COMPUTERNAME*/ DWORD bufCharCount = 1024; GetComputerName(HostName, &bufCharCount); + /* OSName - Windows XP Home Editition */ - if(osvi.dwMajorVersion == 4) + if(osvi->dwMajorVersion == 4) { _tcscpy(OSName, _T("Microsoft Windows NT 4.0 ")); } - else if(osvi.dwMajorVersion == 5) + else if(osvi->dwMajorVersion == 5) { - if(osvi.dwMajorVersion == 0) + if(osvi->dwMajorVersion == 0) { _tcscpy(OSName, _T("Microsoft Windows 2000 ")); } - else if(osvi.dwMinorVersion == 1) + else if(osvi->dwMinorVersion == 1) { _tcscpy(OSName, _T("Microsoft Windows XP ")); } - else if(osvi.dwMinorVersion == 2) + else if(osvi->dwMinorVersion == 2) { _tcscpy(OSName, _T("Microsoft Windows Server 2003 ")); } } - else if(osvi.dwMajorVersion == 6) + else if(osvi->dwMajorVersion == 6) { _tcscpy(OSName, _T("Microsoft Windows Vista ")); } @@ -63,169 +196,199 @@ _tcscpy(OSName, _T("Microsoft Windows ")); } - if(osvi.wSuiteMask & VER_SUITE_BLADE) + if(osvi->wSuiteMask & VER_SUITE_BLADE) _tcscat(OSName, _T("Web Edition")); - if(osvi.wSuiteMask & VER_SUITE_DATACENTER) + if(osvi->wSuiteMask & VER_SUITE_DATACENTER) _tcscat(OSName, _T("Datacenter")); - if(osvi.wSuiteMask & VER_SUITE_ENTERPRISE) + if(osvi->wSuiteMask & VER_SUITE_ENTERPRISE) _tcscat(OSName, _T("Enterprise")); - if(osvi.wSuiteMask & VER_SUITE_EMBEDDEDNT) + if(osvi->wSuiteMask & VER_SUITE_EMBEDDEDNT) _tcscat(OSName, _T("Embedded")); - if(osvi.wSuiteMask & VER_SUITE_PERSONAL) + if(osvi->wSuiteMask & VER_SUITE_PERSONAL) _tcscat(OSName, _T("Home Edition")); - if(osvi.wSuiteMask & VER_SUITE_SMALLBUSINESS_RESTRICTED && osvi.wSuiteMask & VER_SUITE_SMALLBUSINESS) + if(osvi->wSuiteMask & VER_SUITE_SMALLBUSINESS_RESTRICTED && osvi->wSuiteMask & VER_SUITE_SMALLBUSINESS) _tcscat(OSName, _T("Small Bussiness Edition")); /* Version - 5.1 Build 2600 Serivce Pack 2 */ - _stprintf(Version, _T("%d.%d Build %d %s"),(int)osvi.dwMajorVersion,(int)osvi.dwMinorVersion,(int)osvi.dwBuild Number, osvi.szCSDVersion); + _stprintf(Version, _T("%d.%d Build %d %s"),(int)osvi->dwMajorVersion,(int)osvi->dwMinorVersion,(int)osvi->dwBu ildNumber, osvi->szCSDVersion); /* Role - Workgroup / Server / Domain Controller */ - if(osvi.wProductType == VER_NT_DOMAIN_CONTROLLER) + if(osvi->wProductType == VER_NT_DOMAIN_CONTROLLER) _tcscpy(Role, _T("Domain Controller")); - else if(osvi.wProductType == VER_NT_SERVER) + else if(osvi->wProductType == VER_NT_SERVER) _tcscpy(Role, _T("Server")); - else if(osvi.wProductType == VER_NT_WORKSTATION) + else if(osvi->wProductType == VER_NT_WORKSTATION) _tcscpy(Role, _T("Workgroup")); - /* Components - N/A */ - BOOL bCompInstalled = FALSE; - _tcscpy(Components, ""); - if(osvi.wSuiteMask & VER_SUITE_BACKOFFICE) - { - _tcscat(Components, _T("Microsoft BackOffice")); - bCompInstalled = TRUE; - } - if(osvi.wSuiteMask & VER_SUITE_TERMINAL) - { - if(bCompInstalled) - _tcscat(OSName, ";"); - _tcscat(Components, _T("Terminal Services")); - bCompInstalled = TRUE; - } - if(!bCompInstalled) - _tcscat(Components, _T("Not Installed")); + /* Components - FIXME: what is something that might be installed? */ + _tcscat(Components, _T("Not Installed")); } -int main (int argc, char *argv[]) + +INT +main (VOID) { DWORD Operations = 0; + INT ret = 255; INT i = 0; - OSVERSIONINFOEX osvi; - - /* get the struct we will pull all the info from */ - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); - if(!GetVersionEx((OSVERSIONINFO*)&osvi)) - return 255; + INT argc = 0; + /* True if the target is local host */ + BOOL bLocal = TRUE; + DWORD nStatus = 0; + TCHAR ServerName[32]; + TCHAR RemoteResource[32]; + TCHAR UserName[32] = _T(""); + TCHAR Password[32] = _T(""); + LPOSVERSIONINFOEX osvi = NULL; + LPSERVER_INFO_102 pBuf102 = NULL; + LPTSTR * argv; + osvi = (LPOSVERSIONINFOEX)malloc(sizeof(LPOSVERSIONINFOEX)); + pBuf102 = (LPSERVER_INFO_102)malloc(sizeof(LPSERVER_INFO_102)); - /* no params, just print some info */ - if(argc == 1) + /* Get the command line correctly since it is unicode */ + argv = CommandLineToArgvW(GetCommandLineW(), &argc); + + + /* Process flags */ + if(argc) { - TCHAR HostName[1024] = _T(""); - TCHAR OSName[1024] = _T(""); - TCHAR VersionInfo[1024] = _T(""); - TCHAR Role[1024] = _T(""); - TCHAR Components[1024] = _T(""); - GetBasicInfo(osvi, HostName, OSName, VersionInfo, Role, Components); - _tprintf(_T("\nHostname: %s\nName: %s\nVersion: %s\nRole: %s\nComponent: %s\n"),HostName, OSName, VersionInfo, Role, Components); - return 0; + for (i = 1; i < argc; i++) + { + if(!_tcsicmp(argv[i], _T("/ROLE")) && !Operations) + Operations |= GETTYPE_ROLE; + else if(!_tcsicmp(argv[i], _T("/VER")) && !Operations) + Operations |= GETTYPE_VER; + else if(!_tcsicmp(argv[i], _T("/MAJV")) && !Operations) + Operations |= GETTYPE_MAJV; + else if(!_tcsicmp(argv[i], _T("/MINV")) && !Operations) + Operations |= GETTYPE_MINV; + else if(!_tcsicmp(argv[i], _T("/SP")) && !Operations) + Operations |= GETTYPE_SP; + else if(!_tcsicmp(argv[i], _T("/BUILD")) && !Operations) + Operations |= GETTYPE_BUILD; + else if(!_tcsicmp(argv[i], _T("/TYPE")) && !Operations) + Operations |= GETTYPE_TYPE; + else if(!_tcsicmp(argv[i], _T("/?")) && !Operations) + Operations |= GETTYPE_HELP; + else if(!_tcsicmp(argv[i], _T("/S")) && i + 1 < argc) + { + _tcscpy(ServerName,argv[++i]); + bLocal = FALSE; + } + else if(!wcsicmp(argv[i], L"/U") && i + 1 < argc) + _tcscpy(UserName,argv[++i]); + else if(!wcsicmp(argv[i], L"/P") && i + 1 < argc) + _tcscpy(Password,argv[++i]); + else + { + wprintf(L"Error in paramters, please see usage\n"); + return 255; + } + } } - /* read the commands */ - for (i = 1; i < argc; i++) + /* Some debug info */ + //_tprintf(_T("%s - %s - %s - %d"), ServerName, UserName, Password, (int)Operations); + + if(!bLocal) { - if(!_tcsicmp(argv[i], _T("/ROLE"))) - Operations |= GETTYPE_ROLE; - else if(!_tcsicmp(argv[i], _T("/VER"))) - Operations |= GETTYPE_VER; - else if(!_tcsicmp(argv[i], _T("/MAJV"))) - Operations |= GETTYPE_MAJV; - else if(!_tcsicmp(argv[i], _T("/MINV"))) - Operations |= GETTYPE_MINV; - else if(!_tcsicmp(argv[i], _T("/SP"))) - Operations |= GETTYPE_SP; - else if(!_tcsicmp(argv[i], _T("/BUILD"))) - Operations |= GETTYPE_BUILD; - else if(!_tcsicmp(argv[i], _T("/TYPE"))) - Operations |= GETTYPE_TYPE; - else if(!_tcsicmp(argv[i], _T("/?"))) - Operations |= GETTYPE_HELP; - else + NETRESOURCE nr; + + + /* \\*IP or Computer Name*\*Share* */ + _stprintf(RemoteResource, _T("\\\\%s\\IPC$"), ServerName); + + nr.dwType = RESOURCETYPE_ANY; + nr.lpLocalName = NULL; + nr.lpProvider= NULL; + nr.lpRemoteName = RemoteResource; + + /* open a connection to the server with difference user/pass. */ + nStatus = WNetAddConnection2(&nr, UserName[0]?UserName:NULL,Password[0]?Password:NULL, CONNECT_INTERACTIVE | CONNECT_COMMANDLINE); + + if(nStatus != NO_ERROR) { - _tprintf(_T("Unsupported parameter")); + _tprintf(_T("Error:%d-%d\n"),(int)nStatus,GetLastError()); return 255; } } - /* preform the operations */ + /* Use GetVersionEx for anything that we are looking for locally */ + if(bLocal) + { + osvi->dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + if(!GetVersionEx((LPOSVERSIONINFO)osvi)) + { + _tprintf(_T("Failed to get local information\n")); + return 255; + } + } + else + { + nStatus = NetServerGetInfo(NULL,102,(LPBYTE *)&pBuf102); + if (nStatus != NERR_Success) + { + _tprintf(_T("Failed to connection to remote machine\n")); + return 255; + } + + } + if(Operations & GETTYPE_VER) { - INT VersionNumber = 0; - VersionNumber = osvi.dwMajorVersion * 1000; - VersionNumber += (osvi.dwMinorVersion * 100); - return VersionNumber; + ret = GetVersionNumber(bLocal, osvi, pBuf102); } else if(Operations & GETTYPE_MAJV) { - INT VersionNumber = 0; - VersionNumber = osvi.dwMajorVersion; - return VersionNumber; + ret = GetMajValue(TRUE, bLocal, osvi, pBuf102); } else if(Operations & GETTYPE_MINV) { - INT VersionNumber = 0; - VersionNumber = osvi.dwMinorVersion; - return VersionNumber; + ret = GetMajValue(FALSE, bLocal, osvi, pBuf102); } else if(Operations & GETTYPE_ROLE) { - if(osvi.wProductType == VER_NT_DOMAIN_CONTROLLER) - return 1; - else if(osvi.wProductType == VER_NT_SERVER) - return 2; - else if(osvi.wProductType == VER_NT_WORKSTATION) - return 3; + ret = GetSystemRole(bLocal, osvi, pBuf102); } else if(Operations & GETTYPE_SP) { - INT SPNumber = 0; - SPNumber = osvi.wServicePackMajor; - return SPNumber; + ret = GetServicePack(bLocal, osvi, pBuf102, ServerName); } else if(Operations & GETTYPE_BUILD) { - INT BuildNumber = 0; - BuildNumber = osvi.dwBuildNumber; - return BuildNumber; + ret = GetBuildNumber(bLocal, osvi, pBuf102); } else if(Operations & GETTYPE_TYPE) { - if(osvi.dwMajorVersion == 5) - { - if(osvi.dwMinorVersion == 1) - { - if(osvi.wSuiteMask & VER_SUITE_PERSONAL) - return 1; - else - return 2; - } - else if(osvi.dwMinorVersion == 2) - { - if(osvi.wSuiteMask & VER_SUITE_BLADE) - return 6; - else if(osvi.wSuiteMask & VER_SUITE_DATACENTER) - return 5; - else if(osvi.wSuiteMask & VER_SUITE_ENTERPRISE) - return 4; - else - return 3; - } - } + ret = GetType(bLocal, osvi, pBuf102); } else if(Operations & GETTYPE_HELP) { - _tprintf(_T("GETTYPE [/ROLE | /SP | /VER | /MAJV | /MINV | /TYPE | /BUILD]")); - return 0; + wprintf(L"GETTYPE [/ROLE | /SP | /VER | /MAJV | /MINV | /TYPE | /BUILD]"); + ret = 0; } + else if(!Operations && bLocal) + { + /* FIXME: what happens when no flags except remote machine, does it + it print this info for the remote server? */ + TCHAR HostName[1024] = _T(""); + TCHAR OSName[1024] = _T(""); + TCHAR VersionInfo[1024] = _T(""); + TCHAR Role[1024] = _T(""); + TCHAR Components[1024] = _T(""); + GetBasicInfo(osvi, HostName, OSName, VersionInfo, Role, Components); + _tprintf(_T("\nHostname: %s\nName: %s\nVersion:%s\n") ,HostName, OSName, VersionInfo); + _tprintf(_T("Role: %s\nComponent: %s\n"), Role, Components); + ret = 0; + } - return 255; + /* Clean up some stuff that that was opened */ + if(pBuf102) + NetApiBufferFree(pBuf102); + LocalFree(argv); + if(!bLocal) + { + WNetCancelConnection2(RemoteResource,0,TRUE); + } + return ret; } _____ Modified: trunk/reactos/subsys/system/gettype/gettype.xml --- trunk/reactos/subsys/system/gettype/gettype.xml 2005-11-03 01:50:13 UTC (rev 18970) +++ trunk/reactos/subsys/system/gettype/gettype.xml 2005-11-03 02:36:09 UTC (rev 18971) @@ -2,6 +2,10 @@ <include base="gettype">.</include> <define name="_WIN32_WINNT">0x0501</define> <define name="__USE_W32API" /> + <define name="UNICODE" /> + <define name="_UNICODE" /> <library>kernel32</library> + <library>mpr</library> + <library>netapi32</library> <file>gettype.c</file> </module>
19 years, 1 month
1
0
0
0
[turner] 18970: stub for NetServerGetInfo
by turner@svn.reactos.com
stub for NetServerGetInfo Modified: trunk/reactos/lib/netapi32/netapi32.c Modified: trunk/reactos/lib/netapi32/netapi32.spec _____ Modified: trunk/reactos/lib/netapi32/netapi32.c --- trunk/reactos/lib/netapi32/netapi32.c 2005-11-03 01:10:24 UTC (rev 18969) +++ trunk/reactos/lib/netapi32/netapi32.c 2005-11-03 01:50:13 UTC (rev 18970) @@ -66,7 +66,14 @@ return ERROR_NO_BROWSER_SERVERS_FOUND; } +NET_API_STATUS WINAPI +NetServerGetInfo(LPWSTR servername, DWORD level, LPBYTE* bufptr) +{ + FIXME("stub (%p, %ld, %p)\n", servername, level, bufptr); + return ERROR_ACCESS_DENIED; +} + /************************************************************ * NetStatisticsGet (NETAPI32.@) */ _____ Modified: trunk/reactos/lib/netapi32/netapi32.spec --- trunk/reactos/lib/netapi32/netapi32.spec 2005-11-03 01:10:24 UTC (rev 18969) +++ trunk/reactos/lib/netapi32/netapi32.spec 2005-11-03 01:50:13 UTC (rev 18970) @@ -157,7 +157,7 @@ @ stub NetServerDiskEnum @ stdcall NetServerEnum(wstr long ptr long ptr ptr long wstr ptr) @ stub NetServerEnumEx -@ stub NetServerGetInfo +@ stdcall NetServerGetInfo(wstr long ptr) @ stub NetServerSetInfo @ stub NetServerTransportAdd @ stub NetServerTransportAddEx
19 years, 1 month
1
0
0
0
[turner] 18969: define CONNECT_COMMANDLINE and CONNECT_CMD_SAVECRED
by turner@svn.reactos.com
define CONNECT_COMMANDLINE and CONNECT_CMD_SAVECRED Modified: trunk/reactos/w32api/include/winnetwk.h _____ Modified: trunk/reactos/w32api/include/winnetwk.h --- trunk/reactos/w32api/include/winnetwk.h 2005-11-03 01:05:07 UTC (rev 18968) +++ trunk/reactos/w32api/include/winnetwk.h 2005-11-03 01:10:24 UTC (rev 18969) @@ -91,6 +91,8 @@ #define CONNECT_REDIRECT 128 #define CONNECT_LOCALDRIVE 256 #define CONNECT_CURRENT_MEDIA 512 +#define CONNECT_COMMANDLINE 2048 +#define CONNECT_CMD_SAVECRED 4096 #define CONNDLG_RO_PATH 1 #define CONNDLG_CONN_POINT 2 #define CONNDLG_USE_MRU 4
19 years, 1 month
1
0
0
0
[weiden] 18968: fixed difference in signedness warnings
by weiden@svn.reactos.com
fixed difference in signedness warnings Modified: trunk/reactos/subsys/system/cmd/dir.c _____ Modified: trunk/reactos/subsys/system/cmd/dir.c --- trunk/reactos/subsys/system/cmd/dir.c 2005-11-03 00:34:09 UTC (rev 18967) +++ trunk/reactos/subsys/system/cmd/dir.c 2005-11-03 01:05:07 UTC (rev 18968) @@ -1985,7 +1985,7 @@ TCHAR szPath[MAX_PATH]; TCHAR szFilespec[MAX_PATH]; LPTSTR* params; - UINT entries = 0; + INT entries = 0; INT nLine = 0; UINT loop = 0; DIRSWITCHFLAGS stFlags;
19 years, 1 month
1
0
0
0
[blight] 18967: Optimize NtGetContextThread a bit and fix use of unitinialized memory if PreviousMode == KernelMode and Thread ==
by blight@svn.reactos.com
Optimize NtGetContextThread a bit and fix use of unitinialized memory if PreviousMode == KernelMode and Thread == CurrentThread (thanks to Thomas for spotting!) Modified: trunk/reactos/ntoskrnl/ps/debug.c _____ Modified: trunk/reactos/ntoskrnl/ps/debug.c --- trunk/reactos/ntoskrnl/ps/debug.c 2005-11-03 00:17:55 UTC (rev 18966) +++ trunk/reactos/ntoskrnl/ps/debug.c 2005-11-03 00:34:09 UTC (rev 18967) @@ -86,6 +86,7 @@ KPROCESSOR_MODE PreviousMode = ExGetPreviousMode(); GET_SET_CTX_CONTEXT GetSetContext; NTSTATUS Status = STATUS_SUCCESS; + PCONTEXT SafeThreadContext = NULL; PAGED_CODE(); @@ -98,6 +99,7 @@ sizeof(CONTEXT), sizeof(ULONG)); GetSetContext.Context = *ThreadContext; + SafeThreadContext = &GetSetContext.Context; } _SEH_HANDLE { @@ -106,6 +108,8 @@ } _SEH_END; if(!NT_SUCCESS(Status)) return Status; + } else { + SafeThreadContext = ThreadContext; } /* Get the Thread Object */ @@ -121,15 +125,20 @@ /* Check if we're running in the same thread */ if(Thread == PsGetCurrentThread()) { - /* * I don't know if trying to get your own context makes much * sense but we can handle it more efficently. */ - KeTrapFrameToContext(Thread->Tcb.TrapFrame, NULL, &GetSetContext.Context); + KeTrapFrameToContext(Thread->Tcb.TrapFrame, NULL, SafeThreadContext); } else { + /* Copy context into GetSetContext if not already done */ + if(PreviousMode == KernelMode) { + GetSetContext.Context = *ThreadContext; + SafeThreadContext = &GetSetContext.Context; + } + /* Use an APC... Initialize the Event */ KeInitializeEvent(&GetSetContext.Event, NotificationEvent, @@ -173,7 +182,7 @@ ObDereferenceObject(Thread); /* Check for success and return the Context */ - if(NT_SUCCESS(Status)) { + if(NT_SUCCESS(Status) && SafeThreadContext != ThreadContext) { _SEH_TRY { *ThreadContext = GetSetContext.Context;
19 years, 1 month
1
0
0
0
[blight] 18966: Remove assignment to unused Thread variable which was removed by my previous commit.
by blight@svn.reactos.com
Remove assignment to unused Thread variable which was removed by my previous commit. Sorry for breaking. Modified: trunk/reactos/ntoskrnl/ps/debug.c _____ Modified: trunk/reactos/ntoskrnl/ps/debug.c --- trunk/reactos/ntoskrnl/ps/debug.c 2005-11-03 00:15:39 UTC (rev 18965) +++ trunk/reactos/ntoskrnl/ps/debug.c 2005-11-03 00:17:55 UTC (rev 18966) @@ -55,7 +55,6 @@ Context = &GetSetContext->Context; Event = &GetSetContext->Event; Mode = GetSetContext->Mode; - Thread = SystemArgument2; if (TrapFrame->Cs == KERNEL_CS && Mode != KernelMode) {
19 years, 1 month
1
0
0
0
[blight] 18965: Replace EXT_QUERY_OPENGLDRIVERINFO define by OPENGL_GETINFO from winddi.h
by blight@svn.reactos.com
Replace EXT_QUERY_OPENGLDRIVERINFO define by OPENGL_GETINFO from winddi.h Rename EXT_OPENGLDRIVERINFO struct to OPENGL_INFO and change member names a bit. Modified: trunk/reactos/lib/opengl32/wgl.c _____ Modified: trunk/reactos/lib/opengl32/wgl.c --- trunk/reactos/lib/opengl32/wgl.c 2005-11-03 00:09:19 UTC (rev 18964) +++ trunk/reactos/lib/opengl32/wgl.c 2005-11-03 00:15:39 UTC (rev 18965) @@ -11,10 +11,18 @@ #define WIN32_LEAN_AND_MEAN #define WIN32_NO_STATUS #include <windows.h> + +#define NTOS_MODE_USER +#include <ddraw.h> +#include <ddrawi.h> +#include <ddk/winddi.h> + #include <stdio.h> #include <stdlib.h> #include <string.h> + #include "teb.h" + #define OPENGL32_GL_FUNC_PROTOTYPES #include "opengl32.h" @@ -27,13 +35,12 @@ #endif -#define EXT_QUERY_OPENGLDRIVERINFO 0x1101 /*!< ExtEscape code to get driver info */ -typedef struct tagEXT_OPENGLDRIVERINFO +typedef struct _OPENGL_INFO { - DWORD version; /*!< Driver interface version */ - DWORD driver_version; /*!< Driver version */ - WCHAR driver_name[256]; /*!< Driver name */ -} EXT_OPENGLDRIVERINFO; + DWORD Version; /*!< Driver interface version */ + DWORD DriverVersion; /*!< Driver version */ + WCHAR DriverName[256]; /*!< Driver name */ +} OPENGL_INFO, *POPENGL_INFO; /*! \brief Append OpenGL Rendering Context (GLRC) to list @@ -295,7 +302,7 @@ if (dcdata->icd == NULL) { LPCWSTR driverName; - EXT_OPENGLDRIVERINFO info; + OPENGL_INFO info; driverName = _wgetenv( L"OPENGL32_DRIVER" ); if (driverName == NULL) @@ -304,13 +311,13 @@ LONG ret; /* get driver name */ - dwInput = EXT_QUERY_OPENGLDRIVERINFO; + dwInput = OPENGL_GETINFO; ret = ExtEscape( hdc, QUERYESCSUPPORT, sizeof (dwInput), (LPCSTR)&dwInput, 0, NULL ); if (ret > 0) { dwInput = 0; - ret = ExtEscape( hdc, EXT_QUERY_OPENGLDRIVERINFO, sizeof (dwInput), - (LPCSTR)&dwInput, sizeof (EXT_OPENGLDRIVERINFO), + ret = ExtEscape( hdc, OPENGL_GETINFO, sizeof (dwInput), + (LPCSTR)&dwInput, sizeof (OPENGL_INFO), (LPSTR)&info ); } if (ret <= 0) @@ -338,8 +345,8 @@ } /* query value */ - size = sizeof (info.driver_name); - ret = RegQueryValueExW( hKey, L"DefaultDriver", 0, &type, (LPBYTE)info.driver_name, &size ); + size = sizeof (info.DriverName); + ret = RegQueryValueExW( hKey, L"DefaultDriver", 0, &type, (LPBYTE)info.DriverName, &size ); RegCloseKey( hKey ); if (ret != ERROR_SUCCESS || type != REG_SZ) { @@ -351,10 +358,10 @@ } else { - wcsncpy( info.driver_name, driverName, sizeof (info.driver_name) / sizeof (info.driver_name[0]) ); + wcsncpy( info.DriverName, driverName, sizeof (info.DriverName) / sizeof (info.DriverName[0]) ); } /* load driver (or get a reference) */ - dcdata->icd = OPENGL32_LoadICD( info.driver_name ); + dcdata->icd = OPENGL32_LoadICD( info.DriverName ); if (dcdata->icd == NULL) { WCHAR Buffer[256]; @@ -363,7 +370,7 @@ MessageBox(WindowFromDC( hdc ), Buffer, L"OPENGL32.dll: Warning", MB_OK | MB_ICONWARNING); - } + } } return dcdata->icd;
19 years, 1 month
1
0
0
0
← Newer
1
...
80
81
82
83
84
85
86
87
88
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
Results per page:
10
25
50
100
200