ReactOS 0.4.16-dev-974-g5022a45
pdh_main.c
Go to the documentation of this file.
1/*
2 * Performance Data Helper (pdh.dll)
3 *
4 * Copyright 2007 Andrey Turkin
5 * Copyright 2007 Hans Leidekker
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21
22#include <stdarg.h>
23#include <math.h>
24
25#define NONAMELESSUNION
26
27#include "windef.h"
28#include "winbase.h"
29
30#include "pdh.h"
31#include "pdhmsg.h"
32#include "winperf.h"
33#ifdef __REACTOS__
34#include <wchar.h>
35#include <winnls.h>
36#endif
37
38#include "wine/debug.h"
39#include "wine/heap.h"
40#include "wine/list.h"
41
43
46{
47 0, 0, &pdh_handle_cs,
50 0, 0, { (DWORD_PTR)(__FILE__ ": pdh_handle_cs") }
51};
52static CRITICAL_SECTION pdh_handle_cs = { &pdh_handle_cs_debug, -1, 0, 0, 0, 0 };
53
54static inline WCHAR *pdh_strdup( const WCHAR *src )
55{
56 WCHAR *dst;
57
58 if (!src) return NULL;
59 if ((dst = heap_alloc( (lstrlenW( src ) + 1) * sizeof(WCHAR) ))) lstrcpyW( dst, src );
60 return dst;
61}
62
63static inline WCHAR *pdh_strdup_aw( const char *src )
64{
65 int len;
66 WCHAR *dst;
67
68 if (!src) return NULL;
69 len = MultiByteToWideChar( CP_ACP, 0, src, -1, NULL, 0 );
70 if ((dst = heap_alloc( len * sizeof(WCHAR) ))) MultiByteToWideChar( CP_ACP, 0, src, -1, dst, len );
71 return dst;
72}
73
75{
76 TRACE("(0x%p, %d, %p)\n",hinstDLL,fdwReason,lpvReserved);
77 switch (fdwReason)
78 {
79#ifndef __REACTOS__
80 case DLL_WINE_PREATTACH:
81 return FALSE; /* prefer native version */
82#endif
85 break;
87 if (lpvReserved) break;
89 break;
90 }
91
92 return TRUE;
93}
94
95union value
96{
100};
101
103{
104 DWORD magic; /* signature */
105 struct list entry; /* list entry */
106 WCHAR *path; /* identifier */
107 DWORD type; /* counter type */
108 DWORD status; /* update status */
109 LONG scale; /* scale factor */
110 LONG defaultscale; /* default scale factor */
111 DWORD_PTR user; /* user data */
112 DWORD_PTR queryuser; /* query user data */
113 LONGLONG base; /* samples per second */
114 FILETIME stamp; /* time stamp */
115 void (CALLBACK *collect)( struct counter * ); /* collect callback */
116 union value one; /* first value */
117 union value two; /* second value */
118};
119
120#define PDH_MAGIC_COUNTER 0x50444831 /* 'PDH1' */
121
122static struct counter *create_counter( void )
123{
124 struct counter *counter;
125
126 if ((counter = heap_alloc_zero( sizeof(struct counter) )))
127 {
129 return counter;
130 }
131 return NULL;
132}
133
134static void destroy_counter( struct counter *counter )
135{
136 counter->magic = 0;
139}
140
141#define PDH_MAGIC_QUERY 0x50444830 /* 'PDH0' */
142
143struct query
144{
145 DWORD magic; /* signature */
146 DWORD_PTR user; /* user data */
147 HANDLE thread; /* collect thread */
148 DWORD interval; /* collect interval */
149 HANDLE wait; /* wait event */
150 HANDLE stop; /* stop event */
151 struct list counters; /* counter list */
152};
153
154static struct query *create_query( void )
155{
156 struct query *query;
157
158 if ((query = heap_alloc_zero( sizeof(struct query) )))
159 {
162 return query;
163 }
164 return NULL;
165}
166
167static void destroy_query( struct query *query )
168{
169 query->magic = 0;
170 heap_free( query );
171}
172
173struct source
174{
175 DWORD index; /* name index */
176 const WCHAR *path; /* identifier */
177 void (CALLBACK *collect)( struct counter * ); /* collect callback */
178 DWORD type; /* counter type */
179 LONG scale; /* default scale factor */
180 LONGLONG base; /* samples per second */
181};
182
184 {'\\','P','r','o','c','e','s','s','o','r','(','_','T','o','t','a','l',')',
185 '\\','%',' ','P','r','o','c','e','s','s','o','r',' ','T','i','m','e',0};
186static const WCHAR path_processor[] =
187 {'\\','P','r','o','c','e','s','s','o','r',0};
188static const WCHAR path_uptime[] =
189 {'\\','S','y','s','t','e','m', '\\', 'S','y','s','t','e','m',' ','U','p',' ','T','i','m','e',0};
190
192{
193 counter->two.largevalue = 500000; /* FIXME */
195}
196
198{
201}
202
203#define TYPE_PROCESSOR_TIME \
204 (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_RATE | PERF_TIMER_100NS | PERF_DELTA_COUNTER | \
205 PERF_INVERSE_COUNTER | PERF_DISPLAY_PERCENT)
206
207#define TYPE_UPTIME \
208 (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_ELAPSED | PERF_OBJECT_TIMER | PERF_DISPLAY_SECONDS)
209
210/* counter source registry */
211static const struct source counter_sources[] =
212{
214 { 238, path_processor, NULL, 0, 0, 0 },
215 { 674, path_uptime, collect_uptime, TYPE_UPTIME, -3, 1000 }
216};
217
219{
221 DWORD buflen = ARRAY_SIZE(buf);
222
223 if (!GetComputerNameW( buf, &buflen )) return FALSE;
224 return len == buflen && !_wcsnicmp( name, buf, buflen );
225}
226
228{
229 const WCHAR *p;
230
231 if (path[0] == '\\' && path[1] == '\\' && (p = wcschr( path + 2, '\\' )) &&
232 is_local_machine( path + 2, p - path - 2 ))
233 {
234 path += p - path;
235 }
236 if (wcschr( path, '\\' )) p = fullpath;
237 else p = wcsrchr( fullpath, '\\' ) + 1;
238 return !wcscmp( p, path );
239}
240
241/***********************************************************************
242 * PdhAddCounterA (PDH.@)
243 */
245 DWORD_PTR userdata, PDH_HCOUNTER *counter )
246{
248 WCHAR *pathW;
249
250 TRACE("%p %s %lx %p\n", query, debugstr_a(path), userdata, counter);
251
252 if (!path) return PDH_INVALID_ARGUMENT;
253
254 if (!(pathW = pdh_strdup_aw( path )))
256
257 ret = PdhAddCounterW( query, pathW, userdata, counter );
258
259 heap_free( pathW );
260 return ret;
261}
262
263/***********************************************************************
264 * PdhAddCounterW (PDH.@)
265 */
267 DWORD_PTR userdata, PDH_HCOUNTER *hcounter )
268{
269 struct query *query = hquery;
270 struct counter *counter;
271 unsigned int i;
272
273 TRACE("%p %s %lx %p\n", hquery, debugstr_w(path), userdata, hcounter);
274
275 if (!path || !hcounter) return PDH_INVALID_ARGUMENT;
276
278 if (!query || query->magic != PDH_MAGIC_QUERY)
279 {
281 return PDH_INVALID_HANDLE;
282 }
283
284 *hcounter = NULL;
285 for (i = 0; i < ARRAY_SIZE(counter_sources); i++)
286 {
288 {
289 if ((counter = create_counter()))
290 {
292 counter->collect = counter_sources[i].collect;
293 counter->type = counter_sources[i].type;
295 counter->base = counter_sources[i].base;
297 counter->user = userdata;
298
300 *hcounter = counter;
301
303 return ERROR_SUCCESS;
304 }
307 }
308 }
311}
312
313/***********************************************************************
314 * PdhAddEnglishCounterA (PDH.@)
315 */
317 DWORD_PTR userdata, PDH_HCOUNTER *counter )
318{
319 TRACE("%p %s %lx %p\n", query, debugstr_a(path), userdata, counter);
320
321 if (!query) return PDH_INVALID_ARGUMENT;
322 return PdhAddCounterA( query, path, userdata, counter );
323}
324
325/***********************************************************************
326 * PdhAddEnglishCounterW (PDH.@)
327 */
329 DWORD_PTR userdata, PDH_HCOUNTER *counter )
330{
331 TRACE("%p %s %lx %p\n", query, debugstr_w(path), userdata, counter);
332
333 if (!query) return PDH_INVALID_ARGUMENT;
334 return PdhAddCounterW( query, path, userdata, counter );
335}
336
337/* caller must hold counter lock */
339 union value *raw2, PDH_FMT_COUNTERVALUE *value )
340{
341 LONG factor;
342
344 if (format & PDH_FMT_LONG)
345 {
346 if (format & PDH_FMT_1000) value->u.longValue = raw2->longvalue * 1000;
347 else value->u.longValue = raw2->longvalue * pow( 10, factor );
348 }
349 else if (format & PDH_FMT_LARGE)
350 {
351 if (format & PDH_FMT_1000) value->u.largeValue = raw2->largevalue * 1000;
352 else value->u.largeValue = raw2->largevalue * pow( 10, factor );
353 }
354 else if (format & PDH_FMT_DOUBLE)
355 {
356 if (format & PDH_FMT_1000) value->u.doubleValue = raw2->doublevalue * 1000;
357 else value->u.doubleValue = raw2->doublevalue * pow( 10, factor );
358 }
359 else
360 {
361 WARN("unknown format %x\n", format);
363 }
364 return ERROR_SUCCESS;
365}
366
367/***********************************************************************
368 * PdhCalculateCounterFromRawValue (PDH.@)
369 */
373{
375 struct counter *counter = handle;
376
377 TRACE("%p 0x%08x %p %p %p\n", handle, format, raw1, raw2, value);
378
379 if (!value) return PDH_INVALID_ARGUMENT;
380
383 {
385 return PDH_INVALID_HANDLE;
386 }
387
388 ret = format_value( counter, format, (union value *)&raw1->SecondValue,
389 (union value *)&raw2->SecondValue, value );
390
392 return ret;
393}
394
395
396/***********************************************************************
397 * PdhCloseQuery (PDH.@)
398 */
400{
401 struct query *query = handle;
402 struct list *item, *next;
403
404 TRACE("%p\n", handle);
405
407 if (!query || query->magic != PDH_MAGIC_QUERY)
408 {
410 return PDH_INVALID_HANDLE;
411 }
412
413 if (query->thread)
414 {
416 SetEvent( query->stop );
418
420
423 {
425 return ERROR_SUCCESS;
426 }
429 query->thread = NULL;
430 }
431
433 {
434 struct counter *counter = LIST_ENTRY( item, struct counter, entry );
435
438 }
439
441
443 return ERROR_SUCCESS;
444}
445
446/* caller must hold query lock */
447static void collect_query_data( struct query *query )
448{
449 struct list *item;
450
452 {
454 struct counter *counter = LIST_ENTRY( item, struct counter, entry );
455
456 counter->collect( counter );
457
458 GetLocalTime( &time );
460 }
461}
462
463/***********************************************************************
464 * PdhCollectQueryData (PDH.@)
465 */
467{
468 struct query *query = handle;
469
470 TRACE("%p\n", handle);
471
473 if (!query || query->magic != PDH_MAGIC_QUERY)
474 {
476 return PDH_INVALID_HANDLE;
477 }
478
479 if (list_empty( &query->counters ))
480 {
482 return PDH_NO_DATA;
483 }
484
486
488 return ERROR_SUCCESS;
489}
490
492{
493 struct query *query = arg;
496
497 for (;;)
498 {
500
503 {
506 }
507
509
510 if (!SetEvent( query->wait ))
511 {
513 ExitThread( 0 );
514 }
516 }
517}
518
519/***********************************************************************
520 * PdhCollectQueryDataEx (PDH.@)
521 */
523{
525 struct query *query = handle;
526
527 TRACE("%p %d %p\n", handle, interval, event);
528
530 if (!query || query->magic != PDH_MAGIC_QUERY)
531 {
533 return PDH_INVALID_HANDLE;
534 }
535 if (list_empty( &query->counters ))
536 {
538 return PDH_NO_DATA;
539 }
540 if (query->thread)
541 {
543 SetEvent( query->stop );
545
547
550 {
552 return PDH_INVALID_HANDLE;
553 }
555 query->thread = NULL;
556 }
557 else if (!(query->stop = CreateEventW( NULL, FALSE, FALSE, NULL )))
558 {
559 ret = GetLastError();
561 return ret;
562 }
563 query->wait = event;
564 query->interval = interval * 1000;
566 {
567 ret = GetLastError();
569
571 return ret;
572 }
573
575 return ERROR_SUCCESS;
576}
577
578/***********************************************************************
579 * PdhCollectQueryDataWithTime (PDH.@)
580 */
582{
583 struct query *query = handle;
584 struct counter *counter;
585 struct list *item;
586
587 TRACE("%p %p\n", handle, timestamp);
588
589 if (!timestamp) return PDH_INVALID_ARGUMENT;
590
592 if (!query || query->magic != PDH_MAGIC_QUERY)
593 {
595 return PDH_INVALID_HANDLE;
596 }
597 if (list_empty( &query->counters ))
598 {
600 return PDH_NO_DATA;
601 }
602
604
606 counter = LIST_ENTRY( item, struct counter, entry );
607
609
611 return ERROR_SUCCESS;
612}
613
614/***********************************************************************
615 * PdhExpandWildCardPathA (PDH.@)
616 */
617PDH_STATUS WINAPI PdhExpandWildCardPathA( LPCSTR szDataSource, LPCSTR szWildCardPath, LPSTR mszExpandedPathList, LPDWORD pcchPathListLength, DWORD dwFlags )
618{
619 FIXME("%s, %s, %p, %p, 0x%x: stub\n", debugstr_a(szDataSource), debugstr_a(szWildCardPath), mszExpandedPathList, pcchPathListLength, dwFlags);
620 return PDH_NOT_IMPLEMENTED;
621}
622
623/***********************************************************************
624 * PdhExpandWildCardPathW (PDH.@)
625 */
626PDH_STATUS WINAPI PdhExpandWildCardPathW( LPCWSTR szDataSource, LPCWSTR szWildCardPath, LPWSTR mszExpandedPathList, LPDWORD pcchPathListLength, DWORD dwFlags )
627{
628 FIXME("%s, %s, %p, %p, 0x%x: stub\n", debugstr_w(szDataSource), debugstr_w(szWildCardPath), mszExpandedPathList, pcchPathListLength, dwFlags);
629 return PDH_NOT_IMPLEMENTED;
630}
631
632/***********************************************************************
633 * PdhExpandCounterPathA (PDH.@)
634 */
635PDH_STATUS WINAPI PdhExpandCounterPathA( LPCSTR szWildCardPath, LPSTR mszExpandedPathList, LPDWORD pcchPathListLength )
636{
637 FIXME("%s, %p, %p: stub\n", debugstr_a(szWildCardPath), mszExpandedPathList, pcchPathListLength);
638 return PdhExpandWildCardPathA(NULL, szWildCardPath, mszExpandedPathList, pcchPathListLength, 0);
639}
640
641/***********************************************************************
642 * PdhExpandCounterPathW (PDH.@)
643 */
644PDH_STATUS WINAPI PdhExpandCounterPathW( LPCWSTR szWildCardPath, LPWSTR mszExpandedPathList, LPDWORD pcchPathListLength )
645{
646 FIXME("%s, %p, %p: stub\n", debugstr_w(szWildCardPath), mszExpandedPathList, pcchPathListLength);
647 return PdhExpandWildCardPathW(NULL, szWildCardPath, mszExpandedPathList, pcchPathListLength, 0);
648}
649
650/***********************************************************************
651 * PdhGetCounterInfoA (PDH.@)
652 */
654{
655 struct counter *counter = handle;
656
657 TRACE("%p %d %p %p\n", handle, text, size, info);
658
661 {
663 return PDH_INVALID_HANDLE;
664 }
665 if (!size)
666 {
669 }
670 if (*size < sizeof(PDH_COUNTER_INFO_A))
671 {
672 *size = sizeof(PDH_COUNTER_INFO_A);
674 return PDH_MORE_DATA;
675 }
676
677 memset( info, 0, sizeof(PDH_COUNTER_INFO_A) );
678
679 info->dwType = counter->type;
680 info->CStatus = counter->status;
681 info->lScale = counter->scale;
682 info->lDefaultScale = counter->defaultscale;
683 info->dwUserData = counter->user;
684 info->dwQueryUserData = counter->queryuser;
685
686 *size = sizeof(PDH_COUNTER_INFO_A);
687
689 return ERROR_SUCCESS;
690}
691
692/***********************************************************************
693 * PdhGetCounterInfoW (PDH.@)
694 */
696{
697 struct counter *counter = handle;
698
699 TRACE("%p %d %p %p\n", handle, text, size, info);
700
703 {
705 return PDH_INVALID_HANDLE;
706 }
707 if (!size)
708 {
711 }
712 if (*size < sizeof(PDH_COUNTER_INFO_W))
713 {
714 *size = sizeof(PDH_COUNTER_INFO_W);
716 return PDH_MORE_DATA;
717 }
718
719 memset( info, 0, sizeof(PDH_COUNTER_INFO_W) );
720
721 info->dwType = counter->type;
722 info->CStatus = counter->status;
723 info->lScale = counter->scale;
724 info->lDefaultScale = counter->defaultscale;
725 info->dwUserData = counter->user;
726 info->dwQueryUserData = counter->queryuser;
727
728 *size = sizeof(PDH_COUNTER_INFO_W);
729
731 return ERROR_SUCCESS;
732}
733
734/***********************************************************************
735 * PdhGetCounterTimeBase (PDH.@)
736 */
738{
739 struct counter *counter = handle;
740
741 TRACE("%p %p\n", handle, base);
742
743 if (!base) return PDH_INVALID_ARGUMENT;
744
747 {
749 return PDH_INVALID_HANDLE;
750 }
751
752 *base = counter->base;
753
755 return ERROR_SUCCESS;
756}
757
758/***********************************************************************
759 * PdhGetDllVersion (PDH.@)
760 */
762{
763 if (!version)
765
767
768 return ERROR_SUCCESS;
769}
770
771/***********************************************************************
772 * PdhGetFormattedCounterValue (PDH.@)
773 */
776{
778 struct counter *counter = handle;
779
780 TRACE("%p %x %p %p\n", handle, format, type, value);
781
782 if (!value) return PDH_INVALID_ARGUMENT;
783
786 {
788 return PDH_INVALID_HANDLE;
789 }
790 if (counter->status)
791 {
793 return PDH_INVALID_DATA;
794 }
796 {
797 value->CStatus = ERROR_SUCCESS;
798 if (type) *type = counter->type;
799 }
800
802 return ret;
803}
804
805/***********************************************************************
806 * PdhGetRawCounterValue (PDH.@)
807 */
810{
811 struct counter *counter = handle;
812
813 TRACE("%p %p %p\n", handle, type, value);
814
815 if (!value) return PDH_INVALID_ARGUMENT;
816
819 {
821 return PDH_INVALID_HANDLE;
822 }
823
824 value->CStatus = counter->status;
825 value->TimeStamp.dwLowDateTime = counter->stamp.dwLowDateTime;
826 value->TimeStamp.dwHighDateTime = counter->stamp.dwHighDateTime;
827 value->FirstValue = counter->one.largevalue;
828 value->SecondValue = counter->two.largevalue;
829 value->MultiCount = 1; /* FIXME */
830
831 if (type) *type = counter->type;
832
834 return ERROR_SUCCESS;
835}
836
837/***********************************************************************
838 * PdhLookupPerfIndexByNameA (PDH.@)
839 */
841{
844 WCHAR *nameW;
845
846 TRACE("%s %s %p\n", debugstr_a(machine), debugstr_a(name), index);
847
848 if (!name) return PDH_INVALID_ARGUMENT;
849
851
852 if (!(nameW = pdh_strdup_aw( name )))
854
856
857 heap_free( nameW );
859 return ret;
860}
861
862/***********************************************************************
863 * PdhLookupPerfIndexByNameW (PDH.@)
864 */
866{
867 unsigned int i;
868
869 TRACE("%s %s %p\n", debugstr_w(machine), debugstr_w(name), index);
870
871 if (!name || !index) return PDH_INVALID_ARGUMENT;
872
873 if (machine)
874 {
875 FIXME("remote machine not supported\n");
877 }
878 for (i = 0; i < ARRAY_SIZE(counter_sources); i++)
879 {
881 {
882 *index = counter_sources[i].index;
883 return ERROR_SUCCESS;
884 }
885 }
887}
888
889/***********************************************************************
890 * PdhLookupPerfNameByIndexA (PDH.@)
891 */
893{
897 DWORD sizeW = ARRAY_SIZE(bufferW);
898
899 TRACE("%s %d %p %p\n", debugstr_a(machine), index, buffer, size);
900
901 if (!buffer || !size) return PDH_INVALID_ARGUMENT;
902
904
905 if (!(ret = PdhLookupPerfNameByIndexW( machineW, index, bufferW, &sizeW )))
906 {
907 int required = WideCharToMultiByte( CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL );
908
909 if (*size < required) ret = PDH_MORE_DATA;
910 else WideCharToMultiByte( CP_ACP, 0, bufferW, -1, buffer, required, NULL, NULL );
911 *size = required;
912 }
914 return ret;
915}
916
917/***********************************************************************
918 * PdhLookupPerfNameByIndexW (PDH.@)
919 */
921{
923 unsigned int i;
924
925 TRACE("%s %d %p %p\n", debugstr_w(machine), index, buffer, size);
926
927 if (machine)
928 {
929 FIXME("remote machine not supported\n");
931 }
932
933 if (!buffer || !size) return PDH_INVALID_ARGUMENT;
934 if (!index) return ERROR_SUCCESS;
935
936 for (i = 0; i < ARRAY_SIZE(counter_sources); i++)
937 {
939 {
940 WCHAR *p = wcsrchr( counter_sources[i].path, '\\' ) + 1;
941 unsigned int required = lstrlenW( p ) + 1;
942
943 if (*size < required) ret = PDH_MORE_DATA;
944 else
945 {
946 lstrcpyW( buffer, p );
948 }
949 *size = required;
950 return ret;
951 }
952 }
954}
955
956/***********************************************************************
957 * PdhOpenQueryA (PDH.@)
958 */
960{
962 WCHAR *sourceW = NULL;
963
964 TRACE("%s %lx %p\n", debugstr_a(source), userdata, query);
965
967
968 ret = PdhOpenQueryW( sourceW, userdata, query );
970
971 return ret;
972}
973
974/***********************************************************************
975 * PdhOpenQueryW (PDH.@)
976 */
978{
979 struct query *query;
980
981 TRACE("%s %lx %p\n", debugstr_w(source), userdata, handle);
982
983 if (!handle) return PDH_INVALID_ARGUMENT;
984
985 if (source)
986 {
987 FIXME("log file data source not supported\n");
989 }
990 if ((query = create_query()))
991 {
992 query->user = userdata;
993 *handle = query;
994
995 return ERROR_SUCCESS;
996 }
998}
999
1000/***********************************************************************
1001 * PdhRemoveCounter (PDH.@)
1002 */
1004{
1005 struct counter *counter = handle;
1006
1007 TRACE("%p\n", handle);
1008
1011 {
1013 return PDH_INVALID_HANDLE;
1014 }
1015
1018
1020 return ERROR_SUCCESS;
1021}
1022
1023/***********************************************************************
1024 * PdhSetCounterScaleFactor (PDH.@)
1025 */
1027{
1028 struct counter *counter = handle;
1029
1030 TRACE("%p\n", handle);
1031
1034 {
1036 return PDH_INVALID_HANDLE;
1037 }
1038 if (factor < PDH_MIN_SCALE || factor > PDH_MAX_SCALE)
1039 {
1041 return PDH_INVALID_ARGUMENT;
1042 }
1043
1044 counter->scale = factor;
1045
1047 return ERROR_SUCCESS;
1048}
1049
1050/***********************************************************************
1051 * PdhValidatePathA (PDH.@)
1052 */
1054{
1056 WCHAR *pathW;
1057
1058 TRACE("%s\n", debugstr_a(path));
1059
1060 if (!path) return PDH_INVALID_ARGUMENT;
1061 if (!(pathW = pdh_strdup_aw( path ))) return PDH_MEMORY_ALLOCATION_FAILURE;
1062
1063 ret = PdhValidatePathW( pathW );
1064
1065 heap_free( pathW );
1066 return ret;
1067}
1068
1070{
1071 if (!path || !*path) return PDH_INVALID_ARGUMENT;
1072 if (*path++ != '\\' || !wcschr( path, '\\' )) return PDH_CSTATUS_BAD_COUNTERNAME;
1073 return ERROR_SUCCESS;
1074 }
1075
1076/***********************************************************************
1077 * PdhValidatePathW (PDH.@)
1078 */
1080{
1082 unsigned int i;
1083
1084 TRACE("%s\n", debugstr_w(path));
1085
1086 if ((ret = validate_path( path ))) return ret;
1087
1088 for (i = 0; i < ARRAY_SIZE(counter_sources); i++)
1090
1092}
1093
1094/***********************************************************************
1095 * PdhVbAddCounter (PDH.@)
1096 */
1098{
1099 FIXME("%p, %s, %p: stub!\n", query, debugstr_a(path), counter);
1100
1101 if (!path) return PDH_INVALID_ARGUMENT;
1102
1103 return PDH_NOT_IMPLEMENTED;
1104}
1105
1106/***********************************************************************
1107 * PdhValidatePathExA (PDH.@)
1108 */
1110{
1111 TRACE("%p %s\n", source, debugstr_a(path));
1112
1113 if (source)
1114 {
1115 FIXME("log file data source not supported\n");
1116 return ERROR_SUCCESS;
1117 }
1118 return PdhValidatePathA( path );
1119}
1120
1121/***********************************************************************
1122 * PdhValidatePathExW (PDH.@)
1123 */
1125{
1126 TRACE("%p %s\n", source, debugstr_w(path));
1127
1128 if (source)
1129 {
1130 FIXME("log file data source not supported\n");
1131 return ERROR_SUCCESS;
1132 }
1133 return PdhValidatePathW( path );
1134}
1135
1136/***********************************************************************
1137 * PdhMakeCounterPathA (PDH.@)
1138 */
1140 LPDWORD buflen, DWORD flags )
1141{
1144 WCHAR *bufferW;
1145 DWORD buflenW;
1146
1147 TRACE("%p %p %p 0x%08x\n", e, buffer, buflen, flags);
1148
1149 if (!e || !buflen) return PDH_INVALID_ARGUMENT;
1150
1151 memset( &eW, 0, sizeof(eW) );
1152 if (e->szMachineName && !(eW.szMachineName = pdh_strdup_aw( e->szMachineName ))) goto done;
1153 if (e->szObjectName && !(eW.szObjectName = pdh_strdup_aw( e->szObjectName ))) goto done;
1154 if (e->szInstanceName && !(eW.szInstanceName = pdh_strdup_aw( e->szInstanceName ))) goto done;
1155 if (e->szParentInstance && !(eW.szParentInstance = pdh_strdup_aw( e->szParentInstance ))) goto done;
1156 if (e->szCounterName && !(eW.szCounterName = pdh_strdup_aw( e->szCounterName ))) goto done;
1157 eW.dwInstanceIndex = e->dwInstanceIndex;
1158
1159 buflenW = 0;
1160 ret = PdhMakeCounterPathW( &eW, NULL, &buflenW, flags );
1161 if (ret == PDH_MORE_DATA)
1162 {
1163 if ((bufferW = heap_alloc( buflenW * sizeof(WCHAR) )))
1164 {
1165 if (!(ret = PdhMakeCounterPathW( &eW, bufferW, &buflenW, flags )))
1166 {
1167 int len = WideCharToMultiByte(CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL);
1168 if (*buflen >= len) WideCharToMultiByte(CP_ACP, 0, bufferW, -1, buffer, *buflen, NULL, NULL);
1169 else ret = PDH_MORE_DATA;
1170 *buflen = len;
1171 }
1172 heap_free( bufferW );
1173 }
1174 else
1176 }
1177
1178done:
1180 heap_free( eW.szObjectName );
1184 return ret;
1185}
1186
1187/***********************************************************************
1188 * PdhMakeCounterPathW (PDH.@)
1189 */
1191 LPDWORD buflen, DWORD flags )
1192{
1193 static const WCHAR bslash[] = {'\\',0};
1194 static const WCHAR fslash[] = {'/',0};
1195 static const WCHAR lparen[] = {'(',0};
1196 static const WCHAR rparen[] = {')',0};
1197 static const WCHAR fmt[] = {'#','%','u',0};
1198
1201 DWORD len;
1202
1203 TRACE("%p %p %p 0x%08x\n", e, buffer, buflen, flags);
1204
1205 if (flags) FIXME("unimplemented flags 0x%08x\n", flags);
1206
1207 if (!e || !e->szCounterName || !e->szObjectName || !buflen)
1208 return PDH_INVALID_ARGUMENT;
1209
1210 path[0] = 0;
1211 if (e->szMachineName)
1212 {
1213 lstrcatW(path, bslash);
1214 lstrcatW(path, bslash);
1215 lstrcatW(path, e->szMachineName);
1216 }
1217 lstrcatW(path, bslash);
1218 lstrcatW(path, e->szObjectName);
1219 if (e->szInstanceName)
1220 {
1221 lstrcatW(path, lparen);
1222 if (e->szParentInstance)
1223 {
1224 lstrcatW(path, e->szParentInstance);
1225 lstrcatW(path, fslash);
1226 }
1227 lstrcatW(path, e->szInstanceName);
1228 swprintf(instance, fmt, e->dwInstanceIndex);
1230 lstrcatW(path, rparen);
1231 }
1232 lstrcatW(path, bslash);
1233 lstrcatW(path, e->szCounterName);
1234
1235 len = lstrlenW(path) + 1;
1236 if (*buflen >= len) lstrcpyW(buffer, path);
1237 else ret = PDH_MORE_DATA;
1238 *buflen = len;
1239 return ret;
1240}
1241
1242/***********************************************************************
1243 * PdhEnumObjectItemsA (PDH.@)
1244 */
1245PDH_STATUS WINAPI PdhEnumObjectItemsA(LPCSTR szDataSource, LPCSTR szMachineName, LPCSTR szObjectName,
1246 LPSTR mszCounterList, LPDWORD pcchCounterListLength, LPSTR mszInstanceList,
1247 LPDWORD pcchInstanceListLength, DWORD dwDetailLevel, DWORD dwFlags)
1248{
1249 FIXME("%s, %s, %s, %p, %p, %p, %p, %d, 0x%x: stub\n", debugstr_a(szDataSource), debugstr_a(szMachineName),
1250 debugstr_a(szObjectName), mszCounterList, pcchCounterListLength, mszInstanceList,
1251 pcchInstanceListLength, dwDetailLevel, dwFlags);
1252
1253 return PDH_NOT_IMPLEMENTED;
1254}
1255
1256/***********************************************************************
1257 * PdhEnumObjectItemsW (PDH.@)
1258 */
1259PDH_STATUS WINAPI PdhEnumObjectItemsW(LPCWSTR szDataSource, LPCWSTR szMachineName, LPCWSTR szObjectName,
1260 LPWSTR mszCounterList, LPDWORD pcchCounterListLength, LPWSTR mszInstanceList,
1261 LPDWORD pcchInstanceListLength, DWORD dwDetailLevel, DWORD dwFlags)
1262{
1263 FIXME("%s, %s, %s, %p, %p, %p, %p, %d, 0x%x: stub\n", debugstr_w(szDataSource), debugstr_w(szMachineName),
1264 debugstr_w(szObjectName), mszCounterList, pcchCounterListLength, mszInstanceList,
1265 pcchInstanceListLength, dwDetailLevel, dwFlags);
1266
1267 return PDH_NOT_IMPLEMENTED;
1268}
1269
1270/***********************************************************************
1271 * PdhSetDefaultRealTimeDataSource (PDH.@)
1272 */
1274{
1275 FIXME("%u\n", source);
1276 return ERROR_SUCCESS;
1277}
1278
1279/***********************************************************************
1280 * PdhGetLogFileTypeA (PDH.@)
1281 */
1283{
1284 FIXME("%s, %p: stub\n", debugstr_a(log), type);
1285 return PDH_NOT_IMPLEMENTED;
1286}
1287
1288/***********************************************************************
1289 * PdhGetLogFileTypeW (PDH.@)
1290 */
1292{
1293 FIXME("%s, %p: stub\n", debugstr_w(log), type);
1294 return PDH_NOT_IMPLEMENTED;
1295}
1296
1297/***********************************************************************
1298 * PdhBindInputDataSourceA (PDH.@)
1299 */
1301{
1302 FIXME("%p %s: stub\n", source, debugstr_a(filenamelist));
1303 return PDH_NOT_IMPLEMENTED;
1304}
1305
1306/***********************************************************************
1307 * PdhBindInputDataSourceW (PDH.@)
1308 */
1310{
1311 FIXME("%p %s: stub\n", source, debugstr_w(filenamelist));
1312 return PDH_NOT_IMPLEMENTED;
1313}
ULONGLONG WINAPI GetTickCount64(VOID)
Definition: GetTickCount64.c:9
unsigned char BOOLEAN
static DWORD const fdwReason
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
static const WCHAR nameW[]
Definition: main.c:49
#define ARRAY_SIZE(A)
Definition: main.h:20
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static int list_empty(struct list_entry *head)
Definition: list.h:58
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
static void list_init(struct list_entry *head)
Definition: list.h:51
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
static HANDLE thread
Definition: service.c:33
Definition: list.h:37
BOOL WINAPI GetComputerNameW(LPWSTR lpBuffer, LPDWORD lpnSize)
Definition: compname.c:446
#define WAIT_TIMEOUT
Definition: dderror.h:14
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static HINSTANCE instance
Definition: main.c:40
#define CloseHandle
Definition: compat.h:739
#define wcschr
Definition: compat.h:17
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
#define wcsrchr
Definition: compat.h:16
#define CP_ACP
Definition: compat.h:109
#define CALLBACK
Definition: compat.h:35
#define lstrcpyW
Definition: compat.h:749
#define WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
#define lstrlenW
Definition: compat.h:750
static const WCHAR version[]
Definition: asmname.c:66
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
VOID WINAPI ExitThread(IN DWORD uExitCode)
Definition: thread.c:365
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
BOOL WINAPI SystemTimeToFileTime(IN CONST SYSTEMTIME *lpSystemTime, OUT LPFILETIME lpFileTime)
Definition: time.c:158
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:286
static const WCHAR sizeW[]
Definition: editor.c:79
const WCHAR * text
Definition: package.c:1794
#define swprintf
Definition: precomp.h:40
#define INFINITE
Definition: serial.h:102
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
double pow(double x, double y)
Definition: freeldr.c:178
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
struct _cl_event * event
Definition: glext.h:7739
GLenum src
Definition: glext.h:6340
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLuint index
Definition: glext.h:6031
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLenum dst
Definition: glext.h:6340
GLbitfield flags
Definition: glext.h:7161
GLint GLint GLsizei GLuint * counters
Definition: glext.h:11114
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
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 factor
Definition: glfuncs.h:178
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
uint32_t entry
Definition: isohybrid.c:63
static const WCHAR sourceW[]
Definition: jsregexp.c:37
#define e
Definition: ke_i.h:82
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_w
Definition: kernel32.h:32
static IN DWORD IN LPVOID lpvReserved
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
__u16 time
Definition: mkdosfs.c:8
static const WCHAR machineW[]
Definition: profile.c:105
static const char machine[]
Definition: profile.c:104
static ATOM item
Definition: dde.c:856
static HMODULE pdh
Definition: pdh.c:30
#define PDH_MAX_COUNTER_NAME
Definition: pdh.h:47
#define PDH_FMT_LONG
Definition: pdh.h:49
#define PDH_FMT_DOUBLE
Definition: pdh.h:50
#define PDH_FMT_1000
Definition: pdh.h:53
LONG PDH_STATUS
Definition: pdh.h:35
#define PDH_VERSION
Definition: pdh.h:42
#define PDH_FMT_LARGE
Definition: pdh.h:51
struct _PDH_COUNTER_INFO_W PDH_COUNTER_INFO_W
struct _PDH_COUNTER_INFO_A PDH_COUNTER_INFO_A
#define PDH_MAX_SCALE
Definition: pdh.h:44
static WCHAR * pdh_strdup(const WCHAR *src)
Definition: pdh_main.c:54
static void collect_query_data(struct query *query)
Definition: pdh_main.c:447
PDH_STATUS WINAPI PdhCollectQueryDataEx(PDH_HQUERY handle, DWORD interval, HANDLE event)
Definition: pdh_main.c:522
PDH_STATUS WINAPI PdhGetLogFileTypeW(const WCHAR *log, DWORD *type)
Definition: pdh_main.c:1291
PDH_STATUS WINAPI PdhExpandCounterPathW(LPCWSTR szWildCardPath, LPWSTR mszExpandedPathList, LPDWORD pcchPathListLength)
Definition: pdh_main.c:644
PDH_STATUS WINAPI PdhValidatePathExW(PDH_HLOG source, LPCWSTR path)
Definition: pdh_main.c:1124
PDH_STATUS WINAPI PdhGetFormattedCounterValue(PDH_HCOUNTER handle, DWORD format, LPDWORD type, PPDH_FMT_COUNTERVALUE value)
Definition: pdh_main.c:774
static BOOL pdh_match_path(LPCWSTR fullpath, LPCWSTR path)
Definition: pdh_main.c:227
PDH_STATUS WINAPI PdhLookupPerfIndexByNameA(LPCSTR machine, LPCSTR name, LPDWORD index)
Definition: pdh_main.c:840
PDH_STATUS WINAPI PdhRemoveCounter(PDH_HCOUNTER handle)
Definition: pdh_main.c:1003
PDH_STATUS WINAPI PdhGetCounterInfoA(PDH_HCOUNTER handle, BOOLEAN text, LPDWORD size, PPDH_COUNTER_INFO_A info)
Definition: pdh_main.c:653
PDH_STATUS WINAPI PdhAddEnglishCounterW(PDH_HQUERY query, LPCWSTR path, DWORD_PTR userdata, PDH_HCOUNTER *counter)
Definition: pdh_main.c:328
static void CALLBACK collect_uptime(struct counter *counter)
Definition: pdh_main.c:197
static struct counter * create_counter(void)
Definition: pdh_main.c:122
static WCHAR * pdh_strdup_aw(const char *src)
Definition: pdh_main.c:63
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
Definition: pdh_main.c:74
PDH_STATUS WINAPI PdhAddCounterA(PDH_HQUERY query, LPCSTR path, DWORD_PTR userdata, PDH_HCOUNTER *counter)
Definition: pdh_main.c:244
PDH_STATUS WINAPI PdhSetCounterScaleFactor(PDH_HCOUNTER handle, LONG factor)
Definition: pdh_main.c:1026
static PDH_STATUS format_value(struct counter *counter, DWORD format, union value *raw1, union value *raw2, PDH_FMT_COUNTERVALUE *value)
Definition: pdh_main.c:338
PDH_STATUS WINAPI PdhGetCounterInfoW(PDH_HCOUNTER handle, BOOLEAN text, LPDWORD size, PPDH_COUNTER_INFO_W info)
Definition: pdh_main.c:695
PDH_STATUS WINAPI PdhCalculateCounterFromRawValue(PDH_HCOUNTER handle, DWORD format, PPDH_RAW_COUNTER raw1, PPDH_RAW_COUNTER raw2, PPDH_FMT_COUNTERVALUE value)
Definition: pdh_main.c:370
static CRITICAL_SECTION_DEBUG pdh_handle_cs_debug
Definition: pdh_main.c:45
PDH_STATUS WINAPI PdhExpandWildCardPathW(LPCWSTR szDataSource, LPCWSTR szWildCardPath, LPWSTR mszExpandedPathList, LPDWORD pcchPathListLength, DWORD dwFlags)
Definition: pdh_main.c:626
PDH_STATUS WINAPI PdhGetLogFileTypeA(const char *log, DWORD *type)
Definition: pdh_main.c:1282
PDH_STATUS WINAPI PdhCollectQueryDataWithTime(PDH_HQUERY handle, LONGLONG *timestamp)
Definition: pdh_main.c:581
PDH_STATUS WINAPI PdhBindInputDataSourceA(PDH_HLOG *source, const char *filenamelist)
Definition: pdh_main.c:1300
PDH_STATUS WINAPI PdhValidatePathA(LPCSTR path)
Definition: pdh_main.c:1053
PDH_STATUS WINAPI PdhOpenQueryA(LPCSTR source, DWORD_PTR userdata, PDH_HQUERY *query)
Definition: pdh_main.c:959
PDH_STATUS WINAPI PdhEnumObjectItemsA(LPCSTR szDataSource, LPCSTR szMachineName, LPCSTR szObjectName, LPSTR mszCounterList, LPDWORD pcchCounterListLength, LPSTR mszInstanceList, LPDWORD pcchInstanceListLength, DWORD dwDetailLevel, DWORD dwFlags)
Definition: pdh_main.c:1245
static void destroy_query(struct query *query)
Definition: pdh_main.c:167
PDH_STATUS WINAPI PdhMakeCounterPathA(PDH_COUNTER_PATH_ELEMENTS_A *e, LPSTR buffer, LPDWORD buflen, DWORD flags)
Definition: pdh_main.c:1139
PDH_STATUS WINAPI PdhExpandWildCardPathA(LPCSTR szDataSource, LPCSTR szWildCardPath, LPSTR mszExpandedPathList, LPDWORD pcchPathListLength, DWORD dwFlags)
Definition: pdh_main.c:617
static PDH_STATUS validate_path(LPCWSTR path)
Definition: pdh_main.c:1069
static const WCHAR path_uptime[]
Definition: pdh_main.c:188
#define TYPE_PROCESSOR_TIME
Definition: pdh_main.c:203
PDH_STATUS WINAPI PdhMakeCounterPathW(PDH_COUNTER_PATH_ELEMENTS_W *e, LPWSTR buffer, LPDWORD buflen, DWORD flags)
Definition: pdh_main.c:1190
#define PDH_MAGIC_QUERY
Definition: pdh_main.c:141
PDH_STATUS WINAPI PdhEnumObjectItemsW(LPCWSTR szDataSource, LPCWSTR szMachineName, LPCWSTR szObjectName, LPWSTR mszCounterList, LPDWORD pcchCounterListLength, LPWSTR mszInstanceList, LPDWORD pcchInstanceListLength, DWORD dwDetailLevel, DWORD dwFlags)
Definition: pdh_main.c:1259
static const WCHAR path_processor[]
Definition: pdh_main.c:186
static CRITICAL_SECTION pdh_handle_cs
Definition: pdh_main.c:44
static const WCHAR path_processor_time[]
Definition: pdh_main.c:183
PDH_STATUS WINAPI PdhExpandCounterPathA(LPCSTR szWildCardPath, LPSTR mszExpandedPathList, LPDWORD pcchPathListLength)
Definition: pdh_main.c:635
PDH_STATUS WINAPI PdhGetDllVersion(LPDWORD version)
Definition: pdh_main.c:761
PDH_STATUS WINAPI PdhLookupPerfNameByIndexA(LPCSTR machine, DWORD index, LPSTR buffer, LPDWORD size)
Definition: pdh_main.c:892
PDH_STATUS WINAPI PdhValidatePathExA(PDH_HLOG source, LPCSTR path)
Definition: pdh_main.c:1109
PDH_STATUS WINAPI PdhLookupPerfNameByIndexW(LPCWSTR machine, DWORD index, LPWSTR buffer, LPDWORD size)
Definition: pdh_main.c:920
#define PDH_MAGIC_COUNTER
Definition: pdh_main.c:120
static void destroy_counter(struct counter *counter)
Definition: pdh_main.c:134
PDH_STATUS WINAPI PdhLookupPerfIndexByNameW(LPCWSTR machine, LPCWSTR name, LPDWORD index)
Definition: pdh_main.c:865
PDH_STATUS WINAPI PdhVbAddCounter(PDH_HQUERY query, LPCSTR path, PDH_HCOUNTER *counter)
Definition: pdh_main.c:1097
PDH_STATUS WINAPI PdhGetRawCounterValue(PDH_HCOUNTER handle, LPDWORD type, PPDH_RAW_COUNTER value)
Definition: pdh_main.c:808
PDH_STATUS WINAPI PdhGetCounterTimeBase(PDH_HCOUNTER handle, LONGLONG *base)
Definition: pdh_main.c:737
PDH_STATUS WINAPI PdhAddCounterW(PDH_HQUERY hquery, LPCWSTR path, DWORD_PTR userdata, PDH_HCOUNTER *hcounter)
Definition: pdh_main.c:266
PDH_STATUS WINAPI PdhOpenQueryW(LPCWSTR source, DWORD_PTR userdata, PDH_HQUERY *handle)
Definition: pdh_main.c:977
#define TYPE_UPTIME
Definition: pdh_main.c:207
static void CALLBACK collect_processor_time(struct counter *counter)
Definition: pdh_main.c:191
PDH_STATUS WINAPI PdhSetDefaultRealTimeDataSource(DWORD source)
Definition: pdh_main.c:1273
PDH_STATUS WINAPI PdhBindInputDataSourceW(PDH_HLOG *source, const WCHAR *filenamelist)
Definition: pdh_main.c:1309
PDH_STATUS WINAPI PdhCollectQueryData(PDH_HQUERY handle)
Definition: pdh_main.c:466
PDH_STATUS WINAPI PdhAddEnglishCounterA(PDH_HQUERY query, LPCSTR path, DWORD_PTR userdata, PDH_HCOUNTER *counter)
Definition: pdh_main.c:316
PDH_STATUS WINAPI PdhValidatePathW(LPCWSTR path)
Definition: pdh_main.c:1079
static const struct source counter_sources[]
Definition: pdh_main.c:211
static DWORD CALLBACK collect_query_thread(void *arg)
Definition: pdh_main.c:491
static struct query * create_query(void)
Definition: pdh_main.c:154
PDH_STATUS WINAPI PdhCloseQuery(PDH_HQUERY handle)
Definition: pdh_main.c:399
static BOOL is_local_machine(const WCHAR *name, DWORD len)
Definition: pdh_main.c:218
#define PDH_NOT_IMPLEMENTED
Definition: pdhmsg.h:68
#define PDH_INVALID_HANDLE
Definition: pdhmsg.h:45
#define PDH_CSTATUS_VALID_DATA
Definition: pdhmsg.h:24
#define PDH_MEMORY_ALLOCATION_FAILURE
Definition: pdhmsg.h:44
#define PDH_INVALID_DATA
Definition: pdhmsg.h:55
#define PDH_STRING_NOT_FOUND
Definition: pdhmsg.h:69
#define PDH_NO_DATA
Definition: pdhmsg.h:31
#define PDH_CSTATUS_NO_MACHINE
Definition: pdhmsg.h:26
#define PDH_MORE_DATA
Definition: pdhmsg.h:28
#define PDH_INVALID_ARGUMENT
Definition: pdhmsg.h:46
#define PDH_CSTATUS_BAD_COUNTERNAME
Definition: pdhmsg.h:49
#define PDH_CSTATUS_NO_COUNTER
Definition: pdhmsg.h:42
long LONG
Definition: pedump.c:60
static unsigned __int64 next
Definition: rand_nt.c:6
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
#define LIST_FOR_EACH(cursor, list)
Definition: list.h:188
#define LIST_FOR_EACH_SAFE(cursor, cursor2, list)
Definition: list.h:192
#define memset(x, y, z)
Definition: compat.h:39
#define log(outFile, fmt,...)
Definition: util.h:15
#define TRACE(s)
Definition: solgame.cpp:4
LIST_ENTRY ProcessLocksList
Definition: winbase.h:908
DWORD dwHighDateTime
Definition: mapidefs.h:66
DWORD dwLowDateTime
Definition: mapidefs.h:65
LONGLONG SecondValue
Definition: pdh.h:78
DWORD type
Definition: pdh_main.c:107
DWORD magic
Definition: pdh_main.c:104
DWORD status
Definition: pdh_main.c:108
struct list entry
Definition: pdh_main.c:105
DWORD_PTR user
Definition: pdh_main.c:111
union value two
Definition: pdh_main.c:117
LONG defaultscale
Definition: pdh_main.c:110
union value one
Definition: pdh_main.c:116
DWORD_PTR queryuser
Definition: pdh_main.c:112
FILETIME stamp
Definition: pdh_main.c:114
LONGLONG base
Definition: pdh_main.c:113
LONG scale
Definition: pdh_main.c:109
WCHAR * path
Definition: pdh_main.c:106
void(CALLBACK *collect)(struct counter *)
Definition: dsound.c:943
Definition: format.c:58
Definition: list.h:15
Definition: name.c:39
struct list counters
Definition: pdh_main.c:151
HANDLE wait
Definition: pdh_main.c:149
DWORD_PTR user
Definition: pdh_main.c:146
DWORD magic
Definition: pdh_main.c:145
HANDLE thread
Definition: pdh_main.c:147
DWORD interval
Definition: pdh_main.c:148
HANDLE stop
Definition: pdh_main.c:150
DWORD index
Definition: pdh_main.c:175
void(CALLBACK *collect)(struct counter *)
DWORD type
Definition: pdh_main.c:178
const WCHAR * path
Definition: pdh_main.c:176
LONGLONG base
Definition: pdh_main.c:180
LONG scale
Definition: pdh_main.c:179
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
#define LIST_ENTRY(type)
Definition: queue.h:175
#define DWORD_PTR
Definition: treelist.c:76
uint32_t DWORD_PTR
Definition: typedefs.h:65
int64_t LONGLONG
Definition: typedefs.h:68
uint32_t * LPDWORD
Definition: typedefs.h:59
Definition: pdh_main.c:96
LONGLONG largevalue
Definition: pdh_main.c:99
LONG longvalue
Definition: pdh_main.c:97
double doublevalue
Definition: pdh_main.c:98
int ret
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:269
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
void * arg
Definition: msvc.h:10
#define WINAPI
Definition: msvc.h:6
const char * LPCSTR
Definition: xmlstorage.h:183
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185