mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[core] improve VDS calls
* Factorize error setting. * Use break so as to not leak resources on error. * Ensure that the error codes are set properly.
This commit is contained in:
parent
e8c717c394
commit
2538974318
3 changed files with 35 additions and 65 deletions
88
src/drive.c
88
src/drive.c
|
@ -443,8 +443,7 @@ out:
|
||||||
*/
|
*/
|
||||||
BOOL RefreshLayout(DWORD DriveIndex)
|
BOOL RefreshLayout(DWORD DriveIndex)
|
||||||
{
|
{
|
||||||
BOOL r = FALSE;
|
HRESULT hr = S_FALSE;
|
||||||
HRESULT hr;
|
|
||||||
wchar_t wPhysicalName[24];
|
wchar_t wPhysicalName[24];
|
||||||
IVdsServiceLoader* pLoader = NULL;
|
IVdsServiceLoader* pLoader = NULL;
|
||||||
IVdsService* pService = NULL;
|
IVdsService* pService = NULL;
|
||||||
|
@ -462,7 +461,6 @@ BOOL RefreshLayout(DWORD DriveIndex)
|
||||||
hr = CoCreateInstance(&CLSID_VdsLoader, NULL, CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER,
|
hr = CoCreateInstance(&CLSID_VdsLoader, NULL, CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER,
|
||||||
&IID_IVdsServiceLoader, (void **)&pLoader);
|
&IID_IVdsServiceLoader, (void **)&pLoader);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
uprintf("Could not create VDS Loader Instance: %s", WindowsErrorString());
|
uprintf("Could not create VDS Loader Instance: %s", WindowsErrorString());
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -470,7 +468,6 @@ BOOL RefreshLayout(DWORD DriveIndex)
|
||||||
// Load the VDS Service
|
// Load the VDS Service
|
||||||
hr = IVdsServiceLoader_LoadService(pLoader, L"", &pService);
|
hr = IVdsServiceLoader_LoadService(pLoader, L"", &pService);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
uprintf("Could not load VDS Service: %s", WindowsErrorString());
|
uprintf("Could not load VDS Service: %s", WindowsErrorString());
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -478,7 +475,6 @@ BOOL RefreshLayout(DWORD DriveIndex)
|
||||||
// Wait for the Service to become ready if needed
|
// Wait for the Service to become ready if needed
|
||||||
hr = IVdsService_WaitForServiceReady(pService);
|
hr = IVdsService_WaitForServiceReady(pService);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
uprintf("VDS Service is not ready: %s", WindowsErrorString());
|
uprintf("VDS Service is not ready: %s", WindowsErrorString());
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -486,7 +482,6 @@ BOOL RefreshLayout(DWORD DriveIndex)
|
||||||
// Query the VDS Service Providers
|
// Query the VDS Service Providers
|
||||||
hr = IVdsService_QueryProviders(pService, VDS_QUERY_SOFTWARE_PROVIDERS, &pEnum);
|
hr = IVdsService_QueryProviders(pService, VDS_QUERY_SOFTWARE_PROVIDERS, &pEnum);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
uprintf("Could not query VDS Service Providers: %s", WindowsErrorString());
|
uprintf("Could not query VDS Service Providers: %s", WindowsErrorString());
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -494,7 +489,6 @@ BOOL RefreshLayout(DWORD DriveIndex)
|
||||||
// Remove mountpoints
|
// Remove mountpoints
|
||||||
hr = IVdsService_CleanupObsoleteMountPoints(pService);
|
hr = IVdsService_CleanupObsoleteMountPoints(pService);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
uprintf("Could not clean up VDS mountpoints: %s", WindowsErrorString());
|
uprintf("Could not clean up VDS mountpoints: %s", WindowsErrorString());
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -502,7 +496,6 @@ BOOL RefreshLayout(DWORD DriveIndex)
|
||||||
// Invoke layout refresh
|
// Invoke layout refresh
|
||||||
hr = IVdsService_Refresh(pService);
|
hr = IVdsService_Refresh(pService);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
uprintf("Could not refresh VDS layout: %s", WindowsErrorString());
|
uprintf("Could not refresh VDS layout: %s", WindowsErrorString());
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -510,18 +503,17 @@ BOOL RefreshLayout(DWORD DriveIndex)
|
||||||
// Force re-enum
|
// Force re-enum
|
||||||
hr = IVdsService_Reenumerate(pService);
|
hr = IVdsService_Reenumerate(pService);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
uprintf("Could not refresh VDS layout: %s", WindowsErrorString());
|
uprintf("Could not refresh VDS layout: %s", WindowsErrorString());
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
r = TRUE;
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (pService != NULL)
|
if (pService != NULL)
|
||||||
IVdsService_Release(pService);
|
IVdsService_Release(pService);
|
||||||
if (pLoader != NULL)
|
if (pLoader != NULL)
|
||||||
IVdsServiceLoader_Release(pLoader);
|
IVdsServiceLoader_Release(pLoader);
|
||||||
return r;
|
VDS_SET_ERROR(hr);
|
||||||
|
return (hr == S_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -552,7 +544,6 @@ static BOOL GetVdsDiskInterface(DWORD DriveIndex, const IID* InterfaceIID, void*
|
||||||
hr = CoCreateInstance(&CLSID_VdsLoader, NULL, CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER,
|
hr = CoCreateInstance(&CLSID_VdsLoader, NULL, CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER,
|
||||||
&IID_IVdsServiceLoader, (void**)&pLoader);
|
&IID_IVdsServiceLoader, (void**)&pLoader);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
suprintf("Could not create VDS Loader Instance: %s", WindowsErrorString());
|
suprintf("Could not create VDS Loader Instance: %s", WindowsErrorString());
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -561,7 +552,6 @@ static BOOL GetVdsDiskInterface(DWORD DriveIndex, const IID* InterfaceIID, void*
|
||||||
hr = IVdsServiceLoader_LoadService(pLoader, L"", &pService);
|
hr = IVdsServiceLoader_LoadService(pLoader, L"", &pService);
|
||||||
IVdsServiceLoader_Release(pLoader);
|
IVdsServiceLoader_Release(pLoader);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
suprintf("Could not load VDS Service: %s", WindowsErrorString());
|
suprintf("Could not load VDS Service: %s", WindowsErrorString());
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -569,7 +559,6 @@ static BOOL GetVdsDiskInterface(DWORD DriveIndex, const IID* InterfaceIID, void*
|
||||||
// Wait for the Service to become ready if needed
|
// Wait for the Service to become ready if needed
|
||||||
hr = IVdsService_WaitForServiceReady(pService);
|
hr = IVdsService_WaitForServiceReady(pService);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
suprintf("VDS Service is not ready: %s", WindowsErrorString());
|
suprintf("VDS Service is not ready: %s", WindowsErrorString());
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -578,7 +567,6 @@ static BOOL GetVdsDiskInterface(DWORD DriveIndex, const IID* InterfaceIID, void*
|
||||||
hr = IVdsService_QueryProviders(pService, VDS_QUERY_SOFTWARE_PROVIDERS, &pEnum);
|
hr = IVdsService_QueryProviders(pService, VDS_QUERY_SOFTWARE_PROVIDERS, &pEnum);
|
||||||
IVdsService_Release(pService);
|
IVdsService_Release(pService);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
suprintf("Could not query VDS Service Providers: %s", WindowsErrorString());
|
suprintf("Could not query VDS Service Providers: %s", WindowsErrorString());
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -593,27 +581,24 @@ static BOOL GetVdsDiskInterface(DWORD DriveIndex, const IID* InterfaceIID, void*
|
||||||
hr = IUnknown_QueryInterface(pUnk, &IID_IVdsProvider, (void**)&pProvider);
|
hr = IUnknown_QueryInterface(pUnk, &IID_IVdsProvider, (void**)&pProvider);
|
||||||
IUnknown_Release(pUnk);
|
IUnknown_Release(pUnk);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
suprintf("Could not get VDS Provider: %s", WindowsErrorString());
|
suprintf("Could not get VDS Provider: %s", WindowsErrorString());
|
||||||
goto out;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get VDS Software Provider
|
// Get VDS Software Provider
|
||||||
hr = IVdsSwProvider_QueryInterface(pProvider, &IID_IVdsSwProvider, (void**)&pSwProvider);
|
hr = IVdsSwProvider_QueryInterface(pProvider, &IID_IVdsSwProvider, (void**)&pSwProvider);
|
||||||
IVdsProvider_Release(pProvider);
|
IVdsProvider_Release(pProvider);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
suprintf("Could not get VDS Software Provider: %s", WindowsErrorString());
|
suprintf("Could not get VDS Software Provider: %s", WindowsErrorString());
|
||||||
goto out;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get VDS Software Provider Packs
|
// Get VDS Software Provider Packs
|
||||||
hr = IVdsSwProvider_QueryPacks(pSwProvider, &pEnumPack);
|
hr = IVdsSwProvider_QueryPacks(pSwProvider, &pEnumPack);
|
||||||
IVdsSwProvider_Release(pSwProvider);
|
IVdsSwProvider_Release(pSwProvider);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
suprintf("Could not get VDS Software Provider Packs: %s", WindowsErrorString());
|
suprintf("Could not get VDS Software Provider Packs: %s", WindowsErrorString());
|
||||||
goto out;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enumerate Provider Packs
|
// Enumerate Provider Packs
|
||||||
|
@ -625,18 +610,16 @@ static BOOL GetVdsDiskInterface(DWORD DriveIndex, const IID* InterfaceIID, void*
|
||||||
hr = IUnknown_QueryInterface(pPackUnk, &IID_IVdsPack, (void**)&pPack);
|
hr = IUnknown_QueryInterface(pPackUnk, &IID_IVdsPack, (void**)&pPack);
|
||||||
IUnknown_Release(pPackUnk);
|
IUnknown_Release(pPackUnk);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
suprintf("Could not query VDS Software Provider Pack: %s", WindowsErrorString());
|
suprintf("Could not query VDS Software Provider Pack: %s", WindowsErrorString());
|
||||||
goto out;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the pack interface to access the disks
|
// Use the pack interface to access the disks
|
||||||
hr = IVdsPack_QueryDisks(pPack, &pEnumDisk);
|
hr = IVdsPack_QueryDisks(pPack, &pEnumDisk);
|
||||||
IVdsPack_Release(pPack);
|
IVdsPack_Release(pPack);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
suprintf("Could not query VDS disks: %s", WindowsErrorString());
|
suprintf("Could not query VDS disks: %s", WindowsErrorString());
|
||||||
goto out;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// List disks
|
// List disks
|
||||||
|
@ -648,36 +631,34 @@ static BOOL GetVdsDiskInterface(DWORD DriveIndex, const IID* InterfaceIID, void*
|
||||||
hr = IUnknown_QueryInterface(pDiskUnk, &IID_IVdsDisk, (void**)&pDisk);
|
hr = IUnknown_QueryInterface(pDiskUnk, &IID_IVdsDisk, (void**)&pDisk);
|
||||||
IUnknown_Release(pDiskUnk);
|
IUnknown_Release(pDiskUnk);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
suprintf("Could not query VDS Disk Interface: %s", WindowsErrorString());
|
suprintf("Could not query VDS Disk Interface: %s", WindowsErrorString());
|
||||||
goto out;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the disk properties
|
// Get the disk properties
|
||||||
hr = IVdsDisk_GetProperties(pDisk, &prop);
|
hr = IVdsDisk_GetProperties(pDisk, &prop);
|
||||||
if ((hr != S_OK) && (hr != VDS_S_PROPERTIES_INCOMPLETE)) {
|
if ((hr != S_OK) && (hr != VDS_S_PROPERTIES_INCOMPLETE)) {
|
||||||
IVdsDisk_Release(pDisk);
|
IVdsDisk_Release(pDisk);
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
suprintf("Could not query VDS Disk Properties: %s", WindowsErrorString());
|
suprintf("Could not query VDS Disk Properties: %s", WindowsErrorString());
|
||||||
goto out;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we are on the target disk
|
// Check if we are on the target disk
|
||||||
hr = (HRESULT)_wcsicmp(wPhysicalName, prop.pwszName);
|
hr = (HRESULT)_wcsicmp(wPhysicalName, prop.pwszName);
|
||||||
CoTaskMemFree(prop.pwszName);
|
CoTaskMemFree(prop.pwszName);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
IVdsDisk_Release(pDisk);
|
hr = S_OK;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Instantiate the requested VDS disk interface
|
// Instantiate the requested VDS disk interface
|
||||||
hr = IVdsDisk_QueryInterface(pDisk, InterfaceIID, pInterfaceInstance);
|
hr = IVdsDisk_QueryInterface(pDisk, InterfaceIID, pInterfaceInstance);
|
||||||
IVdsDisk_Release(pDisk);
|
IVdsDisk_Release(pDisk);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK)
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
suprintf("Could not access the requested Disk interface: %s", WindowsErrorString());
|
suprintf("Could not access the requested Disk interface: %s", WindowsErrorString());
|
||||||
}
|
|
||||||
goto out;
|
// With the interface found, we should be able to return
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
IEnumVdsObject_Release(pEnumDisk);
|
IEnumVdsObject_Release(pEnumDisk);
|
||||||
}
|
}
|
||||||
|
@ -686,6 +667,7 @@ static BOOL GetVdsDiskInterface(DWORD DriveIndex, const IID* InterfaceIID, void*
|
||||||
IEnumVdsObject_Release(pEnum);
|
IEnumVdsObject_Release(pEnum);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
VDS_SET_ERROR(hr);
|
||||||
return (hr == S_OK);
|
return (hr == S_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -713,10 +695,8 @@ BOOL DeletePartition(DWORD DriveIndex, ULONGLONG PartitionOffset, BOOL bSilent)
|
||||||
suprintf("● Partition %d (offset: %lld, size: %s)", prop_array[i].ulPartitionNumber,
|
suprintf("● Partition %d (offset: %lld, size: %s)", prop_array[i].ulPartitionNumber,
|
||||||
prop_array[i].ullOffset, SizeToHumanReadable(prop_array[i].ullSize, FALSE, FALSE));
|
prop_array[i].ullOffset, SizeToHumanReadable(prop_array[i].ullSize, FALSE, FALSE));
|
||||||
hr = IVdsAdvancedDisk_DeletePartition(pAdvancedDisk, prop_array[i].ullOffset, TRUE, TRUE);
|
hr = IVdsAdvancedDisk_DeletePartition(pAdvancedDisk, prop_array[i].ullOffset, TRUE, TRUE);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK)
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
suprintf("Could not delete partition: %s", WindowsErrorString());
|
suprintf("Could not delete partition: %s", WindowsErrorString());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
suprintf("No partition to delete on disk");
|
suprintf("No partition to delete on disk");
|
||||||
|
@ -724,6 +704,7 @@ BOOL DeletePartition(DWORD DriveIndex, ULONGLONG PartitionOffset, BOOL bSilent)
|
||||||
}
|
}
|
||||||
CoTaskMemFree(prop_array);
|
CoTaskMemFree(prop_array);
|
||||||
IVdsAdvancedDisk_Release(pAdvancedDisk);
|
IVdsAdvancedDisk_Release(pAdvancedDisk);
|
||||||
|
VDS_SET_ERROR(hr);
|
||||||
return (hr == S_OK);
|
return (hr == S_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -753,7 +734,6 @@ BOOL ListVdsVolumes(BOOL bSilent)
|
||||||
hr = CoCreateInstance(&CLSID_VdsLoader, NULL, CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER,
|
hr = CoCreateInstance(&CLSID_VdsLoader, NULL, CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER,
|
||||||
&IID_IVdsServiceLoader, (void**)&pLoader);
|
&IID_IVdsServiceLoader, (void**)&pLoader);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
suprintf("Could not create VDS Loader Instance: %s", WindowsErrorString());
|
suprintf("Could not create VDS Loader Instance: %s", WindowsErrorString());
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -762,7 +742,6 @@ BOOL ListVdsVolumes(BOOL bSilent)
|
||||||
hr = IVdsServiceLoader_LoadService(pLoader, L"", &pService);
|
hr = IVdsServiceLoader_LoadService(pLoader, L"", &pService);
|
||||||
IVdsServiceLoader_Release(pLoader);
|
IVdsServiceLoader_Release(pLoader);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
suprintf("Could not load VDS Service: %s", WindowsErrorString());
|
suprintf("Could not load VDS Service: %s", WindowsErrorString());
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -770,7 +749,6 @@ BOOL ListVdsVolumes(BOOL bSilent)
|
||||||
// Wait for the Service to become ready if needed
|
// Wait for the Service to become ready if needed
|
||||||
hr = IVdsService_WaitForServiceReady(pService);
|
hr = IVdsService_WaitForServiceReady(pService);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
suprintf("VDS Service is not ready: %s", WindowsErrorString());
|
suprintf("VDS Service is not ready: %s", WindowsErrorString());
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -779,7 +757,6 @@ BOOL ListVdsVolumes(BOOL bSilent)
|
||||||
hr = IVdsService_QueryProviders(pService, VDS_QUERY_SOFTWARE_PROVIDERS, &pEnum);
|
hr = IVdsService_QueryProviders(pService, VDS_QUERY_SOFTWARE_PROVIDERS, &pEnum);
|
||||||
IVdsService_Release(pService);
|
IVdsService_Release(pService);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
suprintf("Could not query VDS Service Providers: %s", WindowsErrorString());
|
suprintf("Could not query VDS Service Providers: %s", WindowsErrorString());
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -794,27 +771,24 @@ BOOL ListVdsVolumes(BOOL bSilent)
|
||||||
hr = IUnknown_QueryInterface(pUnk, &IID_IVdsProvider, (void**)&pProvider);
|
hr = IUnknown_QueryInterface(pUnk, &IID_IVdsProvider, (void**)&pProvider);
|
||||||
IUnknown_Release(pUnk);
|
IUnknown_Release(pUnk);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
suprintf("Could not get VDS Provider: %s", WindowsErrorString());
|
suprintf("Could not get VDS Provider: %s", WindowsErrorString());
|
||||||
goto out;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get VDS Software Provider
|
// Get VDS Software Provider
|
||||||
hr = IVdsSwProvider_QueryInterface(pProvider, &IID_IVdsSwProvider, (void**)&pSwProvider);
|
hr = IVdsSwProvider_QueryInterface(pProvider, &IID_IVdsSwProvider, (void**)&pSwProvider);
|
||||||
IVdsProvider_Release(pProvider);
|
IVdsProvider_Release(pProvider);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
suprintf("Could not get VDS Software Provider: %s", WindowsErrorString());
|
suprintf("Could not get VDS Software Provider: %s", WindowsErrorString());
|
||||||
goto out;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get VDS Software Provider Packs
|
// Get VDS Software Provider Packs
|
||||||
hr = IVdsSwProvider_QueryPacks(pSwProvider, &pEnumPack);
|
hr = IVdsSwProvider_QueryPacks(pSwProvider, &pEnumPack);
|
||||||
IVdsSwProvider_Release(pSwProvider);
|
IVdsSwProvider_Release(pSwProvider);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
suprintf("Could not get VDS Software Provider Packs: %s", WindowsErrorString());
|
suprintf("Could not get VDS Software Provider Packs: %s", WindowsErrorString());
|
||||||
goto out;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enumerate Provider Packs
|
// Enumerate Provider Packs
|
||||||
|
@ -826,17 +800,15 @@ BOOL ListVdsVolumes(BOOL bSilent)
|
||||||
hr = IUnknown_QueryInterface(pPackUnk, &IID_IVdsPack, (void**)&pPack);
|
hr = IUnknown_QueryInterface(pPackUnk, &IID_IVdsPack, (void**)&pPack);
|
||||||
IUnknown_Release(pPackUnk);
|
IUnknown_Release(pPackUnk);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
suprintf("Could not query VDS Software Provider Pack: %s", WindowsErrorString());
|
suprintf("Could not query VDS Software Provider Pack: %s", WindowsErrorString());
|
||||||
goto out;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the pack interface to access the disks
|
// Use the pack interface to access the disks
|
||||||
hr = IVdsPack_QueryVolumes(pPack, &pEnumVolume);
|
hr = IVdsPack_QueryVolumes(pPack, &pEnumVolume);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
suprintf("Could not query VDS volumes: %s", WindowsErrorString());
|
suprintf("Could not query VDS volumes: %s", WindowsErrorString());
|
||||||
goto out;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// List volumes
|
// List volumes
|
||||||
|
@ -850,17 +822,15 @@ BOOL ListVdsVolumes(BOOL bSilent)
|
||||||
// Get the volume interface.
|
// Get the volume interface.
|
||||||
hr = IUnknown_QueryInterface(pVolumeUnk, &IID_IVdsVolume, (void**)&pVolume);
|
hr = IUnknown_QueryInterface(pVolumeUnk, &IID_IVdsVolume, (void**)&pVolume);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
suprintf("Could not query VDS Volume Interface: %s", WindowsErrorString());
|
suprintf("Could not query VDS Volume Interface: %s", WindowsErrorString());
|
||||||
goto out;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the volume properties
|
// Get the volume properties
|
||||||
hr = IVdsVolume_GetProperties(pVolume, &prop);
|
hr = IVdsVolume_GetProperties(pVolume, &prop);
|
||||||
if ((hr != S_OK) && (hr != VDS_S_PROPERTIES_INCOMPLETE)) {
|
if ((hr != S_OK) && (hr != VDS_S_PROPERTIES_INCOMPLETE)) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
suprintf("Could not query VDS Volume Properties: %s", WindowsErrorString());
|
suprintf("Could not query VDS Volume Properties: %s", WindowsErrorString());
|
||||||
goto out;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
uprintf("FOUND VOLUME: '%S'", prop.pwszName);
|
uprintf("FOUND VOLUME: '%S'", prop.pwszName);
|
||||||
|
@ -870,18 +840,17 @@ BOOL ListVdsVolumes(BOOL bSilent)
|
||||||
// Get the volume MF3 interface.
|
// Get the volume MF3 interface.
|
||||||
hr = IUnknown_QueryInterface(pVolumeUnk, &IID_IVdsVolumeMF3, (void**)&pVolumeMF3);
|
hr = IUnknown_QueryInterface(pVolumeUnk, &IID_IVdsVolumeMF3, (void**)&pVolumeMF3);
|
||||||
if (hr != S_OK) {
|
if (hr != S_OK) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
suprintf("Could not query VDS VolumeMF3 Interface: %s", WindowsErrorString());
|
suprintf("Could not query VDS VolumeMF3 Interface: %s", WindowsErrorString());
|
||||||
goto out;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the volume properties
|
// Get the volume properties
|
||||||
hr = IVdsVolumeMF3_QueryVolumeGuidPathnames(pVolumeMF3, &wszPathArray, &ulNumberOfPaths);
|
hr = IVdsVolumeMF3_QueryVolumeGuidPathnames(pVolumeMF3, &wszPathArray, &ulNumberOfPaths);
|
||||||
if ((hr != S_OK) && (hr != VDS_S_PROPERTIES_INCOMPLETE)) {
|
if ((hr != S_OK) && (hr != VDS_S_PROPERTIES_INCOMPLETE)) {
|
||||||
VDS_SET_ERROR(hr);
|
|
||||||
suprintf("Could not query VDS VolumeMF3 GUID PathNames: %s", WindowsErrorString());
|
suprintf("Could not query VDS VolumeMF3 GUID PathNames: %s", WindowsErrorString());
|
||||||
goto out;
|
break;
|
||||||
}
|
}
|
||||||
|
hr = S_OK;
|
||||||
|
|
||||||
for (i = 0; i < ulNumberOfPaths; i++)
|
for (i = 0; i < ulNumberOfPaths; i++)
|
||||||
uprintf(" VOL GUID: '%S'", wszPathArray[i]);
|
uprintf(" VOL GUID: '%S'", wszPathArray[i]);
|
||||||
|
@ -896,6 +865,7 @@ BOOL ListVdsVolumes(BOOL bSilent)
|
||||||
IEnumVdsObject_Release(pEnum);
|
IEnumVdsObject_Release(pEnum);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
VDS_SET_ERROR(hr);
|
||||||
return (hr == S_OK);
|
return (hr == S_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
|
|
||||||
#define FILE_FLOPPY_DISKETTE 0x00000004
|
#define FILE_FLOPPY_DISKETTE 0x00000004
|
||||||
|
|
||||||
#define VDS_SET_ERROR(hr) do { if (hr == S_FALSE) hr = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_GEN_FAILURE; FormatStatus = hr; SetLastError(hr); } while(0)
|
#define VDS_SET_ERROR(hr) do { if (hr != S_OK) { hr = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_GEN_FAILURE; FormatStatus = hr; SetLastError(hr); } } while(0)
|
||||||
|
|
||||||
#if !defined(__MINGW32__)
|
#if !defined(__MINGW32__)
|
||||||
typedef enum _FSINFOCLASS {
|
typedef enum _FSINFOCLASS {
|
||||||
|
|
10
src/rufus.rc
10
src/rufus.rc
|
@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||||
IDD_DIALOG DIALOGEX 12, 12, 232, 326
|
IDD_DIALOG DIALOGEX 12, 12, 232, 326
|
||||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
EXSTYLE WS_EX_ACCEPTFILES
|
EXSTYLE WS_EX_ACCEPTFILES
|
||||||
CAPTION "Rufus 3.13.1718"
|
CAPTION "Rufus 3.13.1719"
|
||||||
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
|
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
|
||||||
BEGIN
|
BEGIN
|
||||||
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
|
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
|
||||||
|
@ -395,8 +395,8 @@ END
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 3,13,1718,0
|
FILEVERSION 3,13,1719,0
|
||||||
PRODUCTVERSION 3,13,1718,0
|
PRODUCTVERSION 3,13,1719,0
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
|
@ -414,13 +414,13 @@ BEGIN
|
||||||
VALUE "Comments", "https://rufus.ie"
|
VALUE "Comments", "https://rufus.ie"
|
||||||
VALUE "CompanyName", "Akeo Consulting"
|
VALUE "CompanyName", "Akeo Consulting"
|
||||||
VALUE "FileDescription", "Rufus"
|
VALUE "FileDescription", "Rufus"
|
||||||
VALUE "FileVersion", "3.13.1718"
|
VALUE "FileVersion", "3.13.1719"
|
||||||
VALUE "InternalName", "Rufus"
|
VALUE "InternalName", "Rufus"
|
||||||
VALUE "LegalCopyright", "© 2011-2020 Pete Batard (GPL v3)"
|
VALUE "LegalCopyright", "© 2011-2020 Pete Batard (GPL v3)"
|
||||||
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
|
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
|
||||||
VALUE "OriginalFilename", "rufus-3.13.exe"
|
VALUE "OriginalFilename", "rufus-3.13.exe"
|
||||||
VALUE "ProductName", "Rufus"
|
VALUE "ProductName", "Rufus"
|
||||||
VALUE "ProductVersion", "3.13.1718"
|
VALUE "ProductVersion", "3.13.1719"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
Loading…
Reference in a new issue