コード例 #1
0
    def setup_console(self):
        """Initializes the screen frame buffer.

        Swaps the current screen buffer with a
        brand new created back buffer where the
        characters can be written to the flicker-free
        rectangular region.

        """
        self._console = get_std_handle(STD_OUTPUT_HANDLE)
        # could not get the standard
        # console handle, raise an exception
        if self._console == INVALID_HANDLE_VALUE:
            raise TermInitializationError()

        buffer_info = CONSOLE_SCREEN_BUFFER_INFO()
        get_console_screen_buffer_info(self._console, byref(buffer_info))
        get_console_cursor_info(self._console, byref(self._cursor_info))
        self._cursor_info.visible = False

        self._cols = buffer_info.size.x
        self._rows = buffer_info.size.y
        self._size = COORD(self._cols, self._rows)
        self._rect = SMALL_RECT(0, 0, self._cols - 1, self._rows - 1)
        self._char_buffer = (CHAR_INFO * (self._size.x * self._size.y))()
        self._framebuffer = create_console_screen_buffer(
            GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
            None, CONSOLE_TEXTMODE_BUFFER, None)
        if self._framebuffer == INVALID_HANDLE_VALUE:
            raise TermInitializationError()
        # hide the cursor and swap
        # the console active screen buffer
        set_console_cursor_info(self._framebuffer, byref(self._cursor_info))
        set_console_active_screen_buffer(self._framebuffer)
コード例 #2
0
ファイル: term.py プロジェクト: mycyty/fibratus
    def init_console(self):
        self.console_handle = get_std_handle(STD_OUTPUT_HANDLE)
        if self.console_handle == INVALID_HANDLE_VALUE:
            raise TermInitializationError()

        get_console_screen_buffer_info(self.console_handle,
                                       byref(self.backbuffer_info))
        get_console_cursor_info(self.console_handle, byref(self.cursor_info))
        self._show_cursor(False)

        self.cols = self.backbuffer_info.size.x
        self.rows = self.backbuffer_info.size.y
        self.size = COORD(self.cols, self.rows)
        self.rect = SMALL_RECT(0, 0, self.cols - 1, self.rows - 1)

        self.char_buffer = (CHAR_INFO * (self.size.x * self.size.y))()

        self.backbuffer_handle = create_console_screen_buffer(
            GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
            None, CONSOLE_TEXTMODE_BUFFER, None)
        if self.backbuffer_handle == INVALID_HANDLE_VALUE:
            raise TermInitializationError()
        set_console_active_screen_buffer(self.backbuffer_handle)
コード例 #3
0
ファイル: term.py プロジェクト: CaineQT/fibratus
    def init_console(self):
        self.console_handle = get_std_handle(STD_OUTPUT_HANDLE)
        if self.console_handle == INVALID_HANDLE_VALUE:
            raise TermInitializationError()

        get_console_screen_buffer_info(self.console_handle, byref(self.backbuffer_info))
        get_console_cursor_info(self.console_handle, byref(self.cursor_info))
        self._show_cursor(False)

        self.cols = self.backbuffer_info.size.x
        self.rows = self.backbuffer_info.size.y
        self.size = COORD(self.cols, self.rows)
        self.rect = SMALL_RECT(0, 0, self.cols - 1, self.rows - 1)

        self.char_buffer = (CHAR_INFO * (self.size.x * self.size.y))()

        self.backbuffer_handle = create_console_screen_buffer(GENERIC_READ | GENERIC_WRITE,
                                                              FILE_SHARE_READ | FILE_SHARE_WRITE,
                                                              None,
                                                              CONSOLE_TEXTMODE_BUFFER,
                                                              None)
        if self.backbuffer_handle == INVALID_HANDLE_VALUE:
            raise TermInitializationError()
        set_console_active_screen_buffer(self.backbuffer_handle)
コード例 #4
0
ファイル: term.py プロジェクト: rabbitstack/fibratus
    def setup_console(self):
        """Initializes the screen frame buffer.

        Swaps the current screen buffer with a
        brand new created back buffer where the
        characters can be written to the flicker-free
        rectangular region.

        """
        self._console = get_std_handle(STD_OUTPUT_HANDLE)
        # could not get the standard
        # console handle, raise an exception
        if self._console == INVALID_HANDLE_VALUE:
            raise TermInitializationError()

        buffer_info = CONSOLE_SCREEN_BUFFER_INFO()
        get_console_screen_buffer_info(self._console, byref(buffer_info))
        get_console_cursor_info(self._console, byref(self._cursor_info))
        self._cursor_info.visible = False

        self._cols = buffer_info.size.x
        self._rows = buffer_info.size.y
        self._size = COORD(self._cols, self._rows)
        self._rect = SMALL_RECT(0, 0, self._cols - 1, self._rows - 1)
        self._char_buffer = (CHAR_INFO * (self._size.x * self._size.y))()
        self._framebuffer = create_console_screen_buffer(GENERIC_READ | GENERIC_WRITE,
                                                         FILE_SHARE_READ | FILE_SHARE_WRITE,
                                                         None,
                                                         CONSOLE_TEXTMODE_BUFFER,
                                                         None)
        if self._framebuffer == INVALID_HANDLE_VALUE:
            raise TermInitializationError()
        # hide the cursor and swap
        # the console active screen buffer
        set_console_cursor_info(self._framebuffer, byref(self._cursor_info))
        set_console_active_screen_buffer(self._framebuffer)
コード例 #5
0
ファイル: term.py プロジェクト: CaineQT/fibratus
 def restore_console(self):
     if self.console_handle:
         self._show_cursor(True)
         set_console_active_screen_buffer(self.console_handle)
コード例 #6
0
ファイル: term.py プロジェクト: mycyty/fibratus
 def restore_console(self):
     if self.console_handle:
         self._show_cursor(True)
         set_console_active_screen_buffer(self.console_handle)
コード例 #7
0
ファイル: term.py プロジェクト: olivierh59500/fibratus
 def restore_console(self):
     if self._console:
         set_console_active_screen_buffer(self._console)
         self._cursor_info.visible = True
         self._term_ready = False
         set_console_cursor_info(self._console, byref(self._cursor_info))
コード例 #8
0
ファイル: term.py プロジェクト: rabbitstack/fibratus
 def restore_console(self):
     if self._console:
         set_console_active_screen_buffer(self._console)
         self._cursor_info.visible = True
         set_console_cursor_info(self._console, byref(self._cursor_info))