tags:

views:

70

answers:

2

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

+1  A: 

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.

KernelJ
A: 

Thanks, it's was helpfull.

Stas