ReactOS 0.4.15-dev-7788-g1ad9096
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 case DLL_WINE_PREATTACH:
80 return FALSE; /* prefer native version */
83 break;
85 if (lpvReserved) break;
87 break;
88 }
89
90 return TRUE;
91}
92
93union value
94{
98};
99
101{
102 DWORD magic; /* signature */
103 struct list entry; /* list entry */
104 WCHAR *path; /* identifier */
105 DWORD type; /* counter type */
106 DWORD status; /* update status */
107 LONG scale; /* scale factor */
108 LONG defaultscale; /* default scale factor */
109 DWORD_PTR user; /* user data */
110 DWORD_PTR queryuser; /* query user data */
111 LONGLONG base; /* samples per second */
112 FILETIME stamp; /* time stamp */
113 void (CALLBACK *collect)( struct counter * ); /* collect callback */
114 union value one; /* first value */
115 union value two; /* second value */
116};
117
118#define PDH_MAGIC_COUNTER 0x50444831 /* 'PDH1' */
119
120static struct counter *create_counter( void )
121{
122 struct counter *counter;
123
124 if ((counter = heap_alloc_zero( sizeof(struct counter) )))
125 {
127 return counter;
128 }
129 return NULL;
130}
131
132static void destroy_counter( struct counter *counter )
133{
134 counter->magic = 0;
137}
138
139#define PDH_MAGIC_QUERY 0x50444830 /* 'PDH0' */
140
141struct query
142{
143 DWORD magic; /* signature */
144 DWORD_PTR user; /* user data */
145 HANDLE thread; /* collect thread */
146 DWORD interval; /* collect interval */
147 HANDLE wait; /* wait event */
148 HANDLE stop; /* stop event */
149 struct list counters; /* counter list */
150};
151
152static struct query *create_query( void )
153{
154 struct query *query;
155
156 if ((query = heap_alloc_zero( sizeof(struct query) )))
157 {
160 return query;
161 }
162 return NULL;
163}
164
165static void destroy_query( struct query *query )
166{
167 query->magic = 0;
168 heap_free( query );
169}
170
171struct source
172{
173 DWORD index; /* name index */
174 const WCHAR *path; /* identifier */
175 void (CALLBACK *collect)( struct counter * ); /* collect callback */
176 DWORD type; /* counter type */
177 LONG scale; /* default scale factor */
178 LONGLONG base; /* samples per second */
179};
180
182 {'\\','P','r','o','c','e','s','s','o','r','(','_','T','o','t','a','l',')',
183 '\\','%',' ','P','r','o','c','e','s','s','o','r',' ','T','i','m','e',0};
184static const WCHAR path_processor[] =
185 {'\\','P','r','o','c','e','s','s','o','r',0};
186static const WCHAR path_uptime[] =
187 {'\\','S','y','s','t','e','m', '\\', 'S','y','s','t','e','m',' ','U','p',' ','T','i','m','e',0};
188
190{
191 counter->two.largevalue = 500000; /* FIXME */
193}
194
196{
199}
200
201#define TYPE_PROCESSOR_TIME \
202 (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_RATE | PERF_TIMER_100NS | PERF_DELTA_COUNTER | \
203 PERF_INVERSE_COUNTER | PERF_DISPLAY_PERCENT)
204
205#define TYPE_UPTIME \
206 (PERF_SIZE_LARGE | PERF_TYPE_COUNTER | PERF_COUNTER_ELAPSED | PERF_OBJECT_TIMER | PERF_DISPLAY_SECONDS)
207
208/* counter source registry */
209static const struct source counter_sources[] =
210{
212 { 238, path_processor, NULL, 0, 0, 0 },
213 { 674, path_uptime, collect_uptime, TYPE_UPTIME, -3, 1000 }
214};
215
217{
219 DWORD buflen = ARRAY_SIZE(buf);
220
221 if (!GetComputerNameW( buf, &buflen )) return FALSE;
222 return len == buflen && !_wcsnicmp( name, buf, buflen );
223}
224
226{
227 const WCHAR *p;
228
229 if (path[0] == '\\' && path[1] == '\\' && (p = wcschr( path + 2, '\\' )) &&
230 is_local_machine( path + 2, p - path - 2 ))
231 {
232 path += p - path;
233 }
234 if (wcschr( path, '\\' )) p = fullpath;
235 else p = wcsrchr( fullpath, '\\' ) + 1;
236 return !wcscmp( p, path );
237}
238
239/***********************************************************************
240 * PdhAddCounterA (PDH.@)
241 */
243 DWORD_PTR userdata, PDH_HCOUNTER *counter )
244{
246 WCHAR *pathW;
247
248 TRACE("%p %s %lx %p\n", query, debugstr_a(path), userdata, counter);
249
250 if (!path) return PDH_INVALID_ARGUMENT;
251
252 if (!(pathW = pdh_strdup_aw( path )))
254
255 ret = PdhAddCounterW( query, pathW, userdata, counter );
256
257 heap_free( pathW );
258 return ret;
259}
260
261/***********************************************************************
262 * PdhAddCounterW (PDH.@)
263 */
265 DWORD_PTR userdata, PDH_HCOUNTER *hcounter )
266{
267 struct query *query = hquery;
268 struct counter *counter;
269 unsigned int i;
270
271 TRACE("%p %s %lx %p\n", hquery, debugstr_w(path), userdata, hcounter);
272
273 if (!path || !hcounter) return PDH_INVALID_ARGUMENT;
274
276 if (!query || query->magic != PDH_MAGIC_QUERY)
277 {
279 return PDH_INVALID_HANDLE;
280 }
281
282 *hcounter = NULL;
283 for (i = 0; i < ARRAY_SIZE(counter_sources); i++)
284 {
286 {
287 if ((counter = create_counter()))
288 {
290 counter->collect = counter_sources[i].collect;
291 counter->type = counter_sources[i].type;
293 counter->base = counter_sources[i].base;
295 counter->user = userdata;
296
298 *hcounter = counter;
299
301 return ERROR_SUCCESS;
302 }
305 }
306 }
309}
310
311/***********************************************************************
312 * PdhAddEnglishCounterA (PDH.@)
313 */
315 DWORD_PTR userdata, PDH_HCOUNTER *counter )
316{
317 TRACE("%p %s %lx %p\n", query, debugstr_a(path), userdata, counter);
318
319 if (!query) return PDH_INVALID_ARGUMENT;
320 return PdhAddCounterA( query, path, userdata, counter );
321}
322
323/***********************************************************************
324 * PdhAddEnglishCounterW (PDH.@)
325 */
327 DWORD_PTR userdata, PDH_HCOUNTER *counter )
328{
329 TRACE("%p %s %lx %p\n", query, debugstr_w(path), userdata, counter);
330
331 if (!query) return PDH_INVALID_ARGUMENT;
332 return PdhAddCounterW( query, path, userdata, counter );
333}
334
335/* caller must hold counter lock */
337 union value *raw2, PDH_FMT_COUNTERVALUE *value )
338{
339 LONG factor;
340
342 if (format & PDH_FMT_LONG)
343 {
344 if (format & PDH_FMT_1000) value->u.longValue = raw2->longvalue * 1000;
345 else value->u.longValue = raw2->longvalue * pow( 10, factor );
346 }
347 else if (format & PDH_FMT_LARGE)
348 {
349 if (format & PDH_FMT_1000) value->u.largeValue = raw2->largevalue * 1000;
350 else value->u.largeValue = raw2->largevalue * pow( 10, factor );
351 }
352 else if (format & PDH_FMT_DOUBLE)
353 {
354 if (format & PDH_FMT_1000) value->u.doubleValue = raw2->doublevalue * 1000;
355 else value->u.doubleValue = raw2->doublevalue * pow( 10, factor );
356 }
357 else
358 {
359 WARN("unknown format %x\n", format);
361 }
362 return ERROR_SUCCESS;
363}
364
365/***********************************************************************
366 * PdhCalculateCounterFromRawValue (PDH.@)
367 */
371{
373 struct counter *counter = handle;
374
375 TRACE("%p 0x%08x %p %p %p\n", handle, format, raw1, raw2, value);
376
377 if (!value) return PDH_INVALID_ARGUMENT;
378
381 {
383 return PDH_INVALID_HANDLE;
384 }
385
386 ret = format_value( counter, format, (union value *)&raw1->SecondValue,
387 (union value *)&raw2->SecondValue, value );
388
390 return ret;
391}
392
393
394/***********************************************************************
395 * PdhCloseQuery (PDH.@)
396 */
398{
399 struct query *query = handle;
400 struct list *item, *next;
401
402 TRACE("%p\n", handle);
403
405 if (!query || query->magic != PDH_MAGIC_QUERY)
406 {
408 return PDH_INVALID_HANDLE;
409 }
410
411 if (query->thread)
412 {
414 SetEvent( query->stop );
416
418
421 {
423 return ERROR_SUCCESS;
424 }
427 query->thread = NULL;
428 }
429
431 {
432 struct counter *counter = LIST_ENTRY( item, struct counter, entry );
433
436 }
437
439
441 return ERROR_SUCCESS;
442}
443
444/* caller must hold query lock */
445static void collect_query_data( struct query *query )
446{
447 struct list *item;
448
450 {
452 struct counter *counter = LIST_ENTRY( item, struct counter, entry );
453
454 counter->collect( counter );
455
456 GetLocalTime( &time );
458 }
459}
460
461/***********************************************************************
462 * PdhCollectQueryData (PDH.@)
463 */
465{
466 struct query *query = handle;
467
468 TRACE("%p\n", handle);
469
471 if (!query || query->magic != PDH_MAGIC_QUERY)
472 {
474 return PDH_INVALID_HANDLE;
475 }
476
477 if (list_empty( &query->counters ))
478 {
480 return PDH_NO_DATA;
481 }
482
484
486 return ERROR_SUCCESS;
487}
488
490{
491 struct query *query = arg;
494
495 for (;;)
496 {
498
501 {
504 }
505
507
508 if (!SetEvent( query->wait ))
509 {
511 ExitThread( 0 );
512 }
514 }
515}
516
517/***********************************************************************
518 * PdhCollectQueryDataEx (PDH.@)
519 */
521{
523 struct query *query = handle;
524
525 TRACE("%p %d %p\n", handle, interval, event);
526
528 if (!query || query->magic != PDH_MAGIC_QUERY)
529 {
531 return PDH_INVALID_HANDLE;
532 }
533 if (list_empty( &query->counters ))
534 {
536 return PDH_NO_DATA;
537 }
538 if (query->thread)
539 {
541 SetEvent( query->stop );
543
545
548 {
550 return PDH_INVALID_HANDLE;
551 }
553 query->thread = NULL;
554 }
555 else if (!(query->stop = CreateEventW( NULL, FALSE, FALSE, NULL )))
556 {
557 ret = GetLastError();
559 return ret;
560 }
561 query->wait = event;
562 query->interval = interval * 1000;
564 {
565 ret = GetLastError();
567
569 return ret;
570 }
571
573 return ERROR_SUCCESS;
574}
575
576/***********************************************************************
577 * PdhCollectQueryDataWithTime (PDH.@)
578 */
580{
581 struct query *query = handle;
582 struct counter *counter;
583 struct list *item;
584
585 TRACE("%p %p\n", handle, timestamp);
586
587 if (!timestamp) return PDH_INVALID_ARGUMENT;
588
590 if (!query || query->magic != PDH_MAGIC_QUERY)
591 {
593 return PDH_INVALID_HANDLE;
594 }
595 if (list_empty( &query->counters ))
596 {
598 return PDH_NO_DATA;
599 }
600
602
604 counter = LIST_ENTRY( item, struct counter, entry );
605
607
609 return ERROR_SUCCESS;
610}
611
612/***********************************************************************
613 * PdhExpandWildCardPathA (PDH.@)
614 */
615PDH_STATUS WINAPI PdhExpandWildCardPathA( LPCSTR szDataSource, LPCSTR szWildCardPath, LPSTR mszExpandedPathList, LPDWORD pcchPathListLength, DWORD dwFlags )
616{
617 FIXME("%s, %s, %p, %p, 0x%x: stub\n", debugstr_a(szDataSource), debugstr_a(szWildCardPath), mszExpandedPathList, pcchPathListLength, dwFlags);
618 return PDH_NOT_IMPLEMENTED;
619}
620
621/***********************************************************************
622 * PdhExpandWildCardPathW (PDH.@)
623 */
624PDH_STATUS WINAPI PdhExpandWildCardPathW( LPCWSTR szDataSource, LPCWSTR szWildCardPath, LPWSTR mszExpandedPathList, LPDWORD pcchPathListLength, DWORD dwFlags )
625{
626 FIXME("%s, %s, %p, %p, 0x%x: stub\n", debugstr_w(szDataSource), debugstr_w(szWildCardPath), mszExpandedPathList, pcchPathListLength, dwFlags);
627 return PDH_NOT_IMPLEMENTED;
628}
629
630/***********************************************************************
631 * PdhExpandCounterPathA (PDH.@)
632 */
633PDH_STATUS WINAPI PdhExpandCounterPathA( LPCSTR szWildCardPath, LPSTR mszExpandedPathList, LPDWORD pcchPathListLength )
634{
635 FIXME("%s, %p, %p: stub\n", debugstr_a(szWildCardPath), mszExpandedPathList, pcchPathListLength);
636 return PdhExpandWildCardPathA(NULL, szWildCardPath, mszExpandedPathList, pcchPathListLength, 0);
637}
638
639/***********************************************************************
640 * PdhExpandCounterPathW (PDH.@)
641 */
642PDH_STATUS WINAPI PdhExpandCounterPathW( LPCWSTR szWildCardPath, LPWSTR mszExpandedPathList, LPDWORD pcchPathListLength )
643{
644 FIXME("%s, %p, %p: stub\n", debugstr_w(szWildCardPath), mszExpandedPathList, pcchPathListLength);
645 return PdhExpandWildCardPathW(NULL, szWildCardPath, mszExpandedPathList, pcchPathListLength, 0);
646}
647
648/***********************************************************************
649 * PdhGetCounterInfoA (PDH.@)
650 */
652{
653 struct counter *counter = handle;
654
655 TRACE("%p %d %p %p\n", handle, text, size, info);
656
659 {
661 return PDH_INVALID_HANDLE;
662 }
663 if (!size)
664 {
667 }
668 if (*size < sizeof(PDH_COUNTER_INFO_A))
669 {
670 *size = sizeof(PDH_COUNTER_INFO_A);
672 return PDH_MORE_DATA;
673 }
674
675 memset( info, 0, sizeof(PDH_COUNTER_INFO_A) );
676
677 info->dwType = counter->type;
678 info->CStatus = counter->status;
679 info->lScale = counter->scale;
680 info->lDefaultScale = counter->defaultscale;
681 info->dwUserData = counter->user;
682 info->dwQueryUserData = counter->queryuser;
683
684 *size = sizeof(PDH_COUNTER_INFO_A);
685
687 return ERROR_SUCCESS;
688}
689
690/***********************************************************************
691 * PdhGetCounterInfoW (PDH.@)
692 */
694{
695 struct counter *counter = handle;
696
697 TRACE("%p %d %p %p\n", handle, text, size, info);
698
701 {
703 return PDH_INVALID_HANDLE;
704 }
705 if (!size)
706 {
709 }
710 if (*size < sizeof(PDH_COUNTER_INFO_W))
711 {
712 *size = sizeof(PDH_COUNTER_INFO_W);
714 return PDH_MORE_DATA;
715 }
716
717 memset( info, 0, sizeof(PDH_COUNTER_INFO_W) );
718
719 info->dwType = counter->type;
720 info->CStatus = counter->status;
721 info->lScale = counter->scale;
722 info->lDefaultScale = counter->defaultscale;
723 info->dwUserData = counter->user;
724 info->dwQueryUserData = counter->queryuser;
725
726 *size = sizeof(PDH_COUNTER_INFO_W);
727
729 return ERROR_SUCCESS;
730}
731
732/***********************************************************************
733 * PdhGetCounterTimeBase (PDH.@)
734 */
736{
737 struct counter *counter = handle;
738
739 TRACE("%p %p\n", handle, base);
740
741 if (!base) return PDH_INVALID_ARGUMENT;
742
745 {
747 return PDH_INVALID_HANDLE;
748 }
749
750 *base = counter->base;
751
753 return ERROR_SUCCESS;
754}
755
756/***********************************************************************
757 * PdhGetDllVersion (PDH.@)
758 */
760{
761 if (!version)
763
765
766 return ERROR_SUCCESS;
767}
768
769/***********************************************************************
770 * PdhGetFormattedCounterValue (PDH.@)
771 */
774{
776 struct counter *counter = handle;
777
778 TRACE("%p %x %p %p\n", handle, format, type, value);
779
780 if (!value) return PDH_INVALID_ARGUMENT;
781
784 {
786 return PDH_INVALID_HANDLE;
787 }
788 if (counter->status)
789 {
791 return PDH_INVALID_DATA;
792 }
794 {
795 value->CStatus = ERROR_SUCCESS;
796 if (type) *type = counter->type;
797 }
798
800 return ret;
801}
802
803/***********************************************************************
804 * PdhGetRawCounterValue (PDH.@)
805 */
808{
809 struct counter *counter = handle;
810
811 TRACE("%p %p %p\n", handle, type, value);
812
813 if (!value) return PDH_INVALID_ARGUMENT;
814
817 {
819 return PDH_INVALID_HANDLE;
820 }
821
822 value->CStatus = counter->status;
823 value->TimeStamp.dwLowDateTime = counter->stamp.dwLowDateTime;
824 value->TimeStamp.dwHighDateTime = counter->stamp.dwHighDateTime;
825 value->FirstValue = counter->one.largevalue;
826 value->SecondValue = counter->two.largevalue;
827 value->MultiCount = 1; /* FIXME */
828
829 if (type) *type = counter->type;
830
832 return ERROR_SUCCESS;
833}
834
835/***********************************************************************
836 * PdhLookupPerfIndexByNameA (PDH.@)
837 */
839{
842 WCHAR *nameW;
843
844 TRACE("%s %s %p\n", debugstr_a(machine), debugstr_a(name), index);
845
846 if (!name) return PDH_INVALID_ARGUMENT;
847
849
850 if (!(nameW = pdh_strdup_aw( name )))
852
854
855 heap_free( nameW );
857 return ret;
858}
859
860/***********************************************************************
861 * PdhLookupPerfIndexByNameW (PDH.@)
862 */
864{
865 unsigned int i;
866
867 TRACE("%s %s %p\n", debugstr_w(machine), debugstr_w(name), index);
868
869 if (!name || !index) return PDH_INVALID_ARGUMENT;
870
871 if (machine)
872 {
873 FIXME("remote machine not supported\n");
875 }
876 for (i = 0; i < ARRAY_SIZE(counter_sources); i++)
877 {
879 {
880 *index = counter_sources[i].index;
881 return ERROR_SUCCESS;
882 }
883 }
885}
886
887/***********************************************************************
888 * PdhLookupPerfNameByIndexA (PDH.@)
889 */
891{
895 DWORD sizeW = ARRAY_SIZE(bufferW);
896
897 TRACE("%s %d %p %p\n", debugstr_a(machine), index, buffer, size);
898
899 if (!buffer || !size) return PDH_INVALID_ARGUMENT;
900
902
903 if (!(ret = PdhLookupPerfNameByIndexW( machineW, index, bufferW, &sizeW )))
904 {
905 int required = WideCharToMultiByte( CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL );
906
907 if (*size < required) ret = PDH_MORE_DATA;
908 else WideCharToMultiByte( CP_ACP, 0, bufferW, -1, buffer, required, NULL, NULL );
909 *size = required;
910 }
912 return ret;
913}
914
915/***********************************************************************
916 * PdhLookupPerfNameByIndexW (PDH.@)
917 */
919{
921 unsigned int i;
922
923 TRACE("%s %d %p %p\n", debugstr_w(machine), index, buffer, size);
924
925 if (machine)
926 {
927 FIXME("remote machine not supported\n");
929 }
930
931 if (!buffer || !size) return PDH_INVALID_ARGUMENT;
932 if (!index) return ERROR_SUCCESS;
933
934 for (i = 0; i < ARRAY_SIZE(counter_sources); i++)
935 {
937 {
938 WCHAR *p = wcsrchr( counter_sources[i].path, '\\' ) + 1;
939 unsigned int required = lstrlenW( p ) + 1;
940
941 if (*size < required) ret = PDH_MORE_DATA;
942 else
943 {
944 lstrcpyW( buffer, p );
946 }
947 *size = required;
948 return ret;
949 }
950 }
952}
953
954/***********************************************************************
955 * PdhOpenQueryA (PDH.@)
956 */
958{
960 WCHAR *sourceW = NULL;
961
962 TRACE("%s %lx %p\n", debugstr_a(source), userdata, query);
963
965
966 ret = PdhOpenQueryW( sourceW, userdata, query );
968
969 return ret;
970}
971
972/***********************************************************************
973 * PdhOpenQueryW (PDH.@)
974 */
976{
977 struct query *query;
978
979 TRACE("%s %lx %p\n", debugstr_w(source), userdata, handle);
980
981 if (!handle) return PDH_INVALID_ARGUMENT;
982
983 if (source)
984 {
985 FIXME("log file data source not supported\n");
987 }
988 if ((query = create_query()))
989 {
990 query->user = userdata;
991 *handle = query;
992
993 return ERROR_SUCCESS;
994 }
996}
997
998/***********************************************************************
999 * PdhRemoveCounter (PDH.@)
1000 */
1002{
1003 struct counter *counter = handle;
1004
1005 TRACE("%p\n", handle);
1006
1009 {
1011 return PDH_INVALID_HANDLE;
1012 }
1013
1016
1018 return ERROR_SUCCESS;
1019}
1020
1021/***********************************************************************
1022 * PdhSetCounterScaleFactor (PDH.@)
1023 */
1025{
1026 struct counter *counter = handle;
1027
1028 TRACE("%p\n", handle);
1029
1032 {
1034 return PDH_INVALID_HANDLE;
1035 }
1036 if (factor < PDH_MIN_SCALE || factor > PDH_MAX_SCALE)
1037 {
1039 return PDH_INVALID_ARGUMENT;
1040 }
1041
1042 counter->scale = factor;
1043
1045 return ERROR_SUCCESS;
1046}
1047
1048/***********************************************************************
1049 * PdhValidatePathA (PDH.@)
1050 */
1052{
1054 WCHAR *pathW;
1055
1056 TRACE("%s\n", debugstr_a(path));
1057
1058 if (!path) return PDH_INVALID_ARGUMENT;
1059 if (!(pathW = pdh_strdup_aw( path ))) return PDH_MEMORY_ALLOCATION_FAILURE;
1060
1061 ret = PdhValidatePathW( pathW );
1062
1063 heap_free( pathW );
1064 return ret;
1065}
1066
1068{
1069 if (!path || !*path) return PDH_INVALID_ARGUMENT;
1070 if (*path++ != '\\' || !wcschr( path, '\\' )) return PDH_CSTATUS_BAD_COUNTERNAME;
1071 return ERROR_SUCCESS;
1072 }
1073
1074/***********************************************************************
1075 * PdhValidatePathW (PDH.@)
1076 */
1078{
1080 unsigned int i;
1081
1082 TRACE("%s\n", debugstr_w(path));
1083
1084 if ((ret = validate_path( path ))) return ret;
1085
1086 for (i = 0; i < ARRAY_SIZE(counter_sources); i++)
1088
1090}
1091
1092/***********************************************************************
1093 * PdhVbAddCounter (PDH.@)
1094 */
1096{
1097 FIXME("%p, %s, %p: stub!\n", query, debugstr_a(path), counter);
1098
1099 if (!path) return PDH_INVALID_ARGUMENT;
1100
1101 return PDH_NOT_IMPLEMENTED;
1102}
1103
1104/***********************************************************************
1105 * PdhValidatePathExA (PDH.@)
1106 */
1108{
1109 TRACE("%p %s\n", source, debugstr_a(path));
1110
1111 if (source)
1112 {
1113 FIXME("log file data source not supported\n");
1114 return ERROR_SUCCESS;
1115 }
1116 return PdhValidatePathA( path );
1117}
1118
1119/***********************************************************************
1120 * PdhValidatePathExW (PDH.@)
1121 */
1123{
1124 TRACE("%p %s\n", source, debugstr_w(path));
1125
1126 if (source)
1127 {
1128 FIXME("log file data source not supported\n");
1129 return ERROR_SUCCESS;
1130 }
1131 return PdhValidatePathW( path );
1132}
1133
1134/***********************************************************************
1135 * PdhMakeCounterPathA (PDH.@)
1136 */
1138 LPDWORD buflen, DWORD flags )
1139{
1142 WCHAR *bufferW;
1143 DWORD buflenW;
1144
1145 TRACE("%p %p %p 0x%08x\n", e, buffer, buflen, flags);
1146
1147 if (!e || !buflen) return PDH_INVALID_ARGUMENT;
1148
1149 memset( &eW, 0, sizeof(eW) );
1150 if (e->szMachineName && !(eW.szMachineName = pdh_strdup_aw( e->szMachineName ))) goto done;
1151 if (e->szObjectName && !(eW.szObjectName = pdh_strdup_aw( e->szObjectName ))) goto done;
1152 if (e->szInstanceName && !(eW.szInstanceName = pdh_strdup_aw( e->szInstanceName ))) goto done;
1153 if (e->szParentInstance && !(eW.szParentInstance = pdh_strdup_aw( e->szParentInstance ))) goto done;
1154 if (e->szCounterName && !(eW.szCounterName = pdh_strdup_aw( e->szCounterName ))) goto done;
1155 eW.dwInstanceIndex = e->dwInstanceIndex;
1156
1157 buflenW = 0;
1158 ret = PdhMakeCounterPathW( &eW, NULL, &buflenW, flags );
1159 if (ret == PDH_MORE_DATA)
1160 {
1161 if ((bufferW = heap_alloc( buflenW * sizeof(WCHAR) )))
1162 {
1163 if (!(ret = PdhMakeCounterPathW( &eW, bufferW, &buflenW, flags )))
1164 {
1165 int len = WideCharToMultiByte(CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL);
1166 if (*buflen >= len) WideCharToMultiByte(CP_ACP, 0, bufferW, -1, buffer, *buflen, NULL, NULL);
1167 else ret = PDH_MORE_DATA;
1168 *buflen = len;
1169 }
1170 heap_free( bufferW );
1171 }
1172 else
1174 }
1175
1176done:
1178 heap_free( eW.szObjectName );
1182 return ret;
1183}
1184
1185/***********************************************************************
1186 * PdhMakeCounterPathW (PDH.@)
1187 */
1189 LPDWORD buflen, DWORD flags )
1190{
1191 static const WCHAR bslash[] = {'\\',0};
1192 static const WCHAR fslash[] = {'/',0};
1193 static const WCHAR lparen[] = {'(',0};
1194 static const WCHAR rparen[] = {')',0};
1195 static const WCHAR fmt[] = {'#','%','u',0};
1196
1199 DWORD len;
1200
1201 TRACE("%p %p %p 0x%08x\n", e, buffer, buflen, flags);
1202
1203 if (flags) FIXME("unimplemented flags 0x%08x\n", flags);
1204
1205 if (!e || !e->szCounterName || !e->szObjectName || !buflen)
1206 return PDH_INVALID_ARGUMENT;
1207
1208 path[0] = 0;
1209 if (e->szMachineName)
1210 {
1211 lstrcatW(path, bslash);
1212 lstrcatW(path, bslash);
1213 lstrcatW(path, e->szMachineName);
1214 }
1215 lstrcatW(path, bslash);
1216 lstrcatW(path, e->szObjectName);
1217 if (e->szInstanceName)
1218 {
1219 lstrcatW(path, lparen);
1220 if (e->szParentInstance)
1221 {
1222 lstrcatW(path, e->szParentInstance);
1223 lstrcatW(path, fslash);
1224 }
1225 lstrcatW(path, e->szInstanceName);
1226 swprintf(instance, fmt, e->dwInstanceIndex);
1228 lstrcatW(path, rparen);
1229 }
1230 lstrcatW(path, bslash);
1231 lstrcatW(path, e->szCounterName);
1232
1233 len = lstrlenW(path) + 1;
1234 if (*buflen >= len) lstrcpyW(buffer, path);
1235 else ret = PDH_MORE_DATA;
1236 *buflen = len;
1237 return ret;
1238}
1239
1240/***********************************************************************
1241 * PdhEnumObjectItemsA (PDH.@)
1242 */
1243PDH_STATUS WINAPI PdhEnumObjectItemsA(LPCSTR szDataSource, LPCSTR szMachineName, LPCSTR szObjectName,
1244 LPSTR mszCounterList, LPDWORD pcchCounterListLength, LPSTR mszInstanceList,
1245 LPDWORD pcchInstanceListLength, DWORD dwDetailLevel, DWORD dwFlags)
1246{
1247 FIXME("%s, %s, %s, %p, %p, %p, %p, %d, 0x%x: stub\n", debugstr_a(szDataSource), debugstr_a(szMachineName),
1248 debugstr_a(szObjectName), mszCounterList, pcchCounterListLength, mszInstanceList,
1249 pcchInstanceListLength, dwDetailLevel, dwFlags);
1250
1251 return PDH_NOT_IMPLEMENTED;
1252}
1253
1254/***********************************************************************
1255 * PdhEnumObjectItemsW (PDH.@)
1256 */
1257PDH_STATUS WINAPI PdhEnumObjectItemsW(LPCWSTR szDataSource, LPCWSTR szMachineName, LPCWSTR szObjectName,
1258 LPWSTR mszCounterList, LPDWORD pcchCounterListLength, LPWSTR mszInstanceList,
1259 LPDWORD pcchInstanceListLength, DWORD dwDetailLevel, DWORD dwFlags)
1260{
1261 FIXME("%s, %s, %s, %p, %p, %p, %p, %d, 0x%x: stub\n", debugstr_w(szDataSource), debugstr_w(szMachineName),
1262 debugstr_w(szObjectName), mszCounterList, pcchCounterListLength, mszInstanceList,
1263 pcchInstanceListLength, dwDetailLevel, dwFlags);
1264
1265 return PDH_NOT_IMPLEMENTED;
1266}
1267
1268/***********************************************************************
1269 * PdhSetDefaultRealTimeDataSource (PDH.@)
1270 */
1272{
1273 FIXME("%u\n", source);
1274 return ERROR_SUCCESS;
1275}
1276
1277/***********************************************************************
1278 * PdhGetLogFileTypeA (PDH.@)
1279 */
1281{
1282 FIXME("%s, %p: stub\n", debugstr_a(log), type);
1283 return PDH_NOT_IMPLEMENTED;
1284}
1285
1286/***********************************************************************
1287 * PdhGetLogFileTypeW (PDH.@)
1288 */
1290{
1291 FIXME("%s, %p: stub\n", debugstr_w(log), type);
1292 return PDH_NOT_IMPLEMENTED;
1293}
1294
1295/***********************************************************************
1296 * PdhBindInputDataSourceA (PDH.@)
1297 */
1299{
1300 FIXME("%p %s: stub\n", source, debugstr_a(filenamelist));
1301 return PDH_NOT_IMPLEMENTED;
1302}
1303
1304/***********************************************************************
1305 * PdhBindInputDataSourceW (PDH.@)
1306 */
1308{
1309 FIXME("%p %s: stub\n", source, debugstr_w(filenamelist));
1310 return PDH_NOT_IMPLEMENTED;
1311}
ULONGLONG WINAPI GetTickCount64(VOID)
Definition: GetTickCount64.c:9
unsigned char BOOLEAN
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:46
#define ARRAY_SIZE(A)
Definition: main.h:33
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
static HANDLE thread
Definition: service.c:33
#define FIXME(fmt,...)
Definition: debug.h:111
#define WARN(fmt,...)
Definition: debug.h:112
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:1799
#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:112
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLsizeiptr size
Definition: glext.h:5919
struct _cl_event * event
Definition: glext.h:7739
GLenum src
Definition: glext.h:6340
GLuint buffer
Definition: glext.h:5915
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:445
PDH_STATUS WINAPI PdhCollectQueryDataEx(PDH_HQUERY handle, DWORD interval, HANDLE event)
Definition: pdh_main.c:520
PDH_STATUS WINAPI PdhGetLogFileTypeW(const WCHAR *log, DWORD *type)
Definition: pdh_main.c:1289
PDH_STATUS WINAPI PdhExpandCounterPathW(LPCWSTR szWildCardPath, LPWSTR mszExpandedPathList, LPDWORD pcchPathListLength)
Definition: pdh_main.c:642
PDH_STATUS WINAPI PdhValidatePathExW(PDH_HLOG source, LPCWSTR path)
Definition: pdh_main.c:1122
PDH_STATUS WINAPI PdhGetFormattedCounterValue(PDH_HCOUNTER handle, DWORD format, LPDWORD type, PPDH_FMT_COUNTERVALUE value)
Definition: pdh_main.c:772
static BOOL pdh_match_path(LPCWSTR fullpath, LPCWSTR path)
Definition: pdh_main.c:225
PDH_STATUS WINAPI PdhLookupPerfIndexByNameA(LPCSTR machine, LPCSTR name, LPDWORD index)
Definition: pdh_main.c:838
PDH_STATUS WINAPI PdhRemoveCounter(PDH_HCOUNTER handle)
Definition: pdh_main.c:1001
PDH_STATUS WINAPI PdhGetCounterInfoA(PDH_HCOUNTER handle, BOOLEAN text, LPDWORD size, PPDH_COUNTER_INFO_A info)
Definition: pdh_main.c:651
PDH_STATUS WINAPI PdhAddEnglishCounterW(PDH_HQUERY query, LPCWSTR path, DWORD_PTR userdata, PDH_HCOUNTER *counter)
Definition: pdh_main.c:326
static void CALLBACK collect_uptime(struct counter *counter)
Definition: pdh_main.c:195
static struct counter * create_counter(void)
Definition: pdh_main.c:120
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:242
PDH_STATUS WINAPI PdhSetCounterScaleFactor(PDH_HCOUNTER handle, LONG factor)
Definition: pdh_main.c:1024
static PDH_STATUS format_value(struct counter *counter, DWORD format, union value *raw1, union value *raw2, PDH_FMT_COUNTERVALUE *value)
Definition: pdh_main.c:336
PDH_STATUS WINAPI PdhGetCounterInfoW(PDH_HCOUNTER handle, BOOLEAN text, LPDWORD size, PPDH_COUNTER_INFO_W info)
Definition: pdh_main.c:693
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:368
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:624
PDH_STATUS WINAPI PdhGetLogFileTypeA(const char *log, DWORD *type)
Definition: pdh_main.c:1280
PDH_STATUS WINAPI PdhCollectQueryDataWithTime(PDH_HQUERY handle, LONGLONG *timestamp)
Definition: pdh_main.c:579
PDH_STATUS WINAPI PdhBindInputDataSourceA(PDH_HLOG *source, const char *filenamelist)
Definition: pdh_main.c:1298
PDH_STATUS WINAPI PdhValidatePathA(LPCSTR path)
Definition: pdh_main.c:1051
PDH_STATUS WINAPI PdhOpenQueryA(LPCSTR source, DWORD_PTR userdata, PDH_HQUERY *query)
Definition: pdh_main.c:957
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:1243
static void destroy_query(struct query *query)
Definition: pdh_main.c:165
PDH_STATUS WINAPI PdhMakeCounterPathA(PDH_COUNTER_PATH_ELEMENTS_A *e, LPSTR buffer, LPDWORD buflen, DWORD flags)
Definition: pdh_main.c:1137
PDH_STATUS WINAPI PdhExpandWildCardPathA(LPCSTR szDataSource, LPCSTR szWildCardPath, LPSTR mszExpandedPathList, LPDWORD pcchPathListLength, DWORD dwFlags)
Definition: pdh_main.c:615
static PDH_STATUS validate_path(LPCWSTR path)
Definition: pdh_main.c:1067
static const WCHAR path_uptime[]
Definition: pdh_main.c:186
#define TYPE_PROCESSOR_TIME
Definition: pdh_main.c:201
PDH_STATUS WINAPI PdhMakeCounterPathW(PDH_COUNTER_PATH_ELEMENTS_W *e, LPWSTR buffer, LPDWORD buflen, DWORD flags)
Definition: pdh_main.c:1188
#define PDH_MAGIC_QUERY
Definition: pdh_main.c:139
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:1257
static const WCHAR path_processor[]
Definition: pdh_main.c:184
static CRITICAL_SECTION pdh_handle_cs
Definition: pdh_main.c:44
static const WCHAR path_processor_time[]
Definition: pdh_main.c:181
PDH_STATUS WINAPI PdhExpandCounterPathA(LPCSTR szWildCardPath, LPSTR mszExpandedPathList, LPDWORD pcchPathListLength)
Definition: pdh_main.c:633
PDH_STATUS WINAPI PdhGetDllVersion(LPDWORD version)
Definition: pdh_main.c:759
PDH_STATUS WINAPI PdhLookupPerfNameByIndexA(LPCSTR machine, DWORD index, LPSTR buffer, LPDWORD size)
Definition: pdh_main.c:890
PDH_STATUS WINAPI PdhValidatePathExA(PDH_HLOG source, LPCSTR path)
Definition: pdh_main.c:1107
PDH_STATUS WINAPI PdhLookupPerfNameByIndexW(LPCWSTR machine, DWORD index, LPWSTR buffer, LPDWORD size)
Definition: pdh_main.c:918
#define PDH_MAGIC_COUNTER
Definition: pdh_main.c:118
static void destroy_counter(struct counter *counter)
Definition: pdh_main.c:132
PDH_STATUS WINAPI PdhLookupPerfIndexByNameW(LPCWSTR machine, LPCWSTR name, LPDWORD index)
Definition: pdh_main.c:863
PDH_STATUS WINAPI PdhVbAddCounter(PDH_HQUERY query, LPCSTR path, PDH_HCOUNTER *counter)
Definition: pdh_main.c:1095
PDH_STATUS WINAPI PdhGetRawCounterValue(PDH_HCOUNTER handle, LPDWORD type, PPDH_RAW_COUNTER value)
Definition: pdh_main.c:806
PDH_STATUS WINAPI PdhGetCounterTimeBase(PDH_HCOUNTER handle, LONGLONG *base)
Definition: pdh_main.c:735
PDH_STATUS WINAPI PdhAddCounterW(PDH_HQUERY hquery, LPCWSTR path, DWORD_PTR userdata, PDH_HCOUNTER *hcounter)
Definition: pdh_main.c:264
PDH_STATUS WINAPI PdhOpenQueryW(LPCWSTR source, DWORD_PTR userdata, PDH_HQUERY *handle)
Definition: pdh_main.c:975
#define TYPE_UPTIME
Definition: pdh_main.c:205
static void CALLBACK collect_processor_time(struct counter *counter)
Definition: pdh_main.c:189
PDH_STATUS WINAPI PdhSetDefaultRealTimeDataSource(DWORD source)
Definition: pdh_main.c:1271
PDH_STATUS WINAPI PdhBindInputDataSourceW(PDH_HLOG *source, const WCHAR *filenamelist)
Definition: pdh_main.c:1307
PDH_STATUS WINAPI PdhCollectQueryData(PDH_HQUERY handle)
Definition: pdh_main.c:464
PDH_STATUS WINAPI PdhAddEnglishCounterA(PDH_HQUERY query, LPCSTR path, DWORD_PTR userdata, PDH_HCOUNTER *counter)
Definition: pdh_main.c:314
PDH_STATUS WINAPI PdhValidatePathW(LPCWSTR path)
Definition: pdh_main.c:1077
static const struct source counter_sources[]
Definition: pdh_main.c:209
static DWORD CALLBACK collect_query_thread(void *arg)
Definition: pdh_main.c:489
static struct query * create_query(void)
Definition: pdh_main.c:152
PDH_STATUS WINAPI PdhCloseQuery(PDH_HQUERY handle)
Definition: pdh_main.c:397
static BOOL is_local_machine(const WCHAR *name, DWORD len)
Definition: pdh_main.c:216
#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:883
DWORD dwHighDateTime
Definition: mapidefs.h:66
DWORD dwLowDateTime
Definition: mapidefs.h:65
LONGLONG SecondValue
Definition: pdh.h:78
DWORD type
Definition: pdh_main.c:105
DWORD magic
Definition: pdh_main.c:102
DWORD status
Definition: pdh_main.c:106
struct list entry
Definition: pdh_main.c:103
DWORD_PTR user
Definition: pdh_main.c:109
union value two
Definition: pdh_main.c:115
LONG defaultscale
Definition: pdh_main.c:108
union value one
Definition: pdh_main.c:114
DWORD_PTR queryuser
Definition: pdh_main.c:110
FILETIME stamp
Definition: pdh_main.c:112
LONGLONG base
Definition: pdh_main.c:111
LONG scale
Definition: pdh_main.c:107
WCHAR * path
Definition: pdh_main.c:104
void(CALLBACK *collect)(struct counter *)
Definition: dsound.c:943
Definition: list.h:15
Definition: name.c:39
struct list counters
Definition: pdh_main.c:149
HANDLE wait
Definition: pdh_main.c:147
DWORD_PTR user
Definition: pdh_main.c:144
DWORD magic
Definition: pdh_main.c:143
HANDLE thread
Definition: pdh_main.c:145
DWORD interval
Definition: pdh_main.c:146
HANDLE stop
Definition: pdh_main.c:148
DWORD index
Definition: pdh_main.c:173
void(CALLBACK *collect)(struct counter *)
DWORD type
Definition: pdh_main.c:176
const WCHAR * path
Definition: pdh_main.c:174
LONGLONG base
Definition: pdh_main.c:178
LONG scale
Definition: pdh_main.c:177
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:94
LONGLONG largevalue
Definition: pdh_main.c:97
LONG longvalue
Definition: pdh_main.c:95
double doublevalue
Definition: pdh_main.c:96
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:243
_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