Synchronize with trunk revision 59636 (just before Alex's CreateProcess revamp).
[reactos.git] / dll / win32 / shlwapi / stopwatch.c
1 /*
2 * Stopwatch Functions
3 *
4 * Copyright 2004 Jon Griffiths
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 * NOTES
21 * These functions probably never need to be implemented unless we
22 * A) Rewrite explorer from scratch, and
23 * B) Want to use a substandard API to tune its performance.
24 */
25
26 #define WIN32_NO_STATUS
27
28 #include <config.h>
29 //#include "wine/port.h"
30
31 #include <stdarg.h>
32 //#include <string.h>
33 //#include <stdlib.h>
34
35 #define NONAMELESSUNION
36 #define NONAMELESSSTRUCT
37 #include <windef.h>
38 #include <winbase.h>
39 //#include "winreg.h"
40 #include <winternl.h>
41 #include <wine/debug.h>
42
43 WINE_DEFAULT_DEBUG_CHANNEL(shell);
44
45 /*************************************************************************
46 * @ [SHLWAPI.241]
47 *
48 * Get the current performance monitoring mode.
49 *
50 * PARAMS
51 * None.
52 *
53 * RETURNS
54 * The current performance monitoring mode. This is zero if monitoring
55 * is disabled (the default).
56 *
57 * NOTES
58 * If this function returns 0, no further StopWatch functions should be called.
59 */
60 DWORD WINAPI StopWatchMode(void)
61 {
62 FIXME("() stub!\n");
63 return 0;
64 }
65
66 /*************************************************************************
67 * @ [SHLWAPI.242]
68 *
69 * Write captured performance nodes to a log file.
70 *
71 * PARAMS
72 * None.
73 *
74 * RETURNS
75 * Nothing.
76 */
77 void WINAPI StopWatchFlush(void)
78 {
79 FIXME("() stub!\n");
80 }
81
82 /*************************************************************************
83 * @ [SHLWAPI.244]
84 *
85 * Write a performance event to a log file
86 *
87 * PARAMS
88 * dwClass [I] Class of event
89 * lpszStr [I] Text of event to log
90 * dwUnknown [I] Unknown
91 * dwMode [I] Mode flags
92 * dwTimeStamp [I] Timestamp
93 *
94 * RETURNS
95 * Success: ERROR_SUCCESS.
96 * Failure: A standard Win32 error code indicating the failure.
97 */
98 DWORD WINAPI StopWatchW(DWORD dwClass, LPCWSTR lpszStr, DWORD dwUnknown,
99 DWORD dwMode, DWORD dwTimeStamp)
100 {
101 FIXME("(%d,%s,%d,%d,%d) stub!\n", dwClass, debugstr_w(lpszStr),
102 dwUnknown, dwMode, dwTimeStamp);
103 return ERROR_SUCCESS;
104 }
105
106 /*************************************************************************
107 * @ [SHLWAPI.243]
108 *
109 * See StopWatchW.
110 */
111 DWORD WINAPI StopWatchA(DWORD dwClass, LPCSTR lpszStr, DWORD dwUnknown,
112 DWORD dwMode, DWORD dwTimeStamp)
113 { DWORD retval;
114 UNICODE_STRING szStrW;
115
116 if(lpszStr) RtlCreateUnicodeStringFromAsciiz(&szStrW, lpszStr);
117 else szStrW.Buffer = NULL;
118
119 retval = StopWatchW(dwClass, szStrW.Buffer, dwUnknown, dwMode, dwTimeStamp);
120
121 RtlFreeUnicodeString(&szStrW);
122 return retval;
123 }
124
125 /*************************************************************************
126 * @ [SHLWAPI.245]
127 *
128 * Log a shell frame event.
129 *
130 * PARAMS
131 * hWnd [I] Window having the event
132 * pvUnknown1 [I] Unknown
133 * bUnknown2 [I] Unknown
134 * pClassWnd [I] Window of class to log
135 *
136 * RETURNS
137 * Nothing.
138 */
139 void WINAPI StopWatch_TimerHandler(HWND hWnd, PVOID pvUnknown1, BOOL bUnknown2, HWND *pClassWnd)
140 {
141 FIXME("(%p,%p,%d,%p) stub!\n", hWnd, pvUnknown1, bUnknown2 ,pClassWnd);
142 }
143
144 /* FIXME: Parameters for @246:StopWatch_CheckMsg unknown */
145
146 /*************************************************************************
147 * @ [SHLWAPI.247]
148 *
149 * Log the start of an applet.
150 *
151 * PARAMS
152 * lpszName [I] Name of the applet
153 *
154 * RETURNS
155 * Nothing.
156 */
157 void WINAPI StopWatch_MarkFrameStart(LPCSTR lpszName)
158 {
159 FIXME("(%s) stub!\n", debugstr_a(lpszName));
160 }
161
162 /* FIXME: Parameters for @248:StopWatch_MarkSameFrameStart unknown */
163
164 /*************************************************************************
165 * @ [SHLWAPI.249]
166 *
167 * Log a java applet stopping.
168 *
169 * PARAMS
170 * lpszEvent [I] Name of the event (applet)
171 * hWnd [I] Window running the applet
172 * dwReserved [I] Unused
173 *
174 * RETURNS
175 * Nothing.
176 */
177 void WINAPI StopWatch_MarkJavaStop(LPCWSTR lpszEvent, HWND hWnd, DWORD dwReserved)
178 {
179 FIXME("(%s,%p,0x%08x) stub!\n", debugstr_w(lpszEvent), hWnd, dwReserved);
180 }
181
182 /*************************************************************************
183 * @ [SHLWAPI.250]
184 *
185 * Read the performance counter.
186 *
187 * PARAMS
188 * None.
189 *
190 * RETURNS
191 * The low 32 bits of the current performance counter reading.
192 */
193 DWORD WINAPI GetPerfTime(void)
194 {
195 static LONG64 iCounterFreq = 0;
196 LARGE_INTEGER iCounter;
197
198 TRACE("()\n");
199
200 if (!iCounterFreq)
201 QueryPerformanceFrequency((LARGE_INTEGER*)&iCounterFreq);
202
203 QueryPerformanceCounter(&iCounter);
204 iCounter.QuadPart = iCounter.QuadPart * 1000 / iCounterFreq;
205 return iCounter.u.LowPart;
206 }
207
208 /* FIXME: Parameters for @251:StopWatch_DispatchTime unknown */
209
210 /*************************************************************************
211 * @ [SHLWAPI.252]
212 *
213 * Set an as yet unidentified performance value.
214 *
215 * PARAMS
216 * dwUnknown [I] Value to set
217 *
218 * RETURNS
219 * dwUnknown.
220 */
221 DWORD WINAPI StopWatch_SetMsgLastLocation(DWORD dwUnknown)
222 {
223 FIXME("(%d) stub!\n", dwUnknown);
224
225 return dwUnknown;
226 }
227
228 /* FIXME: Parameters for @253:StopWatchExA, 254:StopWatchExW unknown */