Commit 2a1da89f authored by Alexandre Julliard's avatar Alexandre Julliard

dxdiagn: Build with msvcrt.

parent 351ffd93
MODULE = dxdiagn.dll MODULE = dxdiagn.dll
IMPORTS = strmiids dxguid uuid d3d9 ddraw version ole32 oleaut32 user32 advapi32 IMPORTS = strmiids dxguid uuid d3d9 ddraw version ole32 oleaut32 user32 advapi32
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \ C_SRCS = \
container.c \ container.c \
dxdiag_main.c \ dxdiag_main.c \
......
...@@ -19,12 +19,10 @@ ...@@ -19,12 +19,10 @@
* *
*/ */
#include "config.h"
#define COBJMACROS #define COBJMACROS
#include "dxdiag_private.h" #include "dxdiag_private.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(dxdiag); WINE_DEFAULT_DEBUG_CHANNEL(dxdiag);
...@@ -114,7 +112,7 @@ static HRESULT WINAPI IDxDiagContainerImpl_EnumChildContainerNames(IDxDiagContai ...@@ -114,7 +112,7 @@ static HRESULT WINAPI IDxDiagContainerImpl_EnumChildContainerNames(IDxDiagContai
if (dwIndex == i) { if (dwIndex == i) {
TRACE("Found container name %s, copying string\n", debugstr_w(p->contName)); TRACE("Found container name %s, copying string\n", debugstr_w(p->contName));
lstrcpynW(pwszContainer, p->contName, cchContainer); lstrcpynW(pwszContainer, p->contName, cchContainer);
return (cchContainer <= strlenW(p->contName)) ? return (cchContainer <= lstrlenW(p->contName)) ?
DXDIAG_E_INSUFFICIENT_BUFFER : S_OK; DXDIAG_E_INSUFFICIENT_BUFFER : S_OK;
} }
++i; ++i;
...@@ -157,12 +155,12 @@ static HRESULT WINAPI IDxDiagContainerImpl_GetChildContainer(IDxDiagContainer *i ...@@ -157,12 +155,12 @@ static HRESULT WINAPI IDxDiagContainerImpl_GetChildContainer(IDxDiagContainer *i
*ppInstance = NULL; *ppInstance = NULL;
tmp_len = strlenW(pwszContainer) + 1; tmp_len = lstrlenW(pwszContainer) + 1;
orig_tmp = tmp = HeapAlloc(GetProcessHeap(), 0, tmp_len * sizeof(WCHAR)); orig_tmp = tmp = HeapAlloc(GetProcessHeap(), 0, tmp_len * sizeof(WCHAR));
if (NULL == tmp) return E_FAIL; if (NULL == tmp) return E_FAIL;
lstrcpynW(tmp, pwszContainer, tmp_len); lstrcpynW(tmp, pwszContainer, tmp_len);
cur = strchrW(tmp, '.'); cur = wcschr(tmp, '.');
while (NULL != cur) { while (NULL != cur) {
*cur = '\0'; /* cut tmp string to '.' */ *cur = '\0'; /* cut tmp string to '.' */
if (!*(cur + 1)) break; /* Account for a lone terminating period, as in "cont1.cont2.". */ if (!*(cur + 1)) break; /* Account for a lone terminating period, as in "cont1.cont2.". */
...@@ -172,7 +170,7 @@ static HRESULT WINAPI IDxDiagContainerImpl_GetChildContainer(IDxDiagContainer *i ...@@ -172,7 +170,7 @@ static HRESULT WINAPI IDxDiagContainerImpl_GetChildContainer(IDxDiagContainer *i
goto on_error; goto on_error;
cur++; /* go after '.' (just replaced by \0) */ cur++; /* go after '.' (just replaced by \0) */
tmp = cur; tmp = cur;
cur = strchrW(tmp, '.'); cur = wcschr(tmp, '.');
} }
TRACE("Trying to get container %s\n", debugstr_w(tmp)); TRACE("Trying to get container %s\n", debugstr_w(tmp));
...@@ -219,7 +217,7 @@ static HRESULT WINAPI IDxDiagContainerImpl_EnumPropNames(IDxDiagContainer *iface ...@@ -219,7 +217,7 @@ static HRESULT WINAPI IDxDiagContainerImpl_EnumPropNames(IDxDiagContainer *iface
if (dwIndex == i) { if (dwIndex == i) {
TRACE("Found property name %s, copying string\n", debugstr_w(p->propName)); TRACE("Found property name %s, copying string\n", debugstr_w(p->propName));
lstrcpynW(pwszPropName, p->propName, cchPropName); lstrcpynW(pwszPropName, p->propName, cchPropName);
return (cchPropName <= strlenW(p->propName)) ? return (cchPropName <= lstrlenW(p->propName)) ?
DXDIAG_E_INSUFFICIENT_BUFFER : S_OK; DXDIAG_E_INSUFFICIENT_BUFFER : S_OK;
} }
++i; ++i;
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#define COBJMACROS #define COBJMACROS
#include "config.h"
#include <stdarg.h> #include <stdarg.h>
#include "windef.h" #include "windef.h"
......
...@@ -20,13 +20,11 @@ ...@@ -20,13 +20,11 @@
* *
*/ */
#include "config.h"
#define COBJMACROS #define COBJMACROS
#define NONAMELESSUNION #define NONAMELESSUNION
#define NONAMELESSSTRUCT #define NONAMELESSSTRUCT
#include "dxdiag_private.h" #include "dxdiag_private.h"
#include "wine/unicode.h"
#include "winver.h" #include "winver.h"
#include "objidl.h" #include "objidl.h"
#include "uuids.h" #include "uuids.h"
...@@ -270,13 +268,13 @@ static IDxDiagContainerImpl_Container *allocate_information_node(const WCHAR *na ...@@ -270,13 +268,13 @@ static IDxDiagContainerImpl_Container *allocate_information_node(const WCHAR *na
if (name) if (name)
{ {
ret->contName = HeapAlloc(GetProcessHeap(), 0, (strlenW(name) + 1) * sizeof(*name)); ret->contName = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(name) + 1) * sizeof(*name));
if (!ret->contName) if (!ret->contName)
{ {
HeapFree(GetProcessHeap(), 0, ret); HeapFree(GetProcessHeap(), 0, ret);
return NULL; return NULL;
} }
strcpyW(ret->contName, name); lstrcpyW(ret->contName, name);
} }
list_init(&ret->subContainers); list_init(&ret->subContainers);
...@@ -293,13 +291,13 @@ static IDxDiagContainerImpl_Property *allocate_property_information(const WCHAR ...@@ -293,13 +291,13 @@ static IDxDiagContainerImpl_Property *allocate_property_information(const WCHAR
if (!ret) if (!ret)
return NULL; return NULL;
ret->propName = HeapAlloc(GetProcessHeap(), 0, (strlenW(name) + 1) * sizeof(*name)); ret->propName = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(name) + 1) * sizeof(*name));
if (!ret->propName) if (!ret->propName)
{ {
HeapFree(GetProcessHeap(), 0, ret); HeapFree(GetProcessHeap(), 0, ret);
return NULL; return NULL;
} }
strcpyW(ret->propName, name); lstrcpyW(ret->propName, name);
return ret; return ret;
} }
...@@ -522,7 +520,7 @@ static HRESULT fill_language_information(IDxDiagContainerImpl_Container *node) ...@@ -522,7 +520,7 @@ static HRESULT fill_language_information(IDxDiagContainerImpl_Container *node)
LoadStringW(dxdiagn_instance, IDS_REGIONAL_SETTING, regional_setting, ARRAY_SIZE(regional_setting)); LoadStringW(dxdiagn_instance, IDS_REGIONAL_SETTING, regional_setting, ARRAY_SIZE(regional_setting));
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SNATIVELANGNAME, user_lang, ARRAY_SIZE(user_lang)); GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SNATIVELANGNAME, user_lang, ARRAY_SIZE(user_lang));
snprintfW(language_str, ARRAY_SIZE(language_str), languages_fmtW, system_lang, regional_setting, swprintf(language_str, ARRAY_SIZE(language_str), languages_fmtW, system_lang, regional_setting,
user_lang); user_lang);
hr = add_bstr_property(node, szLanguagesLocalized, language_str); hr = add_bstr_property(node, szLanguagesLocalized, language_str);
...@@ -533,7 +531,7 @@ static HRESULT fill_language_information(IDxDiagContainerImpl_Container *node) ...@@ -533,7 +531,7 @@ static HRESULT fill_language_information(IDxDiagContainerImpl_Container *node)
GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT, LOCALE_SENGLANGUAGE, system_lang, ARRAY_SIZE(system_lang)); GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT, LOCALE_SENGLANGUAGE, system_lang, ARRAY_SIZE(system_lang));
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SENGLANGUAGE, user_lang, ARRAY_SIZE(user_lang)); GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SENGLANGUAGE, user_lang, ARRAY_SIZE(user_lang));
snprintfW(language_str, ARRAY_SIZE(language_str), languages_fmtW, system_lang, swprintf(language_str, ARRAY_SIZE(language_str), languages_fmtW, system_lang,
regional_setting_engW, user_lang); regional_setting_engW, user_lang);
hr = add_bstr_property(node, szLanguagesEnglish, language_str); hr = add_bstr_property(node, szLanguagesEnglish, language_str);
...@@ -562,7 +560,7 @@ static HRESULT fill_datetime_information(IDxDiagContainerImpl_Container *node) ...@@ -562,7 +560,7 @@ static HRESULT fill_datetime_information(IDxDiagContainerImpl_Container *node)
/* szTimeLocalized */ /* szTimeLocalized */
GetDateFormatW(LOCALE_USER_DEFAULT, DATE_LONGDATE, &curtime, NULL, date_str, ARRAY_SIZE(date_str)); GetDateFormatW(LOCALE_USER_DEFAULT, DATE_LONGDATE, &curtime, NULL, date_str, ARRAY_SIZE(date_str));
snprintfW(datetime_str, ARRAY_SIZE(datetime_str), datetime_fmtW, date_str, time_str); swprintf(datetime_str, ARRAY_SIZE(datetime_str), datetime_fmtW, date_str, time_str);
hr = add_bstr_property(node, szTimeLocalized, datetime_str); hr = add_bstr_property(node, szTimeLocalized, datetime_str);
if (FAILED(hr)) if (FAILED(hr))
...@@ -571,7 +569,7 @@ static HRESULT fill_datetime_information(IDxDiagContainerImpl_Container *node) ...@@ -571,7 +569,7 @@ static HRESULT fill_datetime_information(IDxDiagContainerImpl_Container *node)
/* szTimeEnglish */ /* szTimeEnglish */
GetDateFormatW(LOCALE_NEUTRAL, 0, &curtime, date_fmtW, date_str, ARRAY_SIZE(date_str)); GetDateFormatW(LOCALE_NEUTRAL, 0, &curtime, date_fmtW, date_str, ARRAY_SIZE(date_str));
snprintfW(datetime_str, ARRAY_SIZE(datetime_str), datetime_fmtW, date_str, time_str); swprintf(datetime_str, ARRAY_SIZE(datetime_str), datetime_fmtW, date_str, time_str);
hr = add_bstr_property(node, szTimeEnglish, datetime_str); hr = add_bstr_property(node, szTimeEnglish, datetime_str);
if (FAILED(hr)) if (FAILED(hr))
...@@ -676,7 +674,8 @@ static HRESULT fill_processor_information(IDxDiagContainerImpl_Container *node) ...@@ -676,7 +674,8 @@ static HRESULT fill_processor_information(IDxDiagContainerImpl_Container *node)
if(FAILED(hr)) if(FAILED(hr))
return hr; return hr;
sprintfW(print_buf, processor_fmtW, V_BSTR(&cpu_name), V_I4(&cpu_no), V_I4(&clock_speed)); swprintf(print_buf, ARRAY_SIZE(print_buf), processor_fmtW,
V_BSTR(&cpu_name), V_I4(&cpu_no), V_I4(&clock_speed));
VariantClear(&cpu_name); VariantClear(&cpu_name);
VariantClear(&cpu_no); VariantClear(&cpu_no);
VariantClear(&clock_speed); VariantClear(&clock_speed);
...@@ -800,7 +799,7 @@ static HRESULT build_systeminfo_tree(IDxDiagContainerImpl_Container *node) ...@@ -800,7 +799,7 @@ static HRESULT build_systeminfo_tree(IDxDiagContainerImpl_Container *node)
return hr; return hr;
/* FIXME: Roundoff should not be done with truncated division. */ /* FIXME: Roundoff should not be done with truncated division. */
snprintfW(print_buf, ARRAY_SIZE(print_buf), physmem_fmtW, swprintf(print_buf, ARRAY_SIZE(print_buf), physmem_fmtW,
(DWORD)(msex.ullTotalPhys / (1024 * 1024))); (DWORD)(msex.ullTotalPhys / (1024 * 1024)));
hr = add_bstr_property(node, szPhysicalMemoryEnglish, print_buf); hr = add_bstr_property(node, szPhysicalMemoryEnglish, print_buf);
if (FAILED(hr)) if (FAILED(hr))
...@@ -819,7 +818,7 @@ static HRESULT build_systeminfo_tree(IDxDiagContainerImpl_Container *node) ...@@ -819,7 +818,7 @@ static HRESULT build_systeminfo_tree(IDxDiagContainerImpl_Container *node)
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
snprintfW(print_buf, ARRAY_SIZE(print_buf), pagefile_fmtW, usedpage_mb, availpage_mb); swprintf(print_buf, ARRAY_SIZE(print_buf), pagefile_fmtW, usedpage_mb, availpage_mb);
hr = add_bstr_property(node, szPageFileEnglish, print_buf); hr = add_bstr_property(node, szPageFileEnglish, print_buf);
if (FAILED(hr)) if (FAILED(hr))
...@@ -993,7 +992,7 @@ static HRESULT fill_display_information_d3d(IDxDiagContainerImpl_Container *node ...@@ -993,7 +992,7 @@ static HRESULT fill_display_information_d3d(IDxDiagContainerImpl_Container *node
DWORD available_mem = 0; DWORD available_mem = 0;
BOOL hardware_accel; BOOL hardware_accel;
snprintfW(buffer, ARRAY_SIZE(buffer), adapterid_fmtW, index); swprintf(buffer, ARRAY_SIZE(buffer), adapterid_fmtW, index);
display_adapter = allocate_information_node(buffer); display_adapter = allocate_information_node(buffer);
if (!display_adapter) if (!display_adapter)
{ {
...@@ -1028,7 +1027,7 @@ static HRESULT fill_display_information_d3d(IDxDiagContainerImpl_Container *node ...@@ -1028,7 +1027,7 @@ static HRESULT fill_display_information_d3d(IDxDiagContainerImpl_Container *node
if (FAILED(hr)) if (FAILED(hr))
goto cleanup; goto cleanup;
snprintfW(buffer, ARRAY_SIZE(buffer), driverversion_fmtW, swprintf(buffer, ARRAY_SIZE(buffer), driverversion_fmtW,
HIWORD(adapter_info.DriverVersion.u.HighPart), LOWORD(adapter_info.DriverVersion.u.HighPart), HIWORD(adapter_info.DriverVersion.u.HighPart), LOWORD(adapter_info.DriverVersion.u.HighPart),
HIWORD(adapter_info.DriverVersion.u.LowPart), LOWORD(adapter_info.DriverVersion.u.LowPart)); HIWORD(adapter_info.DriverVersion.u.LowPart), LOWORD(adapter_info.DriverVersion.u.LowPart));
...@@ -1036,22 +1035,22 @@ static HRESULT fill_display_information_d3d(IDxDiagContainerImpl_Container *node ...@@ -1036,22 +1035,22 @@ static HRESULT fill_display_information_d3d(IDxDiagContainerImpl_Container *node
if (FAILED(hr)) if (FAILED(hr))
goto cleanup; goto cleanup;
snprintfW(buffer, ARRAY_SIZE(buffer), id_fmtW, adapter_info.VendorId); swprintf(buffer, ARRAY_SIZE(buffer), id_fmtW, adapter_info.VendorId);
hr = add_bstr_property(display_adapter, szVendorId, buffer); hr = add_bstr_property(display_adapter, szVendorId, buffer);
if (FAILED(hr)) if (FAILED(hr))
goto cleanup; goto cleanup;
snprintfW(buffer, ARRAY_SIZE(buffer), id_fmtW, adapter_info.DeviceId); swprintf(buffer, ARRAY_SIZE(buffer), id_fmtW, adapter_info.DeviceId);
hr = add_bstr_property(display_adapter, szDeviceId, buffer); hr = add_bstr_property(display_adapter, szDeviceId, buffer);
if (FAILED(hr)) if (FAILED(hr))
goto cleanup; goto cleanup;
snprintfW(buffer, ARRAY_SIZE(buffer), subsysid_fmtW, adapter_info.SubSysId); swprintf(buffer, ARRAY_SIZE(buffer), subsysid_fmtW, adapter_info.SubSysId);
hr = add_bstr_property(display_adapter, szSubSysId, buffer); hr = add_bstr_property(display_adapter, szSubSysId, buffer);
if (FAILED(hr)) if (FAILED(hr))
goto cleanup; goto cleanup;
snprintfW(buffer, ARRAY_SIZE(buffer), id_fmtW, adapter_info.Revision); swprintf(buffer, ARRAY_SIZE(buffer), id_fmtW, adapter_info.Revision);
hr = add_bstr_property(display_adapter, szRevisionId, buffer); hr = add_bstr_property(display_adapter, szRevisionId, buffer);
if (FAILED(hr)) if (FAILED(hr))
goto cleanup; goto cleanup;
...@@ -1085,7 +1084,7 @@ static HRESULT fill_display_information_d3d(IDxDiagContainerImpl_Container *node ...@@ -1085,7 +1084,7 @@ static HRESULT fill_display_information_d3d(IDxDiagContainerImpl_Container *node
if (FAILED(hr)) if (FAILED(hr))
goto cleanup; goto cleanup;
snprintfW(buffer, ARRAY_SIZE(buffer), mode_fmtW, adapter_mode.Width, adapter_mode.Height, swprintf(buffer, ARRAY_SIZE(buffer), mode_fmtW, adapter_mode.Width, adapter_mode.Height,
depth_for_pixelformat(adapter_mode.Format), adapter_mode.RefreshRate); depth_for_pixelformat(adapter_mode.Format), adapter_mode.RefreshRate);
hr = add_bstr_property(display_adapter, szDisplayModeLocalized, buffer); hr = add_bstr_property(display_adapter, szDisplayModeLocalized, buffer);
...@@ -1120,7 +1119,7 @@ static HRESULT fill_display_information_d3d(IDxDiagContainerImpl_Container *node ...@@ -1120,7 +1119,7 @@ static HRESULT fill_display_information_d3d(IDxDiagContainerImpl_Container *node
if (!get_texture_memory(&adapter_info.DeviceIdentifier, &available_mem)) if (!get_texture_memory(&adapter_info.DeviceIdentifier, &available_mem))
WARN("get_texture_memory helper failed\n"); WARN("get_texture_memory helper failed\n");
snprintfW(buffer, ARRAY_SIZE(buffer), mem_fmt, available_mem / 1000000.0f); swprintf(buffer, ARRAY_SIZE(buffer), mem_fmt, available_mem / 1000000.0f);
hr = add_bstr_property(display_adapter, szDisplayMemoryLocalized, buffer); hr = add_bstr_property(display_adapter, szDisplayMemoryLocalized, buffer);
if (FAILED(hr)) if (FAILED(hr))
...@@ -1299,7 +1298,7 @@ static HRESULT fill_display_information_fallback(IDxDiagContainerImpl_Container ...@@ -1299,7 +1298,7 @@ static HRESULT fill_display_information_fallback(IDxDiagContainerImpl_Container
{ {
static const WCHAR mem_fmt[] = {'%','.','1','f',' ','M','B',0}; static const WCHAR mem_fmt[] = {'%','.','1','f',' ','M','B',0};
snprintfW(buffer, ARRAY_SIZE(buffer), mem_fmt, tmp / 1000000.0f); swprintf(buffer, ARRAY_SIZE(buffer), mem_fmt, tmp / 1000000.0f);
hr = add_bstr_property(display_adapter, szDisplayMemoryLocalized, buffer); hr = add_bstr_property(display_adapter, szDisplayMemoryLocalized, buffer);
if (FAILED(hr)) if (FAILED(hr))
...@@ -1476,7 +1475,7 @@ static HRESULT fill_file_description(IDxDiagContainerImpl_Container *node, const ...@@ -1476,7 +1475,7 @@ static HRESULT fill_file_description(IDxDiagContainerImpl_Container *node, const
if (boolret) if (boolret)
{ {
snprintfW(szVersion_v, ARRAY_SIZE(szVersion_v), szVersionFormat, swprintf(szVersion_v, ARRAY_SIZE(szVersion_v), szVersionFormat,
HIWORD(pFileInfo->dwFileVersionMS), LOWORD(pFileInfo->dwFileVersionMS), HIWORD(pFileInfo->dwFileVersionMS), LOWORD(pFileInfo->dwFileVersionMS),
HIWORD(pFileInfo->dwFileVersionLS), LOWORD(pFileInfo->dwFileVersionLS)); HIWORD(pFileInfo->dwFileVersionLS), LOWORD(pFileInfo->dwFileVersionLS));
...@@ -1557,7 +1556,7 @@ static HRESULT build_directxfiles_tree(IDxDiagContainerImpl_Container *node) ...@@ -1557,7 +1556,7 @@ static HRESULT build_directxfiles_tree(IDxDiagContainerImpl_Container *node)
WCHAR szFileID[5]; WCHAR szFileID[5];
IDxDiagContainerImpl_Container *file_container; IDxDiagContainerImpl_Container *file_container;
snprintfW(szFileID, ARRAY_SIZE(szFileID), szFormat, i); swprintf(szFileID, ARRAY_SIZE(szFileID), szFormat, i);
file_container = allocate_information_node(szFileID); file_container = allocate_information_node(szFileID);
if (!file_container) if (!file_container)
...@@ -1632,7 +1631,7 @@ static HRESULT fill_filter_data_information(IDxDiagContainerImpl_Container *subc ...@@ -1632,7 +1631,7 @@ static HRESULT fill_filter_data_information(IDxDiagContainerImpl_Container *subc
goto cleanup; goto cleanup;
pRF = ((REGFILTER2**)ppRF)[0]; pRF = ((REGFILTER2**)ppRF)[0];
snprintfW(bufferW, ARRAY_SIZE(bufferW), szVersionFormat, pRF->dwVersion); swprintf(bufferW, ARRAY_SIZE(bufferW), szVersionFormat, pRF->dwVersion);
hr = add_bstr_property(subcont, szVersionW, bufferW); hr = add_bstr_property(subcont, szVersionW, bufferW);
if (FAILED(hr)) if (FAILED(hr))
goto cleanup; goto cleanup;
...@@ -1804,7 +1803,7 @@ static HRESULT build_directshowfilters_tree(IDxDiagContainerImpl_Container *node ...@@ -1804,7 +1803,7 @@ static HRESULT build_directshowfilters_tree(IDxDiagContainerImpl_Container *node
WCHAR bufferW[10]; WCHAR bufferW[10];
IDxDiagContainerImpl_Container *subcont; IDxDiagContainerImpl_Container *subcont;
snprintfW(bufferW, ARRAY_SIZE(bufferW), szIdFormat, i); swprintf(bufferW, ARRAY_SIZE(bufferW), szIdFormat, i);
subcont = allocate_information_node(bufferW); subcont = allocate_information_node(bufferW);
if (!subcont) if (!subcont)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment