ReactOS 0.4.16-dev-1946-g52006dd
main.c File Reference
#include "ntstatus.h"
#include "windows.h"
#include "appmodel.h"
#include "shlwapi.h"
#include "perflib.h"
#include "winternl.h"
#include "wine/debug.h"
#include "kernelbase.h"
#include "wine/heap.h"
#include "wine/list.h"
Include dependency graph for main.c:

Go to the source code of this file.

Classes

struct  counterset_template
 
struct  counterset_instance
 
struct  perf_provider
 

Macros

#define COBJMACROS
 
#define WIN32_NO_STATUS
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (kernelbase)
 
BOOL WINAPI DllMain (HINSTANCE hinst, DWORD reason, LPVOID reserved)
 
INT WINAPI MulDiv (INT a, INT b, INT c)
 
LONG WINAPI AppPolicyGetMediaFoundationCodecLoading (HANDLE token, AppPolicyMediaFoundationCodecLoading *policy)
 
LONG WINAPI AppPolicyGetProcessTerminationMethod (HANDLE token, AppPolicyProcessTerminationMethod *policy)
 
LONG WINAPI AppPolicyGetThreadInitializationType (HANDLE token, AppPolicyThreadInitializationType *policy)
 
LONG WINAPI AppPolicyGetShowDeveloperDiagnostic (HANDLE token, AppPolicyShowDeveloperDiagnostic *policy)
 
LONG WINAPI AppPolicyGetWindowingModel (HANDLE token, AppPolicyWindowingModel *policy)
 
static struct perf_providerperf_provider_from_handle (HANDLE prov)
 
PERF_COUNTERSET_INSTANCE WINAPIPerfCreateInstance (HANDLE handle, const GUID *guid, const WCHAR *name, ULONG id)
 
ULONG WINAPI PerfDeleteInstance (HANDLE provider, PERF_COUNTERSET_INSTANCE *block)
 
ULONG WINAPI PerfSetCounterSetInfo (HANDLE handle, PERF_COUNTERSET_INFO *template, ULONG size)
 
ULONG WINAPI PerfSetCounterRefValue (HANDLE provider, PERF_COUNTERSET_INSTANCE *instance, ULONG counterid, void *address)
 
ULONG WINAPI PerfStartProvider (GUID *guid, PERFLIBREQUEST callback, HANDLE *provider)
 
ULONG WINAPI PerfStartProviderEx (GUID *guid, PERF_PROVIDER_CONTEXT *context, HANDLE *provider)
 
ULONG WINAPI PerfStopProvider (HANDLE handle)
 
BOOL WINAPI QuirkIsEnabled (void *arg)
 
BOOL WINAPI QuirkIsEnabled3 (void *unk1, void *unk2)
 
HRESULT WINAPI QISearch (void *base, const QITAB *table, REFIID riid, void **obj)
 
HRESULT WINAPI GetAcceptLanguagesA (LPSTR langbuf, DWORD *buflen)
 
static HRESULT lcid_to_rfc1766 (LCID lcid, WCHAR *rfc1766, INT len)
 
HRESULT WINAPI GetAcceptLanguagesW (WCHAR *langbuf, DWORD *buflen)
 

Variables

BOOL is_wow64 = FALSE
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 20 of file main.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 23 of file main.c.

Function Documentation

◆ AppPolicyGetMediaFoundationCodecLoading()

LONG WINAPI AppPolicyGetMediaFoundationCodecLoading ( HANDLE  token,
AppPolicyMediaFoundationCodecLoading *  policy 
)

Definition at line 88 of file main.c.

89{
90 FIXME("%p, %p\n", token, policy);
91
92 if(policy)
93 *policy = AppPolicyMediaFoundationCodecLoading_All;
94
95 return ERROR_SUCCESS;
96}
WINBASEAPI _Check_return_ _Out_ AppPolicyProcessTerminationMethod * policy
Definition: appmodel.h:73
#define FIXME(fmt,...)
Definition: precomp.h:53
#define ERROR_SUCCESS
Definition: deptool.c:10
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210

◆ AppPolicyGetProcessTerminationMethod()

LONG WINAPI AppPolicyGetProcessTerminationMethod ( HANDLE  token,
AppPolicyProcessTerminationMethod policy 
)

Definition at line 101 of file main.c.

102{
103 FIXME("%p, %p\n", token, policy);
104
105 if(policy)
107
108 return ERROR_SUCCESS;
109}
@ AppPolicyProcessTerminationMethod_ExitProcess
Definition: appmodel.h:16

◆ AppPolicyGetShowDeveloperDiagnostic()

LONG WINAPI AppPolicyGetShowDeveloperDiagnostic ( HANDLE  token,
AppPolicyShowDeveloperDiagnostic policy 
)

Definition at line 127 of file main.c.

128{
129 FIXME("%p, %p\n", token, policy);
130
131 if(policy)
133
134 return ERROR_SUCCESS;
135}
@ AppPolicyShowDeveloperDiagnostic_ShowUI
Definition: appmodel.h:29

◆ AppPolicyGetThreadInitializationType()

LONG WINAPI AppPolicyGetThreadInitializationType ( HANDLE  token,
AppPolicyThreadInitializationType policy 
)

Definition at line 114 of file main.c.

115{
116 FIXME("%p, %p\n", token, policy);
117
118 if(policy)
120
121 return ERROR_SUCCESS;
122}
@ AppPolicyThreadInitializationType_None
Definition: appmodel.h:22

◆ AppPolicyGetWindowingModel()

LONG WINAPI AppPolicyGetWindowingModel ( HANDLE  token,
AppPolicyWindowingModel policy 
)

Definition at line 140 of file main.c.

141{
142 FIXME("%p, %p\n", token, policy);
143
144 if(policy)
146
147 return ERROR_SUCCESS;
148}
@ AppPolicyWindowingModel_ClassicDesktop
Definition: appmodel.h:36

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hinst,
DWORD  reason,
LPVOID  reserved 
)

Definition at line 43 of file main.c.

44{
46 {
53 }
54 return TRUE;
55}
#define TRUE
Definition: types.h:120
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define GetCurrentProcess()
Definition: compat.h:759
#define IsWow64Process
Definition: compat.h:760
PPEB Peb
Definition: dllmain.c:27
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
void init_console(void)
Definition: console.c:2339
BOOL is_wow64
Definition: main.c:38
#define NtCurrentTeb
void init_global_data(void)
Definition: memory.c:931
void init_locale(HMODULE module)
Definition: locale.c:1911
void init_startup_info(RTL_USER_PROCESS_PARAMETERS *params)
Definition: process.c:1306
static HINSTANCE hinst
Definition: edit.c:551
PRTL_USER_PROCESS_PARAMETERS ProcessParameters
Definition: btrfs_drv.h:1913

◆ GetAcceptLanguagesA()

HRESULT WINAPI GetAcceptLanguagesA ( LPSTR  langbuf,
DWORD buflen 
)

Definition at line 463 of file main.c.

464{
465 DWORD buflenW, convlen;
466 WCHAR *langbufW;
467 HRESULT hr;
468
469 TRACE("%p, %p, *%p: %ld\n", langbuf, buflen, buflen, buflen ? *buflen : -1);
470
471 if (!langbuf || !buflen || !*buflen)
472 return E_FAIL;
473
474 buflenW = *buflen;
475 langbufW = heap_alloc(sizeof(WCHAR) * buflenW);
476 hr = GetAcceptLanguagesW(langbufW, &buflenW);
477
478 if (hr == S_OK)
479 {
480 convlen = WideCharToMultiByte(CP_ACP, 0, langbufW, -1, langbuf, *buflen, NULL, NULL);
481 convlen--; /* do not count the terminating 0 */
482 }
483 else /* copy partial string anyway */
484 {
485 convlen = WideCharToMultiByte(CP_ACP, 0, langbufW, *buflen, langbuf, *buflen, NULL, NULL);
486 if (convlen < *buflen)
487 {
488 langbuf[convlen] = 0;
489 convlen--; /* do not count the terminating 0 */
490 }
491 else
492 {
493 convlen = *buflen;
494 }
495 }
496 *buflen = buflenW ? convlen : 0;
497
498 heap_free(langbufW);
499 return hr;
500}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
HRESULT WINAPI GetAcceptLanguagesW(WCHAR *langbuf, DWORD *buflen)
Definition: main.c:529
unsigned long DWORD
Definition: ntddk_ex.h:95
#define S_OK
Definition: intsafe.h:52
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ GetAcceptLanguagesW()

HRESULT WINAPI GetAcceptLanguagesW ( WCHAR langbuf,
DWORD buflen 
)

Definition at line 529 of file main.c.

