mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 13:16:07 +00:00
[VCDCONTROLTOOL] Enable driver start/stop buttons depending on the service status
This commit is contained in:
parent
b518fc065d
commit
044a7022c5
1 changed files with 36 additions and 1 deletions
|
@ -182,6 +182,20 @@ RefreshDevicesList(WCHAR Letter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
SetServiceState(BOOLEAN Started)
|
||||||
|
{
|
||||||
|
HWND hControl;
|
||||||
|
|
||||||
|
/* If started, disable start button */
|
||||||
|
hControl = GetDlgItem(hDriverWnd, IDC_DRIVERSTART);
|
||||||
|
EnableWindow(hControl, !Started);
|
||||||
|
|
||||||
|
/* If started, enable stop button */
|
||||||
|
hControl = GetDlgItem(hDriverWnd, IDC_DRIVERSTOP);
|
||||||
|
EnableWindow(hControl, Started);
|
||||||
|
}
|
||||||
|
|
||||||
INT_PTR
|
INT_PTR
|
||||||
QueryDriverInfo(HWND hDlg)
|
QueryDriverInfo(HWND hDlg)
|
||||||
{
|
{
|
||||||
|
@ -190,6 +204,7 @@ QueryDriverInfo(HWND hDlg)
|
||||||
LPQUERY_SERVICE_CONFIGW pConfig;
|
LPQUERY_SERVICE_CONFIGW pConfig;
|
||||||
WCHAR szText[2 * MAX_PATH];
|
WCHAR szText[2 * MAX_PATH];
|
||||||
HWND hControl;
|
HWND hControl;
|
||||||
|
SERVICE_STATUS Status;
|
||||||
|
|
||||||
hDriverWnd = hDlg;
|
hDriverWnd = hDlg;
|
||||||
|
|
||||||
|
@ -198,7 +213,7 @@ QueryDriverInfo(HWND hDlg)
|
||||||
if (hMgr != NULL)
|
if (hMgr != NULL)
|
||||||
{
|
{
|
||||||
/* Open our service */
|
/* Open our service */
|
||||||
hSvc = OpenService(hMgr, L"Vcdrom", SERVICE_QUERY_CONFIG);
|
hSvc = OpenService(hMgr, L"Vcdrom", SERVICE_QUERY_CONFIG | SERVICE_QUERY_STATUS);
|
||||||
if (hSvc != NULL)
|
if (hSvc != NULL)
|
||||||
{
|
{
|
||||||
/* Probe its config size */
|
/* Probe its config size */
|
||||||
|
@ -219,6 +234,20 @@ QueryDriverInfo(HWND hDlg)
|
||||||
HeapFree(GetProcessHeap(), 0, pConfig);
|
HeapFree(GetProcessHeap(), 0, pConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Get its status */
|
||||||
|
if (QueryServiceStatus(hSvc, &Status))
|
||||||
|
{
|
||||||
|
if (Status.dwCurrentState != SERVICE_RUNNING &&
|
||||||
|
Status.dwCurrentState != SERVICE_START_PENDING)
|
||||||
|
{
|
||||||
|
SetServiceState(FALSE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetServiceState(TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CloseServiceHandle(hSvc);
|
CloseServiceHandle(hSvc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,6 +290,9 @@ StartDriver(VOID)
|
||||||
|
|
||||||
/* Refresh the list in case there were persistent mounts */
|
/* Refresh the list in case there were persistent mounts */
|
||||||
RefreshDevicesList(0);
|
RefreshDevicesList(0);
|
||||||
|
|
||||||
|
/* Update buttons */
|
||||||
|
SetServiceState(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseServiceHandle(hMgr);
|
CloseServiceHandle(hMgr);
|
||||||
|
@ -290,6 +322,9 @@ StopDriver(VOID)
|
||||||
|
|
||||||
/* Refresh the list to clear it */
|
/* Refresh the list to clear it */
|
||||||
RefreshDevicesList(0);
|
RefreshDevicesList(0);
|
||||||
|
|
||||||
|
/* Update buttons */
|
||||||
|
SetServiceState(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseServiceHandle(hMgr);
|
CloseServiceHandle(hMgr);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue