00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
#include "precomp.h"
00021
#pragma hdrstop
00022
00023
#include "dbt.h"
00024
#include "ntdddisk.h"
00025
#include "ntuser.h"
00026
00027
#include <winsta.h>
00028
#include <wstmsg.h>
00029
#include <winuser.h>
00030
00031
00032
00033
00034
00035
00036
#if DBG
00037
void DumpOutLastErrorString()
00038 {
00039
LPVOID lpMsgBuf;
00040
00041
DWORD error = GetLastError();
00042
00043
DBGHYD((
"GetLastError() = 0x%lx \n", error ));
00044
00045 FormatMessage(
00046 FORMAT_MESSAGE_ALLOCATE_BUFFER |
00047 FORMAT_MESSAGE_FROM_SYSTEM |
00048 FORMAT_MESSAGE_IGNORE_INSERTS,
00049 NULL,
00050 error,
00051 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
00052 (LPTSTR) &lpMsgBuf,
00053 0,
00054 NULL
00055 );
00056
00057
00058
00059
00060
00061
DBGHYD((
"%s\n", (LPCTSTR)lpMsgBuf ));
00062
00063
00064
00065
00066 LocalFree( lpMsgBuf );
00067 }
00068
#endif
00069
00070
#if DBG
00071
#define DumpOutLastError DumpOutLastErrorString()
00072
#else
00073 #define DumpOutLastError
00074
#endif
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
NTSTATUS
00089 RemoteDoBroadcastSystemMessage(
00090 PWINSTATION_APIMSG pMsg)
00091 {
00092 LONG rc;
00093 WINSTATIONBROADCASTSYSTEMMSG *pmsg;
00094 LPARAM tmpLPARAM;
00095
NTSTATUS status;
00096
00097
00098 pmsg = &(pMsg->u.bMsg);
00099
00100
if ( pmsg->bufferSize )
00101 {
00102
00103 tmpLPARAM = (LPARAM)pmsg->dataBuffer;
00104 }
00105
else
00106 {
00107 tmpLPARAM = pmsg->lParam ;
00108 }
00109
00110 rc =
BroadcastSystemMessage( pmsg->dwFlags, &pmsg->dwRecipients,
00111 pmsg->uiMessage, pmsg->wParam, tmpLPARAM );
00112
00113 status = STATUS_SUCCESS;
00114
00115 pmsg->Response = rc;
00116
00117
return status ;
00118 }
00119
00120
00121
00122
NTSTATUS
00123 RemoteDoSendWindowMessage(
00124 PWINSTATION_APIMSG pMsg)
00125 {
00126 LONG rc;
00127
NTSTATUS status;
00128
00129
00130 WINSTATIONSENDWINDOWMSG *pmsg;
00131 LPARAM tmpLPARAM;
00132
00133 pmsg = &(pMsg->u.sMsg);
00134
00135
if ( pmsg->bufferSize )
00136 {
00137
00138 tmpLPARAM = (LPARAM)pmsg->dataBuffer;
00139 }
00140
else
00141 {
00142 tmpLPARAM = (LPARAM)pmsg->lParam;
00143 }
00144
00145
00146
00147
00148
00149
00150 rc = (LONG)
SendMessage( pmsg->hWnd, pmsg->Msg,
00151 pmsg->wParam, tmpLPARAM );
00152
00153 status = STATUS_SUCCESS;
00154
00155 pmsg->Response = rc;
00156
00157
return status ;
00158 }
00159