comdlg32: Use unicode APIs to react to the change printer combo.
[wine] / dlls / loadperf / loadperf_main.c
1 /*
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"
27 #include "winerror.h"
28 #include "winnls.h"
29 #include "wine/debug.h"
30
31 #include "loadperf.h"
32
33 WINE_DEFAULT_DEBUG_CHANNEL(loadperf);
34
35 BOOL 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 }
52
53 /*************************************************************
54  *     LoadPerfCounterTextStringsA (loadperf.@)
55  *
56  * NOTES
57  *   See LoadPerfCounterTextStringsW
58  */
59 DWORD WINAPI LoadPerfCounterTextStringsA(LPCSTR cmdline, BOOL quiet)
60 {
61     DWORD ret;
62     LPWSTR cmdlineW = NULL;
63
64     if (cmdline)
65     {
66         INT len = MultiByteToWideChar(CP_ACP, 0, cmdline, -1, NULL, 0);
67         cmdlineW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
68         if (!cmdlineW) return ERROR_NOT_ENOUGH_MEMORY;
69         MultiByteToWideChar(CP_ACP, 0, cmdline, -1, cmdlineW, len);
70     }
71
72     ret = LoadPerfCounterTextStringsW(cmdlineW, quiet);
73
74     HeapFree(GetProcessHeap(), 0, cmdlineW);
75
76     return ret;
77 }
78
79 /*************************************************************
80  *     LoadPerfCounterTextStringsW (loadperf.@)
81  *
82  * PARAMS
83  *   cmdline [in] Last argument in command line - ini file to be used
84  *   quiet   [in] FALSE - the function may write to stdout
85  *
86  */
87 DWORD WINAPI LoadPerfCounterTextStringsW(LPCWSTR cmdline, BOOL quiet)
88 {
89     FIXME("(%s, %d): stub\n", debugstr_w(cmdline), quiet);
90
91     return ERROR_SUCCESS;
92 }
93
94 /*************************************************************
95  *     UnloadPerfCounterTextStringsA (loadperf.@)
96  *
97  * NOTES
98  *   See UnloadPerfCounterTextStringsW
99  */
100 DWORD WINAPI UnloadPerfCounterTextStringsA(LPCSTR cmdline, BOOL verbose)
101 {
102     DWORD ret;
103     LPWSTR cmdlineW = NULL;
104
105     if (cmdline)
106     {
107         INT len = MultiByteToWideChar(CP_ACP, 0, cmdline, -1, NULL, 0);
108         cmdlineW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
109         if (!cmdlineW) return ERROR_NOT_ENOUGH_MEMORY;
110         MultiByteToWideChar(CP_ACP, 0, cmdline, -1, cmdlineW, len);
111     }
112
113     ret = UnloadPerfCounterTextStringsW(cmdlineW, verbose);
114
115     HeapFree(GetProcessHeap(), 0, cmdlineW);
116
117     return ret;
118 }
119
120 /*************************************************************
121  *     UnloadPerfCounterTextStringsW (loadperf.@)
122  *
123  * PARAMS
124  *   cmdline [in] Last argument in command line - application counters to be removed
125  *   verbose [in] TRUE - the function may write to stdout
126  *
127  */
128 DWORD WINAPI UnloadPerfCounterTextStringsW(LPCWSTR cmdline, BOOL verbose)
129 {
130     FIXME("(%s, %d): stub\n", debugstr_w(cmdline), verbose);
131
132     return ERROR_SUCCESS;
133 }