-
Автор темы
- #1
тайп дефы функций
код инициализации
код создания фрейма
сам рендер бокса
C:
typedef HBRUSH(*GdiSelectBrush_t)(_In_ HDC hdc,_In_ HBRUSH hbr);
typedef BOOL(*PatBlt_t)(_In_ HDC,_In_ int x,_In_ int y,_In_ int w,_In_ int h,_In_ DWORD);
typedef HDC(*NtUserGetDC_t)(HWND hWnd);
typedef HBRUSH(*NtGdiCreateSolidBrush_t)(_In_ COLORREF crColor,_In_opt_ HBRUSH hbr);
typedef int (*ReleaseDC_t)(HDC hdc);
typedef BOOL(*DeleteObjectApp_t)(HANDLE hobj);
C++:
GdiSelectBrush = (GdiSelectBrush_t)get_system_module_export(L"win32kfull.sys", "NtGdiSelectBrush");
NtGdiCreateSolidBrush = (NtGdiCreateSolidBrush_t)get_system_module_export(L"win32kfull.sys", "NtGdiCreateSolidBrush");
NtGdiPatBlt = (PatBlt_t)get_system_module_export(L"win32kfull.sys", "NtGdiPatBlt");
NtUserGetDC = (NtUserGetDC_t)get_system_module_export(L"win32kbase.sys", "NtUserGetDC");
NtUserReleaseDC = (ReleaseDC_t)get_system_module_export(L"win32kbase.sys", "NtUserReleaseDC");
NtGdiDeleteObjectApp = (DeleteObjectApp_t)get_system_module_export(L"win32kbase.sys", "NtGdiDeleteObjectApp");
C++:
INT FrameRect(HDC hDC, CONST RECT* lprc, HBRUSH hbr, int thickness)
{
HBRUSH oldbrush;
RECT r = *lprc;
if (!(oldbrush = GdiSelectBrush(hDC, hbr))) return 0;
NtGdiPatBlt(hDC, r.left, r.top, thickness, r.bottom - r.top, PATCOPY);
NtGdiPatBlt(hDC, r.right - thickness, r.top, thickness, r.bottom - r.top, PATCOPY);
NtGdiPatBlt(hDC, r.left, r.top, r.right - r.left, thickness, PATCOPY);
NtGdiPatBlt(hDC, r.left, r.bottom - thickness, r.right - r.left, thickness, PATCOPY);
GdiSelectBrush(hDC, oldbrush);
return TRUE;
}
C++:
HDC hdc = NtUserGetDC(NULL);
if (!hdc)
return STATUS_UNSUCCESSFUL;
HBRUSH brush = NtGdiCreateSolidBrush(RGB(instructions->r, instructions->g, instructions->b), NULL);
if (!brush)
return STATUS_UNSUCCESSFUL;
RECT rect = { instructions->x, instructions->y, instructions->x + instructions->w, instructions->y + instructions->h };
FrameRect(hdc, &rect, brush, instructions->t);
NtUserReleaseDC(hdc);
NtGdiDeleteObjectApp(brush);