在 C# 中读取 PVOID,我应该读取多少位? [英] Reading a PVOID in c#, how many bits should I read?

查看:30
本文介绍了在 C# 中读取 PVOID,我应该读取多少位?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在读取 URB 类型的 USB 数据包.在 http: 中定义的 URB 标头://msdn.microsoft.com/en-us/library/windows/hardware/ff540409(v=vs.85).aspx as

I'm reading from a USB packet that has a URB type. The URB header defined at http://msdn.microsoft.com/en-us/library/windows/hardware/ff540409(v=vs.85).aspx as

 struct _URB_HEADER {
    USHORT      Length;
    USHORT      Function;
    USBD_STATUS Status;
    PVOID       UsbdDeviceHandle;
    ULONG       UsbdFlags;
 };

我应该为 PVOID 读取多少位?

How many bits should I be reading for the PVOID?

推荐答案

感谢您的评论 - 通读它们,看起来就像使用

Thanks for the comments - reading through them, it looks like using

 byte [] ptr_bytes = rdr.ReadBytes(System.IntPtr.Size);

将根据操作系统正确提供指针的大小.

will provide the size of the pointer correctly depending on the operating system.

这篇关于在 C# 中读取 PVOID,我应该读取多少位?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