530{
531 DWORD mystrlen, mytype;
532 WCHAR *mystr;
533 LCID mylcid;
534 HKEY mykey;
535 LONG lres;
536 DWORD len;
537
538 TRACE("%p, %p, *%p: %ld\n", langbuf, buflen, buflen, buflen ? *buflen : -1);
539
540 if (!langbuf || !buflen || !*buflen)
541 return E_FAIL;
542
543 mystrlen = (*buflen > 20) ? *buflen : 20 ;
544 len = mystrlen * sizeof(WCHAR);
545 mystr = heap_alloc(len);
546 mystr[0] = 0;
547 RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Internet Explorer\\International",
548 0, KEY_QUERY_VALUE, &mykey);
549 lres = RegQueryValueExW(mykey, L"AcceptLanguage", 0, &mytype, (PBYTE)mystr, &len);
550 RegCloseKey(mykey);
551 len = lstrlenW(mystr);
552
553 if (!lres && (*buflen > len))
554 {
555 lstrcpyW(langbuf, mystr);
556 *buflen = len;
557 heap_free(mystr);
558 return S_OK;
559 }
560
561 /* Did not find a value in the registry or the user buffer is too small */
562 mylcid = GetUserDefaultLCID();
563 lcid_to_rfc1766(mylcid, mystr, mystrlen);
564 len = lstrlenW(mystr);
565
566 memcpy(langbuf, mystr, min(*buflen, len + 1)*sizeof(WCHAR));
567 heap_free(mystr);
568
569 if (*buflen > len)
570 {
571 *buflen = len;
572 return S_OK;
573 }
574
575 *buflen = 0;
577}
#define RegCloseKey(hKey)
Definition: registry.h:49
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
#define lstrcpyW
Definition: compat.h:749
#define lstrlenW
Definition: compat.h:750
LCID WINAPI GetUserDefaultLCID(void)
Definition: locale.c:1216
static HRESULT lcid_to_rfc1766(LCID lcid, WCHAR *rfc1766, INT len)
Definition: main.c:502
#define L(x)
Definition: resources.c:13
GLenum GLsizei len
Definition: glext.h:6722
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define min(a, b)
Definition: monoChain.cc:55
#define KEY_QUERY_VALUE
Definition: nt_native.h:1019
BYTE * PBYTE
Definition: pedump.c:66
long LONG
Definition: pedump.c:60
DWORD LCID
Definition: nls.h:13
#define E_NOT_SUFFICIENT_BUFFER
Definition: winerror.h:3437
#define HKEY_CURRENT_USER
Definition: winreg.h:11

Referenced by GetAcceptLanguagesA().

◆ lcid_to_rfc1766()

static HRESULT lcid_to_rfc1766 ( LCID  lcid,
WCHAR rfc1766,
INT  len 
)
static

Definition at line 502 of file main.c.

