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
August 2012
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
14 participants
198 discussions
Start a n
N
ew thread
[ekohl] 57098: [WIDL] Sync WIDL to Wine 1.5.11. Part 2 of 2.
by ekohl@svn.reactos.org
Author: ekohl Date: Sat Aug 18 18:37:39 2012 New Revision: 57098 URL:
http://svn.reactos.org/svn/reactos?rev=57098&view=rev
Log: [WIDL] Sync WIDL to Wine 1.5.11. Part 2 of 2. Modified: trunk/reactos/media/doc/README.WINE trunk/reactos/tools/widl/header.c trunk/reactos/tools/widl/server.c trunk/reactos/tools/widl/typegen.c Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sat Aug 18 18:37:39 2012 @@ -22,7 +22,7 @@ The following build tools are shared with Wine. reactos/tools/unicode # Synced to Wine-1.5.4 -reactos/tools/widl # Synced to Wine-1.3.26 +reactos/tools/widl # Synced to Wine-1.5.11 reactos/tools/wpp # Synced to Wine-1.3.26 The following libraries are shared with Wine. Modified: trunk/reactos/tools/widl/header.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/header.c?rev=57…
============================================================================== --- trunk/reactos/tools/widl/header.c [iso-8859-1] (original) +++ trunk/reactos/tools/widl/header.c [iso-8859-1] Sat Aug 18 18:37:39 2012 @@ -816,6 +816,28 @@ return get_attrp(a, ATTR_CALLAS); } +static int is_inherited_method(const type_t *iface, const var_t *func) +{ + while ((iface = type_iface_get_inherit(iface))) + { + const statement_t *stmt; + STATEMENTS_FOR_EACH_FUNC(stmt, type_iface_get_stmts(iface)) + { + const var_t *funccmp = stmt->u.var; + + if (!is_callas(func->attrs)) + { + char inherit_name[256]; + /* compare full name including property prefix */ + strcpy(inherit_name, get_name(funccmp)); + if (!strcmp(inherit_name, get_name(func))) return 1; + } + } + } + + return 0; +} + static void write_method_macro(FILE *header, const type_t *iface, const char *name) { const statement_t *stmt; @@ -834,7 +856,7 @@ first_iface = 0; } - if (!is_callas(func->attrs)) { + if (!is_callas(func->attrs) && !is_inherited_method(iface, func)) { const var_t *arg; fprintf(header, "#define %s_%s(This", name, get_name(func)); @@ -876,6 +898,13 @@ else fprintf(h, ","); } write_type_decl(h, arg->type, arg->name); + if (method == 2) { + const expr_t *expr = get_attrp(arg->attrs, ATTR_DEFAULTVALUE); + if (expr) { + fprintf(h, " = "); + write_expr( h, expr, 0, 1, NULL, NULL, "" ); + } + } count++; } if (do_indent) indentation--; @@ -902,6 +931,43 @@ } } +static void write_inline_wrappers(FILE *header, const type_t *iface, const char *name) +{ + const statement_t *stmt; + int first_iface = 1; + + if (type_iface_get_inherit(iface)) + write_inline_wrappers(header, type_iface_get_inherit(iface), name); + + STATEMENTS_FOR_EACH_FUNC(stmt, type_iface_get_stmts(iface)) + { + const var_t *func = stmt->u.var; + + if (first_iface) + { + fprintf(header, "/*** %s methods ***/\n", iface->name); + first_iface = 0; + } + + if (!is_callas(func->attrs) && !is_inherited_method(iface, func)) { + const var_t *arg; + + fprintf(header, "static FORCEINLINE "); + write_type_decl_left(header, type_function_get_rettype(func->type)); + fprintf(header, " %s_%s(", name, get_name(func)); + write_args(header, type_get_function_args(func->type), name, 1, FALSE); + fprintf(header, ") {\n"); + fprintf(header, " %s", is_void(type_function_get_rettype(func->type)) ? "" : "return "); + fprintf(header, "This->lpVtbl->%s(This", get_name(func)); + if (type_get_function_args(func->type)) + LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->type), const var_t, entry ) + fprintf(header, ",%s", arg->name); + fprintf(header, ");\n"); + fprintf(header, "}\n"); + } + } +} + static void do_write_c_method_def(FILE *header, const type_t *iface, const char *name) { const statement_t *stmt; @@ -923,7 +989,10 @@ if (!callconv) callconv = "STDMETHODCALLTYPE"; indent(header, 0); write_type_decl_left(header, type_function_get_rettype(func->type)); - fprintf(header, " (%s *%s)(\n", callconv, get_name(func)); + if (is_inherited_method(iface, func)) + fprintf(header, " (%s *%s_%s)(\n", callconv, iface->name, func->name); + else + fprintf(header, " (%s *%s)(\n", callconv, get_name(func)); write_args(header, type_get_function_args(func->type), name, 1, TRUE); fprintf(header, ");\n"); fprintf(header, "\n"); @@ -1150,8 +1219,11 @@ fprintf(header, "#ifdef COBJMACROS\n"); /* dispinterfaces don't have real functions, so don't write macros for them, * only for the interface this interface inherits from, i.e. IDispatch */ + fprintf(header, "#ifndef WIDL_C_INLINE_WRAPPERS\n"); write_method_macro(header, dispinterface ? type_iface_get_inherit(iface) : iface, iface->name); - fprintf(header, "#endif\n"); + fprintf(header, "#else\n"); + write_inline_wrappers(header, dispinterface ? type_iface_get_inherit(iface) : iface, iface->name); + fprintf(header, "#endif\n"); fprintf(header, "#endif\n"); fprintf(header, "\n"); fprintf(header, "#endif\n"); fprintf(header, "\n"); Modified: trunk/reactos/tools/widl/server.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/server.c?rev=57…
============================================================================== --- trunk/reactos/tools/widl/server.c [iso-8859-1] (original) +++ trunk/reactos/tools/widl/server.c [iso-8859-1] Sat Aug 18 18:37:39 2012 @@ -175,11 +175,10 @@ /* if the context_handle attribute appears in the chain of types * without pointers being followed, then the context handle must * be direct, otherwise it is a pointer */ - int is_ch_ptr = is_aliaschain_attr(var->type, ATTR_CONTEXTHANDLE) ? FALSE : TRUE; + const char *ch_ptr = is_aliaschain_attr(var->type, ATTR_CONTEXTHANDLE) ? "*" : ""; print_server("("); write_type_decl_left(server, var->type); - fprintf(server, ")%sNDRSContextValue(__frame->%s)", - is_ch_ptr ? "" : "*", var->name); + fprintf(server, ")%sNDRSContextValue(__frame->%s)", ch_ptr, var->name); } else { Modified: trunk/reactos/tools/widl/typegen.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/typegen.c?rev=5…
============================================================================== --- trunk/reactos/tools/widl/typegen.c [iso-8859-1] (original) +++ trunk/reactos/tools/widl/typegen.c [iso-8859-1] Sat Aug 18 18:37:39 2012 @@ -4147,10 +4147,11 @@ /* if the context_handle attribute appears in the chain of types * without pointers being followed, then the context handle must * be direct, otherwise it is a pointer */ - int is_ch_ptr = is_aliaschain_attr(type, ATTR_CONTEXTHANDLE) ? FALSE : TRUE; + const char *ch_ptr = is_aliaschain_attr(type, ATTR_CONTEXTHANDLE) ? "" : "*"; print_file(file, indent, "NdrClientContextMarshall(\n"); print_file(file, indent + 1, "&__frame->_StubMsg,\n"); - print_file(file, indent + 1, "(NDR_CCONTEXT)%s%s%s,\n", is_ch_ptr ? "*" : "", local_var_prefix, var->name); + print_file(file, indent + 1, "(NDR_CCONTEXT)%s%s%s,\n", ch_ptr, local_var_prefix, + var->name); print_file(file, indent + 1, "%s);\n", in_attr && out_attr ? "1" : "0"); } else
12 years, 4 months
1
0
0
0
[cgutman] 57097: [MSAFD] - Fix a memory leak in the failure path of WSPGetSockName and WSPGetPeerName - Fix a broken debug print in WSPGetPeerName
by cgutman@svn.reactos.org
Author: cgutman Date: Sat Aug 18 16:36:05 2012 New Revision: 57097 URL:
http://svn.reactos.org/svn/reactos?rev=57097&view=rev
Log: [MSAFD] - Fix a memory leak in the failure path of WSPGetSockName and WSPGetPeerName - Fix a broken debug print in WSPGetPeerName Modified: trunk/reactos/dll/win32/msafd/misc/dllmain.c Modified: trunk/reactos/dll/win32/msafd/misc/dllmain.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msafd/misc/dllma…
============================================================================== --- trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] Sat Aug 18 16:36:05 2012 @@ -1842,6 +1842,8 @@ } } + HeapFree(GlobalHeap, 0, TdiAddress); + return MsafdReturnWithErrno ( Status, lpErrno, 0, NULL ); } @@ -1933,7 +1935,7 @@ SocketAddress->Address[0].Address, SocketAddress->Address[0].AddressLength); *NameLength = Socket->SharedData.SizeOfRemoteAddress; - AFD_DbgPrint (MID_TRACE, ("NameLength %d Address: %s Port %x\n", + AFD_DbgPrint (MID_TRACE, ("NameLength %d Address: %x Port %x\n", *NameLength, ((struct sockaddr_in *)Name)->sin_addr.s_addr, ((struct sockaddr_in *)Name)->sin_port)); HeapFree(GlobalHeap, 0, SocketAddress); @@ -1946,6 +1948,8 @@ return SOCKET_ERROR; } } + + HeapFree(GlobalHeap, 0, SocketAddress); return MsafdReturnWithErrno ( Status, lpErrno, 0, NULL ); }
12 years, 4 months
1
0
0
0
[ekohl] 57096: [WIDL] - Missed one old header guard.
by ekohl@svn.reactos.org
Author: ekohl Date: Sat Aug 18 13:25:24 2012 New Revision: 57096 URL:
http://svn.reactos.org/svn/reactos?rev=57096&view=rev
Log: [WIDL] - Missed one old header guard. Modified: trunk/reactos/dll/win32/browseui/shellbrowser.cpp Modified: trunk/reactos/dll/win32/browseui/shellbrowser.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/shellbr…
============================================================================== --- trunk/reactos/dll/win32/browseui/shellbrowser.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/shellbrowser.cpp [iso-8859-1] Sat Aug 18 13:25:24 2012 @@ -2579,7 +2579,7 @@ { return E_NOTIMPL; } -#ifdef __WIDL_EXDISP_H +#ifdef __exdisp_h__ #undef long #endif HRESULT STDMETHODCALLTYPE CShellBrowser::get_LocationName(BSTR *LocationName)
12 years, 4 months
1
0
0
0
[ekohl] 57095: [WIDL] - Sync WIDL to Wine 1.5.10. Part 1 of 2. - Adjust files to use MIDL compatible header guards. - Add support for nameless structs and unions.
by ekohl@svn.reactos.org
Author: ekohl Date: Sat Aug 18 13:11:56 2012 New Revision: 57095 URL:
http://svn.reactos.org/svn/reactos?rev=57095&view=rev
Log: [WIDL] - Sync WIDL to Wine 1.5.10. Part 1 of 2. - Adjust files to use MIDL compatible header guards. - Add support for nameless structs and unions. Modified: trunk/reactos/dll/win32/browseui/shellbrowser.cpp trunk/reactos/include/psdk/htmlhelp.h trunk/reactos/include/psdk/winnt.h trunk/reactos/tools/widl/header.c trunk/reactos/tools/widl/parser.tab.c trunk/reactos/tools/widl/parser.y trunk/reactos/tools/widl/widl.c [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/reactos/dll/win32/browseui/shellbrowser.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/shellbr…
Modified: trunk/reactos/include/psdk/htmlhelp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/htmlhelp.h?re…
Modified: trunk/reactos/include/psdk/winnt.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winnt.h?rev=5…
Modified: trunk/reactos/tools/widl/header.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/header.c?rev=57…
Modified: trunk/reactos/tools/widl/parser.tab.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/parser.tab.c?re…
Modified: trunk/reactos/tools/widl/parser.y URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/parser.y?rev=57…
Modified: trunk/reactos/tools/widl/widl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/widl.c?rev=5709…
12 years, 4 months
1
0
0
0
[cgutman] 57094: [MSAFD] - Add more option support to WSPGetSockOpt and WSPSetSockOpt - Return the correct error code for an unsupported option in WSPGetSockOpt - Hack a SO_ERROR get handler togeth...
by cgutman@svn.reactos.org
Author: cgutman Date: Sat Aug 18 09:57:27 2012 New Revision: 57094 URL:
http://svn.reactos.org/svn/reactos?rev=57094&view=rev
Log: [MSAFD] - Add more option support to WSPGetSockOpt and WSPSetSockOpt - Return the correct error code for an unsupported option in WSPGetSockOpt - Hack a SO_ERROR get handler together for apps that need it - Add better unsupported protoopts debugging (particularly for getsockopt) - SMPlayer can now stream media from the Internet :) Modified: trunk/reactos/dll/win32/msafd/misc/dllmain.c Modified: trunk/reactos/dll/win32/msafd/misc/dllmain.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msafd/misc/dllma…
============================================================================== --- trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msafd/misc/dllmain.c [iso-8859-1] Sat Aug 18 09:57:27 2012 @@ -2052,6 +2052,7 @@ PVOID Buffer; INT BufferSize; BOOL BoolBuffer; + INT IntBuffer; /* Get the Socket Structure associate to this Socket*/ Socket = GetSocketStructure(Handle); @@ -2112,21 +2113,46 @@ BufferSize = sizeof(struct linger); break; - /* case SO_CONDITIONAL_ACCEPT: */ + case SO_OOBINLINE: + BoolBuffer = (Socket->SharedData.OobInline != 0); + Buffer = &BoolBuffer; + BufferSize = sizeof(BOOL); + break; + + case SO_KEEPALIVE: case SO_DONTROUTE: + /* These guys go directly to the helper */ + goto SendToHelper; + + case SO_CONDITIONAL_ACCEPT: + BoolBuffer = (Socket->SharedData.UseDelayedAcceptance != 0); + Buffer = &BoolBuffer; + BufferSize = sizeof(BOOL); + break; + + case SO_REUSEADDR: + BoolBuffer = (Socket->SharedData.ReuseAddresses != 0); + Buffer = &BoolBuffer; + BufferSize = sizeof(BOOL); + break; + case SO_ERROR: + /* HACK: This needs to be properly tracked */ + IntBuffer = 0; + DbgPrint("MSAFD: Hacked SO_ERROR returning error %d\n", IntBuffer); + + Buffer = &IntBuffer; + BufferSize = sizeof(INT); + break; + case SO_GROUP_ID: case SO_GROUP_PRIORITY: - case SO_KEEPALIVE: case SO_MAX_MSG_SIZE: - case SO_OOBINLINE: case SO_PROTOCOL_INFO: - case SO_REUSEADDR: - AFD_DbgPrint(MID_TRACE, ("Unimplemented option (%x)\n", - OptionName)); default: - *lpErrno = WSAEINVAL; + DbgPrint("MSAFD: Get unknown optname %x\n", OptionName); + *lpErrno = WSAENOPROTOOPT; return SOCKET_ERROR; } @@ -2140,18 +2166,20 @@ return 0; - case IPPROTO_TCP: /* FIXME */ default: - *lpErrno = Socket->HelperData->WSHGetSocketInformation(Socket->HelperContext, - Handle, - Socket->TdiAddressHandle, - Socket->TdiConnectionHandle, - Level, - OptionName, - OptionValue, - (LPINT)OptionLength); - return (*lpErrno == 0) ? 0 : SOCKET_ERROR; - } + break; + } + +SendToHelper: + *lpErrno = Socket->HelperData->WSHGetSocketInformation(Socket->HelperContext, + Handle, + Socket->TdiAddressHandle, + Socket->TdiConnectionHandle, + Level, + OptionName, + OptionValue, + (LPINT)OptionLength); + return (*lpErrno == 0) ? 0 : SOCKET_ERROR; } INT @@ -2220,13 +2248,43 @@ AFD_DbgPrint(MIN_TRACE,("Setting send buf to %x is not implemented yet\n", optval)); return 0; + case SO_SNDTIMEO: + if (optlen < sizeof(DWORD)) + { + *lpErrno = WSAEFAULT; + return SOCKET_ERROR; + } + + RtlCopyMemory(&Socket->SharedData.SendTimeout, + optval, + sizeof(DWORD)); + return 0; + + case SO_RCVTIMEO: + if (optlen < sizeof(DWORD)) + { + *lpErrno = WSAEFAULT; + return SOCKET_ERROR; + } + + RtlCopyMemory(&Socket->SharedData.RecvTimeout, + optval, + sizeof(DWORD)); + return 0; + + case SO_KEEPALIVE: + case SO_DONTROUTE: + /* These go directly to the helper dll */ + goto SendToHelper; + default: - AFD_DbgPrint(MIN_TRACE,("Unknown optname %x\n", optname)); - break; - } - } - - + /* Obviously this is a hack */ + DbgPrint("MSAFD: Set unknown optname %x\n", optname); + return 0; + } + } + +SendToHelper: *lpErrno = Socket->HelperData->WSHSetSocketInformation(Socket->HelperContext, s, Socket->TdiAddressHandle,
12 years, 4 months
1
0
0
0
[tfaber] 57093: [NTDLL:LDR] - Code cleanup in LdrpLoadDll
by tfaber@svn.reactos.org
Author: tfaber Date: Sat Aug 18 08:19:48 2012 New Revision: 57093 URL:
http://svn.reactos.org/svn/reactos?rev=57093&view=rev
Log: [NTDLL:LDR] - Code cleanup in LdrpLoadDll Modified: trunk/reactos/dll/ntdll/ldr/ldrutils.c Modified: trunk/reactos/dll/ntdll/ldr/ldrutils.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/ldr/ldrutils.c?r…
============================================================================== --- trunk/reactos/dll/ntdll/ldr/ldrutils.c [iso-8859-1] (original) +++ trunk/reactos/dll/ntdll/ldr/ldrutils.c [iso-8859-1] Sat Aug 18 08:19:48 2012 @@ -1985,7 +1985,7 @@ /* FIXME: Warning, "Flag" is used as magic instead of "Static" */ /* FIXME: Warning, code does not support redirection at all */ - + /* Look in the hash table if flag was set */ lookinhash: if (Flag) @@ -2077,7 +2077,7 @@ Flag = TRUE; goto lookinhash; } - + /* FIXME: Warning, activation context missing */ /* NOTE: From here on down, everything looks good */ @@ -2192,7 +2192,7 @@ /* Check if it's in the process of being unloaded */ if (!CurEntry->InMemoryOrderModuleList.Flink) continue; - + /* The header is untrusted, use SEH */ _SEH2_TRY { @@ -2415,28 +2415,28 @@ { PPEB Peb = NtCurrentPeb(); NTSTATUS Status = STATUS_SUCCESS; - PWCHAR p1, p2, p1min; + const WCHAR *p; + BOOLEAN GotExtension; WCHAR c; - WCHAR NameBuffer[MAX_PATH+6]; - LPWSTR RawDllName; - UNICODE_STRING RawDllNameString; + WCHAR NameBuffer[MAX_PATH + 6]; + UNICODE_STRING RawDllName; PLDR_DATA_TABLE_ENTRY LdrEntry; BOOLEAN InInit = LdrpInLdrInit; /* Save the Raw DLL Name */ - RawDllName = NameBuffer; if (DllName->Length >= sizeof(NameBuffer)) return STATUS_NAME_TOO_LONG; - RtlMoveMemory(RawDllName, DllName->Buffer, DllName->Length); - - /* Find the name without the extension */ - p1 = DllName->Buffer + DllName->Length / sizeof(WCHAR) - 1; - p2 = NULL; - for (p1min = DllName->Buffer; p1 >= p1min; p1--) - { - c = *p1; + RtlInitEmptyUnicodeString(&RawDllName, NameBuffer, sizeof(NameBuffer)); + RtlCopyUnicodeString(&RawDllName, DllName); + + /* Find the extension, if present */ + p = DllName->Buffer + DllName->Length / sizeof(WCHAR) - 1; + GotExtension = FALSE; + while (p >= DllName->Buffer) + { + c = *p--; if (c == L'.') { - p2 = p1; + GotExtension = TRUE; break; } else if (c == L'\\') @@ -2445,8 +2445,8 @@ } } - /* Check if no extension was found */ - if (!p2) + /* If no extension was found, add the default extension */ + if (!GotExtension) { /* Check that we have space to add one */ if ((DllName->Length + LdrApiDefaultExtension.Length + sizeof(UNICODE_NULL)) >= @@ -2466,30 +2466,10 @@ return STATUS_NAME_TOO_LONG; } - /* FIXME: CLEAN THIS UP WITH Rtl String Functions */ - /* Add it */ - RtlMoveMemory((PVOID)((ULONG_PTR)RawDllName + DllName->Length), - LdrApiDefaultExtension.Buffer, - LdrApiDefaultExtension.Length); - - /* Save the length to a unicode string */ - RawDllNameString.Length = DllName->Length + LdrApiDefaultExtension.Length; - - /* Null terminate it */ - RawDllName[RawDllNameString.Length / sizeof(WCHAR)] = 0; - } - else - { - /* Null terminate it */ - RawDllName[DllName->Length / sizeof(WCHAR)] = 0; - - /* Save the length to a unicode string */ - RawDllNameString.Length = DllName->Length; - } - - /* Now create a unicode string for the DLL's name */ - RawDllNameString.MaximumLength = sizeof(NameBuffer); - RawDllNameString.Buffer = NameBuffer; + /* Add it. Needs to be null terminated, thus the length check above */ + (VOID)RtlAppendUnicodeStringToString(&RawDllName, + &LdrApiDefaultExtension); + } /* Check for init flag and acquire lock */ if (!InInit) RtlEnterCriticalSection(&LdrpLoaderLock); @@ -2497,14 +2477,14 @@ /* Show debug message */ if (ShowSnaps) { - DPRINT1("LDR: LdrLoadDll, loading %ws from %ws\n", - RawDllName, + DPRINT1("LDR: LdrLoadDll, loading %wZ from %ws\n", + &RawDllName, DllPath ? DllPath : L""); } /* Check if the DLL is already loaded */ if (!LdrpCheckForLoadedDll(DllPath, - &RawDllNameString, + &RawDllName, FALSE, Redirected, &LdrEntry)) @@ -2518,7 +2498,7 @@ Redirected, &LdrEntry); if (!NT_SUCCESS(Status)) goto Quickie; - + /* FIXME: Need to mark the DLL range for the stack DB */ //RtlpStkMarkDllRange(LdrEntry); @@ -2555,7 +2535,7 @@ /* Cancel the load */ LdrpClearLoadInProgress(); - + /* Unload the DLL */ if (ShowSnaps) { @@ -2590,7 +2570,7 @@ //ShimLoadCallback = RtlDecodeSystemPointer(g_pfnSE_DllLoaded); //ShimLoadCallback(LdrEntry); } - + /* Run the init routine */ Status = LdrpRunInitializeRoutines(NULL); if (!NT_SUCCESS(Status))
12 years, 4 months
1
0
0
0
[tfaber] 57092: [NTDLL:LDR] - Do not assume null termination of DllName and optimize extension search in LdrpLoadDll. Patch by Alexander Yastrebov (menone7 at gmail dot com). See issue #7251 for mo...
by tfaber@svn.reactos.org
Author: tfaber Date: Sat Aug 18 07:56:45 2012 New Revision: 57092 URL:
http://svn.reactos.org/svn/reactos?rev=57092&view=rev
Log: [NTDLL:LDR] - Do not assume null termination of DllName and optimize extension search in LdrpLoadDll. Patch by Alexander Yastrebov (menone7 at gmail dot com). See issue #7251 for more details. Modified: trunk/reactos/dll/ntdll/ldr/ldrutils.c Modified: trunk/reactos/dll/ntdll/ldr/ldrutils.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/ldr/ldrutils.c?r…
============================================================================== --- trunk/reactos/dll/ntdll/ldr/ldrutils.c [iso-8859-1] (original) +++ trunk/reactos/dll/ntdll/ldr/ldrutils.c [iso-8859-1] Sat Aug 18 07:56:45 2012 @@ -2415,37 +2415,38 @@ { PPEB Peb = NtCurrentPeb(); NTSTATUS Status = STATUS_SUCCESS; - PWCHAR p1, p2; + PWCHAR p1, p2, p1min; WCHAR c; - WCHAR NameBuffer[266]; + WCHAR NameBuffer[MAX_PATH+6]; LPWSTR RawDllName; UNICODE_STRING RawDllNameString; PLDR_DATA_TABLE_ENTRY LdrEntry; BOOLEAN InInit = LdrpInLdrInit; - /* Find the name without the extension */ - p1 = DllName->Buffer; - p2 = NULL; - while (*p1) - { - c = *p1++; - if (c == L'.') - { - p2 = p1; - } - else if (c == L'\\') - { - p2 = NULL; - } - } - /* Save the Raw DLL Name */ RawDllName = NameBuffer; if (DllName->Length >= sizeof(NameBuffer)) return STATUS_NAME_TOO_LONG; RtlMoveMemory(RawDllName, DllName->Buffer, DllName->Length); - /* Check if no extension was found or if we got a slash */ - if (!(p2) || (*p2 == '\\')) + /* Find the name without the extension */ + p1 = DllName->Buffer + DllName->Length / sizeof(WCHAR) - 1; + p2 = NULL; + for (p1min = DllName->Buffer; p1 >= p1min; p1--) + { + c = *p1; + if (c == L'.') + { + p2 = p1; + break; + } + else if (c == L'\\') + { + break; + } + } + + /* Check if no extension was found */ + if (!p2) { /* Check that we have space to add one */ if ((DllName->Length + LdrApiDefaultExtension.Length + sizeof(UNICODE_NULL)) >=
12 years, 4 months
1
0
0
0
[jimtabor] 57091: [Win32SS] - Fixed skip test regression in User32 Win wine test. - Regressed one scroll control test. AbiWord scrolls and Explorer redraw issue still the same. - WIP: Rearranged co...
by jimtabor@svn.reactos.org
Author: jimtabor Date: Sat Aug 18 00:59:35 2012 New Revision: 57091 URL:
http://svn.reactos.org/svn/reactos?rev=57091&view=rev
Log: [Win32SS] - Fixed skip test regression in User32 Win wine test. - Regressed one scroll control test. AbiWord scrolls and Explorer redraw issue still the same. - WIP: Rearranged code for standard structures prior to moving scroll code to Win32k. Proc support will remain in User32 (A2W etc) and redirected to Win32k. Drawing support will be added when this switch is made. Then ReactOS will have 100 percent wine scrolls plus our fixes in one file. Modified: trunk/reactos/include/reactos/undocuser.h trunk/reactos/win32ss/user/ntuser/message.c trunk/reactos/win32ss/user/ntuser/scrollbar.c trunk/reactos/win32ss/user/user32/controls/scrollbar.c Modified: trunk/reactos/include/reactos/undocuser.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/undocuser.…
============================================================================== --- trunk/reactos/include/reactos/undocuser.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/undocuser.h [iso-8859-1] Sat Aug 18 00:59:35 2012 @@ -68,6 +68,9 @@ #define SWP_NOCLIENTMOVE 0x1000 #define SWP_STATECHANGED 0x8000 +/* NtUserSetScrollInfo mask to return original position before it is change */ +#define SIF_PREVIOUSPOS 4096 + /* Non SDK Queue state flags. */ #define QS_SMRESULT 0x8000 /* see "Undoc. Windows" */ Modified: trunk/reactos/win32ss/user/ntuser/message.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/messag…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/message.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/message.c [iso-8859-1] Sat Aug 18 00:59:35 2012 @@ -608,7 +608,7 @@ pWnd == UserGetMessageWindow() ) // pWnd->fnid == FNID_MESSAGEWND return 0; - TRACE("Internal Event Msg %p\n",msg); + TRACE("Internal Event Msg %p hWnd 0x%x\n",msg,pWnd->head.h); switch(msg) { @@ -742,7 +742,6 @@ BOOL bGMSG ) { PTHREADINFO pti; - //PCLIENTINFO pci; LARGE_INTEGER LargeTickCount; PUSER_MESSAGE_QUEUE ThreadQueue; BOOL RemoveMessages; @@ -751,10 +750,14 @@ pti = PsGetCurrentThreadWin32Thread(); ThreadQueue = pti->MessageQueue; - //pci = pti->pClientInfo; RemoveMessages = RemoveMsg & PM_REMOVE; ProcessMask = HIWORD(RemoveMsg); + + if (ThreadQueue->ptiSysLock && ThreadQueue->ptiSysLock != pti) + { + ERR("PeekMessage: Thread Q 0x%p is locked 0x%p to another pti 0x%p!\n", ThreadQueue, ThreadQueue->ptiSysLock, pti ); + } /* Hint, "If wMsgFilterMin and wMsgFilterMax are both zero, PeekMessage returns all available messages (that is, no range filtering is performed)". */ @@ -1182,6 +1185,7 @@ Window = UserGetWindowObject(Wnd); if ( !Window ) { + ERR("UserPostMessage: Invalid handle 0x%p!\n",Wnd); return FALSE; } @@ -1246,6 +1250,7 @@ if (!(Window = UserGetWindowObject(hWnd))) { + TRACE("SendMessageTimeoutSingle: Invalid handle 0x%p!\n",hWnd); RETURN( FALSE); } @@ -1491,6 +1496,7 @@ if (!(Window = UserGetWindowObject(hWnd))) { + TRACE("SendMessageWithCallBack: Invalid handle 0x%p!\n",hWnd); RETURN(FALSE); } @@ -1514,6 +1520,8 @@ if (Msg & 0x80000000 && Window->head.pti->MessageQueue == Win32Thread->MessageQueue) { + if (Win32Thread->TIF_flags & TIF_INCLEANUP) RETURN( FALSE); + ERR("SMWCB: Internal Message!\n"); Result = (ULONG_PTR)handle_internal_message( Window, Msg, wParam, lParam ); if (uResult) *uResult = Result; @@ -1650,6 +1658,7 @@ if(!(Window = UserGetWindowObject(hWnd))) { + TRACE("PostOrSendMessage: Invalid handle 0x%p!\n",hWnd); return 0; } @@ -2158,6 +2167,8 @@ return Ret; } +LRESULT APIENTRY ScrollBarWndProc(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam); + BOOL APIENTRY NtUserMessageCall( HWND hWnd, UINT Msg, @@ -2178,18 +2189,7 @@ { case FNID_SCROLLBAR: { - switch(Msg) - { - case WM_ENABLE: - { - Window = UserGetWindowObject(hWnd); - if (Window->pSBInfo) - { - Window->pSBInfo->WSBflags = wParam ? ESB_ENABLE_BOTH : ESB_DISABLE_BOTH; - } - } - break; - } + lResult = ScrollBarWndProc(hWnd, Msg, wParam, lParam); break; } case FNID_DEFWINDOWPROC: @@ -2675,6 +2675,7 @@ case FNID_DEFWINDOWPROC: case FNID_CALLWNDPROC: case FNID_CALLWNDPROCRET: + case FNID_SCROLLBAR: if (ResultInfo) { _SEH2_TRY Modified: trunk/reactos/win32ss/user/ntuser/scrollbar.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/scroll…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/scrollbar.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/scrollbar.c [iso-8859-1] Sat Aug 18 00:59:35 2012 @@ -38,42 +38,94 @@ * 'thumbSize' returns the size of the thumb, and 'thumbPos' returns the position of the thumb relative to the left or to * the top. Return TRUE if the scrollbar is vertical, FALSE if horizontal. */ +static inline void mirror_rect( const RECT *window_rect, RECT *rect ) +{ + int width = window_rect->right - window_rect->left; + int tmp = rect->left; + rect->left = width - rect->right; + rect->right = width - tmp; +} + +PSBDATA FASTCALL +IntGetSBData(PWND pwnd, INT Bar) +{ + PSBWND pSBWnd; + PSBINFO pSBInfo; + + pSBInfo = pwnd->pSBInfo; + switch (Bar) + { + case SB_HORZ: + return &pSBInfo->Horz; + case SB_VERT: + return &pSBInfo->Vert; + case SB_CTL: + if ( pwnd->cbwndExtra != (sizeof(SBWND)-sizeof(WND)) ) + { + ERR("IntGetSBData Wrong Extra bytes for CTL Scrollbar!\n"); + return 0; + } + pSBWnd = (PSBWND)pwnd; + return (PSBDATA)&pSBWnd->SBCalc; + default: + ERR("IntGetSBData Bad Bar!\n"); + } + return NULL; +} + BOOL FASTCALL IntGetScrollBarRect (PWND Wnd, INT nBar, RECTL *lprect) { BOOL vertical; - RECTL ClientRect = Wnd->rcClient; - RECTL WindowRect = Wnd->rcWindow; + *lprect = Wnd->rcClient; + + RECTL_vOffsetRect( lprect, -Wnd->rcWindow.left, -Wnd->rcWindow.top ); + if (Wnd->ExStyle & WS_EX_LAYOUTRTL) + mirror_rect( &Wnd->rcWindow, lprect ); switch (nBar) { case SB_HORZ: - lprect->left = ClientRect.left - WindowRect.left; - lprect->top = ClientRect.bottom - WindowRect.top; - lprect->right = ClientRect.right - WindowRect.left; - lprect->bottom = lprect->top + UserGetSystemMetrics (SM_CYHSCROLL); + lprect->top = lprect->bottom; + lprect->bottom += UserGetSystemMetrics (SM_CYHSCROLL); + if (Wnd->style & WS_BORDER) + { + lprect->left--; + lprect->right++; + } + else if (Wnd->style & WS_VSCROLL) + { + lprect->right++; + } vertical = FALSE; break; case SB_VERT: if(Wnd->ExStyle & WS_EX_LEFTSCROLLBAR) { - lprect->right = ClientRect.left - WindowRect.left; - lprect->left = lprect->right - UserGetSystemMetrics(SM_CXVSCROLL); + lprect->right = lprect->right;; + lprect->left -= UserGetSystemMetrics(SM_CXVSCROLL); } else { - lprect->left = ClientRect.right - WindowRect.left; - lprect->right = lprect->left + UserGetSystemMetrics(SM_CXVSCROLL); - } - lprect->top = ClientRect.top - WindowRect.top; - lprect->bottom = ClientRect.bottom - WindowRect.top; + lprect->left = lprect->right; + lprect->right += UserGetSystemMetrics(SM_CXVSCROLL); + } + if (Wnd->style & WS_BORDER) + { + lprect->top--; + lprect->bottom++; + } + else if (Wnd->style & WS_HSCROLL) + { + lprect->bottom++; + } vertical = TRUE; break; case SB_CTL: IntGetClientRect (Wnd, lprect); - vertical = ((Wnd->style & SBS_VERT) != 0); + vertical = !!(Wnd->style & SBS_VERT); break; default: @@ -84,7 +136,7 @@ } BOOL FASTCALL -IntCalculateThumb(PWND Wnd, LONG idObject, PSCROLLBARINFO psbi, LPSCROLLINFO psi) +IntCalculateThumb(PWND Wnd, LONG idObject, PSCROLLBARINFO psbi, PSBDATA pSBData) { INT Thumb, ThumbBox, ThumbPos, cxy, mx; RECTL ClientRect; @@ -127,20 +179,20 @@ } else { - ThumbBox = psi->nPage ? MINTRACKTHUMB : UserGetSystemMetrics(SM_CXHTHUMB); + ThumbBox = pSBData->page ? MINTRACKTHUMB : UserGetSystemMetrics(SM_CXHTHUMB); cxy -= (2 * Thumb); if(cxy >= ThumbBox) { - if(psi->nPage) - { - ThumbBox = max(EngMulDiv(cxy, psi->nPage, psi->nMax - psi->nMin + 1), ThumbBox); + if(pSBData->page) + { + ThumbBox = max(EngMulDiv(cxy, pSBData->page, pSBData->posMax - pSBData->posMin + 1), ThumbBox); } if(cxy > ThumbBox) { - mx = psi->nMax - max(psi->nPage - 1, 0); - if(psi->nMin < mx) - ThumbPos = Thumb + EngMulDiv(cxy - ThumbBox, psi->nPos - psi->nMin, mx - psi->nMin); + mx = pSBData->posMax - max(pSBData->page - 1, 0); + if(pSBData->posMin < mx) + ThumbPos = Thumb + EngMulDiv(cxy - ThumbBox, pSBData->pos - pSBData->posMin, mx - pSBData->posMin); else ThumbPos = Thumb + ThumbBox; } @@ -158,25 +210,25 @@ return TRUE; } - +/* static VOID FASTCALL IntUpdateSBInfo(PWND Window, int wBar) { PSCROLLBARINFO sbi; - LPSCROLLINFO psi; + PSBDATA pSBData; ASSERT(Window); ASSERT(Window->pSBInfo); ASSERT(Window->pSBInfoex); sbi = IntGetScrollbarInfoFromWindow(Window, wBar); - psi = IntGetScrollInfoFromWindow(Window, wBar); + pSBData = IntGetSBData(Window, wBar); IntGetScrollBarRect(Window, wBar, &(sbi->rcScrollBar)); - IntCalculateThumb(Window, wBar, sbi, psi); -} - + IntCalculateThumb(Window, wBar, sbi, pSBData); +} +*/ static BOOL FASTCALL -co_IntGetScrollInfo(PWND Window, INT nBar, LPSCROLLINFO lpsi) +co_IntGetScrollInfo(PWND Window, INT nBar, PSBDATA pSBData, LPSCROLLINFO lpsi) { UINT Mask; LPSCROLLINFO psi; @@ -190,7 +242,11 @@ return FALSE; } - if (!Window->pSBInfo) return FALSE; + if (!Window->pSBInfo) + { + ERR("IntGetScrollInfo No window scrollbar info!\n"); + return FALSE; + } psi = IntGetScrollInfoFromWindow(Window, nBar); @@ -288,6 +344,8 @@ PSCROLLBARINFO psbi; UINT new_flags; INT action = 0; + PSBDATA pSBData; + DWORD OldPos; BOOL bChangeParams = FALSE; /* Don't show/hide scrollbar if params don't change */ ASSERT_REFS_CO(Window); @@ -310,7 +368,7 @@ EngSetLastError(ERROR_INVALID_PARAMETER); return 0; } - if (lpsi->fMask & ~(SIF_ALL | SIF_DISABLENOSCROLL)) + if (lpsi->fMask & ~(SIF_ALL | SIF_DISABLENOSCROLL | SIF_PREVIOUSPOS)) { EngSetLastError(ERROR_INVALID_PARAMETER); return 0; @@ -318,6 +376,7 @@ psbi = IntGetScrollbarInfoFromWindow(Window, nBar); Info = IntGetScrollInfoFromWindow(Window, nBar); + pSBData = IntGetSBData(Window, nBar); /* Set the page size */ if (lpsi->fMask & SIF_PAGE) @@ -325,6 +384,7 @@ if (Info->nPage != lpsi->nPage) { Info->nPage = lpsi->nPage; + pSBData->page = lpsi->nPage; bChangeParams = TRUE; } } @@ -334,7 +394,9 @@ { if (Info->nPos != lpsi->nPos) { + OldPos = Info->nPos; Info->nPos = lpsi->nPos; + pSBData->pos = lpsi->nPos; bChangeParams = TRUE; } } @@ -348,32 +410,38 @@ { Info->nMin = 0; Info->nMax = 0; + pSBData->posMin = 0; + pSBData->posMax = 0; bChangeParams = TRUE; } else if (Info->nMin != lpsi->nMin || Info->nMax != lpsi->nMax) { Info->nMin = lpsi->nMin; Info->nMax = lpsi->nMax; + pSBData->posMin = lpsi->nMin; + pSBData->posMax = lpsi->nMax; bChangeParams = TRUE; } } /* Make sure the page size is valid */ if (Info->nPage < 0) - Info->nPage = 0; + { + pSBData->page = Info->nPage = 0; + } else if ((Info->nMax - Info->nMin + 1UL) < Info->nPage) { - Info->nPage = Info->nMax - Info->nMin + 1; + pSBData->page = Info->nPage = Info->nMax - Info->nMin + 1; } /* Make sure the pos is inside the range */ if (Info->nPos < Info->nMin) { - Info->nPos = Info->nMin; + pSBData->pos = Info->nPos = Info->nMin; } else if (Info->nPos > (Info->nMax - max((int)Info->nPage - 1, 0))) { - Info->nPos = Info->nMax - max(Info->nPage - 1, 0); + pSBData->pos = Info->nPos = Info->nMax - max(Info->nPage - 1, 0); } /* @@ -382,7 +450,8 @@ */ if (!(lpsi->fMask & SIF_ALL)) { - goto done; //return Info->nPos; + //goto done; + return lpsi->fMask & SIF_PREVIOUSPOS ? OldPos : pSBData->pos; } /* Check if the scrollbar should be hidden or disabled */ @@ -419,7 +488,7 @@ } } -done: +//done: if ( action & SA_SSI_HIDE ) { co_UserShowScrollBar(Window, nBar, FALSE, FALSE); @@ -428,7 +497,7 @@ { if ( action & SA_SSI_SHOW ) if ( co_UserShowScrollBar(Window, nBar, TRUE, TRUE) ) - return Info->nPos; /* SetWindowPos() already did the painting */ + return lpsi->fMask & SIF_PREVIOUSPOS ? OldPos : pSBData->pos; /* SetWindowPos() already did the painting */ if (bRedraw) { // FIXME: Arrows and interior. RECTL UpdateRect = psbi->rcScrollBar; @@ -438,7 +507,7 @@ UpdateRect.bottom -= Window->rcClient.top - Window->rcWindow.top; co_UserRedrawWindow(Window, &UpdateRect, 0, RDW_INVALIDATE | RDW_FRAME); } // FIXME: Arrows - else if( action & SA_SSI_REPAINT_ARROWS ) +/* else if( action & SA_SSI_REPAINT_ARROWS ) { RECTL UpdateRect = psbi->rcScrollBar; UpdateRect.left -= Window->rcClient.left - Window->rcWindow.left; @@ -447,9 +516,9 @@ UpdateRect.bottom -= Window->rcClient.top - Window->rcWindow.top; co_UserRedrawWindow(Window, &UpdateRect, 0, RDW_INVALIDATE | RDW_FRAME); } - } +*/ } /* Return current position */ - return Info->nPos; + return lpsi->fMask & SIF_PREVIOUSPOS ? OldPos : pSBData->pos; } BOOL FASTCALL @@ -457,7 +526,7 @@ { INT Bar; PSCROLLBARINFO sbi; - LPSCROLLINFO psi; + PSBDATA pSBData; ASSERT_REFS_CO(Window); Bar = SBOBJ_TO_SBID(idObject); @@ -471,14 +540,15 @@ if(!co_IntCreateScrollBars(Window)) { + ERR("Failed to create scrollbars for window.\n"); return FALSE; } sbi = IntGetScrollbarInfoFromWindow(Window, Bar); - psi = IntGetScrollInfoFromWindow(Window, Bar); + pSBData = IntGetSBData(Window, Bar); IntGetScrollBarRect(Window, Bar, &(sbi->rcScrollBar)); - IntCalculateThumb(Window, Bar, sbi, psi); + IntCalculateThumb(Window, Bar, sbi, pSBData); RtlCopyMemory(psbi, sbi, sizeof(SCROLLBARINFO)); @@ -489,7 +559,7 @@ co_IntCreateScrollBars(PWND Window) { PSCROLLBARINFO psbi; - LPSCROLLINFO psi; + PSBDATA pSBData; ULONG Size, s; INT i; @@ -532,12 +602,10 @@ for (i = 0; i < CCHILDREN_SCROLLBAR + 1; i++) psbi->rgstate[i] = 0; - psi = IntGetScrollInfoFromWindow(Window, s); - psi->cbSize = sizeof(LPSCROLLINFO); - psi->nMax = 100; + pSBData = IntGetSBData(Window, s); IntGetScrollBarRect(Window, s, &(psbi->rcScrollBar)); - IntCalculateThumb(Window, s, psbi, psi); + IntCalculateThumb(Window, s, psbi, pSBData); } return TRUE; @@ -607,7 +675,7 @@ { case SB_CTL: { - if (Wnd->pSBInfo) IntUpdateSBInfo(Wnd, SB_CTL); // Is this needed? Was tested w/o! + //IntUpdateSBInfo(Wnd, SB_CTL); // Is this needed? Was tested w/o! co_WinPosShowWindow(Wnd, fShowH ? SW_SHOW : SW_HIDE); return TRUE; @@ -627,20 +695,12 @@ return FALSE; } - - old_style = Wnd->style; - Wnd->style = (Wnd->style | set_bits) & ~clear_bits; - - if (fShowH || fShowV) - { - if (!Wnd->pSBInfo) co_IntCreateScrollBars(Wnd); - } - + old_style = IntSetStyle( Wnd, set_bits, clear_bits ); if ((old_style & clear_bits) != 0 || (old_style & set_bits) != set_bits) { ///// Is this needed? Was tested w/o! - if (Wnd->style & WS_HSCROLL) IntUpdateSBInfo(Wnd, SB_HORZ); - if (Wnd->style & WS_VSCROLL) IntUpdateSBInfo(Wnd, SB_VERT); + //if (Wnd->style & WS_HSCROLL) IntUpdateSBInfo(Wnd, SB_HORZ); + //if (Wnd->style & WS_VSCROLL) IntUpdateSBInfo(Wnd, SB_VERT); ///// /* Frame has been changed, let the window redraw itself */ co_WinPosSetWindowPos(Wnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | @@ -648,6 +708,28 @@ return TRUE; } return FALSE; +} + +LRESULT APIENTRY +ScrollBarWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) +{ + LRESULT lResult = 0; + PWND pWnd; + pWnd = UserGetWindowObject(hWnd); + if (!pWnd) return 0; + + switch(Msg) + { + case WM_ENABLE: + { + if (pWnd->pSBInfo) + { + pWnd->pSBInfo->WSBflags = wParam ? ESB_ENABLE_BOTH : ESB_DISABLE_BOTH; + } + } + break; + } + return lResult; } //// @@ -706,47 +788,53 @@ PSBDATA pSBData, LPSCROLLINFO lpsi) { - NTSTATUS Status; PWND Window; SCROLLINFO psi; - DWORD sz; BOOL Ret; + SBDATA SBDataSafe; DECLARE_RETURN(BOOL); USER_REFERENCE_ENTRY Ref; TRACE("Enter NtUserGetScrollInfo\n"); - UserEnterExclusive(); - - Status = MmCopyFromCaller(&psi.cbSize, &(lpsi->cbSize), sizeof(UINT)); - if(!NT_SUCCESS(Status) || - !((psi.cbSize == sizeof(SCROLLINFO)) || (psi.cbSize == sizeof(SCROLLINFO) - sizeof(psi.nTrackPos)))) - { - SetLastNtError(Status); + UserEnterShared(); + + _SEH2_TRY + { + RtlCopyMemory(&psi, lpsi, sizeof(SCROLLINFO)); + if (pSBData) + { + RtlCopyMemory(&SBDataSafe, pSBData, sizeof(SBDATA)); + } + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + ERR("NtUserGetScrollInfo Failed size.\n"); + SetLastNtError(_SEH2_GetExceptionCode()); + _SEH2_YIELD(RETURN(FALSE)); + } + _SEH2_END + + if(!(Window = UserGetWindowObject(hWnd))) + { + ERR("NtUserGetScrollInfo Bad window.\n"); RETURN(FALSE); } - sz = psi.cbSize; - Status = MmCopyFromCaller(&psi, lpsi, sz); - if (!NT_SUCCESS(Status)) - { - SetLastNtError(Status); - RETURN(FALSE); - } - - if(!(Window = UserGetWindowObject(hWnd))) - { - RETURN(FALSE); - } UserRefObjectCo(Window, &Ref); - Ret = co_IntGetScrollInfo(Window, fnBar, &psi); + Ret = co_IntGetScrollInfo(Window, fnBar, &SBDataSafe, &psi); UserDerefObjectCo(Window); - Status = MmCopyToCaller(lpsi, &psi, sz); - if(!NT_SUCCESS(Status)) - { - SetLastNtError(Status); - RETURN( FALSE); - } + _SEH2_TRY + { + RtlCopyMemory(lpsi, &psi, sizeof(SCROLLINFO)); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + ERR("NtUserGetScrollInfo Failed copy to user.\n"); + SetLastNtError(_SEH2_GetExceptionCode()); + _SEH2_YIELD(RETURN(FALSE)); + } + _SEH2_END RETURN( Ret); @@ -773,7 +861,9 @@ TRACE("Enter NtUserEnableScrollBar\n"); UserEnterExclusive(); - if (!(Window = UserGetWindowObject(hWnd))) + if (!(Window = UserGetWindowObject(hWnd)) || // FIXME: + Window == UserGetDesktopWindow() || // pWnd->fnid == FNID_DESKTOP + Window == UserGetMessageWindow() ) // pWnd->fnid == FNID_MESSAGEWND { RETURN(FALSE); } @@ -827,6 +917,7 @@ // Done in user32: // SCROLL_RefreshScrollBar( hwnd, nBar, TRUE, TRUE ); + RETURN( Chg); if (OrigArrows == wArrows) RETURN( FALSE); RETURN( TRUE); @@ -856,7 +947,9 @@ TRACE("Enter NtUserSetScrollInfo\n"); UserEnterExclusive(); - if(!(Window = UserGetWindowObject(hWnd))) + if(!(Window = UserGetWindowObject(hWnd)) || // FIXME: + Window == UserGetDesktopWindow() || // pWnd->fnid == FNID_DESKTOP + Window == UserGetMessageWindow() ) // pWnd->fnid == FNID_MESSAGEWND { RETURN( 0); } Modified: trunk/reactos/win32ss/user/user32/controls/scrollbar.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/contro…
============================================================================== --- trunk/reactos/win32ss/user/user32/controls/scrollbar.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/controls/scrollbar.c [iso-8859-1] Sat Aug 18 00:59:35 2012 @@ -55,6 +55,9 @@ /* Minimum size of the thumb in pixels */ #define SCROLL_MIN_THUMB 6 + /* Overlap between arrows and thumb */ +#define SCROLL_ARROW_THUMB_OVERLAP 0 + /* Thumb-tracking info */ static HWND ScrollTrackingWin = 0; static INT ScrollTrackingBar = 0; @@ -86,6 +89,32 @@ /* PRIVATE FUNCTIONS **********************************************************/ +static PSBDATA +IntGetSBData(PWND pwnd, INT Bar) +{ + PSBWND pSBWnd; + PSBINFO pSBInfo; + + pSBInfo = DesktopPtrToUser(pwnd->pSBInfo); + switch (Bar) + { + case SB_HORZ: + return &pSBInfo->Horz; + case SB_VERT: + return &pSBInfo->Vert; + case SB_CTL: + if ( pwnd->cbwndExtra != (sizeof(SBWND)-sizeof(WND)) ) + { + ERR("IntGetSBData Wrong Extra bytes for CTL Scrollbar!\n"); + return 0; + } + pSBWnd = (PSBWND)pwnd; + return (PSBDATA)&pSBWnd->SBCalc; + default: + ERR("IntGetSBData Bad Bar!\n"); + } + return NULL; +} static void IntDrawScrollInterior(HWND hWnd, HDC hDC, INT nBar, BOOL Vertical, @@ -253,25 +282,16 @@ INT OldTop; if (Vertical) - { MaxSize = ScrollBarInfo->rcScrollBar.bottom - ScrollBarInfo->rcScrollBar.top; - } else - { MaxSize = ScrollBarInfo->rcScrollBar.right - ScrollBarInfo->rcScrollBar.left; - } - - MaxSize -= ScrollBarInfo->dxyLineButton + ScrollBarInfo->xyThumbBottom - - ScrollBarInfo->xyThumbTop; + + MaxSize -= ScrollBarInfo->dxyLineButton + ScrollBarInfo->xyThumbBottom - ScrollBarInfo->xyThumbTop; if (Pos < ScrollBarInfo->dxyLineButton) - { Pos = ScrollBarInfo->dxyLineButton; - } else if (MaxSize < Pos) - { Pos = MaxSize; - } OldTop = ScrollBarInfo->xyThumbTop; ScrollBarInfo->xyThumbBottom = Pos + ScrollBarInfo->xyThumbBottom - ScrollBarInfo->xyThumbTop; @@ -280,21 +300,16 @@ ScrollBarInfo->xyThumbBottom = OldTop + ScrollBarInfo->xyThumbBottom - ScrollBarInfo->xyThumbTop; ScrollBarInfo->xyThumbTop = OldTop; - ScrollMovingThumb = ! ScrollMovingThumb; + ScrollMovingThumb = !ScrollMovingThumb; } static LONG FASTCALL IntScrollGetObjectId(INT SBType) { - if (SB_VERT == SBType) - { + if (SBType == SB_VERT) return OBJID_VSCROLL; - } - if (SB_HORZ == SBType) - { + if (SBType == SB_HORZ) return OBJID_HSCROLL; - } - return OBJID_CLIENT; } @@ -334,15 +349,15 @@ default: return; } - if (! IntGetScrollBarInfo(Wnd, Bar, &Info)) - { + if (!IntGetScrollBarInfo(Wnd, Bar, &Info)) + { return; - } + } if (IsRectEmpty(&Info.rcScrollBar)) - { + { return; - } + } //ThumbSize = pSBWnd->pSBCalc->pxThumbBottom - pSBWnd->pSBCalc->pxThumbTop; @@ -350,9 +365,9 @@ * Draw the arrows. */ if (Info.dxyLineButton) - { + { IntDrawScrollArrows(DC, &Info, Vertical); - } + } /* * Draw the interior. @@ -363,34 +378,44 @@ * If scroll bar has focus, reposition the caret. */ if (Wnd == GetFocus() && SB_CTL == Bar) - { + { if (Vertical) - { + { SetCaretPos(Info.rcScrollBar.top + 1, Info.dxyLineButton + 1); - } + } else - { + { SetCaretPos(Info.dxyLineButton + 1, Info.rcScrollBar.top + 1); - } - } + } + } } static BOOL FASTCALL IntScrollPtInRectEx(LPRECT Rect, POINT Pt, BOOL Vertical) { RECT TempRect = *Rect; + int scrollbarWidth; + + /* Pad hit rect to allow mouse to be dragged outside of scrollbar and + * still be considered in the scrollbar. */ if (Vertical) - { - TempRect.left -= Rect->right - Rect->left; - TempRect.right += Rect->right - Rect->left; - } - else - { - TempRect.top -= Rect->bottom - Rect->top; - TempRect.bottom += Rect->bottom - Rect->top; - } - - return PtInRect(&TempRect, Pt); + { + scrollbarWidth = Rect->right - Rect->left; + TempRect.left -= scrollbarWidth*8; + TempRect.right += scrollbarWidth*8; + TempRect.top -= scrollbarWidth*2; + TempRect.bottom += scrollbarWidth*2; + } + else + { + scrollbarWidth = Rect->bottom - Rect->top; + TempRect.left -= scrollbarWidth*2; + TempRect.right += scrollbarWidth*2; + TempRect.top -= scrollbarWidth*8; + TempRect.bottom += scrollbarWidth*8; + } + + return PtInRect(&TempRect, Pt); } static DWORD FASTCALL @@ -399,63 +424,30 @@ INT ArrowSize, ThumbSize, ThumbPos; if ((Dragging && ! IntScrollPtInRectEx(&ScrollBarInfo->rcScrollBar, Pt, Vertical)) || - ! PtInRect(&ScrollBarInfo->rcScrollBar, Pt)) - { - return SCROLL_NOWHERE; - } + ! PtInRect(&ScrollBarInfo->rcScrollBar, Pt)) return SCROLL_NOWHERE; ThumbPos = ScrollBarInfo->xyThumbTop; ThumbSize = ScrollBarInfo->xyThumbBottom - ThumbPos; ArrowSize = ScrollBarInfo->dxyLineButton; if (Vertical) - { - if (Pt.y < ScrollBarInfo->rcScrollBar.top + ArrowSize) - { - return SCROLL_TOP_ARROW; - } - if (ScrollBarInfo->rcScrollBar.bottom - ArrowSize <= Pt.y) - { - return SCROLL_BOTTOM_ARROW; - } - if (0 == ThumbPos) - { - return SCROLL_TOP_RECT; - } + { + if (Pt.y < ScrollBarInfo->rcScrollBar.top + ArrowSize) return SCROLL_TOP_ARROW; + if (Pt.y >= ScrollBarInfo->rcScrollBar.bottom - ArrowSize) return SCROLL_BOTTOM_ARROW; + if (!ThumbPos) return SCROLL_TOP_RECT; Pt.y -= ScrollBarInfo->rcScrollBar.top; - if (Pt.y < ThumbPos) - { - return SCROLL_TOP_RECT; - } - if (ThumbPos + ThumbSize <= Pt.y) - { - return SCROLL_BOTTOM_RECT; - } - } + if (Pt.y < ThumbPos) return SCROLL_TOP_RECT; + if (Pt.y >= ThumbPos + ThumbSize) return SCROLL_BOTTOM_RECT; + } else - { - if (Pt.x < ScrollBarInfo->rcScrollBar.left + ArrowSize) - { - return SCROLL_TOP_ARROW; - } - if (ScrollBarInfo->rcScrollBar.right - ArrowSize <= Pt.x) - { - return SCROLL_BOTTOM_ARROW; - } - if (0 == ThumbPos) - { - return SCROLL_TOP_RECT; - } + { + if (Pt.x < ScrollBarInfo->rcScrollBar.left + ArrowSize) return SCROLL_TOP_ARROW; + if (Pt.x >= ScrollBarInfo->rcScrollBar.right - ArrowSize) return SCROLL_BOTTOM_ARROW; + if (!ThumbPos) return SCROLL_TOP_RECT; Pt.x -= ScrollBarInfo->rcScrollBar.left; - if (Pt.x < ThumbPos) - { - return SCROLL_TOP_RECT; - } - if (ThumbPos + ThumbSize <= Pt.x) - { - return SCROLL_BOTTOM_RECT; - } - } + if (Pt.x < ThumbPos) return SCROLL_TOP_RECT; + if (Pt.x >= ThumbPos + ThumbSize) return SCROLL_BOTTOM_RECT; + } return SCROLL_THUMB; } @@ -479,145 +471,113 @@ { INT Pixels; BOOL Vertical; - RECT ClientRect; - RECT WindowRect; - DWORD Style, ExStyle; PWND pWnd; PSBINFO pSBInfo; + PSBDATA pSBData; + PSBWND pSBWnd; pWnd = ValidateHwnd( Wnd ); + if (!pWnd) return FALSE; pSBInfo = DesktopPtrToUser(pWnd->pSBInfo); - GetClientRect(Wnd, &ClientRect); - if (SB_HORZ == Bar || SB_VERT == Bar) - { - ClientToScreen(Wnd, (LPPOINT) &ClientRect.left); - ClientToScreen(Wnd, (LPPOINT) &ClientRect.right); - GetWindowRect(Wnd, &WindowRect); - } - Style = GetWindowLongPtrW(Wnd, GWL_STYLE); + *Rect = pWnd->rcClient; + OffsetRect( Rect, -pWnd->rcWindow.left, -pWnd->rcWindow.top ); + if (pWnd->ExStyle & WS_EX_LAYOUTRTL) + mirror_rect( &pWnd->rcWindow, Rect ); switch (Bar) { case SB_HORZ: - Rect->left = ClientRect.left - WindowRect.left; - Rect->top = ClientRect.bottom - WindowRect.top; - Rect->right = ClientRect.right - WindowRect.left; - Rect->bottom = Rect->top + GetSystemMetrics(SM_CYHSCROLL); - if (0 != (Style & WS_BORDER)) - { +// WIN_GetRectangles( Wnd, COORDS_WINDOW, NULL, Rect ); + Rect->top = Rect->bottom; + Rect->bottom += GetSystemMetrics(SM_CYHSCROLL); + if (pWnd->style & WS_BORDER) + { Rect->left--; Rect->right++; - } - else if (0 != (Style & WS_VSCROLL)) - { + } + else if (pWnd->style & WS_VSCROLL) + { Rect->right++; - } + } Vertical = FALSE; + pSBData = &pSBInfo->Horz; break; case SB_VERT: - ExStyle = GetWindowLongPtrW(Wnd, GWL_EXSTYLE); - if (0 != (ExStyle & WS_EX_LEFTSCROLLBAR)) - { - Rect->left = ClientRect.left - WindowRect.left - GetSystemMetrics(SM_CXVSCROLL); - } +// WIN_GetRectangles( Wnd, COORDS_WINDOW, NULL, Rect ); + if (pWnd->ExStyle & WS_EX_LEFTSCROLLBAR) + { + Rect->right = Rect->left; + Rect->left -= GetSystemMetrics(SM_CXVSCROLL); + } else - { - Rect->left = ClientRect.right - WindowRect.left; - } - Rect->top = ClientRect.top - WindowRect.top; - Rect->right = Rect->left + GetSystemMetrics(SM_CXVSCROLL); - Rect->bottom = ClientRect.bottom - WindowRect.top; - if (0 != (Style & WS_BORDER)) - { + { + Rect->left = Rect->right; + Rect->right += GetSystemMetrics(SM_CXVSCROLL); + } + if (pWnd->style & WS_BORDER) + { Rect->top--; Rect->bottom++; - } - else if (0 != (Style & WS_HSCROLL)) - { + } + else if (pWnd->style & WS_HSCROLL) + { Rect->bottom++; - } + } Vertical = TRUE; + pSBData = &pSBInfo->Vert; break; case SB_CTL: - *Rect = ClientRect; - Vertical = (0 != (Style & SBS_VERT)); + GetClientRect( Wnd, Rect ); + Vertical = (pWnd->style & SBS_VERT); + pSBWnd = (PSBWND)pWnd; + pSBData = (PSBDATA)&pSBWnd->SBCalc; break; default: return FALSE; } - if (Vertical) - { - Pixels = Rect->bottom - Rect->top; - } + if (Vertical) Pixels = Rect->bottom - Rect->top; + else Pixels = Rect->right - Rect->left; + + if (Pixels <= 2 * GetSystemMetrics(SM_CXVSCROLL) + SCROLL_MIN_RECT) + { + if (SCROLL_MIN_RECT < Pixels) + *ArrowSize = (Pixels - SCROLL_MIN_RECT) / 2; + else + *ArrowSize = 0; + *ThumbPos = *ThumbSize = 0; + } else - { - Pixels = Rect->right - Rect->left; - } - - if (Pixels <= 2 * GetSystemMetrics(SM_CXVSCROLL) + SCROLL_MIN_RECT) - { - if (SCROLL_MIN_RECT < Pixels) - { - *ArrowSize = (Pixels - SCROLL_MIN_RECT) / 2; - } - else - { - *ArrowSize = 0; - } - *ThumbPos = *ThumbSize = 0; - } - else - { - SCROLLINFO Info; - - NtUserSBGetParms(Wnd, Bar, NULL, &Info); + { *ArrowSize = GetSystemMetrics(SM_CXVSCROLL); - Pixels -= (2 * GetSystemMetrics(SM_CXVSCROLL)); - - if (0 != Info.nPage) + Pixels -= (2 * (GetSystemMetrics(SM_CXVSCROLL) - SCROLL_ARROW_THUMB_OVERLAP)); + if (pSBData->page) { - *ThumbSize = MulDiv(Pixels, Info.nPage, (Info.nMax - Info.nMin + 1)); - if (*ThumbSize < SCROLL_MIN_THUMB) - { - *ThumbSize = SCROLL_MIN_THUMB; - } + *ThumbSize = MulDiv(Pixels, pSBData->page, (pSBData->posMax - pSBData->posMin + 1)); + if (*ThumbSize < SCROLL_MIN_THUMB) *ThumbSize = SCROLL_MIN_THUMB; } - else - { - *ThumbSize = GetSystemMetrics(SM_CXVSCROLL); - } - -//#if 0 /* FIXME */ + else *ThumbSize = GetSystemMetrics(SM_CXVSCROLL); + if (((Pixels -= *ThumbSize ) < 0) || (( pSBInfo->WSBflags & ESB_DISABLE_BOTH) == ESB_DISABLE_BOTH)) -//#else -// if ((Pixels -= *ThumbSize ) < 0) -//#endif { /* Rectangle too small or scrollbar disabled -> no thumb */ *ThumbPos = *ThumbSize = 0; } else { - INT Max = Info.nMax - max(Info.nPage - 1, 0); - if (Max <= Info.nMin) - { - *ThumbPos = *ArrowSize; - } + INT Max = pSBData->posMax - max(pSBData->page - 1, 0); + if (pSBData->posMin >= Max) + *ThumbPos = *ArrowSize - SCROLL_ARROW_THUMB_OVERLAP; else - { - *ThumbPos = *ArrowSize - + MulDiv(Pixels, (Info.nPos - Info.nMin), - (Max - Info.nMin)); - } + *ThumbPos = *ArrowSize - SCROLL_ARROW_THUMB_OVERLAP + + MulDiv(Pixels, (pSBData->pos - pSBData->posMin),(Max - pSBData->posMin)); } } - return Vertical; } @@ -631,70 +591,61 @@ IntScrollGetThumbVal(HWND Wnd, INT SBType, PSCROLLBARINFO ScrollBarInfo, BOOL Vertical, INT Pos) { - SCROLLINFO si; + PWND pWnd; + PSBDATA pSBData; INT Pixels = Vertical ? ScrollBarInfo->rcScrollBar.bottom - ScrollBarInfo->rcScrollBar.top : ScrollBarInfo->rcScrollBar.right - ScrollBarInfo->rcScrollBar.left; - si.cbSize = sizeof(SCROLLINFO); - si.fMask = SIF_RANGE | SIF_PAGE; - NtUserSBGetParms(Wnd, SBType, NULL, &si); + pWnd = ValidateHwnd( Wnd ); + if (!pWnd) return FALSE; + + pSBData = IntGetSBData(pWnd, SBType); + if ((Pixels -= 2 * ScrollBarInfo->dxyLineButton) <= 0) - { - return si.nMin; - } + { + return pSBData->posMin; + } if ((Pixels -= (ScrollBarInfo->xyThumbBottom - ScrollBarInfo->xyThumbTop)) <= 0) - { - return si.nMin; - } + { + return pSBData->posMin; + } Pos = Pos - ScrollBarInfo->dxyLineButton; if (Pos < 0) - { + { Pos = 0; - } - if (Pixels < Pos) - { - Pos = Pixels; - } - - if (0 == si.nPage) - { - Pos *= si.nMax - si.nMin; - } + } + if (Pos > Pixels) Pos = Pixels; + + if (!pSBData->page) + Pos *= pSBData->posMax - pSBData->posMin; else - { - Pos *= si.nMax - si.nMin - si.nPage + 1; - } - return si.nMin + ((Pos + Pixels / 2) / Pixels); + Pos *= pSBData->posMax - pSBData->posMin - pSBData->page + 1; + + return pSBData->posMin + ((Pos + Pixels / 2) / Pixels); } /*********************************************************************** * IntScrollClipPos */ -static POINT IntScrollClipPos(PRECT Rect, POINT Pt) -{ - if (Pt.x < Rect->left) - { - Pt.x = Rect->left; - } - else if (Rect->right < Pt.x) - { - Pt.x = Rect->right; - } - - if (Pt.y < Rect->top) - { - Pt.y = Rect->top; - } - else if (Rect->bottom < Pt.y) - { - Pt.y = Rect->bottom; - } - - return Pt; +static POINT IntScrollClipPos(PRECT lpRect, POINT pt) +{ + if( pt.x < lpRect->left ) + pt.x = lpRect->left; + else + if( pt.x > lpRect->right ) + pt.x = lpRect->right; + + if( pt.y < lpRect->top ) + pt.y = lpRect->top; + else + if( pt.y > lpRect->bottom ) + pt.y = lpRect->bottom; + + return pt; } /*********************************************************************** @@ -895,9 +846,9 @@ ScrollBarInfo.rgstate[ScrollTrackHitTest] &= ~STATE_SYSTEM_PRESSED; NewInfo.rgstate[ScrollTrackHitTest] = ScrollBarInfo.rgstate[ScrollTrackHitTest]; NtUserSetScrollBarInfo(Wnd, IntScrollGetObjectId(SBType), &NewInfo); - + IntDrawScrollArrows(Dc, &ScrollBarInfo, Vertical); - + break; case WM_SYSTIMER: @@ -1092,7 +1043,7 @@ TRACE("hwnd=%p lpCreate=%p\n", Wnd, lpCreate); -//#if 0 /* FIXME */ +#if 0 /* FIXME */ if (lpCreate->style & WS_DISABLED) { // info->flags = ESB_DISABLE_BOTH; @@ -1100,7 +1051,7 @@ NtUserMessageCall( Wnd, WM_ENABLE, FALSE, 0, 0, FNID_SCROLLBAR, FALSE); ERR("Created WS_DISABLED scrollbar\n"); } -//#endif +#endif if (0 != (lpCreate->style & (SBS_SIZEGRIP | SBS_SIZEBOX))) { if (0 != (lpCreate->style & SBS_SIZEBOXTOPLEFTALIGN)) @@ -1146,42 +1097,6 @@ lpCreate->cx, GetSystemMetrics(SM_CYHSCROLL) + 1, FALSE); } } -} - -static INT FASTCALL -IntScrollGetScrollPos(HWND Wnd, INT Bar) -{ - SCROLLINFO ScrollInfo; - - ScrollInfo.cbSize = sizeof(SCROLLINFO); - ScrollInfo.fMask = SIF_POS; - if (!NtUserSBGetParms(Wnd, Bar, NULL, &ScrollInfo)) - { - return 0; - } - - return ScrollInfo.nPos; -} - -static BOOL FASTCALL -IntScrollGetScrollRange(HWND Wnd, int Bar, LPINT MinPos, LPINT MaxPos) -{ - BOOL Result; - SCROLLINFO ScrollInfo; - - if (NULL == MinPos || NULL == MaxPos) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - ScrollInfo.cbSize = sizeof(SCROLLINFO); - ScrollInfo.fMask = SIF_RANGE; - Result = NtUserSBGetParms(Wnd, Bar, NULL, &ScrollInfo); - *MinPos = Result ? ScrollInfo.nMin : 0; - *MaxPos = Result ? ScrollInfo.nMax : 0; - - return Result; } /* USER32 INTERNAL FUNCTIONS **************************************************/ @@ -1199,13 +1114,13 @@ UINT XOffset = 0, YOffset = 0; if (SBType != SB_CTL) - { // Replace HAX for CMD mouse tracking. + { // Used with CMD mouse tracking. PWND pwnd = ValidateHwnd(Wnd); if (!pwnd) return; XOffset = pwnd->rcClient.left - pwnd->rcWindow.left; YOffset = pwnd->rcClient.top - pwnd->rcWindow.top; // RECT rect; -// GetClientRect(Wnd, &rect); +// WIN_GetRectangles( Wnd, COORDS_CLIENT, &rect, NULL ); ScreenToClient(Wnd, &Pt); // Pt.x -= rect.left; // Pt.y -= rect.top; @@ -1241,6 +1156,15 @@ } +static DWORD FASTCALL +IntSetScrollInfo(HWND Wnd, LPCSCROLLINFO Info, BOOL bRedraw) +{ + DWORD Ret = NtUserSetScrollInfo(Wnd, SB_CTL, Info, bRedraw); + if (Ret) IntNotifyWinEvent(EVENT_OBJECT_VALUECHANGE, Wnd, OBJID_CLIENT, CHILDID_SELF, WEF_SETBYWNDPTI); + return Ret; +} + + /*********************************************************************** * ScrollBarWndProc */ @@ -1249,12 +1173,21 @@ { #ifdef __REACTOS__ // Do this now, remove after Server side is fixed. PWND pWnd; + PSBWND pSBWnd; + SCROLLINFO ScrollInfo; pWnd = ValidateHwnd(Wnd); if (pWnd) { if (!pWnd->fnid) { + ERR("ScrollBar CTL size %d\n",(sizeof(SBWND)-sizeof(WND))); + if ( pWnd->cbwndExtra != (sizeof(SBWND)-sizeof(WND)) ) + { + ERR("Wrong Extra bytes for Scrollbar!\n"); + return 0; + } + if (Msg != WM_CREATE) { return DefWindowProc(Wnd, Msg, wParam, lParam); @@ -1277,6 +1210,9 @@ return 0; } + // Must be a scroll bar control! + pSBWnd = (PSBWND)pWnd; + switch (Msg) { case WM_CREATE: @@ -1285,17 +1221,8 @@ case WM_ENABLE: { - PWND pWnd = ValidateHwnd(Wnd); - if (pWnd->pSBInfo) - { - ERR("ScrollBarWndProc WM_ENABLE\n"); - //NtUserEnableScrollBar(Wnd,SB_CTL,(wParam ? ESB_ENABLE_BOTH : ESB_DISABLE_BOTH)); - NtUserMessageCall( Wnd, Msg, wParam, lParam, 0, FNID_SCROLLBAR, !unicode); - /* Refresh Scrollbars. */ - SCROLL_RefreshScrollBar(Wnd, SB_CTL, TRUE, TRUE); - } - } - return 0; + return SendMessageW( Wnd, SBM_ENABLE_ARROWS, wParam ? ESB_ENABLE_BOTH : ESB_DISABLE_BOTH, 0); + } case WM_LBUTTONDBLCLK: case WM_LBUTTONDOWN: @@ -1408,35 +1335,49 @@ } break; - case SBM_SETPOS: - return SetScrollPos(Wnd, SB_CTL, wParam, (BOOL) lParam); - case SBM_GETPOS: - return IntScrollGetScrollPos(Wnd, SB_CTL); - - case SBM_SETRANGEREDRAW: - case SBM_SETRANGE: - { - INT OldPos = IntScrollGetScrollPos(Wnd, SB_CTL); - SetScrollRange(Wnd, SB_CTL, wParam, lParam, FALSE); - if (Msg == SBM_SETRANGEREDRAW) - SCROLL_RefreshScrollBar( Wnd, SB_CTL, TRUE, TRUE ); - if (OldPos != IntScrollGetScrollPos(Wnd, SB_CTL)) return OldPos; - } + return pSBWnd->SBCalc.pos; + + case SBM_GETRANGE: + *(LPINT)wParam = pSBWnd->SBCalc.posMin; + *(LPINT)lParam = pSBWnd->SBCalc.posMax; + // This message does not return a value. return 0; - - case SBM_GETRANGE: - return IntScrollGetScrollRange(Wnd, SB_CTL, (LPINT) wParam, (LPINT) lParam); case SBM_ENABLE_ARROWS: return EnableScrollBar( Wnd, SB_CTL, wParam ); + case SBM_SETPOS: + { + ScrollInfo.cbSize = sizeof(SCROLLINFO); + ScrollInfo.fMask = SIF_POS|SIF_PREVIOUSPOS; + ScrollInfo.nPos = wParam; + return IntSetScrollInfo(Wnd, &ScrollInfo, lParam); + } + + case SBM_SETRANGEREDRAW: + case SBM_SETRANGE: + { + ScrollInfo.cbSize = sizeof(SCROLLINFO); + ScrollInfo.fMask = SIF_RANGE|SIF_PREVIOUSPOS; + ScrollInfo.nMin = wParam; + ScrollInfo.nMax = lParam; + return IntSetScrollInfo(Wnd, &ScrollInfo, Msg == SBM_SETRANGEREDRAW ? TRUE : FALSE); + } + case SBM_SETSCROLLINFO: - return NtUserSetScrollInfo(Wnd, SB_CTL, (SCROLLINFO *) lParam, wParam); + return IntSetScrollInfo(Wnd, (LPCSCROLLINFO)lParam, wParam); case SBM_GETSCROLLINFO: - return NtUserSBGetParms(Wnd, SB_CTL, NULL, (SCROLLINFO *) lParam); - + { + PSBDATA pSBData = (PSBDATA)&pSBWnd->SBCalc; + DWORD ret = NtUserSBGetParms(Wnd, SB_CTL, pSBData, (SCROLLINFO *) lParam); + if (!ret) + { + ERR("SBM_GETSCROLLINFO No ScrollInfo\n"); + } + return ret; + } case SBM_GETSCROLLBARINFO: ((PSCROLLBARINFO)lParam)->cbSize = sizeof(SCROLLBARINFO); return NtUserGetScrollBarInfo(Wnd, OBJID_CLIENT, (PSCROLLBARINFO)lParam); @@ -1496,8 +1437,7 @@ if (!Hook) { Ret = NtUserEnableScrollBar(hwnd, nBar, flags); - if (GetLastError() == ERROR_INVALID_PARAMETER) return Ret; - if (nBar == SB_CTL) return Ret; + if (!Ret) return Ret; SCROLL_RefreshScrollBar( hwnd, nBar, TRUE, TRUE ); return Ret; } @@ -1519,7 +1459,7 @@ RealGetScrollInfo(HWND Wnd, INT SBType, LPSCROLLINFO Info) { PWND pWnd; - PSBDATA pSBData = NULL; + PSBDATA pSBData; if (SB_CTL == SBType) { @@ -1534,7 +1474,12 @@ SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - // FIXME add support to set pSBData from pWnd->pSBInfo + if (!pWnd->pSBInfo) + { + SetLastError(ERROR_NO_SCROLLBARS); + return FALSE; + } + pSBData = IntGetSBData(pWnd, SBType); return NtUserSBGetParms(Wnd, SBType, pSBData, Info); } @@ -1573,17 +1518,33 @@ INT WINAPI GetScrollPos(HWND Wnd, INT Bar) { + PWND pwnd; + PSBDATA pSBData; + TRACE("Wnd=%p Bar=%d\n", Wnd, Bar); /* Refer SB_CTL requests to the window */ if (SB_CTL == Bar) - { + { return SendMessageW(Wnd, SBM_GETPOS, (WPARAM) 0, (LPARAM) 0); - } - else - { - return IntScrollGetScrollPos(Wnd, Bar); - } + } + else if (Bar == SB_HORZ || Bar == SB_VERT ) + { + pwnd = ValidateHwnd(Wnd); + if (!pwnd) return 0; + + if (pwnd->pSBInfo) + { + pSBData = IntGetSBData(pwnd, Bar); + return pSBData->pos; + } + + SetLastError(ERROR_NO_SCROLLBARS); + ERR("GetScrollPos No Scroll Info\n"); + return 0; + } + SetLastError(ERROR_INVALID_PARAMETER); + return 0; } /* @@ -1592,17 +1553,37 @@ BOOL WINAPI GetScrollRange(HWND Wnd, int Bar, LPINT MinPos, LPINT MaxPos) { + PWND pwnd; + PSBDATA pSBData; + TRACE("Wnd=%x Bar=%d Min=%p Max=%p\n", Wnd, Bar, MinPos, MaxPos); /* Refer SB_CTL requests to the window */ if (SB_CTL == Bar) - { + { return SendMessageW(Wnd, SBM_GETRANGE, (WPARAM) MinPos, (LPARAM) MaxPos); - } - else - { - return IntScrollGetScrollRange(Wnd, Bar, MinPos, MaxPos); - } + } + else if (Bar == SB_HORZ || Bar == SB_VERT ) + { + pwnd = ValidateHwnd(Wnd); + if (!pwnd) return FALSE; + + if (pwnd->pSBInfo) + { + pSBData = IntGetSBData(pwnd, Bar); + *MinPos = pSBData->posMin; + *MaxPos = pSBData->posMax; + } + else + { + SetLastError(ERROR_NO_SCROLLBARS); + *MinPos = 0; + *MaxPos = 0; + } + return TRUE; + } + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; } INT WINAPI @@ -1655,32 +1636,13 @@ INT WINAPI SetScrollPos(HWND hWnd, INT nBar, INT nPos, BOOL bRedraw) { - PWND pWnd; - INT Result = 0; SCROLLINFO ScrollInfo; - pWnd = ValidateHwnd(hWnd); - if ( !pWnd || !pWnd->pSBInfo ) return 0; - ScrollInfo.cbSize = sizeof(SCROLLINFO); - ScrollInfo.fMask = SIF_POS; - - /* - * Call NtUserSBGetParms() to get the previous position that - * we will later return. - */ - if (NtUserSBGetParms(hWnd, nBar, NULL, &ScrollInfo)) - { - Result = ScrollInfo.nPos; - if (Result != nPos) - { - ScrollInfo.nPos = nPos; - /* Finally set the new position */ - NtUserSetScrollInfo(hWnd, nBar, &ScrollInfo, bRedraw); - } - } - - return Result; + ScrollInfo.fMask = SIF_POS|SIF_PREVIOUSPOS; + ScrollInfo.nPos = nPos; + + return RealSetScrollInfo(hWnd, nBar, &ScrollInfo, bRedraw); } /* @@ -1706,6 +1668,5 @@ ScrollInfo.nMin = nMinPos; ScrollInfo.nMax = nMaxPos; SetScrollInfo(hWnd, nBar, &ScrollInfo, bRedraw); // do not bypass themes. - return TRUE; }
12 years, 4 months
1
0
0
0
[fireball] 57090: [ADVAPI32] - Cleanup and update source code header.
by fireball@svn.reactos.org
Author: fireball Date: Fri Aug 17 12:47:29 2012 New Revision: 57090 URL:
http://svn.reactos.org/svn/reactos?rev=57090&view=rev
Log: [ADVAPI32] - Cleanup and update source code header. Modified: trunk/reactos/dll/win32/advapi32/misc/shutdown.c Modified: trunk/reactos/dll/win32/advapi32/misc/shutdown.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/misc/sh…
============================================================================== --- trunk/reactos/dll/win32/advapi32/misc/shutdown.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/misc/shutdown.c [iso-8859-1] Fri Aug 17 12:47:29 2012 @@ -1,13 +1,10 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory +/* + * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries - * FILE: lib/advapi32/misc/shutdown.c + * FILE: dll/win32/advapi32/misc/shutdown.c * PURPOSE: System shutdown functions - * PROGRAMMER: Emanuele Aliberti - * UPDATE HISTORY: - * 19990413 EA created - * 19990515 EA + * PROGRAMMER: Lee Schroeder <spaceseel at gmail dot com> + * Emanuele Aliberti */ #include <advapi32.h>
12 years, 4 months
1
0
0
0
[fireball] 57089: [ADVAPI32] Patch by milawynsrealm: * Implemented the beginnings of InitiateShutdownA/W (nothing works yet, and it's not exported). * Running InitiateSystemShutdownA/W invokes Init...
by fireball@svn.reactos.org
Author: fireball Date: Thu Aug 16 22:14:49 2012 New Revision: 57089 URL:
http://svn.reactos.org/svn/reactos?rev=57089&view=rev
Log: [ADVAPI32] Patch by milawynsrealm: * Implemented the beginnings of InitiateShutdownA/W (nothing works yet, and it's not exported). * Running InitiateSystemShutdownA/W invokes InitiateSystemShutdownExA/W while using "Other (Planned)" as the reason code. - The "Other (Planned)" reason code seemed to be the best default option so far. Let me know if you feel otherwise. * Added the shutdown flags that are used for InitiateShutdownA/W inside of winreg.h. * Include the reason.h header inside the winreg.h header so that the reason codes can be properly called. This conforms to the VC2010 method of adding this support. * Added the declarations for InitiateSystemShutdownExA/W and InitiateShutdownA/W inside of winreg.h. * In winuser.h, change the definitions for EWX_* to conform to MSDN documentation -
http://msdn.microsoft.com/en-us/library/windows/desktop/aa376868%28v=vs.85%…
* Added definition support for EWX_HYBRID_SHUTDOWN which is found in Windows 8. * Calling InitiateSystemShutdownExA will convert strings to UNICODE and send it over to InitiateSystemShutdownExW. The same is also for InitiateShutdownA. See issue #7245 for more details. Modified: trunk/reactos/dll/win32/advapi32/misc/shutdown.c trunk/reactos/include/psdk/winreg.h trunk/reactos/include/psdk/winuser.h Modified: trunk/reactos/dll/win32/advapi32/misc/shutdown.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/misc/sh…
============================================================================== --- trunk/reactos/dll/win32/advapi32/misc/shutdown.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/misc/shutdown.c [iso-8859-1] Thu Aug 16 22:14:49 2012 @@ -55,11 +55,10 @@ return rv; } - /********************************************************************** * InitiateSystemShutdownW * - * @unimplemented + * @implemented */ BOOL WINAPI InitiateSystemShutdownW(LPWSTR lpMachineName, @@ -68,30 +67,20 @@ BOOL bForceAppsClosed, BOOL bRebootAfterShutdown) { - SHUTDOWN_ACTION Action = ShutdownNoReboot; - NTSTATUS Status; - - if (lpMachineName) - { - /* FIXME: remote machine shutdown not supported yet */ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; - } - - if (dwTimeout) - { - } - - Status = NtShutdownSystem(Action); - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; -} - + return InitiateSystemShutdownExW(lpMachineName, + lpMessage, + dwTimeout, + bForceAppsClosed, + bRebootAfterShutdown, + SHTDN_REASON_MAJOR_OTHER | + SHTDN_REASON_MINOR_OTHER | + SHTDN_REASON_FLAG_PLANNED); +} /********************************************************************** * InitiateSystemShutdownA * - * @unimplemented + * @implemented */ BOOL WINAPI @@ -101,68 +90,20 @@ BOOL bForceAppsClosed, BOOL bRebootAfterShutdown) { - ANSI_STRING MachineNameA; - ANSI_STRING MessageA; - UNICODE_STRING MachineNameW; - UNICODE_STRING MessageW; - NTSTATUS Status; - INT LastError; - BOOL rv; - - MachineNameW.Buffer = NULL; - MessageW.Buffer = NULL; - - if (lpMachineName) - { - RtlInitAnsiString(&MachineNameA, lpMachineName); - Status = RtlAnsiStringToUnicodeString(&MachineNameW, &MachineNameA, TRUE); - if (STATUS_SUCCESS != Status) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - } - - if (lpMessage) - { - RtlInitAnsiString(&MessageA, lpMessage); - Status = RtlAnsiStringToUnicodeString(&MessageW, &MessageA, TRUE); - if (STATUS_SUCCESS != Status) - { - if (MachineNameW.Buffer) - { - RtlFreeUnicodeString(&MachineNameW); - } - - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - } - - rv = InitiateSystemShutdownW(MachineNameW.Buffer, - MessageW.Buffer, - dwTimeout, - bForceAppsClosed, - bRebootAfterShutdown); - LastError = GetLastError(); - if (lpMachineName) - { - RtlFreeUnicodeString(&MachineNameW); - } - - if (lpMessage) - { - RtlFreeUnicodeString(&MessageW); - } - - SetLastError(LastError); - return rv; + return InitiateSystemShutdownExA(lpMachineName, + lpMessage, + dwTimeout, + bForceAppsClosed, + bRebootAfterShutdown, + SHTDN_REASON_MAJOR_OTHER | + SHTDN_REASON_MINOR_OTHER | + SHTDN_REASON_FLAG_PLANNED); } /****************************************************************************** * InitiateSystemShutdownExW [ADVAPI32.@] * - * see InitiateSystemShutdownExA + * @unimplemented */ BOOL WINAPI InitiateSystemShutdownExW(LPWSTR lpMachineName, @@ -172,10 +113,30 @@ BOOL bRebootAfterShutdown, DWORD dwReason) { - UNIMPLEMENTED; - return TRUE; -} - + SHUTDOWN_ACTION Action = ShutdownNoReboot; + NTSTATUS Status; + + if (lpMachineName) + { + /* FIXME: remote machine shutdown not supported yet */ + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; + } + + if (dwTimeout) + { + } + + Status = NtShutdownSystem(Action); + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; +} + +/****************************************************************************** + * InitiateSystemShutdownExA [ADVAPI32.@] + * + * see InitiateSystemShutdownExW + */ BOOL WINAPI InitiateSystemShutdownExA(LPSTR lpMachineName, LPSTR lpMessage, @@ -184,8 +145,139 @@ BOOL bRebootAfterShutdown, DWORD dwReason) { - UNIMPLEMENTED; - return TRUE; + ANSI_STRING MachineNameA, MessageA; + UNICODE_STRING MachineNameW, MessageW; + NTSTATUS Status; + INT LastError; + BOOL rv; + + MachineNameW.Buffer = NULL; + MessageW.Buffer = NULL; + + if (lpMachineName) + { + RtlInitAnsiString(&MachineNameA, lpMachineName); + Status = RtlAnsiStringToUnicodeString(&MachineNameW, &MachineNameA, TRUE); + if (STATUS_SUCCESS != Status) + { + if(MachineNameW.Buffer) + RtlFreeUnicodeString(&MachineNameW); + + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + } + + if (lpMessage) + { + RtlInitAnsiString(&MessageA, lpMessage); + Status = RtlAnsiStringToUnicodeString(&MessageW, &MessageA, TRUE); + if (STATUS_SUCCESS != Status) + { + if (MessageW.Buffer) + RtlFreeUnicodeString(&MessageW); + + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + } + + rv = InitiateSystemShutdownExW(MachineNameW.Buffer, + MessageW.Buffer, + dwTimeout, + bForceAppsClosed, + bRebootAfterShutdown, + dwReason); + LastError = GetLastError(); + if (lpMachineName) + RtlFreeUnicodeString(&MachineNameW); + + if (lpMessage) + RtlFreeUnicodeString(&MessageW); + + SetLastError(LastError); + return rv; +} + +/****************************************************************************** + * InitiateShutdownW [ADVAPI32.@] + * + * @unimplamented + */ +DWORD WINAPI +InitiateShutdownW(LPWSTR lpMachineName, + LPWSTR lpMessage, + DWORD dwGracePeriod, + DWORD dwShutdownFlags, + DWORD dwReason) +{ + UNIMPLEMENTED; + return ERROR_SUCCESS; +} + +/****************************************************************************** + * InitiateShutdownA [ADVAPI32.@] + * + * @unimplamented + */ +DWORD WINAPI +InitiateShutdownA(LPSTR lpMachineName, + LPSTR lpMessage, + DWORD dwGracePeriod, + DWORD dwShutdownFlags, + DWORD dwReason) +{ + ANSI_STRING MachineNameA, MessageA; + UNICODE_STRING MachineNameW, MessageW; + NTSTATUS Status; + INT LastError; + DWORD rv; + + MachineNameW.Buffer = NULL; + MessageW.Buffer = NULL; + + if (lpMachineName) + { + RtlInitAnsiString(&MachineNameA, lpMachineName); + Status = RtlAnsiStringToUnicodeString(&MachineNameW, &MachineNameA, TRUE); + if (STATUS_SUCCESS != Status) + { + if(MachineNameW.Buffer) + RtlFreeUnicodeString(&MachineNameW); + + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + } + + if (lpMessage) + { + RtlInitAnsiString(&MessageA, lpMessage); + Status = RtlAnsiStringToUnicodeString(&MessageW, &MessageA, TRUE); + if (STATUS_SUCCESS != Status) + { + if (MessageW.Buffer) + RtlFreeUnicodeString(&MessageW); + + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + } + + rv = InitiateShutdownW(MachineNameW.Buffer, + MessageW.Buffer, + dwGracePeriod, + dwShutdownFlags, + dwReason); + LastError = GetLastError(); + if (lpMachineName) + RtlFreeUnicodeString(&MachineNameW); + + if (lpMessage) + RtlFreeUnicodeString(&MessageW); + + SetLastError(LastError); + return rv; } /* EOF */ Modified: trunk/reactos/include/psdk/winreg.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winreg.h?rev=…
============================================================================== --- trunk/reactos/include/psdk/winreg.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/winreg.h [iso-8859-1] Thu Aug 16 22:14:49 2012 @@ -1,9 +1,12 @@ -#ifndef _WINREG_ -#define _WINREG_ +#ifndef _WINREG_H +#define _WINREG_H #ifdef __cplusplus extern "C" { #endif + +#include <reason.h> + #define HKEY_CLASSES_ROOT ((HKEY)0x80000000) #define HKEY_CURRENT_USER ((HKEY)0x80000001) #define HKEY_LOCAL_MACHINE ((HKEY)0x80000002) @@ -34,6 +37,16 @@ #define REG_NOTIFY_CHANGE_LAST_SET 4 #define REG_NOTIFY_CHANGE_SECURITY 8 +/* Shutdown flags for InitiateShutdownA/W */ +#define SHUTDOWN_FORCE_OTHERS 0x00000001 +#define SHUTDOWN_FORCE_SELF 0x00000002 +#define SHUTDOWN_GRACE_OVERRIDE 0x00000020 +#define SHUTDOWN_INSTALL_UPDATES 0x00000040 +#define SHUTDOWN_NOREBOOT 0x00000010 +#define SHUTDOWN_POWEROFF 0x00000008 +#define SHUTDOWN_RESTART 0x00000004 +#define SHUTDOWN_RESTARTAPPS 0x00000080 + #define RRF_RT_REG_NONE (1 << 0) #define RRF_RT_REG_SZ (1 << 1) #define RRF_RT_REG_EXPAND_SZ (1 << 2) @@ -64,8 +77,14 @@ } VALENTW,*PVALENTW; BOOL WINAPI AbortSystemShutdownA(LPCSTR); BOOL WINAPI AbortSystemShutdownW(LPCWSTR); +#if (_WIN32_WINNT >= 0x0600) +DWORD WINAPI InitiateShutdownA(LPSTR, LPSTR, DWORD, DWORD, DWORD); +DWORD WINAPI InitiateShutdownW(LPWSTR, LPWSTR, DWORD, DWORD, DWORD); +#endif BOOL WINAPI InitiateSystemShutdownA(LPSTR,LPSTR,DWORD,BOOL,BOOL); BOOL WINAPI InitiateSystemShutdownW(LPWSTR,LPWSTR,DWORD,BOOL,BOOL); +BOOL WINAPI InitiateSystemShutdownExA(LPSTR,LPSTR,DWORD,BOOL,BOOL,DWORD); +BOOL WINAPI InitiateSystemShutdownExW(LPWSTR,LPWSTR,DWORD,BOOL,BOOL,DWORD); LONG WINAPI RegCloseKey(HKEY); LONG WINAPI RegConnectRegistryA(LPCSTR,HKEY,PHKEY); LONG WINAPI RegConnectRegistryW(LPCWSTR,HKEY,PHKEY); @@ -158,8 +177,10 @@ typedef VALENTW VALENT,*PVALENT; #define AbortSystemShutdown AbortSystemShutdownW #define InitiateSystemShutdown InitiateSystemShutdownW +#define InitiateSystemShutdownEx InitiateSystemShutdownExW #define RegConnectRegistry RegConnectRegistryW #if (_WIN32_WINNT >= 0x0600) +#define InitiateShutdown InitiateShutdownW #define RegCopyTree RegCopyTreeW #endif #define RegCreateKey RegCreateKeyW @@ -201,8 +222,10 @@ typedef VALENTA VALENT,*PVALENT; #define AbortSystemShutdown AbortSystemShutdownA #define InitiateSystemShutdown InitiateSystemShutdownA +#define InitiateSystemShutdownEx InitiateSystemShutdownExA #define RegConnectRegistry RegConnectRegistryA #if (_WIN32_WINNT >= 0x0600) +#define InitiateShutdown InitiateShutdownA #define RegCopyTree RegCopyTreeA #endif #define RegCreateKey RegCreateKeyA Modified: trunk/reactos/include/psdk/winuser.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winuser.h?rev…
============================================================================== --- trunk/reactos/include/psdk/winuser.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/winuser.h [iso-8859-1] Thu Aug 16 22:14:49 2012 @@ -613,13 +613,16 @@ #define ISOLATIONAWARE_MANIFEST_RESOURCE_ID 2 #define ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID 3 #endif -#define EWX_FORCE 4 +#define EWX_FORCE 0x00000004 #define EWX_LOGOFF 0 -#define EWX_POWEROFF 8 -#define EWX_REBOOT 2 -#define EWX_SHUTDOWN 1 +#define EWX_POWEROFF 0x00000008 +#define EWX_REBOOT 0x00000002 +#define EWX_SHUTDOWN 0x00000001 #if (_WIN32_WINNT >= 0x0500) -#define EWX_FORCEIFHUNG 16 +#define EWX_FORCEIFHUNG 0x00000010 +#endif +#if (_WIN32_WINNT > 0x06010000) +#define EWX_HYBRID_SHUTDOWN 0x00400000 #endif #define CS_BYTEALIGNCLIENT 4096 #define CS_BYTEALIGNWINDOW 8192
12 years, 4 months
1
0
0
0
← Newer
1
...
9
10
11
12
13
14
15
...
20
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Results per page:
10
25
50
100
200