示例#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
    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
 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
 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))