Hi all,
I am trying to get the partition information from a specific hardrive and
am using the IOCTL_DISK_GET_DRIVE_LAYOUT. Whenever I make the call from within
a class, the call succeeds but when the function returns I get an access
violation. When I call the function from directly in the main function, everything
happens correctly. If there is an easier way to do this, I would be very
appreciative. Below is a snippet of the code the contaions the creation of
the handle and the IOCTL call. Thanks.

*************************************************************************
DRIVE_LAYOUT_INFORMATION pdl; //Structure for partition information
DWORD junk; //Value for the number of bytes returned
BOOL bResult;
HANDLE hDevice;
DWORD bigBuffer[sizeof(DRIVE_LAYOUT_INFORMATION) * 15];
SECURITY_ATTRIBUTES saTest;

saTest.bInheritHandle = TRUE;
saTest.nLength = sizeof(SECURITY_ATTRIBUTES);
saTest.lpSecurityDescriptor = NULL;

hDevice = CreateFile("\\\\.\\PhysicalDrive0", GENERIC_WRITE | GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE, &saTest,
OPEN_EXISTING, 0, NULL);

bResult = DeviceIoControl(hDevice, // device we are querying
IOCTL_DISK_GET_DRIVE_LAYOUT, // operation to perform
NULL, 0, // no input buffer, pass 0 for buffer size
&pdl, sizeof(bigBuffer), // output structure and size
&junk, // discard count of bytes returned
NULL); // set to NULL for synchronous I/O