Commit 0124576c authored by François Gouget's avatar François Gouget Committed by Alexandre Julliard

Be smarter about the ellipsis in SPY_GetWndName.

parent 4188fbcb
...@@ -1444,23 +1444,27 @@ const char *SPY_GetWndName( HWND hwnd ) ...@@ -1444,23 +1444,27 @@ const char *SPY_GetWndName( HWND hwnd )
WND* pWnd = WIN_FindWndPtr( hwnd ); WND* pWnd = WIN_FindWndPtr( hwnd );
if( pWnd ) if( pWnd )
{ {
INT n = sizeof(wnd_buffer) - 6;
LPSTR p = wnd_buffer; LPSTR p = wnd_buffer;
char postfix; char postfix;
if( pWnd->text && pWnd->text[0] != '\0' ) if( pWnd->text && pWnd->text[0] != '\0' )
{ {
LPWSTR src = pWnd->text; LPWSTR src = pWnd->text;
int n=sizeof(wnd_buffer)-2;
*(p++) = postfix = '\"'; *(p++) = postfix = '\"';
while ((n-- > 1) && *src) *p++ = *src++; while ((n-- > 0) && *src) *p++ = *src++;
if( *src ) for( n = 0; n < 3; n++ ) *(p++)='.';
} }
else /* get class name */ else /* get class name */
{ {
*(p++)='{'; *(p++) = '{';
GlobalGetAtomNameA((ATOM) GetClassWord(pWnd->hwndSelf, GCW_ATOM), p, n + 1); p+=GlobalGetAtomNameA((ATOM) GetClassWord(pWnd->hwndSelf, GCW_ATOM), p, sizeof(wnd_buffer)-1);
p += strlen(p); postfix='}';
postfix = '}'; }
if( p-wnd_buffer == sizeof(wnd_buffer)-1 ) {
p=wnd_buffer+sizeof(wnd_buffer)-5;
*(p++) = '.';
*(p++) = '.';
*(p++) = '.';
} }
*(p++) = postfix; *(p++) = postfix;
*(p++) = '\0'; *(p++) = '\0';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment