blob: 35ce891cebc0665bf2cd80db313353fcb13ebaca [file] [log] [blame]
Andrey Turkinfaa73662009-01-07 13:34:31 +03001/*
2 * Implementation of loadperf.dll
3 *
4 * Copyright 2009 Andrey Turkin
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#include "config.h"
22
23#include <stdarg.h>
24
25#include "windef.h"
26#include "winbase.h"
Andrey Turkin0eebcf52009-01-07 13:34:45 +030027#include "winerror.h"
28#include "winnls.h"
Andrey Turkinfaa73662009-01-07 13:34:31 +030029#include "wine/debug.h"
30
Andrey Turkin0eebcf52009-01-07 13:34:45 +030031#include "loadperf.h"
32
Andrey Turkinfaa73662009-01-07 13:34:31 +030033WINE_DEFAULT_DEBUG_CHANNEL(loadperf);
34
35BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
36{
37 TRACE("(0x%p, %d, %p)\n",hinstDLL,fdwReason,lpvReserved);
38
39 switch(fdwReason)
40 {
41 case DLL_WINE_PREATTACH:
42 return FALSE; /* prefer native version */
43 case DLL_PROCESS_ATTACH:
44 DisableThreadLibraryCalls(hinstDLL);
45 break;
46 case DLL_PROCESS_DETACH:
47 break;
48 }
49
50 return TRUE;
51}
Andrey Turkin0eebcf52009-01-07 13:34:45 +030052
Hans Leidekker0dd925b2009-01-23 10:32:20 +010053static WCHAR *strdupAW(const char *str)
54{
55 WCHAR *ret = NULL;
56 if (str)
57 {
58 INT len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
59 if (!(ret = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) return NULL;
60 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
61 }
62 return ret;
63}
64
65/*************************************************************
66 * InstallPerfDllA (loadperf.@)
67 */
68DWORD WINAPI InstallPerfDllA(LPCSTR computer, LPCSTR ini, ULONG_PTR flags)
69{
70 DWORD ret;
71 LPWSTR computerW = NULL, iniW = NULL;
72
73 if (computer && !(computerW = strdupAW(computer))) return ERROR_OUTOFMEMORY;
74 if (ini && !(iniW = strdupAW(ini)))
75 {
76 HeapFree(GetProcessHeap(), 0, computerW);
77 return ERROR_OUTOFMEMORY;
78 }
79
80 ret = InstallPerfDllW(computerW, iniW, flags);
81
82 HeapFree(GetProcessHeap(), 0, computerW);
83 HeapFree(GetProcessHeap(), 0, iniW);
84
85 return ret;
86}
87
88/*************************************************************
89 * InstallPerfDllW (loadperf.@)
90 */
91DWORD WINAPI InstallPerfDllW(LPCWSTR computer, LPCWSTR ini, ULONG_PTR flags)
92{
93 FIXME("(%s, %s, %lx)\n", debugstr_w(computer), debugstr_w(ini), flags);
94 return ERROR_SUCCESS;
95}
96
Andrey Turkin0eebcf52009-01-07 13:34:45 +030097/*************************************************************
Andrey Turkin86635b32009-01-12 03:35:01 +030098 * LoadPerfCounterTextStringsA (loadperf.@)
99 *
100 * NOTES
101 * See LoadPerfCounterTextStringsW
102 */
103DWORD WINAPI LoadPerfCounterTextStringsA(LPCSTR cmdline, BOOL quiet)
104{
105 DWORD ret;
106 LPWSTR cmdlineW = NULL;
107
Hans Leidekker0dd925b2009-01-23 10:32:20 +0100108 if (cmdline && !(cmdlineW = strdupAW(cmdline))) return ERROR_OUTOFMEMORY;
Andrey Turkin86635b32009-01-12 03:35:01 +0300109
110 ret = LoadPerfCounterTextStringsW(cmdlineW, quiet);
111
112 HeapFree(GetProcessHeap(), 0, cmdlineW);
113
114 return ret;
115}
116
117/*************************************************************
118 * LoadPerfCounterTextStringsW (loadperf.@)
119 *
120 * PARAMS
121 * cmdline [in] Last argument in command line - ini file to be used
122 * quiet [in] FALSE - the function may write to stdout
123 *
124 */
125DWORD WINAPI LoadPerfCounterTextStringsW(LPCWSTR cmdline, BOOL quiet)
126{
127 FIXME("(%s, %d): stub\n", debugstr_w(cmdline), quiet);
128
129 return ERROR_SUCCESS;
130}
131
132/*************************************************************
Andrey Turkin0eebcf52009-01-07 13:34:45 +0300133 * UnloadPerfCounterTextStringsA (loadperf.@)
134 *
135 * NOTES
136 * See UnloadPerfCounterTextStringsW
137 */
Andrey Turkina9c57932009-01-28 19:56:25 +0300138DWORD WINAPI UnloadPerfCounterTextStringsA(LPCSTR cmdline, BOOL quiet)
Andrey Turkin0eebcf52009-01-07 13:34:45 +0300139{
140 DWORD ret;
141 LPWSTR cmdlineW = NULL;
142
Hans Leidekker0dd925b2009-01-23 10:32:20 +0100143 if (cmdline && !(cmdlineW = strdupAW(cmdline))) return ERROR_OUTOFMEMORY;
Andrey Turkin0eebcf52009-01-07 13:34:45 +0300144
Andrey Turkina9c57932009-01-28 19:56:25 +0300145 ret = UnloadPerfCounterTextStringsW(cmdlineW, quiet);
Andrey Turkin0eebcf52009-01-07 13:34:45 +0300146
147 HeapFree(GetProcessHeap(), 0, cmdlineW);
148
149 return ret;
150}
151
152/*************************************************************
153 * UnloadPerfCounterTextStringsW (loadperf.@)
154 *
155 * PARAMS
156 * cmdline [in] Last argument in command line - application counters to be removed
Andrey Turkina9c57932009-01-28 19:56:25 +0300157 * quiet [in] FALSE - the function may write to stdout
Andrey Turkin0eebcf52009-01-07 13:34:45 +0300158 *
159 */
Andrey Turkina9c57932009-01-28 19:56:25 +0300160DWORD WINAPI UnloadPerfCounterTextStringsW(LPCWSTR cmdline, BOOL quiet)
Andrey Turkin0eebcf52009-01-07 13:34:45 +0300161{
Andrey Turkina9c57932009-01-28 19:56:25 +0300162 FIXME("(%s, %d): stub\n", debugstr_w(cmdline), quiet);
Andrey Turkin0eebcf52009-01-07 13:34:45 +0300163
164 return ERROR_SUCCESS;
165}