masm32 中带有 64 位数字的 winapi

发布于 2024-08-14 18:21:44 字数 67 浏览 3 评论 0原文

我需要确定逻辑卷的大小并打印它。 GetDiskFreeSpaceEx 返回大小为 64 位数字(?)。我能用它做什么?

I need determind size of a logical volume and print it. GetDiskFreeSpaceEx is returning size as 64bit number(?). What can i do with it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云裳 2024-08-21 18:21:44

你可以用它做任何你想做的事情,但是用 masm32 进行计算有点尴尬。您应该能够填充使用 64 位整数的任何其他数据结构。还可以通过将值加载到 EDX:EAX 中来对 64 位执行一些算术运算,例如除法(因此将前 4 个字节加载到 EAX 中,将后 4 个字节加载到 EDX 中)。但是,请注意这里可能会发生溢出,需要处理或避免这种情况。

如果您只想使用此函数打印出卷的大小,您可以调用 C 运行时库 printf 函数:

invoke crt_printf,chr$("GetDiskFreeSpaceEx, total bytes: %I64d%c"),
                  dqTotalBytes,10

但是,正如手册所述“要确定磁盘或卷上的字节总数,请使用 < a href="http://msdn.microsoft.com/en-us/library/aa365178%28VS.85%29.aspx" rel="nofollow noreferrer">IOCTL_DISK_GET_LENGTH_INFO。"前面的代码仅告诉您当前用户可以使用多少个。

You can do whatever you want with it, however it's a bit awkward to do calculations with in masm32. You should be able to fill any other data structure which uses 64 bit integers. It is also possible to do some arithmetic operations on 64 bits such as division, by loading the value into EDX:EAX (so load the first 4 bytes into EAX, and the next 4 into EDX). However, beware that overflow is possible here, which needs to be handled or avoided.

If you just want to print out the size of the volume using this function you can just invoke the C run-time library printf function:

invoke crt_printf,chr$("GetDiskFreeSpaceEx, total bytes: %I64d%c"),
                  dqTotalBytes,10

However, as the manual says "To determine the total number of bytes on a disk or volume, use IOCTL_DISK_GET_LENGTH_INFO." The previous code only tells you how many are available to the current user.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文