views:

105

answers:

1

For some reason on my application when running on some configuration of hard disk (RAID, random partitions, through a separate IDE controller, not on the operating systems partition), VirtualAlloc returns null with the GetLastError code of ERROR_INVALID_PARAMETER.

The only parameter apart from the flags (MEM_COMMIT | MEM_TOP_DOWN, PAGE_READWRITE) passed in is the size calculated as a multiple of the sector size obtained from the disk geometry (unfortunately I cant post code due to NDA etc).

Just wondering if anyone has any experience of this? or if anyone knows any reason why windows might treat page sizes differently on disks that are part of a raid or partitioned?, any help is greatly appreciated thanks!

A: 

Issue was to do with DeviceIoControl when trying to return IOCTL_DISK_GET_DRIVE_GEOMETRY seemed to be returning complete garbage when using anything other than the primary hdd, I solved this by using GetDiskFreeSpace instead to get the sector information and is all working fine

obviously finding out why IOCTL_DISK_GET_DRIVE_GEOMETRY is garbage would be ideal, but im happy that it works!

Stowelly