Skip to content

Commit

Permalink
Fixed infinite WMI enumeration.
Browse files Browse the repository at this point in the history
  • Loading branch information
raspopov committed Jul 23, 2024
1 parent 6583f22 commit 242d387
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion VisualDiskImager/DeviceEnum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void CVisualDiskImagerDlg::EnumDevices(bool bSilent)
{
CComPtr< IWbemClassObject > disk;
ULONG uReturn = 0;
hr = disks->Next( WBEM_INFINITE, 1, &disk, &uReturn );
hr = disks->Next( WMI_TIMEOUT, 1, &disk, &uReturn );
if ( FAILED( hr ) || uReturn == 0 )
{
break;
Expand Down
2 changes: 2 additions & 0 deletions VisualDiskImager/VisualDiskImager.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ extern CVisualDiskImagerApp theApp;
#define REG_VERIFY _T("Verify")
#define REG_OFFSET _T("Offset")

#define WMI_TIMEOUT 5000 // WMI query timeout (ms)

// Log priority
enum LogPriority { LOG_ERROR = 0, LOG_INFO, LOG_WARNING, LOG_ACTION, LOG_DEVICE, LOG_VOLUME };

Expand Down

0 comments on commit 242d387

Please sign in to comment.