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
September 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
20 participants
399 discussions
Start a n
N
ew thread
[jgardou] 53790: [DHCPSVC] - fix const usage
by jgardou@svn.reactos.org
Author: jgardou Date: Wed Sep 21 17:11:00 2011 New Revision: 53790 URL:
http://svn.reactos.org/svn/reactos?rev=53790&view=rev
Log: [DHCPSVC] - fix const usage Modified: trunk/reactos/dll/win32/dhcpcsvc/dhcp/adapter.c Modified: trunk/reactos/dll/win32/dhcpcsvc/dhcp/adapter.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/dhcpcsvc/dhcp/ad…
============================================================================== --- trunk/reactos/dll/win32/dhcpcsvc/dhcp/adapter.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/dhcpcsvc/dhcp/adapter.c [iso-8859-1] Wed Sep 21 17:11:00 2011 @@ -190,7 +190,7 @@ } int -InterfaceConnected(const PMIB_IFROW IfEntry) +InterfaceConnected(const MIB_IFROW* IfEntry) { if (IfEntry->dwOperStatus == IF_OPER_STATUS_CONNECTED || IfEntry->dwOperStatus == IF_OPER_STATUS_OPERATIONAL)
13 years, 3 months
1
0
0
0
[pschweitzer] 53789: [HAL/x86] Completely fix one of the overruns
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Wed Sep 21 16:15:16 2011 New Revision: 53789 URL:
http://svn.reactos.org/svn/reactos?rev=53789&view=rev
Log: [HAL/x86] Completely fix one of the overruns Modified: trunk/reactos/hal/halx86/legacy/bussupp.c Modified: trunk/reactos/hal/halx86/legacy/bussupp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/legacy/bussupp.…
============================================================================== --- trunk/reactos/hal/halx86/legacy/bussupp.c [iso-8859-1] (original) +++ trunk/reactos/hal/halx86/legacy/bussupp.c [iso-8859-1] Wed Sep 21 16:15:16 2011 @@ -721,7 +721,7 @@ SubClassName += 5; p = strchr(SubClassName, '\r'); Length = p - SubClassName; - if (Length > sizeof(bSubClassName)) Length = sizeof(bSubClassName) - 1; + if (Length >= sizeof(bSubClassName)) Length = sizeof(bSubClassName) - 1; strncpy(bSubClassName, SubClassName, Length); bSubClassName[Length] = '\0'; }
13 years, 3 months
1
0
0
0
[pschweitzer] 53788: [HAL/x86] Fix buffer overruns
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Wed Sep 21 16:10:32 2011 New Revision: 53788 URL:
http://svn.reactos.org/svn/reactos?rev=53788&view=rev
Log: [HAL/x86] Fix buffer overruns Modified: trunk/reactos/hal/halx86/generic/usage.c trunk/reactos/hal/halx86/legacy/bussupp.c Modified: trunk/reactos/hal/halx86/generic/usage.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/usage.c…
============================================================================== --- trunk/reactos/hal/halx86/generic/usage.c [iso-8859-1] (original) +++ trunk/reactos/hal/halx86/generic/usage.c [iso-8859-1] Wed Sep 21 16:10:32 2011 @@ -323,7 +323,7 @@ while (TRUE) { /* Check for valid vector number */ - if (i <= MAXIMUM_IDTVECTOR) + if (i < MAXIMUM_IDTVECTOR) { /* Check if this entry should be parsed */ if ((HalpIDTUsageFlags[i].Flags & FlagMatch)) Modified: trunk/reactos/hal/halx86/legacy/bussupp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/legacy/bussupp.…
============================================================================== --- trunk/reactos/hal/halx86/legacy/bussupp.c [iso-8859-1] (original) +++ trunk/reactos/hal/halx86/legacy/bussupp.c [iso-8859-1] Wed Sep 21 16:10:32 2011 @@ -721,7 +721,7 @@ SubClassName += 5; p = strchr(SubClassName, '\r'); Length = p - SubClassName; - if (Length > sizeof(bSubClassName)) Length = sizeof(bSubClassName); + if (Length > sizeof(bSubClassName)) Length = sizeof(bSubClassName) - 1; strncpy(bSubClassName, SubClassName, Length); bSubClassName[Length] = '\0'; }
13 years, 3 months
1
0
0
0
[gadamopoulos] 53787: [user32_apitest] - Add some tests for TrackMouseEvent
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Wed Sep 21 12:30:22 2011 New Revision: 53787 URL:
http://svn.reactos.org/svn/reactos?rev=53787&view=rev
Log: [user32_apitest] - Add some tests for TrackMouseEvent Added: trunk/rostests/apitests/user32/TrackMouseEvent.c (with props) Modified: trunk/rostests/apitests/user32/CMakeLists.txt trunk/rostests/apitests/user32/testlist.c trunk/rostests/apitests/user32/user32_apitest.rbuild Modified: trunk/rostests/apitests/user32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/CMakeList…
============================================================================== --- trunk/rostests/apitests/user32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/apitests/user32/CMakeLists.txt [iso-8859-1] Wed Sep 21 12:30:22 2011 @@ -15,6 +15,7 @@ ScrollWindowEx.c SetCursorPos.c SetActiveWindow.c + TrackMouseEvent.c WndProc.c testlist.c user32_apitest.rc) Added: trunk/rostests/apitests/user32/TrackMouseEvent.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/TrackMous…
============================================================================== --- trunk/rostests/apitests/user32/TrackMouseEvent.c (added) +++ trunk/rostests/apitests/user32/TrackMouseEvent.c [iso-8859-1] Wed Sep 21 12:30:22 2011 @@ -1,0 +1,355 @@ +/* + * PROJECT: ReactOS api tests + * LICENSE: GPL - See COPYING in the top level directory + * PURPOSE: Test for TrackMouseEvent + * PROGRAMMERS: Giannis Adamopoulos + */ + +#include <stdio.h> +#include <wine/test.h> +#include <windows.h> + +typedef struct _MSG_ENTRY +{ + int iwnd; + UINT msg; +} MSG_ENTRY; + +MSG_ENTRY message_cache[100]; +static int message_cache_size = 0; + +HWND hWnd1, hWnd2, hWnd3; + +/* helper functions */ + +static char* get_msg_name(UINT msg) +{ + switch(msg) + { + case WM_NCACTIVATE: return "WM_NCACTIVATE"; + case WM_ACTIVATE: return "WM_ACTIVATE"; + case WM_ACTIVATEAPP: return "WM_ACTIVATEAPP"; + case WM_WINDOWPOSCHANGING: return "WM_WINDOWPOSCHANGING"; + case WM_WINDOWPOSCHANGED: return "WM_WINDOWPOSCHANGED"; + case WM_SETFOCUS: return "WM_SETFOCUS"; + case WM_KILLFOCUS: return "WM_KILLFOCUS"; + case WM_NCPAINT: return "WM_NCPAINT"; + case WM_PAINT: return "WM_PAINT"; + case WM_ERASEBKGND: return "WM_ERASEBKGND"; + case WM_SIZE: return "WM_SIZE"; + case WM_MOVE: return "WM_MOVE"; + case WM_SHOWWINDOW: return "WM_SHOWWINDOW"; + case WM_QUERYNEWPALETTE: return "WM_QUERYNEWPALETTE"; + case WM_MOUSELEAVE: return "WM_MOUSELEAVE"; + case WM_MOUSEHOVER: return "WM_MOUSEHOVER"; + case WM_NCMOUSELEAVE: return "WM_NCMOUSELEAVE"; + case WM_NCMOUSEHOVER: return "WM_NCMOUSEHOVER"; + case WM_NCHITTEST: return "WM_NCHITTEST"; + case WM_SETCURSOR: return "WM_SETCURSOR"; + case WM_MOUSEMOVE: return "WM_MOUSEMOVE"; + default: return NULL; + } +} + +static void empty_message_cache() +{ + memset(message_cache, 0, sizeof(message_cache)); + message_cache_size = 0; +} +#if 0 +static void trace_cache() +{ + int i; + char *szMsgName; + + for (i=0; i < message_cache_size; i++) + { + if((szMsgName = get_msg_name(message_cache[i].msg))) + { + trace("hwnd%d, msg:%s\n",message_cache[i].iwnd, szMsgName ); + } + else + { + trace("hwnd%d, msg:%d\n",message_cache[i].iwnd, message_cache[i].msg ); + } + } + trace("\n"); +} +#endif + +static void compare_cache(char* testname, MSG_ENTRY *msg_chain) +{ + int i = 0; + + while(1) + { + char *szMsgExpected, *szMsgGot; + szMsgExpected = get_msg_name(msg_chain->msg); + szMsgGot = get_msg_name(message_cache[i].msg); + if(szMsgExpected && szMsgGot) + { + ok(message_cache[i].iwnd == msg_chain->iwnd && + message_cache[i].msg == msg_chain->msg, + "%s, message %d: expected %s to hwnd%d and got %s to hwnd%d\n", + testname,i, szMsgExpected, msg_chain->iwnd, szMsgGot, message_cache[i].iwnd); + } + else + { + ok(message_cache[i].iwnd == msg_chain->iwnd && + message_cache[i].msg == msg_chain->msg, + "%s, message %d: expected msg %d to hwnd%d and got msg %d to hwnd%d\n", + testname,i, msg_chain->msg, msg_chain->iwnd, message_cache[i].msg, message_cache[i].iwnd); + } + + if(msg_chain->msg !=0 && msg_chain->iwnd != 0) + { + msg_chain++; + } + else + { + if(i>message_cache_size) + { + break; + } + } + i++; + } + + empty_message_cache(); +} + +static void record_message(int iwnd, UINT message) +{ + message_cache[message_cache_size].iwnd = iwnd; + message_cache[message_cache_size].msg = message; + message_cache_size++; +} + +LRESULT CALLBACK TmeTestProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + if(message < WM_USER && + message != WM_IME_SETCONTEXT && + message != WM_IME_NOTIFY && + message != WM_KEYUP && + message != WM_GETICON && + message != WM_GETTEXT && /* the following messages have to be ignroed because dwm changes the time they are sent */ + message != WM_NCPAINT && + message != WM_ERASEBKGND && + message != WM_PAINT && + message != 0x031f /*WM_DWMNCRENDERINGCHANGED*/) + { + if (message_cache_size<100) + { + int iwnd; + if(hWnd == hWnd1) iwnd = 1; + else if(hWnd == hWnd2) iwnd = 2; + else if(hWnd == hWnd3) iwnd = 3; + else + return DefWindowProc(hWnd, message, wParam, lParam); + + record_message(iwnd, message); + } + } + + if(message == WM_PAINT) + { + PAINTSTRUCT ps; + BeginPaint(hWnd, &ps); + Rectangle(ps.hdc, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom); + EndPaint(hWnd, &ps); + } + + return DefWindowProc(hWnd, message, wParam, lParam); +} + +static void create_test_windows() +{ + WNDCLASSEXW wcex; + + wcex.cbSize = sizeof(WNDCLASSEX); + wcex.style = 0; + wcex.lpfnWndProc = TmeTestProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = 0; + wcex.hIcon = 0; + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); + wcex.lpszMenuName = 0; + wcex.lpszClassName = L"testClass"; + wcex.hIconSm = 0; + + RegisterClassExW(&wcex); + + hWnd1 = CreateWindowW(L"testClass", L"test", WS_OVERLAPPEDWINDOW, + 100, 100, 500, 500, NULL, NULL, 0, NULL); + hWnd2 = CreateWindowW(L"testClass", L"test", WS_CHILD, + 50, 50, 200, 200, hWnd1, NULL, 0, NULL); + hWnd3 = CreateWindowW(L"testClass", L"test", WS_CHILD, + 150, 150, 200, 200, hWnd1, NULL, 0, NULL); + + ShowWindow(hWnd1, SW_SHOW); + UpdateWindow(hWnd1); + ShowWindow(hWnd2, SW_SHOW); + UpdateWindow(hWnd2); + ShowWindow(hWnd3, SW_SHOWNORMAL); + UpdateWindow(hWnd3); + //SetWindowPos (hWnd3, HWND_TOP, 0,0,0,0, SWP_NOMOVE|SWP_NOREDRAW); +} + +static void TmeStartTracking(HWND hwnd, DWORD Flags) +{ + TRACKMOUSEEVENT tme; + tme.cbSize = sizeof(tme); + tme.dwFlags = Flags; + tme.hwndTrack = hwnd; + tme.dwHoverTime = 1; + if(!TrackMouseEvent(&tme)) + { + trace("failed!\n"); + } +} + +DWORD TmeQuery(HWND hwnd) +{ + TRACKMOUSEEVENT tme; + tme.cbSize = sizeof(tme); + tme.dwFlags = TME_QUERY|TME_HOVER|TME_LEAVE; + tme.hwndTrack = hwnd; + TrackMouseEvent(&tme); + return tme.dwFlags; +} + +#define FLUSH_MESSAGES(msg) while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); +#define EXPECT_TME_FLAGS(hWnd, expected) \ + { DWORD flags = TmeQuery(hWnd); \ + ok(flags == (expected),"wrong tme flags. expected %li, and got %li\n", (DWORD)(expected), flags); \ + } + +#define EXPECT_QUEUE_STATUS(expected, notexpected) \ + { \ + DWORD status = HIWORD(GetQueueStatus(QS_ALLEVENTS)); \ + ok(((status) & (expected))== (expected),"wrong queue status. expected %li, and got %li\n", (DWORD)(expected), status); \ + if(notexpected) \ + ok((status & (notexpected))!=(notexpected), "wrong queue status. got non expected %li\n", (DWORD)(notexpected)); \ + } + +MSG_ENTRY empty_chain[]= {{0,0}}; + +/* the mouse moves over hwnd2 */ +MSG_ENTRY mousemove2_chain[]={{2, WM_NCHITTEST}, + {2, WM_SETCURSOR}, + {1, WM_SETCURSOR}, + {2, WM_MOUSEMOVE}, + {0,0}}; + +/* the mouse hovers hwnd2 */ +MSG_ENTRY mousehover2_chain[]={{2, WM_NCHITTEST}, + {2, WM_SETCURSOR}, + {1, WM_SETCURSOR}, + {2, WM_MOUSEMOVE}, + {2, WM_MOUSEHOVER}, + {0,0}}; + +/* the mouse leaves hwnd2 and moves to hwnd1 */ +MSG_ENTRY mouseleave2to1_chain[]={{1, WM_NCHITTEST}, + {1, WM_SETCURSOR}, + {1, WM_MOUSEMOVE}, + {2, WM_MOUSELEAVE}, + {0,0}}; + +/* the mouse leaves hwnd2 and moves to hwnd3 */ +MSG_ENTRY mouseleave2to3_chain[]={{3, WM_NCHITTEST}, + {3, WM_SETCURSOR}, + {1, WM_SETCURSOR}, + {3, WM_MOUSEMOVE}, + {2, WM_MOUSELEAVE}, + {0,0}}; + +void Test_TrackMouseEvent() +{ + MSG msg; + + SetCursorPos(0,0); + create_test_windows(); + FLUSH_MESSAGES(msg); + empty_message_cache(); + + /* the mouse moves over hwnd2 */ + SetCursorPos(220,220); + FLUSH_MESSAGES(msg); + compare_cache("mousemove2", mousemove2_chain); + EXPECT_TME_FLAGS(hWnd2, 0); + TmeStartTracking(hWnd2, TME_HOVER|TME_LEAVE); + EXPECT_TME_FLAGS(hWnd2, TME_HOVER|TME_LEAVE); + FLUSH_MESSAGES(msg); + compare_cache("empty1", empty_chain); + + /* the mouse hovers hwnd2 */ + SetCursorPos(221,221); + Sleep(100); + EXPECT_QUEUE_STATUS(QS_TIMER|QS_MOUSEMOVE, QS_POSTMESSAGE); + EXPECT_TME_FLAGS(hWnd2, TME_HOVER|TME_LEAVE); + FLUSH_MESSAGES(msg); + EXPECT_TME_FLAGS(hWnd2, TME_LEAVE); + compare_cache("mousehover2", mousehover2_chain); + + /* the mouse leaves hwnd2 and moves to hwnd1 */ + SetCursorPos(150,150); + EXPECT_QUEUE_STATUS(QS_MOUSEMOVE,QS_TIMER|QS_POSTMESSAGE ); + EXPECT_TME_FLAGS(hWnd2, TME_LEAVE); + FLUSH_MESSAGES(msg); + EXPECT_TME_FLAGS(hWnd2, 0); + compare_cache("mouseleave2to1", mouseleave2to1_chain); + + FLUSH_MESSAGES(msg); + compare_cache("empty2", empty_chain); + + /* the mouse moves over hwnd2 */ + SetCursorPos(220,220); + EXPECT_QUEUE_STATUS(QS_MOUSEMOVE, QS_TIMER|QS_POSTMESSAGE); + FLUSH_MESSAGES(msg); + compare_cache("mousemove2", mousemove2_chain); + EXPECT_TME_FLAGS(hWnd2, 0); + compare_cache("empty3", empty_chain); + TmeStartTracking(hWnd2, TME_HOVER|TME_LEAVE); + TmeStartTracking(hWnd2, TME_HOVER|TME_LEAVE); + TmeStartTracking(hWnd2, TME_HOVER|TME_LEAVE); + TmeStartTracking(hWnd2, TME_HOVER|TME_LEAVE); + EXPECT_QUEUE_STATUS(0, QS_TIMER|QS_MOUSEMOVE|QS_POSTMESSAGE); + FLUSH_MESSAGES(msg); + compare_cache("empty4", empty_chain); + EXPECT_TME_FLAGS(hWnd2, TME_HOVER|TME_LEAVE); + + FLUSH_MESSAGES(msg); + compare_cache("empty5", empty_chain); + + /* the mouse moves from hwnd2 to the intersection of hwnd2 and hwnd3 */ + SetCursorPos(300,300); + EXPECT_QUEUE_STATUS(QS_MOUSEMOVE, QS_TIMER|QS_POSTMESSAGE); + FLUSH_MESSAGES(msg); + EXPECT_TME_FLAGS(hWnd2, TME_HOVER|TME_LEAVE); + compare_cache("mousemove2", mousemove2_chain); + + FLUSH_MESSAGES(msg); + compare_cache("empty6", empty_chain); + + /* the mouse moves from hwnd2 to hwnd3 */ + SetCursorPos(400,400); + EXPECT_QUEUE_STATUS(QS_MOUSEMOVE, QS_TIMER|QS_POSTMESSAGE); + FLUSH_MESSAGES(msg); + EXPECT_TME_FLAGS(hWnd2, 0); + compare_cache("mousemove2to3", mouseleave2to3_chain); + + FLUSH_MESSAGES(msg); + compare_cache("empty7", empty_chain); + + //trace_cache(); + + //Sleep(2000); +} + +START_TEST(TrackMouseEvent) +{ + Test_TrackMouseEvent(); +} Propchange: trunk/rostests/apitests/user32/TrackMouseEvent.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/rostests/apitests/user32/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/testlist.…
============================================================================== --- trunk/rostests/apitests/user32/testlist.c [iso-8859-1] (original) +++ trunk/rostests/apitests/user32/testlist.c [iso-8859-1] Wed Sep 21 12:30:22 2011 @@ -16,6 +16,7 @@ extern void func_GetKeyState(void); extern void func_SetCursorPos(void); extern void func_SetActiveWindow(void); +extern void func_TrackMouseEvent(void); extern void func_WndProc(void); const struct test winetest_testlist[] = @@ -31,6 +32,7 @@ { "GetKeyState", func_GetKeyState }, { "SetCursorPos", func_SetCursorPos }, { "SetActiveWindow", func_SetActiveWindow }, + { "TrackMouseEvent", func_TrackMouseEvent }, { "WndProc", func_WndProc }, { 0, 0 } }; Modified: trunk/rostests/apitests/user32/user32_apitest.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/user32/user32_ap…
============================================================================== --- trunk/rostests/apitests/user32/user32_apitest.rbuild [iso-8859-1] (original) +++ trunk/rostests/apitests/user32/user32_apitest.rbuild [iso-8859-1] Wed Sep 21 12:30:22 2011 @@ -21,6 +21,7 @@ <file>DeferWindowPos.c</file> <file>SetActiveWindow.c</file> <file>SetCursorPos.c</file> + <file>TrackMouseEvent.c</file> <file>WndProc.c</file> </module>
13 years, 3 months
1
0
0
0
[pschweitzer] 53786: [DHCPCSVC] Fix passing a 860B struct by value
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Wed Sep 21 11:26:55 2011 New Revision: 53786 URL:
http://svn.reactos.org/svn/reactos?rev=53786&view=rev
Log: [DHCPCSVC] Fix passing a 860B struct by value Modified: trunk/reactos/dll/win32/dhcpcsvc/dhcp/adapter.c Modified: trunk/reactos/dll/win32/dhcpcsvc/dhcp/adapter.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/dhcpcsvc/dhcp/ad…
============================================================================== --- trunk/reactos/dll/win32/dhcpcsvc/dhcp/adapter.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/dhcpcsvc/dhcp/adapter.c [iso-8859-1] Wed Sep 21 11:26:55 2011 @@ -190,13 +190,13 @@ } int -InterfaceConnected(MIB_IFROW IfEntry) +InterfaceConnected(const PMIB_IFROW IfEntry) { - if (IfEntry.dwOperStatus == IF_OPER_STATUS_CONNECTED || - IfEntry.dwOperStatus == IF_OPER_STATUS_OPERATIONAL) + if (IfEntry->dwOperStatus == IF_OPER_STATUS_CONNECTED || + IfEntry->dwOperStatus == IF_OPER_STATUS_OPERATIONAL) return 1; - DH_DbgPrint(MID_TRACE,("Interface %d is down\n", IfEntry.dwIndex)); + DH_DbgPrint(MID_TRACE,("Interface %d is down\n", IfEntry->dwIndex)); return 0; } @@ -241,7 +241,7 @@ if ((Adapter = AdapterFindByHardwareAddress(Table->table[i].bPhysAddr, Table->table[i].dwPhysAddrLen))) { /* This is an existing adapter */ - if (InterfaceConnected(Table->table[i])) { + if (InterfaceConnected(&Table->table[i])) { /* We're still active so we stay in the list */ ifi = &Adapter->DhclientInfo; } else { @@ -259,7 +259,7 @@ Adapter = (DHCP_ADAPTER*) calloc( sizeof( DHCP_ADAPTER ) + Table->table[i].dwMtu, 1 ); - if( Adapter && Table->table[i].dwType == MIB_IF_TYPE_ETHERNET && InterfaceConnected(Table->table[i])) { + if( Adapter && Table->table[i].dwType == MIB_IF_TYPE_ETHERNET && InterfaceConnected(&Table->table[i])) { memcpy( &Adapter->IfMib, &Table->table[i], sizeof(Adapter->IfMib) ); Adapter->DhclientInfo.client = &Adapter->DhclientState;
13 years, 3 months
1
0
0
0
[tfaber] 53785: [KMTESTS/MM] - Add some tests for MmCreateSection involving file objects
by tfaber@svn.reactos.org
Author: tfaber Date: Wed Sep 21 10:35:33 2011 New Revision: 53785 URL:
http://svn.reactos.org/svn/reactos?rev=53785&view=rev
Log: [KMTESTS/MM] - Add some tests for MmCreateSection involving file objects Modified: trunk/rostests/kmtests/ntos_mm/MmSection.c Modified: trunk/rostests/kmtests/ntos_mm/MmSection.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_mm/MmSection…
============================================================================== --- trunk/rostests/kmtests/ntos_mm/MmSection.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/ntos_mm/MmSection.c [iso-8859-1] Wed Sep 21 10:35:33 2011 @@ -10,13 +10,30 @@ #define StartSeh() ExceptionStatus = STATUS_SUCCESS; _SEH2_TRY { #define EndSeh(ExpectedStatus) } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { ExceptionStatus = _SEH2_GetExceptionCode(); } _SEH2_END; ok_eq_hex(ExceptionStatus, ExpectedStatus) -START_TEST(MmSection) +#define CheckObject(Handle, Pointers, Handles) do \ +{ \ + PUBLIC_OBJECT_BASIC_INFORMATION ObjectInfo; \ + Status = ZwQueryObject(Handle, ObjectBasicInformation, \ + &ObjectInfo, sizeof ObjectInfo, NULL); \ + ok_eq_hex(Status, STATUS_SUCCESS); \ + ok_eq_ulong(ObjectInfo.PointerCount, Pointers); \ + ok_eq_ulong(ObjectInfo.HandleCount, Handles); \ +} while (0) + +static +VOID +TestCreateSection( + IN HANDLE FileHandle1, + IN PFILE_OBJECT FileObject1, + IN HANDLE FileHandle2, + IN PFILE_OBJECT FileObject2) { NTSTATUS Status = STATUS_SUCCESS; NTSTATUS ExceptionStatus; const PVOID InvalidPointer = (PVOID)0x5555555555555555ULL; PVOID SectionObject; LARGE_INTEGER MaximumSize; + ULONG PointerCount1, PointerCount2; StartSeh() Status = MmCreateSection(NULL, 0, NULL, NULL, 0, SEC_RESERVE, NULL, NULL); @@ -101,6 +118,7 @@ if (SectionObject && SectionObject != InvalidPointer) ObDereferenceObject(SectionObject); + /* page file section */ SectionObject = InvalidPointer; MaximumSize.QuadPart = 1; StartSeh() @@ -113,4 +131,224 @@ if (SectionObject && SectionObject != InvalidPointer) ObDereferenceObject(SectionObject); + + if (!skip(FileHandle1 != NULL && FileObject1 != NULL && + FileHandle2 != NULL && FileObject2 != NULL, "No file handle or object\n")) + { + PointerCount1 = 3; + PointerCount2 = 3; + /* image section */ + CheckObject(FileHandle2, PointerCount2, 1L); + SectionObject = InvalidPointer; + MaximumSize.QuadPart = 1; + StartSeh() + Status = MmCreateSection(&SectionObject, 0, NULL, &MaximumSize, PAGE_READONLY, SEC_IMAGE, FileHandle2, NULL); + EndSeh(STATUS_SUCCESS); + ok_eq_hex(Status, STATUS_SUCCESS); + ok_eq_longlong(MaximumSize.QuadPart, 1LL); + ok(SectionObject != InvalidPointer, "Section object pointer untouched\n"); + ok(SectionObject != NULL, "Section object pointer NULL\n"); + CheckObject(FileHandle2, PointerCount2, 1L); + + if (SectionObject && SectionObject != InvalidPointer) + ObDereferenceObject(SectionObject); + + CheckObject(FileHandle2, PointerCount2, 1L); + SectionObject = InvalidPointer; + MaximumSize.QuadPart = 1; + StartSeh() + Status = MmCreateSection(&SectionObject, 0, NULL, &MaximumSize, PAGE_READONLY, SEC_IMAGE, NULL, FileObject2); + EndSeh(STATUS_SUCCESS); + ok_eq_hex(Status, STATUS_SUCCESS); + ok_eq_longlong(MaximumSize.QuadPart, 1LL); + ok(SectionObject != InvalidPointer, "Section object pointer untouched\n"); + ok(SectionObject != NULL, "Section object pointer NULL\n"); + ++PointerCount2; + CheckObject(FileHandle2, PointerCount2, 1L); + + if (SectionObject && SectionObject != InvalidPointer) + ObDereferenceObject(SectionObject); + //--PointerCount2; // ???? + + CheckObject(FileHandle2, PointerCount2, 1L); + SectionObject = InvalidPointer; + MaximumSize.QuadPart = 1; + StartSeh() + Status = MmCreateSection(&SectionObject, 0, NULL, &MaximumSize, PAGE_READONLY, SEC_IMAGE, FileHandle2, FileObject2); + EndSeh(STATUS_SUCCESS); + ok_eq_hex(Status, STATUS_SUCCESS); + ok_eq_longlong(MaximumSize.QuadPart, 1LL); + ok(SectionObject != InvalidPointer, "Section object pointer untouched\n"); + ok(SectionObject != NULL, "Section object pointer NULL\n"); + CheckObject(FileHandle2, PointerCount2, 1L); + + if (SectionObject && SectionObject != InvalidPointer) + ObDereferenceObject(SectionObject); + + /* image section with inappropriate file */ + CheckObject(FileHandle1, PointerCount1, 1L); + SectionObject = InvalidPointer; + MaximumSize.QuadPart = 1; + StartSeh() + Status = MmCreateSection(&SectionObject, 0, NULL, &MaximumSize, PAGE_READONLY, SEC_IMAGE, FileHandle1, NULL); + EndSeh(STATUS_SUCCESS); + ok_eq_hex(Status, STATUS_INVALID_IMAGE_NOT_MZ); + ok_eq_longlong(MaximumSize.QuadPart, 1LL); + ok_eq_pointer(SectionObject, InvalidPointer); + CheckObject(FileHandle1, PointerCount1, 1L); + + if (SectionObject && SectionObject != InvalidPointer) + ObDereferenceObject(SectionObject); + + CheckObject(FileHandle1, PointerCount1, 1L); + SectionObject = InvalidPointer; + MaximumSize.QuadPart = 1; + StartSeh() + Status = MmCreateSection(&SectionObject, 0, NULL, &MaximumSize, PAGE_READONLY, SEC_IMAGE, NULL, FileObject1); + EndSeh(STATUS_SUCCESS); + ok_eq_hex(Status, STATUS_SUCCESS); + ok_eq_longlong(MaximumSize.QuadPart, 1LL); + ok(SectionObject != InvalidPointer, "Section object pointer untouched\n"); + ok(SectionObject != NULL, "Section object pointer NULL\n"); + ++PointerCount1; + CheckObject(FileHandle1, PointerCount1, 1L); + + if (SectionObject && SectionObject != InvalidPointer) + ObDereferenceObject(SectionObject); + //--PointerCount1; // ???? + + CheckObject(FileHandle1, PointerCount1, 1L); + SectionObject = InvalidPointer; + MaximumSize.QuadPart = 1; + StartSeh() + Status = MmCreateSection(&SectionObject, 0, NULL, &MaximumSize, PAGE_READONLY, SEC_IMAGE, FileHandle1, FileObject1); + EndSeh(STATUS_SUCCESS); + ok_eq_hex(Status, STATUS_SUCCESS); + ok_eq_longlong(MaximumSize.QuadPart, 1LL); + ok(SectionObject != InvalidPointer, "Section object pointer untouched\n"); + ok(SectionObject != NULL, "Section object pointer NULL\n"); + CheckObject(FileHandle1, PointerCount1, 1L); + + if (SectionObject && SectionObject != InvalidPointer) + ObDereferenceObject(SectionObject); + + /* data file section */ + CheckObject(FileHandle1, PointerCount1, 1L); + SectionObject = InvalidPointer; + MaximumSize.QuadPart = 1; + StartSeh() + Status = MmCreateSection(&SectionObject, 0, NULL, &MaximumSize, PAGE_READONLY, SEC_RESERVE, FileHandle1, NULL); + EndSeh(STATUS_SUCCESS); + ok_eq_hex(Status, STATUS_SUCCESS); + ok_eq_longlong(MaximumSize.QuadPart, 1LL); + ok(SectionObject != InvalidPointer, "Section object pointer untouched\n"); + ok(SectionObject != NULL, "Section object pointer NULL\n"); + CheckObject(FileHandle1, PointerCount1, 1L); + + if (SectionObject && SectionObject != InvalidPointer) + ObDereferenceObject(SectionObject); + + CheckObject(FileHandle1, PointerCount1, 1L); + SectionObject = InvalidPointer; + MaximumSize.QuadPart = 1; + StartSeh() + Status = MmCreateSection(&SectionObject, 0, NULL, &MaximumSize, PAGE_READONLY, SEC_RESERVE, NULL, FileObject1); + EndSeh(STATUS_SUCCESS); + ok_eq_hex(Status, STATUS_SUCCESS); + ok_eq_longlong(MaximumSize.QuadPart, 1LL); + ok(SectionObject != InvalidPointer, "Section object pointer untouched\n"); + ok(SectionObject != NULL, "Section object pointer NULL\n"); + CheckObject(FileHandle1, PointerCount1, 1L); + + if (SectionObject && SectionObject != InvalidPointer) + ObDereferenceObject(SectionObject); + + CheckObject(FileHandle1, PointerCount1, 1L); + SectionObject = InvalidPointer; + MaximumSize.QuadPart = 1; + StartSeh() + Status = MmCreateSection(&SectionObject, 0, NULL, &MaximumSize, PAGE_READONLY, SEC_RESERVE, FileHandle1, FileObject1); + EndSeh(STATUS_SUCCESS); + ok_eq_hex(Status, STATUS_SUCCESS); + ok_eq_longlong(MaximumSize.QuadPart, 1LL); + ok(SectionObject != InvalidPointer, "Section object pointer untouched\n"); + ok(SectionObject != NULL, "Section object pointer NULL\n"); + CheckObject(FileHandle1, PointerCount1, 1L); + + if (SectionObject && SectionObject != InvalidPointer) + ObDereferenceObject(SectionObject); + + CheckObject(FileHandle1, PointerCount1, 1L); + } } + +START_TEST(MmSection) +{ + NTSTATUS Status; + HANDLE FileHandle1 = NULL, FileHandle2 = NULL; + PFILE_OBJECT FileObject1 = NULL, FileObject2 = NULL; + OBJECT_ATTRIBUTES ObjectAttributes; + IO_STATUS_BLOCK IoStatusBlock; + UNICODE_STRING FileName1 = RTL_CONSTANT_STRING(L"\\SystemRoot\\kmtest-MmSection.txt"); + UNICODE_STRING FileName2 = RTL_CONSTANT_STRING(L"\\SystemRoot\\system32\\ntdll.dll"); + LARGE_INTEGER FileOffset; + UCHAR FileData = 0; + + /* create a one-byte file that we can use */ + InitializeObjectAttributes(&ObjectAttributes, &FileName1, OBJ_CASE_INSENSITIVE, NULL, NULL); + Status = ZwCreateFile(&FileHandle1, GENERIC_ALL, &ObjectAttributes, &IoStatusBlock, NULL, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ, FILE_SUPERSEDE, FILE_NON_DIRECTORY_FILE, NULL, 0); + ok_eq_hex(Status, STATUS_SUCCESS); + ok_eq_ulongptr(IoStatusBlock.Information, FILE_CREATED); + ok(FileHandle1 != NULL, "FileHandle1 is NULL\n"); + if (FileHandle1) + { + FileOffset.QuadPart = 0; + Status = ZwWriteFile(FileHandle1, NULL, NULL, NULL, &IoStatusBlock, &FileData, sizeof FileData, &FileOffset, NULL); + ok_eq_hex(Status, STATUS_SUCCESS); + ok_eq_ulongptr(IoStatusBlock.Information, 1); + Status = ZwClose(FileHandle1); + ok_eq_hex(Status, STATUS_SUCCESS); + FileHandle1 = NULL; + } + + InitializeObjectAttributes(&ObjectAttributes, &FileName1, OBJ_CASE_INSENSITIVE, NULL, NULL); + Status = ZwCreateFile(&FileHandle1, GENERIC_ALL, &ObjectAttributes, &IoStatusBlock, NULL, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ, FILE_OPEN, FILE_NON_DIRECTORY_FILE | FILE_DELETE_ON_CLOSE, NULL, 0); + ok_eq_hex(Status, STATUS_SUCCESS); + ok_eq_ulongptr(IoStatusBlock.Information, FILE_OPENED); + ok(FileHandle1 != NULL, "FileHandle1 is NULL\n"); + CheckObject(FileHandle1, 2L, 1L); + + InitializeObjectAttributes(&ObjectAttributes, &FileName2, OBJ_CASE_INSENSITIVE, NULL, NULL); + Status = ZwCreateFile(&FileHandle2, GENERIC_READ, &ObjectAttributes, &IoStatusBlock, NULL, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ, FILE_OPEN, FILE_NON_DIRECTORY_FILE, NULL, 0); + ok_eq_hex(Status, STATUS_SUCCESS); + ok_eq_ulongptr(IoStatusBlock.Information, FILE_OPENED); + ok(FileHandle2 != NULL, "FileHandle2 is NULL\n"); + + if (!skip(Status == STATUS_SUCCESS && FileHandle1 != NULL, "Failed to open file 1\n")) + { + Status = ObReferenceObjectByHandle(FileHandle1, FILE_READ_DATA | FILE_WRITE_DATA, IoFileObjectType, KernelMode, (PVOID *)&FileObject1, NULL); + ok_eq_hex(Status, STATUS_SUCCESS); + ok(FileObject1 != NULL, "FileObject1 is NULL\n"); + CheckObject(FileHandle1, 3L, 1L); + } + + if (!skip(Status == STATUS_SUCCESS && FileHandle2 != NULL, "Failed to open file 2\n")) + { + Status = ObReferenceObjectByHandle(FileHandle2, FILE_READ_DATA | FILE_WRITE_DATA, IoFileObjectType, KernelMode, (PVOID *)&FileObject2, NULL); + ok_eq_hex(Status, STATUS_SUCCESS); + ok(FileObject2 != NULL, "FileObject2 is NULL\n"); + } + + trace("FileHandle1=%p, FileObject1=%p\n", FileHandle1, FileObject1); + trace("FileHandle2=%p, FileObject2=%p\n", FileHandle2, FileObject2); + TestCreateSection(FileHandle1, FileObject1, FileHandle2, FileObject2); + + if (FileObject2) + ObDereferenceObject(FileObject2); + if (FileObject1) + ObDereferenceObject(FileObject1); + if (FileHandle2) + ZwClose(FileHandle2); + if (FileHandle1) + ZwClose(FileHandle1); +}
13 years, 3 months
1
0
0
0
[pschweitzer] 53784: [NTOSKRNL] Fix FstubFixupEfiPartition() Add helper macro SET_PARTITION_LENGTH()
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Wed Sep 21 09:11:42 2011 New Revision: 53784 URL:
http://svn.reactos.org/svn/reactos?rev=53784&view=rev
Log: [NTOSKRNL] Fix FstubFixupEfiPartition() Add helper macro SET_PARTITION_LENGTH() Modified: trunk/reactos/ntoskrnl/fstub/disksup.c trunk/reactos/ntoskrnl/include/internal/hal.h Modified: trunk/reactos/ntoskrnl/fstub/disksup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/fstub/disksup.c?r…
============================================================================== --- trunk/reactos/ntoskrnl/fstub/disksup.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/fstub/disksup.c [iso-8859-1] Wed Sep 21 09:11:42 2011 @@ -1365,18 +1365,17 @@ FstubFixupEfiPartition(IN PPARTITION_DESCRIPTOR PartitionDescriptor, IN ULONGLONG MaxOffset) { - ULONG PartitionLength; + ULONG PartitionMaxOffset, PartitionLength; PAGED_CODE(); /* Compute partition length (according to MBR entry) */ - PartitionLength = PartitionDescriptor->StartingSectorLsb0 + PartitionDescriptor->PartitionLengthLsb0; + PartitionMaxOffset = GET_STARTING_SECTOR(PartitionDescriptor) + GET_PARTITION_LENGTH(PartitionDescriptor); /* In case the partition length goes beyond disk size... */ - if (PartitionLength > MaxOffset) + if (PartitionMaxOffset > MaxOffset) { /* Resize partition to its maximum real length */ -#pragma message("--> FIXME: FstubFixupEfiPartition is most likeley broken!") - PartitionDescriptor->PartitionLengthLsb0 = - (UCHAR)(MaxOffset - PartitionDescriptor->StartingSectorLsb0); + PartitionLength = (ULONG)(PartitionMaxOffset - GET_STARTING_SECTOR(PartitionDescriptor)); + SET_PARTITION_LENGTH(PartitionDescriptor, PartitionLength); } } Modified: trunk/reactos/ntoskrnl/include/internal/hal.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/hal.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/hal.h [iso-8859-1] Wed Sep 21 09:11:42 2011 @@ -263,6 +263,12 @@ (ULONG)(p->PartitionLengthLsb1 << 8) + \ (ULONG)(p->PartitionLengthMsb0 << 16) + \ (ULONG)(p->PartitionLengthMsb1 << 24)) + +#define SET_PARTITION_LENGTH(p, l) \ + p->PartitionLengthLsb0 = l & 0xFF; \ + p->PartitionLengthLsb1 = (l >> 8) & 0xFF; \ + p->PartitionLengthMsb0 = (l >> 16) & 0xFF; \ + p->PartitionLengthMsb1 = (l >> 24) & 0xFF // // Structure describing a partition
13 years, 3 months
1
0
0
0
[ekohl] 53783: [LSA] - Implement the LSA object database. - Implement the information classes PolicyPrimaryDomainInformation and PolicyAccountDomainInformation of LsarSetInformationPolicy().
by ekohl@svn.reactos.org
Author: ekohl Date: Tue Sep 20 23:15:51 2011 New Revision: 53783 URL:
http://svn.reactos.org/svn/reactos?rev=53783&view=rev
Log: [LSA] - Implement the LSA object database. - Implement the information classes PolicyPrimaryDomainInformation and PolicyAccountDomainInformation of LsarSetInformationPolicy(). Added: trunk/reactos/dll/win32/lsasrv/database.c (with props) trunk/reactos/dll/win32/lsasrv/policy.c (with props) Modified: trunk/reactos/dll/win32/lsasrv/CMakeLists.txt trunk/reactos/dll/win32/lsasrv/lsarpc.c trunk/reactos/dll/win32/lsasrv/lsasrv.c trunk/reactos/dll/win32/lsasrv/lsasrv.h trunk/reactos/dll/win32/lsasrv/lsasrv.rbuild trunk/reactos/dll/win32/lsasrv/lsasrv.spec trunk/reactos/dll/win32/lsasrv/privileges.c Modified: trunk/reactos/dll/win32/lsasrv/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/CMakeList…
============================================================================== --- trunk/reactos/dll/win32/lsasrv/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/lsasrv/CMakeLists.txt [iso-8859-1] Tue Sep 20 23:15:51 2011 @@ -12,8 +12,10 @@ list(APPEND SOURCE authport.c + database.c lsarpc.c lsasrv.c + policy.c privileges.c sids.c lsasrv.rc Added: trunk/reactos/dll/win32/lsasrv/database.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/database.…
============================================================================== --- trunk/reactos/dll/win32/lsasrv/database.c (added) +++ trunk/reactos/dll/win32/lsasrv/database.c [iso-8859-1] Tue Sep 20 23:15:51 2011 @@ -1,0 +1,476 @@ +/* + * PROJECT: Local Security Authority Server DLL + * LICENSE: GPL - See COPYING in the top level directory + * FILE: dll/win32/lsasrv/database.c + * PURPOSE: LSA object database + * COPYRIGHT: Copyright 2011 Eric Kohl + */ + +/* INCLUDES ****************************************************************/ + +#include "lsasrv.h" + +WINE_DEFAULT_DEBUG_CHANNEL(lsasrv); + + +/* GLOBALS *****************************************************************/ + +static HANDLE SecurityKeyHandle = NULL; + + +/* FUNCTIONS ***************************************************************/ + +static NTSTATUS +LsapOpenServiceKey(VOID) +{ + OBJECT_ATTRIBUTES ObjectAttributes; + UNICODE_STRING KeyName; + NTSTATUS Status; + + RtlInitUnicodeString(&KeyName, + L"\\Registry\\Machine\\SECURITY"); + + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + Status = RtlpNtOpenKey(&SecurityKeyHandle, + KEY_READ | KEY_CREATE_SUB_KEY | KEY_ENUMERATE_SUB_KEYS, + &ObjectAttributes, + 0); + + return Status; +} + + +static BOOLEAN +LsapIsDatabaseInstalled(VOID) +{ + OBJECT_ATTRIBUTES ObjectAttributes; + UNICODE_STRING KeyName; + HANDLE KeyHandle; + NTSTATUS Status; + + RtlInitUnicodeString(&KeyName, + L"Policy"); + + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + SecurityKeyHandle, + NULL); + + Status = RtlpNtOpenKey(&KeyHandle, + KEY_READ, + &ObjectAttributes, + 0); + if (!NT_SUCCESS(Status)) + return FALSE; + + NtClose(KeyHandle); + + return TRUE; +} + + +static NTSTATUS +LsapInstallDatabase(VOID) +{ + OBJECT_ATTRIBUTES ObjectAttributes; + UNICODE_STRING KeyName; + HANDLE PolicyKeyHandle = NULL; + HANDLE AccountsKeyHandle = NULL; + HANDLE DomainsKeyHandle = NULL; + HANDLE SecretsKeyHandle = NULL; + NTSTATUS Status = STATUS_SUCCESS; + + TRACE("LsapInstallDatabase()\n"); + + /* Create the 'Policy' key */ + RtlInitUnicodeString(&KeyName, + L"Policy"); + + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + SecurityKeyHandle, + NULL); + + Status = NtCreateKey(&PolicyKeyHandle, + KEY_ALL_ACCESS, + &ObjectAttributes, + 0, + NULL, + 0, + NULL); + if (!NT_SUCCESS(Status)) + { + ERR("Failed to create the 'Policy' key (Status: 0x%08lx)\n", Status); + goto Done; + } + + /* Create the 'Accounts' key */ + RtlInitUnicodeString(&KeyName, + L"Accounts"); + + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + PolicyKeyHandle, + NULL); + + Status = NtCreateKey(&AccountsKeyHandle, + KEY_ALL_ACCESS, + &ObjectAttributes, + 0, + NULL, + 0, + NULL); + if (!NT_SUCCESS(Status)) + { + ERR("Failed to create the 'Accounts' key (Status: 0x%08lx)\n", Status); + goto Done; + } + + /* Create the 'Domains' key */ + RtlInitUnicodeString(&KeyName, + L"Domains"); + + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + PolicyKeyHandle, + NULL); + + Status = NtCreateKey(&DomainsKeyHandle, + KEY_ALL_ACCESS, + &ObjectAttributes, + 0, + NULL, + 0, + NULL); + if (!NT_SUCCESS(Status)) + { + ERR("Failed to create the 'Domains' key (Status: 0x%08lx)\n", Status); + goto Done; + } + + /* Create the 'Secrets' key */ + RtlInitUnicodeString(&KeyName, + L"Secrets"); + + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + PolicyKeyHandle, + NULL); + + Status = NtCreateKey(&SecretsKeyHandle, + KEY_ALL_ACCESS, + &ObjectAttributes, + 0, + NULL, + 0, + NULL); + if (!NT_SUCCESS(Status)) + { + ERR("Failed to create the 'Secrets' key (Status: 0x%08lx)\n", Status); + goto Done; + } + + +Done: + if (SecretsKeyHandle != NULL) + NtClose(SecretsKeyHandle); + + if (DomainsKeyHandle != NULL) + NtClose(DomainsKeyHandle); + + if (AccountsKeyHandle != NULL) + NtClose(AccountsKeyHandle); + + if (PolicyKeyHandle != NULL) + NtClose(PolicyKeyHandle); + + TRACE("LsapInstallDatabase() done (Status: 0x%08lx)\n", Status); + + return Status; +} + + +NTSTATUS +LsapInitDatabase(VOID) +{ + NTSTATUS Status; + + TRACE("LsapInitDatabase()\n"); + + Status = LsapOpenServiceKey(); + if (!NT_SUCCESS(Status)) + { + ERR("Failed to open the service key (Status: 0x%08lx)\n", Status); + return Status; + } + + if (!LsapIsDatabaseInstalled()) + { + Status = LsapInstallDatabase(); + if (!NT_SUCCESS(Status)) + { + ERR("Failed to install the LSA database (Status: 0x%08lx)\n", Status); + return Status; + } + } + + TRACE("LsapInitDatabase() done\n"); + + return STATUS_SUCCESS; +} + + +LSAPR_HANDLE +LsapCreateDbObject(LSAPR_HANDLE ParentHandle, + LPWSTR ObjectName, + BOOLEAN Open, + LSA_DB_OBJECT_TYPE ObjectType, + ACCESS_MASK DesiredAccess) +{ + PLSA_DB_OBJECT ParentObject = (PLSA_DB_OBJECT)ParentHandle; + PLSA_DB_OBJECT DbObject; + OBJECT_ATTRIBUTES ObjectAttributes; + UNICODE_STRING KeyName; + HANDLE ParentKeyHandle; + HANDLE ObjectKeyHandle; + NTSTATUS Status; + + if (ParentHandle != NULL) + ParentKeyHandle = ParentObject->KeyHandle; + else + ParentKeyHandle = SecurityKeyHandle; + + RtlInitUnicodeString(&KeyName, + ObjectName); + + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + ParentKeyHandle, + NULL); + + if (Open == TRUE) + { + Status = NtOpenKey(&ObjectKeyHandle, + KEY_ALL_ACCESS, + &ObjectAttributes); + } + else + { + Status = NtCreateKey(&ObjectKeyHandle, + KEY_ALL_ACCESS, + &ObjectAttributes, + 0, + NULL, + 0, + NULL); + } + + if (!NT_SUCCESS(Status)) + { + return NULL; + } + + DbObject = (PLSA_DB_OBJECT)RtlAllocateHeap(RtlGetProcessHeap(), + 0, + sizeof(LSA_DB_OBJECT)); + if (DbObject == NULL) + { + NtClose(ObjectKeyHandle); + return NULL; + } + + DbObject->Signature = LSAP_DB_SIGNATURE; + DbObject->RefCount = 0; + DbObject->ObjectType = ObjectType; + DbObject->Access = DesiredAccess; + DbObject->KeyHandle = ObjectKeyHandle; + DbObject->ParentObject = ParentObject; + + if (ParentObject != NULL) + ParentObject->RefCount++; + + return (LSAPR_HANDLE)DbObject; +} + + +NTSTATUS +LsapValidateDbObject(LSAPR_HANDLE Handle, + LSA_DB_OBJECT_TYPE ObjectType, + ACCESS_MASK GrantedAccess) +{ + PLSA_DB_OBJECT DbObject = (PLSA_DB_OBJECT)Handle; + BOOLEAN bValid = FALSE; + + _SEH2_TRY + { + if (DbObject->Signature == LSAP_DB_SIGNATURE) + { + if ((ObjectType == LsaDbIgnoreObject) || + (DbObject->ObjectType == ObjectType)) + bValid = TRUE; + } + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + bValid = FALSE; + } + _SEH2_END; + + if (bValid == FALSE) + return STATUS_INVALID_HANDLE; + + if (GrantedAccess != 0) + { + /* FIXME: Check for granted access rights */ + } + + return STATUS_SUCCESS; +} + + +NTSTATUS +LsapCloseDbObject(LSAPR_HANDLE Handle) +{ + PLSA_DB_OBJECT DbObject = (PLSA_DB_OBJECT)Handle; + + if (DbObject->RefCount != 0) + return STATUS_UNSUCCESSFUL; + + if (DbObject->ParentObject != NULL) + DbObject->ParentObject->RefCount--; + + if (DbObject->KeyHandle != NULL) + NtClose(DbObject->KeyHandle); + + RtlFreeHeap(RtlGetProcessHeap(), 0, DbObject); + + return STATUS_SUCCESS; +} + + +NTSTATUS +LsapSetObjectAttribute(PLSA_DB_OBJECT DbObject, + LPWSTR AttributeName, + LPVOID AttributeData, + ULONG AttributeSize) +{ + OBJECT_ATTRIBUTES ObjectAttributes; + UNICODE_STRING KeyName; + HANDLE AttributeKey; + NTSTATUS Status; + + RtlInitUnicodeString(&KeyName, + AttributeName); + + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + DbObject->KeyHandle, + NULL); + + Status = NtCreateKey(&AttributeKey, + KEY_SET_VALUE, + &ObjectAttributes, + 0, + NULL, + REG_OPTION_NON_VOLATILE, + NULL); + if (!NT_SUCCESS(Status)) + { + + return Status; + } + + Status = RtlpNtSetValueKey(AttributeKey, + REG_NONE, + AttributeData, + AttributeSize); + + NtClose(AttributeKey); + + return Status; +} + + +NTSTATUS +LsapGetObjectAttribute(PLSA_DB_OBJECT DbObject, + LPWSTR AttributeName, + LPVOID AttributeData, + PULONG AttributeSize) +{ + OBJECT_ATTRIBUTES ObjectAttributes; + UNICODE_STRING KeyName; + HANDLE AttributeKey; + ULONG ValueSize; + NTSTATUS Status; + + RtlInitUnicodeString(&KeyName, + AttributeName); + + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + DbObject->KeyHandle, + NULL); + + Status = NtOpenKey(&AttributeKey, + KEY_QUERY_VALUE, + &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + return Status; + } + + ValueSize = *AttributeSize; + Status = RtlpNtQueryValueKey(AttributeKey, + NULL, + NULL, + &ValueSize, + 0); + if (!NT_SUCCESS(Status) && Status != STATUS_BUFFER_OVERFLOW) + { + goto Done; + } + + if (AttributeData == NULL || *AttributeSize == 0) + { + *AttributeSize = ValueSize; + Status == STATUS_SUCCESS; + goto Done; + } + else if (*AttributeSize < ValueSize) + { + *AttributeSize = ValueSize; + Status == STATUS_BUFFER_OVERFLOW; + goto Done; + } + + Status = RtlpNtQueryValueKey(AttributeKey, + NULL, + AttributeData, + &ValueSize, + 0); + if (NT_SUCCESS(Status)) + { + *AttributeSize = ValueSize; + } + +Done: + NtClose(AttributeKey); + + return Status; +} + +/* EOF */ + Propchange: trunk/reactos/dll/win32/lsasrv/database.c ------------------------------------------------------------------------------ svn:eol-style = native Propchange: trunk/reactos/dll/win32/lsasrv/database.c ------------------------------------------------------------------------------ svn:keywords = author date id revision Modified: trunk/reactos/dll/win32/lsasrv/lsarpc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsarpc.c?…
============================================================================== --- trunk/reactos/dll/win32/lsasrv/lsarpc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/lsasrv/lsarpc.c [iso-8859-1] Tue Sep 20 23:15:51 2011 @@ -11,22 +11,6 @@ #include "lsasrv.h" -typedef enum _LSA_DB_HANDLE_TYPE -{ - LsaDbIgnoreHandle, - LsaDbPolicyHandle, - LsaDbAccountHandle -} LSA_DB_HANDLE_TYPE, *PLSA_DB_HANDLE_TYPE; - -typedef struct _LSA_DB_HANDLE -{ - ULONG Signature; - LSA_DB_HANDLE_TYPE HandleType; - LONG RefCount; - ACCESS_MASK Access; -} LSA_DB_HANDLE, *PLSA_DB_HANDLE; - -#define LSAP_DB_SIGNATURE 0x12345678 static RTL_CRITICAL_SECTION PolicyHandleTableLock; @@ -34,68 +18,6 @@ /* FUNCTIONS ***************************************************************/ - -static LSAPR_HANDLE -LsapCreateDbHandle(LSA_DB_HANDLE_TYPE HandleType, - ACCESS_MASK DesiredAccess) -{ - PLSA_DB_HANDLE DbHandle; - -// RtlEnterCriticalSection(&PolicyHandleTableLock); - - DbHandle = (PLSA_DB_HANDLE)RtlAllocateHeap(RtlGetProcessHeap(), - 0, - sizeof(LSA_DB_HANDLE)); - if (DbHandle != NULL) - { - DbHandle->Signature = LSAP_DB_SIGNATURE; - DbHandle->RefCount = 1; - DbHandle->HandleType = HandleType; - DbHandle->Access = DesiredAccess; - } - -// RtlLeaveCriticalSection(&PolicyHandleTableLock); - - return (LSAPR_HANDLE)DbHandle; -} - - -static NTSTATUS -LsapValidateDbHandle(LSAPR_HANDLE Handle, - LSA_DB_HANDLE_TYPE HandleType, - ACCESS_MASK GrantedAccess) -{ - PLSA_DB_HANDLE DbHandle = (PLSA_DB_HANDLE)Handle; - BOOL bValid = FALSE; - - _SEH2_TRY - { - if (DbHandle->Signature == LSAP_DB_SIGNATURE) - { - if (HandleType == LsaDbIgnoreHandle) - bValid = TRUE; - else if (DbHandle->HandleType == HandleType) - bValid = TRUE; - } - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - bValid = FALSE; - } - _SEH2_END; - - if (bValid == FALSE) - return STATUS_INVALID_HANDLE; - - if (GrantedAccess != 0) - { - /* FIXME: Check for granted access rights */ - } - - return STATUS_SUCCESS; -} - - VOID @@ -153,13 +75,12 @@ // RtlEnterCriticalSection(&PolicyHandleTableLock); - Status = LsapValidateDbHandle(*ObjectHandle, - LsaDbIgnoreHandle, + Status = LsapValidateDbObject(*ObjectHandle, + LsaDbIgnoreObject, 0); - if (Status == STATUS_SUCCESS) { - RtlFreeHeap(RtlGetProcessHeap(), 0, *ObjectHandle); + Status = LsapCloseDbObject(*ObjectHandle); *ObjectHandle = NULL; } @@ -239,7 +160,10 @@ RtlEnterCriticalSection(&PolicyHandleTableLock); - *PolicyHandle = LsapCreateDbHandle(LsaDbPolicyHandle, + *PolicyHandle = LsapCreateDbObject(NULL, + L"Policy", + TRUE, + LsaDbPolicyObject, DesiredAccess); if (*PolicyHandle == NULL) Status = STATUS_INSUFFICIENT_RESOURCES; @@ -268,8 +192,8 @@ TRACE("*PolicyInformation %p\n", *PolicyInformation); } - Status = LsapValidateDbHandle(PolicyHandle, - LsaDbPolicyHandle, + Status = LsapValidateDbObject(PolicyHandle, + LsaDbPolicyObject, 0); /* FIXME */ if (!NT_SUCCESS(Status)) return Status; @@ -409,8 +333,53 @@ POLICY_INFORMATION_CLASS InformationClass, PLSAPR_POLICY_INFORMATION PolicyInformation) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + NTSTATUS Status; + + TRACE("LsarSetInformationPolicy(%p,0x%08x,%p)\n", + PolicyHandle, InformationClass, PolicyInformation); + + if (PolicyInformation) + { + TRACE("*PolicyInformation %p\n", *PolicyInformation); + } + + Status = LsapValidateDbObject(PolicyHandle, + LsaDbPolicyObject, + 0); /* FIXME */ + if (!NT_SUCCESS(Status)) + return Status; + + switch (InformationClass) + { + case PolicyAuditEventsInformation: + Status = STATUS_NOT_IMPLEMENTED; + break; + + case PolicyPrimaryDomainInformation: + Status = LsarSetPrimaryDomain(PolicyHandle, + (PLSAPR_POLICY_PRIMARY_DOM_INFO)PolicyInformation); + break; + + case PolicyAccountDomainInformation: + Status = LsarSetAccountDomain(PolicyHandle, + (PLSAPR_POLICY_ACCOUNT_DOM_INFO)PolicyInformation); + break; + + case PolicyDnsDomainInformation: + Status = LsarSetDnsDomain(PolicyHandle, + (PLSAPR_POLICY_DNS_DOMAIN_INFO)PolicyInformation); + break; + + case PolicyLsaServerRoleInformation: + Status = STATUS_NOT_IMPLEMENTED; + break; + + default: + Status = STATUS_INVALID_PARAMETER; + break; + } + + return Status; } @@ -838,8 +807,8 @@ TRACE("LsarLookupPrivilegeValue(%p, %wZ, %p)\n", PolicyHandle, Name, Value); - Status = LsapValidateDbHandle(PolicyHandle, - LsaDbPolicyHandle, + Status = LsapValidateDbObject(PolicyHandle, + LsaDbPolicyObject, 0); /* FIXME */ if (!NT_SUCCESS(Status)) { @@ -867,8 +836,8 @@ TRACE("LsarLookupPrivilegeName(%p, %p, %p)\n", PolicyHandle, Value, Name); - Status = LsapValidateDbHandle(PolicyHandle, - LsaDbPolicyHandle, + Status = LsapValidateDbObject(PolicyHandle, + LsaDbPolicyObject, 0); /* FIXME */ if (!NT_SUCCESS(Status)) { @@ -926,8 +895,8 @@ FIXME("(%p,%p,%p) stub\n", PolicyHandle, AccountSid, UserRights); - Status = LsapValidateDbHandle(PolicyHandle, - LsaDbPolicyHandle, + Status = LsapValidateDbObject(PolicyHandle, + LsaDbPolicyObject, 0); /* FIXME */ if (!NT_SUCCESS(Status)) return Status; Modified: trunk/reactos/dll/win32/lsasrv/lsasrv.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsasrv.c?…
============================================================================== --- trunk/reactos/dll/win32/lsasrv/lsasrv.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/lsasrv/lsasrv.c [iso-8859-1] Tue Sep 20 23:15:51 2011 @@ -25,6 +25,9 @@ /* Initialize the well known SIDs */ LsapInitSids(); + + /* Initialize the LSA database */ + LsapInitDatabase(); /* Start the RPC server */ LsarStartRpcServer(); Modified: trunk/reactos/dll/win32/lsasrv/lsasrv.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsasrv.h?…
============================================================================== --- trunk/reactos/dll/win32/lsasrv/lsasrv.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/lsasrv/lsasrv.h [iso-8859-1] Tue Sep 20 23:15:51 2011 @@ -9,12 +9,16 @@ #define WIN32_NO_STATUS #include <windows.h> -#include <ntsecapi.h> #define NTOS_MODE_USER +#include <ndk/cmfuncs.h> #include <ndk/lpctypes.h> #include <ndk/lpcfuncs.h> +#include <ndk/obfuncs.h> #include <ndk/rtlfuncs.h> #include <ndk/setypes.h> + + +#include <ntsecapi.h> #include <string.h> @@ -24,11 +28,80 @@ #include <wine/debug.h> +typedef enum _LSA_DB_OBJECT_TYPE +{ + LsaDbIgnoreObject, + LsaDbContainerObject, + LsaDbPolicyObject, + LsaDbAccountObject, + LsaDbDomainObject, + LsaDbSecretObject +} LSA_DB_OBJECT_TYPE, *PLSA_DB_OBJECT_TYPE; + +typedef struct _LSA_DB_OBJECT +{ + ULONG Signature; + LSA_DB_OBJECT_TYPE ObjectType; + ULONG RefCount; + ACCESS_MASK Access; + HANDLE KeyHandle; + struct _LSA_DB_OBJECT *ParentObject; +} LSA_DB_OBJECT, *PLSA_DB_OBJECT; + +#define LSAP_DB_SIGNATURE 0x12345678 + + /* authport.c */ -NTSTATUS StartAuthenticationPort(VOID); +NTSTATUS +StartAuthenticationPort(VOID); + +/* database.c */ +NTSTATUS +LsapInitDatabase(VOID); + +LSAPR_HANDLE +LsapCreateDbObject(LSAPR_HANDLE ParentHandle, + LPWSTR ObjectName, + BOOLEAN Open, + LSA_DB_OBJECT_TYPE HandleType, + ACCESS_MASK DesiredAccess); + +NTSTATUS +LsapValidateDbObject(LSAPR_HANDLE Handle, + LSA_DB_OBJECT_TYPE HandleType, + ACCESS_MASK GrantedAccess); + +NTSTATUS +LsapCloseDbObject(LSAPR_HANDLE Handle); + +NTSTATUS +LsapGetObjectAttribute(PLSA_DB_OBJECT DbObject, + LPWSTR AttributeName, + LPVOID AttributeData, + PULONG AttributeSize); + +NTSTATUS +LsapSetObjectAttribute(PLSA_DB_OBJECT DbObject, + LPWSTR AttributeName, + LPVOID AttributeData, + ULONG AttributeSize); /* lsarpc.c */ -VOID LsarStartRpcServer(VOID); +VOID +LsarStartRpcServer(VOID); + +/* policy.c */ +NTSTATUS +LsarSetPrimaryDomain(LSAPR_HANDLE PolicyObject, + PLSAPR_POLICY_PRIMARY_DOM_INFO Info); + +NTSTATUS +LsarSetAccountDomain(LSAPR_HANDLE PolicyObject, + PLSAPR_POLICY_ACCOUNT_DOM_INFO Info); + +NTSTATUS +LsarSetDnsDomain(LSAPR_HANDLE PolicyObject, + PLSAPR_POLICY_DNS_DOMAIN_INFO Info); /* privileges.c */ NTSTATUS Modified: trunk/reactos/dll/win32/lsasrv/lsasrv.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsasrv.rb…
============================================================================== --- trunk/reactos/dll/win32/lsasrv/lsasrv.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/win32/lsasrv/lsasrv.rbuild [iso-8859-1] Tue Sep 20 23:15:51 2011 @@ -9,8 +9,10 @@ <library>ntdll</library> <library>pseh</library> <file>authport.c</file> + <file>database.c</file> <file>lsarpc.c</file> <file>lsasrv.c</file> + <file>policy.c</file> <file>privileges.c</file> <file>sids.c</file> <file>lsasrv.rc</file> Modified: trunk/reactos/dll/win32/lsasrv/lsasrv.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsasrv.sp…
============================================================================== --- trunk/reactos/dll/win32/lsasrv/lsasrv.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/lsasrv/lsasrv.spec [iso-8859-1] Tue Sep 20 23:15:51 2011 @@ -35,11 +35,13 @@ @ stdcall LsarCreateAccount(ptr ptr long ptr) @ stdcall LsarCreateSecret(ptr ptr long ptr) @ stdcall LsarCreateTrustedDomain(ptr ptr long ptr) + @ stub LsarCreateTrustedDomainEx @ stdcall LsarDelete(ptr) @ stdcall LsarEnumerateAccounts(ptr ptr ptr long) @ stdcall LsarEnumeratePrivileges(ptr ptr ptr long) @ stdcall LsarEnumeratePrivilegesAccount(ptr ptr) @ stdcall LsarEnumerateTrustedDomains(ptr ptr ptr long) + @ stub LsarEnumerateTrustedDomainsEx @ stdcall LsarGetQuotasForAccount(ptr ptr) @ stdcall LsarGetSystemAccessAccount(ptr ptr) @ stdcall LsarLookupNames(ptr long ptr ptr ptr long ptr) @@ -47,19 +49,29 @@ @ stdcall LsarLookupPrivilegeName(ptr ptr ptr) @ stdcall LsarLookupPrivilegeValue(ptr ptr ptr) @ stdcall LsarLookupSids(ptr ptr ptr ptr long ptr) + @ stub LsarLookupSids2 @ stdcall LsarOpenAccount(ptr ptr long ptr) @ stdcall LsarOpenPolicy(ptr ptr long ptr) + @ stub LsarOpenPolicySce @ stdcall LsarOpenSecret(ptr ptr long ptr) @ stdcall LsarOpenTrustedDomain(ptr ptr long ptr) + @ stub LsarOpenTrustedDomainByName + @ stub LsarQueryDomainInformationPolicy + @ stub LsarQueryForestTrustInformation @ stdcall LsarQueryInfoTrustedDomain(ptr long ptr) @ stdcall LsarQueryInformationPolicy(ptr long ptr) @ stdcall LsarQuerySecret(ptr ptr ptr ptr ptr) @ stdcall LsarQuerySecurityObject(ptr long ptr) + @ stub LsarQueryTrustedDomainInfo + @ stub LsarQueryTrustedDomainInfoByName @ stdcall LsarRemovePrivilegesFromAccount(ptr long ptr) + @ stub LsarSetDomainInformationPolicy + @ stub LsarSetForestTrustInformation @ stdcall LsarSetInformationPolicy(ptr long ptr) @ stdcall LsarSetInformationTrustedDomain(ptr long ptr) @ stdcall LsarSetQuotasForAccount(ptr ptr) @ stdcall LsarSetSecret(ptr ptr ptr) @ stdcall LsarSetSecurityObject(ptr long ptr) @ stdcall LsarSetSystemAccessAccount(ptr long) + @ stub LsarSetTrustedDomainInfoByName @ stdcall ServiceInit() Added: trunk/reactos/dll/win32/lsasrv/policy.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/policy.c?…
============================================================================== --- trunk/reactos/dll/win32/lsasrv/policy.c (added) +++ trunk/reactos/dll/win32/lsasrv/policy.c [iso-8859-1] Tue Sep 20 23:15:51 2011 @@ -1,0 +1,118 @@ +/* + * PROJECT: Local Security Authority Server DLL + * LICENSE: GPL - See COPYING in the top level directory + * FILE: dll/win32/lsasrv/policy.c + * PURPOSE: Policy object routines + * COPYRIGHT: Copyright 2011 Eric Kohl + */ + +/* INCLUDES ****************************************************************/ + +#include "lsasrv.h" + +WINE_DEFAULT_DEBUG_CHANNEL(lsasrv); + + +/* FUNCTIONS ***************************************************************/ + +NTSTATUS +LsarSetPrimaryDomain(LSAPR_HANDLE PolicyHandle, + PLSAPR_POLICY_PRIMARY_DOM_INFO Info) +{ + PUNICODE_STRING Buffer; + ULONG Length = 0; + NTSTATUS Status; + LPWSTR Ptr; + + TRACE("LsarSetPrimaryDomain(%p, %p)\n", PolicyHandle, Info); + + Length = sizeof(UNICODE_STRING) + Info->Name.MaximumLength; + Buffer = RtlAllocateHeap(RtlGetProcessHeap(), + 0, + Length); + if (Buffer == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + Buffer->Length = Info->Name.Length; + Buffer->MaximumLength = Info->Name.MaximumLength; + Buffer->Buffer = (LPWSTR)sizeof(UNICODE_STRING); + Ptr = (LPWSTR)((ULONG_PTR)Buffer + sizeof(UNICODE_STRING)); + memcpy(Ptr, Info->Name.Buffer, Info->Name.MaximumLength); + + Status = LsapSetObjectAttribute((PLSA_DB_OBJECT)PolicyHandle, + L"PolPrDmN", + Buffer, Length); + + RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer); + + if (!NT_SUCCESS(Status)) + return Status; + + Length = 0; + if (Info->Sid != NULL) + Length = RtlLengthSid(Info->Sid); + + Status = LsapSetObjectAttribute((PLSA_DB_OBJECT)PolicyHandle, + L"PolPrDmS", + (LPBYTE)Info->Sid, + Length); + + return Status; +} + + +NTSTATUS +LsarSetAccountDomain(LSAPR_HANDLE PolicyHandle, + PLSAPR_POLICY_ACCOUNT_DOM_INFO Info) +{ + PUNICODE_STRING Buffer; + ULONG Length = 0; + NTSTATUS Status; + LPWSTR Ptr; + + TRACE("LsarSetAccountDomain(%p, %p)\n", PolicyHandle, Info); + + Length = sizeof(UNICODE_STRING) + Info->DomainName.MaximumLength; + Buffer = RtlAllocateHeap(RtlGetProcessHeap(), + 0, + Length); + if (Buffer == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + Buffer->Length = Info->DomainName.Length; + Buffer->MaximumLength = Info->DomainName.MaximumLength; + Buffer->Buffer = (LPWSTR)sizeof(UNICODE_STRING); + Ptr = (LPWSTR)((ULONG_PTR)Buffer + sizeof(UNICODE_STRING)); + memcpy(Ptr, Info->DomainName.Buffer, Info->DomainName.MaximumLength); + + Status = LsapSetObjectAttribute((PLSA_DB_OBJECT)PolicyHandle, + L"PolAcDmN", + Buffer, Length); + + RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer); + + if (!NT_SUCCESS(Status)) + return Status; + + Length = 0; + if (Info->Sid != NULL) + Length = RtlLengthSid(Info->Sid); + + Status = LsapSetObjectAttribute((PLSA_DB_OBJECT)PolicyHandle, + L"PolAcDmS", + (LPBYTE)Info->Sid, + Length); + + return Status; +} + + +NTSTATUS +LsarSetDnsDomain(LSAPR_HANDLE PolicyHandle, + PLSAPR_POLICY_DNS_DOMAIN_INFO Info) +{ + + return STATUS_NOT_IMPLEMENTED; +} + +/* EOF */ Propchange: trunk/reactos/dll/win32/lsasrv/policy.c ------------------------------------------------------------------------------ svn:eol-style = native Propchange: trunk/reactos/dll/win32/lsasrv/policy.c ------------------------------------------------------------------------------ svn:keywords = author date id revision Modified: trunk/reactos/dll/win32/lsasrv/privileges.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/privilege…
============================================================================== --- trunk/reactos/dll/win32/lsasrv/privileges.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/lsasrv/privileges.c [iso-8859-1] Tue Sep 20 23:15:51 2011 @@ -111,8 +111,9 @@ { if (_wcsicmp(Name->Buffer, WellKnownPrivileges[Priv].Name) == 0) { - Value->LowPart = WellKnownPrivileges[Priv].Luid.LowPart; - Value->HighPart = WellKnownPrivileges[Priv].Luid.HighPart; +// Value->LowPart = WellKnownPrivileges[Priv].Luid.LowPart; +// Value->HighPart = WellKnownPrivileges[Priv].Luid.HighPart; + *Value = WellKnownPrivileges[Priv].Luid; return STATUS_SUCCESS; } }
13 years, 3 months
1
0
0
0
[pschweitzer] 53782: [CRT] Rewritten _tfullpath(). This: - Fixes memory leak - Fixes null pointer use - Adds missing features - Sets errno
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Tue Sep 20 21:44:22 2011 New Revision: 53782 URL:
http://svn.reactos.org/svn/reactos?rev=53782&view=rev
Log: [CRT] Rewritten _tfullpath(). This: - Fixes memory leak - Fixes null pointer use - Adds missing features - Sets errno Modified: trunk/reactos/lib/sdk/crt/stdlib/fullpath.c Modified: trunk/reactos/lib/sdk/crt/stdlib/fullpath.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/stdlib/fullpat…
============================================================================== --- trunk/reactos/lib/sdk/crt/stdlib/fullpath.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/stdlib/fullpath.c [iso-8859-1] Tue Sep 20 21:44:22 2011 @@ -1,11 +1,9 @@ /* * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib/msvcrt/stdlib/fullpath.c + * PROJECT: ReactOS CRT library + * FILE: lib/sdk/crt/stdlib/fullpath.c * PURPOSE: Gets the fullpathname - * PROGRAMER: Ariadne - * UPDATE HISTORY: - * 28/12/98: Created + * PROGRAMER: Pierre Schweitzer (pierre.schweitzer(a)reactos.org) */ #include <precomp.h> @@ -16,18 +14,60 @@ */ _TCHAR* _tfullpath(_TCHAR* absPath, const _TCHAR* relPath, size_t maxLength) { + _TCHAR* lpBuffer; _TCHAR* lpFilePart; - DWORD copied; + DWORD retval; + /* First check if entry relative path was given */ + if (!relPath || relPath[0] == 0) + { + /* If not, just try to return current dir */ + return _tgetcwd(absPath, maxLength); + } + + /* If no output buffer was given */ if (!absPath) { + /* Allocate one with fixed length */ maxLength = MAX_PATH; - absPath = malloc(maxLength); + lpBuffer = malloc(maxLength); + if (!lpBuffer) + { + errno = ENOMEM; + return NULL; + } + } + else + { + lpBuffer = absPath; } - copied = GetFullPathName(relPath,(DWORD)maxLength,absPath,&lpFilePart); - if (copied == 0 || copied > maxLength) + /* Really get full path */ + retval = GetFullPathName(relPath, (DWORD)maxLength, lpBuffer, &lpFilePart); + /* Check for failures */ + if (retval > maxLength) + { + /* Path too long, free (if needed) and return */ + if (!absPath) + { + free(lpBuffer); + } + + errno = ERANGE; return NULL; + } + else if (!retval) + { + /* Other error, free (if needed), translate error, and return */ + if (!absPath) + { + free(lpBuffer); + } - return absPath; + _dosmaperr(GetLastError()); + return NULL; + } + + /* Return buffer. Up to the caller to free if needed */ + return lpBuffer; }
13 years, 3 months
1
0
0
0
[fireball] 53781: [NTDLL/LDR] - Properly wrap potentially unsafe buffer usage into SEH. Spotted by Pierre.
by fireball@svn.reactos.org
Author: fireball Date: Tue Sep 20 21:04:33 2011 New Revision: 53781 URL:
http://svn.reactos.org/svn/reactos?rev=53781&view=rev
Log: [NTDLL/LDR] - Properly wrap potentially unsafe buffer usage into SEH. Spotted by Pierre. Modified: trunk/reactos/dll/ntdll/ldr/ldrapi.c Modified: trunk/reactos/dll/ntdll/ldr/ldrapi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/ldr/ldrapi.c?rev…
============================================================================== --- trunk/reactos/dll/ntdll/ldr/ldrapi.c [iso-8859-1] (original) +++ trunk/reactos/dll/ntdll/ldr/ldrapi.c [iso-8859-1] Tue Sep 20 21:04:33 2011 @@ -911,7 +911,7 @@ NTAPI LdrQueryProcessModuleInformationEx(IN ULONG ProcessId, IN ULONG Reserved, - IN PRTL_PROCESS_MODULES ModuleInformation, + OUT PRTL_PROCESS_MODULES ModuleInformation, IN ULONG Size, OUT PULONG ReturnedSize OPTIONAL) { @@ -929,21 +929,21 @@ /* Acquire loader lock */ RtlEnterCriticalSection(NtCurrentPeb()->LoaderLock); - /* Check if we were given enough space */ - if (Size < UsedSize) - { - Status = STATUS_INFO_LENGTH_MISMATCH; - } - else - { - ModuleInformation->NumberOfModules = 0; - ModulePtr = &ModuleInformation->Modules[0]; - Status = STATUS_SUCCESS; - } - - /* Traverse the list of modules */ _SEH2_TRY { + /* Check if we were given enough space */ + if (Size < UsedSize) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + } + else + { + ModuleInformation->NumberOfModules = 0; + ModulePtr = &ModuleInformation->Modules[0]; + Status = STATUS_SUCCESS; + } + + /* Traverse the list of modules */ ModuleListHead = &NtCurrentPeb()->Ldr->InLoadOrderModuleList; Entry = ModuleListHead->Flink;
13 years, 3 months
1
0
0
0
← Newer
1
...
10
11
12
13
14
15
16
...
40
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
Results per page:
10
25
50
100
200