A
Andre R.
Hi all,
I appreciate the hard work you put into your products, and your blog. In
reviewing the usage of the EWFAPI in the sample code at
http://msdn2.microsoft.com/en-us/library/ms912855.aspx#xeconcodeexampleanchor21 I
noticed a discrepancy that does not make any sense.
For the sake of clarity I will quote the section I believe is in error here,
below is the sample directly from MSDN2.
Begin Quote
// Convert the protected volume's device name into a volume name.
PEWF_VOLUME_NAME_ENTRY pEwfVolName = NULL;
pEwfVolName = EwfMgrGetProtectedVolumeList();
// Get the drive letter that represents this protected volume.
chDrive = EwfMgrGetDriveLetterFromVolumeName(pEwfVolName->Name);
if (chDrive == -1)
{
dwStatus = GetLastError();
wprintf(L"EwfMgrGetDriveLetterFromVolumeName failed LE =
%u\n",dwStatus);
}
if ( pEwfVolName )
{
EwfMgrVolumeNameListDelete( pEwfVolName );
pEwfVolName = NULL;
}
End Quote
If I am reading this code correctly it will always look up the drive letter
for the first volume returned in the volume list. Thus by extension this
function will display that all volumes recorded by the Overlay Configuration
will be using the same letter. This appears to be a logic error.
Am I correct in assuming that this routine should/could be using the values
reported in the pOvlConfig->VolumeDescArray?
Andre Reid.
Here is the complete sample for contextual understanding.
VOID DisplayEwfOverlayConfig ( PEWF_OVERLAY_STORE_CONFIG pOvlConfig )
{
PEWF_VOLUME_DESC pVolDesc = NULL;
WORD ii = 0, jj = 0;
WCHAR chDrive = NULL;
DWORD dwStatus = 0;
WCHAR szVolumeName[EWF_MAX_DEVICE_NAME_LENGTH + 15] = {0};
wprintf(L"\n\n");
wprintf(L"--------------------------------------------------------\n");
wprintf(L"-- Ewf overlay store configuration : \n");
wprintf(L"--------------------------------------------------------\n\n");
// Display the EWF overlay store configuration.
wprintf(L"Format Version : %u\n", pOvlConfig->FormatVersion);
wprintf(L"Volume Size : %I64d Mb\n", pOvlConfig->VolumeSize /
1000000L);
wprintf(L"Number of Segments : %u\n", pOvlConfig->NumSegments);
wprintf(L"Free Segments : %u\n", pOvlConfig->FreeSegments);
wprintf(L"Segment Size : %u Bytes\n", pOvlConfig->SegmentSize);
wprintf(L"Max Volumes : %u\n", pOvlConfig->MaxVolumes);
wprintf(L"Number of Volumes : %u\n", pOvlConfig->NumVolumes);
wprintf(L"Max Levels : %u\n\n", pOvlConfig->MaxLevels);
// Display information about each protected volume.
for (ii = 0; ii < pOvlConfig->NumVolumes; ii++)
{
pVolDesc = &pOvlConfig->VolumeDescArray[ii];
/*Error is in this Block*/
// Convert the protected volume's device name into a volume name.
PEWF_VOLUME_NAME_ENTRY pEwfVolName = NULL;
pEwfVolName = EwfMgrGetProtectedVolumeList();
// Get the drive letter that represents this protected volume.
chDrive = EwfMgrGetDriveLetterFromVolumeName(pEwfVolName->Name);
if (chDrive == -1)
{
dwStatus = GetLastError();
wprintf(L"EwfMgrGetDriveLetterFromVolumeName failed LE =
%u\n",dwStatus);
}
if ( pEwfVolName )
{
EwfMgrVolumeNameListDelete( pEwfVolName );
pEwfVolName = NULL;
}
/*End error*/
wprintf(L"Protected Volume [%u] : ID = ",ii);
for (jj = 0; jj < EWF_VOLUME_ID_SIZE; jj++)
{
wprintf(L"%02X", pVolDesc->VolumeID[jj]);
}
wprintf(L"Name = %.*s Drive = %c\n",
EWF_MAX_DEVICE_NAME_LENGTH, pVolDesc->DeviceName, chDrive);
} // End for each protected volume.
wprintf(L"\n\n");
}
I appreciate the hard work you put into your products, and your blog. In
reviewing the usage of the EWFAPI in the sample code at
http://msdn2.microsoft.com/en-us/library/ms912855.aspx#xeconcodeexampleanchor21 I
noticed a discrepancy that does not make any sense.
For the sake of clarity I will quote the section I believe is in error here,
below is the sample directly from MSDN2.
Begin Quote
// Convert the protected volume's device name into a volume name.
PEWF_VOLUME_NAME_ENTRY pEwfVolName = NULL;
pEwfVolName = EwfMgrGetProtectedVolumeList();
// Get the drive letter that represents this protected volume.
chDrive = EwfMgrGetDriveLetterFromVolumeName(pEwfVolName->Name);
if (chDrive == -1)
{
dwStatus = GetLastError();
wprintf(L"EwfMgrGetDriveLetterFromVolumeName failed LE =
%u\n",dwStatus);
}
if ( pEwfVolName )
{
EwfMgrVolumeNameListDelete( pEwfVolName );
pEwfVolName = NULL;
}
End Quote
If I am reading this code correctly it will always look up the drive letter
for the first volume returned in the volume list. Thus by extension this
function will display that all volumes recorded by the Overlay Configuration
will be using the same letter. This appears to be a logic error.
Am I correct in assuming that this routine should/could be using the values
reported in the pOvlConfig->VolumeDescArray?
Andre Reid.
Here is the complete sample for contextual understanding.
VOID DisplayEwfOverlayConfig ( PEWF_OVERLAY_STORE_CONFIG pOvlConfig )
{
PEWF_VOLUME_DESC pVolDesc = NULL;
WORD ii = 0, jj = 0;
WCHAR chDrive = NULL;
DWORD dwStatus = 0;
WCHAR szVolumeName[EWF_MAX_DEVICE_NAME_LENGTH + 15] = {0};
wprintf(L"\n\n");
wprintf(L"--------------------------------------------------------\n");
wprintf(L"-- Ewf overlay store configuration : \n");
wprintf(L"--------------------------------------------------------\n\n");
// Display the EWF overlay store configuration.
wprintf(L"Format Version : %u\n", pOvlConfig->FormatVersion);
wprintf(L"Volume Size : %I64d Mb\n", pOvlConfig->VolumeSize /
1000000L);
wprintf(L"Number of Segments : %u\n", pOvlConfig->NumSegments);
wprintf(L"Free Segments : %u\n", pOvlConfig->FreeSegments);
wprintf(L"Segment Size : %u Bytes\n", pOvlConfig->SegmentSize);
wprintf(L"Max Volumes : %u\n", pOvlConfig->MaxVolumes);
wprintf(L"Number of Volumes : %u\n", pOvlConfig->NumVolumes);
wprintf(L"Max Levels : %u\n\n", pOvlConfig->MaxLevels);
// Display information about each protected volume.
for (ii = 0; ii < pOvlConfig->NumVolumes; ii++)
{
pVolDesc = &pOvlConfig->VolumeDescArray[ii];
/*Error is in this Block*/
// Convert the protected volume's device name into a volume name.
PEWF_VOLUME_NAME_ENTRY pEwfVolName = NULL;
pEwfVolName = EwfMgrGetProtectedVolumeList();
// Get the drive letter that represents this protected volume.
chDrive = EwfMgrGetDriveLetterFromVolumeName(pEwfVolName->Name);
if (chDrive == -1)
{
dwStatus = GetLastError();
wprintf(L"EwfMgrGetDriveLetterFromVolumeName failed LE =
%u\n",dwStatus);
}
if ( pEwfVolName )
{
EwfMgrVolumeNameListDelete( pEwfVolName );
pEwfVolName = NULL;
}
/*End error*/
wprintf(L"Protected Volume [%u] : ID = ",ii);
for (jj = 0; jj < EWF_VOLUME_ID_SIZE; jj++)
{
wprintf(L"%02X", pVolDesc->VolumeID[jj]);
}
wprintf(L"Name = %.*s Drive = %c\n",
EWF_MAX_DEVICE_NAME_LENGTH, pVolDesc->DeviceName, chDrive);
} // End for each protected volume.
wprintf(L"\n\n");
}