Commit bdb7110d authored by Vitaly Lipatov's avatar Vitaly Lipatov

commit 13.2.0 upon wine-1.7.4

parent 0ad36379
......@@ -40,6 +40,9 @@
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_MACH_MACH_H
#include <mach/mach.h>
#endif
#ifdef sun
/* FIXME: Unfortunately swapctl can't be used with largefile.... */
......@@ -1146,14 +1149,21 @@ BOOL WINAPI GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpmemex )
SYSTEM_INFO si;
#ifdef linux
FILE *f;
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
unsigned long val;
int mib[2];
size_t size_sys;
#elif defined(__APPLE__)
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
DWORDLONG total;
#ifdef __APPLE__
unsigned int val;
#else
unsigned long val;
#endif
int mib[2];
size_t size_sys;
#ifdef HW_MEMSIZE
uint64_t val64;
#endif
#ifdef VM_SWAPUSAGE
struct xsw_usage swap;
#endif
#elif defined(sun)
unsigned long pagesize,maxpages,freepages,swapspace,swapfree;
struct anoninfo swapinf;
......@@ -1219,18 +1229,78 @@ BOOL WINAPI GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpmemex )
fclose( f );
}
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
total = 0;
lpmemex->ullAvailPhys = 0;
mib[0] = CTL_HW;
mib[1] = HW_PHYSMEM;
size_sys = sizeof(val);
sysctl(mib, 2, &val, &size_sys, NULL, 0);
if (val) lpmemex->ullTotalPhys = val;
mib[1] = HW_USERMEM;
size_sys = sizeof(val);
sysctl(mib, 2, &val, &size_sys, NULL, 0);
if (!val) val = lpmemex->ullTotalPhys;
lpmemex->ullAvailPhys = val;
lpmemex->ullTotalPageFile = val;
lpmemex->ullAvailPageFile = val;
#ifdef HW_MEMSIZE
mib[1] = HW_MEMSIZE;
size_sys = sizeof(val64);
if (!sysctl(mib, 2, &val64, &size_sys, NULL, 0) && size_sys == sizeof(val64) && val64)
total = val64;
#endif
#ifdef HAVE_MACH_MACH_H
{
host_name_port_t host = mach_host_self();
mach_msg_type_number_t count;
#ifdef HOST_VM_INFO64_COUNT
vm_size_t page_size;
vm_statistics64_data_t vm_stat;
count = HOST_VM_INFO64_COUNT;
if (host_statistics64(host, HOST_VM_INFO64, (host_info64_t)&vm_stat, &count) == KERN_SUCCESS &&
host_page_size(host, &page_size) == KERN_SUCCESS)
lpmemex->ullAvailPhys = (vm_stat.free_count + vm_stat.inactive_count) * (DWORDLONG)page_size;
#endif
if (!total)
{
host_basic_info_data_t info;
count = HOST_BASIC_INFO_COUNT;
if (host_info(host, HOST_BASIC_INFO, (host_info_t)&info, &count) == KERN_SUCCESS)
total = info.max_mem;
}
mach_port_deallocate(mach_task_self(), host);
}
#endif
if (!total)
{
mib[1] = HW_PHYSMEM;
size_sys = sizeof(val);
if (!sysctl(mib, 2, &val, &size_sys, NULL, 0) && size_sys == sizeof(val) && val)
total = val;
}
if (total)
lpmemex->ullTotalPhys = total;
if (!lpmemex->ullAvailPhys)
{
mib[1] = HW_USERMEM;
size_sys = sizeof(val);
if (!sysctl(mib, 2, &val, &size_sys, NULL, 0) && size_sys == sizeof(val) && val)
lpmemex->ullAvailPhys = val;
}
if (!lpmemex->ullAvailPhys)
lpmemex->ullAvailPhys = lpmemex->ullTotalPhys;
lpmemex->ullTotalPageFile = lpmemex->ullAvailPhys;
lpmemex->ullAvailPageFile = lpmemex->ullAvailPhys;
#ifdef VM_SWAPUSAGE
mib[0] = CTL_VM;
mib[1] = VM_SWAPUSAGE;
size_sys = sizeof(swap);
if (!sysctl(mib, 2, &swap, &size_sys, NULL, 0) && size_sys == sizeof(swap))
{
lpmemex->ullTotalPageFile = swap.xsu_total;
lpmemex->ullAvailPageFile = swap.xsu_avail;
}
#endif
#elif defined ( sun )
pagesize=sysconf(_SC_PAGESIZE);
maxpages=sysconf(_SC_PHYS_PAGES);
......
......@@ -489,6 +489,16 @@ DWORD WINAPI GetShortPathNameW( LPCWSTR longpath, LPWSTR shortpath, DWORD shortl
tmplen = p - (longpath + lp);
lstrcpynW(tmpshortpath + sp, longpath + lp, tmplen + 1);
if (tmpshortpath[sp] == '.')
{
if (tmplen == 1 || (tmplen == 2 && tmpshortpath[sp + 1] == '.'))
{
sp += tmplen;
lp += tmplen;
continue;
}
}
/* Check if the file exists and use the existing short file name */
goit = FindFirstFileW(tmpshortpath, &wfd);
if (goit == INVALID_HANDLE_VALUE) goto notfound;
......
......@@ -689,8 +689,8 @@ static void test_padding(void)
IAudioRenderClient *arc;
WAVEFORMATEX *pwfx;
REFERENCE_TIME minp, defp;
BYTE *buf;
UINT32 psize, pad, written;
BYTE *buf, silence;
UINT32 psize, pad, written, i;
hr = IMMDevice_Activate(dev, &IID_IAudioClient, CLSCTX_INPROC_SERVER,
NULL, (void**)&ac);
......@@ -709,6 +709,11 @@ static void test_padding(void)
if(hr != S_OK)
return;
if(pwfx->wBitsPerSample == 8)
silence = 128;
else
silence = 0;
/** GetDevicePeriod
* Default (= shared) device period is 10ms (e.g. 441 frames at 44100),
* except when the HW/OS forces a particular alignment,
......@@ -735,6 +740,12 @@ static void test_padding(void)
hr = IAudioRenderClient_GetBuffer(arc, psize, &buf);
ok(hr == S_OK, "GetBuffer failed: %08x\n", hr);
ok(buf != NULL, "NULL buffer returned\n");
for(i = 0; i < psize * pwfx->nBlockAlign; ++i){
if(buf[i] != silence){
ok(0, "buffer has data in it already\n");
break;
}
}
hr = IAudioRenderClient_GetBuffer(arc, 0, &buf);
ok(hr == AUDCLNT_E_OUT_OF_ORDER, "GetBuffer 0 size failed: %08x\n", hr);
......
......@@ -363,6 +363,105 @@ static UINT wait_process_handle(MSIPACKAGE* package, UINT type,
return rc;
}
/* CROSSOVER HACK BUG 11581 */
static int mta_thread_enabled = -1;
static int mta_thread_refcount = 0;
static HANDLE mta_thread_started = NULL;
static HANDLE mta_thread_signal = NULL;
static CRITICAL_SECTION mta_thread_cs;
static CRITICAL_SECTION_DEBUG mta_thread_cs_debug =
{
0, 0, &mta_thread_cs,
{ &mta_thread_cs_debug.ProcessLocksList,
&mta_thread_cs_debug.ProcessLocksList },
0, 0, { (DWORD_PTR)(__FILE__ ": mta_thread_cs") }
};
static CRITICAL_SECTION mta_thread_cs = { &mta_thread_cs_debug, -1, 0, 0, 0, 0 };
static HMODULE mta_thread_hmsi;
static DWORD WINAPI mta_thread_proc(void *arg)
{
CoInitializeEx(0, COINIT_MULTITHREADED);
SetEvent(mta_thread_started);
while (1)
{
WaitForSingleObject(mta_thread_signal, INFINITE);
EnterCriticalSection(&mta_thread_cs);
if (mta_thread_refcount == 0)
break;
LeaveCriticalSection(&mta_thread_cs);
}
CloseHandle(mta_thread_started);
CloseHandle(mta_thread_signal);
mta_thread_started = mta_thread_signal = NULL;
LeaveCriticalSection(&mta_thread_cs);
CoUninitialize();
FreeLibraryAndExitThread(mta_thread_hmsi, 0);
return 0;
}
static void mta_thread_ref(void)
{
if (mta_thread_enabled == 0) return;
EnterCriticalSection(&mta_thread_cs);
if (mta_thread_enabled == -1)
{
char buffer[2];
mta_thread_enabled = (GetEnvironmentVariableA("CX_MSI_MTA", buffer, 2) != 0);
if (mta_thread_enabled == 0)
{
LeaveCriticalSection(&mta_thread_cs);
return;
}
}
if (!mta_thread_started)
{
mta_thread_started = CreateEventW(NULL, TRUE, FALSE, NULL);
mta_thread_signal = CreateEventW(NULL, FALSE, FALSE, NULL);
GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCWSTR)mta_thread_proc, &mta_thread_hmsi);
CreateThread(NULL, 0, mta_thread_proc, NULL, 0, NULL);
WaitForSingleObject(mta_thread_started, INFINITE);
}
mta_thread_refcount++;
LeaveCriticalSection(&mta_thread_cs);
}
static void mta_thread_unref(void)
{
if (mta_thread_enabled == 0) return;
EnterCriticalSection(&mta_thread_cs);
mta_thread_refcount--;
if (mta_thread_refcount == 0)
SetEvent(mta_thread_signal);
LeaveCriticalSection(&mta_thread_cs);
}
/* END CROSSOVER HACK BUG 11581 */
typedef struct _msi_custom_action_info {
struct list entry;
LONG refs;
......@@ -616,6 +715,9 @@ static DWORD WINAPI DllThread( LPVOID arg )
TRACE("custom action (%x) returned %i\n", GetCurrentThreadId(), rc );
MsiCloseAllHandles();
mta_thread_unref();
return rc;
}
......@@ -641,6 +743,8 @@ static msi_custom_action_info *do_msidbCustomActionTypeDll(
list_add_tail( &msi_pending_custom_actions, &info->entry );
LeaveCriticalSection( &msi_custom_action_cs );
mta_thread_ref();
info->handle = CreateThread( NULL, 0, DllThread, &info->guid, 0, NULL );
if (!info->handle)
{
......
......@@ -2466,6 +2466,18 @@ static ULONG WINAPI AudioRenderClient_Release(IAudioRenderClient *iface)
return AudioClient_Release(&This->IAudioClient_iface);
}
static void silence_buffer(ACImpl *This, BYTE *buffer, UINT32 frames)
{
WAVEFORMATEXTENSIBLE *fmtex = (WAVEFORMATEXTENSIBLE*)This->fmt;
if((This->fmt->wFormatTag == WAVE_FORMAT_PCM ||
(This->fmt->wFormatTag == WAVE_FORMAT_EXTENSIBLE &&
IsEqualGUID(&fmtex->SubFormat, &KSDATAFORMAT_SUBTYPE_PCM))) &&
This->fmt->wBitsPerSample == 8)
memset(buffer, 128, frames * This->fmt->nBlockAlign);
else
memset(buffer, 0, frames * This->fmt->nBlockAlign);
}
static HRESULT WINAPI AudioRenderClient_GetBuffer(IAudioRenderClient *iface,
UINT32 frames, BYTE **data)
{
......@@ -2515,6 +2527,8 @@ static HRESULT WINAPI AudioRenderClient_GetBuffer(IAudioRenderClient *iface,
This->getbuf_last = frames;
}
silence_buffer(This, *data, frames);
LeaveCriticalSection(&This->lock);
return S_OK;
......@@ -2568,12 +2582,8 @@ static HRESULT WINAPI AudioRenderClient_ReleaseBuffer(
else
buffer = This->tmp_buffer;
if(flags & AUDCLNT_BUFFERFLAGS_SILENT){
if(This->fmt->wBitsPerSample == 8)
memset(buffer, 128, written_frames * This->fmt->nBlockAlign);
else
memset(buffer, 0, written_frames * This->fmt->nBlockAlign);
}
if(flags & AUDCLNT_BUFFERFLAGS_SILENT)
silence_buffer(This, buffer, written_frames);
if(This->getbuf_last < 0)
alsa_wrap_buffer(This, buffer, written_frames);
......
......@@ -2024,6 +2024,18 @@ static ULONG WINAPI AudioRenderClient_Release(IAudioRenderClient *iface)
return AudioClient_Release(&This->IAudioClient_iface);
}
static void silence_buffer(ACImpl *This, BYTE *buffer, UINT32 frames)
{
WAVEFORMATEXTENSIBLE *fmtex = (WAVEFORMATEXTENSIBLE*)This->fmt;
if((This->fmt->wFormatTag == WAVE_FORMAT_PCM ||
(This->fmt->wFormatTag == WAVE_FORMAT_EXTENSIBLE &&
IsEqualGUID(&fmtex->SubFormat, &KSDATAFORMAT_SUBTYPE_PCM))) &&
This->fmt->wBitsPerSample == 8)
memset(buffer, 128, frames * This->fmt->nBlockAlign);
else
memset(buffer, 0, frames * This->fmt->nBlockAlign);
}
static HRESULT WINAPI AudioRenderClient_GetBuffer(IAudioRenderClient *iface,
UINT32 frames, BYTE **data)
{
......@@ -2094,6 +2106,7 @@ static HRESULT WINAPI AudioRenderClient_GetBuffer(IAudioRenderClient *iface,
This->getbuf_last = frames;
*data = This->public_buffer->mAudioData;
silence_buffer(This, *data, frames);
OSSpinLockUnlock(&This->lock);
......@@ -2133,18 +2146,8 @@ static HRESULT WINAPI AudioRenderClient_ReleaseBuffer(
return AUDCLNT_E_INVALID_SIZE;
}
if(flags & AUDCLNT_BUFFERFLAGS_SILENT){
WAVEFORMATEXTENSIBLE *fmtex = (WAVEFORMATEXTENSIBLE*)This->fmt;
if((This->fmt->wFormatTag == WAVE_FORMAT_PCM ||
(This->fmt->wFormatTag == WAVE_FORMAT_EXTENSIBLE &&
IsEqualGUID(&fmtex->SubFormat, &KSDATAFORMAT_SUBTYPE_PCM))) &&
This->fmt->wBitsPerSample == 8)
memset(This->public_buffer->mAudioData, 128,
frames * This->fmt->nBlockAlign);
else
memset(This->public_buffer->mAudioData, 0,
frames * This->fmt->nBlockAlign);
}
if(flags & AUDCLNT_BUFFERFLAGS_SILENT)
silence_buffer(This, This->public_buffer->mAudioData, frames);
This->public_buffer->mAudioDataByteSize = frames * This->fmt->nBlockAlign;
......
......@@ -1119,7 +1119,7 @@ static void shader_arb_get_register_name(const struct wined3d_shader_instruction
if (!pshader && reg->idx[0].rel_addr)
{
const struct arb_vshader_private *shader_data = shader->backend_data;
UINT rel_offset = shader_data->rel_offset;
UINT rel_offset = ctx->target_version == ARB ? shader_data->rel_offset : 0;
BOOL aL = FALSE;
char rel_reg[50];
if (reg_maps->shader_version.major < 2)
......@@ -1850,7 +1850,7 @@ static void shader_hw_mov(const struct wined3d_shader_instruction *ins)
const struct arb_vshader_private *shader_data = shader->backend_data;
src0_param[0] = '\0';
if (shader_data->rel_offset)
if (shader_data->rel_offset && ctx->target_version == ARB)
{
const char *offset = arb_get_helper_value(WINED3D_SHADER_TYPE_VERTEX, ARB_VS_REL_OFFSET);
shader_arb_get_src_param(ins, &ins->src[0], 0, src0_param);
......
......@@ -2011,6 +2011,7 @@ static UINT wined3d_cs_exec_query_issue(struct wined3d_cs *cs, const void *data)
* result, polling it could result in a GL error */
list_remove(&query->poll_list_entry);
list_init(&query->poll_list_entry);
InterlockedIncrement(&query->counter_retrieved);
}
else if (op->flags & WINED3DISSUE_END)
{
......@@ -2812,7 +2813,7 @@ static DWORD WINAPI wined3d_cs_run(void *thread_param)
cs->thread_id = GetCurrentThreadId();
for (;;)
{
if (poll == 10)
if (poll == 100)
{
poll = 0;
poll_queries(cs);
......
......@@ -713,6 +713,7 @@ static void wined3d_resource_prepare_bo(struct wined3d_resource *resource, struc
GL_STREAM_DRAW_ARB, GL_PIXEL_UNPACK_BUFFER_ARB, context);
resource->map_buffer = resource->buffer;
TRACE("Created GL buffer %u for resource %p.\n", resource->buffer->name, resource);
resource->map_heap_memory = NULL;
}
BOOL wined3d_resource_prepare_system_memory(struct wined3d_resource *resource)
......
......@@ -408,7 +408,7 @@ static inline NSUInteger adjusted_modifiers_for_option_behavior(NSUInteger modif
event->im_set_text.data = [window imeData];
event->im_set_text.text = (CFStringRef)[[markedText string] copy];
event->im_set_text.complete = FALSE;
event->im_set_text.cursor_pos = markedTextSelection.location;
event->im_set_text.cursor_pos = markedTextSelection.location + markedTextSelection.length;
[[window queue] postEvent:event];
......
......@@ -1367,12 +1367,16 @@ static HRESULT WINAPI AudioClient_GetDevicePeriod(IAudioClient *iface,
return S_OK;
}
static void oss_silence_buffer(ACImpl *This, BYTE *buf, UINT32 frames)
{
if(This->fmt->wBitsPerSample == 8)
memset(buf, 128, frames * This->fmt->nBlockAlign);
static void silence_buffer(ACImpl *This, BYTE *buffer, UINT32 frames)
{
WAVEFORMATEXTENSIBLE *fmtex = (WAVEFORMATEXTENSIBLE*)This->fmt;
if((This->fmt->wFormatTag == WAVE_FORMAT_PCM ||
(This->fmt->wFormatTag == WAVE_FORMAT_EXTENSIBLE &&
IsEqualGUID(&fmtex->SubFormat, &KSDATAFORMAT_SUBTYPE_PCM))) &&
This->fmt->wBitsPerSample == 8)
memset(buffer, 128, frames * This->fmt->nBlockAlign);
else
memset(buf, 0, frames * This->fmt->nBlockAlign);
memset(buffer, 0, frames * This->fmt->nBlockAlign);
}
static void oss_write_data(ACImpl *This)
......@@ -1419,7 +1423,7 @@ static void oss_write_data(ACImpl *This)
to_write_bytes = to_write_frames * This->fmt->nBlockAlign;
if(This->session->mute)
oss_silence_buffer(This, buf, to_write_frames);
silence_buffer(This, buf, to_write_frames);
written_bytes = write(This->fd, buf, to_write_bytes);
if(written_bytes < 0){
......@@ -1445,7 +1449,7 @@ static void oss_write_data(ACImpl *This)
to_write_bytes = to_write_frames * This->fmt->nBlockAlign;
if(This->session->mute)
oss_silence_buffer(This, This->local_buffer, to_write_frames);
silence_buffer(This, This->local_buffer, to_write_frames);
written_bytes = write(This->fd, This->local_buffer, to_write_bytes);
if(written_bytes < 0){
......@@ -1846,6 +1850,8 @@ static HRESULT WINAPI AudioRenderClient_GetBuffer(IAudioRenderClient *iface,
This->getbuf_last = frames;
}
silence_buffer(This, *data, frames);
LeaveCriticalSection(&This->lock);
return S_OK;
......@@ -1902,7 +1908,7 @@ static HRESULT WINAPI AudioRenderClient_ReleaseBuffer(
buffer = This->tmp_buffer;
if(flags & AUDCLNT_BUFFERFLAGS_SILENT)
oss_silence_buffer(This, buffer, written_frames);
silence_buffer(This, buffer, written_frames);
if(This->getbuf_last < 0)
oss_wrap_buffer(This, buffer, written_frames);
......
......@@ -71,6 +71,7 @@ static const WCHAR url13[] =
{'h','t','t','p','s',':','/','/','t','o','o','l','s','.','g','o','o','g','l','e','.','c','o','m','/','s','e','r','v','i','c','e','/','u','p','d','a','t','e','2','?','w','=','3',':','B','x','D','H','o','W','y','8','e','z','M',0};
static const WCHAR url14[] =
{'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o',' ','g','/','p','a','t','h',' ','w','i','t','h',' ','s','p','a','c','e','s',0};
static const WCHAR url15[] = {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','t','e','s','t',0};
static const WCHAR url_k1[] =
{'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d',
......@@ -622,6 +623,73 @@ static void WinHttpCrackUrl_test( void )
ok( ret, "WinHttpCrackUrl failed\n" );
ok( !lstrcmpW( uc.lpszHostName, hostnameW ), "unexpected host name\n" );
ok( !lstrcmpW( uc.lpszUrlPath, pathW ), "unexpected path\n" );
uc.dwStructSize = sizeof(uc);
uc.lpszScheme = NULL;
uc.dwSchemeLength = 0;
uc.nScheme = 0;
uc.lpszHostName = NULL;
uc.dwHostNameLength = ~0u;
uc.nPort = 0;
uc.lpszUserName = NULL;
uc.dwUserNameLength = ~0u;
uc.lpszPassword = NULL;
uc.dwPasswordLength = ~0u;
uc.lpszUrlPath = NULL;
uc.dwUrlPathLength = ~0u;
uc.lpszExtraInfo = NULL;
uc.dwExtraInfoLength = ~0u;
ret = WinHttpCrackUrl( url15, 0, 0, &uc );
ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
ok( !uc.lpszScheme, "unexpected scheme %s\n", wine_dbgstr_w(uc.lpszScheme) );
ok( !uc.dwSchemeLength, "unexpected length %u\n", uc.dwSchemeLength );
ok( uc.nScheme == INTERNET_SCHEME_HTTP, "unexpected scheme %u\n", uc.nScheme );
ok( !lstrcmpW( uc.lpszHostName, url15 + 7 ), "unexpected hostname %s\n", wine_dbgstr_w(uc.lpszHostName) );
ok( uc.dwHostNameLength == 14, "unexpected length %u\n", uc.dwHostNameLength );
ok( uc.nPort == 80, "unexpected port %u\n", uc.nPort );
ok( !uc.lpszUserName, "unexpected username\n" );
ok( !uc.dwUserNameLength, "unexpected length %u\n", uc.dwUserNameLength );
ok( !uc.lpszPassword, "unexpected password\n" );
ok( !uc.dwPasswordLength, "unexpected length %u\n", uc.dwPasswordLength );
ok( !lstrcmpW( uc.lpszUrlPath, url15 + 21 ), "unexpected path %s\n", wine_dbgstr_w(uc.lpszUrlPath) );
ok( uc.dwUrlPathLength == 5, "unexpected length %u\n", uc.dwUrlPathLength );
ok( !uc.lpszExtraInfo[0], "unexpected extra info %s\n", wine_dbgstr_w(uc.lpszExtraInfo) );
ok( uc.dwExtraInfoLength == 0, "unexpected length %u\n", uc.dwExtraInfoLength );
uc.dwStructSize = sizeof(uc);
uc.lpszScheme = scheme;
uc.dwSchemeLength = 0;
uc.nScheme = 0;
uc.lpszHostName = NULL;
uc.dwHostNameLength = 0;
uc.nPort = 0;
uc.lpszUserName = NULL;
uc.dwUserNameLength = ~0u;
uc.lpszPassword = NULL;
uc.dwPasswordLength = ~0u;
uc.lpszUrlPath = NULL;
uc.dwUrlPathLength = 0;
uc.lpszExtraInfo = NULL;
uc.dwExtraInfoLength = 0;
SetLastError( 0xdeadbeef );
ret = WinHttpCrackUrl( url15, 0, 0, &uc );
error = GetLastError();
ok( !ret, "WinHttpCrackUrl succeeded\n" );
ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error );
ok( !lstrcmpW( uc.lpszScheme, http ), "unexpected scheme %s\n", wine_dbgstr_w(uc.lpszScheme) );
ok( !uc.dwSchemeLength, "unexpected length %u\n", uc.dwSchemeLength );
ok( uc.nScheme == 0, "unexpected scheme %u\n", uc.nScheme );
ok( !uc.lpszHostName, "unexpected hostname %s\n", wine_dbgstr_w(uc.lpszHostName) );
ok( uc.dwHostNameLength == 0, "unexpected length %u\n", uc.dwHostNameLength );
ok( uc.nPort == 0, "unexpected port %u\n", uc.nPort );
ok( !uc.lpszUserName, "unexpected username\n" );
ok( uc.dwUserNameLength == ~0u, "unexpected length %u\n", uc.dwUserNameLength );
ok( !uc.lpszPassword, "unexpected password\n" );
ok( uc.dwPasswordLength == ~0u, "unexpected length %u\n", uc.dwPasswordLength );
ok( !uc.lpszUrlPath, "unexpected path %s\n", wine_dbgstr_w(uc.lpszUrlPath) );
ok( uc.dwUrlPathLength == 0, "unexpected length %u\n", uc.dwUrlPathLength );
ok( !uc.lpszExtraInfo, "unexpected extra info %s\n", wine_dbgstr_w(uc.lpszExtraInfo) );
ok( uc.dwExtraInfoLength == 0, "unexpected length %u\n", uc.dwExtraInfoLength );
}
START_TEST(url)
......
......@@ -36,6 +36,12 @@ static const WCHAR scheme_https[] = {'h','t','t','p','s',0};
static BOOL set_component( WCHAR **str, DWORD *str_len, WCHAR *value, DWORD len, DWORD flags )
{
if (*str && !*str_len)
{
set_last_error( ERROR_INVALID_PARAMETER );
return FALSE;
}
if (!*str_len) return TRUE;
if (!*str)
{
if (len && *str_len && (flags & (ICU_DECODE|ICU_ESCAPE)))
......@@ -173,6 +179,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
{
BOOL ret = FALSE;
WCHAR *p, *q, *r, *url_decoded = NULL, *url_escaped = NULL;
INTERNET_SCHEME scheme = 0;
TRACE("%s, %d, %x, %p\n", debugstr_w(url), len, flags, uc);
......@@ -206,8 +213,8 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
set_last_error( ERROR_WINHTTP_UNRECOGNIZED_SCHEME );
return FALSE;
}
if (p - url == 4 && !strncmpiW( url, scheme_http, 4 )) uc->nScheme = INTERNET_SCHEME_HTTP;
else if (p - url == 5 && !strncmpiW( url, scheme_https, 5 )) uc->nScheme = INTERNET_SCHEME_HTTPS;
if (p - url == 4 && !strncmpiW( url, scheme_http, 4 )) scheme = INTERNET_SCHEME_HTTP;
else if (p - url == 5 && !strncmpiW( url, scheme_https, 5 )) scheme = INTERNET_SCHEME_HTTPS;
else
{
set_last_error( ERROR_WINHTTP_UNRECOGNIZED_SCHEME );
......@@ -251,8 +258,8 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
else
{
if (!(set_component( &uc->lpszHostName, &uc->dwHostNameLength, p, q - p, flags ))) goto exit;
if (uc->nScheme == INTERNET_SCHEME_HTTP) uc->nPort = INTERNET_DEFAULT_HTTP_PORT;
if (uc->nScheme == INTERNET_SCHEME_HTTPS) uc->nPort = INTERNET_DEFAULT_HTTPS_PORT;
if (scheme == INTERNET_SCHEME_HTTP) uc->nPort = INTERNET_DEFAULT_HTTP_PORT;
if (scheme == INTERNET_SCHEME_HTTPS) uc->nPort = INTERNET_DEFAULT_HTTPS_PORT;
}
if ((r = memchrW( q, '?', len - (q - url) )))
......@@ -277,8 +284,8 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
else
{
if (!(set_component( &uc->lpszHostName, &uc->dwHostNameLength, p, len - (p - url), flags ))) goto exit;
if (uc->nScheme == INTERNET_SCHEME_HTTP) uc->nPort = INTERNET_DEFAULT_HTTP_PORT;
if (uc->nScheme == INTERNET_SCHEME_HTTPS) uc->nPort = INTERNET_DEFAULT_HTTPS_PORT;
if (scheme == INTERNET_SCHEME_HTTP) uc->nPort = INTERNET_DEFAULT_HTTP_PORT;
if (scheme == INTERNET_SCHEME_HTTPS) uc->nPort = INTERNET_DEFAULT_HTTPS_PORT;
}
if (!(set_component( &uc->lpszUrlPath, &uc->dwUrlPathLength, (WCHAR *)url + len, 0, flags ))) goto exit;
if (!(set_component( &uc->lpszExtraInfo, &uc->dwExtraInfoLength, (WCHAR *)url + len, 0, flags ))) goto exit;
......@@ -294,6 +301,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
debugstr_wn( uc->lpszExtraInfo, uc->dwExtraInfoLength ));
exit:
if (ret) uc->nScheme = scheme;
heap_free( url_decoded );
heap_free( url_escaped );
return ret;
......
......@@ -49,9 +49,9 @@ NameList: Adobe Glyph List
DisplaySize: -48
AntiAlias: 1
FitToEm: 1
WinInfo: 0 33 12
WinInfo: 0 29 12
TeXData: 1 0 0 708670 354335 236222 1342177 -2147484 236222 783286 444596 497025 792723 393216 433062 380633 303038 157286 324010 404750 52429 2506097 1059062 262144
BeginChars: 256 30
BeginChars: 256 38
StartChar: f020
Encoding: 0 61472 0
......@@ -686,5 +686,106 @@ SplineSet
172 0 l 1,4,-1
EndSplineSet
EndChar
StartChar: barb2left
Encoding: 223 8659 30
Width: 2006
VWidth: 0
LayerCount: 2
Fore
SplineSet
1830 820 m 25,0,-1
550 820 l 25,1,-1
1190 1460 l 17,2,-1
900 1460 l 1,3,-1
170 730 l 1,4,-1
900 0 l 1,5,-1
1190 0 l 9,6,-1
550 640 l 25,7,-1
1830 640 l 25,8,-1
1830 820 l 25,0,-1
EndSplineSet
EndChar
StartChar: barb2right
Encoding: 224 8900 31
Width: 2006
VWidth: 0
Flags: W
LayerCount: 2
Fore
Refer: 30 8659 N -1 0 0 1 2006 0 2
EndChar
StartChar: barb2up
Encoding: 225 9001 32
Width: 1825
VWidth: 0
Flags: W
LayerCount: 2
Fore
Refer: 30 8659 N 0 -1 1 0 173 1653 2
EndChar
StartChar: barb2down
Encoding: 226 63720 33
Width: 1825
VWidth: 0
Flags: W
LayerCount: 2
Fore
Refer: 30 8659 N 0 1 -1 0 1653 -173 2
EndChar
StartChar: barb4left
Encoding: 231 63724 34
Width: 2186
VWidth: 0
Flags: W
LayerCount: 2
Fore
SplineSet
2010 940 m 25,0,-1
925 940 l 25,1,-1
1465 1480 l 17,2,-1
915 1480 l 1,3,-1
165 730 l 1,4,-1
915 0 l 1,5,-1
1465 0 l 9,6,-1
925 520 l 25,7,-1
2010 520 l 25,8,-1
2010 940 l 25,0,-1
EndSplineSet
EndChar
StartChar: barb4right
Encoding: 232 63725 35
Width: 2186
VWidth: 0
Flags: W
LayerCount: 2
Fore
Refer: 34 63724 N -1 0 0 1 2186 0 2
EndChar
StartChar: barb4up
Encoding: 233 63726 36
Width: 1825
VWidth: 0
Flags: W
LayerCount: 2
Fore
Refer: 34 63724 N 0 -1 1 0 173 1653 2
EndChar
StartChar: barb4down
Encoding: 234 63727 37
Width: 1825
VWidth: 0
Flags: W
LayerCount: 2
Fore
Refer: 34 63724 N 0 1 -1 0 1653 -173 2
EndChar
EndChars
EndSplineFont
No preview for this file type
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