summaryrefslogtreecommitdiff
path: root/payloads/libpayload/curses/PDCurses/win32/pdcgetsc.c
blob: 7c7652362c57c2ca05a082aeba7b0034a32c4dca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* Public Domain Curses */

#include "pdcwin.h"

RCSID("$Id: pdcgetsc.c,v 1.36 2008/07/14 04:24:52 wmcbrine Exp $")

/* get the cursor size/shape */

int PDC_get_cursor_mode(void)
{
    CONSOLE_CURSOR_INFO ci;

    PDC_LOG(("PDC_get_cursor_mode() - called\n"));

    GetConsoleCursorInfo(pdc_con_out, &ci);

    return ci.dwSize;
}

/* return number of screen rows */

int PDC_get_rows(void)
{
    CONSOLE_SCREEN_BUFFER_INFO scr;

    PDC_LOG(("PDC_get_rows() - called\n"));

    GetConsoleScreenBufferInfo(pdc_con_out, &scr);

    return scr.srWindow.Bottom - scr.srWindow.Top + 1;
}

/* return number of buffer rows */

int PDC_get_buffer_rows(void)
{
    CONSOLE_SCREEN_BUFFER_INFO scr;

    PDC_LOG(("PDC_get_buffer_rows() - called\n"));

    GetConsoleScreenBufferInfo(pdc_con_out, &scr);

    return scr.dwSize.Y;
}

/* return width of screen/viewport */

int PDC_get_columns(void)
{
    CONSOLE_SCREEN_BUFFER_INFO scr;

    PDC_LOG(("PDC_get_columns() - called\n"));

    GetConsoleScreenBufferInfo(pdc_con_out, &scr);

    return scr.srWindow.Right - scr.srWindow.Left + 1;
}