ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
April 2015
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
17 participants
481 discussions
Start a n
N
ew thread
[gedmurphy] 67094: [SERVMAN] - Rewrite the progress dialog making it responsible for controlling services. (starting, stopping, etc). - Fixup the rest of the code to make use of running actions thr...
by gedmurphy@svn.reactos.org
Author: gedmurphy Date: Wed Apr 8 17:28:46 2015 New Revision: 67094 URL:
http://svn.reactos.org/svn/reactos?rev=67094&view=rev
Log: [SERVMAN] - Rewrite the progress dialog making it responsible for controlling services. (starting, stopping, etc). - Fixup the rest of the code to make use of running actions through the progress dialog. - As a side-effect, this should fix CORE-4585 Modified: trunk/reactos/base/applications/mscutils/servman/control.c trunk/reactos/base/applications/mscutils/servman/mainwnd.c trunk/reactos/base/applications/mscutils/servman/precomp.h trunk/reactos/base/applications/mscutils/servman/progress.c trunk/reactos/base/applications/mscutils/servman/start.c trunk/reactos/base/applications/mscutils/servman/stop.c trunk/reactos/base/applications/mscutils/servman/stop_dependencies.c Modified: trunk/reactos/base/applications/mscutils/servman/control.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
============================================================================== --- trunk/reactos/base/applications/mscutils/servman/control.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/mscutils/servman/control.c [iso-8859-1] Wed Apr 8 17:28:46 2015 @@ -3,180 +3,143 @@ * LICENSE: GPL - See COPYING in the top level directory * FILE: base/applications/mscutils/servman/control.c * PURPOSE: Pauses and resumes a service - * COPYRIGHT: Copyright 2006-2010 Ged Murphy <gedmurphy(a)reactos.org> + * COPYRIGHT: Copyright 2006-2015 Ged Murphy <gedmurphy(a)reactos.org> * */ #include "precomp.h" -static BOOL -DoControl(PMAIN_WND_INFO Info, - HWND hProgress, - DWORD Control) +#define MAX_WAIT_TIME 30000 + +BOOL +DoControlService(LPWSTR ServiceName, + HWND hProgress, + DWORD Control) { SC_HANDLE hSCManager; SC_HANDLE hService; SERVICE_STATUS_PROCESS ServiceStatus = {0}; SERVICE_STATUS Status; DWORD BytesNeeded = 0; - DWORD dwStartTickCount; - DWORD dwOldCheckPoint; - DWORD dwWaitTime; - DWORD dwMaxWait; - DWORD dwReqState; - BOOL bRet = FALSE; + DWORD StartTickCount; + DWORD OldCheckPoint; + DWORD WaitTime; + DWORD MaxWait; + DWORD ReqState; + BOOL Result; /* Set the state we're interested in */ switch (Control) { case SERVICE_CONTROL_PAUSE: - dwReqState = SERVICE_PAUSED; + ReqState = SERVICE_PAUSED; break; case SERVICE_CONTROL_CONTINUE: - dwReqState = SERVICE_RUNNING; + ReqState = SERVICE_RUNNING; break; default: /* Unhandled control code */ return FALSE; } - hSCManager = OpenSCManager(NULL, - NULL, - SC_MANAGER_CONNECT); - if (hSCManager) + hSCManager = OpenSCManagerW(NULL, + NULL, + SC_MANAGER_CONNECT); + if (!hSCManager) return FALSE; + + hService = OpenServiceW(hSCManager, + ServiceName, + SERVICE_PAUSE_CONTINUE | SERVICE_INTERROGATE | SERVICE_QUERY_STATUS); + if (!hService) { - hService = OpenService(hSCManager, - Info->pCurrentService->lpServiceName, - SERVICE_PAUSE_CONTINUE | SERVICE_INTERROGATE | SERVICE_QUERY_STATUS); - if (hService) + CloseServiceHandle(hSCManager); + return FALSE; + } + + /* Send the control message to the service */ + Result = ControlService(hService, + Control, + &Status); + if (Result) + { + if (hProgress) { - if (hProgress) + /* Increment the progress bar */ + IncrementProgressBar(hProgress, DEFAULT_STEP); + } + + /* Get the service status */ + Result = QueryServiceStatusEx(hService, + SC_STATUS_PROCESS_INFO, + (LPBYTE)&ServiceStatus, + sizeof(SERVICE_STATUS_PROCESS), + &BytesNeeded); + if (Result) + { + Result = FALSE; + MaxWait = MAX_WAIT_TIME; + OldCheckPoint = ServiceStatus.dwCheckPoint; + StartTickCount = GetTickCount(); + + /* Loop until it's at the correct state */ + while (ServiceStatus.dwCurrentState != ReqState) { - /* Increment the progress bar */ - IncrementProgressBar(hProgress, DEFAULT_STEP); - } + /* Fixup the wait time */ + WaitTime = ServiceStatus.dwWaitHint / 10; - /* Send the control message to the service */ - if (ControlService(hService, - Control, - &Status)) - { - /* Get the service status */ - if (QueryServiceStatusEx(hService, - SC_STATUS_PROCESS_INFO, - (LPBYTE)&ServiceStatus, - sizeof(SERVICE_STATUS_PROCESS), - &BytesNeeded)) + if (WaitTime < 1000) WaitTime = 1000; + else if (WaitTime > 10000) WaitTime = 10000; + + /* We don't wanna wait for up to 10 secs without incrementing */ + for (int i = WaitTime / 1000; i > 0; i--) { - /* We don't want to wait for more than 30 seconds */ - dwMaxWait = 30000; - dwStartTickCount = GetTickCount(); - - /* Loop until it's at the correct state */ - while (ServiceStatus.dwCurrentState != dwReqState) + Sleep(1000); + if (hProgress) { - dwOldCheckPoint = ServiceStatus.dwCheckPoint; - dwWaitTime = ServiceStatus.dwWaitHint / 10; - - /* Get the latest status info */ - if (!QueryServiceStatusEx(hService, - SC_STATUS_PROCESS_INFO, - (LPBYTE)&ServiceStatus, - sizeof(SERVICE_STATUS_PROCESS), - &BytesNeeded)) - { - /* Something went wrong... */ - break; - } - - /* Is the service making progress? */ - if (ServiceStatus.dwCheckPoint > dwOldCheckPoint) - { - /* It is, get the latest tickcount to reset the max wait time */ - dwStartTickCount = GetTickCount(); - dwOldCheckPoint = ServiceStatus.dwCheckPoint; - IncrementProgressBar(hProgress, DEFAULT_STEP); - } - else - { - /* It's not, make sure we haven't exceeded our wait time */ - if(GetTickCount() >= dwStartTickCount + dwMaxWait) - { - /* We have, give up */ - break; - } - } - - /* Adjust the wait hint times */ - if (dwWaitTime < 200) - dwWaitTime = 200; - else if (dwWaitTime > 10000) - dwWaitTime = 10000; - - /* Wait before trying again */ - Sleep(dwWaitTime); + /* Increment the progress bar */ + IncrementProgressBar(hProgress, DEFAULT_STEP); } } - if (ServiceStatus.dwCurrentState == dwReqState) + /* Get the latest status info */ + if (!QueryServiceStatusEx(hService, + SC_STATUS_PROCESS_INFO, + (LPBYTE)&ServiceStatus, + sizeof(SERVICE_STATUS_PROCESS), + &BytesNeeded)) { - bRet = TRUE; + /* Something went wrong... */ + break; + } + + /* Is the service making progress? */ + if (ServiceStatus.dwCheckPoint > OldCheckPoint) + { + /* It is, get the latest tickcount to reset the max wait time */ + StartTickCount = GetTickCount(); + OldCheckPoint = ServiceStatus.dwCheckPoint; + IncrementProgressBar(hProgress, DEFAULT_STEP); + } + else + { + /* It's not, make sure we haven't exceeded our wait time */ + if(GetTickCount() >= StartTickCount + MaxWait) + { + /* We have, give up */ + break; + } } } - - CloseServiceHandle(hService); } - CloseServiceHandle(hSCManager); + if (ServiceStatus.dwCurrentState == ReqState) + { + Result = TRUE; + } } - return bRet; + CloseServiceHandle(hService); + CloseServiceHandle(hSCManager); + + return Result; } - -BOOL -DoPause(PMAIN_WND_INFO Info) -{ - HWND hProgress; - BOOL bRet = FALSE; - - /* Create a progress window to track the progress of the pausing service */ - hProgress = CreateProgressDialog(Info->hMainWnd, - IDS_PROGRESS_INFO_PAUSE); - if (hProgress) - { - /* Set the service name and reset the progress bag */ - InitializeProgressDialog(hProgress, Info->pCurrentService->lpServiceName); - - /* Resume the requested service */ - bRet = DoControl(Info, hProgress, SERVICE_CONTROL_PAUSE); - - /* Complete and destroy the progress bar */ - DestroyProgressDialog(hProgress, bRet); - } - - return bRet; -} - -BOOL -DoResume(PMAIN_WND_INFO Info) -{ - HWND hProgress; - BOOL bRet = FALSE; - - /* Create a progress window to track the progress of the resuming service */ - hProgress = CreateProgressDialog(Info->hMainWnd, - IDS_PROGRESS_INFO_RESUME); - if (hProgress) - { - /* Set the service name and reset the progress bag */ - InitializeProgressDialog(hProgress, Info->pCurrentService->lpServiceName); - - /* Resume the requested service */ - bRet = DoControl(Info, hProgress, SERVICE_CONTROL_CONTINUE); - - /* Complete and destroy the progress bar */ - DestroyProgressDialog(hProgress, bRet); - } - - return bRet; -} Modified: trunk/reactos/base/applications/mscutils/servman/mainwnd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
============================================================================== --- trunk/reactos/base/applications/mscutils/servman/mainwnd.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/mscutils/servman/mainwnd.c [iso-8859-1] Wed Apr 8 17:28:46 2015 @@ -3,7 +3,7 @@ * LICENSE: GPL - See COPYING in the top level directory * FILE: base/applications/mscutils/servman/mainwnd.c * PURPOSE: Main window message handler - * COPYRIGHT: Copyright 2006-2007 Ged Murphy <gedmurphy(a)reactos.org> + * COPYRIGHT: Copyright 2006-20015 Ged Murphy <gedmurphy(a)reactos.org> * */ @@ -11,7 +11,7 @@ #include <windowsx.h> -static const TCHAR szMainWndClass[] = TEXT("ServManWndClass"); +static const WCHAR szMainWndClass[] = L"ServManWndClass"; BOOL bSortAscending = TRUE; @@ -126,17 +126,17 @@ VOID UpdateServiceCount(PMAIN_WND_INFO Info) { - LPTSTR lpNumServices; + LPWSTR lpNumServices; if (AllocAndLoadString(&lpNumServices, hInstance, IDS_NUM_SERVICES)) { - TCHAR szNumServices[32]; + WCHAR szNumServices[32]; INT NumListedServ = ListView_GetItemCount(Info->hListView); - _sntprintf(szNumServices, + _snwprintf(szNumServices, 31, lpNumServices, NumListedServ); @@ -257,7 +257,7 @@ Param1 = (ENUM_SERVICE_STATUS_PROCESS *)lParam2; Param2 = (ENUM_SERVICE_STATUS_PROCESS *)lParam1; } - return _tcsicmp(Param1->lpDisplayName, Param2->lpDisplayName); + return _wcsicmp(Param1->lpDisplayName, Param2->lpDisplayName); } @@ -344,24 +344,24 @@ { if (!pCreateToolbar(Info)) { - DisplayString(_T("error creating toolbar")); + DisplayString(L"error creating toolbar"); return FALSE; } if (!CreateListView(Info)) { - DisplayString(_T("error creating list view")); + DisplayString(L"error creating list view"); return FALSE; } if (!CreateStatusBar(Info)) - DisplayString(_T("error creating status bar")); + DisplayString(L"error creating status bar"); /* Create Popup Menu */ Info->hShortcutMenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_POPUP)); - Info->bIsUserAnAdmin = IsUserAnAdmin(); + Info->bIsUserAnAdmin = TRUE;// IsUserAnAdmin(); if (Info->bIsUserAnAdmin) { HMENU hMainMenu = GetMenu(Info->hMainWnd); @@ -418,7 +418,7 @@ SendMessage(Info->hStatus, SB_SETTEXT, 1, - _T('\0')); + L'\0'); } break; @@ -457,11 +457,11 @@ } else { - TCHAR Buf[60]; + WCHAR Buf[60]; LoadString(hInstance, IDS_DELETE_STOP, Buf, - sizeof(Buf) / sizeof(TCHAR)); + sizeof(Buf) / sizeof(WCHAR)); DisplayString(Buf); } @@ -472,50 +472,73 @@ case ID_START: { - if (DoStart(Info, NULL)) - { - UpdateServiceStatus(Info->pCurrentService); - ChangeListViewText(Info, Info->pCurrentService, LVSTATUS); - SetMenuAndButtonStates(Info); - SetFocus(Info->hListView); - } + RunActionWithProgress(Info->hMainWnd, + Info->pCurrentService->lpServiceName, + Info->pCurrentService->lpDisplayName, + ACTION_START); + + UpdateServiceStatus(Info->pCurrentService); + ChangeListViewText(Info, Info->pCurrentService, LVSTATUS); + SetMenuAndButtonStates(Info); + SetFocus(Info->hListView); + } break; case ID_STOP: - if (DoStop(Info)) - { - UpdateServiceStatus(Info->pCurrentService); - ChangeListViewText(Info, Info->pCurrentService, LVSTATUS); - SetMenuAndButtonStates(Info); - SetFocus(Info->hListView); - } + RunActionWithProgress(Info->hMainWnd, + Info->pCurrentService->lpServiceName, + Info->pCurrentService->lpDisplayName, + ACTION_STOP); + + UpdateServiceStatus(Info->pCurrentService); + ChangeListViewText(Info, Info->pCurrentService, LVSTATUS); + SetMenuAndButtonStates(Info); + SetFocus(Info->hListView); + break; case ID_PAUSE: - DoPause(Info); + RunActionWithProgress(Info->hMainWnd, + Info->pCurrentService->lpServiceName, + Info->pCurrentService->lpDisplayName, + ACTION_PAUSE); + + UpdateServiceStatus(Info->pCurrentService); + ChangeListViewText(Info, Info->pCurrentService, LVSTATUS); + SetMenuAndButtonStates(Info); + SetFocus(Info->hListView); break; case ID_RESUME: - DoResume(Info); + RunActionWithProgress(Info->hMainWnd, + Info->pCurrentService->lpServiceName, + Info->pCurrentService->lpDisplayName, + ACTION_RESUME); + + UpdateServiceStatus(Info->pCurrentService); + ChangeListViewText(Info, Info->pCurrentService, LVSTATUS); + SetMenuAndButtonStates(Info); + SetFocus(Info->hListView); break; case ID_RESTART: - if (DoStop(Info)) - { - DoStart(Info, NULL); - UpdateServiceStatus(Info->pCurrentService); - ChangeListViewText(Info, Info->pCurrentService, LVSTATUS); - SetMenuAndButtonStates(Info); - SetFocus(Info->hListView); - } + RunActionWithProgress(Info->hMainWnd, + Info->pCurrentService->lpServiceName, + Info->pCurrentService->lpDisplayName, + ACTION_RESTART); + + UpdateServiceStatus(Info->pCurrentService); + ChangeListViewText(Info, Info->pCurrentService, LVSTATUS); + SetMenuAndButtonStates(Info); + SetFocus(Info->hListView); break; case ID_HELP: - MessageBox(NULL, - _T("Help is not yet implemented\n"), - _T("Note!"), - MB_OK | MB_ICONINFORMATION); + MessageBoxW(NULL, + L"Help is not yet implemented\n", + L"Note!", + MB_OK | MB_ICONINFORMATION); SetFocus(Info->hListView); break; Modified: trunk/reactos/base/applications/mscutils/servman/precomp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
============================================================================== --- trunk/reactos/base/applications/mscutils/servman/precomp.h [iso-8859-1] (original) +++ trunk/reactos/base/applications/mscutils/servman/precomp.h [iso-8859-1] Wed Apr 8 17:28:46 2015 @@ -1,6 +1,7 @@ #ifndef __SERVMAN_PRECOMP_H #define __SERVMAN_PRECOMP_H +#if 0 #include <stdarg.h> #define WIN32_NO_STATUS @@ -12,10 +13,14 @@ #include <wingdi.h> #include <winsvc.h> #include <wincon.h> -#include <tchar.h> #include <shlobj.h> #include <strsafe.h> - +#else +#include <windows.h> +#include <Commctrl.h> +#include <process.h> +#include <Strsafe.h> +#endif #include "resource.h" #ifdef _MSC_VER @@ -23,17 +28,23 @@ #endif #define NO_ITEM_SELECTED -1 -#define MAX_KEY_LENGTH 256 +#define MAX_KEY_LENGTH 256 -#define LVNAME 0 -#define LVDESC 1 -#define LVSTATUS 2 -#define LVSTARTUP 3 -#define LVLOGONAS 4 +#define LVNAME 0 +#define LVDESC 1 +#define LVSTATUS 2 +#define LVSTARTUP 3 +#define LVLOGONAS 4 -#define IMAGE_UNKNOWN 0 -#define IMAGE_SERVICE 1 -#define IMAGE_DRIVER 2 +#define IMAGE_UNKNOWN 0 +#define IMAGE_SERVICE 1 +#define IMAGE_DRIVER 2 + +#define ACTION_START 1 +#define ACTION_STOP 2 +#define ACTION_PAUSE 3 +#define ACTION_RESUME 4 +#define ACTION_RESTART 5 typedef struct _MAIN_WND_INFO { @@ -86,38 +97,24 @@ VOID ListViewSelectionChanged(PMAIN_WND_INFO Info, LPNMLISTVIEW pnmv); BOOL CreateListView(PMAIN_WND_INFO Info); -/* start */ -BOOL DoStart(PMAIN_WND_INFO Info, LPWSTR lpStartParams); - -/* stop */ -typedef struct _STOP_INFO -{ - PMAIN_WND_INFO pInfo; - SC_HANDLE hSCManager; - SC_HANDLE hMainService; -} STOP_INFO, *PSTOP_INFO; - -/* control */ -BOOL Control(PMAIN_WND_INFO Info, HWND hProgress, DWORD Control); -BOOL DoStop(PMAIN_WND_INFO Info); -BOOL DoPause(PMAIN_WND_INFO Info); -BOOL DoResume(PMAIN_WND_INFO Info); +/* start / stop / control */ +BOOL DoStartService(LPWSTR ServiceName, HANDLE hProgress, LPWSTR lpStartParams); +BOOL DoStopService(LPWSTR ServiceName, HANDLE hProgress); +BOOL DoControlService(LPWSTR ServiceName, HWND hProgress, DWORD Control); /* progress.c */ #define DEFAULT_STEP 0 -HWND CreateProgressDialog(HWND hParent, UINT LabelId); -BOOL DestroyProgressDialog(HWND hProgress, BOOL bComplete); -VOID InitializeProgressDialog(HWND hProgress, LPWSTR lpServiceName); -VOID IncrementProgressBar(HWND hProgress, UINT NewPos); -VOID CompleteProgressBar(HWND hProgress); +BOOL RunActionWithProgress(HWND hParent, LPWSTR ServiceName, LPWSTR DisplayName, UINT Action); +VOID IncrementProgressBar(HANDLE hProgress, UINT NewPos); +VOID CompleteProgressBar(HANDLE hProgress); /* query.c */ ENUM_SERVICE_STATUS_PROCESS* GetSelectedService(PMAIN_WND_INFO Info); -LPQUERY_SERVICE_CONFIG GetServiceConfig(LPTSTR lpServiceName); -BOOL SetServiceConfig(LPQUERY_SERVICE_CONFIG pServiceConfig, LPTSTR lpServiceName, LPTSTR lpPassword); -LPTSTR GetServiceDescription(LPTSTR lpServiceName); -BOOL SetServiceDescription(LPTSTR lpServiceName, LPTSTR lpDescription); -LPTSTR GetExecutablePath(LPTSTR lpServiceName); +LPQUERY_SERVICE_CONFIG GetServiceConfig(LPWSTR lpServiceName); +BOOL SetServiceConfig(LPQUERY_SERVICE_CONFIG pServiceConfig, LPWSTR lpServiceName, LPWSTR lpPassword); +LPWSTR GetServiceDescription(LPWSTR lpServiceName); +BOOL SetServiceDescription(LPWSTR lpServiceName, LPWSTR lpDescription); +LPWSTR GetExecutablePath(LPWSTR lpServiceName); BOOL RefreshServiceList(PMAIN_WND_INFO Info); BOOL UpdateServiceStatus(ENUM_SERVICE_STATUS_PROCESS* pService); BOOL GetServiceList(PMAIN_WND_INFO Info, DWORD *NumServices); @@ -135,19 +132,24 @@ } SERVICEPROPSHEET, *PSERVICEPROPSHEET; -HTREEITEM AddItemToTreeView(HWND hTreeView, HTREEITEM hRoot, LPTSTR lpDisplayName, LPTSTR lpServiceName, ULONG serviceType, BOOL bHasChildren); +HTREEITEM AddItemToTreeView(HWND hTreeView, HTREEITEM hRoot, LPWSTR lpDisplayName, LPWSTR lpServiceName, ULONG serviceType, BOOL bHasChildren); /* stop_dependencies */ INT_PTR CALLBACK StopDependsDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); LPWSTR GetListOfServicesToStop(LPWSTR lpServiceName); +BOOL +CreateStopDependsDialog(HWND hParent, +LPWSTR ServiceName, +LPWSTR DisplayName, +LPWSTR ServiceList); /* tv1_dependencies */ -BOOL TV1_Initialize(PSERVICEPROPSHEET pDlgInfo, LPTSTR lpServiceName); -VOID TV1_AddDependantsToTree(PSERVICEPROPSHEET pDlgInfo, HTREEITEM hParent, LPTSTR lpServiceName); +BOOL TV1_Initialize(PSERVICEPROPSHEET pDlgInfo, LPWSTR lpServiceName); +VOID TV1_AddDependantsToTree(PSERVICEPROPSHEET pDlgInfo, HTREEITEM hParent, LPWSTR lpServiceName); /* tv2_dependencies */ -BOOL TV2_Initialize(PSERVICEPROPSHEET pDlgInfo, LPTSTR lpServiceName); -VOID TV2_AddDependantsToTree(PSERVICEPROPSHEET pDlgInfo, HTREEITEM hParent, LPTSTR lpServiceName); +BOOL TV2_Initialize(PSERVICEPROPSHEET pDlgInfo, LPWSTR lpServiceName); +VOID TV2_AddDependantsToTree(PSERVICEPROPSHEET pDlgInfo, HTREEITEM hParent, LPWSTR lpServiceName); BOOL TV2_HasDependantServices(LPWSTR lpServiceName); LPENUM_SERVICE_STATUS TV2_GetDependants(LPWSTR lpServiceName, LPDWORD lpdwCount); @@ -167,12 +169,12 @@ VOID ExportFile(PMAIN_WND_INFO Info); /* misc.c */ -INT AllocAndLoadString(OUT LPTSTR *lpTarget, +INT AllocAndLoadString(OUT LPWSTR *lpTarget, IN HINSTANCE hInst, IN UINT uID); DWORD LoadAndFormatString(IN HINSTANCE hInstance, IN UINT uID, - OUT LPTSTR *lpTarget, + OUT LPWSTR *lpTarget, ...); BOOL StatusBarLoadAndFormatString(IN HWND hStatusBar, IN INT PartId, @@ -183,11 +185,11 @@ IN INT PartId, IN HINSTANCE hInstance, IN UINT uID); -INT GetTextFromEdit(OUT LPTSTR lpString, +INT GetTextFromEdit(OUT LPWSTR lpString, IN HWND hDlg, IN UINT Res); VOID GetError(VOID); -VOID DisplayString(PTCHAR); +VOID DisplayString(PWCHAR); HIMAGELIST InitImageList(UINT StartResource, UINT EndResource, UINT Width, Modified: trunk/reactos/base/applications/mscutils/servman/progress.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
============================================================================== --- trunk/reactos/base/applications/mscutils/servman/progress.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/mscutils/servman/progress.c [iso-8859-1] Wed Apr 8 17:28:46 2015 @@ -3,95 +3,225 @@ * LICENSE: GPL - See COPYING in the top level directory * FILE: base/applications/mscutils/servman/progress.c * PURPOSE: Progress dialog box message handler - * COPYRIGHT: Copyright 2006-2010 Ged Murphy <gedmurphy(a)reactos.org> + * COPYRIGHT: Copyright 2006-2015 Ged Murphy <gedmurphy(a)reactos.org> * */ #include "precomp.h" -#define PROGRESSRANGE 20 - -VOID -CompleteProgressBar(HWND hProgDlg) -{ - HWND hProgBar; - UINT Pos = 0; - - /* Get a handle to the progress bar */ - hProgBar = GetDlgItem(hProgDlg, - IDC_SERVCON_PROGRESS); - if (hProgBar) - { - /* Get the current position */ - Pos = SendMessageW(hProgBar, - PBM_GETPOS, - 0, - 0); - - /* Loop until we hit the max */ - while (Pos <= PROGRESSRANGE) - { - /* Increment the progress bar */ - SendMessageW(hProgBar, - PBM_DELTAPOS, - Pos, - 0); - - /* Wait for 15ms, it gives it a smooth feel */ - Sleep(15); - Pos++; - } - } -} - -VOID -IncrementProgressBar(HWND hProgDlg, - UINT NewPos) -{ - HWND hProgBar; - - /* Get a handle to the progress bar */ - hProgBar = GetDlgItem(hProgDlg, - IDC_SERVCON_PROGRESS); - if (hProgBar) - { - /* Do we want to increment the default amount? */ - if (NewPos == DEFAULT_STEP) - { - /* Yes, use the step value we set on create */ - SendMessageW(hProgBar, - PBM_STEPIT, - 0, - 0); - } - else - { - /* No, use the value passed */ - SendMessageW(hProgBar, - PBM_SETPOS, - NewPos, - 0); - } - } -} - -VOID -InitializeProgressDialog(HWND hProgDlg, - LPWSTR lpServiceName) -{ +#define PROGRESS_RANGE 20 +#define PROGRESS_STEP_MAX 15 + +typedef struct _PROGRESS_DATA +{ + HWND hDlg; + HWND hProgress; + LPWSTR ServiceName; + ULONG Action; + BOOL StopDepends; + LPWSTR ServiceList; + +} PROGRESS_DATA, *PPROGRESS_DATA; + + +static VOID +ResetProgressDialog(HWND hDlg, + LPWSTR ServiceName, + ULONG LabelId) +{ + LPWSTR lpProgStr; + + /* Load the label Id */ + if (AllocAndLoadString(&lpProgStr, + hInstance, + LabelId)) + { + /* Write it to the dialog */ + SendDlgItemMessageW(hDlg, + IDC_SERVCON_INFO, + WM_SETTEXT, + 0, + (LPARAM)lpProgStr); + + LocalFree(lpProgStr); + } + /* Write the service name to the dialog */ - SendDlgItemMessageW(hProgDlg, + SendDlgItemMessageW(hDlg, IDC_SERVCON_NAME, WM_SETTEXT, 0, - (LPARAM)lpServiceName); + (LPARAM)ServiceName); /* Set the progress bar to the start */ - SendDlgItemMessageW(hProgDlg, + SendDlgItemMessageW(hDlg, IDC_SERVCON_PROGRESS, PBM_SETPOS, 0, 0); +} + +unsigned int __stdcall ActionThread(void* Param) +{ + PPROGRESS_DATA ProgressData = (PPROGRESS_DATA)Param; + + if (ProgressData->Action == ACTION_START) + { + /* Setup the progress dialog for this action */ + ResetProgressDialog(ProgressData->hDlg, + ProgressData->ServiceName, + IDS_PROGRESS_INFO_START); + + /* Start the service */ + if (DoStartService(ProgressData->ServiceName, + ProgressData->hProgress, + NULL)) + { + /* We're done, slide the progress bar up to the top */ + CompleteProgressBar(ProgressData->hProgress); + } + } + else if (ProgressData->Action == ACTION_STOP || ProgressData->Action == ACTION_RESTART) + { + /* Check if there are and dependants to stop */ + if (ProgressData->StopDepends && ProgressData->ServiceList) + { + LPWSTR lpStr = ProgressData->ServiceList; + + /* Loop through all the services in the list */ + for (;;) + { + /* Break when we hit the double null */ + if (*lpStr == L'\0' && *(lpStr + 1) == L'\0') + break; + + /* If this isn't our first time in the loop we'll + have been left on a null char */ + if (*lpStr == L'\0') + lpStr++; + + ResetProgressDialog(ProgressData->hDlg, + lpStr, + IDS_PROGRESS_INFO_STOP); + + /* Stop the requested service */ + if (DoStopService(ProgressData->ServiceName, + ProgressData->hProgress)) + { + CompleteProgressBar(ProgressData->hProgress); + } + + /* Move onto the next string */ + while (*lpStr != L'\0') + lpStr++; + } + } + + ResetProgressDialog(ProgressData->hDlg, + ProgressData->ServiceName, + IDS_PROGRESS_INFO_STOP); + + if (DoStopService(ProgressData->ServiceName, + ProgressData->hProgress)) + { + CompleteProgressBar(ProgressData->hProgress); + } + + + /* If this was a restart, we'll need to start the service back up */ + if (ProgressData->Action == ACTION_RESTART) + { + /* Setup the progress dialog for this action */ + ResetProgressDialog(ProgressData->hDlg, + ProgressData->ServiceName, + IDS_PROGRESS_INFO_START); + + /* Start the service */ + if (DoStartService(ProgressData->ServiceName, + ProgressData->hProgress, + NULL)) + { + /* We're done, slide the progress bar up to the top */ + CompleteProgressBar(ProgressData->hProgress); + } + } + } + else if (ProgressData->Action == ACTION_PAUSE) + { + /* Setup the progress dialog for this action */ + ResetProgressDialog(ProgressData->hDlg, + ProgressData->ServiceName, + IDS_PROGRESS_INFO_PAUSE); + + /* Pause the service */ + if (DoControlService(ProgressData->ServiceName, + ProgressData->hProgress, + SERVICE_CONTROL_PAUSE)) + { + /* We're done, slide the progress bar up to the top */ + CompleteProgressBar(ProgressData->hProgress); + } + } + else if (ProgressData->Action == ACTION_RESUME) + { + /* Setup the progress dialog for this action */ + ResetProgressDialog(ProgressData->hDlg, + ProgressData->ServiceName, + IDS_PROGRESS_INFO_RESUME); + + /* resume the service */ + if (DoControlService(ProgressData->ServiceName, + ProgressData->hProgress, + SERVICE_CONTROL_CONTINUE)) + { + /* We're done, slide the progress bar up to the top */ + CompleteProgressBar(ProgressData->hProgress); + } + } + + + EndDialog(ProgressData->hDlg, IDOK); + + _endthreadex(0); + return 0; +} + +static BOOL +InitDialog(HWND hDlg, + UINT Message, + WPARAM wParam, + LPARAM lParam) +{ + PPROGRESS_DATA ProgressData = (PPROGRESS_DATA)lParam; + HANDLE hThread; + + ProgressData->hDlg = hDlg; + + /* Get a handle to the progress bar */ + ProgressData->hProgress = GetDlgItem(hDlg, + IDC_SERVCON_PROGRESS); + if (!ProgressData->hProgress) + return FALSE; + + /* Set the progress bar range */ + SendMessageW(ProgressData->hProgress, + PBM_SETRANGE, + 0, + MAKELPARAM(0, PROGRESS_RANGE)); + + /* Set the progress bar step */ + SendMessageW(ProgressData->hProgress, + PBM_SETSTEP, + (WPARAM)1, + 0); + + /* Create a thread to handle the service control */ + hThread = (HANDLE)_beginthreadex(NULL, 0, &ActionThread, ProgressData, 0, NULL); + if (!hThread) return FALSE; + + CloseHandle(hThread); + + return TRUE; } INT_PTR CALLBACK @@ -104,35 +234,21 @@ { case WM_INITDIALOG: { - HWND hProgBar; - - /* Get a handle to the progress bar */ - hProgBar = GetDlgItem(hDlg, - IDC_SERVCON_PROGRESS); - - /* Set the progress bar range */ - SendMessageW(hProgBar, - PBM_SETRANGE, - 0, - MAKELPARAM(0, PROGRESSRANGE)); - - /* Set the progress bar step */ - SendMessageW(hProgBar, - PBM_SETSTEP, - (WPARAM)1, - 0); - } - break; + return InitDialog(hDlg, + Message, + wParam, + lParam); + } case WM_COMMAND: switch(LOWORD(wParam)) { case IDOK: - DestroyWindow(hDlg); - break; + EndDialog(hDlg, wParam); + break; } - break; + break; default: return FALSE; @@ -141,64 +257,115 @@ return TRUE; } -HWND -CreateProgressDialog(HWND hParent, - UINT LabelId) -{ - HWND hProgDlg; - LPWSTR lpProgStr; - - /* open the progress dialog */ - hProgDlg = CreateDialogW(hInstance, +VOID +CompleteProgressBar(HANDLE hProgress) +{ + HWND hProgBar = (HWND)hProgress; + UINT Pos = 0; + + /* Get the current position */ + Pos = SendMessageW(hProgBar, + PBM_GETPOS, + 0, + 0); + + /* Loop until we hit the max */ + while (Pos <= PROGRESS_RANGE) + { + /* Increment the progress bar */ + SendMessageW(hProgBar, + PBM_DELTAPOS, + Pos, + 0); + + /* Wait for 15ms to give it a smooth feel */ + Sleep(15); + Pos++; + } +} + +VOID +IncrementProgressBar(HANDLE hProgress, + UINT Step) +{ + HWND hProgBar = (HWND)hProgress; + UINT Position; + + /* Don't allow the progress to reach to complete*/ + Position = SendMessageW(hProgBar, + PBM_GETPOS, + 0, + 0); + if (Position < PROGRESS_STEP_MAX) + { + /* Do we want to increment the default amount? */ + if (Step == DEFAULT_STEP) + { + /* Use the step value we set on create */ + SendMessageW(hProgBar, + PBM_STEPIT, + 0, + 0); + } + else + { + /* Use the value passed */ + SendMessageW(hProgBar, + PBM_SETPOS, + Step, + 0); + } + } +} + +BOOL +RunActionWithProgress(HWND hParent, + LPWSTR ServiceName, + LPWSTR DisplayName, + UINT Action) +{ + PROGRESS_DATA ProgressData; + LPWSTR ServiceList; + BOOL StopDepends; + INT_PTR Result; + + StopDepends = FALSE; + ServiceList = NULL; + + + /* Check if we'll be stopping the service */ + if (Action == ACTION_STOP || Action == ACTION_RESTART) + { + /* Does the service have any dependent services which need stopping first */ + ServiceList = GetListOfServicesToStop(ServiceName); + if (ServiceList) + { + /* Ask the user if they want to stop the dependants */ + StopDepends = CreateStopDependsDialog(hParent, + ServiceName, + DisplayName, + ServiceList); + + /* Exit early if the user decided not to stop the dependants */ + if (StopDepends == FALSE) + return FALSE; + } + } + + ProgressData.hDlg = NULL; + ProgressData.ServiceName = ServiceName; + ProgressData.Action = Action; + ProgressData.StopDepends = StopDepends; + ProgressData.ServiceList = ServiceList; + + Result = DialogBoxParamW(hInstance, MAKEINTRESOURCEW(IDD_DLG_PROGRESS), hParent, - ProgressDialogProc); - if (hProgDlg != NULL) - { - /* Load the label Id */ - if (AllocAndLoadString(&lpProgStr, - hInstance, - LabelId)) - { - /* Write it to the dialog */ - SendDlgItemMessageW(hProgDlg, - IDC_SERVCON_INFO, - WM_SETTEXT, - 0, - (LPARAM)lpProgStr); - - LocalFree(lpProgStr); - } - - /* Finally, show and update the progress dialog */ - ShowWindow(hProgDlg, SW_SHOWNORMAL); - UpdateWindow(hProgDlg); - - // TODO: Add a message loop for it ? - } - - return hProgDlg; -} - -BOOL -DestroyProgressDialog(HWND hwnd, - BOOL bComplete) -{ - BOOL bRet = FALSE; - - if (hwnd) - { - if (bComplete) - { - /* Complete the progress bar */ - CompleteProgressBar(hwnd); - - /* Wait, for asthetics */ - Sleep(500); - } - - bRet = DestroyWindow(hwnd); - } - - return bRet; -} + ProgressDialogProc, + (LPARAM)&ProgressData); + + if (ServiceList) + HeapFree(GetProcessHeap(), 0, ServiceList); + + return (Result == IDOK); +} Modified: trunk/reactos/base/applications/mscutils/servman/start.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
============================================================================== --- trunk/reactos/base/applications/mscutils/servman/start.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/mscutils/servman/start.c [iso-8859-1] Wed Apr 8 17:28:46 2015 @@ -3,26 +3,28 @@ * LICENSE: GPL - See COPYING in the top level directory * FILE: base/applications/mscutils/servman/start.c * PURPOSE: Start a service - * COPYRIGHT: Copyright 2005-2010 Ged Murphy <gedmurphy(a)reactos.org> + * COPYRIGHT: Copyright 2005-2015 Ged Murphy <gedmurphy(a)reactos.org> * */ #include "precomp.h" -static BOOL -DoStartService(PMAIN_WND_INFO Info, - HWND hProgress, +#define MAX_WAIT_TIME 30000 + +BOOL +DoStartService(LPWSTR ServiceName, + HANDLE hProgress, LPWSTR lpStartParams) { SC_HANDLE hSCManager; SC_HANDLE hService; SERVICE_STATUS_PROCESS ServiceStatus; DWORD BytesNeeded = 0; - DWORD dwStartTickCount; - DWORD dwOldCheckPoint; - DWORD dwWaitTime; - DWORD dwMaxWait; - BOOL bRet = FALSE; + DWORD StartTickCount; + DWORD OldCheckPoint; + DWORD WaitTime; + DWORD MaxWait; + BOOL Result = FALSE; BOOL bWhiteSpace = TRUE; LPWSTR lpChar; @@ -57,7 +59,7 @@ return FALSE; /* Make the service name the first argument */ - lpArgsVector[0] = Info->pCurrentService->lpServiceName; + lpArgsVector[0] = ServiceName; /* Fill the arguments vector */ dwArgsCount = 1; @@ -84,130 +86,120 @@ } } - hSCManager = OpenSCManager(NULL, - NULL, - SC_MANAGER_CONNECT); - if (hSCManager) - { - hService = OpenService(hSCManager, - Info->pCurrentService->lpServiceName, - SERVICE_START | SERVICE_QUERY_STATUS); - if (hService) - { - if (hProgress) - { - /* Increment the progress bar */ - IncrementProgressBar(hProgress, DEFAULT_STEP); - } - - /* Start the service */ - bRet = StartService(hService, - dwArgsCount, - lpArgsVector); - if (!bRet && GetLastError() == ERROR_SERVICE_ALREADY_RUNNING) - { - /* If it's already running, just return TRUE */ - bRet = TRUE; - } - else if (bRet) - { - bRet = FALSE; - - /* Get the service status to check if it's running */ - if (QueryServiceStatusEx(hService, - SC_STATUS_PROCESS_INFO, - (LPBYTE)&ServiceStatus, - sizeof(SERVICE_STATUS_PROCESS), - &BytesNeeded)) - { - /* We don't want to wait for more than 30 seconds */ - dwMaxWait = 30000; - dwStartTickCount = GetTickCount(); - - /* Loop until it's running */ - while (ServiceStatus.dwCurrentState != SERVICE_RUNNING) + hSCManager = OpenSCManagerW(NULL, + NULL, + SC_MANAGER_CONNECT); + if (!hSCManager) + { + if (lpArgsVector) + LocalFree((LPVOID)lpArgsVector); + return FALSE; + } + + hService = OpenServiceW(hSCManager, + ServiceName, + SERVICE_START | SERVICE_QUERY_STATUS); + if (!hService) + { + CloseServiceHandle(hSCManager); + if (lpArgsVector) + LocalFree((LPVOID)lpArgsVector); + return FALSE; + } + + /* Start the service */ + Result = StartServiceW(hService, + dwArgsCount, + lpArgsVector); + if (!Result && GetLastError() == ERROR_SERVICE_ALREADY_RUNNING) + { + /* If it's already running, just return TRUE */ + Result = TRUE; + } + else if (Result) + { + if (hProgress) + { + /* Increment the progress bar */ + IncrementProgressBar(hProgress, DEFAULT_STEP); + } + + /* Get the service status to check if it's running */ + Result = QueryServiceStatusEx(hService, + SC_STATUS_PROCESS_INFO, + (LPBYTE)&ServiceStatus, + sizeof(SERVICE_STATUS_PROCESS), + &BytesNeeded); + if (Result) + { + Result = FALSE; + MaxWait = MAX_WAIT_TIME; + OldCheckPoint = ServiceStatus.dwCheckPoint; + StartTickCount = GetTickCount(); + + /* Loop until it's running */ + while (ServiceStatus.dwCurrentState != SERVICE_RUNNING) + { + /* Fixup the wait time */ + WaitTime = ServiceStatus.dwWaitHint / 10; + + if (WaitTime < 1000) WaitTime = 1000; + else if (WaitTime > 10000) WaitTime = 10000; + + /* We don't wanna wait for up to 10 secs without incrementing */ + for (int i = WaitTime / 1000; i > 0; i--) + { + Sleep(1000); + if (hProgress) { - dwOldCheckPoint = ServiceStatus.dwCheckPoint; - dwWaitTime = ServiceStatus.dwWaitHint / 10; - - /* Get the latest status info */ - if (!QueryServiceStatusEx(hService, - SC_STATUS_PROCESS_INFO, - (LPBYTE)&ServiceStatus, - sizeof(SERVICE_STATUS_PROCESS), - &BytesNeeded)) - { - /* Something went wrong... */ - break; - } - - /* Is the service making progress? */ - if (ServiceStatus.dwCheckPoint > dwOldCheckPoint) - { - /* It is, get the latest tickcount to reset the max wait time */ - dwStartTickCount = GetTickCount(); - dwOldCheckPoint = ServiceStatus.dwCheckPoint; - IncrementProgressBar(hProgress, DEFAULT_STEP); - } - else - { - /* It's not, make sure we haven't exceeded our wait time */ - if (GetTickCount() >= dwStartTickCount + dwMaxWait) - { - /* We have, give up */ - break; - } - } - - /* Adjust the wait hint times */ - if (dwWaitTime < 200) - dwWaitTime = 200; - else if (dwWaitTime > 10000) - dwWaitTime = 10000; - - /* Wait before trying again */ - Sleep(dwWaitTime); + /* Increment the progress bar */ + IncrementProgressBar(hProgress, DEFAULT_STEP); } } - if (ServiceStatus.dwCurrentState == SERVICE_RUNNING) - { - bRet = TRUE; - } - } - - CloseServiceHandle(hService); - } - - CloseServiceHandle(hSCManager); - } + + /* Get the latest status info */ + if (!QueryServiceStatusEx(hService, + SC_STATUS_PROCESS_INFO, + (LPBYTE)&ServiceStatus, + sizeof(SERVICE_STATUS_PROCESS), + &BytesNeeded)) + { + /* Something went wrong... */ + break; + } + + /* Is the service making progress? */ + if (ServiceStatus.dwCheckPoint > OldCheckPoint) + { + /* It is, get the latest tickcount to reset the max wait time */ + StartTickCount = GetTickCount(); + OldCheckPoint = ServiceStatus.dwCheckPoint; + } + else + { + /* It's not, make sure we haven't exceeded our wait time */ + if (GetTickCount() >= StartTickCount + MaxWait) + { + /* We have, give up */ + break; + } + } + } + } + + if (ServiceStatus.dwCurrentState == SERVICE_RUNNING) + { + Result = TRUE; + } + } + + CloseServiceHandle(hService); + + CloseServiceHandle(hSCManager); if (lpArgsVector) LocalFree((LPVOID)lpArgsVector); - return bRet; + return Result; } - -BOOL -DoStart(PMAIN_WND_INFO Info, LPWSTR lpStartParams) -{ - HWND hProgress; - BOOL bRet = FALSE; - - /* Create a progress window to track the progress of the stopping service */ - hProgress = CreateProgressDialog(Info->hMainWnd, - IDS_PROGRESS_INFO_START); - if (hProgress) - { - /* Set the service name and reset the progress bag */ - InitializeProgressDialog(hProgress, Info->pCurrentService->lpServiceName); - - /* Start the requested service */ - bRet = DoStartService(Info, hProgress, lpStartParams); - - /* Complete and destroy the progress bar */ - DestroyProgressDialog(hProgress, bRet); - } - - return bRet; -} Modified: trunk/reactos/base/applications/mscutils/servman/stop.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
============================================================================== --- trunk/reactos/base/applications/mscutils/servman/stop.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/mscutils/servman/stop.c [iso-8859-1] Wed Apr 8 17:28:46 2015 @@ -3,223 +3,107 @@ * LICENSE: GPL - See COPYING in the top level directory * FILE: base/applications/mscutils/servman/stop.c * PURPOSE: Stops running a service - * COPYRIGHT: Copyright 2006-2010 Ged Murphy <gedmurphy(a)reactos.org> + * COPYRIGHT: Copyright 2006-2015 Ged Murphy <gedmurphy(a)reactos.org> * */ #include "precomp.h" -static BOOL -StopService(PMAIN_WND_INFO pInfo, - LPWSTR lpServiceName, - HWND hProgress OPTIONAL) +#define MAX_WAIT_TIME 30000 + +BOOL +DoStopService(_In_z_ LPWSTR ServiceName, + _In_opt_ HANDLE hProgress) { SC_HANDLE hSCManager; SC_HANDLE hService; SERVICE_STATUS_PROCESS ServiceStatus; - DWORD dwBytesNeeded; - DWORD dwStartTime; - DWORD dwTimeout; + DWORD BytesNeeded; + DWORD StartTime; + DWORD WaitTime; + DWORD Timeout; BOOL bRet = FALSE; + + + hSCManager = OpenSCManagerW(NULL, + NULL, + SC_MANAGER_CONNECT); + if (!hSCManager) return FALSE; + + hService = OpenServiceW(hSCManager, + ServiceName, + SERVICE_STOP | SERVICE_QUERY_STATUS); + if (!hService) + { + CloseServiceHandle(hSCManager); + return FALSE; + } if (hProgress) { - /* Set the service name and reset the progress bag */ - InitializeProgressDialog(hProgress, lpServiceName); + /* Increment the progress bar */ + IncrementProgressBar(hProgress, DEFAULT_STEP); } - hSCManager = OpenSCManager(NULL, - NULL, - SC_MANAGER_CONNECT); - if (hSCManager) + /* Set the start and max wait times */ + StartTime = GetTickCount(); + Timeout = MAX_WAIT_TIME; + + /* Send the service the stop code */ + if (ControlService(hService, + SERVICE_CONTROL_STOP, + (LPSERVICE_STATUS)&ServiceStatus)) { - hService = OpenService(hSCManager, - lpServiceName, - SERVICE_STOP | SERVICE_QUERY_STATUS); - if (hService) + if (hProgress) { - if (hProgress) + /* Increment the progress bar */ + IncrementProgressBar(hProgress, DEFAULT_STEP); + } + + while (ServiceStatus.dwCurrentState != SERVICE_STOPPED) + { + /* Fixup the wait time */ + WaitTime = ServiceStatus.dwWaitHint / 10; + + if (WaitTime < 1000) WaitTime = 1000; + else if (WaitTime > 10000) WaitTime = 10000; + + /* We don't wanna wait for up to 10 secs without incrementing */ + for (int i = WaitTime / 1000; i > 0; i--) { - /* Increment the progress bar */ - IncrementProgressBar(hProgress, DEFAULT_STEP); - } - - /* Set the wait time to 30 secs */ - dwStartTime = GetTickCount(); - dwTimeout = 30000; - - /* Send the service the stop code */ - if (ControlService(hService, - SERVICE_CONTROL_STOP, - (LPSERVICE_STATUS)&ServiceStatus)) - { + Sleep(1000); if (hProgress) { /* Increment the progress bar */ IncrementProgressBar(hProgress, DEFAULT_STEP); } + } - while (ServiceStatus.dwCurrentState != SERVICE_STOPPED) + if (QueryServiceStatusEx(hService, + SC_STATUS_PROCESS_INFO, + (LPBYTE)&ServiceStatus, + sizeof(SERVICE_STATUS_PROCESS), + &BytesNeeded)) + { + /* Have we exceeded our wait time? */ + if (GetTickCount() - StartTime > Timeout) { - /* Don't sleep for more than 3 seconds */ - if (ServiceStatus.dwWaitHint > 3000) - ServiceStatus.dwWaitHint = 3000; - - Sleep(ServiceStatus.dwWaitHint); - - if (hProgress) - { - /* Increment the progress bar */ - IncrementProgressBar(hProgress, DEFAULT_STEP); - } - - if (QueryServiceStatusEx(hService, - SC_STATUS_PROCESS_INFO, - (LPBYTE)&ServiceStatus, - sizeof(SERVICE_STATUS_PROCESS), - &dwBytesNeeded)) - { - /* Have we exceeded our wait time? */ - if (GetTickCount() - dwStartTime > dwTimeout) - { - /* Yep, give up */ - break; - } - } - } - - /* If the service is stopped, return TRUE */ - if (ServiceStatus.dwCurrentState == SERVICE_STOPPED) - { - bRet = TRUE; + /* Yep, give up */ + break; } } - - CloseServiceHandle(hService); } - CloseServiceHandle(hSCManager); + /* If the service is stopped, return TRUE */ + if (ServiceStatus.dwCurrentState == SERVICE_STOPPED) + { + bRet = TRUE; + } } + + CloseServiceHandle(hService); + + CloseServiceHandle(hSCManager); return bRet; } - -static BOOL -StopDependantServices(PMAIN_WND_INFO pInfo, - LPWSTR lpServiceList, - HWND hProgress OPTIONAL) -{ - LPWSTR lpStr; - BOOL bRet = FALSE; - - lpStr = lpServiceList; - - /* Loop through all the services in the list */ - while (TRUE) - { - /* Break when we hit the double null */ - if (*lpStr == L'\0' && *(lpStr + 1) == L'\0') - break; - - /* If this isn't our first time in the loop we'll - have been left on a null char */ - if (*lpStr == L'\0') - lpStr++; - - /* Stop the requested service */ - bRet = StopService(pInfo, - lpStr, - hProgress); - - /* Complete the progress bar if we succeeded */ - if (bRet) - { - CompleteProgressBar(hProgress); - } - - /* Move onto the next string */ - while (*lpStr != L'\0') - lpStr++; - } - - return bRet; -} - -BOOL -DoStop(PMAIN_WND_INFO pInfo) -{ - HWND hProgress; - LPWSTR lpServiceList; - BOOL bRet = FALSE; - BOOL bStopMainService = TRUE; - - if (pInfo) - { - /* Does the service have any dependent services which need stopping first */ - lpServiceList = GetListOfServicesToStop(pInfo->pCurrentService->lpServiceName); - if (lpServiceList) - { - /* Tag the service list to the main wnd info */ - pInfo->pTag = (PVOID)lpServiceList; - - /* List them and ask the user if they want to stop them */ - if (DialogBoxParamW(hInstance, - MAKEINTRESOURCEW(IDD_DLG_DEPEND_STOP), - pInfo->hMainWnd, - StopDependsDialogProc, - (LPARAM)pInfo) == IDOK) - { - /* Create a progress window to track the progress of the stopping services */ - hProgress = CreateProgressDialog(pInfo->hMainWnd, - IDS_PROGRESS_INFO_STOP); - - /* Stop all the dependant services */ - StopDependantServices(pInfo, lpServiceList, hProgress); - - /* Now stop the requested one */ - bRet = StopService(pInfo, - pInfo->pCurrentService->lpServiceName, - hProgress); - - /* We've already stopped the main service, don't try to stop it again */ - bStopMainService = FALSE; - - if (hProgress) - { - /* Complete and destroy the progress bar */ - DestroyProgressDialog(hProgress, TRUE); - } - } - else - { - /* Don't stop the main service if the user selected not to */ - bStopMainService = FALSE; - } - - HeapFree(GetProcessHeap(), - 0, - lpServiceList); - } - - /* If the service has no running dependents, then we stop it here */ - if (bStopMainService) - { - /* Create a progress window to track the progress of the stopping service */ - hProgress = CreateProgressDialog(pInfo->hMainWnd, - IDS_PROGRESS_INFO_STOP); - - /* Stop the requested service */ - bRet = StopService(pInfo, - pInfo->pCurrentService->lpServiceName, - hProgress); - - if (hProgress) - { - /* Complete and destroy the progress bar */ - DestroyProgressDialog(hProgress, TRUE); - } - } - } - - return bRet; -} Modified: trunk/reactos/base/applications/mscutils/servman/stop_dependencies.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
============================================================================== --- trunk/reactos/base/applications/mscutils/servman/stop_dependencies.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/mscutils/servman/stop_dependencies.c [iso-8859-1] Wed Apr 8 17:28:46 2015 @@ -3,11 +3,19 @@ * LICENSE: GPL - See COPYING in the top level directory * FILE: base/applications/mscutils/servman/stop_dependencies.c * PURPOSE: Routines related to stopping dependent services - * COPYRIGHT: Copyright 2006-2010 Ged Murphy <gedmurphy(a)reactos.org> + * COPYRIGHT: Copyright 2006-2015 Ged Murphy <gedmurphy(a)reactos.org> * */ #include "precomp.h" + +typedef struct _STOP_DATA +{ + LPWSTR ServiceName; + LPWSTR DisplayName; + LPWSTR ServiceList; + +} STOP_DATA, *PSTOP_DATA; static LPWSTR AddServiceToList(LPWSTR *lpServiceList, @@ -46,7 +54,7 @@ dwCurSize = 0; /* Get the list size */ - while (TRUE) + for (;;) { /* Break when we hit the double null */ if (*ptr == L'\0' && *(ptr + 1) == L'\0') @@ -98,13 +106,6 @@ if (lpServiceStatus[i].ServiceStatus.dwCurrentState != SERVICE_STOPPED && lpServiceStatus[i].ServiceStatus.dwCurrentState != SERVICE_STOP_PENDING) { - /* Does this service have any dependents? */ - if (TV2_HasDependantServices(lpServiceStatus[i].lpServiceName)) - { - /* recall this function with the dependent */ - BuildListOfServicesToStop(lpServiceList, lpServiceStatus[i].lpServiceName); - } - /* Add the service to the list */ *lpServiceList = AddServiceToList(lpServiceList, lpServiceStatus[i].lpServiceName); @@ -143,7 +144,7 @@ lpStr = lpServiceList; /* Loop through all the services in the list */ - while (TRUE) + for (;;) { /* Break when we hit the double null */ if (*lpStr == L'\0' && *(lpStr + 1) == L'\0') @@ -174,117 +175,100 @@ } static BOOL -DoInitDependsDialog(PMAIN_WND_INFO pInfo, - HWND hDlg) -{ +InitDialog(HWND hDlg, + UINT Message, + WPARAM wParam, + LPARAM lParam) +{ + PSTOP_DATA StopData; HWND hServiceListBox; LPWSTR lpPartialStr, lpStr; DWORD fullLen; HICON hIcon = NULL; BOOL bRet = FALSE; - if (pInfo) - { - /* Tag the info to the window */ - SetWindowLongPtrW(hDlg, - GWLP_USERDATA, - (LONG_PTR)pInfo); - - /* Load the icon for the window */ - hIcon = (HICON)LoadImageW(hInstance, - MAKEINTRESOURCE(IDI_SM_ICON), - IMAGE_ICON, - GetSystemMetrics(SM_CXSMICON), - GetSystemMetrics(SM_CXSMICON), - 0); - if (hIcon) - { - /* Set it */ - SendMessageW(hDlg, - WM_SETICON, - ICON_SMALL, - (LPARAM)hIcon); - DestroyIcon(hIcon); - } - - /* Load the stop depends note */ - if (AllocAndLoadString(&lpPartialStr, - hInstance, - IDS_STOP_DEPENDS)) - { - /* Get the length required */ - fullLen = wcslen(lpPartialStr) + wcslen(pInfo->pCurrentService->lpDisplayName) + 1; - - lpStr = HeapAlloc(ProcessHeap, - 0, - fullLen * sizeof(WCHAR)); - if (lpStr) - { - /* Add the service name to the depends note */ - _snwprintf(lpStr, - fullLen, - lpPartialStr, - pInfo->pCurrentService->lpDisplayName); - - /* Add the string to the dialog */ - SendDlgItemMessageW(hDlg, - IDC_STOP_DEPENDS, - WM_SETTEXT, - 0, - (LPARAM)lpStr); - - HeapFree(ProcessHeap, - 0, - lpStr); - - bRet = TRUE; - } - - LocalFree(lpPartialStr); - } - - /* Display the list of services which need stopping */ - hServiceListBox = GetDlgItem(hDlg, - IDC_STOP_DEPENDS_LB); - if (hServiceListBox) - { - AddServiceNamesToStop(hServiceListBox, - (LPWSTR)pInfo->pTag); - } - } - + StopData = (PSTOP_DATA)lParam; + + + /* Load the icon for the window */ + hIcon = (HICON)LoadImageW(hInstance, + MAKEINTRESOURCE(IDI_SM_ICON), + IMAGE_ICON, + GetSystemMetrics(SM_CXSMICON), + GetSystemMetrics(SM_CXSMICON), + 0); + if (hIcon) + { + /* Set it */ + SendMessageW(hDlg, + WM_SETICON, + ICON_SMALL, + (LPARAM)hIcon); + DestroyIcon(hIcon); + } + + /* Load the stop depends note */ + if (AllocAndLoadString(&lpPartialStr, + hInstance, + IDS_STOP_DEPENDS)) + { + /* Get the length required */ + fullLen = wcslen(lpPartialStr) + wcslen(StopData->DisplayName) + 1; + + lpStr = HeapAlloc(ProcessHeap, + 0, + fullLen * sizeof(WCHAR)); + if (lpStr) + { + /* Add the service name to the depends note */ + _snwprintf(lpStr, + fullLen, + lpPartialStr, + StopData->DisplayName); + + /* Add the string to the dialog */ + SendDlgItemMessageW(hDlg, + IDC_STOP_DEPENDS, + WM_SETTEXT, + 0, + (LPARAM)lpStr); + + HeapFree(ProcessHeap, + 0, + lpStr); + + bRet = TRUE; + } + + LocalFree(lpPartialStr); + } + + /* Display the list of services which need stopping */ + hServiceListBox = GetDlgItem(hDlg, IDC_STOP_DEPENDS_LB); + if (hServiceListBox) + { + AddServiceNamesToStop(hServiceListBox, + (LPWSTR)StopData->ServiceList); + } + return bRet; } INT_PTR CALLBACK StopDependsDialogProc(HWND hDlg, - UINT message, + UINT Message, WPARAM wParam, LPARAM lParam) { - PMAIN_WND_INFO pInfo = NULL; - - /* Get the window context */ - pInfo = (PMAIN_WND_INFO)GetWindowLongPtrW(hDlg, - GWLP_USERDATA); - if (pInfo == NULL && message != WM_INITDIALOG) - { - return FALSE; - } - - switch (message) + + switch (Message) { case WM_INITDIALOG: { - BOOL bRet = FALSE; - - pInfo = (PMAIN_WND_INFO)lParam; - if (pInfo != NULL) - { - bRet = DoInitDependsDialog(pInfo, hDlg); - } - - return bRet; + return InitDialog(hDlg, + Message, + wParam, + lParam); } case WM_COMMAND: @@ -304,3 +288,27 @@ return FALSE; } + +BOOL +CreateStopDependsDialog(HWND hParent, + LPWSTR ServiceName, + LPWSTR DisplayName, + LPWSTR ServiceList) +{ + STOP_DATA StopData; + INT_PTR Result; + + StopData.ServiceName = ServiceName; + StopData.DisplayName = DisplayName; + StopData.ServiceList = ServiceList; + + Result = DialogBoxParamW(hInstance, + MAKEINTRESOURCEW(IDD_DLG_DEPEND_STOP), + hParent, + StopDependsDialogProc, + (LPARAM)&StopData); + if (Result == IDOK) + return TRUE; + + return FALSE; +}
9 years, 8 months
1
0
0
0
[akhaldi] 67093: [MSXML3_WINETEST] Sync with Wine Staging 1.7.37. CORE-9246
by akhaldi@svn.reactos.org
Author: akhaldi Date: Wed Apr 8 17:15:53 2015 New Revision: 67093 URL:
http://svn.reactos.org/svn/reactos?rev=67093&view=rev
Log: [MSXML3_WINETEST] Sync with Wine Staging 1.7.37. CORE-9246 Modified: trunk/rostests/winetests/msxml3/domdoc.c trunk/rostests/winetests/msxml3/saxreader.c trunk/rostests/winetests/msxml3/schema.c Modified: trunk/rostests/winetests/msxml3/domdoc.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msxml3/domdoc.c…
============================================================================== --- trunk/rostests/winetests/msxml3/domdoc.c [iso-8859-1] (original) +++ trunk/rostests/winetests/msxml3/domdoc.c [iso-8859-1] Wed Apr 8 17:15:53 2015 @@ -416,11 +416,6 @@ '<','o','p','e','n','>','<','/','o','p','e','n','>','\n',0 }; static const WCHAR szComplete2[] = { - '<','?','x','m','l',' ', - 'v','e','r','s','i','o','n','=','\'','1','.','0','\'','?','>','\n', - '<','o','>','<','/','o','>','\n',0 -}; -static const WCHAR szComplete3[] = { '<','?','x','m','l',' ', 'v','e','r','s','i','o','n','=','\'','1','.','0','\'','?','>','\n', '<','a','>','<','/','a','>','\n',0 @@ -1376,7 +1371,7 @@ /* try to load something else simple and valid */ b = VARIANT_FALSE; - str = SysAllocString( szComplete3 ); + str = SysAllocString( szComplete2 ); r = IXMLDOMDocument_loadXML( doc, str, &b ); ok( r == S_OK, "loadXML failed\n"); ok( b == VARIANT_TRUE, "failed to load XML string\n"); @@ -4946,7 +4941,6 @@ doc = create_document(&IID_IXMLDOMDocument); - pNextChild = (void*)0xdeadbeef; hr = IXMLDOMDocument_get_nextSibling(doc, NULL); ok(hr == E_INVALIDARG, "ret %08x\n", hr ); @@ -8950,9 +8944,12 @@ static void test_get_doctype(void) { + static const WCHAR emailW[] = {'e','m','a','i','l',0}; IXMLDOMDocumentType *doctype; IXMLDOMDocument *doc; + VARIANT_BOOL b; HRESULT hr; + BSTR s; doc = create_document(&IID_IXMLDOMDocument); @@ -8964,6 +8961,28 @@ ok(hr == S_FALSE, "got 0x%08x\n", hr); ok(doctype == NULL, "got %p\n", doctype); + hr = IXMLDOMDocument_loadXML(doc, _bstr_(szEmailXML), &b); + ok(b == VARIANT_TRUE, "failed to load XML string\n"); + + doctype = NULL; + hr = IXMLDOMDocument_get_doctype(doc, &doctype); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(doctype != NULL, "got %p\n", doctype); + + hr = IXMLDOMDocumentType_get_name(doctype, NULL); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + hr = IXMLDOMDocumentType_get_name(doctype, &s); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(!lstrcmpW(emailW, s), "got name %s\n", wine_dbgstr_w(s)); + SysFreeString(s); + + hr = IXMLDOMDocumentType_get_nodeName(doctype, &s); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(!lstrcmpW(emailW, s), "got name %s\n", wine_dbgstr_w(s)); + SysFreeString(s); + + IXMLDOMDocumentType_Release(doctype); IXMLDOMDocument_Release(doc); } @@ -9164,6 +9183,11 @@ hr = IXMLDOMNode_get_attributes(node, &map); ok(hr == S_OK, "got %08x\n", hr); + + node2 = (void*)0xdeadbeef; + hr = IXMLDOMNamedNodeMap_getNamedItem(map, _bstr_("attr"), &node2); + ok(hr == S_FALSE, "got %08x\n", hr); + ok(node2 == NULL, "got %p\n", node2); length = -1; hr = IXMLDOMNamedNodeMap_get_length(map, &length); @@ -11099,6 +11123,7 @@ V_VT(&v) = VT_BSTR; V_BSTR(&v) = _bstr_("urn:schemas-microsoft-com:datatypes"); hr = IXMLDOMAttribute_put_nodeValue(pAttribute, v); + ok(hr == S_OK, "ret %08x\n", hr ); hr = IXMLDOMElement_setAttributeNode(root, pAttribute, NULL); ok(hr == S_OK, "ret %08x\n", hr ); Modified: trunk/rostests/winetests/msxml3/saxreader.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msxml3/saxreade…
============================================================================== --- trunk/rostests/winetests/msxml3/saxreader.c [iso-8859-1] (original) +++ trunk/rostests/winetests/msxml3/saxreader.c [iso-8859-1] Wed Apr 8 17:15:53 2015 @@ -312,13 +312,6 @@ HeapFree(GetProcessHeap(), 0, call_seq->sequence); call_seq->sequence = NULL; call_seq->count = call_seq->size = 0; -} - -static inline void flush_sequences(struct call_sequence **seq, int n) -{ - int i; - for (i = 0; i < n; i++) - flush_sequence(seq, i); } static const char *get_event_name(CH event) @@ -2899,7 +2892,7 @@ HRESULT hr; int i; - static const REFIID riids[] = + static REFIID riids[] = { &IID_ISAXContentHandler, &IID_ISAXLexicalHandler, Modified: trunk/rostests/winetests/msxml3/schema.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msxml3/schema.c…
============================================================================== --- trunk/rostests/winetests/msxml3/schema.c [iso-8859-1] (original) +++ trunk/rostests/winetests/msxml3/schema.c [iso-8859-1] Wed Apr 8 17:15:53 2015 @@ -1300,6 +1300,7 @@ VariantClear(&type); hr = IXMLDOMNode_get_nodeTypedValue(node, &type); + EXPECT_HR(hr, S_OK); ok(V_VT(&type) == VT_BSTR, "got variant type %i\n", V_VT(&v)); VariantClear(&type); IXMLDOMNode_Release(node);
9 years, 8 months
1
0
0
0
[akhaldi] 67092: [MSXML3] Sync with Wine Staging 1.7.37. CORE-9246
by akhaldi@svn.reactos.org
Author: akhaldi Date: Wed Apr 8 17:15:30 2015 New Revision: 67092 URL:
http://svn.reactos.org/svn/reactos?rev=67092&view=rev
Log: [MSXML3] Sync with Wine Staging 1.7.37. CORE-9246 Modified: trunk/reactos/dll/win32/msxml3/doctype.c trunk/reactos/dll/win32/msxml3/node.c trunk/reactos/dll/win32/msxml3/pi.c trunk/reactos/dll/win32/msxml3/xdr.c trunk/reactos/dll/win32/msxml3/xslpattern.y trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/msxml3/doctype.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msxml3/doctype.c…
============================================================================== --- trunk/reactos/dll/win32/msxml3/doctype.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msxml3/doctype.c [iso-8859-1] Wed Apr 8 17:15:30 2015 @@ -134,8 +134,8 @@ BSTR* p ) { domdoctype *This = impl_from_IXMLDOMDocumentType( iface ); - FIXME("(%p)->(%p): stub\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return node_get_nodeName(&This->node, p); } static HRESULT WINAPI domdoctype_get_nodeValue( @@ -468,8 +468,8 @@ BSTR *p) { domdoctype *This = impl_from_IXMLDOMDocumentType( iface ); - FIXME("(%p)->(%p): stub\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return node_get_nodeName(&This->node, p); } static HRESULT WINAPI domdoctype_get_entities( Modified: trunk/reactos/dll/win32/msxml3/node.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msxml3/node.c?re…
============================================================================== --- trunk/reactos/dll/win32/msxml3/node.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msxml3/node.c [iso-8859-1] Wed Apr 8 17:15:30 2015 @@ -458,15 +458,19 @@ xmlnode *before_node_obj = get_node_obj(before); IXMLDOMNode_Release(before); if(!before_node_obj) return E_FAIL; - - /* unlink from current parent first */ - if(node_obj->parent) - { - hr = IXMLDOMNode_removeChild(node_obj->parent, node_obj->iface, NULL); - if (hr == S_OK) xmldoc_remove_orphan(node_obj->node->doc, node_obj->node); - } - - doc = node_obj->node->doc; + } + + /* unlink from current parent first */ + if(node_obj->parent) + { + hr = IXMLDOMNode_removeChild(node_obj->parent, node_obj->iface, NULL); + if (hr == S_OK) xmldoc_remove_orphan(node_obj->node->doc, node_obj->node); + } + doc = node_obj->node->doc; + + if(before) + { + xmlnode *before_node_obj = get_node_obj(before); /* refs count including subtree */ if (doc != before_node_obj->node->doc) @@ -479,14 +483,6 @@ } else { - /* unlink from current parent first */ - if(node_obj->parent) - { - hr = IXMLDOMNode_removeChild(node_obj->parent, node_obj->iface, NULL); - if (hr == S_OK) xmldoc_remove_orphan(node_obj->node->doc, node_obj->node); - } - doc = node_obj->node->doc; - if (doc != This->node->doc) refcount = xmlnode_get_inst_cnt(node_obj); Modified: trunk/reactos/dll/win32/msxml3/pi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msxml3/pi.c?rev=…
============================================================================== --- trunk/reactos/dll/win32/msxml3/pi.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msxml3/pi.c [iso-8859-1] Wed Apr 8 17:15:30 2015 @@ -665,7 +665,9 @@ static HRESULT dom_pi_get_named_item(const xmlNodePtr node, BSTR name, IXMLDOMNode **item) { FIXME("(%p)->(%s %p): stub\n", node, debugstr_w(name), item ); - return E_NOTIMPL; + if (item) + *item = NULL; + return S_FALSE; } static HRESULT dom_pi_set_named_item(xmlNodePtr node, IXMLDOMNode *newItem, IXMLDOMNode **namedItem) Modified: trunk/reactos/dll/win32/msxml3/xdr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msxml3/xdr.c?rev…
============================================================================== --- trunk/reactos/dll/win32/msxml3/xdr.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msxml3/xdr.c [iso-8859-1] Wed Apr 8 17:15:30 2015 @@ -35,7 +35,6 @@ static const xmlChar DT_prefix[] = "dt"; static const xmlChar DT_href[] = "urn:schemas-microsoft-com:datatypes"; -static const xmlChar XDR_prefix[] = "xdr"; static const xmlChar XDR_href[] = "urn:schemas-microsoft-com:xml-data"; static const xmlChar XSD_prefix[] = "xsd"; static const xmlChar XSD_href[] = "
http://www.w3.org/2001/XMLSchema
"; @@ -48,7 +47,6 @@ static const xmlChar xs_AttributeType[] = "AttributeType"; static const xmlChar xs_base[] = "base"; static const xmlChar xs_choice[] = "choice"; -static const xmlChar xs_complexContent[] = "complexContent"; static const xmlChar xs_complexType[] = "complexType"; static const xmlChar xs_content[] = "content"; static const xmlChar xs_datatype[] = "datatype"; @@ -58,7 +56,6 @@ static const xmlChar xs_element[] = "element"; static const xmlChar xs_ElementType[] = "ElementType"; static const xmlChar xs_eltOnly[] = "eltOnly"; -static const xmlChar xs_empty[] = "empty"; static const xmlChar xs_enumeration[] = "enumeration"; static const xmlChar xs_extension[] = "extension"; static const xmlChar xs_group[] = "group"; @@ -72,7 +69,6 @@ static const xmlChar xs_name[] = "name"; static const xmlChar xs_namespace[] = "namespace"; static const xmlChar xs_no[] = "no"; -static const xmlChar xs_one[] = "one"; static const xmlChar xs_open[] = "open"; static const xmlChar xs_optional[] = "optional"; static const xmlChar xs_order[] = "order"; @@ -81,7 +77,6 @@ static const xmlChar xs_required[] = "required"; static const xmlChar xs_restriction[] = "restriction"; static const xmlChar xs_schema[] = "schema"; -static const xmlChar xs_Schema[] = "Schema"; static const xmlChar xs_seq[] = "seq"; static const xmlChar xs_sequence[] = "sequence"; static const xmlChar xs_simpleContent[] = "simpleContent"; @@ -96,7 +91,6 @@ static const xmlChar xs_value[] = "value"; static const xmlChar xs_values[] = "values"; static const xmlChar xs_xsd_string[] = "xsd:string"; -static const xmlChar xs_yes[] = "yes"; typedef enum _CONTENT_TYPE { Modified: trunk/reactos/dll/win32/msxml3/xslpattern.y URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msxml3/xslpatter…
============================================================================== --- trunk/reactos/dll/win32/msxml3/xslpattern.y [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msxml3/xslpattern.y [iso-8859-1] Wed Apr 8 17:15:30 2015 @@ -70,7 +70,7 @@ %start XSLPattern -%pure_parser +%pure-parser %parse-param {parser_param* p} %parse-param {void* scanner} %lex-param {yyscan_t* scanner} Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Wed Apr 8 17:15:30 2015 @@ -140,7 +140,7 @@ reactos/dll/win32/msvidc32 # Synced to Wine-1.7.27 reactos/dll/win32/msxml # Synced to Wine-1.7.27 reactos/dll/win32/msxml2 # Synced to Wine-1.7.27 -reactos/dll/win32/msxml3 # Synced to Wine-1.7.27 +reactos/dll/win32/msxml3 # Synced to WineStaging-1.7.37 reactos/dll/win32/msxml4 # Synced to Wine-1.7.27 reactos/dll/win32/msxml6 # Synced to Wine-1.7.27 reactos/dll/win32/nddeapi # Synced to Wine-1.7.27
9 years, 8 months
1
0
0
0
[akhaldi] 67091: [MSTASK_WINETEST] Sync with Wine Staging 1.7.37. CORE-9246
by akhaldi@svn.reactos.org
Author: akhaldi Date: Wed Apr 8 17:14:16 2015 New Revision: 67091 URL:
http://svn.reactos.org/svn/reactos?rev=67091&view=rev
Log: [MSTASK_WINETEST] Sync with Wine Staging 1.7.37. CORE-9246 Modified: trunk/rostests/winetests/mstask/task_trigger.c Modified: trunk/rostests/winetests/mstask/task_trigger.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/mstask/task_tri…
============================================================================== --- trunk/rostests/winetests/mstask/task_trigger.c [iso-8859-1] (original) +++ trunk/rostests/winetests/mstask/task_trigger.c [iso-8859-1] Wed Apr 8 17:14:16 2015 @@ -282,7 +282,6 @@ normal_trigger_state.wStartHour = 24; hres = ITaskTrigger_SetTrigger(test_trigger, &normal_trigger_state); ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08x\n", hres); - normal_trigger_state.wStartHour = 3; normal_trigger_state.wStartHour = 60; hres = ITaskTrigger_SetTrigger(test_trigger, &normal_trigger_state); ok(hres == E_INVALIDARG, "Expected E_INVALIDARG: 0x%08x\n", hres);
9 years, 8 months
1
0
0
0
[akhaldi] 67090: [MSVFW32] Sync with Wine Staging 1.7.37. CORE-9246
by akhaldi@svn.reactos.org
Author: akhaldi Date: Wed Apr 8 17:13:34 2015 New Revision: 67090 URL:
http://svn.reactos.org/svn/reactos?rev=67090&view=rev
Log: [MSVFW32] Sync with Wine Staging 1.7.37. CORE-9246 Modified: trunk/reactos/dll/win32/msvfw32/drawdib.c trunk/reactos/dll/win32/msvfw32/mciwnd.c trunk/reactos/dll/win32/msvfw32/msvideo_main.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/msvfw32/drawdib.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msvfw32/drawdib.…
============================================================================== --- trunk/reactos/dll/win32/msvfw32/drawdib.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msvfw32/drawdib.c [iso-8859-1] Wed Apr 8 17:13:34 2015 @@ -462,7 +462,7 @@ whdd = MSVIDEO_GetHddPtr(hdd); if (!whdd) return FALSE; - if (!whdd || !(whdd->begun)) + if (!whdd->begun) { ret = 0; goto out; Modified: trunk/reactos/dll/win32/msvfw32/mciwnd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msvfw32/mciwnd.c…
============================================================================== --- trunk/reactos/dll/win32/msvfw32/mciwnd.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msvfw32/mciwnd.c [iso-8859-1] Wed Apr 8 17:13:34 2015 @@ -79,7 +79,7 @@ wc.cbWndExtra = sizeof(MCIWndInfo*); wc.hInstance = MSVFW32_hModule; wc.hIcon = 0; - wc.hCursor = LoadCursorW(0, MAKEINTRESOURCEW(IDC_ARROW)); + wc.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wc.lpszMenuName = NULL; wc.lpszClassName = mciWndClassW; Modified: trunk/reactos/dll/win32/msvfw32/msvideo_main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msvfw32/msvideo_…
============================================================================== --- trunk/reactos/dll/win32/msvfw32/msvideo_main.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msvfw32/msvideo_main.c [iso-8859-1] Wed Apr 8 17:13:34 2015 @@ -1439,7 +1439,7 @@ } pc->cbState = sizeof(ICCOMPRESS); - pc->lpBitsOut = HeapAlloc(GetProcessHeap(), 0, pc->lpbiOut->bmiHeader.biSizeImage); + pc->lpBitsOut = HeapAlloc(GetProcessHeap(), 0, pc->lpbiIn->bmiHeader.biSizeImage); if (!pc->lpBitsOut) { HeapFree(GetProcessHeap(), 0, pc->lpbiIn); Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Wed Apr 8 17:13:34 2015 @@ -136,7 +136,7 @@ reactos/dll/win32/mstask # Synced to Wine-1.7.27 reactos/dll/win32/msvcrt20 # Out of sync reactos/dll/win32/msvcrt40 # Out of sync -reactos/dll/win32/msvfw32 # Synced to Wine-1.7.27 +reactos/dll/win32/msvfw32 # Synced to WineStaging-1.7.37 reactos/dll/win32/msvidc32 # Synced to Wine-1.7.27 reactos/dll/win32/msxml # Synced to Wine-1.7.27 reactos/dll/win32/msxml2 # Synced to Wine-1.7.27
9 years, 8 months
1
0
0
0
[akhaldi] 67089: [MSRLE32] Sync with Wine Staging 1.7.37. CORE-9246
by akhaldi@svn.reactos.org
Author: akhaldi Date: Wed Apr 8 17:12:45 2015 New Revision: 67089 URL:
http://svn.reactos.org/svn/reactos?rev=67089&view=rev
Log: [MSRLE32] Sync with Wine Staging 1.7.37. CORE-9246 Modified: trunk/reactos/dll/win32/msrle32/msrle32.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/msrle32/msrle32.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msrle32/msrle32.…
============================================================================== --- trunk/reactos/dll/win32/msrle32/msrle32.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msrle32/msrle32.c [iso-8859-1] Wed Apr 8 17:12:45 2015 @@ -36,13 +36,10 @@ #define compare_fourcc(fcc1, fcc2) (((fcc1)^(fcc2))&~0x20202020) -#define ABS(a) ((a) < 0 ? -(a) : (a)) -#define SQR(a) ((a) * (a)) - static inline WORD ColorCmp(WORD clr1, WORD clr2) { UINT a = clr1 - clr2; - return SQR(a); + return a * a; } static inline WORD Intensity(RGBQUAD clr) { Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Wed Apr 8 17:12:45 2015 @@ -130,7 +130,7 @@ reactos/dll/win32/msisys.ocx # Synced to Wine-1.7.27 reactos/dll/win32/msnet32 # Synced to Wine-1.7.27 reactos/dll/win32/mspatcha # Synced to Wine-1.7.27 -reactos/dll/win32/msrle32 # Synced to Wine-1.7.27 +reactos/dll/win32/msrle32 # Synced to WineStaging-1.7.37 reactos/dll/win32/mssign32 # Synced to Wine-1.7.27 reactos/dll/win32/mssip32 # Synced to Wine-1.7.27 reactos/dll/win32/mstask # Synced to Wine-1.7.27
9 years, 8 months
1
0
0
0
[akhaldi] 67088: [MSCMS_WINETEST] Sync with Wine Staging 1.7.37. CORE-9246
by akhaldi@svn.reactos.org
Author: akhaldi Date: Wed Apr 8 17:12:02 2015 New Revision: 67088 URL:
http://svn.reactos.org/svn/reactos?rev=67088&view=rev
Log: [MSCMS_WINETEST] Sync with Wine Staging 1.7.37. CORE-9246 Modified: trunk/rostests/winetests/mscms/profile.c Modified: trunk/rostests/winetests/mscms/profile.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/mscms/profile.c…
============================================================================== --- trunk/rostests/winetests/mscms/profile.c [iso-8859-1] (original) +++ trunk/rostests/winetests/mscms/profile.c [iso-8859-1] Wed Apr 8 17:12:02 2015 @@ -1364,10 +1364,10 @@ /* See if we can find the standard color profile */ ret = GetSystemDirectoryA( profilefile1, sizeof(profilefile1) ); ok( ret > 0, "GetSystemDirectoryA() returns %d, LastError = %d\n", ret, GetLastError()); - ok( lstrlenA(profilefile1) > 0 && lstrlenA(profilefile1) < MAX_PATH, + ok(profilefile1[0] && lstrlenA(profilefile1) < MAX_PATH, "Expected length between 0 and MAX_PATH, got %d\n", lstrlenA(profilefile1)); MultiByteToWideChar(CP_ACP, 0, profilefile1, -1, profilefile1W, MAX_PATH); - ok( lstrlenW(profilefile1W) > 0 && lstrlenW(profilefile1W) < MAX_PATH, + ok(profilefile1W[0] && lstrlenW(profilefile1W) < MAX_PATH, "Expected length between 0 and MAX_PATH, got %d\n", lstrlenW(profilefile1W)); lstrcpyA(profilefile2, profilefile1); lstrcpyW(profilefile2W, profilefile1W);
9 years, 8 months
1
0
0
0
[akhaldi] 67087: [MSCMS] Sync with Wine Staging 1.7.37. CORE-9246
by akhaldi@svn.reactos.org
Author: akhaldi Date: Wed Apr 8 17:11:42 2015 New Revision: 67087 URL:
http://svn.reactos.org/svn/reactos?rev=67087&view=rev
Log: [MSCMS] Sync with Wine Staging 1.7.37. CORE-9246 Modified: trunk/reactos/dll/win32/mscms/profile.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/mscms/profile.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mscms/profile.c?…
============================================================================== --- trunk/reactos/dll/win32/mscms/profile.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mscms/profile.c [iso-8859-1] Wed Apr 8 17:11:42 2015 @@ -651,7 +651,7 @@ lstrcatW( rgbprofile, rgbprofilefile ); len = lstrlenW( rgbprofile ) * sizeof(WCHAR); - if (*size < len || !profile) + if (*size < len) { *size = len; SetLastError( ERROR_MORE_DATA ); Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Wed Apr 8 17:11:42 2015 @@ -115,7 +115,7 @@ reactos/dll/win32/msacm32/msacm32.drv # Synced to Wine-1.7.27 reactos/dll/win32/msadp32.acm # Synced to Wine-1.7.27 reactos/dll/win32/mscat32 # Synced to Wine-1.7.27 -reactos/dll/win32/mscms # Synced to Wine-1.7.27 +reactos/dll/win32/mscms # Synced to WineStaging-1.7.37 reactos/dll/win32/mscoree # Synced to Wine-1.5.4 reactos/dll/win32/msctf # Synced to Wine-1.7.27 reactos/dll/win32/msftedit # Synced to Wine-1.7.27
9 years, 8 months
1
0
0
0
[akhaldi] 67086: [MMDEVAPI_WINETEST] Sync with Wine Staging 1.7.37. CORE-9246
by akhaldi@svn.reactos.org
Author: akhaldi Date: Wed Apr 8 17:11:03 2015 New Revision: 67086 URL:
http://svn.reactos.org/svn/reactos?rev=67086&view=rev
Log: [MMDEVAPI_WINETEST] Sync with Wine Staging 1.7.37. CORE-9246 Modified: trunk/rostests/winetests/mmdevapi/render.c Modified: trunk/rostests/winetests/mmdevapi/render.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/mmdevapi/render…
============================================================================== --- trunk/rostests/winetests/mmdevapi/render.c [iso-8859-1] (original) +++ trunk/rostests/winetests/mmdevapi/render.c [iso-8859-1] Wed Apr 8 17:11:03 2015 @@ -467,6 +467,169 @@ } } +static void test_formats2(void) +{ + IAudioClient *ac; + HRESULT hr; + WAVEFORMATEX *pwfx, *pwfx2; + WAVEFORMATEXTENSIBLE *pwfe, wfe, *pwfe2; + + hr = IMMDevice_Activate(dev, &IID_IAudioClient, CLSCTX_INPROC_SERVER, + NULL, (void**)&ac); + + ok(hr == S_OK, "Activation failed with %08x\n", hr); + if (hr != S_OK) + return; + + hr = IAudioClient_GetMixFormat(ac, &pwfx); + ok(hr == S_OK, "GetMixFormat failed: %08x\n", hr); + if (hr != S_OK) + return; + + ok(pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE, "Invalid wFormatTag\n"); + if (pwfx->wFormatTag != WAVE_FORMAT_EXTENSIBLE) { + CoTaskMemFree(pwfx); + return; + } + + pwfe = (WAVEFORMATEXTENSIBLE*)pwfx; + ok(pwfe->Samples.wValidBitsPerSample, "wValidBitsPerSample should be non-zero\n"); + + if (pwfx->nChannels > 2) { + trace("Limiting channels to 2\n"); + pwfx->nChannels = 2; + pwfx->nBlockAlign = pwfx->wBitsPerSample / 8 * pwfx->nChannels; + pwfx->nAvgBytesPerSec = pwfx->nBlockAlign * pwfx->nSamplesPerSec; + pwfe->dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT; + } + + wfe = *pwfe; + pwfx->nAvgBytesPerSec = pwfx->nBlockAlign = 0; + + hr = IAudioClient_IsFormatSupported(ac, AUDCLNT_SHAREMODE_EXCLUSIVE, pwfx, NULL); + ok(hr == AUDCLNT_E_UNSUPPORTED_FORMAT || hr == AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED, + "Exclusive IsFormatSupported with nAvgBytesPerSec=0 and nBlockAlign=0 returned %08x\n", hr); + + pwfx2 = NULL; + hr = IAudioClient_IsFormatSupported(ac, AUDCLNT_SHAREMODE_SHARED, pwfx, &pwfx2); + ok((hr == E_INVALIDARG || hr == AUDCLNT_E_UNSUPPORTED_FORMAT) && !pwfx2, + "Shared IsFormatSupported with nAvgBytesPerSec=0 and nBlockAlign=0 returned %08x %p\n", hr, pwfx2); + CoTaskMemFree(pwfx2); + + pwfx->wFormatTag = WAVE_FORMAT_PCM; + pwfx2 = NULL; + hr = IAudioClient_IsFormatSupported(ac, AUDCLNT_SHAREMODE_SHARED, pwfx, &pwfx2); + ok((hr == S_OK || hr == AUDCLNT_E_UNSUPPORTED_FORMAT) && !pwfx2, + "Shared IsFormatSupported with nAvgBytesPerSec=0 and nBlockAlign=0 returned %08x %p\n", hr, pwfx2); + CoTaskMemFree(pwfx2); + + *pwfe = wfe; + pwfe->dwChannelMask = 0; + hr = IAudioClient_IsFormatSupported(ac, AUDCLNT_SHAREMODE_EXCLUSIVE, pwfx, NULL); + ok(hr == AUDCLNT_E_UNSUPPORTED_FORMAT || hr == AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED, + "Exclusive IsFormatSupported with dwChannelMask=0 returned %08x\n", hr); + + pwfx2 = NULL; + hr = IAudioClient_IsFormatSupported(ac, AUDCLNT_SHAREMODE_SHARED, pwfx, &pwfx2); + ok(hr == S_OK, + "Shared IsFormatSupported with dwChannelMask=0 returned %08x\n", hr); + CoTaskMemFree(pwfx2); + + + pwfe->dwChannelMask = 0x3ffff; + hr = IAudioClient_IsFormatSupported(ac, AUDCLNT_SHAREMODE_EXCLUSIVE, pwfx, NULL); + ok(hr == AUDCLNT_E_UNSUPPORTED_FORMAT || hr == AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED, + "Exclusive IsFormatSupported with dwChannelMask=0x3ffff returned %08x\n", hr); + + pwfx2 = NULL; + hr = IAudioClient_IsFormatSupported(ac, AUDCLNT_SHAREMODE_SHARED, pwfx, &pwfx2); + ok(hr == S_OK && !pwfx2, + "Shared IsFormatSupported with dwChannelMask=0x3ffff returned %08x %p\n", hr, pwfx2); + CoTaskMemFree(pwfx2); + + + pwfe->dwChannelMask = 0x40000000; + hr = IAudioClient_IsFormatSupported(ac, AUDCLNT_SHAREMODE_EXCLUSIVE, pwfx, NULL); + ok(hr == AUDCLNT_E_UNSUPPORTED_FORMAT || hr == AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED, + "Exclusive IsFormatSupported with dwChannelMask=0x40000000 returned %08x\n", hr); + + pwfx2 = NULL; + hr = IAudioClient_IsFormatSupported(ac, AUDCLNT_SHAREMODE_SHARED, pwfx, &pwfx2); + ok(hr == S_OK && !pwfx2, + "Shared IsFormatSupported with dwChannelMask=0x40000000 returned %08x %p\n", hr, pwfx2); + CoTaskMemFree(pwfx2); + + pwfe->dwChannelMask = SPEAKER_ALL | SPEAKER_RESERVED; + hr = IAudioClient_IsFormatSupported(ac, AUDCLNT_SHAREMODE_EXCLUSIVE, pwfx, NULL); + ok(hr == AUDCLNT_E_UNSUPPORTED_FORMAT || hr == AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED, + "Exclusive IsFormatSupported with dwChannelMask=SPEAKER_ALL | SPEAKER_RESERVED returned %08x\n", hr); + + pwfx2 = NULL; + hr = IAudioClient_IsFormatSupported(ac, AUDCLNT_SHAREMODE_SHARED, pwfx, &pwfx2); + ok(hr == S_OK && !pwfx2, + "Shared IsFormatSupported with dwChannelMask=SPEAKER_ALL | SPEAKER_RESERVED returned %08x %p\n", hr, pwfx2); + CoTaskMemFree(pwfx2); + + *pwfe = wfe; + pwfe->Samples.wValidBitsPerSample = 0; + hr = IAudioClient_IsFormatSupported(ac, AUDCLNT_SHAREMODE_EXCLUSIVE, pwfx, NULL); + ok(hr == AUDCLNT_E_UNSUPPORTED_FORMAT || hr == AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED, + "Exclusive IsFormatSupported with wValidBitsPerSample=0 returned %08x\n", hr); + + pwfx2 = NULL; + hr = IAudioClient_IsFormatSupported(ac, AUDCLNT_SHAREMODE_SHARED, pwfx, &pwfx2); + ok((hr == S_FALSE || hr == AUDCLNT_E_UNSUPPORTED_FORMAT) && pwfx2, + "Shared IsFormatSupported with wValidBitsPerSample=0 returned %08x %p\n", hr, pwfx2); + if (pwfx2) { + pwfe2 = (WAVEFORMATEXTENSIBLE*)pwfx2; + ok(pwfe2->Samples.wValidBitsPerSample == pwfx->wBitsPerSample, + "Shared IsFormatSupported had wValidBitsPerSample set to %u, not %u\n", + pwfe2->Samples.wValidBitsPerSample, pwfx->wBitsPerSample); + CoTaskMemFree(pwfx2); + } + + pwfx2 = NULL; + pwfe->Samples.wValidBitsPerSample = pwfx->wBitsPerSample + 1; + hr = IAudioClient_IsFormatSupported(ac, AUDCLNT_SHAREMODE_SHARED, pwfx, &pwfx2); + ok((hr == E_INVALIDARG || hr == AUDCLNT_E_UNSUPPORTED_FORMAT) && !pwfx2, + "Shared IsFormatSupported with wValidBitsPerSample += 1 returned %08x %p\n", hr, pwfx2); + + *pwfe = wfe; + memset(&pwfe->SubFormat, 0xff, 16); + pwfx2 = NULL; + hr = IAudioClient_IsFormatSupported(ac, AUDCLNT_SHAREMODE_SHARED, pwfx, &pwfx2); + ok(hr == AUDCLNT_E_UNSUPPORTED_FORMAT && !pwfx2, + "Shared IsFormatSupported with SubFormat=-1 returned %08x %p\n", hr, pwfx2); + CoTaskMemFree(pwfx2); + + *pwfe = wfe; + pwfx2 = NULL; + pwfe->Samples.wValidBitsPerSample = pwfx->wBitsPerSample = 256; + pwfx->nBlockAlign = pwfx->wBitsPerSample / 8 * pwfx->nChannels; + pwfx->nAvgBytesPerSec = pwfx->nBlockAlign * pwfx->nSamplesPerSec; + hr = IAudioClient_IsFormatSupported(ac, AUDCLNT_SHAREMODE_SHARED, pwfx, &pwfx2); + ok((hr == E_INVALIDARG || hr == AUDCLNT_E_UNSUPPORTED_FORMAT) && !pwfx2, + "Shared IsFormatSupported with wBitsPerSample=256 returned %08x %p\n", hr, pwfx2); + CoTaskMemFree(pwfx2); + + *pwfe = wfe; + pwfx2 = NULL; + pwfe->Samples.wValidBitsPerSample = pwfx->wBitsPerSample - 1; + hr = IAudioClient_IsFormatSupported(ac, AUDCLNT_SHAREMODE_SHARED, pwfx, &pwfx2); + ok(hr == S_FALSE && pwfx2, + "Shared IsFormatSupported with wValidBitsPerSample-=1 returned %08x %p\n", hr, pwfx2); + if (pwfx2) { + pwfe2 = (WAVEFORMATEXTENSIBLE*)pwfx2; + ok(pwfe2->Samples.wValidBitsPerSample == pwfx->wBitsPerSample, + "Shared IsFormatSupported had wValidBitsPerSample set to %u, not %u\n", + pwfe2->Samples.wValidBitsPerSample, pwfx->wBitsPerSample); + CoTaskMemFree(pwfx2); + } + + CoTaskMemFree(pwfx); + IAudioClient_Release(ac); +} + static void test_references(void) { IAudioClient *ac; @@ -1020,7 +1183,7 @@ ok(hr == S_OK, "GetPosition failed: %08x\n", hr); ok(pos >= last, "Position %u vs. last %u\n", (UINT)pos,(UINT)last); last = pos; - if(/*share &&*/ winetest_debug>1) todo_wine + if(/*share &&*/ winetest_debug>1) ok(pos*1000/freq <= slept*1.1, "Position %u too far after stop %ums\n", (UINT)pos, slept); hr = IAudioClient_Start(ac); /* #2 */ @@ -1054,7 +1217,7 @@ ok(pos * pwfx->nSamplesPerSec <= sum * freq, "Position %u > written %u\n", (UINT)pos, sum); /* Prove that Stop must not drop frames (in shared mode). */ ok(pad ? pos > last : pos >= last, "Position %u vs. last %u\n", (UINT)pos,(UINT)last); - if (share && pad > 0 && winetest_debug>1) todo_wine + if (share && pad > 0 && winetest_debug>1) ok(pos*1000/freq <= slept*1.1, "Position %u too far after playing %ums\n", (UINT)pos, slept); /* in exclusive mode, testbot's w7 machines yield pos > sum-pad */ if(/*share &&*/ winetest_debug>1) @@ -1133,7 +1296,7 @@ ok(pos >= last, "Position %u vs. last %u\n", (UINT)pos,(UINT)last); ok(pcpos > pcpos0, "pcpos should increase\n"); ok(pos * pwfx->nSamplesPerSec <= sum * freq, "Position %u > written %u\n", (UINT)pos, sum); - if (pad > 0 && winetest_debug>1) todo_wine + if (pad > 0 && winetest_debug>1) ok(pos*1000/freq <= slept*1.1, "Position %u too far after stop %ums\n", (UINT)pos, slept); if(winetest_debug>1) ok(pos * pwfx->nSamplesPerSec == (sum-pad) * freq, @@ -1223,7 +1386,7 @@ ok(pos*1000/freq <= slept*1.1, "Position %u too far after %ums\n", (UINT)pos, slept); if (pad) /* not in case of underrun */ ok((pos-last)*1000/freq >= 90 && 110 >= (pos-last)*1000/freq, - "Position delta %ld not regular\n", (long)(pos-last)); + "Position delta %ld not regular: %ld ms\n", (long)(pos-last), (long)((pos-last)*1000/freq)); } last = pos; @@ -1237,7 +1400,7 @@ /* ok(hr == AUDCLNT_E_BUFFER_TOO_LARGE || (hr == S_OK && i==0) without todo_wine */ ok(hr == S_OK || hr == AUDCLNT_E_BUFFER_TOO_LARGE, "GetBuffer large (%u) failed: %08x\n", avail, hr); - if(hr == S_OK && i) todo_wine ok(FALSE, "GetBuffer large (%u) at iteration %d\n", avail, i); + if(hr == S_OK && i) ok(FALSE, "GetBuffer large (%u) at iteration %d\n", avail, i); /* Only the first iteration should allow that large a buffer * as prefill was drained during the first 350+100ms sleep. * Afterwards, only 100ms of data should find room per iteration. */ @@ -2256,6 +2419,7 @@ test_audioclient(); test_formats(AUDCLNT_SHAREMODE_EXCLUSIVE); test_formats(AUDCLNT_SHAREMODE_SHARED); + test_formats2(); test_references(); test_marshal(); trace("Output to a MS-DOS console is particularly slow and disturbs timing.\n");
9 years, 8 months
1
0
0
0
[akhaldi] 67085: [MMDEVAPI] Sync with Wine Staging 1.7.37. CORE-9246
by akhaldi@svn.reactos.org
Author: akhaldi Date: Wed Apr 8 17:10:40 2015 New Revision: 67085 URL:
http://svn.reactos.org/svn/reactos?rev=67085&view=rev
Log: [MMDEVAPI] Sync with Wine Staging 1.7.37. CORE-9246 Modified: trunk/reactos/dll/win32/mmdevapi/CMakeLists.txt trunk/reactos/dll/win32/mmdevapi/audiovolume.c trunk/reactos/dll/win32/mmdevapi/devenum.c trunk/reactos/dll/win32/mmdevapi/main.c trunk/reactos/dll/win32/mmdevapi/mmdevapi.h trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/mmdevapi/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mmdevapi/CMakeLi…
============================================================================== --- trunk/reactos/dll/win32/mmdevapi/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mmdevapi/CMakeLists.txt [iso-8859-1] Wed Apr 8 17:10:40 2015 @@ -23,4 +23,5 @@ target_link_libraries(mmdevapi uuid wine) add_importlibs(mmdevapi ole32 oleaut32 user32 advapi32 msvcrt kernel32 ntdll) add_pch(mmdevapi mmdevapi.h SOURCE) +add_dependencies(mmdevapi dxsdk) add_cd_file(TARGET mmdevapi DESTINATION reactos/system32 FOR all) Modified: trunk/reactos/dll/win32/mmdevapi/audiovolume.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mmdevapi/audiovo…
============================================================================== --- trunk/reactos/dll/win32/mmdevapi/audiovolume.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mmdevapi/audiovolume.c [iso-8859-1] Wed Apr 8 17:10:40 2015 @@ -23,6 +23,8 @@ typedef struct AEVImpl { IAudioEndpointVolumeEx IAudioEndpointVolumeEx_iface; LONG ref; + float level; + BOOL mute; } AEVImpl; static inline AEVImpl *impl_from_IAudioEndpointVolumeEx(IAudioEndpointVolumeEx *iface) @@ -39,6 +41,8 @@ return E_OUTOFMEMORY; This->IAudioEndpointVolumeEx_iface.lpVtbl = &AEVImpl_Vtbl; This->ref = 1; + This->level = 1.0f; + This->mute = FALSE; return S_OK; } @@ -112,9 +116,13 @@ static HRESULT WINAPI AEV_SetMasterVolumeLevel(IAudioEndpointVolumeEx *iface, float leveldb, const GUID *ctx) { - TRACE("(%p)->(%f,%s)\n", iface, leveldb, debugstr_guid(ctx)); - FIXME("stub\n"); - return E_NOTIMPL; + AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface); + + FIXME("(%p)->(%f,%s): stub\n", iface, leveldb, debugstr_guid(ctx)); + + This->level = leveldb; + + return S_OK; } static HRESULT WINAPI AEV_SetMasterVolumeLevelScalar(IAudioEndpointVolumeEx *iface, float level, const GUID *ctx) @@ -126,11 +134,16 @@ static HRESULT WINAPI AEV_GetMasterVolumeLevel(IAudioEndpointVolumeEx *iface, float *leveldb) { - TRACE("(%p)->(%p)\n", iface, leveldb); + AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface); + + FIXME("(%p)->(%p): stub\n", iface, leveldb); + if (!leveldb) return E_POINTER; - FIXME("stub\n"); - return E_NOTIMPL; + + *leveldb = This->level; + + return S_OK; } static HRESULT WINAPI AEV_GetMasterVolumeLevelScalar(IAudioEndpointVolumeEx *iface, float *level) @@ -176,18 +189,27 @@ static HRESULT WINAPI AEV_SetMute(IAudioEndpointVolumeEx *iface, BOOL mute, const GUID *ctx) { - TRACE("(%p)->(%u,%s)\n", iface, mute, debugstr_guid(ctx)); - FIXME("stub\n"); - return E_NOTIMPL; + AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface); + + FIXME("(%p)->(%u,%s): stub\n", iface, mute, debugstr_guid(ctx)); + + This->mute = mute; + + return S_OK; } static HRESULT WINAPI AEV_GetMute(IAudioEndpointVolumeEx *iface, BOOL *mute) { - TRACE("(%p)->(%p)\n", iface, mute); + AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface); + + FIXME("(%p)->(%p): stub\n", iface, mute); + if (!mute) return E_POINTER; - FIXME("stub\n"); - return E_NOTIMPL; + + *mute = This->mute; + + return S_OK; } static HRESULT WINAPI AEV_GetVolumeStepInfo(IAudioEndpointVolumeEx *iface, UINT *stepsize, UINT *stepcount) @@ -224,11 +246,16 @@ static HRESULT WINAPI AEV_GetVolumeRange(IAudioEndpointVolumeEx *iface, float *mindb, float *maxdb, float *inc) { - TRACE("(%p)->(%p,%p,%p)\n", iface, mindb, maxdb, inc); + FIXME("(%p)->(%p,%p,%p): stub\n", iface, mindb, maxdb, inc); + if (!mindb || !maxdb || !inc) return E_POINTER; - FIXME("stub\n"); - return E_NOTIMPL; + + *mindb = 0.0f; + *maxdb = 1.0f; + *inc = 0.1f; + + return S_OK; } static HRESULT WINAPI AEV_GetVolumeRangeChannel(IAudioEndpointVolumeEx *iface, UINT chan, float *mindb, float *maxdb, float *inc) Modified: trunk/reactos/dll/win32/mmdevapi/devenum.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mmdevapi/devenum…
============================================================================== --- trunk/reactos/dll/win32/mmdevapi/devenum.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mmdevapi/devenum.c [iso-8859-1] Wed Apr 8 17:10:40 2015 @@ -246,6 +246,25 @@ return hr; } +static HRESULT set_driver_prop_value(GUID *id, const EDataFlow flow, const PROPERTYKEY *prop) +{ + HRESULT hr; + PROPVARIANT pv; + + if (!drvs.pGetPropValue) + return E_NOTIMPL; + + hr = drvs.pGetPropValue(id, prop, &pv); + + if (SUCCEEDED(hr)) + { + MMDevice_SetPropValue(id, flow, prop, &pv); + PropVariantClear(&pv); + } + + return hr; +} + /* Creates or updates the state of a device * If GUID is null, a random guid will be assigned * and the device will be created @@ -259,6 +278,10 @@ static const PROPERTYKEY deviceinterface_key = { {0x233164c8, 0x1b2c, 0x4c7d, {0xbc, 0x68, 0xb6, 0x71, 0x68, 0x7a, 0x25, 0x67}}, 1 + }; + + static const PROPERTYKEY devicepath_key = { + {0xb3f8fa53, 0x0004, 0x438e, {0x90, 0x03, 0x51, 0xa4, 0x6e, 0x13, 0x9b, 0xfc}}, 2 }; for (i = 0; i < MMDevice_count; ++i) @@ -319,6 +342,29 @@ pv.u.pwszVal = guidstr; MMDevice_SetPropValue(id, flow, &deviceinterface_key, &pv); + + set_driver_prop_value(id, flow, &devicepath_key); + + if (FAILED(set_driver_prop_value(id, flow, &PKEY_AudioEndpoint_FormFactor))) + { + pv.vt = VT_UI4; + pv.u.ulVal = (flow == eCapture) ? Microphone : Speakers; + + MMDevice_SetPropValue(id, flow, &PKEY_AudioEndpoint_FormFactor, &pv); + } + + if (flow != eCapture) + { + PROPVARIANT pv2; + + PropVariantInit(&pv2); + + /* make read-write by not overwriting if already set */ + if (FAILED(MMDevice_GetPropValue(id, flow, &PKEY_AudioEndpoint_PhysicalSpeakers, &pv2)) || pv2.vt != VT_UI4) + set_driver_prop_value(id, flow, &PKEY_AudioEndpoint_PhysicalSpeakers); + + PropVariantClear(&pv2); + } RegCloseKey(keyprop); } @@ -1405,8 +1451,17 @@ static HRESULT WINAPI MMDevPropStore_Commit(IPropertyStore *iface) { - FIXME("stub\n"); - return E_NOTIMPL; + MMDevPropStore *This = impl_from_IPropertyStore(iface); + TRACE("(%p)\n", iface); + + if (This->access != STGM_WRITE + && This->access != STGM_READWRITE) + return STG_E_ACCESSDENIED; + + /* Does nothing - for mmdevapi, the propstore values are written on SetValue, + * not on Commit. */ + + return S_OK; } static const IPropertyStoreVtbl MMDevPropVtbl = Modified: trunk/reactos/dll/win32/mmdevapi/main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mmdevapi/main.c?…
============================================================================== --- trunk/reactos/dll/win32/mmdevapi/main.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mmdevapi/main.c [iso-8859-1] Wed Apr 8 17:10:40 2015 @@ -70,6 +70,9 @@ LDFC(GetAudioSessionManager); #undef LDFC + /* optional - do not fail if not found */ + driver->pGetPropValue = (void*)GetProcAddress(driver->module, "GetPropValue"); + driver->priority = driver->pGetPriority(); lstrcpyW(driver->module_name, driver_module); @@ -83,7 +86,7 @@ { static const WCHAR drv_value[] = {'A','u','d','i','o',0}; - static WCHAR default_list[] = {'a','l','s','a',',','o','s','s',',', + static WCHAR default_list[] = {'p','u','l','s','e',',','a','l','s','a',',','o','s','s',',', 'c','o','r','e','a','u','d','i','o',0}; DriverFuncs driver; Modified: trunk/reactos/dll/win32/mmdevapi/mmdevapi.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mmdevapi/mmdevap…
============================================================================== --- trunk/reactos/dll/win32/mmdevapi/mmdevapi.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mmdevapi/mmdevapi.h [iso-8859-1] Wed Apr 8 17:10:40 2015 @@ -79,6 +79,8 @@ IAudioClient **out); HRESULT (WINAPI *pGetAudioSessionManager)(IMMDevice *device, IAudioSessionManager2 **out); + HRESULT (WINAPI *pGetPropValue)(GUID *guid, + const PROPERTYKEY *prop, PROPVARIANT *out); } DriverFuncs; extern DriverFuncs drvs DECLSPEC_HIDDEN; Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Wed Apr 8 17:10:40 2015 @@ -108,7 +108,7 @@ reactos/dll/win32/mciwave # Synced to WineStaging-1.7.37 reactos/dll/win32/mgmtapi # Synced to Wine-1.7.27 reactos/dll/win32/mlang # Synced to WineStaging-1.7.37 -reactos/dll/win32/mmdevapi # Synced to Wine-1.7.27 +reactos/dll/win32/mmdevapi # Synced to WineStaging-1.7.37 reactos/dll/win32/mpr # Synced to Wine-1.7.27 reactos/dll/win32/mprapi # Synced to Wine-1.7.27 reactos/dll/win32/msacm32 # Synced to Wine-1.7.27
9 years, 8 months
1
0
0
0
← Newer
1
...
37
38
39
40
41
42
43
...
49
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Results per page:
10
25
50
100
200