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