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 2011
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
16 participants
274 discussions
Start a n
N
ew thread
[tfaber] 54344: [SERVICES] - Do not use local memory functions (and possibly free the result using HeapFree!) - Do not use double percent signs with _wcsnicmp - DPRINT and style fixes
by tfaber@svn.reactos.org
Author: tfaber Date: Thu Nov 10 21:29:34 2011 New Revision: 54344 URL:
http://svn.reactos.org/svn/reactos?rev=54344&view=rev
Log: [SERVICES] - Do not use local memory functions (and possibly free the result using HeapFree!) - Do not use double percent signs with _wcsnicmp - DPRINT and style fixes Modified: trunk/reactos/base/system/services/database.c trunk/reactos/base/system/services/rpcserver.c Modified: trunk/reactos/base/system/services/database.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/datab…
============================================================================== --- trunk/reactos/base/system/services/database.c [iso-8859-1] (original) +++ trunk/reactos/base/system/services/database.c [iso-8859-1] Thu Nov 10 21:29:34 2011 @@ -193,7 +193,7 @@ /* Create a new service image */ pServiceImage = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - FIELD_OFFSET(SERVICE_IMAGE, szImagePath[wcslen(ImagePath.Buffer) + 1])); + FIELD_OFFSET(SERVICE_IMAGE, szImagePath[ImagePath.Length / sizeof(WCHAR) + 1])); if (pServiceImage == NULL) { dwError = ERROR_NOT_ENOUGH_MEMORY; @@ -1407,7 +1407,7 @@ return ERROR_SERVICE_REQUEST_TIMEOUT; } - else if (dwError == ERROR_SUCCESS) + else if (dwError == WAIT_OBJECT_0) { bResult = GetOverlappedResult(Service->lpImage->hControlPipe, &Overlapped, @@ -1570,10 +1570,10 @@ return dwError; } - DPRINT("Process Id: %lu Handle %lx\n", + DPRINT("Process Id: %lu Handle %p\n", ProcessInformation.dwProcessId, ProcessInformation.hProcess); - DPRINT("Thread Id: %lu Handle %lx\n", + DPRINT("Thread Id: %lu Handle %p\n", ProcessInformation.dwThreadId, ProcessInformation.hThread); Modified: trunk/reactos/base/system/services/rpcserver.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/rpcse…
============================================================================== --- trunk/reactos/base/system/services/rpcserver.c [iso-8859-1] (original) +++ trunk/reactos/base/system/services/rpcserver.c [iso-8859-1] Thu Nov 10 21:29:34 2011 @@ -1578,7 +1578,9 @@ if (ServiceNameLen > 12 && !_wcsnicmp(L"\\SystemRoot\\", CanonName, 12)) { - *RelativeName = LocalAlloc(LMEM_ZEROINIT, ServiceNameLen * sizeof(WCHAR) + sizeof(WCHAR)); + *RelativeName = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + (ServiceNameLen + 1) * sizeof(WCHAR)); if (*RelativeName == NULL) { DPRINT("Error allocating memory for boot driver name!\n"); @@ -1597,7 +1599,9 @@ !_wcsnicmp(L"%SystemRoot%\\", CanonName, 13)) { /* There is no +sizeof(wchar_t) because the name is less by 1 wchar */ - *RelativeName = LocalAlloc(LMEM_ZEROINIT, ServiceNameLen * sizeof(WCHAR)); + *RelativeName = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + ServiceNameLen * sizeof(WCHAR)); if (*RelativeName == NULL) { @@ -1623,7 +1627,9 @@ } /* Allocate memory, since the size is known now */ - Expanded = LocalAlloc(LMEM_ZEROINIT, BufferSize * sizeof(WCHAR) + sizeof(WCHAR)); + Expanded = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + (BufferSize + 1) * sizeof(WCHAR)); if (!Expanded) { DPRINT("Error allocating memory for boot driver name!\n"); @@ -1635,7 +1641,7 @@ BufferSize) { DPRINT("Error during a call to ExpandEnvironmentStringsW()\n"); - LocalFree(Expanded); + HeapFree(GetProcessHeap(), 0, Expanded); return ERROR_NOT_ENOUGH_MEMORY; } @@ -1649,10 +1655,12 @@ DPRINT("Converted to NT-style %wZ\n", &NtPathName); /* No need to keep the dos-path anymore */ - LocalFree(Expanded); + HeapFree(GetProcessHeap(), 0, Expanded); /* Copy it to the allocated place */ - Expanded = LocalAlloc(LMEM_ZEROINIT, NtPathName.Length + sizeof(WCHAR)); + Expanded = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + NtPathName.Length + sizeof(UNICODE_NULL)); if (!Expanded) { DPRINT("Error allocating memory for boot driver name!\n"); @@ -1661,18 +1669,19 @@ ExpandedLen = NtPathName.Length / sizeof(WCHAR); wcsncpy(Expanded, NtPathName.Buffer, ExpandedLen); - Expanded[ExpandedLen] = 0; + Expanded[ExpandedLen] = UNICODE_NULL; if (ServiceNameLen > ExpandedLen && !_wcsnicmp(Expanded, CanonName, ExpandedLen)) { /* Only \SystemRoot\ is missing */ - *RelativeName = LocalAlloc(LMEM_ZEROINIT, - (ServiceNameLen - ExpandedLen) * sizeof(WCHAR) + 13*sizeof(WCHAR)); + *RelativeName = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + (ServiceNameLen - ExpandedLen) * sizeof(WCHAR) + 13*sizeof(WCHAR)); if (*RelativeName == NULL) { DPRINT("Error allocating memory for boot driver name!\n"); - LocalFree(Expanded); + HeapFree(GetProcessHeap(), 0, Expanded); return ERROR_NOT_ENOUGH_MEMORY; } @@ -1711,24 +1720,25 @@ *RelativeName = 0; if (SymbolicLinkHandle) NtClose(SymbolicLinkHandle); - LocalFree(Expanded); + HeapFree(GetProcessHeap(), 0, Expanded); return ERROR_NOT_ENOUGH_MEMORY; } /* Alloc the string */ - LinkTarget.Buffer = LocalAlloc(LMEM_ZEROINIT, BufferSize + sizeof(WCHAR)); + LinkTarget.Length = (USHORT)BufferSize; + LinkTarget.MaximumLength = LinkTarget.Length + sizeof(UNICODE_NULL); + LinkTarget.Buffer = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + LinkTarget.MaximumLength); if (!LinkTarget.Buffer) { DPRINT("Unable to alloc buffer\n"); if (SymbolicLinkHandle) NtClose(SymbolicLinkHandle); - LocalFree(Expanded); + HeapFree(GetProcessHeap(), 0, Expanded); return ERROR_NOT_ENOUGH_MEMORY; } /* Do a real query now */ - LinkTarget.Length = (USHORT)BufferSize; - LinkTarget.MaximumLength = LinkTarget.Length + sizeof(WCHAR); - Status = NtQuerySymbolicLinkObject(SymbolicLinkHandle, &LinkTarget, &BufferSize); if (NT_SUCCESS(Status)) { @@ -1738,14 +1748,15 @@ if ((ServiceNameLen > ExpandedLen) && !_wcsnicmp(LinkTarget.Buffer, CanonName, ExpandedLen)) { - *RelativeName = LocalAlloc(LMEM_ZEROINIT, - (ServiceNameLen - ExpandedLen) * sizeof(WCHAR) + 13*sizeof(WCHAR)); + *RelativeName = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + (ServiceNameLen - ExpandedLen) * sizeof(WCHAR) + 13*sizeof(WCHAR)); if (*RelativeName == NULL) { DPRINT("Unable to alloc buffer\n"); if (SymbolicLinkHandle) NtClose(SymbolicLinkHandle); - LocalFree(Expanded); + HeapFree(GetProcessHeap(), 0, Expanded); RtlFreeUnicodeString(&NtPathName); return ERROR_NOT_ENOUGH_MEMORY; } @@ -1757,7 +1768,7 @@ /* Cleanup */ if (SymbolicLinkHandle) NtClose(SymbolicLinkHandle); - LocalFree(Expanded); + HeapFree(GetProcessHeap(), 0, Expanded); RtlFreeUnicodeString(&NtPathName); /* Return success */ @@ -1766,7 +1777,7 @@ else { if (SymbolicLinkHandle) NtClose(SymbolicLinkHandle); - LocalFree(Expanded); + HeapFree(GetProcessHeap(), 0, Expanded); RtlFreeUnicodeString(&NtPathName); return ERROR_INVALID_PARAMETER; } @@ -1775,7 +1786,7 @@ { DPRINT("Error, Status = %08X\n", Status); if (SymbolicLinkHandle) NtClose(SymbolicLinkHandle); - LocalFree(Expanded); + HeapFree(GetProcessHeap(), 0, Expanded); RtlFreeUnicodeString(&NtPathName); return ERROR_INVALID_PARAMETER; } @@ -1784,7 +1795,7 @@ { DPRINT("Error, Status = %08X\n", Status); if (SymbolicLinkHandle) NtClose(SymbolicLinkHandle); - LocalFree(Expanded); + HeapFree(GetProcessHeap(), 0, Expanded); RtlFreeUnicodeString(&NtPathName); return ERROR_INVALID_PARAMETER; } @@ -1792,7 +1803,7 @@ else { DPRINT("Error, Status = %08X\n", Status); - LocalFree(Expanded); + HeapFree(GetProcessHeap(), 0, Expanded); return ERROR_INVALID_PARAMETER; } @@ -1819,8 +1830,9 @@ !_wcsnicmp(L"\\SystemRoot\\", lpServiceName, 12)) { /* SystemRoot prefix is already included */ - - *lpCanonName = LocalAlloc(LMEM_ZEROINIT, ServiceNameLen * sizeof(WCHAR) + sizeof(WCHAR)); + *lpCanonName = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + (ServiceNameLen + 1) * sizeof(WCHAR)); if (*lpCanonName == NULL) { @@ -1841,10 +1853,12 @@ /* Check if it has %SystemRoot% (len=13) */ if (ServiceNameLen > 13 && - !_wcsnicmp(L"%%SystemRoot%%\\", lpServiceName, 13)) + !_wcsnicmp(L"%SystemRoot%\\", lpServiceName, 13)) { /* Substitute %SystemRoot% with \\SystemRoot\\ */ - *lpCanonName = LocalAlloc(LMEM_ZEROINIT, ServiceNameLen * sizeof(WCHAR) + sizeof(WCHAR)); + *lpCanonName = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + (ServiceNameLen + 1) * sizeof(WCHAR)); if (*lpCanonName == NULL) { @@ -1865,7 +1879,9 @@ /* Check if it's a relative path name */ if (lpServiceName[0] != L'\\' && lpServiceName[1] != L':') { - *lpCanonName = LocalAlloc(LMEM_ZEROINIT, ServiceNameLen * sizeof(WCHAR) + sizeof(WCHAR)); + *lpCanonName = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + (ServiceNameLen + 1) * sizeof(WCHAR)); if (*lpCanonName == NULL) { @@ -1886,7 +1902,9 @@ return ERROR_INVALID_PARAMETER; } - *lpCanonName = LocalAlloc(LMEM_ZEROINIT, NtServiceName.Length + sizeof(WCHAR)); + *lpCanonName = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + NtServiceName.Length + sizeof(WCHAR)); if (*lpCanonName == NULL) { @@ -1912,7 +1930,7 @@ if (Result) { /* There is a problem, free name and return */ - LocalFree(*lpCanonName); + HeapFree(GetProcessHeap(), 0, *lpCanonName); DPRINT("Error converting named!\n"); return Result; } @@ -1923,7 +1941,7 @@ wcscpy(*lpCanonName, RelativeName + 12); /* Free the allocated buffer */ - LocalFree(RelativeName); + HeapFree(GetProcessHeap(), 0, RelativeName); DPRINT("Canonicalized name %S\n", *lpCanonName);
13 years, 1 month
1
0
0
0
[fireball] 54343: [RTL] - DPH: Improve RtlpPageHeapAllocate() code, make variable names consistent with the generic available/busy terms. Logic is absolutely unchanged.
by fireball@svn.reactos.org
Author: fireball Date: Thu Nov 10 15:13:21 2011 New Revision: 54343 URL:
http://svn.reactos.org/svn/reactos?rev=54343&view=rev
Log: [RTL] - DPH: Improve RtlpPageHeapAllocate() code, make variable names consistent with the generic available/busy terms. Logic is absolutely unchanged. Modified: trunk/reactos/lib/rtl/heappage.c Modified: trunk/reactos/lib/rtl/heappage.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/heappage.c?rev=543…
============================================================================== --- trunk/reactos/lib/rtl/heappage.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/heappage.c [iso-8859-1] Thu Nov 10 15:13:21 2011 @@ -1649,9 +1649,9 @@ IN SIZE_T Size) { PDPH_HEAP_ROOT DphRoot; - PDPH_HEAP_BLOCK Node, AllocatedNode; + PDPH_HEAP_BLOCK AvailableNode, BusyNode; BOOLEAN Biased = FALSE; - ULONG TotalSize, AccessSize; + ULONG AllocateSize, AccessSize; NTSTATUS Status; SIZE_T UserActualSize; PVOID Ptr; @@ -1705,11 +1705,11 @@ /* Calculate sizes */ AccessSize = ROUND_UP(Size + sizeof(DPH_BLOCK_INFORMATION), PAGE_SIZE); - TotalSize = AccessSize + PAGE_SIZE; - - // RtlpDphAllocateNode(DphRoot); - Node = RtlpDphFindAvailableMemory(DphRoot, TotalSize, TRUE); - if (!Node) + AllocateSize = AccessSize + PAGE_SIZE; + + // FIXME: Move RtlpDphAllocateNode(DphRoot) to this place + AvailableNode = RtlpDphFindAvailableMemory(DphRoot, AllocateSize, TRUE); + if (!AvailableNode) { DPRINT1("Page heap: Unable to allocate virtual memory\n"); DbgBreakPoint(); @@ -1719,35 +1719,39 @@ return NULL; } - ASSERT(Node->nVirtualBlockSize >= TotalSize); + ASSERT(AvailableNode->nVirtualBlockSize >= AllocateSize); /* Set protection */ - Status = RtlpDphSetProtectionBeforeUse(DphRoot, Node->pVirtualBlock, AccessSize); + Status = RtlpDphSetProtectionBeforeUse(DphRoot, + AvailableNode->pVirtualBlock, + AccessSize); if (!NT_SUCCESS(Status)) { ASSERT(FALSE); } - Ptr = Node->pVirtualBlock; + /* Save available node pointer */ + Ptr = AvailableNode->pVirtualBlock; /* Check node's size */ - if (Node->nVirtualBlockSize > TotalSize) + if (AvailableNode->nVirtualBlockSize > AllocateSize) { /* The block contains too much free space, reduce it */ - Node->pVirtualBlock += TotalSize; - Node->nVirtualBlockSize -= TotalSize; - DphRoot->nAvailableAllocationBytesCommitted -= TotalSize; - - AllocatedNode = RtlpDphAllocateNode(DphRoot); - ASSERT(AllocatedNode != NULL); - AllocatedNode->pVirtualBlock = Ptr; - AllocatedNode->nVirtualBlockSize = TotalSize; + AvailableNode->pVirtualBlock += AllocateSize; + AvailableNode->nVirtualBlockSize -= AllocateSize; + DphRoot->nAvailableAllocationBytesCommitted -= AllocateSize; + + /* Allocate a new node which will be our busy node */ + BusyNode = RtlpDphAllocateNode(DphRoot); + ASSERT(BusyNode != NULL); + BusyNode->pVirtualBlock = Ptr; + BusyNode->nVirtualBlockSize = AllocateSize; } else { /* The block's size fits exactly */ - RtlpDphRemoveFromAvailableList(DphRoot, Node); - AllocatedNode = Node; + RtlpDphRemoveFromAvailableList(DphRoot, AvailableNode); + BusyNode = AvailableNode; } /* Calculate actual user size */ @@ -1757,34 +1761,37 @@ UserActualSize = ROUND_UP(Size, 8); /* Set up the block */ - AllocatedNode->nVirtualAccessSize = AccessSize; - AllocatedNode->nUserActualSize = UserActualSize; - AllocatedNode->nUserRequestedSize = Size; + BusyNode->nVirtualAccessSize = AccessSize; + BusyNode->nUserActualSize = UserActualSize; + BusyNode->nUserRequestedSize = Size; if (DphRoot->ExtraFlags & DPH_EXTRA_CHECK_UNDERRUN) - AllocatedNode->pUserAllocation = AllocatedNode->pVirtualBlock + PAGE_SIZE; + BusyNode->pUserAllocation = BusyNode->pVirtualBlock + PAGE_SIZE; else - AllocatedNode->pUserAllocation = AllocatedNode->pVirtualBlock + AllocatedNode->nVirtualAccessSize - UserActualSize; - - AllocatedNode->UserValue = NULL; - AllocatedNode->UserFlags = Flags & HEAP_SETTABLE_USER_FLAGS; + BusyNode->pUserAllocation = BusyNode->pVirtualBlock + BusyNode->nVirtualAccessSize - UserActualSize; + + BusyNode->UserValue = NULL; + BusyNode->UserFlags = Flags & HEAP_SETTABLE_USER_FLAGS; // FIXME: Don't forget about stack traces if such flag was set - AllocatedNode->StackTrace = NULL; + BusyNode->StackTrace = NULL; /* Place it on busy list */ - RtlpDphPlaceOnBusyList(DphRoot, AllocatedNode); + RtlpDphPlaceOnBusyList(DphRoot, BusyNode); /* Zero or patter-fill memory depending on flags */ if (Flags & HEAP_ZERO_MEMORY) - RtlZeroMemory(AllocatedNode->pUserAllocation, Size); + RtlZeroMemory(BusyNode->pUserAllocation, Size); else - RtlFillMemory(AllocatedNode->pUserAllocation, Size, DPH_FILL_INFIX); + RtlFillMemory(BusyNode->pUserAllocation, Size, DPH_FILL_INFIX); /* Write DPH info */ if (!(DphRoot->ExtraFlags & DPH_EXTRA_CHECK_UNDERRUN)) { - RtlpDphWritePageHeapBlockInformation(DphRoot, AllocatedNode->pUserAllocation, Size, AccessSize); + RtlpDphWritePageHeapBlockInformation(DphRoot, + BusyNode->pUserAllocation, + Size, + AccessSize); } /* Finally allocation is done, perform validation again if required */ @@ -1796,10 +1803,10 @@ /* Release the lock */ RtlpDphPostProcessing(DphRoot); - DPRINT("Allocated user block pointer: %p\n", AllocatedNode->pUserAllocation); + DPRINT("Allocated user block pointer: %p\n", BusyNode->pUserAllocation); /* Return pointer to user allocation */ - return AllocatedNode->pUserAllocation; + return BusyNode->pUserAllocation; } BOOLEAN NTAPI
13 years, 1 month
1
0
0
0
[ekohl] 54342: [SERVICES] Improve the parameter checks in RCreateServiceW.
by ekohl@svn.reactos.org
Author: ekohl Date: Wed Nov 9 23:18:37 2011 New Revision: 54342 URL:
http://svn.reactos.org/svn/reactos?rev=54342&view=rev
Log: [SERVICES] Improve the parameter checks in RCreateServiceW. Modified: trunk/reactos/base/system/services/rpcserver.c Modified: trunk/reactos/base/system/services/rpcserver.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/rpcse…
============================================================================== --- trunk/reactos/base/system/services/rpcserver.c [iso-8859-1] (original) +++ trunk/reactos/base/system/services/rpcserver.c [iso-8859-1] Wed Nov 9 23:18:37 2011 @@ -1999,26 +1999,39 @@ return ERROR_INVALID_PARAMETER; } - if ((dwServiceType & SERVICE_KERNEL_DRIVER) && - (dwServiceType & SERVICE_FILE_SYSTEM_DRIVER)) - { + /* Check for invalid service type value */ + if ((dwServiceType != SERVICE_KERNEL_DRIVER) && + (dwServiceType != SERVICE_FILE_SYSTEM_DRIVER) && + ((dwServiceType & ~SERVICE_INTERACTIVE_PROCESS) != SERVICE_WIN32_OWN_PROCESS) && + ((dwServiceType & ~SERVICE_INTERACTIVE_PROCESS) != SERVICE_WIN32_SHARE_PROCESS)) + return ERROR_INVALID_PARAMETER; + + /* Check for invalid start type value */ + if ((dwStartType != SERVICE_BOOT_START) && + (dwStartType != SERVICE_SYSTEM_START) && + (dwStartType != SERVICE_AUTO_START) && + (dwStartType != SERVICE_DEMAND_START) && + (dwStartType != SERVICE_DISABLED)) return ERROR_INVALID_PARAMETER; - } + + /* Only drivers can be boot start or system start services */ + if ((dwStartType == SERVICE_BOOT_START) || + (dwStartType == SERVICE_SYSTEM_START)) + { + if ((dwServiceType != SERVICE_KERNEL_DRIVER) && + (dwServiceType != SERVICE_FILE_SYSTEM_DRIVER)) + return ERROR_INVALID_PARAMETER; + } + + /* Check for invalid error control value */ + if ((dwErrorControl != SERVICE_ERROR_IGNORE) && + (dwErrorControl != SERVICE_ERROR_NORMAL) && + (dwErrorControl != SERVICE_ERROR_SEVERE) && + (dwErrorControl != SERVICE_ERROR_CRITICAL)) + return ERROR_INVALID_PARAMETER; if ((dwServiceType == (SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS)) && (lpServiceStartName)) - { - return ERROR_INVALID_PARAMETER; - } - - if ((dwServiceType > SERVICE_WIN32_SHARE_PROCESS) && - (dwServiceType != (SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS)) && - (dwServiceType != (SERVICE_WIN32_SHARE_PROCESS | SERVICE_INTERACTIVE_PROCESS))) - { - return ERROR_INVALID_PARAMETER; - } - - if (dwStartType > SERVICE_DISABLED) { return ERROR_INVALID_PARAMETER; }
13 years, 1 month
1
0
0
0
[tfaber] 54341: [USER32] - Fix a TRACE. Spotted by Victor Martinez
by tfaber@svn.reactos.org
Author: tfaber Date: Wed Nov 9 18:52:09 2011 New Revision: 54341 URL:
http://svn.reactos.org/svn/reactos?rev=54341&view=rev
Log: [USER32] - Fix a TRACE. Spotted by Victor Martinez Modified: trunk/reactos/dll/win32/user32/windows/message.c Modified: trunk/reactos/dll/win32/user32/windows/message.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/m…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/message.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/message.c [iso-8859-1] Wed Nov 9 18:52:09 2011 @@ -1512,7 +1512,7 @@ This is the message exchange for user32. If there's a need to monitor messages, do it here! */ - TRACE("HWND 0x%x, MSG %d, WPARAM 0x%x, LPARAM 0x%x, Ansi &d\n",hWnd,Msg,wParam,lParam,Ansi); + TRACE("HWND %p, MSG %u, WPARAM %p, LPARAM %p, Ansi %d\n", hWnd, Msg, wParam, lParam, Ansi); // if (Class->fnid <= FNID_GHOST && Class->fnid >= FNID_BUTTON ) if (Class->fnid <= FNID_GHOST && Class->fnid >= FNID_FIRST ) {
13 years, 1 month
1
0
0
0
[khornicek] 54340: [FASTFAT] Don't report success for unsupported file information classes. See issue #6628 for more details.
by khornicek@svn.reactos.org
Author: khornicek Date: Tue Nov 8 17:08:04 2011 New Revision: 54340 URL:
http://svn.reactos.org/svn/reactos?rev=54340&view=rev
Log: [FASTFAT] Don't report success for unsupported file information classes. See issue #6628 for more details. Modified: trunk/reactos/drivers/filesystems/fastfat/dir.c Modified: trunk/reactos/drivers/filesystems/fastfat/dir.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
============================================================================== --- trunk/reactos/drivers/filesystems/fastfat/dir.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/fastfat/dir.c [iso-8859-1] Tue Nov 8 17:08:04 2011 @@ -433,7 +433,7 @@ default: RC = STATUS_INVALID_INFO_CLASS; } - if (RC == STATUS_BUFFER_OVERFLOW) + if (RC == STATUS_BUFFER_OVERFLOW || RC == STATUS_INVALID_INFO_CLASS) { break; }
13 years, 1 month
1
0
0
0
[ion] 54339: [KERNEL32]: Fix a bug when converting EXECUTE access.
by ion@svn.reactos.org
Author: ion Date: Mon Nov 7 17:49:10 2011 New Revision: 54339 URL:
http://svn.reactos.org/svn/reactos?rev=54339&view=rev
Log: [KERNEL32]: Fix a bug when converting EXECUTE access. Modified: trunk/reactos/dll/win32/kernel32/client/file/filemap.c Modified: trunk/reactos/dll/win32/kernel32/client/file/filemap.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/file/filemap.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/file/filemap.c [iso-8859-1] Mon Nov 7 17:49:10 2011 @@ -314,11 +314,14 @@ NULL); /* Convert COPY to READ */ - if (dwDesiredAccess == FILE_MAP_COPY) dwDesiredAccess = SECTION_MAP_READ; - - /* Fixup execute */ - if (dwDesiredAccess == FILE_MAP_EXECUTE) - { + if (dwDesiredAccess == FILE_MAP_COPY) + { + /* Fixup copy */ + dwDesiredAccess = SECTION_MAP_READ; + } + else if (dwDesiredAccess & FILE_MAP_EXECUTE) + { + /* Fixup execute */ dwDesiredAccess = (dwDesiredAccess & ~FILE_MAP_EXECUTE) | SECTION_MAP_EXECUTE; }
13 years, 1 month
1
0
0
0
[tfaber] 54338: [KERNEL32] - Do not fail in CreateFileMappingW if write or execute access is requested
by tfaber@svn.reactos.org
Author: tfaber Date: Mon Nov 7 16:53:04 2011 New Revision: 54338 URL:
http://svn.reactos.org/svn/reactos?rev=54338&view=rev
Log: [KERNEL32] - Do not fail in CreateFileMappingW if write or execute access is requested Modified: trunk/reactos/dll/win32/kernel32/client/file/filemap.c Modified: trunk/reactos/dll/win32/kernel32/client/file/filemap.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/file/filemap.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/file/filemap.c [iso-8859-1] Mon Nov 7 16:53:04 2011 @@ -85,8 +85,7 @@ /* Give it */ DesiredAccess |= SECTION_MAP_EXECUTE; } - - if ((flProtect != PAGE_READONLY) && (flProtect != PAGE_WRITECOPY)) + else if ((flProtect != PAGE_READONLY) && (flProtect != PAGE_WRITECOPY)) { SetLastError(ERROR_INVALID_PARAMETER); return NULL;
13 years, 1 month
1
0
0
0
[ion] 54337: Hurray for misisng includes.
by ion@svn.reactos.org
Author: ion Date: Mon Nov 7 15:44:07 2011 New Revision: 54337 URL:
http://svn.reactos.org/svn/reactos?rev=54337&view=rev
Log: Hurray for misisng includes. Modified: trunk/reactos/include/psdk/winbase.h trunk/reactos/include/psdk/winnt.h Modified: trunk/reactos/include/psdk/winbase.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winbase.h?rev…
============================================================================== --- trunk/reactos/include/psdk/winbase.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/winbase.h [iso-8859-1] Mon Nov 7 15:44:07 2011 @@ -148,10 +148,11 @@ #define CALLBACK_CHUNK_FINISHED 0 #define CALLBACK_STREAM_SWITCH 1 #define OFS_MAXPATHNAME 128 -#define FILE_MAP_ALL_ACCESS 0xf001f -#define FILE_MAP_READ 4 -#define FILE_MAP_WRITE 2 -#define FILE_MAP_COPY 1 +#define FILE_MAP_COPY SECTION_QUERY +#define FILE_MAP_WRITE SECTION_MAP_WRITE +#define FILE_MAP_READ SECTION_MAP_READ +#define FILE_MAP_ALL_ACCESS SECTION_ALL_ACCESS +#define FILE_MAP_EXECUTE SECTION_MAP_EXECUTE_EXPLICIT #define MUTEX_ALL_ACCESS 0x1f0001 #define MUTEX_MODIFY_STATE 1 #define SEMAPHORE_ALL_ACCESS 0x1f0003 Modified: trunk/reactos/include/psdk/winnt.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winnt.h?rev=5…
============================================================================== --- trunk/reactos/include/psdk/winnt.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/winnt.h [iso-8859-1] Mon Nov 7 15:44:07 2011 @@ -1385,6 +1385,7 @@ #define SEC_NOCACHE 0x10000000 #define SEC_WRITECOMBINE 0x40000000 #define SEC_LARGE_PAGES 0x80000000 +#define SECTION_MAP_EXECUTE_EXPLICIT 0x0020 #define SECTION_EXTEND_SIZE 16 #define SECTION_MAP_READ 4 #define SECTION_MAP_WRITE 2
13 years, 1 month
1
0
0
0
[ion] 54336: [KERNEL32]: Fix various bugs in the file mapping APIs, mainly related to lack of EXECUTE mappings and incorrect error codes.
by ion@svn.reactos.org
Author: ion Date: Mon Nov 7 15:43:37 2011 New Revision: 54336 URL:
http://svn.reactos.org/svn/reactos?rev=54336&view=rev
Log: [KERNEL32]: Fix various bugs in the file mapping APIs, mainly related to lack of EXECUTE mappings and incorrect error codes. Modified: trunk/reactos/dll/win32/kernel32/client/file/filemap.c Modified: trunk/reactos/dll/win32/kernel32/client/file/filemap.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/file/filemap.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/file/filemap.c [iso-8859-1] Mon Nov 7 15:43:37 2011 @@ -6,14 +6,14 @@ * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org) */ -/* INCLUDES ******************************************************************/ +/* INCLUDES *******************************************************************/ #include <k32.h> #define NDEBUG #include <debug.h> -/* FUNCTIONS *****************************************************************/ +/* FUNCTIONS ******************************************************************/ /* * @implemented @@ -73,7 +73,23 @@ if (flProtect == PAGE_READWRITE) { /* Give it */ - DesiredAccess |= (SECTION_MAP_WRITE | SECTION_MAP_READ); + DesiredAccess |= SECTION_MAP_WRITE; + } + else if (flProtect == PAGE_EXECUTE_READWRITE) + { + /* Give it */ + DesiredAccess |= (SECTION_MAP_WRITE | SECTION_MAP_EXECUTE); + } + else if (flProtect == PAGE_EXECUTE_READ) + { + /* Give it */ + DesiredAccess |= SECTION_MAP_EXECUTE; + } + + if ((flProtect != PAGE_READONLY) && (flProtect != PAGE_WRITECOPY)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return NULL; } /* Now check if we got a name */ @@ -114,21 +130,21 @@ flProtect, Attributes, hFile); - - if (Status == STATUS_OBJECT_NAME_EXISTS) + if (!NT_SUCCESS(Status)) + { + /* We failed */ + BaseSetLastNTError(Status); + return NULL; + } + else if (Status == STATUS_OBJECT_NAME_EXISTS) { SetLastError(ERROR_ALREADY_EXISTS); - return SectionHandle; - } - - if (!NT_SUCCESS(Status)) - { - /* We failed */ - BaseSetLastNTError(Status); - return NULL; - } - - SetLastError(ERROR_SUCCESS); + } + else + { + SetLastError(ERROR_SUCCESS); + } + /* Return the section */ return SectionHandle; } @@ -160,17 +176,19 @@ ViewSize = dwNumberOfBytesToMap; /* Convert flags to NT Protection Attributes */ - if (dwDesiredAccess & FILE_MAP_WRITE) - { - Protect = PAGE_READWRITE; + if (dwDesiredAccess == FILE_MAP_COPY) + { + Protect = PAGE_WRITECOPY; + } + else if (dwDesiredAccess & FILE_MAP_WRITE) + { + Protect = (dwDesiredAccess & FILE_MAP_EXECUTE) ? + PAGE_EXECUTE_READWRITE : PAGE_READWRITE; } else if (dwDesiredAccess & FILE_MAP_READ) { - Protect = PAGE_READONLY; - } - else if (dwDesiredAccess & FILE_MAP_COPY) - { - Protect = PAGE_WRITECOPY; + Protect = (dwDesiredAccess & FILE_MAP_EXECUTE) ? + PAGE_EXECUTE_READ : PAGE_READONLY; } else { @@ -232,6 +250,18 @@ Status = NtUnmapViewOfSection(NtCurrentProcess(), (PVOID)lpBaseAddress); if (!NT_SUCCESS(Status)) { + /* Check if the pages were protected */ + if (Status == STATUS_INVALID_PAGE_PROTECTION) + { + /* Flush the region if it was a "secure memory cache" */ + if (RtlFlushSecureMemoryCache((PVOID)lpBaseAddress, 0)) + { + /* Now try to unmap again */ + Status = NtUnmapViewOfSection(NtCurrentProcess(), (PVOID)lpBaseAddress); + if (NT_SUCCESS(Status)) return TRUE; + } + } + /* We failed */ BaseSetLastNTError(Status); return FALSE; @@ -244,55 +274,24 @@ /* * @implemented */ +HANDLE +NTAPI +OpenFileMappingA(IN DWORD dwDesiredAccess, + IN BOOL bInheritHandle, + IN LPCSTR lpName) +{ + ConvertOpenWin32AnsiObjectApiToUnicodeApi(FileMapping, dwDesiredAccess, bInheritHandle, lpName); +} + +/* + * @implemented + */ /* FIXME: Convert to the new macros */ HANDLE NTAPI -OpenFileMappingA(DWORD dwDesiredAccess, - BOOL bInheritHandle, - LPCSTR lpName) -{ - NTSTATUS Status; - ANSI_STRING AnsiName; - PUNICODE_STRING UnicodeCache; - - /* Check for a name */ - if (lpName) - { - /* Use TEB Cache */ - UnicodeCache = &NtCurrentTeb()->StaticUnicodeString; - - /* Convert to unicode */ - RtlInitAnsiString(&AnsiName, lpName); - Status = RtlAnsiStringToUnicodeString(UnicodeCache, &AnsiName, FALSE); - if (!NT_SUCCESS(Status)) - { - /* Conversion failed */ - BaseSetLastNTError(Status); - return NULL; - } - } - else - { - /* We need a name */ - SetLastError(ERROR_INVALID_PARAMETER); - return NULL; - } - - /* Call the Unicode version */ - return OpenFileMappingW(dwDesiredAccess, - bInheritHandle, - (LPCWSTR)UnicodeCache->Buffer); -} - -/* - * @implemented - */ - /* FIXME: Convert to the new macros */ -HANDLE -NTAPI -OpenFileMappingW(DWORD dwDesiredAccess, - BOOL bInheritHandle, - LPCWSTR lpName) +OpenFileMappingW(IN DWORD dwDesiredAccess, + IN BOOL bInheritHandle, + IN LPCWSTR lpName) { NTSTATUS Status; HANDLE SectionHandle; @@ -316,12 +315,16 @@ NULL); /* Convert COPY to READ */ - if (dwDesiredAccess == FILE_MAP_COPY) dwDesiredAccess = FILE_MAP_READ; + if (dwDesiredAccess == FILE_MAP_COPY) dwDesiredAccess = SECTION_MAP_READ; + + /* Fixup execute */ + if (dwDesiredAccess == FILE_MAP_EXECUTE) + { + dwDesiredAccess = (dwDesiredAccess & ~FILE_MAP_EXECUTE) | SECTION_MAP_EXECUTE; + } /* Open the section */ - Status = ZwOpenSection(&SectionHandle, - dwDesiredAccess, - &ObjectAttributes); + Status = ZwOpenSection(&SectionHandle, dwDesiredAccess, &ObjectAttributes); if (!NT_SUCCESS(Status)) { /* We failed */ @@ -329,7 +332,6 @@ return NULL; } - SetLastError(ERROR_SUCCESS); /* Otherwise, return the handle */ return SectionHandle; } @@ -339,8 +341,8 @@ */ BOOL NTAPI -FlushViewOfFile(LPCVOID lpBaseAddress, - SIZE_T dwNumberOfBytesToFlush) +FlushViewOfFile(IN LPCVOID lpBaseAddress, + IN SIZE_T dwNumberOfBytesToFlush) { SIZE_T NumberOfBytesToFlush; NTSTATUS Status; @@ -354,7 +356,7 @@ (LPVOID)lpBaseAddress, &NumberOfBytesToFlush, &IoStatusBlock); - if (!NT_SUCCESS(Status)) + if (!NT_SUCCESS(Status) && (Status != STATUS_NOT_MAPPED_DATA)) { /* We failed */ BaseSetLastNTError(Status);
13 years, 1 month
1
0
0
0
[dgorbachev] 54335: [TRANSLATION] - Add some Romanian strings to the registry. Fulea Stefan, bug #6603. - Add a few Russian strings, too.
by dgorbachev@svn.reactos.org
Author: dgorbachev Date: Mon Nov 7 08:01:58 2011 New Revision: 54335 URL:
http://svn.reactos.org/svn/reactos?rev=54335&view=rev
Log: [TRANSLATION] - Add some Romanian strings to the registry. Fulea Stefan, bug #6603. - Add a few Russian strings, too. Modified: trunk/reactos/boot/bootdata/hivedef_i386.inf trunk/reactos/boot/bootdata/hivesft_i386.inf Modified: trunk/reactos/boot/bootdata/hivedef_i386.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivedef_i386…
============================================================================== Binary files - no diff available. Modified: trunk/reactos/boot/bootdata/hivesft_i386.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivesft_i386…
============================================================================== Binary files - no diff available.
13 years, 1 month
1
0
0
0
← Newer
1
...
19
20
21
22
23
24
25
...
28
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
Results per page:
10
25
50
100
200