ReactOS 0.4.17-dev-444-g71ee754
CShellDispatch.cpp File Reference
#include "precomp.h"
#include "prop.h"
#include "winsvc.h"
Include dependency graph for CShellDispatch.cpp:

Go to the source code of this file.

Macros

#define IDM_SECURITY   5001
 
#define SSF_SERVERADMINUI   4
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
EXTERN_C DWORD WINAPI SHGetRestriction (LPCWSTR lpSubKey, LPCWSTR lpSubName, LPCWSTR lpValue)
 
static HRESULT PostTrayCommand (UINT cmd)
 
static BOOL is_optional_argument (const VARIANT *arg)
 
static HRESULT SHELL_OpenFolder (LPCITEMIDLIST pidl, LPCWSTR verb=NULL)
 
static HRESULT OpenFolder (VARIANT vDir, LPCWSTR verb=NULL)
 
static HRESULT OpenServiceHelper (LPCWSTR name, DWORD access, SC_HANDLE &hSvc)
 
static HRESULT SHELL32_ControlService (BSTR name, DWORD control, VARIANT &persistent)
 
HRESULT WINAPI CShellDispatch_Constructor (REFIID riid, LPVOID *ppvOut)
 

Macro Definition Documentation

◆ IDM_SECURITY

#define IDM_SECURITY   5001

Definition at line 523 of file CShellDispatch.cpp.

◆ SSF_SERVERADMINUI

#define SSF_SERVERADMINUI   4

Definition at line 543 of file CShellDispatch.cpp.

Function Documentation

◆ CShellDispatch_Constructor()

HRESULT WINAPI CShellDispatch_Constructor ( REFIID  riid,
LPVOID ppvOut 
)

Definition at line 597 of file CShellDispatch.cpp.

598{
599 return ShellObjectCreatorInit<CShellDispatch>(riid, ppvOut);
600}
REFIID riid
Definition: atlbase.h:39

Referenced by CDefViewDual::get_Application(), and CFolder::Initialize().

◆ is_optional_argument()

static BOOL is_optional_argument ( const VARIANT arg)
static

Definition at line 88 of file CShellDispatch.cpp.

89{
91}
@ VT_ERROR
Definition: compat.h:2305
#define V_ERROR(A)
Definition: oleauto.h:241
#define V_VT(A)
Definition: oleauto.h:211
#define DISP_E_PARAMNOTFOUND
Definition: winerror.h:3616

Referenced by CShellDispatch::BrowseForFolder().

◆ OpenFolder()

static HRESULT OpenFolder ( VARIANT  vDir,
LPCWSTR  verb = NULL 
)
static

Definition at line 138 of file CShellDispatch.cpp.

139{
141 HRESULT hr = VariantToIdlist(&vDir, &idlist);
142 if (hr == S_OK && SHELL_OpenFolder(idlist, verb) == S_OK)
143 {
144 return S_OK;
145 }
146 return S_FALSE;
147}
HRESULT hr
Definition: delayimp.cpp:582
static HRESULT SHELL_OpenFolder(LPCITEMIDLIST pidl, LPCWSTR verb=NULL)
#define S_OK
Definition: intsafe.h:52
HRESULT VariantToIdlist(_In_ VARIANT *pV, _Out_ LPITEMIDLIST *ppidl)
Definition: prop.cpp:68
#define S_FALSE
Definition: winerror.h:3451

Referenced by CShellDispatch::Explore(), and CShellDispatch::Open().

◆ OpenServiceHelper()

static HRESULT OpenServiceHelper ( LPCWSTR  name,
DWORD  access,
SC_HANDLE &  hSvc 
)
static

Definition at line 365 of file CShellDispatch.cpp.

366{
367 hSvc = NULL;
368 SC_HANDLE hScm = OpenSCManagerW(NULL, NULL, SC_MANAGER_CONNECT);
369 if (!hScm)
371 HRESULT hr = S_OK;
372 hSvc = OpenServiceW(hScm, name, access);
373 if (!hSvc)
375 CloseServiceHandle(hScm);
376 return hr;
377}
#define NULL
Definition: types.h:112
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
#define HResultFromWin32
Definition: loader.cpp:14
#define SC_MANAGER_CONNECT
Definition: winsvc.h:14
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:2107
SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:2199
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:580
Definition: name.c:39
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by CShellDispatch::CanStartStopService(), and SHELL32_ControlService().

◆ PostTrayCommand()

◆ SHELL32_ControlService()

static HRESULT SHELL32_ControlService ( BSTR  name,
DWORD  control,
VARIANT persistent 
)
static

Definition at line 379 of file CShellDispatch.cpp.

