[URLMON] Sync with Wine Staging 4.0. CORE-15682

This commit is contained in:
Amine Khaldi 2019-02-04 13:04:30 +01:00
parent f4c8f8de72
commit ad73c0a040
12 changed files with 48 additions and 50 deletions

View file

@ -154,12 +154,12 @@ static void expand_command(install_ctx_t *ctx, const WCHAR *cmd, WCHAR *buf, siz
memcpy(buf+len, prev_ptr, ptr-prev_ptr);
len += ptr-prev_ptr;
if(!strncmpiW(ptr, expand_dirW, sizeof(expand_dirW)/sizeof(WCHAR))) {
if(!strncmpiW(ptr, expand_dirW, ARRAY_SIZE(expand_dirW))) {
len2 = strlenW(ctx->tmp_dir);
if(buf)
memcpy(buf+len, ctx->tmp_dir, len2*sizeof(WCHAR));
len += len2;
ptr += sizeof(expand_dirW)/sizeof(WCHAR);
ptr += ARRAY_SIZE(expand_dirW);
}else {
FIXME("Can't expand %s\n", debugstr_w(ptr));
if(buf)
@ -185,7 +185,7 @@ static HRESULT process_hook_section(install_ctx_t *ctx, const WCHAR *sect_name)
static const WCHAR runW[] = {'r','u','n',0};
len = GetPrivateProfileStringW(sect_name, NULL, NULL, buf, sizeof(buf)/sizeof(*buf), ctx->install_file);
len = GetPrivateProfileStringW(sect_name, NULL, NULL, buf, ARRAY_SIZE(buf), ctx->install_file);
if(!len)
return S_OK;
@ -194,7 +194,7 @@ static HRESULT process_hook_section(install_ctx_t *ctx, const WCHAR *sect_name)
WCHAR *cmd;
size_t size;
len = GetPrivateProfileStringW(sect_name, runW, NULL, val, sizeof(val)/sizeof(*val), ctx->install_file);
len = GetPrivateProfileStringW(sect_name, runW, NULL, val, ARRAY_SIZE(val), ctx->install_file);
TRACE("Run %s\n", debugstr_w(val));
@ -229,14 +229,14 @@ static HRESULT install_inf_file(install_ctx_t *ctx)
static const WCHAR setup_hooksW[] = {'S','e','t','u','p',' ','H','o','o','k','s',0};
static const WCHAR add_codeW[] = {'A','d','d','.','C','o','d','e',0};
len = GetPrivateProfileStringW(setup_hooksW, NULL, NULL, buf, sizeof(buf)/sizeof(*buf), ctx->install_file);
len = GetPrivateProfileStringW(setup_hooksW, NULL, NULL, buf, ARRAY_SIZE(buf), ctx->install_file);
if(len) {
default_install = FALSE;
for(key = buf; *key; key += strlenW(key)+1) {
TRACE("[Setup Hooks] key: %s\n", debugstr_w(key));
len = GetPrivateProfileStringW(setup_hooksW, key, NULL, sect_name, sizeof(sect_name)/sizeof(*sect_name),
len = GetPrivateProfileStringW(setup_hooksW, key, NULL, sect_name, ARRAY_SIZE(sect_name),
ctx->install_file);
if(!len) {
WARN("Could not get key value\n");
@ -249,14 +249,14 @@ static HRESULT install_inf_file(install_ctx_t *ctx)
}
}
len = GetPrivateProfileStringW(add_codeW, NULL, NULL, buf, sizeof(buf)/sizeof(*buf), ctx->install_file);
len = GetPrivateProfileStringW(add_codeW, NULL, NULL, buf, ARRAY_SIZE(buf), ctx->install_file);
if(len) {
default_install = FALSE;
for(key = buf; *key; key += strlenW(key)+1) {
TRACE("[Add.Code] key: %s\n", debugstr_w(key));
len = GetPrivateProfileStringW(add_codeW, key, NULL, sect_name, sizeof(sect_name)/sizeof(*sect_name),
len = GetPrivateProfileStringW(add_codeW, key, NULL, sect_name, ARRAY_SIZE(sect_name),
ctx->install_file);
if(!len) {
WARN("Could not get key value\n");
@ -290,7 +290,7 @@ static HRESULT install_cab_file(install_ctx_t *ctx)
DWORD i;
HRESULT hres;
GetTempPathW(sizeof(tmp_path)/sizeof(WCHAR), tmp_path);
GetTempPathW(ARRAY_SIZE(tmp_path), tmp_path);
for(i=0; !res && i < 100; i++) {
GetTempFileNameW(tmp_path, NULL, GetTickCount() + i*17037, tmp_dir);
@ -336,13 +336,13 @@ static void update_counter(install_ctx_t *ctx, HWND hwnd)
HWND button_hwnd;
KillTimer(hwnd, ctx->timer);
LoadStringW(urlmon_instance, IDS_AXINSTALL_INSTALL, text, sizeof(text)/sizeof(WCHAR));
LoadStringW(urlmon_instance, IDS_AXINSTALL_INSTALL, text, ARRAY_SIZE(text));
button_hwnd = GetDlgItem(hwnd, ID_AXINSTALL_INSTALL_BTN);
EnableWindow(button_hwnd, TRUE);
}else {
WCHAR buf[100];
LoadStringW(urlmon_instance, IDS_AXINSTALL_INSTALLN, buf, sizeof(buf)/sizeof(WCHAR));
LoadStringW(urlmon_instance, IDS_AXINSTALL_INSTALLN, buf, ARRAY_SIZE(buf));
sprintfW(text, buf, ctx->counter);
}
@ -476,7 +476,7 @@ static void failure_msgbox(install_ctx_t *ctx, HRESULT hres)
{
WCHAR buf[1024], fmt[1024];
LoadStringW(urlmon_instance, IDS_AXINSTALL_FAILURE, fmt, sizeof(fmt)/sizeof(WCHAR));
LoadStringW(urlmon_instance, IDS_AXINSTALL_FAILURE, fmt, ARRAY_SIZE(fmt));
sprintfW(buf, fmt, hres);
MessageBoxW(ctx->hwnd, buf, NULL, MB_OK);
}

View file

@ -202,7 +202,7 @@ static LPWSTR get_mime_clsid(LPCWSTR mime, CLSID *clsid)
len = strlenW(mime)+1;
key_name = heap_alloc(sizeof(mime_keyW) + len*sizeof(WCHAR));
memcpy(key_name, mime_keyW, sizeof(mime_keyW));
strcpyW(key_name + sizeof(mime_keyW)/sizeof(WCHAR), mime);
strcpyW(key_name + ARRAY_SIZE(mime_keyW), mime);
res = RegOpenKeyW(HKEY_CLASSES_ROOT, key_name, &hkey);
heap_free(key_name);

View file

@ -304,7 +304,7 @@ static HRESULT WINAPI FileProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr
IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_SENDINGREQUEST, &null_char);
size = 0;
hres = CoInternetParseIUri(pUri, PARSE_PATH_FROM_URL, 0, path, sizeof(path)/sizeof(WCHAR), &size, 0);
hres = CoInternetParseIUri(pUri, PARSE_PATH_FROM_URL, 0, path, ARRAY_SIZE(path), &size, 0);
if(FAILED(hres)) {
WARN("CoInternetParseIUri failed: %08x\n", hres);
return report_result(pOIProtSink, hres, 0);

View file

@ -342,7 +342,7 @@ static HRESULT HttpProtocol_open_request(Protocol *prot, IUri *uri, DWORD reques
CoTaskMemFree(rootdoc_url);
}
num = sizeof(accept_mimes)/sizeof(accept_mimes[0])-1;
num = ARRAY_SIZE(accept_mimes) - 1;
hres = IInternetBindInfo_GetBindString(bind_info, BINDSTRING_ACCEPT_MIMES, accept_mimes, num, &num);
if(hres == INET_E_USE_DEFAULT_SETTING) {
static const WCHAR default_accept_mimeW[] = {'*','/','*',0};
@ -428,7 +428,7 @@ static HRESULT HttpProtocol_open_request(Protocol *prot, IUri *uri, DWORD reques
WARN("IServiceProvider_QueryService IID_IHttpNegotiate2 failed: %08x\n", hres);
/* No goto done as per native */
}else {
len = sizeof(security_id)/sizeof(security_id[0]);
len = ARRAY_SIZE(security_id);
hres = IHttpNegotiate2_GetRootSecurityId(http_negotiate2, security_id, &len, 0);
IHttpNegotiate2_Release(http_negotiate2);
if (hres != S_OK)

View file

@ -588,7 +588,7 @@ static HRESULT load_process_feature(INTERNETFEATURELIST feature)
BOOL check_hklm = FALSE;
BOOL enabled;
if (!GetModuleFileNameW(NULL, module_name, sizeof(module_name)/sizeof(WCHAR))) {
if (!GetModuleFileNameW(NULL, module_name, ARRAY_SIZE(module_name))) {
ERR("Failed to get module file name: %u\n", GetLastError());
return E_UNEXPECTED;
}

View file

@ -547,12 +547,12 @@ static BOOL is_known_mime_type(const WCHAR *mime)
{
unsigned i;
for(i=0; i < sizeof(mime_filters_any_pos)/sizeof(*mime_filters_any_pos); i++) {
for(i=0; i < ARRAY_SIZE(mime_filters_any_pos); i++) {
if(!strcmpW(mime, mime_filters_any_pos[i].mime))
return TRUE;
}
for(i=0; i < sizeof(mime_filters)/sizeof(*mime_filters); i++) {
for(i=0; i < ARRAY_SIZE(mime_filters); i++) {
if(!strcmpW(mime, mime_filters[i].mime))
return TRUE;
}
@ -585,7 +585,7 @@ static HRESULT find_mime_from_buffer(const BYTE *buf, DWORD size, const WCHAR *p
if(proposed_mime) {
ret = proposed_mime;
for(i=0; i < sizeof(mime_filters_any_pos)/sizeof(*mime_filters_any_pos); i++) {
for(i=0; i < ARRAY_SIZE(mime_filters_any_pos); i++) {
if(!strcmpW(proposed_mime, mime_filters_any_pos[i].mime)) {
any_pos_mime = i;
for(len=size; len>0; len--) {
@ -598,8 +598,8 @@ static HRESULT find_mime_from_buffer(const BYTE *buf, DWORD size, const WCHAR *p
}
}
if(i == sizeof(mime_filters_any_pos)/sizeof(*mime_filters_any_pos)) {
for(i=0; i < sizeof(mime_filters)/sizeof(*mime_filters); i++) {
if(i == ARRAY_SIZE(mime_filters_any_pos)) {
for(i=0; i < ARRAY_SIZE(mime_filters); i++) {
if(!strcmpW(proposed_mime, mime_filters[i].mime)) {
if(!mime_filters[i].filter(buf, size))
ret = NULL;
@ -613,7 +613,7 @@ static HRESULT find_mime_from_buffer(const BYTE *buf, DWORD size, const WCHAR *p
* are not looked for if none of them was proposed */
if(!proposed_mime || any_pos_mime!=-1) {
for(len=size; !ret && len>0; len--) {
for(i=0; i<sizeof(mime_filters_any_pos)/sizeof(*mime_filters_any_pos); i++) {
for(i=0; i<ARRAY_SIZE(mime_filters_any_pos); i++) {
if(mime_filters_any_pos[i].filter(buf+size-len, len)) {
ret = mime_filters_any_pos[i].mime;
break;
@ -635,7 +635,7 @@ static HRESULT find_mime_from_buffer(const BYTE *buf, DWORD size, const WCHAR *p
for(len=size; ret==app_octetstreamW && len>0; len--) {
if(!is_text_plain_char(buf[size-len]))
break;
for(i=0; i<sizeof(mime_filters_any_pos)/sizeof(*mime_filters_any_pos); i++) {
for(i=0; i<ARRAY_SIZE(mime_filters_any_pos); i++) {
if(mime_filters_any_pos[i].filter(buf+size-len, len)) {
ret = text_plainW;
break;

View file

@ -547,7 +547,7 @@ static HRESULT map_security_uri_to_zone(IUri *uri, DWORD *zone)
else
path_start = path;
if((ptr = strchrW(path_start, ':')) && ptr-path_start+1 < sizeof(root)/sizeof(WCHAR)) {
if((ptr = strchrW(path_start, ':')) && ptr-path_start+1 < ARRAY_SIZE(root)) {
UINT type;
memcpy(root, path_start, (ptr-path_start+1)*sizeof(WCHAR));
@ -645,7 +645,7 @@ static HRESULT open_zone_key(HKEY parent_key, DWORD zone, HKEY *hkey)
{
static const WCHAR wszFormat[] = {'%','s','%','u',0};
WCHAR key_name[sizeof(wszZonesKey)/sizeof(WCHAR)+12];
WCHAR key_name[ARRAY_SIZE(wszZonesKey) + 12];
DWORD res;
wsprintfW(key_name, wszFormat, wszZonesKey, zone);
@ -1307,7 +1307,7 @@ static LPDWORD build_zonemap_from_reg(void)
while (!res) {
name[0] = '\0';
len = sizeof(name) / sizeof(name[0]);
len = ARRAY_SIZE(name);
res = RegEnumKeyExW(hkey, used, name, &len, NULL, NULL, NULL, NULL);
if (!res) {
@ -2052,7 +2052,7 @@ HRESULT WINAPI CoInternetGetSecurityUrlEx(IUri *pUri, IUri **ppSecUri, PSUACTION
const WCHAR *tmp = ret_url;
/* Check and see if a "//" is after the scheme name. */
tmp += sizeof(fileW)/sizeof(WCHAR);
tmp += ARRAY_SIZE(fileW);
if(*tmp != '/' || *(tmp+1) != '/')
hres = E_INVALIDARG;
}

View file

@ -86,7 +86,7 @@ static HRESULT get_protocol_cf(LPCWSTR schema, DWORD schema_len, CLSID *pclsid,
wszKey = heap_alloc(sizeof(wszProtocolsKey)+(schema_len+1)*sizeof(WCHAR));
memcpy(wszKey, wszProtocolsKey, sizeof(wszProtocolsKey));
memcpy(wszKey + sizeof(wszProtocolsKey)/sizeof(WCHAR), schema, (schema_len+1)*sizeof(WCHAR));
memcpy(wszKey + ARRAY_SIZE(wszProtocolsKey), schema, (schema_len+1)*sizeof(WCHAR));
res = RegOpenKeyW(HKEY_CLASSES_ROOT, wszKey, &hkey);
heap_free(wszKey);
@ -171,8 +171,7 @@ BOOL is_registered_protocol(LPCWSTR url)
WCHAR schema[64];
HRESULT hres;
hres = CoInternetParseUrl(url, PARSE_SCHEMA, 0, schema, sizeof(schema)/sizeof(schema[0]),
&schema_len, 0);
hres = CoInternetParseUrl(url, PARSE_SCHEMA, 0, schema, ARRAY_SIZE(schema), &schema_len, 0);
if(FAILED(hres))
return FALSE;
@ -188,8 +187,7 @@ IInternetProtocolInfo *get_protocol_info(LPCWSTR url)
DWORD schema_len;
HRESULT hres;
hres = CoInternetParseUrl(url, PARSE_SCHEMA, 0, schema, sizeof(schema)/sizeof(schema[0]),
&schema_len, 0);
hres = CoInternetParseUrl(url, PARSE_SCHEMA, 0, schema, ARRAY_SIZE(schema), &schema_len, 0);
if(FAILED(hres) || !schema_len)
return NULL;
@ -578,7 +576,7 @@ static void ensure_useragent(void)
DWORD value_len;
while(1) {
value_len = sizeof(buf)/sizeof(WCHAR);
value_len = ARRAY_SIZE(buf);
res = RegEnumValueW(key, idx, buf, &value_len, NULL, NULL, NULL, NULL);
if(res != ERROR_SUCCESS)
break;

View file

@ -627,7 +627,7 @@ HRESULT WINAPI CreateURLMonikerEx(IMoniker *pmkContext, LPCWSTR szURL, IMoniker
if (!szURL || !ppmk)
return E_INVALIDARG;
if(dwFlags >= sizeof(create_flags_map)/sizeof(*create_flags_map)) {
if(dwFlags >= ARRAY_SIZE(create_flags_map)) {
FIXME("Unsupported flags %x\n", dwFlags);
return E_INVALIDARG;
}
@ -680,7 +680,7 @@ HRESULT WINAPI CreateURLMonikerEx2(IMoniker *pmkContext, IUri *pUri, IMoniker **
if (!pUri || !ppmk)
return E_INVALIDARG;
if(dwFlags >= sizeof(create_flags_map)/sizeof(*create_flags_map)) {
if(dwFlags >= ARRAY_SIZE(create_flags_map)) {
FIXME("Unsupported flags %x\n", dwFlags);
return E_INVALIDARG;
}

View file

@ -365,7 +365,7 @@ static inline BOOL is_ascii(WCHAR c)
static BOOL is_default_port(URL_SCHEME scheme, DWORD port) {
DWORD i;
for(i = 0; i < sizeof(default_ports)/sizeof(default_ports[0]); ++i) {
for(i = 0; i < ARRAY_SIZE(default_ports); ++i) {
if(default_ports[i].scheme == scheme && default_ports[i].port)
return TRUE;
}
@ -556,7 +556,7 @@ void find_domain_name(const WCHAR *host, DWORD host_len,
* Ex: edu.uk -> has no domain name.
* foo.uk -> foo.uk as the domain name.
*/
for(i = 0; i < sizeof(recognized_tlds)/sizeof(recognized_tlds[0]); ++i) {
for(i = 0; i < ARRAY_SIZE(recognized_tlds); ++i) {
if(!StrCmpNIW(host, recognized_tlds[i].tld_name, 3))
return;
}
@ -584,7 +584,7 @@ void find_domain_name(const WCHAR *host, DWORD host_len,
* www.google.foo.uk -> foo.uk as the domain name.
*/
if(last_tld - (sec_last_tld+1) == 3) {
for(i = 0; i < sizeof(recognized_tlds)/sizeof(recognized_tlds[0]); ++i) {
for(i = 0; i < ARRAY_SIZE(recognized_tlds); ++i) {
if(!StrCmpNIW(sec_last_tld+1, recognized_tlds[i].tld_name, 3)) {
const WCHAR *domain = memrchrW(host, '.', sec_last_tld-host);
@ -1134,7 +1134,7 @@ static BOOL parse_scheme_type(parse_data *data) {
if(data->scheme && data->scheme_len) {
DWORD i;
for(i = 0; i < sizeof(recognized_schemes)/sizeof(recognized_schemes[0]); ++i) {
for(i = 0; i < ARRAY_SIZE(recognized_schemes); ++i) {
if(lstrlenW(recognized_schemes[i].scheme_name) == data->scheme_len) {
/* Has to be a case insensitive compare. */
if(!StrCmpNIW(recognized_schemes[i].scheme_name, data->scheme, data->scheme_len)) {
@ -2728,7 +2728,7 @@ static BOOL canonicalize_port(const parse_data *data, Uri *uri, DWORD flags, BOO
uri->port_offset = -1;
/* Check if the scheme has a default port. */
for(i = 0; i < sizeof(default_ports)/sizeof(default_ports[0]); ++i) {
for(i = 0; i < ARRAY_SIZE(default_ports); ++i) {
if(default_ports[i].scheme == data->scheme_type) {
has_default_port = TRUE;
default_port = default_ports[i].port;
@ -3154,7 +3154,7 @@ static BOOL canonicalize_hierpart(const parse_data *data, Uri *uri, DWORD flags,
uri->display_modifiers |= URI_DISPLAY_NO_ABSOLUTE_URI;
/* Windows also sets the port for these (if they have one). */
for(i = 0; i < sizeof(default_ports)/sizeof(default_ports[0]); ++i) {
for(i = 0; i < ARRAY_SIZE(default_ports); ++i) {
if(data->scheme_type == default_ports[i].scheme) {
uri->has_port = TRUE;
uri->port = default_ports[i].port;
@ -4121,7 +4121,7 @@ static DWORD generate_raw_uri(const parse_data *data, BSTR uri, DWORD flags) {
DWORD i;
BOOL is_default = FALSE;
for(i = 0; i < sizeof(default_ports)/sizeof(default_ports[0]); ++i) {
for(i = 0; i < ARRAY_SIZE(default_ports); ++i) {
if(data->scheme_type == default_ports[i].scheme &&
data->port_value == default_ports[i].port)
is_default = TRUE;
@ -7002,7 +7002,7 @@ static HRESULT parse_rootdocument(const Uri *uri, LPWSTR output, DWORD output_le
memcpy(ptr, colon_slashesW, sizeof(colon_slashesW));
/* Add the authority. */
ptr += sizeof(colon_slashesW)/sizeof(WCHAR);
ptr += ARRAY_SIZE(colon_slashesW);
memcpy(ptr, uri->canon_uri+uri->authority_start, uri->authority_len*sizeof(WCHAR));
/* Add the '/' after the authority. */
@ -7066,7 +7066,7 @@ static HRESULT parse_path_from_url(const Uri *uri, LPWSTR output, DWORD output_l
static const WCHAR slash_slashW[] = {'\\','\\'};
memcpy(ptr, slash_slashW, sizeof(slash_slashW));
ptr += sizeof(slash_slashW)/sizeof(WCHAR);
ptr += ARRAY_SIZE(slash_slashW);
memcpy(ptr, uri->canon_uri+uri->host_start, uri->host_len*sizeof(WCHAR));
ptr += uri->host_len;
}

View file

@ -409,7 +409,7 @@ static void init_session(void)
{
unsigned int i;
for(i=0; i < sizeof(object_creation)/sizeof(object_creation[0]); i++) {
for(i = 0; i < ARRAY_SIZE(object_creation); i++) {
if(object_creation[i].protocol)
register_namespace(object_creation[i].cf, object_creation[i].clsid,
object_creation[i].protocol, TRUE);
@ -438,10 +438,10 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
{
unsigned int i;
HRESULT hr;
TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
for (i=0; i < sizeof(object_creation)/sizeof(object_creation[0]); i++)
for (i = 0; i < ARRAY_SIZE(object_creation); i++)
{
if (IsEqualGUID(object_creation[i].clsid, rclsid))
return IClassFactory_QueryInterface(object_creation[i].cf, riid, ppv);

View file

@ -188,7 +188,7 @@ reactos/dll/win32/traffic # Synced to WineStaging-3.3
reactos/dll/win32/twain_32 # Synced to WineStaging-3.3
reactos/dll/win32/updspapi # Synced to WineStaging-3.3
reactos/dll/win32/url # Synced to WineStaging-3.3
reactos/dll/win32/urlmon # Synced to WineStaging-3.9
reactos/dll/win32/urlmon # Synced to WineStaging-4.0
reactos/dll/win32/usp10 # Synced to WineStaging-3.9
reactos/dll/win32/uxtheme # Forked
reactos/dll/win32/vbscript # Synced to WineStaging-3.9