winmm: dwBytesRecorded controls how much is played, not dwBufferLength.
[wine/hramrach.git] / programs / dxdiag / main.c
blob4e73b4b4cc97622b0c2fce75b1a540766b3a5e87
1 /*
2 * DxDiag Implementation
4 * Copyright 2009 Austin English
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 #define WIN32_LEAN_AND_MEAN
22 #include <windows.h>
23 #include "wine/debug.h"
24 #include "wine/unicode.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(dxdiag);
29 Process options [/WHQL:ON|OFF][/X outfile][/T outfile]
30 Returns TRUE if options were present, FALSE otherwise
31 FIXME: Native behavior seems to be:
32 Only one of /X and /T is allowed, /WHQL must come before /X and /T,
33 quotes are optional around the filename, even if it contains spaces.
36 static BOOL ProcessCommandLine(const WCHAR *s)
38 WCHAR outfile[MAX_PATH+1];
39 int opt_t = FALSE;
40 int opt_x = FALSE;
41 int opt_help = FALSE;
42 int opt_given = FALSE;
43 int want_arg = FALSE;
45 outfile[0] = 0;
46 while (*s) {
47 /* Skip whitespace before arg */
48 while (*s == ' ')
49 s++;
50 /* Check for option */
51 if (*s != '-' && *s != '/')
52 return FALSE;
53 s++;
54 switch (*s++) {
55 case 'T':
56 case 't': opt_t = TRUE; want_arg = TRUE; opt_given = TRUE; break;
57 case 'X':
58 case 'x': opt_x = TRUE; want_arg = TRUE; opt_given = TRUE; break;
59 case 'W':
60 case 'w':
61 opt_given = TRUE;
62 while (isalphaW(*s) || *s == ':')
63 s++;
64 break;
65 default: opt_help = TRUE; opt_given = TRUE; break;
67 /* Skip any spaces before next option or filename */
68 while (*s == ' ')
69 s++;
70 if (want_arg) {
71 int i;
72 if (*s == '"')
73 s++;
74 for (i=0; i < MAX_PATH && *s && *s != '"'; i++, s++)
75 outfile[i] = *s;
76 outfile[i] = 0;
77 break;
80 if (opt_help)
81 WINE_FIXME("help unimplemented\n");
82 if (opt_t)
83 WINE_FIXME("/t unimplemented\n");
84 if (opt_x)
85 WINE_FIXME("/x unimplemented\n");
86 return opt_given;
89 int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cmdshow)
91 if (ProcessCommandLine(cmdline))
92 return 0;
94 return 0;