ReactOS 0.4.15-dev-7907-g95bf896
process.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wbemcli.h"
#include "wine/debug.h"
#include "wbemprox_private.h"
Include dependency graph for process.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (wbemprox)
 
static HRESULT get_owner (VARIANT *user, VARIANT *domain, VARIANT *retval)
 
HRESULT process_get_owner (IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out)
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file process.c.

Function Documentation

◆ get_owner()

static HRESULT get_owner ( VARIANT user,
VARIANT domain,
VARIANT retval 
)
static

Definition at line 34 of file process.c.

35{
36 DWORD len;
37 UINT error = 8;
38
39 len = 0;
41 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) goto done;
42 if (!(V_BSTR( user ) = SysAllocStringLen( NULL, len - 1 ))) goto done;
43 if (!GetUserNameW( V_BSTR( user ), &len )) goto done;
44 V_VT( user ) = VT_BSTR;
45
46 len = 0;
48 if (GetLastError() != ERROR_BUFFER_OVERFLOW) goto done;
49 if (!(V_BSTR( domain ) = SysAllocStringLen( NULL, len - 1 ))) goto done;
50 if (!GetComputerNameW( V_BSTR( domain ), &len )) goto done;
51 V_VT( domain ) = VT_BSTR;
52
53 error = 0;
54
55done:
56 if (error)
57 {
60 }
61 set_variant( VT_UI4, error, NULL, retval );
62 return S_OK;
63}
void user(int argc, const char *argv[])
Definition: cmds.c:1350
BOOL WINAPI GetComputerNameW(LPWSTR lpBuffer, LPDWORD lpnSize)
Definition: compname.c:446
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define NULL
Definition: types.h:112
BOOL WINAPI GetUserNameW(LPWSTR lpszName, LPDWORD lpSize)
Definition: misc.c:291
@ VT_BSTR
Definition: compat.h:2303
@ VT_UI4
Definition: compat.h:2313
void set_variant(VARTYPE type, LONGLONG val, void *val_ptr, VARIANT *ret)
Definition: query.c:1093
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:52
#define error(str)
Definition: mkdosfs.c:1605
unsigned int UINT
Definition: ndis.h:50
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
Definition: cookie.c:42
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:185

Referenced by alloc_rootdir_entry(), check_file(), process_get_owner(), and test_file().

◆ process_get_owner()

HRESULT process_get_owner ( IWbemClassObject obj,
IWbemClassObject in,
IWbemClassObject **  out 
)

Definition at line 65 of file process.c.

66{
67 VARIANT user, domain, retval;
69 HRESULT hr;
70
71 TRACE("%p, %p, %p\n", obj, in, out);
72
74 if (hr != S_OK) return hr;
75
76 if (out)
77 {
78 hr = IWbemClassObject_SpawnInstance( sig, 0, &out_params );
79 if (hr != S_OK)
80 {
81 IWbemClassObject_Release( sig );
82 return hr;
83 }
84 }
85 VariantInit( &user );
87 hr = get_owner( &user, &domain, &retval );
88 if (hr != S_OK) goto done;
89 if (out_params)
90 {
91 if (!V_UI4( &retval ))
92 {
93 hr = IWbemClassObject_Put( out_params, param_userW, 0, &user, CIM_STRING );
94 if (hr != S_OK) goto done;
95 hr = IWbemClassObject_Put( out_params, param_domainW, 0, &domain, CIM_STRING );
96 if (hr != S_OK) goto done;
97 }
98 hr = IWbemClassObject_Put( out_params, param_returnvalueW, 0, &retval, CIM_UINT32 );
99 }
100
101done:
102 VariantClear( &user );
104 IWbemClassObject_Release( sig );
105 if (hr == S_OK && out)
106 {
107 *out = out_params;
108 IWbemClassObject_AddRef( out_params );
109 }
110 if (out_params) IWbemClassObject_Release( out_params );
111 return hr;
112}
HRESULT create_signature(const WCHAR *class, const WCHAR *method, enum param_direction dir, IWbemClassObject **sig)
Definition: class.c:819
static HRESULT get_owner(VARIANT *user, VARIANT *domain, VARIANT *retval)
Definition: process.c:34
GLuint in
Definition: glext.h:9616
static void out_params(void)
Definition: nanoxwin.c:1413
#define V_UI4(A)
Definition: oleauto.h:270
static FILE * out
Definition: regtests2xml.c:44
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:568
@ CIM_UINT32
Definition: wbemcli.idl:249
@ CIM_STRING
Definition: wbemcli.idl:243
static const WCHAR param_userW[]
static const WCHAR method_getownerW[]
@ PARAM_OUT
static const WCHAR class_processW[]
static const WCHAR param_returnvalueW[]
static const WCHAR param_domainW[]

Referenced by fill_process().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( wbemprox  )