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
July 2018
----- 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
17 participants
89 discussions
Start a n
N
ew thread
01/01: [WIN32SS] Add 5 members to FONTGDI structure
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=30830ca96399724915aa2…
commit 30830ca96399724915aa20a43a42fb8d850a1aff Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sat Jul 28 23:24:26 2018 +0900 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Jul 29 13:11:48 2018 +0200 [WIN32SS] Add 5 members to FONTGDI structure --- win32ss/gdi/eng/engobjects.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/win32ss/gdi/eng/engobjects.h b/win32ss/gdi/eng/engobjects.h index 348774bba5..c79832aff9 100644 --- a/win32ss/gdi/eng/engobjects.h +++ b/win32ss/gdi/eng/engobjects.h @@ -153,6 +153,13 @@ typedef struct _FONTGDI { BYTE OriginalItalic; LONG OriginalWeight; BYTE CharSet; + + /* Precomputed font metrics (supplements FreeType metrics) */ + LONG tmHeight; + LONG tmAscent; + LONG tmDescent; + LONG tmInternalLeading; + LONG EmHeight; } FONTGDI, *PFONTGDI; typedef struct _PATHGDI {
6 years, 4 months
1
0
0
0
01/01: [WIN32SS][FONT] Change the type of 2nd argument of IntRequestFontSize
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5e1a099cd109e6c54d795…
commit 5e1a099cd109e6c54d795ecdd377a9450d3f1721 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sat Jul 28 23:37:03 2018 +0900 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Jul 29 13:11:18 2018 +0200 [WIN32SS][FONT] Change the type of 2nd argument of IntRequestFontSize --- win32ss/gdi/ntgdi/freetype.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/win32ss/gdi/ntgdi/freetype.c b/win32ss/gdi/ntgdi/freetype.c index 4ae74fced1..efc3ad316a 100644 --- a/win32ss/gdi/ntgdi/freetype.c +++ b/win32ss/gdi/ntgdi/freetype.c @@ -2995,9 +2995,10 @@ static unsigned int get_bezier_glyph_outline(FT_Outline *outline, unsigned int b } static INT -IntRequestFontSize(PDC dc, FT_Face face, LONG Width, LONG Height) +IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG Width, LONG Height) { FT_Size_RequestRec req; + FT_Face face = FontGDI->SharedFace->Face; if (Width < 0) Width = -Width; @@ -3079,7 +3080,7 @@ TextIntUpdateSize(PDC dc, plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont; - error = IntRequestFontSize(dc, face, plf->lfWidth, plf->lfHeight); + error = IntRequestFontSize(dc, FontGDI, plf->lfWidth, plf->lfHeight); if (bDoLock) IntUnLockFreeType(); @@ -3918,7 +3919,7 @@ ftGdiGetTextMetricsW( Face = FontGDI->SharedFace->Face; IntLockFreeType(); - Error = IntRequestFontSize(dc, Face, plf->lfWidth, plf->lfHeight); + Error = IntRequestFontSize(dc, FontGDI, plf->lfWidth, plf->lfHeight); FtSetCoordinateTransform(Face, DC_pmxWorldToDevice(dc)); IntUnLockFreeType(); if (0 != Error) @@ -6085,7 +6086,7 @@ NtGdiGetCharABCWidthsW( plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont; IntLockFreeType(); - IntRequestFontSize(dc, face, plf->lfWidth, plf->lfHeight); + IntRequestFontSize(dc, FontGDI, plf->lfWidth, plf->lfHeight); FtSetCoordinateTransform(face, pmxWorldToDevice); for (i = FirstChar; i < FirstChar+Count; i++) @@ -6281,7 +6282,7 @@ NtGdiGetCharWidthW( plf = &TextObj->logfont.elfEnumLogfontEx.elfLogFont; IntLockFreeType(); - IntRequestFontSize(dc, face, plf->lfWidth, plf->lfHeight); + IntRequestFontSize(dc, FontGDI, plf->lfWidth, plf->lfHeight); FtSetCoordinateTransform(face, pmxWorldToDevice); for (i = FirstChar; i < FirstChar+Count; i++)
6 years, 4 months
1
0
0
0
01/01: [RPCRT4] Update the support for remote pipes which was dropped by the sync to Wine Staging 2.9 and update rpcrt4_ros.diff accordingly
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=24cd7bbe0bca5d4b1e87e…
commit 24cd7bbe0bca5d4b1e87e8ed5cfd9d53a0cbc660 Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sun Jul 29 07:30:43 2018 +0200 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sun Jul 29 07:30:43 2018 +0200 [RPCRT4] Update the support for remote pipes which was dropped by the sync to Wine Staging 2.9 and update rpcrt4_ros.diff accordingly --- dll/win32/rpcrt4/rpc_transport.c | 24 ++- dll/win32/rpcrt4/rpcrt4_ros.diff | 427 +++++++++++++-------------------------- 2 files changed, 161 insertions(+), 290 deletions(-) diff --git a/dll/win32/rpcrt4/rpc_transport.c b/dll/win32/rpcrt4/rpc_transport.c index 8d8a7be3af..7672ce3ef5 100644 --- a/dll/win32/rpcrt4/rpc_transport.c +++ b/dll/win32/rpcrt4/rpc_transport.c @@ -258,14 +258,24 @@ static RPC_STATUS rpcrt4_protseq_ncalrpc_open_endpoint(RpcServerProtseq* protseq return r; } -static char *ncacn_pipe_name(const char *endpoint) +static char *ncacn_pipe_name(const char *server, const char *endpoint) { - static const char prefix[] = "\\\\."; + static const char prefix[] = "\\\\"; + static const char local[] = "."; + char ComputerName[MAX_COMPUTERNAME_LENGTH + 1]; char *pipe_name; + DWORD bufLen = ARRAYSIZE(ComputerName); + + GetComputerNameA(ComputerName, &bufLen); + + if (server == NULL || *server == 0 || stricmp(ComputerName, server) == 0) + server = local; /* protseq=ncacn_np: named pipes */ - pipe_name = I_RpcAllocate(sizeof(prefix) + strlen(endpoint)); - strcat(strcpy(pipe_name, prefix), endpoint); + pipe_name = I_RpcAllocate(sizeof(prefix) + strlen(server) + strlen(endpoint)); + strcpy(pipe_name, prefix); + strcat(pipe_name, server); + strcat(pipe_name, endpoint); return pipe_name; } @@ -279,7 +289,7 @@ static RPC_STATUS rpcrt4_ncacn_np_open(RpcConnection* Connection) if (npc->pipe) return RPC_S_OK; - pname = ncacn_pipe_name(Connection->Endpoint); + pname = ncacn_pipe_name(Connection->NetworkAddr, Connection->Endpoint); r = rpcrt4_conn_open_pipe(Connection, pname, FALSE); I_RpcFree(pname); @@ -307,7 +317,7 @@ static RPC_STATUS rpcrt4_protseq_ncacn_np_open_endpoint(RpcServerProtseq *protse if (r != RPC_S_OK) return r; - ((RpcConnection_np*)Connection)->listen_pipe = ncacn_pipe_name(Connection->Endpoint); + ((RpcConnection_np*)Connection)->listen_pipe = ncacn_pipe_name(NULL, Connection->Endpoint); r = rpcrt4_conn_create_pipe(Connection); EnterCriticalSection(&protseq->cs); @@ -358,7 +368,7 @@ static RPC_STATUS rpcrt4_ncacn_np_is_server_listening(const char *endpoint) char *pipe_name; RPC_STATUS status; - pipe_name = ncacn_pipe_name(endpoint); + pipe_name = ncacn_pipe_name(NULL, endpoint); status = is_pipe_listening(pipe_name); I_RpcFree(pipe_name); return status; diff --git a/dll/win32/rpcrt4/rpcrt4_ros.diff b/dll/win32/rpcrt4/rpcrt4_ros.diff index 6441791035..ea7412c191 100644 --- a/dll/win32/rpcrt4/rpcrt4_ros.diff +++ b/dll/win32/rpcrt4/rpcrt4_ros.diff @@ -63,9 +63,35 @@ diff -pudN e:\wine\dlls\rpcrt4/rpc_epmap.c e:\reactos\dll\win32\rpcrt4/rpc_epmap case EXCEPTION_ACCESS_VIOLATION: case EXCEPTION_ILLEGAL_INSTRUCTION: diff -pudN e:\wine\dlls\rpcrt4/rpc_transport.c e:\reactos\dll\win32\rpcrt4/rpc_transport.c ---- e:\wine\dlls\rpcrt4/rpc_transport.c 2016-11-16 17:33:13 +0100 -+++ e:\reactos\dll\win32\rpcrt4/rpc_transport.c 2016-11-17 00:00:46 +0100 -@@ -82,6 +79,7 @@ +--- e:\wine\dlls\rpcrt4/rpc_transport.c 2018-07-28 18:12:19 +0000 ++++ e:\reactos\dll\win32\rpcrt4/rpc_transport.c 2018-07-28 18:28:54 +0000 +@@ -25,6 +25,9 @@ + + #include "ntstatus.h" + #define WIN32_NO_STATUS ++#ifdef __REACTOS__ ++#define NONAMELESSUNION ++#endif + #include "ws2tcpip.h" + + #include <stdarg.h> +@@ -32,12 +35,14 @@ + #include <string.h> + #include <assert.h> + ++ ++ + #include "windef.h" + #include "winbase.h" + #include "winnls.h" + #include "winerror.h" + #include "wininet.h" +-#include "winternl.h" ++#include "wine/winternl.h" + #include "winioctl.h" + #include "wine/unicode.h" + +@@ -54,10 +59,26 @@ #define DEFAULT_NCACN_HTTP_TIMEOUT (60 * 1000) @@ -73,302 +99,137 @@ diff -pudN e:\wine\dlls\rpcrt4/rpc_transport.c e:\reactos\dll\win32\rpcrt4/rpc_t #define ARRAYSIZE(a) (sizeof((a)) / sizeof((a)[0])) WINE_DEFAULT_DEBUG_CHANNEL(rpc); -@@ -94,31 +92,41 @@ typedef struct _RpcConnection_np - { - RpcConnection common; - HANDLE pipe; -- HANDLE listen_thread; -+ OVERLAPPED ovl; - BOOL listening; - } RpcConnection_np; - static RpcConnection *rpcrt4_conn_np_alloc(void) - { - RpcConnection_np *npc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RpcConnection_np)); -+ if (npc) -+ { -+ npc->pipe = NULL; -+ memset(&npc->ovl, 0, sizeof(npc->ovl)); -+ npc->listening = FALSE; -+ } - return &npc->common; - } - --static DWORD CALLBACK listen_thread(void *arg) -+static RPC_STATUS rpcrt4_conn_listen_pipe(RpcConnection_np *npc) - { -- RpcConnection_np *npc = arg; -+ if (npc->listening) -+ return RPC_S_OK; ++#ifdef __REACTOS__ /* FIXME: Inspect */ ++BOOL WINAPI CancelIoEx(HANDLE handle, LPOVERLAPPED lpOverlapped) ++{ ++ IO_STATUS_BLOCK io_status; + -+ npc->listening = TRUE; - for (;;) - { -- if (ConnectNamedPipe(npc->pipe, NULL)) -+ if (ConnectNamedPipe(npc->pipe, &npc->ovl)) - return RPC_S_OK; - - switch(GetLastError()) - { - case ERROR_PIPE_CONNECTED: -+ SetEvent(npc->ovl.hEvent); -+ return RPC_S_OK; -+ case ERROR_IO_PENDING: -+ /* will be completed in rpcrt4_protseq_np_wait_for_new_connection */ - return RPC_S_OK; -- case ERROR_HANDLES_CLOSED: -- /* connection closed during listen */ -- return RPC_S_NO_CONTEXT_AVAILABLE; - case ERROR_NO_DATA_DETECTED: - /* client has disconnected, retry */ - DisconnectNamedPipe( npc->pipe ); -@@ -131,6 +139,7 @@ static DWORD CALLBACK listen_thread(void - } - } - -+#ifndef __REACTOS__ - static RPC_STATUS rpcrt4_conn_listen_pipe(RpcConnection_np *npc) - { - if (npc->listening) -@@ -146,13 +155,14 @@ static RPC_STATUS rpcrt4_conn_listen_pip - } - return RPC_S_OK; - } ++ NtCancelIoFile(handle, &io_status); ++ if (io_status.u.Status) ++ { ++ SetLastError( RtlNtStatusToDosError( io_status.u.Status ) ); ++ return FALSE; ++ } ++ return TRUE; ++} +#endif - - static RPC_STATUS rpcrt4_conn_create_pipe(RpcConnection *Connection, LPCSTR pname) - { - RpcConnection_np *npc = (RpcConnection_np *) Connection; - TRACE("listening on %s\n", pname); - -- npc->pipe = CreateNamedPipeA(pname, PIPE_ACCESS_DUPLEX, -+ npc->pipe = CreateNamedPipeA(pname, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, - PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE, - PIPE_UNLIMITED_INSTANCES, - RPC_MAX_PACKET_SIZE, RPC_MAX_PACKET_SIZE, 5000, NULL); -@@ -164,6 +174,9 @@ static RPC_STATUS rpcrt4_conn_create_pip - return RPC_S_CANT_CREATE_ENDPOINT; - } - -+ memset(&npc->ovl, 0, sizeof(npc->ovl)); -+ npc->ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); + - /* Note: we don't call ConnectNamedPipe here because it must be done in the - * server thread as the thread must be alertable */ - return RPC_S_OK; -@@ -210,6 +223,9 @@ static RPC_STATUS rpcrt4_conn_open_pipe( - if (err == ERROR_PIPE_BUSY) { - TRACE("connection failed, error=%x\n", err); - return RPC_S_SERVER_TOO_BUSY; -+ } else if (err == ERROR_BAD_NETPATH) { -+ TRACE("connection failed, error=%x\n", err); -+ return RPC_S_SERVER_UNAVAILABLE; - } - if (!wait || !WaitNamedPipeA(pname, NMPWAIT_WAIT_FOREVER)) { - err = GetLastError(); -@@ -219,9 +235,11 @@ static RPC_STATUS rpcrt4_conn_open_pipe( - } + static RpcConnection *rpcrt4_spawn_connection(RpcConnection *old_connection); - /* success */ -+ memset(&npc->ovl, 0, sizeof(npc->ovl)); - /* pipe is connected; change to message-read mode. */ - dwMode = PIPE_READMODE_MESSAGE; - SetNamedPipeHandleState(pipe, &dwMode, NULL, NULL); -+ npc->ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); - npc->pipe = pipe; + /**** ncacn_np support ****/ +@@ -237,14 +258,24 @@ static RPC_STATUS rpcrt4_protseq_ncalrpc + return r; + } - return RPC_S_OK; -@@ -304,15 +322,64 @@ static char *ncacn_pipe_name(const char - static RPC_STATUS rpcrt4_ncacn_np_open(RpcConnection* Connection) +-static char *ncacn_pipe_name(const char *endpoint) ++static char *ncacn_pipe_name(const char *server, const char *endpoint) { - RpcConnection_np *npc = (RpcConnection_np *) Connection; +- static const char prefix[] = "\\\\."; + static const char prefix[] = "\\\\"; + static const char local[] = "."; -+ BOOL bUseLocalName = TRUE; -+ CHAR ComputerName[MAX_COMPUTERNAME_LENGTH + 1]; -+ DWORD bufLen = sizeof(ComputerName)/sizeof(ComputerName[0]); - RPC_STATUS r; - LPSTR pname; -+ LPSTR NetworkAddr; -+ INT size; ++ char ComputerName[MAX_COMPUTERNAME_LENGTH + 1]; + char *pipe_name; ++ DWORD bufLen = ARRAYSIZE(ComputerName); ++ ++ GetComputerNameA(ComputerName, &bufLen); ++ ++ if (server == NULL || *server == 0 || stricmp(ComputerName, server) == 0) ++ server = local; + + /* protseq=ncacn_np: named pipes */ +- pipe_name = I_RpcAllocate(sizeof(prefix) + strlen(endpoint)); +- strcat(strcpy(pipe_name, prefix), endpoint); ++ pipe_name = I_RpcAllocate(sizeof(prefix) + strlen(server) + strlen(endpoint)); ++ strcpy(pipe_name, prefix); ++ strcat(pipe_name, server); ++ strcat(pipe_name, endpoint); + return pipe_name; + } - /* already connected? */ +@@ -258,7 +289,7 @@ static RPC_STATUS rpcrt4_ncacn_np_open(R if (npc->pipe) return RPC_S_OK; - pname = ncacn_pipe_name(Connection->Endpoint); -- r = rpcrt4_conn_open_pipe(Connection, pname, FALSE); -+ /* protseq=ncacn_np: named pipes */ -+ size = strlen(prefix); -+ -+ if (Connection->NetworkAddr == NULL || strlen(Connection->NetworkAddr) == 0) -+ { -+ bUseLocalName = TRUE; -+ size += strlen(local); -+ } -+ else -+ { -+ NetworkAddr = Connection->NetworkAddr; -+ if (NetworkAddr[0] == '\\' && NetworkAddr[1] == '\\') -+ NetworkAddr += 2; -+ -+ if (GetComputerNameA(ComputerName, &bufLen)) -+ { -+ if (stricmp(ComputerName, NetworkAddr) == 0) -+ { -+ bUseLocalName = TRUE; -+ size += strlen(local); -+ } -+ else -+ { -+ bUseLocalName = FALSE; -+ size += strlen(NetworkAddr); -+ } -+ } -+ else -+ { -+ bUseLocalName = FALSE; -+ size += strlen(NetworkAddr); -+ } -+ } -+ -+ size += strlen(Connection->Endpoint) + 1; -+ -+ pname = I_RpcAllocate(size); -+ strcpy(pname, prefix); -+ if (bUseLocalName) -+ strcat(pname, local); -+ else -+ strcat(pname, NetworkAddr); -+ strcat(pname, Connection->Endpoint); -+ r = rpcrt4_conn_open_pipe(Connection, pname, TRUE); ++ pname = ncacn_pipe_name(Connection->NetworkAddr, Connection->Endpoint); + r = rpcrt4_conn_open_pipe(Connection, pname, FALSE); I_RpcFree(pname); - return r; -@@ -358,9 +425,9 @@ static void rpcrt4_conn_np_handoff(RpcCo - * to the child, then reopen the server binding to continue listening */ - - new_npc->pipe = old_npc->pipe; -- new_npc->listen_thread = old_npc->listen_thread; -+ new_npc->ovl = old_npc->ovl; - old_npc->pipe = 0; -- old_npc->listen_thread = 0; -+ memset(&old_npc->ovl, 0, sizeof(old_npc->ovl)); - old_npc->listening = FALSE; - } - -@@ -444,20 +511,29 @@ static int rpcrt4_conn_np_read(RpcConnec - void *buffer, unsigned int count) - { - RpcConnection_np *npc = (RpcConnection_np *) Connection; -- IO_STATUS_BLOCK io_status; - char *buf = buffer; -+ BOOL ret = TRUE; - unsigned int bytes_left = count; -- NTSTATUS status; -+ OVERLAPPED ovl; -+ -+ ZeroMemory(&ovl, sizeof(ovl)); -+ ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); - - while (bytes_left) - { -- status = NtReadFile(npc->pipe, NULL, NULL, NULL, &io_status, buf, bytes_left, NULL, NULL); -- if (status && status != STATUS_BUFFER_OVERFLOW) -- return -1; -- bytes_left -= io_status.Information; -- buf += io_status.Information; -+ DWORD bytes_read; -+ ret = ReadFile(npc->pipe, buf, bytes_left, &bytes_read, &ovl); -+ if (!ret && GetLastError() == ERROR_IO_PENDING) -+ ret = GetOverlappedResult(npc->pipe, &ovl, &bytes_read, TRUE); -+ if (!ret && GetLastError() == ERROR_MORE_DATA) -+ ret = TRUE; -+ if (!ret || !bytes_read) -+ break; -+ bytes_left -= bytes_read; -+ buf += bytes_read; - } -- return count; -+ CloseHandle(ovl.hEvent); -+ return ret ? count : -1; - } - - static int rpcrt4_conn_np_write(RpcConnection *Connection, -@@ -467,16 +543,23 @@ static int rpcrt4_conn_np_write(RpcConne - const char *buf = buffer; - BOOL ret = TRUE; - unsigned int bytes_left = count; -+ OVERLAPPED ovl; -+ -+ ZeroMemory(&ovl, sizeof(ovl)); -+ ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); - - while (bytes_left) - { - DWORD bytes_written; -- ret = WriteFile(npc->pipe, buf, bytes_left, &bytes_written, NULL); -+ ret = WriteFile(npc->pipe, buf, bytes_left, &bytes_written, &ovl); -+ if (!ret && GetLastError() == ERROR_IO_PENDING) -+ ret = GetOverlappedResult(npc->pipe, &ovl, &bytes_written, TRUE); - if (!ret || !bytes_written) - break; - bytes_left -= bytes_written; - buf += bytes_written; - } -+ CloseHandle(ovl.hEvent); - return ret ? count : -1; - } - -@@ -488,9 +571,9 @@ static int rpcrt4_conn_np_close(RpcConne - CloseHandle(npc->pipe); - npc->pipe = 0; - } -- if (npc->listen_thread) { -- CloseHandle(npc->listen_thread); -- npc->listen_thread = 0; -+ if (npc->ovl.hEvent) { -+ CloseHandle(npc->ovl.hEvent); -+ npc->ovl.hEvent = 0; - } - return 0; - } -@@ -694,7 +777,7 @@ static void *rpcrt4_protseq_np_get_wait_ - conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common); - while (conn) { - rpcrt4_conn_listen_pipe(conn); -- if (conn->listen_thread) -+ if (conn->ovl.hEvent) - (*count)++; - conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common); +@@ -286,7 +317,7 @@ static RPC_STATUS rpcrt4_protseq_ncacn_n + if (r != RPC_S_OK) + return r; + +- ((RpcConnection_np*)Connection)->listen_pipe = ncacn_pipe_name(Connection->Endpoint); ++ ((RpcConnection_np*)Connection)->listen_pipe = ncacn_pipe_name(NULL, Connection->Endpoint); + r = rpcrt4_conn_create_pipe(Connection); + + EnterCriticalSection(&protseq->cs); +@@ -337,7 +368,7 @@ static RPC_STATUS rpcrt4_ncacn_np_is_ser + char *pipe_name; + RPC_STATUS status; + +- pipe_name = ncacn_pipe_name(endpoint); ++ pipe_name = ncacn_pipe_name(NULL, endpoint); + status = is_pipe_listening(pipe_name); + I_RpcFree(pipe_name); + return status; +@@ -395,10 +426,14 @@ static int rpcrt4_conn_np_read(RpcConnec + if (connection->read_closed) + { + IO_STATUS_BLOCK io_status; ++#ifdef __REACTOS__ /* FIXME: We should also cancel I/O for other threads */ ++ NtCancelIoFile(connection->pipe, &io_status); ++#else + NtCancelIoFileEx(connection->pipe, &connection->io_status, &io_status); ++#endif + } + WaitForSingleObject(event, INFINITE); +- status = connection->io_status.Status; ++ status = connection->io_status.u.Status; } -@@ -715,7 +798,7 @@ static void *rpcrt4_protseq_np_get_wait_ - *count = 1; - conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common); - while (conn) { -- if ((objs[*count] = conn->listen_thread)) -+ if ((objs[*count] = conn->ovl.hEvent)) - (*count)++; - conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common); + release_np_event(connection, event); + return status && status != STATUS_BUFFER_OVERFLOW ? -1 : connection->io_status.Information; +@@ -419,7 +454,7 @@ static int rpcrt4_conn_np_write(RpcConne + if (status == STATUS_PENDING) + { + WaitForSingleObject(event, INFINITE); +- status = io_status.Status; ++ status = io_status.u.Status; } -@@ -762,18 +845,12 @@ static int rpcrt4_protseq_np_wait_for_ne - EnterCriticalSection(&protseq->cs); - conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common); - while (conn) { -- if (b_handle == conn->listen_thread) break; -+ if (b_handle == conn->ovl.hEvent) break; - conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common); + release_np_event(connection, event); + if (status) +@@ -457,7 +492,11 @@ static void rpcrt4_conn_np_close_read(Rp + IO_STATUS_BLOCK io_status; + + connection->read_closed = TRUE; ++#ifdef __REACTOS__ /* FIXME: We should also cancel I/O for other threads */ ++ NtCancelIoFile(connection->pipe, &io_status); ++#else + NtCancelIoFileEx(connection->pipe, &connection->io_status, &io_status); ++#endif + } + + static void rpcrt4_conn_np_cancel_call(RpcConnection *conn) +@@ -675,7 +714,7 @@ static void *rpcrt4_protseq_np_get_wait_ + { + case STATUS_SUCCESS: + case STATUS_PIPE_CONNECTED: +- conn->io_status.Status = status; ++ conn->io_status.u.Status = status; + SetEvent(event); + break; + case STATUS_PENDING: +@@ -756,10 +795,10 @@ static int rpcrt4_protseq_np_wait_for_ne + { + release_np_event(conn, conn->listen_event); + conn->listen_event = NULL; +- if (conn->io_status.Status == STATUS_SUCCESS || conn->io_status.Status == STATUS_PIPE_CONNECTED) ++ if (conn->io_status.u.Status == STATUS_SUCCESS || conn->io_status.u.Status == STATUS_PIPE_CONNECTED) + cconn = rpcrt4_spawn_connection(&conn->common); + else +- ERR("listen failed %x\n", conn->io_status.Status); ++ ERR("listen failed %x\n", conn->io_status.u.Status); + break; + } } - cconn = NULL; - if (conn) -- { -- DWORD exit_code; -- if (GetExitCodeThread(conn->listen_thread, &exit_code) && exit_code == RPC_S_OK) -- RPCRT4_SpawnConnection(&cconn, &conn->common); -- CloseHandle(conn->listen_thread); -- conn->listen_thread = 0; -- } -+ RPCRT4_SpawnConnection(&cconn, &conn->common); - else - ERR("failed to locate connection for handle %p\n", b_handle); - LeaveCriticalSection(&protseq->cs);
6 years, 4 months
1
0
0
0
01/01: [ROSDDT] do_update_base(): Fix assignment to f (#702)
by Serge Gautherie
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8f440355da10c594bcc1f…
commit 8f440355da10c594bcc1fbae6331ad9da8fcbb99 Author: Serge Gautherie <32623169+SergeGautherie(a)users.noreply.github.com> AuthorDate: Fri Jul 27 21:54:12 2018 +0200 Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org> CommitDate: Fri Jul 27 21:54:12 2018 +0200 [ROSDDT] do_update_base(): Fix assignment to f (#702) Thanks to "devpao" for reporting this. ROSAPPS-343 --- modules/rosapps/applications/sysutils/rosddt/rosddt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/rosapps/applications/sysutils/rosddt/rosddt.c b/modules/rosapps/applications/sysutils/rosddt/rosddt.c index 7e06fc9834..d64fdd23b0 100644 --- a/modules/rosapps/applications/sysutils/rosddt/rosddt.c +++ b/modules/rosapps/applications/sysutils/rosddt/rosddt.c @@ -146,7 +146,7 @@ static void do_update_base() wchar_t up_url[MAX_PATH]; void *data = NULL; u_long size; - FILE *f = NULL; + FILE *f; if (GetPrivateProfileString(L"URL", L"udpate", NULL, up_url, MAX_PATH, gl_ini_file) == 0) { wprintf(L"Update URL not found in rosddt.ini\n"); return; @@ -156,7 +156,8 @@ static void do_update_base() if (data == http_get(up_url, &size)) { - if (f == _wfopen(gl_ini_file, L"wb")) { + f = _wfopen(gl_ini_file, L"wb"); + if (f) { fwrite(data, 1, size, f); fclose(f); wprintf(L"Update completed\n");
6 years, 4 months
1
0
0
0
01/01: [MAN] AnalyzeArgv(): Fix 2 overruns related to element (#703)
by Serge Gautherie
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d69d40132555772a1f229…
commit d69d40132555772a1f229bb3cb9f066e4890d3a3 Author: Serge Gautherie <32623169+SergeGautherie(a)users.noreply.github.com> AuthorDate: Fri Jul 27 21:53:50 2018 +0200 Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org> CommitDate: Fri Jul 27 21:53:50 2018 +0200 [MAN] AnalyzeArgv(): Fix 2 overruns related to element (#703) - Also use _countof(). - Also add braces. - Also enforce consistent "no spaces" style. Thanks to "devpao" for pointing to this function. ROSAPPS-344 --- modules/rosapps/applications/sysutils/man/man.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/rosapps/applications/sysutils/man/man.c b/modules/rosapps/applications/sysutils/man/man.c index edc12d2365..3c54eb346a 100644 --- a/modules/rosapps/applications/sysutils/man/man.c +++ b/modules/rosapps/applications/sysutils/man/man.c @@ -88,7 +88,7 @@ Usage() int AnalyzeArgv(char *argument) { - int element=0; + int element; char HelpFlag=0; char *keys[]={"--help","/h","/?","-h"}; char *sections[]={".1",".2",".3",".4",".5",".6",".7",".8",".9"}; @@ -96,25 +96,32 @@ AnalyzeArgv(char *argument) strcpy(filename,argument); //save argument value - for(element=0; element < 5;element++) + for(element=0;element<_countof(keys);element++) + { if(!strcmp(keys[element],argument)) { Usage(); HelpFlag=1; } + } element = 0; if(!HelpFlag) + { if(OpenF(filename)) - while(OpenF(strcat(filename,sections[element])) && (element<9)) + { + while(element<_countof(sections)&&OpenF(strcat(filename,sections[element]))) { strcpy(filename,argument); element++; } - if(element>8) printf("No manual for %s\n",argument); + if(element>=_countof(sections)) printf("No manual for %s\n",argument); + } + + } return element; }
6 years, 4 months
1
0
0
0
04/04: [LPK] Changes (#622).
by Baruch Rutman
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=65a5a989c587ecbf52197…
commit 65a5a989c587ecbf52197346ab1eff8ba0e5e192 Author: Baruch Rutman <peterooch(a)gmail.com> AuthorDate: Thu Jul 26 22:08:29 2018 +0300 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Fri Jul 27 00:47:48 2018 +0200 [LPK] Changes (#622). - Changed how the ScriptIsComplex check is made to account direction, most noticeble on dxdiag,
https://docs.microsoft.com/en-us/windows/desktop/api/usp10/nf-usp10-scripti…
However commented out the ScriptIsComplex flag change because of a bug. - Added a check and debug print if BIDI_Reorder fails. --- dll/win32/lpk/lpk.c | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/dll/win32/lpk/lpk.c b/dll/win32/lpk/lpk.c index 03ed3268ef..a31d9787a0 100644 --- a/dll/win32/lpk/lpk.c +++ b/dll/win32/lpk/lpk.c @@ -7,6 +7,7 @@ */ #include "ros_lpk.h" +#include <debug.h> LPK_LPEDITCONTROL_LIST LpkEditControl = {EditCreate, EditIchToXY, EditMouseToIch, EditCchInWidth, EditGetLineWidth, EditDrawText, EditHScroll, EditMoveSelection, @@ -66,28 +67,32 @@ LpkExtTextOut( LPWORD glyphs = NULL; LPWSTR reordered_str = NULL; INT cGlyphs; - BOOL bResult; + DWORD dwSICFlags = SIC_COMPLEX; + BOOL bResult, bReorder; UNREFERENCED_PARAMETER(unknown); - if (!(fuOptions & ETO_IGNORELANGUAGE)) - fuOptions |= ETO_IGNORELANGUAGE; + fuOptions |= ETO_IGNORELANGUAGE; /* Check text direction */ if ((GetLayout(hdc) & LAYOUT_RTL) || (GetTextAlign(hdc) & TA_RTLREADING)) - { - if (!(fuOptions & ETO_RTLREADING)) - fuOptions |= ETO_RTLREADING; - } + fuOptions |= ETO_RTLREADING; + + /* If text direction is RTL change flag to account neutral characters + BUG: disables reordering of propsheet titles */ + /* if (fuOptions & ETO_RTLREADING) + dwSICFlags = SIC_NEUTRAL; */ /* Check if the string requires complex script processing and not a "glyph indices" array */ - if (ScriptIsComplex(lpString, uCount, SIC_COMPLEX) == S_OK && !(fuOptions & ETO_GLYPH_INDEX)) + if (ScriptIsComplex(lpString, uCount, dwSICFlags) == S_OK && !(fuOptions & ETO_GLYPH_INDEX)) { + /* reordered_str is used as fallback in case the glyphs array fails to generate, + BIDI_Reorder doesn't attempt to write into reordered_str if memory allocation fails */ reordered_str = HeapAlloc(GetProcessHeap(), 0, uCount * sizeof(WCHAR)); - BIDI_Reorder(hdc, lpString, uCount, GCP_REORDER, - (fuOptions & ETO_RTLREADING) ? WINE_GCPW_FORCE_RTL : WINE_GCPW_FORCE_LTR, - reordered_str, uCount, NULL, &glyphs, &cGlyphs); + bReorder = BIDI_Reorder(hdc, lpString, uCount, GCP_REORDER, + (fuOptions & ETO_RTLREADING) ? WINE_GCPW_FORCE_RTL : WINE_GCPW_FORCE_LTR, + reordered_str, uCount, NULL, &glyphs, &cGlyphs); if (glyphs) { @@ -95,14 +100,17 @@ LpkExtTextOut( uCount = cGlyphs; } - if (glyphs || reordered_str) + /* Now display the reordered text if any of the arrays is valid and if BIDI_Reorder succeeded */ + if ((glyphs || reordered_str) && bReorder) { bResult = ExtTextOutW(hdc, x, y, fuOptions, lprc, glyphs ? (LPWSTR)glyphs : reordered_str, uCount, lpDx); } - else + { + DPRINT1("BIDI_Reorder failed, falling back to original string.\n"); bResult = ExtTextOutW(hdc, x, y, fuOptions, lprc, lpString, uCount, lpDx); + } HeapFree(GetProcessHeap(), 0, glyphs); HeapFree(GetProcessHeap(), 0, reordered_str); @@ -152,18 +160,17 @@ LpkGetCharacterPlacement( { if (lpGlyphs) StringCchCopyW(lpResults->lpGlyphs, cGlyphs, lpGlyphs); - else if (lpResults->lpOutString) GetGlyphIndicesW(hdc, lpResults->lpOutString, nSet, lpResults->lpGlyphs, 0); } if (lpResults->lpDx) { + int c; + /* If glyph shaping was requested */ if (dwFlags & GCP_GLYPHSHAPE) { - int c; - if (lpResults->lpGlyphs) { for (i = 0; i < lpResults->nGlyphs; i++) @@ -176,8 +183,6 @@ LpkGetCharacterPlacement( else { - int c; - for (i = 0; i < nSet; i++) { if (GetCharWidth32W(hdc, lpResults->lpOutString[i], lpResults->lpOutString[i], &c))
6 years, 5 months
1
0
0
0
03/04: [LPK] Added more error handling code (#622).
by Baruch Rutman
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e054a053ffcfada7afa1f…
commit e054a053ffcfada7afa1ff438805e530146ebb70 Author: Baruch Rutman <peterooch(a)gmail.com> AuthorDate: Mon Jun 18 17:54:15 2018 +0300 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Fri Jul 27 00:47:28 2018 +0200 [LPK] Added more error handling code (#622). - Added a codepath if both glyphs and reordered_str arrays are NULL. - Move variables back to the beginning of function. CORE-14732 --- dll/win32/lpk/lpk.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/dll/win32/lpk/lpk.c b/dll/win32/lpk/lpk.c index 85e2e8faf4..03ed3268ef 100644 --- a/dll/win32/lpk/lpk.c +++ b/dll/win32/lpk/lpk.c @@ -63,6 +63,11 @@ LpkExtTextOut( const INT *lpDx, INT unknown) { + LPWORD glyphs = NULL; + LPWSTR reordered_str = NULL; + INT cGlyphs; + BOOL bResult; + UNREFERENCED_PARAMETER(unknown); if (!(fuOptions & ETO_IGNORELANGUAGE)) @@ -78,10 +83,7 @@ LpkExtTextOut( /* Check if the string requires complex script processing and not a "glyph indices" array */ if (ScriptIsComplex(lpString, uCount, SIC_COMPLEX) == S_OK && !(fuOptions & ETO_GLYPH_INDEX)) { - LPWORD glyphs = NULL; - LPWSTR reordered_str = HeapAlloc(GetProcessHeap(), 0, uCount * sizeof(WCHAR)); - INT cGlyphs; - BOOL bResult; + reordered_str = HeapAlloc(GetProcessHeap(), 0, uCount * sizeof(WCHAR)); BIDI_Reorder(hdc, lpString, uCount, GCP_REORDER, (fuOptions & ETO_RTLREADING) ? WINE_GCPW_FORCE_RTL : WINE_GCPW_FORCE_LTR, @@ -90,13 +92,17 @@ LpkExtTextOut( if (glyphs) { fuOptions |= ETO_GLYPH_INDEX; + uCount = cGlyphs; + } - if (uCount != cGlyphs) - uCount = cGlyphs; + if (glyphs || reordered_str) + { + bResult = ExtTextOutW(hdc, x, y, fuOptions, lprc, + glyphs ? (LPWSTR)glyphs : reordered_str, uCount, lpDx); } - bResult = ExtTextOutW(hdc, x, y, fuOptions, lprc, - glyphs ? (LPWSTR)glyphs : reordered_str, uCount, lpDx); + else + bResult = ExtTextOutW(hdc, x, y, fuOptions, lprc, lpString, uCount, lpDx); HeapFree(GetProcessHeap(), 0, glyphs); HeapFree(GetProcessHeap(), 0, reordered_str);
6 years, 5 months
1
0
0
0
02/04: [LPK] Diverse fixes (#622).
by Baruch Rutman
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7fe6a14ede49276cd934b…
commit 7fe6a14ede49276cd934bca9f36bad314689ad09 Author: Baruch Rutman <peterooch(a)gmail.com> AuthorDate: Mon Jun 18 14:52:57 2018 +0300 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Fri Jul 27 00:47:14 2018 +0200 [LPK] Diverse fixes (#622). - Changed wcspy to strsafe function. - Use GetCharWidthI instead of GetCharWidth32W if dealing with glyph indices. --- dll/win32/lpk/lpk.c | 6 +++--- dll/win32/lpk/ros_lpk.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dll/win32/lpk/lpk.c b/dll/win32/lpk/lpk.c index 656808ea5b..85e2e8faf4 100644 --- a/dll/win32/lpk/lpk.c +++ b/dll/win32/lpk/lpk.c @@ -145,7 +145,7 @@ LpkGetCharacterPlacement( if (lpResults->lpGlyphs) { if (lpGlyphs) - wcscpy(lpResults->lpGlyphs, lpGlyphs); + StringCchCopyW(lpResults->lpGlyphs, cGlyphs, lpGlyphs); else if (lpResults->lpOutString) GetGlyphIndicesW(hdc, lpResults->lpOutString, nSet, lpResults->lpGlyphs, 0); @@ -154,7 +154,7 @@ LpkGetCharacterPlacement( if (lpResults->lpDx) { /* If glyph shaping was requested */ - if(dwFlags & GCP_GLYPHSHAPE) + if (dwFlags & GCP_GLYPHSHAPE) { int c; @@ -162,7 +162,7 @@ LpkGetCharacterPlacement( { for (i = 0; i < lpResults->nGlyphs; i++) { - if (GetCharWidth32W(hdc, lpResults->lpGlyphs[i], lpResults->lpGlyphs[i], &c)) + if (GetCharWidthI(hdc, 0, 1, (WORD *)&lpResults->lpGlyphs[i], &c)) lpResults->lpDx[i] = c; } } diff --git a/dll/win32/lpk/ros_lpk.h b/dll/win32/lpk/ros_lpk.h index d82a4498bc..0fb1fe341d 100644 --- a/dll/win32/lpk/ros_lpk.h +++ b/dll/win32/lpk/ros_lpk.h @@ -17,6 +17,7 @@ #include <wingdi.h> #include <winnls.h> #include <usp10.h> +#include <strsafe.h> /* FIXME USP10 api that does not have prototype in any include file */ VOID WINAPI LpkPresent(VOID);
6 years, 5 months
1
0
0
0
01/04: [LPK] Refactoring (#622).
by Baruch Rutman
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=33d3e56cf4abbe57a7b0f…
commit 33d3e56cf4abbe57a7b0f6cee682055894c92155 Author: Baruch Rutman <peterooch(a)gmail.com> AuthorDate: Mon Jun 18 12:07:16 2018 +0300 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Fri Jul 27 00:46:02 2018 +0200 [LPK] Refactoring (#622). - Moved lpDx and lpGlyphs operations to seperate brackets. - lpGlyphs == NULL checks + memory managment additions. CORE-14732 --- dll/win32/lpk/lpk.c | 67 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 44 insertions(+), 23 deletions(-) diff --git a/dll/win32/lpk/lpk.c b/dll/win32/lpk/lpk.c index fde181cc52..656808ea5b 100644 --- a/dll/win32/lpk/lpk.c +++ b/dll/win32/lpk/lpk.c @@ -63,9 +63,6 @@ LpkExtTextOut( const INT *lpDx, INT unknown) { - LPWORD glyphs = NULL; - INT cGlyphs; - UNREFERENCED_PARAMETER(unknown); if (!(fuOptions & ETO_IGNORELANGUAGE)) @@ -81,16 +78,30 @@ LpkExtTextOut( /* Check if the string requires complex script processing and not a "glyph indices" array */ if (ScriptIsComplex(lpString, uCount, SIC_COMPLEX) == S_OK && !(fuOptions & ETO_GLYPH_INDEX)) { + LPWORD glyphs = NULL; + LPWSTR reordered_str = HeapAlloc(GetProcessHeap(), 0, uCount * sizeof(WCHAR)); + INT cGlyphs; + BOOL bResult; + BIDI_Reorder(hdc, lpString, uCount, GCP_REORDER, (fuOptions & ETO_RTLREADING) ? WINE_GCPW_FORCE_RTL : WINE_GCPW_FORCE_LTR, - NULL, uCount, NULL, &glyphs, &cGlyphs); + reordered_str, uCount, NULL, &glyphs, &cGlyphs); - fuOptions |= ETO_GLYPH_INDEX; + if (glyphs) + { + fuOptions |= ETO_GLYPH_INDEX; - if (uCount > cGlyphs) - cGlyphs = uCount; + if (uCount != cGlyphs) + uCount = cGlyphs; + } - return ExtTextOutW(hdc, x, y, fuOptions, lprc, (LPWSTR)glyphs, cGlyphs, lpDx); + bResult = ExtTextOutW(hdc, x, y, fuOptions, lprc, + glyphs ? (LPWSTR)glyphs : reordered_str, uCount, lpDx); + + HeapFree(GetProcessHeap(), 0, glyphs); + HeapFree(GetProcessHeap(), 0, reordered_str); + + return bResult; } return ExtTextOutW(hdc, x, y, fuOptions, lprc, lpString, uCount, lpDx); @@ -132,28 +143,38 @@ LpkGetCharacterPlacement( lpResults->nGlyphs = (UINT)cGlyphs; if (lpResults->lpGlyphs) - wcscpy(lpResults->lpGlyphs, lpGlyphs); - - if (lpResults->lpDx && !(dwFlags & GCP_GLYPHSHAPE)) { - int c; - for (i = 0; i < nSet; i++) - { - if (GetCharWidth32W(hdc, lpResults->lpOutString[i], lpResults->lpOutString[i], &c)) - lpResults->lpDx[i] = c; - } + if (lpGlyphs) + wcscpy(lpResults->lpGlyphs, lpGlyphs); + + else if (lpResults->lpOutString) + GetGlyphIndicesW(hdc, lpResults->lpOutString, nSet, lpResults->lpGlyphs, 0); } - /* If glyph shaping was requested */ - else if (lpResults->lpDx && (dwFlags & GCP_GLYPHSHAPE)) + if (lpResults->lpDx) { - int c; + /* If glyph shaping was requested */ + if(dwFlags & GCP_GLYPHSHAPE) + { + int c; + + if (lpResults->lpGlyphs) + { + for (i = 0; i < lpResults->nGlyphs; i++) + { + if (GetCharWidth32W(hdc, lpResults->lpGlyphs[i], lpResults->lpGlyphs[i], &c)) + lpResults->lpDx[i] = c; + } + } + } - if (lpResults->lpGlyphs) + else { - for (i = 0; i < lpResults->nGlyphs; i++) + int c; + + for (i = 0; i < nSet; i++) { - if (GetCharWidth32W(hdc, lpGlyphs[i], lpGlyphs[i], &c)) + if (GetCharWidth32W(hdc, lpResults->lpOutString[i], lpResults->lpOutString[i], &c)) lpResults->lpDx[i] = c; } }
6 years, 5 months
1
0
0
0
01/01: [USER32][WIN32SS] Implement TileWindows function (#678)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bfc6b719cfccb199ce8b0…
commit bfc6b719cfccb199ce8b0f656dce174a1a9a3a79 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Thu Jul 26 21:34:00 2018 +0900 Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org> CommitDate: Thu Jul 26 14:34:00 2018 +0200 [USER32][WIN32SS] Implement TileWindows function (#678) CORE-14815 --- win32ss/user/user32/windows/mdi.c | 189 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 181 insertions(+), 8 deletions(-) diff --git a/win32ss/user/user32/windows/mdi.c b/win32ss/user/user32/windows/mdi.c index 5e892de252..5d9d8bd6ff 100644 --- a/win32ss/user/user32/windows/mdi.c +++ b/win32ss/user/user32/windows/mdi.c @@ -2047,7 +2047,7 @@ GetCascadeChildProc(HWND hwnd, LPARAM lParam) return TRUE; } -static void +static BOOL QuerySizeFix(HWND hwnd, LPINT pcx, LPINT pcy) { MINMAXINFO mmi; @@ -2060,7 +2060,9 @@ QuerySizeFix(HWND hwnd, LPINT pcx, LPINT pcy) { *pcx = min(max(*pcx, mmi.ptMinTrackSize.x), mmi.ptMaxTrackSize.x); *pcy = min(max(*pcy, mmi.ptMinTrackSize.y), mmi.ptMaxTrackSize.y); + return TRUE; } + return FALSE; } WORD WINAPI @@ -2162,9 +2164,11 @@ CascadeWindows(HWND hwndParent, UINT wFlags, LPCRECT lpRect, if (cx != cxNew || cy != cyNew) { /* too large. shrink if we can */ - QuerySizeFix(hwnd, &cxNew, &cyNew); - cx = cxNew; - cy = cyNew; + if (QuerySizeFix(hwnd, &cxNew, &cyNew)) + { + cx = cxNew; + cy = cyNew; + } } } @@ -2216,11 +2220,180 @@ WORD WINAPI CascadeChildWindows( HWND parent, UINT flags ) * Failure: 0 */ WORD WINAPI -TileWindows (HWND hwndParent, UINT wFlags, LPCRECT lpRect, - UINT cKids, const HWND *lpKids) +TileWindows(HWND hwndParent, UINT wFlags, LPCRECT lpRect, + UINT cKids, const HWND *lpKids) { - FIXME("(%p,0x%08x,...,%u,...): stub\n", hwndParent, wFlags, cKids); - return 0; + HWND hwnd, hwndTop, hwndPrev; + CASCADE_INFO info; + RECT rcWork, rcWnd; + DWORD i, iRow, iColumn, cRows, cColumns, ret = 0; + INT x, y, cx, cy, cxNew, cyNew, cxWork, cyWork, cxCell, cyCell, cxMin2, cyMin3; + HDWP hDWP; + MONITORINFO mi; + HMONITOR hMon; + POINT pt; + + TRACE("(%p,0x%08x,...,%u,...)\n", hwndParent, wFlags, cKids); + + hwndTop = GetTopWindow(hwndParent); + + ZeroMemory(&info, sizeof(info)); + info.hwndDesktop = GetDesktopWindow(); + info.hTrayWnd = FindWindowW(L"Shell_TrayWnd", NULL); + info.hwndProgman = FindWindowW(L"Progman", NULL); + info.hwndParent = hwndParent; + info.wFlags = wFlags; + + if (cKids == 0 || lpKids == NULL) + { + info.hwndTop = hwndTop; + EnumChildWindows(hwndParent, GetCascadeChildProc, (LPARAM)&info); + + info.hwndTop = NULL; + GetCascadeChildProc(hwndTop, (LPARAM)&info); + } + else + { + info.chwnd = cKids; + info.ahwnd = (HWND *)lpKids; + } + + if (info.chwnd == 0 || info.ahwnd == NULL) + return ret; + + if (lpRect) + { + rcWork = *lpRect; + } + else if (hwndParent) + { + GetClientRect(hwndParent, &rcWork); + } + else + { + pt.x = pt.y = 0; + hMon = MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY); + mi.cbSize = sizeof(mi); + GetMonitorInfoW(hMon, &mi); + rcWork = mi.rcWork; + } + + cxWork = rcWork.right - rcWork.left; + cyWork = rcWork.bottom - rcWork.top; + + cxMin2 = GetSystemMetrics(SM_CXMIN) * 2; + cyMin3 = GetSystemMetrics(SM_CYMIN) * 3; + + /* calculate the numbers and widths of columns and rows */ + if (info.wFlags & MDITILE_HORIZONTAL) + { + cColumns = info.chwnd; + cRows = 1; + for (;;) + { + cxCell = cxWork / cColumns; + cyCell = cyWork / cRows; + if (cyCell <= cyMin3 || cxCell >= cxMin2) + break; + + ++cRows; + cColumns = (info.chwnd + cRows - 1) / cRows; + } + } + else + { + cRows = info.chwnd; + cColumns = 1; + for (;;) + { + cxCell = cxWork / cColumns; + cyCell = cyWork / cRows; + if (cxCell <= cxMin2 || cyCell >= cyMin3) + break; + + ++cColumns; + cRows = (info.chwnd + cColumns - 1) / cColumns; + } + } + + hDWP = BeginDeferWindowPos(info.chwnd); + if (hDWP == NULL) + goto cleanup; + + x = rcWork.left; + y = rcWork.top; + hwndPrev = NULL; + iRow = iColumn = 0; + for (i = info.chwnd; i > 0;) /* in reverse order */ + { + --i; + hwnd = info.ahwnd[i]; + + if (IsZoomed(hwnd)) + ShowWindow(hwnd, SW_RESTORE | SW_SHOWNA); + + GetWindowRect(hwnd, &rcWnd); + cx = rcWnd.right - rcWnd.left; + cy = rcWnd.bottom - rcWnd.top; + + /* if we can change the window size */ + if (GetWindowLongPtrW(hwnd, GWL_STYLE) & WS_THICKFRAME) + { + cxNew = cxCell; + cyNew = cyCell; + /* shrink if we can */ + if (QuerySizeFix(hwnd, &cxNew, &cyNew)) + { + cx = cxNew; + cy = cyNew; + } + } + + hDWP = DeferWindowPos(hDWP, hwnd, HWND_TOP, x, y, cx, cy, SWP_NOACTIVATE); + if (hDWP == NULL) + { + ret = 0; + goto cleanup; + } + + if (info.wFlags & MDITILE_HORIZONTAL) + { + x += cxCell; + ++iColumn; + if (iColumn >= cColumns) + { + iColumn = 0; + ++iRow; + x = rcWork.left; + y += cyCell; + } + } + else + { + y += cyCell; + ++iRow; + if (iRow >= cRows) + { + iRow = 0; + ++iColumn; + x += cxCell; + y = rcWork.top; + } + } + hwndPrev = hwnd; + ++ret; + } + + EndDeferWindowPos(hDWP); + + if (hwndPrev) + SetForegroundWindow(hwndPrev); + +cleanup: + if (cKids == 0 || lpKids == NULL) + HeapFree(GetProcessHeap(), 0, info.ahwnd); + + return (WORD)ret; }
6 years, 5 months
1
0
0
0
← Newer
1
2
3
4
5
6
7
8
9
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
Results per page:
10
25
50
100
200