小编yxo*_*xor的帖子

使用可加载内核模块的系统调用拦截中的参数似乎已损坏

第一篇文章,所以我为可能的低质量解释道歉。

I was trying to write a loadable kernel module that does nothing but intercept syscalls to SYS_open, print the arguments to KERN_INFO and then forward the arguments to the real syscall. The forwarding part seems to be working just fine, but I'm having issues with the printing, arguments seem to be broken, from the syscall interceptor function's perspective.

Following are the pointer to the real open syscall as well as the interceptor definition.

asmlinkage int (*real_open) (const char __user …
Run Code Online (Sandbox Code Playgroud)

c linux system-calls linux-kernel

5
推荐指数
1
解决办法
245
查看次数

将 Image 对象复制到剪贴板时出错

我试图将图像对象放入剪贴板,但出现了一个奇怪的错误。

这就是问题发生的地方。

ByteArrayInputStream bis = new ByteArrayInputStream(clipboardObject.data);
try(ObjectInput in = new ObjectInputStream(bis)) {
    ImageIcon img = (ImageIcon) in.readObject();
    ImageTransferable t = new ImageTransferable(img.getImage());
    Toolkit.getDefaultToolkit().getSystemClipboard()
            .setContents(t, null);
} catch(Exception e) {
    e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)

这是我的ImageTransferable课。

static class ImageTransferable implements Transferable
{
    private Image image;

    public ImageTransferable (Image image)
    {
        this.image = image;
    }

    public Object getTransferData(DataFlavor flavor)
            throws UnsupportedFlavorException
    {
        if (isDataFlavorSupported(flavor))
        {
            return image;
        }
        else
        {
            throw new UnsupportedFlavorException(flavor);
        }
    }

    public boolean isDataFlavorSupported (DataFlavor flavor)
    {
        return …
Run Code Online (Sandbox Code Playgroud)

java clipboard

2
推荐指数
1
解决办法
671
查看次数

标签 统计

c ×1

clipboard ×1

java ×1

linux ×1

linux-kernel ×1

system-calls ×1