38 |
va_list argp; |
va_list argp; |
39 |
char buf [ 256 ]; |
char buf [ 256 ]; |
40 |
|
|
41 |
|
sprintf( buf, "DEBUG1," ); |
42 |
|
|
43 |
va_start( argp, format ); |
va_start( argp, format ); |
44 |
vsprintf( buf, format, argp ); |
vsnprintf( buf + sizeof( "DEBUG1," ) - 1, |
45 |
|
sizeof( buf ) - sizeof( "DEBUG1," ) + 1, format, argp ); |
46 |
va_end( argp ); |
va_end( argp ); |
47 |
|
|
|
WriteToChannel( "DEBUG1," ); |
|
48 |
WriteToChannel( buf ); |
WriteToChannel( buf ); |
|
WriteToChannel( "\n" ); |
|
49 |
} |
} |
50 |
|
|
51 |
|
|
118 |
if ( wp->flags & SWP_SHOWWINDOW ) { |
if ( wp->flags & SWP_SHOWWINDOW ) { |
119 |
// FIXME: Now, just like create! |
// FIXME: Now, just like create! |
120 |
SendDebug("SWP_SHOWWINDOW for %p!", details->hwnd); |
SendDebug("SWP_SHOWWINDOW for %p!", details->hwnd); |
121 |
|
WriteToChannel( "CREATE1,0x%p,0x%x", details->hwnd, 0 ); |
|
snprintf( result, sizeof( result ), |
|
|
"CREATE1,0x%p,0x%x\n", |
|
|
details->hwnd, 0 ); |
|
|
result[ sizeof( result ) - 1 ] = '\0'; |
|
|
WriteToChannel( result ); |
|
122 |
|
|
123 |
// FIXME: SETSTATE |
// FIXME: SETSTATE |
124 |
|
|
126 |
SendDebug( "GetWindowRect failed!\n" ); |
SendDebug( "GetWindowRect failed!\n" ); |
127 |
break; |
break; |
128 |
} |
} |
129 |
snprintf( result, sizeof( result ), |
WriteToChannel( "POSITION1,0x%p,%d,%d,%d,%d,0x%x", |
130 |
"POSITION1,0x%p,%d,%d,%d,%d,0x%x\n", |
details->hwnd, |
131 |
details->hwnd, |
rect.left, rect.top, |
132 |
rect.left, rect.top, |
rect.right - rect.left, |
133 |
rect.right - rect.left, |
rect.bottom - rect.top, |
134 |
rect.bottom - rect.top, |
0 ); |
|
0 ); |
|
|
result[ sizeof( result ) - 1 ] = '\0'; |
|
|
WriteToChannel( result ); |
|
|
|
|
135 |
} |
} |
136 |
|
|
137 |
|
|
138 |
if ( wp->flags & SWP_HIDEWINDOW ) { |
if ( wp->flags & SWP_HIDEWINDOW ) |
139 |
snprintf( result, sizeof( result ), |
WriteToChannel( "DESTROY1,0x%p,0x%x", details->hwnd, 0 ); |
|
"DESTROY1,0x%p,0x%x\n", |
|
|
details->hwnd, 0 ); |
|
|
result[ sizeof( result ) - 1 ] = '\0'; |
|
|
WriteToChannel( result ); |
|
|
|
|
|
} |
|
140 |
|
|
141 |
|
|
142 |
if ( !( dwStyle & WS_VISIBLE ) ) |
if ( !( dwStyle & WS_VISIBLE ) ) |
150 |
break; |
break; |
151 |
} |
} |
152 |
|
|
153 |
snprintf( result, sizeof( result ), |
WriteToChannel( "POSITION1,0x%p,%d,%d,%d,%d,0x%x", |
154 |
"POSITION1,0x%p,%d,%d,%d,%d,0x%x\n", |
details->hwnd, |
155 |
details->hwnd, |
rect.left, rect.top, |
156 |
rect.left, rect.top, |
rect.right - rect.left, |
157 |
rect.right - rect.left, |
rect.bottom - rect.top, |
158 |
rect.bottom - rect.top, |
0 ); |
|
0 ); |
|
|
result[ sizeof( result ) - 1 ] = '\0'; |
|
|
WriteToChannel( result ); |
|
159 |
|
|
160 |
break; |
break; |
161 |
|
|
175 |
if ( !( dwStyle & WS_VISIBLE ) ) |
if ( !( dwStyle & WS_VISIBLE ) ) |
176 |
break; |
break; |
177 |
|
|
178 |
if ( !( wp->flags & SWP_NOZORDER ) ) { |
if ( !( wp->flags & SWP_NOZORDER ) ) |
179 |
snprintf( result, sizeof( result ), |
WriteToChannel( "ZCHANGE1,0x%p,0x%p,0x%x", |
180 |
"ZCHANGE1,0x%p,0x%p,0x%x\n", |
details->hwnd, |
181 |
details->hwnd, |
wp->flags & SWP_NOACTIVATE ? wp->hwndInsertAfter : 0, |
182 |
wp->flags & SWP_NOACTIVATE ? wp->hwndInsertAfter : 0, |
0 ); |
183 |
0 ); |
|
|
result[ sizeof( result ) - 1 ] = '\0'; |
|
|
WriteToChannel( result ); |
|
|
} |
|
184 |
break; |
break; |
185 |
|
|
186 |
|
|
190 |
if ( dwStyle & WS_CHILD) |
if ( dwStyle & WS_CHILD) |
191 |
break; |
break; |
192 |
|
|
193 |
snprintf( result, sizeof( result ), |
WriteToChannel( "DESTROY1,0x%p,0x%x", details->hwnd, 0 ); |
|
"DESTROY1,0x%p,0x%x\n", |
|
|
details->hwnd, 0 ); |
|
|
result[ sizeof( result ) - 1 ] = '\0'; |
|
|
WriteToChannel( result ); |
|
194 |
|
|
195 |
break; |
break; |
196 |
|
|
224 |
|
|
225 |
GetWindowText( ( HWND ) wParam, windowTitle, 150 ); |
GetWindowText( ( HWND ) wParam, windowTitle, 150 ); |
226 |
|
|
227 |
snprintf( result, sizeof( result ), |
WriteToChannel( "SETSTATE1,0x%p,%s,0x%x,0x%x", |
228 |
"SETSTATE1,0x%p,%s,0x%x,0x%x\n", |
( HWND ) wParam, |
229 |
( HWND ) wParam, |
windowTitle, |
230 |
windowTitle, |
LOWORD( lParam ), |
231 |
LOWORD( lParam ), |
0 ); |
|
0 ); |
|
|
result[ sizeof( result ) - 1 ] = '\0'; |
|
|
WriteToChannel( result ); |
|
232 |
break; |
break; |
233 |
|
|
234 |
|
|
427 |
} |
} |
428 |
} |
} |
429 |
|
|
430 |
int WriteToChannel( PCHAR buffer ) |
int WriteToChannel( char *format, ... ) |
431 |
{ |
{ |
432 |
BOOL result; |
BOOL result; |
433 |
|
va_list argp; |
434 |
|
char buf [ 1024 ]; |
435 |
|
int size; |
436 |
PULONG bytesRead = 0; |
PULONG bytesRead = 0; |
437 |
PULONG pBytesWritten = 0; |
PULONG pBytesWritten = 0; |
438 |
|
|
439 |
if ( !ChannelIsOpen() ) |
if ( !ChannelIsOpen() ) |
440 |
return 1; |
return 1; |
441 |
|
|
442 |
|
va_start( argp, format ); |
443 |
|
size = vsnprintf( buf, sizeof( buf ), format, argp ); |
444 |
|
va_end( argp ); |
445 |
|
|
446 |
|
if ( size >= sizeof( buf ) ) |
447 |
|
return 0; |
448 |
|
|
449 |
WaitForSingleObject( hMutex, INFINITE ); |
WaitForSingleObject( hMutex, INFINITE ); |
450 |
result = WTSVirtualChannelWrite( m_vcHandle, buffer, ( ULONG ) strlen( buffer ), pBytesWritten ); |
result = WTSVirtualChannelWrite( m_vcHandle, buf, ( ULONG ) strlen( buf ), pBytesWritten ); |
451 |
|
result = WTSVirtualChannelWrite( m_vcHandle, "\n", ( ULONG ) 1, pBytesWritten ); |
452 |
ReleaseMutex( hMutex ); |
ReleaseMutex( hMutex ); |
453 |
|
|
454 |
if ( result ) { |
if ( result ) { |