380{
381 BOOL persist = V_VT(&persistent) == VT_BOOL && V_BOOL(&persistent);
382 DWORD access = persist ? SERVICE_CHANGE_CONFIG : 0;
383 switch (control)
384 {
385 case 0:
387 break;
390 break;
391 }
392 SC_HANDLE hSvc;
394 if (SUCCEEDED(hr))
395 {
397 DWORD error, already;
398 if (control)
399 {
401 success = ControlService(hSvc, control, &ss);
403 already = ERROR_SERVICE_NOT_ACTIVE;
404 }
405 else
406 {
407 success = StartService(hSvc, 0, NULL);
410 }
411 hr = success ? S_OK : error == already ? S_FALSE : HRESULT_FROM_WIN32(error);
412 if (SUCCEEDED(hr) && persist)
413 {
417 }
418 CloseServiceHandle(hSvc);
419 }
420 return hr;
421}
@ VT_BOOL
Definition: compat.h:2306
static HRESULT OpenServiceHelper(LPCWSTR name, DWORD access, SC_HANDLE &hSvc)
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ss
Definition: i386-dis.c:441
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define error(str)
Definition: mkdosfs.c:1605
#define V_BOOL(A)
Definition: oleauto.h:224
#define SERVICE_START
Definition: winsvc.h:63
#define SERVICE_NO_CHANGE
Definition: winsvc.h:20
#define SERVICE_CHANGE_CONFIG
Definition: winsvc.h:60
#define StartService
Definition: winsvc.h:591
#define SERVICE_STOP
Definition: winsvc.h:64
#define SERVICE_CONTROL_STOP
Definition: winsvc.h:42
BOOL WINAPI ControlService(SC_HANDLE hService, DWORD dwControl, LPSERVICE_STATUS lpServiceStatus)
Definition: scm.c:622
BOOL WINAPI ChangeServiceConfigW(SC_HANDLE hService, DWORD dwServiceType, DWORD dwStartType, DWORD dwErrorControl, LPCWSTR lpBinaryPathName, LPCWSTR lpLoadOrderGroup, LPDWORD lpdwTagId, LPCWSTR lpDependencies, LPCWSTR lpServiceStartName, LPCWSTR lpPassword, LPCWSTR lpDisplayName)
Definition: scm.c:482
Definition: dialog.c:52
#define success(from, fromstr, to, tostr)
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define ERROR_SERVICE_ALREADY_RUNNING
Definition: winerror.h:931
#define ERROR_SERVICE_NOT_ACTIVE
Definition: winerror.h:937
#define SERVICE_DEMAND_START
Definition: cmtypes.h:978
#define SERVICE_AUTO_START
Definition: cmtypes.h:977

Referenced by CShellDispatch::ServiceStart(), and CShellDispatch::ServiceStop().

◆ SHELL_OpenFolder()

static HRESULT SHELL_OpenFolder ( LPCITEMIDLIST  pidl,
LPCWSTR  verb = NULL 
)
static

Definition at line 122 of file CShellDispatch.cpp.

123{
125 sei.cbSize = sizeof(sei);
127 sei.hwnd = NULL;
128 sei.lpVerb = verb;
129 sei.lpFile = sei.lpParameters = sei.lpDirectory = NULL;
130 sei.nShow = SW_SHOW;
131 sei.lpIDList = const_cast<LPITEMIDLIST>(pidl);
132 if (ShellExecuteExW(&sei))
133 return S_OK;
136}
#define SEE_MASK_IDLIST
Definition: shellapi.h:27
#define SEE_MASK_FLAG_DDEWAIT
Definition: shellapi.h:36
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2723
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
LPCWSTR lpDirectory
Definition: shellapi.h:340
LPCWSTR lpParameters
Definition: shellapi.h:339
#define SW_SHOW
Definition: winuser.h:786

Referenced by OpenFolder().

◆ SHGetRestriction()

EXTERN_C DWORD WINAPI SHGetRestriction ( LPCWSTR  lpSubKey,
LPCWSTR  lpSubName,
LPCWSTR  lpValue 
)

Definition at line 2357 of file ordinal.c.

2358{
2359#ifdef __REACTOS__
2361 DWORD dwSize, dwValue = 0;
2362
2363 TRACE("(%s, %s, %s)\n", debugstr_w(lpSubKey), debugstr_w(lpSubName), debugstr_w(lpValue));
2364
2365 if (!lpSubKey)
2366 lpSubKey = L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies";
2367
2368 PathCombineW(szPath, lpSubKey, lpSubName);
2369
2370 dwSize = sizeof(dwValue);
2371 if (SHGetValueW(HKEY_LOCAL_MACHINE, szPath, lpValue, NULL, &dwValue, &dwSize) == ERROR_SUCCESS)
2372 return dwValue;
2373
2374 dwSize = sizeof(dwValue);
2375 SHGetValueW(HKEY_CURRENT_USER, szPath, lpValue, NULL, &dwValue, &dwSize);
2376 return dwValue;
2377#else
2378 DWORD retval, datsize = sizeof(retval);
2379 HKEY hKey;
2380
2381 if (!lpSubKey)
2382 lpSubKey = strRegistryPolicyW;
2383
2385 if (retval != ERROR_SUCCESS)
2387 if (retval != ERROR_SUCCESS)
2388 return 0;
2389
2390 SHGetValueW(hKey, lpSubName, lpValue, NULL, &retval, &datsize);
2392 return retval;
2393#endif
2394}
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3268
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI SHGetValueW(HKEY hkey, const WCHAR *subkey, const WCHAR *value, DWORD *type, void *data, DWORD *data_len)
Definition: main.c:2222
static const WCHAR strRegistryPolicyW[]
Definition: ordinal.c:2338
FxAutoRegKey hKey
#define debugstr_w
Definition: kernel32.h:32
LPCWSTR szPath
Definition: env.c:37
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define PathCombineW
Definition: pathcch.h:318
short WCHAR
Definition: pedump.c:58
#define TRACE(s)
Definition: solgame.cpp:4
int retval
Definition: wcstombs.cpp:91
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define HKEY_CURRENT_USER
Definition: winreg.h:11

Referenced by CShellDispatch::IsRestricted(), and SHRestrictionLookup().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )