wmic: Convert integer property values to BSTR.
[wine/wine-gecko.git] / dlls / loadperf / loadperf_main.c
blob8f0da112ecf8d6b2f0fac65f5c12be4c66a7085c
1 /*
2 * Implementation of loadperf.dll
4 * Copyright 2009 Andrey Turkin
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.
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.
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
21 #include "config.h"
23 #include <stdarg.h>
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winerror.h"
28 #include "winnls.h"
29 #include "wine/debug.h"
31 #include "loadperf.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(loadperf);
35 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
37 TRACE("(0x%p, %d, %p)\n",hinstDLL,fdwReason,lpvReserved);
39 switch(fdwReason)
41 case DLL_WINE_PREATTACH:
42 return FALSE; /* prefer native version */
43 case DLL_PROCESS_ATTACH:
44 DisableThreadLibraryCalls(hinstDLL);
45 break;
48 return TRUE;
51 static WCHAR *strdupAW(const char *str)
53 WCHAR *ret = NULL;
54 if (str)
56 INT len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
57 if (!(ret = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) return NULL;
58 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
60 return ret;
63 /*************************************************************
64 * InstallPerfDllA (loadperf.@)
66 DWORD WINAPI InstallPerfDllA(LPCSTR computer, LPCSTR ini, ULONG_PTR flags)
68 DWORD ret;
69 LPWSTR computerW = NULL, iniW = NULL;
71 if (computer && !(computerW = strdupAW(computer))) return ERROR_OUTOFMEMORY;
72 if (ini && !(iniW = strdupAW(ini)))
74 HeapFree(GetProcessHeap(), 0, computerW);
75 return ERROR_OUTOFMEMORY;
78 ret = InstallPerfDllW(computerW, iniW, flags);
80 HeapFree(GetProcessHeap(), 0, computerW);
81 HeapFree(GetProcessHeap(), 0, iniW);
83 return ret;
86 /*************************************************************
87 * InstallPerfDllW (loadperf.@)
89 DWORD WINAPI InstallPerfDllW(LPCWSTR computer, LPCWSTR ini, ULONG_PTR flags)
91 FIXME("(%s, %s, %lx)\n", debugstr_w(computer), debugstr_w(ini), flags);
92 return ERROR_SUCCESS;
95 /*************************************************************
96 * LoadPerfCounterTextStringsA (loadperf.@)
98 * NOTES
99 * See LoadPerfCounterTextStringsW
101 DWORD WINAPI LoadPerfCounterTextStringsA(LPCSTR cmdline, BOOL quiet)
103 DWORD ret;
104 LPWSTR cmdlineW = NULL;
106 if (cmdline && !(cmdlineW = strdupAW(cmdline))) return ERROR_OUTOFMEMORY;
108 ret = LoadPerfCounterTextStringsW(cmdlineW, quiet);
110 HeapFree(GetProcessHeap(), 0, cmdlineW);
112 return ret;
115 /*************************************************************
116 * LoadPerfCounterTextStringsW (loadperf.@)
118 * PARAMS
119 * cmdline [in] Last argument in command line - ini file to be used
120 * quiet [in] FALSE - the function may write to stdout
123 DWORD WINAPI LoadPerfCounterTextStringsW(LPCWSTR cmdline, BOOL quiet)
125 FIXME("(%s, %d): stub\n", debugstr_w(cmdline), quiet);
127 return ERROR_SUCCESS;
130 /*************************************************************
131 * UnloadPerfCounterTextStringsA (loadperf.@)
133 * NOTES
134 * See UnloadPerfCounterTextStringsW
136 DWORD WINAPI UnloadPerfCounterTextStringsA(LPCSTR cmdline, BOOL quiet)
138 DWORD ret;
139 LPWSTR cmdlineW = NULL;
141 if (cmdline && !(cmdlineW = strdupAW(cmdline))) return ERROR_OUTOFMEMORY;
143 ret = UnloadPerfCounterTextStringsW(cmdlineW, quiet);
145 HeapFree(GetProcessHeap(), 0, cmdlineW);
147 return ret;
150 /*************************************************************
151 * UnloadPerfCounterTextStringsW (loadperf.@)
153 * PARAMS
154 * cmdline [in] Last argument in command line - application counters to be removed
155 * quiet [in] FALSE - the function may write to stdout
158 DWORD WINAPI UnloadPerfCounterTextStringsW(LPCWSTR cmdline, BOOL quiet)
160 FIXME("(%s, %d): stub\n", debugstr_w(cmdline), quiet);
162 return ERROR_SUCCESS;