def _ioctl(self, ioctl_code, in_buf, out_length): if not self.driver_loaded: _handle_error( "chipsec kernel driver is not loaded (in native API mode?)") out_buf = (c_char * out_length)() self.get_driver_handle() if logger().DEBUG: print_buffer(bytestostring(in_buf)) try: out_buf = win32file.DeviceIoControl(self.driver_handle, ioctl_code, in_buf, out_length, None) except pywintypes.error as _err: err_status = _err.args[0] + 0x100000000 if STATUS_PRIVILEGED_INSTRUCTION == err_status: err_msg = "HW Access Violation: DeviceIoControl returned STATUS_PRIVILEGED_INSTRUCTION (0x{:X})".format( err_status) if logger().DEBUG: logger().error(err_msg) raise HWAccessViolationError(err_msg, err_status) else: _handle_error( "HW Access Error: DeviceIoControl returned status 0x{:X} ({})" .format(err_status, _err.args[2]), err_status) return out_buf
def _ioctl( self, ioctl_code, in_buf, out_length ): out_buf = (c_char * out_length)() self.get_driver_handle() #ret = kernel32.DeviceIoControl( self.driver_handle, ioctl_code, in_buf, len(in_buf), byref(out_buf), out_length, byref(out_size), None ) if logger().VERBOSE: print_buffer( in_buf ) try: out_buf = win32file.DeviceIoControl( self.driver_handle, ioctl_code, in_buf, out_length, None ) except pywintypes.error, _err: err_status = _err[0] + 0x100000000 if STATUS_PRIVILEGED_INSTRUCTION == err_status: err_msg = "HW Access Violation: DeviceIoControl returned STATUS_PRIVILEGED_INSTRUCTION (0x%X)" % err_status logger().error( err_msg ) raise HWAccessViolationError( err_msg, err_status ) else: err_msg = "HW Access Error: DeviceIoControl returned status 0x%X (%s)" % (err_status,_err[2]) logger().error( err_msg ) raise OsHelperError( err_msg, err_status )
def _ioctl( self, ioctl_code, in_buf, out_length ): if not self.driver_loaded: _handle_error("chipsec kernel driver is not loaded (in native API mode?)") out_buf = (c_char * out_length)() self.get_driver_handle() if logger().VERBOSE: print_buffer( in_buf ) try: out_buf = win32file.DeviceIoControl( self.driver_handle, ioctl_code, in_buf, out_length, None ) except pywintypes.error, _err: err_status = _err[0] + 0x100000000 if STATUS_PRIVILEGED_INSTRUCTION == err_status: err_msg = "HW Access Violation: DeviceIoControl returned STATUS_PRIVILEGED_INSTRUCTION (0x%X)" % err_status logger().error( err_msg ) raise HWAccessViolationError( err_msg, err_status ) else: _handle_error( "HW Access Error: DeviceIoControl returned status 0x%X (%s)" % (err_status,_err[2]), err_status )