103 SECURITY_DESCRIPTOR securityDescriptor;
104 UCHAR saclBuffer[
sizeof(ACL) + FIELD_OFFSET(SYSTEM_MANDATORY_LABEL_ACE, SidStart) + FIELD_OFFSET(SID, SubAuthority) +
sizeof(ULONG)];
106 UCHAR mandatoryLabelAceBuffer[FIELD_OFFSET(SYSTEM_MANDATORY_LABEL_ACE, SidStart) + FIELD_OFFSET(SID, SubAuthority) +
sizeof(ULONG)];
107 PSYSTEM_MANDATORY_LABEL_ACE mandatoryLabelAce;
112 LARGE_INTEGER maximumSize;
132 if (!WeServerSharedData)
157 WeServerSharedData = viewBase;
198 static SID_IDENTIFIER_AUTHORITY mandatoryLabelAuthority = SECURITY_MANDATORY_LABEL_AUTHORITY;
202 sacl = (PACL)saclBuffer;
205 mandatoryLabelAce = (PSYSTEM_MANDATORY_LABEL_ACE)mandatoryLabelAceBuffer;
206 mandatoryLabelAce->Header.AceType = SYSTEM_MANDATORY_LABEL_ACE_TYPE;
207 mandatoryLabelAce->Header.AceFlags = 0;
208 mandatoryLabelAce->Header.AceSize =
sizeof(mandatoryLabelAceBuffer);
209 mandatoryLabelAce->Mask = SYSTEM_MANDATORY_LABEL_NO_WRITE_UP;
211 sid = (PSID)&mandatoryLabelAce->SidStart;
215 if (
NT_SUCCESS(
RtlAddAce(sacl, ACL_REVISION, MAXULONG32, mandatoryLabelAce,
sizeof(mandatoryLabelAceBuffer))))
252 if (!WeServerSharedData)
277 WeServerSharedData = viewBase;
325 if (WeServerSharedData)
328 WeServerSharedData = NULL;
364 LARGE_INTEGER timeout;
392 LARGE_INTEGER timeout;
397 threadId = GetWindowThreadProcessId(hWnd, &processId);
399 if (UlongToHandle(processId) == NtCurrentProcessId())
443 WCHAR className[256];
446 memset(&WeServerSharedData->
c, 0,
sizeof(WeServerSharedData->
c));
447 isUnicode = IsWindowUnicode(hwnd);
451 WeServerSharedData->
c.
WndProc = GetWindowLongPtrW(hwnd, GWLP_WNDPROC);
452 WeServerSharedData->
c.
DlgProc = GetWindowLongPtrW(hwnd, DWLP_DLGPROC);
456 WeServerSharedData->
c.
WndProc = GetWindowLongPtrA(hwnd, GWLP_WNDPROC);
457 WeServerSharedData->
c.
DlgProc = GetWindowLongPtrA(hwnd, DWLP_DLGPROC);
460 if (!GetClassName(hwnd, className,
sizeof(className) /
sizeof(WCHAR)))
463 WeServerSharedData->
c.
ClassInfo.cbSize =
sizeof(WNDCLASSEX);
464 GetClassInfoEx(NULL, className, &WeServerSharedData->
c.
ClassInfo);
467 WeServerSharedData->
c.
ClassInfo.lpfnWndProc = (PVOID)GetClassLongPtrW(hwnd, GCLP_WNDPROC);
469 WeServerSharedData->
c.
ClassInfo.lpfnWndProc = (PVOID)GetClassLongPtrA(hwnd, GCLP_WNDPROC);
481 result = CallNextHookEx(NULL, nCode, wParam, lParam);
483 info = (PCWPSTRUCT)lParam;
487 HANDLE serverProcessId;
490 serverProcessId = (HANDLE)info->wParam;
491 messageId = (ULONG)info->lParam;
493 if (serverProcessId != NtCurrentProcessId())
497 if (WeServerSharedData->
MessageId == messageId)