#include <math.h>
#define NONAMELESSUNION
-#define NONAMELESSSTRUCT
+
#include "windef.h"
#include "winbase.h"
#include "winperf.h"
#include "wine/debug.h"
+#include "wine/heap.h"
#include "wine/list.h"
#include "wine/unicode.h"
};
static CRITICAL_SECTION pdh_handle_cs = { &pdh_handle_cs_debug, -1, 0, 0, 0, 0 };
-static inline void *heap_alloc( SIZE_T size )
-{
- return HeapAlloc( GetProcessHeap(), 0, size );
-}
-
-static inline void *heap_alloc_zero( SIZE_T size )
-{
- return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, size );
-}
-
-static inline void heap_free( LPVOID mem )
-{
- HeapFree( GetProcessHeap(), 0, mem );
-}
-
static inline WCHAR *pdh_strdup( const WCHAR *src )
{
WCHAR *dst;
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
TRACE("(0x%p, %d, %p)\n",hinstDLL,fdwReason,lpvReserved);
-
- if (fdwReason == DLL_WINE_PREATTACH) return FALSE; /* prefer native version */
-
- if (fdwReason == DLL_PROCESS_ATTACH)
+ switch (fdwReason)
{
- DisableThreadLibraryCalls( hinstDLL );
+ case DLL_WINE_PREATTACH:
+ return FALSE; /* prefer native version */
+ case DLL_PROCESS_ATTACH:
+ DisableThreadLibraryCalls(hinstDLL);
+ break;
+ case DLL_PROCESS_DETACH:
+ if (lpvReserved) break;
+ DeleteCriticalSection(&pdh_handle_cs);
+ break;
}
return TRUE;
{ 674, path_uptime, collect_uptime, TYPE_UPTIME, -3, 1000 }
};
+static BOOL is_local_machine( const WCHAR *name, DWORD len )
+{
+ WCHAR buf[MAX_COMPUTERNAME_LENGTH + 1];
+ DWORD buflen = sizeof(buf) / sizeof(buf[0]);
+
+ if (!GetComputerNameW( buf, &buflen )) return FALSE;
+ return len == buflen && !memicmpW( name, buf, buflen );
+}
+
static BOOL pdh_match_path( LPCWSTR fullpath, LPCWSTR path )
{
const WCHAR *p;
- if (strchrW( path, '\\')) p = fullpath;
+ if (path[0] == '\\' && path[1] == '\\' && (p = strchrW( path + 2, '\\' )) &&
+ is_local_machine( path + 2, p - path - 2 ))
+ {
+ path += p - path;
+ }
+ if (strchrW( path, '\\' )) p = fullpath;
else p = strrchrW( fullpath, '\\' ) + 1;
- if (strcmpW( p, path )) return FALSE;
- return TRUE;
+ return !strcmpW( p, path );
}
/***********************************************************************
return PDH_NOT_IMPLEMENTED;
}
+/***********************************************************************
+ * PdhExpandCounterPathA (PDH.@)
+ */
+PDH_STATUS WINAPI PdhExpandCounterPathA( LPCSTR szWildCardPath, LPSTR mszExpandedPathList, LPDWORD pcchPathListLength )
+{
+ FIXME("%s, %p, %p: stub\n", debugstr_a(szWildCardPath), mszExpandedPathList, pcchPathListLength);
+ return PdhExpandWildCardPathA(NULL, szWildCardPath, mszExpandedPathList, pcchPathListLength, 0);
+}
+
+/***********************************************************************
+ * PdhExpandCounterPathW (PDH.@)
+ */
+PDH_STATUS WINAPI PdhExpandCounterPathW( LPCWSTR szWildCardPath, LPWSTR mszExpandedPathList, LPDWORD pcchPathListLength )
+{
+ FIXME("%s, %p, %p: stub\n", debugstr_w(szWildCardPath), mszExpandedPathList, pcchPathListLength);
+ return PdhExpandWildCardPathW(NULL, szWildCardPath, mszExpandedPathList, pcchPathListLength, 0);
+}
+
/***********************************************************************
* PdhGetCounterInfoA (PDH.@)
*/
FIXME("%u\n", source);
return ERROR_SUCCESS;
}
+
+/***********************************************************************
+ * PdhGetLogFileTypeA (PDH.@)
+ */
+PDH_STATUS WINAPI PdhGetLogFileTypeA(const char *log, DWORD *type)
+{
+ FIXME("%s, %p: stub\n", debugstr_a(log), type);
+ return PDH_NOT_IMPLEMENTED;
+}
+
+/***********************************************************************
+ * PdhGetLogFileTypeW (PDH.@)
+ */
+PDH_STATUS WINAPI PdhGetLogFileTypeW(const WCHAR *log, DWORD *type)
+{
+ FIXME("%s, %p: stub\n", debugstr_w(log), type);
+ return PDH_NOT_IMPLEMENTED;
+}
+
+/***********************************************************************
+ * PdhBindInputDataSourceA (PDH.@)
+ */
+PDH_STATUS WINAPI PdhBindInputDataSourceA(PDH_HLOG *source, const char *filenamelist)
+{
+ FIXME("%p %s: stub\n", source, debugstr_a(filenamelist));
+ return PDH_NOT_IMPLEMENTED;
+}
+
+/***********************************************************************
+ * PdhBindInputDataSourceW (PDH.@)
+ */
+PDH_STATUS WINAPI PdhBindInputDataSourceW(PDH_HLOG *source, const WCHAR *filenamelist)
+{
+ FIXME("%p %s: stub\n", source, debugstr_w(filenamelist));
+ return PDH_NOT_IMPLEMENTED;
+}