503{
504 WCHAR buffer[6 /* MAX_RFC1766_NAME */];
506 INT i;
507
508 if (n)
509 {
511 if ((((i == LANG_ENGLISH) || (i == LANG_CHINESE) || (i == LANG_ARABIC)) &&
514
515 buffer[n - 1] = '-';
517 if (!i)
518 buffer[n - 1] = '\0';
519 }
520 else
521 i = 0;
522
524 return ((n + i) > len) ? E_INVALIDARG : S_OK;
525 }
526 return E_FAIL;
527}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define E_INVALIDARG
Definition: ddrawi.h:101
INT WINAPI LCMapStringW(LCID lcid, DWORD flags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen)
Definition: locale.c:3808
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: locale.c:1675
LCID lcid
Definition: locale.c:5656
GLdouble n
Definition: glext.h:7729
GLuint buffer
Definition: glext.h:5915
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define LOCALE_USER_DEFAULT
#define SUBLANGID(l)
Definition: nls.h:17
#define LANG_ENGLISH
Definition: nls.h:52
#define SUBLANG_DEFAULT
Definition: nls.h:168
#define LANG_ARABIC
Definition: nls.h:29
#define LANG_CHINESE
Definition: nls.h:42
#define PRIMARYLANGID(l)
Definition: nls.h:16
int32_t INT
Definition: typedefs.h:58
#define LOCALE_SISO639LANGNAME
Definition: winnls.h:133
#define LCMAP_LOWERCASE
Definition: winnls.h:197
#define LOCALE_SISO3166CTRYNAME
Definition: winnls.h:134

Referenced by GetAcceptLanguagesW().

◆ MulDiv()

INT WINAPI MulDiv ( INT  a,
INT  b,
INT  c 
)

Definition at line 61 of file main.c.

62{
64
65 if (!c) return -1;
66
67 /* We want to deal with a positive divisor to simplify the logic. */
68 if (c < 0)
69 {
70 a = -a;
71 c = -c;
72 }
73
74 /* If the result is positive, we "add" to round. else, we subtract to round. */
75 if ((a < 0 && b < 0) || (a >= 0 && b >= 0))
76 ret = (((LONGLONG)a * b) + (c / 2)) / c;
77 else
78 ret = (((LONGLONG)a * b) - (c / 2)) / c;
79
80 if (ret > 2147483647 || ret < -2147483647) return -1;
81 return ret;
82}
return ret
Definition: mutex.c:146
const GLubyte * c
Definition: glext.h:8905
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define a
Definition: ke_i.h:78
#define c
Definition: ke_i.h:80
int64_t LONGLONG
Definition: typedefs.h:68

◆ perf_provider_from_handle()

static struct perf_provider * perf_provider_from_handle ( HANDLE  prov)
static

Definition at line 173 of file main.c.

174{
175 return (struct perf_provider *)prov;
176}

Referenced by PerfCreateInstance(), PerfDeleteInstance(), PerfSetCounterRefValue(), PerfSetCounterSetInfo(), and PerfStopProvider().

◆ PerfCreateInstance()

PERF_COUNTERSET_INSTANCE WINAPI * PerfCreateInstance ( HANDLE  handle,
const GUID guid,
const WCHAR name,
ULONG  id 
)

Definition at line 185 of file main.c.

188{
190 struct counterset_template *template;
191 struct counterset_instance *inst;
192 unsigned int i;
193 ULONG size;
194
195 FIXME( "handle %p, guid %s, name %s, id %lu semi-stub.\n", handle, debugstr_guid(guid), debugstr_w(name), id );
196
197 if (!prov || !guid || !name)
198 {
200 return NULL;
201 }
202
203 for (i = 0; i < prov->counterset_count; ++i)
204 if (IsEqualGUID(guid, &prov->countersets[i]->counterset.CounterSetGuid)) break;
205
206 if (i == prov->counterset_count)
207 {
209 return NULL;
210 }
211
212 template = prov->countersets[i];
213
215 {
216 if (inst->template == template && inst->instance.InstanceId == id)
217 {
219 return NULL;
220 }
221 }
222
223 size = (sizeof(PERF_COUNTERSET_INSTANCE) + template->counterset.NumCounters * sizeof(UINT64)
224 + (lstrlenW( name ) + 1) * sizeof(WCHAR) + 7) & ~7;
225 inst = heap_alloc_zero( offsetof(struct counterset_instance, instance) + size );
226 if (!inst)
227 {
229 return NULL;
230 }
231
232 inst->template = template;
234 inst->instance.dwSize = size;
235 inst->instance.InstanceId = id;
237 + template->counterset.NumCounters * sizeof(UINT64);
238 inst->instance.InstanceNameSize = (lstrlenW( name ) + 1) * sizeof(WCHAR);
240 list_add_tail( &prov->instance_list, &inst->entry );
241
242 return &inst->instance;
243}
unsigned long long UINT64
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
static HINSTANCE instance
Definition: main.c:40
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
static struct perf_provider * perf_provider_from_handle(HANDLE prov)
Definition: main.c:173
GUID guid
Definition: version.c:147
const UINT template
Definition: action.c:7511
GLsizeiptr size
Definition: glext.h:5919
GLuint id
Definition: glext.h:5910
uint32_t entry
Definition: isohybrid.c:63
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_w
Definition: kernel32.h:32
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
struct _PERF_COUNTERSET_INSTANCE PERF_COUNTERSET_INSTANCE
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define offsetof(TYPE, MEMBER)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
PERF_COUNTERSET_INSTANCE instance
Definition: main.c:160
struct counterset_template * template
Definition: main.c:159
struct list entry
Definition: main.c:158
Definition: name.c:39
struct counterset_template ** countersets
Definition: main.c:167
unsigned int counterset_count
Definition: main.c:168
struct list instance_list
Definition: main.c:170
uint32_t ULONG
Definition: typedefs.h:59
#define ERROR_NOT_FOUND
Definition: winerror.h:1014
unsigned char BYTE
Definition: xxhash.c:193

◆ PerfDeleteInstance()

ULONG WINAPI PerfDeleteInstance ( HANDLE  provider,
PERF_COUNTERSET_INSTANCE block 
)

Definition at line 248 of file main.c.

249{
250 struct perf_provider *prov = perf_provider_from_handle( provider );
251 struct counterset_instance *inst;
252
253 TRACE( "provider %p, block %p.\n", provider, block );
254
255 if (!prov || !block) return ERROR_INVALID_PARAMETER;
256
258 list_remove( &inst->entry );
259 heap_free( inst );
260
261 return ERROR_SUCCESS;
262}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
static unsigned int block
Definition: xmlmemory.c:101

◆ PerfSetCounterRefValue()

ULONG WINAPI PerfSetCounterRefValue ( HANDLE  provider,
PERF_COUNTERSET_INSTANCE instance,
ULONG  counterid,
void address 
)

Definition at line 312 of file main.c.

314{
315 struct perf_provider *prov = perf_provider_from_handle( provider );
316 struct counterset_template *template;
317 struct counterset_instance *inst;
318 unsigned int i;
319
320 FIXME( "provider %p, instance %p, counterid %lu, address %p semi-stub.\n",
321 provider, instance, counterid, address );
322
323 if (!prov || !instance || !address) return ERROR_INVALID_PARAMETER;
324
326 template = inst->template;
327
328 for (i = 0; i < template->counterset.NumCounters; ++i)
329 if (template->counter[i].CounterId == counterid) break;
330
331 if (i == template->counterset.NumCounters) return ERROR_NOT_FOUND;
332 *(void **)((BYTE *)&inst->instance + sizeof(PERF_COUNTERSET_INSTANCE) + template->counter[i].Offset) = address;
333
334 return STATUS_SUCCESS;
335}
GLuint address
Definition: glext.h:9393
#define STATUS_SUCCESS
Definition: shellext.h:65

◆ PerfSetCounterSetInfo()

ULONG WINAPI PerfSetCounterSetInfo ( HANDLE  handle,
PERF_COUNTERSET_INFO template,
ULONG  size 
)

Definition at line 267 of file main.c.

268{
270 struct counterset_template **new_array;
271 struct counterset_template *new;
272 unsigned int i;
273
274 FIXME( "handle %p, template %p, size %lu semi-stub.\n", handle, template, size );
275
276 if (!prov || !template) return ERROR_INVALID_PARAMETER;
277 if (!template->NumCounters) return ERROR_INVALID_PARAMETER;
278 if (size < sizeof(*template) || (size - (sizeof(*template))) / sizeof(PERF_COUNTER_INFO) < template->NumCounters)
280
281 for (i = 0; i < prov->counterset_count; ++i)
282 {
283 if (IsEqualGUID( &template->CounterSetGuid, &prov->countersets[i]->counterset.CounterSetGuid ))
285 }
286
287 size = offsetof( struct counterset_template, counter[template->NumCounters] );
288 if (!(new = heap_alloc( size ))) return ERROR_OUTOFMEMORY;
289
290 if (prov->counterset_count)
291 new_array = heap_realloc( prov->countersets, sizeof(*prov->countersets) * (prov->counterset_count + 1) );
292 else
293 new_array = heap_alloc( sizeof(*prov->countersets) );
294
295 if (!new_array)
296 {
297 heap_free( new );
298 return ERROR_OUTOFMEMORY;
299 }
300 memcpy( new, template, size );
301 for (i = 0; i < template->NumCounters; ++i)
302 new->counter[i].Offset = i * sizeof(UINT64);
303 new_array[prov->counterset_count++] = new;
304 prov->countersets = new_array;
305
306 return STATUS_SUCCESS;
307}
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:71
#define new(TYPE, numElems)
Definition: treelist.c:54

◆ PerfStartProvider()

ULONG WINAPI PerfStartProvider ( GUID guid,
PERFLIBREQUEST  callback,
HANDLE provider 
)

Definition at line 340 of file main.c.

341{
343
344 FIXME( "guid %s, callback %p, provider %p semi-stub.\n", debugstr_guid(guid), callback, provider );
345
346 memset( &ctx, 0, sizeof(ctx) );
347 ctx.ContextSize = sizeof(ctx);
348 ctx.ControlCallback = callback;
349
350 return PerfStartProviderEx( guid, &ctx, provider );
351}
ULONG WINAPI PerfStartProviderEx(GUID *guid, PERF_PROVIDER_CONTEXT *context, HANDLE *provider)
Definition: main.c:356
static IPrintDialogCallback callback
Definition: printdlg.c:326
#define memset(x, y, z)
Definition: compat.h:39

◆ PerfStartProviderEx()

ULONG WINAPI PerfStartProviderEx ( GUID guid,
PERF_PROVIDER_CONTEXT context,
HANDLE provider 
)

Definition at line 356 of file main.c.

357{
358 struct perf_provider *prov;
359
360 FIXME( "guid %s, context %p, provider %p semi-stub.\n", debugstr_guid(guid), context, provider );
361
362 if (!guid || !context || !provider) return ERROR_INVALID_PARAMETER;
363 if (context->ContextSize < sizeof(*context)) return ERROR_INVALID_PARAMETER;
364
365 if (context->MemAllocRoutine || context->MemFreeRoutine)
366 FIXME("Memory allocation routine is not supported.\n");
367
368 if (!(prov = heap_alloc_zero( sizeof(*prov) ))) return ERROR_OUTOFMEMORY;
369 list_init( &prov->instance_list );
370 memcpy( &prov->guid, guid, sizeof(prov->guid) );
371 prov->callback = context->ControlCallback;
372 *provider = prov;
373
374 return STATUS_SUCCESS;
375}
static void list_init(struct list_entry *head)
Definition: list.h:51
Definition: http.c:7252
PERFLIBREQUEST callback
Definition: main.c:166
GUID guid
Definition: main.c:165

Referenced by PerfStartProvider().

◆ PerfStopProvider()

ULONG WINAPI PerfStopProvider ( HANDLE  handle)

Definition at line 380 of file main.c.

381{
383 struct counterset_instance *inst, *next;
384 unsigned int i;
385
386 TRACE( "handle %p.\n", handle );
387
388 if (!list_empty( &prov->instance_list ))
389 WARN( "Stopping provider with active counter instances.\n" );
390
392 {
393 list_remove( &inst->entry );
394 heap_free( inst );
395 }
396
397 for (i = 0; i < prov->counterset_count; ++i)
398 heap_free( prov->countersets[i] );
399 heap_free( prov->countersets );
400 heap_free( prov );
401 return STATUS_SUCCESS;
402}
static int list_empty(struct list_entry *head)
Definition: list.h:58
#define WARN(fmt,...)
Definition: precomp.h:61
static unsigned __int64 next
Definition: rand_nt.c:6
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204

◆ QISearch()

HRESULT WINAPI QISearch ( void base,
const QITAB table,
REFIID  riid,
void **  obj 
)

Definition at line 426 of file main.c.

427{
428 const QITAB *ptr;
429 IUnknown *unk;
430
431 TRACE("%p, %p, %s, %p\n", base, table, debugstr_guid(riid), obj);
432
433 if (!obj)
434 return E_POINTER;
435
436 for (ptr = table; ptr->piid; ++ptr)
437 {
438 TRACE("trying (offset %ld) %s\n", ptr->dwOffset, debugstr_guid(ptr->piid));
439 if (IsEqualIID(riid, ptr->piid))
440 {
441 unk = (IUnknown *)((BYTE *)base + ptr->dwOffset);
442 TRACE("matched, returning (%p)\n", unk);
443 *obj = unk;
444 IUnknown_AddRef(unk);
445 return S_OK;
446 }
447 }
448
450 {
451 unk = (IUnknown *)((BYTE *)base + table->dwOffset);
452 TRACE("returning first for IUnknown (%p)\n", unk);
453 *obj = unk;
454 IUnknown_AddRef(unk);
455 return S_OK;
456 }
457
458 WARN("Not found %s.\n", debugstr_guid(riid));
459 *obj = NULL;
460 return E_NOINTERFACE;
461}
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
static PVOID ptr
Definition: dispmode.c:27
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
Definition: shlwapi.h:139
#define E_NOINTERFACE
Definition: winerror.h:3479
#define E_POINTER
Definition: winerror.h:3480

Referenced by ExplorerInstance::QueryInterface(), and CUnknownBase< Interface >::QueryInterface().

◆ QuirkIsEnabled()

BOOL WINAPI QuirkIsEnabled ( void arg)

Definition at line 407 of file main.c.

408{
409 FIXME("(%p): stub\n", arg);
410 return FALSE;
411}
#define FALSE
Definition: types.h:117

◆ QuirkIsEnabled3()

BOOL WINAPI QuirkIsEnabled3 ( void unk1,
void unk2 
)

Definition at line 416 of file main.c.

417{
418 static int once;
419
420 if (!once++)
421 FIXME("(%p, %p) stub!\n", unk1, unk2);
422
423 return FALSE;
424}
static DWORD unk1
Definition: cursoricon.c:1638

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( kernelbase  )

Variable Documentation

◆ is_wow64

BOOL is_wow64 = FALSE

Definition at line 38 of file main.c.

Referenced by DllMain().