iphlpapi: Implement ConvertInterfaceAliasToLuid().
[wine.git] / programs / icinfo / icinfo.c
blob25b847b5a365abba3c72716ef5fe28bb58b15c7b
1 /*
2 * Copyright 1999 Marcus Meissner
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include <stdio.h>
20 #include <string.h>
21 #include "windows.h"
22 #include "mmsystem.h"
23 #include "vfw.h"
25 static int WINAPIV mywprintf(const WCHAR *format, ...)
27 static char output_bufA[65536];
28 static WCHAR output_bufW[sizeof(output_bufA)];
29 __ms_va_list parms;
30 DWORD nOut;
31 BOOL res = FALSE;
32 HANDLE hout = GetStdHandle(STD_OUTPUT_HANDLE);
34 __ms_va_start(parms, format);
35 vswprintf(output_bufW, ARRAY_SIZE(output_bufW), format, parms);
36 __ms_va_end(parms);
38 /* Try to write as unicode whenever we think it's a console */
39 if (((DWORD_PTR)hout & 3) == 3)
41 res = WriteConsoleW(hout, output_bufW, lstrlenW(output_bufW), &nOut, NULL);
43 else
45 DWORD convertedChars;
47 /* Convert to OEM, then output */
48 convertedChars = WideCharToMultiByte(GetConsoleOutputCP(), 0, output_bufW, -1,
49 output_bufA, sizeof(output_bufA),
50 NULL, NULL);
51 res = WriteFile(hout, output_bufA, convertedChars, &nOut, FALSE);
54 return res ? nOut : 0;
57 int __cdecl wmain(int argc, WCHAR* argv[])
59 int i, n=0,doabout=0,doconfigure=0;
61 for (i = 1; i < argc; i++) {
62 if (!lstrcmpW(argv[i], L"-about"))
63 doabout = 1;
64 else if (!lstrcmpW(argv[i], L"-configure"))
65 doconfigure = 1;
66 else {
67 mywprintf(L"Unknown option: %s\n", argv[i]);
68 return -1;
72 mywprintf(L"%s", L"Currently installed Video Compressors:\n");
73 while (1) {
74 ICINFO ii;
75 HIC hic;
77 ii.dwSize = sizeof(ii);
78 if (!ICInfo(ICTYPE_VIDEO,n++,&ii))
79 break;
80 if (!(hic=ICOpen(ii.fccType,ii.fccHandler,ICMODE_QUERY)))
81 continue;
82 if (!ICGetInfo(hic,&ii,sizeof(ii))) {
83 ICClose(hic);
84 continue;
87 mywprintf(L"%c%c%c%c.%c%c%c%c: %s\n",
88 LOBYTE(ii.fccType),LOBYTE(ii.fccType>>8),LOBYTE(ii.fccType>>16),LOBYTE(ii.fccType>>24),
89 LOBYTE(ii.fccHandler),LOBYTE(ii.fccHandler>>8),LOBYTE(ii.fccHandler>>16),LOBYTE(ii.fccHandler>>24),
90 ii.szName);
91 mywprintf(L"\tdwFlags: 0x%08x (",ii.dwFlags);
93 if (ii.dwFlags & VIDCF_QUALITY) mywprintf(L"%s ", L"VIDCF_QUALITY");
94 if (ii.dwFlags & VIDCF_CRUNCH) mywprintf(L"%s ", L"VIDCF_CRUNCH");
95 if (ii.dwFlags & VIDCF_TEMPORAL) mywprintf(L"%s ", L"VIDCF_TEMPORAL");
96 if (ii.dwFlags & VIDCF_COMPRESSFRAMES) mywprintf(L"%s ", L"VIDCF_COMPRESSFRAMES");
97 if (ii.dwFlags & VIDCF_DRAW) mywprintf(L"%s ", L"VIDCF_DRAW");
98 if (ii.dwFlags & VIDCF_FASTTEMPORALC) mywprintf(L"%s ", L"VIDCF_FASTTEMPORALC");
99 if (ii.dwFlags & VIDCF_FASTTEMPORALD) mywprintf(L"%s ", L"VIDCF_FASTTEMPORALD");
100 if (ii.dwFlags & VIDCF_QUALITYTIME) mywprintf(L"%s ", L"VIDCF_QUALITYTIME");
102 mywprintf(L"%s", L")\n");
103 mywprintf(L"\tdwVersion: 0x%08x\n", ii.dwVersion);
104 mywprintf(L"\tdwVersionICM: 0x%08x\n", ii.dwVersionICM);
105 mywprintf(L"\tszDescription: %s\n", ii.szDescription);
106 if (doabout) ICAbout(hic,0);
107 if (doconfigure && ICQueryConfigure(hic))
108 ICConfigure(hic,0);
109 ICClose(hic);
111 return 0;