ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
June 2009
----- 2024 -----
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
21 participants
496 discussions
Start a n
N
ew thread
[spetreolle] 41335: fix dll/win32/netshell/lang/nl-NL.rc:128:4: error: no newline at end of file
by spetreolle@svn.reactos.org
Author: spetreolle Date: Sun Jun 7 17:41:41 2009 New Revision: 41335 URL:
http://svn.reactos.org/svn/reactos?rev=41335&view=rev
Log: fix dll/win32/netshell/lang/nl-NL.rc:128:4: error: no newline at end of file Modified: trunk/reactos/dll/win32/netshell/lang/nl-NL.rc Modified: trunk/reactos/dll/win32/netshell/lang/nl-NL.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netshell/lang/nl…
============================================================================== --- trunk/reactos/dll/win32/netshell/lang/nl-NL.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netshell/lang/nl-NL.rc [iso-8859-1] Sun Jun 7 17:41:41 2009 @@ -125,4 +125,5 @@ IDS_DURATION_DAYS "%d Dagen %s" IDS_ASSIGNED_DHCP "Toegekend door DHCP" IDS_ASSIGNED_MANUAL "Handmatig geconfigureerd" -END +END +
15 years, 5 months
1
0
0
0
[cwittich] 41334: don't close a dialog with <Return> when the OK button is disabled
by cwittich@svn.reactos.org
Author: cwittich Date: Sun Jun 7 17:27:33 2009 New Revision: 41334 URL:
http://svn.reactos.org/svn/reactos?rev=41334&view=rev
Log: don't close a dialog with <Return> when the OK button is disabled Modified: trunk/reactos/dll/win32/user32/windows/dialog.c Modified: trunk/reactos/dll/win32/user32/windows/dialog.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/d…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/dialog.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/dialog.c [iso-8859-1] Sun Jun 7 17:27:33 2009 @@ -2376,6 +2376,10 @@ } else if (DC_HASDEFID == HIWORD(dw = SendMessageW (hDlg, DM_GETDEFID, 0, 0))) { + HWND hwndDef = GetDlgItem(hDlg, LOWORD(dw)); + if (!hwndDef || !IsWindowEnabled(hwndDef)) + return TRUE; + SendMessageW( hDlg, WM_COMMAND, MAKEWPARAM( LOWORD(dw), BN_CLICKED ), (LPARAM)GetDlgItem(hDlg, LOWORD(dw))); }
15 years, 5 months
1
0
0
0
[cwittich] 41333: sync urlmon and winhttp with wine 1.1.23
by cwittich@svn.reactos.org
Author: cwittich Date: Sun Jun 7 16:32:05 2009 New Revision: 41333 URL:
http://svn.reactos.org/svn/reactos?rev=41333&view=rev
Log: sync urlmon and winhttp with wine 1.1.23 Added: trunk/reactos/dll/win32/winhttp/cookie.c (with props) trunk/reactos/dll/win32/winhttp/url.c (with props) Modified: trunk/reactos/dll/win32/urlmon/bindprot.c trunk/reactos/dll/win32/urlmon/http.c trunk/reactos/dll/win32/urlmon/urlmon_main.c trunk/reactos/dll/win32/winhttp/main.c trunk/reactos/dll/win32/winhttp/net.c trunk/reactos/dll/win32/winhttp/request.c trunk/reactos/dll/win32/winhttp/session.c trunk/reactos/dll/win32/winhttp/winhttp.rbuild trunk/reactos/dll/win32/winhttp/winhttp_private.h trunk/reactos/include/psdk/winhttp.h Modified: trunk/reactos/dll/win32/urlmon/bindprot.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/bindprot.…
============================================================================== --- trunk/reactos/dll/win32/urlmon/bindprot.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/urlmon/bindprot.c [iso-8859-1] Sun Jun 7 16:32:05 2009 @@ -608,10 +608,14 @@ static HRESULT WINAPI ProtocolHandler_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData) { BindProtocol *This = PROTOCOLHANDLER_THIS(iface); + HRESULT hres; TRACE("(%p)->(%p)\n", This, pProtocolData); - return IInternetProtocol_Continue(This->protocol, pProtocolData); + hres = IInternetProtocol_Continue(This->protocol, pProtocolData); + + heap_free(pProtocolData); + return hres; } static HRESULT WINAPI ProtocolHandler_Abort(IInternetProtocol *iface, HRESULT hrReason, @@ -874,14 +878,14 @@ typedef struct { task_header_t header; - PROTOCOLDATA data; + PROTOCOLDATA *data; } switch_task_t; static void switch_proc(BindProtocol *bind, task_header_t *t) { switch_task_t *task = (switch_task_t*)t; - IInternetProtocol_Continue(bind->protocol_handler, &task->data); + IInternetProtocol_Continue(bind->protocol_handler, task->data); heap_free(task); } @@ -890,11 +894,17 @@ PROTOCOLDATA *pProtocolData) { BindProtocol *This = PROTSINK_THIS(iface); + PROTOCOLDATA *data; TRACE("(%p)->(%p)\n", This, pProtocolData); TRACE("flags %x state %x data %p cb %u\n", pProtocolData->grfFlags, pProtocolData->dwState, pProtocolData->pData, pProtocolData->cbData); + + data = heap_alloc(sizeof(PROTOCOLDATA)); + if(!data) + return E_OUTOFMEMORY; + memcpy(data, pProtocolData, sizeof(PROTOCOLDATA)); if(!do_direct_notif(This)) { switch_task_t *task; @@ -903,18 +913,18 @@ if(!task) return E_OUTOFMEMORY; - task->data = *pProtocolData; + task->data = data; push_task(This, &task->header, switch_proc); return S_OK; } if(!This->protocol_sink) { - IInternetProtocol_Continue(This->protocol_handler, pProtocolData); + IInternetProtocol_Continue(This->protocol_handler, data); return S_OK; } - return IInternetProtocolSink_Switch(This->protocol_sink, pProtocolData); + return IInternetProtocolSink_Switch(This->protocol_sink, data); } static void report_progress(BindProtocol *This, ULONG status_code, LPCWSTR status_text) Modified: trunk/reactos/dll/win32/urlmon/http.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/http.c?re…
============================================================================== --- trunk/reactos/dll/win32/urlmon/http.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/urlmon/http.c [iso-8859-1] Sun Jun 7 16:32:05 2009 @@ -85,7 +85,7 @@ BYTE security_id[512]; DWORD len = 0; ULONG num = 0; - BOOL res; + BOOL res, b; HRESULT hres; static const WCHAR wszBindVerb[BINDVERB_CUSTOM][5] = @@ -208,6 +208,11 @@ else optional = (LPWSTR)This->base.bind_info.stgmedData.u.hGlobal; } + + b = TRUE; + res = InternetSetOptionW(This->base.request, INTERNET_OPTION_HTTP_DECODING, &b, sizeof(b)); + if(!res) + WARN("InternetSetOption(INTERNET_OPTION_HTTP_DECODING) failed: %08x\n", GetLastError()); res = HttpSendRequestW(This->base.request, This->full_header, lstrlenW(This->full_header), optional, optional ? This->base.bind_info.cbstgmedData : 0); Modified: trunk/reactos/dll/win32/urlmon/urlmon_main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/urlmon_ma…
============================================================================== --- trunk/reactos/dll/win32/urlmon/urlmon_main.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/urlmon/urlmon_main.c [iso-8859-1] Sun Jun 7 16:32:05 2009 @@ -36,7 +36,7 @@ HINSTANCE URLMON_hInstance = 0; static HMODULE hCabinet = NULL; -static DWORD urlmon_tls; +static DWORD urlmon_tls = TLS_OUT_OF_INDEXES; static void init_session(BOOL); @@ -56,9 +56,12 @@ { tls_data_t *data; - if(!urlmon_tls) { + if(urlmon_tls == TLS_OUT_OF_INDEXES) { DWORD tls = TlsAlloc(); - tls = InterlockedCompareExchange((LONG*)&urlmon_tls, tls, 0); + if(tls == TLS_OUT_OF_INDEXES) + return NULL; + + tls = InterlockedCompareExchange((LONG*)&urlmon_tls, tls, TLS_OUT_OF_INDEXES); if(tls != urlmon_tls) TlsFree(tls); } @@ -83,7 +86,7 @@ { tls_data_t *data; - if(!urlmon_tls) + if(urlmon_tls == TLS_OUT_OF_INDEXES) return; while(!list_empty(&tls_list)) { @@ -99,7 +102,7 @@ { tls_data_t *data; - if(!urlmon_tls) + if(urlmon_tls == TLS_OUT_OF_INDEXES) return; data = TlsGetValue(urlmon_tls); Added: trunk/reactos/dll/win32/winhttp/cookie.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/winhttp/cookie.c…
============================================================================== --- trunk/reactos/dll/win32/winhttp/cookie.c (added) +++ trunk/reactos/dll/win32/winhttp/cookie.c [iso-8859-1] Sun Jun 7 16:32:05 2009 @@ -1,0 +1,281 @@ +/* + * Copyright 2008 Hans Leidekker for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "config.h" +#include <stdarg.h> + +#include "wine/debug.h" +#include "wine/list.h" + +#include "windef.h" +#include "winbase.h" +#include "winhttp.h" + +#include "winhttp_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(winhttp); + +static domain_t *add_domain( session_t *session, WCHAR *name ) +{ + domain_t *domain; + + if (!(domain = heap_alloc_zero( sizeof(domain_t) ))) return NULL; + + list_init( &domain->entry ); + list_init( &domain->cookies ); + + domain->name = name; + list_add_tail( &session->cookie_cache, &domain->entry ); + + TRACE("%s\n", debugstr_w(domain->name)); + return domain; +} + +static cookie_t *find_cookie( domain_t *domain, const WCHAR *path, const WCHAR *name ) +{ + struct list *item; + cookie_t *cookie; + + LIST_FOR_EACH( item, &domain->cookies ) + { + cookie = LIST_ENTRY( item, cookie_t, entry ); + if (!strcmpW( cookie->path, path ) && !strcmpiW( cookie->name, name )) + { + TRACE("found %s=%s\n", debugstr_w(cookie->name), debugstr_w(cookie->value)); + return cookie; + } + } + return NULL; +} + +static BOOL domain_match( const WCHAR *name, domain_t *domain, BOOL partial ) +{ + TRACE("comparing %s with %s\n", debugstr_w(name), debugstr_w(domain->name)); + + if (partial && !strstrW( name, domain->name )) return FALSE; + else if (!partial && strcmpW( name, domain->name )) return FALSE; + return TRUE; +} + +static void free_cookie( cookie_t *cookie ) +{ + heap_free( cookie->name ); + heap_free( cookie->value ); + heap_free( cookie->path ); + heap_free( cookie ); +} + +static void delete_cookie( cookie_t *cookie ) +{ + list_remove( &cookie->entry ); + free_cookie( cookie ); +} + +void delete_domain( domain_t *domain ) +{ + cookie_t *cookie; + struct list *item, *next; + + LIST_FOR_EACH_SAFE( item, next, &domain->cookies ) + { + cookie = LIST_ENTRY( item, cookie_t, entry ); + delete_cookie( cookie ); + } + + list_remove( &domain->entry ); + heap_free( domain->name ); + heap_free( domain ); +} + +static BOOL add_cookie( session_t *session, cookie_t *cookie, WCHAR *domain_name, WCHAR *path ) +{ + domain_t *domain = NULL; + cookie_t *old_cookie; + struct list *item; + + LIST_FOR_EACH( item, &session->cookie_cache ) + { + domain = LIST_ENTRY( item, domain_t, entry ); + if (domain_match( domain_name, domain, FALSE )) break; + domain = NULL; + } + if (!domain) + { + if (!(domain = add_domain( session, domain_name ))) return FALSE; + } + else if ((old_cookie = find_cookie( domain, path, cookie->name ))) delete_cookie( old_cookie ); + + cookie->path = path; + list_add_tail( &domain->cookies, &cookie->entry ); + + TRACE("domain %s path %s <- %s=%s\n", debugstr_w(domain_name), debugstr_w(cookie->path), + debugstr_w(cookie->name), debugstr_w(cookie->value)); + return TRUE; +} + +static cookie_t *parse_cookie( const WCHAR *string ) +{ + cookie_t *cookie; + const WCHAR *p; + int len; + + if (!(cookie = heap_alloc_zero( sizeof(cookie_t) ))) return NULL; + + list_init( &cookie->entry ); + + if (!(p = strchrW( string, '=' ))) + { + WARN("no '=' in %s\n", debugstr_w(string)); + return NULL; + } + if (p == string) + { + WARN("empty cookie name in %s\n", debugstr_w(string)); + return NULL; + } + len = p - string; + if (!(cookie->name = heap_alloc( (len + 1) * sizeof(WCHAR) ))) + { + heap_free( cookie ); + return NULL; + } + memcpy( cookie->name, string, len * sizeof(WCHAR) ); + cookie->name[len] = 0; + + p++; /* skip '=' */ + while (*p == ' ') p++; + + len = strlenW( p ); + if (!(cookie->value = heap_alloc( (len + 1) * sizeof(WCHAR) ))) + { + free_cookie( cookie ); + return NULL; + } + memcpy( cookie->value, p, len * sizeof(WCHAR) ); + cookie->value[len] = 0; + + return cookie; +} + +BOOL set_cookies( request_t *request, const WCHAR *cookies ) +{ + static const WCHAR pathW[] = {'p','a','t','h',0}; + static const WCHAR domainW[] = {'d','o','m','a','i','n',0}; + + BOOL ret = FALSE; + WCHAR *buffer, *p, *q, *r; + WCHAR *cookie_domain = NULL, *cookie_path = NULL; + session_t *session = request->connect->session; + cookie_t *cookie; + int len; + + len = strlenW( cookies ); + if (!(buffer = heap_alloc( (len + 1) * sizeof(WCHAR) ))) return FALSE; + strcpyW( buffer, cookies ); + + p = buffer; + while (*p && *p != ';') p++; + if (*p == ';') *p++ = 0; + if (!(cookie = parse_cookie( buffer ))) + { + heap_free( buffer ); + return FALSE; + } + if ((q = strstrW( p, domainW ))) /* FIXME: do real attribute parsing */ + { + while (*q && *q != '=') q++; + if (!*q) goto end; + + r = ++q; + while (*r && *r != ';') r++; + len = r - q; + + if (!(cookie_domain = heap_alloc( (len + 1) * sizeof(WCHAR) ))) goto end; + memcpy( cookie_domain, q, len * sizeof(WCHAR) ); + cookie_domain[len] = 0; + + } + if ((q = strstrW( p, pathW ))) + { + while (*q && *q != '=') q++; + if (!*q) goto end; + + r = ++q; + while (*r && *r != ';') r++; + len = r - q; + + if (!(cookie_path = heap_alloc( (len + 1) * sizeof(WCHAR) ))) goto end; + memcpy( cookie_path, q, len * sizeof(WCHAR) ); + cookie_path[len] = 0; + } + if (!cookie_domain && !(cookie_domain = strdupW( request->connect->servername ))) goto end; + if (!cookie_path && !(cookie_path = strdupW( request->path ))) goto end; + + if ((p = strrchrW( cookie_path, '/' )) && p != cookie_path) *p = 0; + ret = add_cookie( session, cookie, cookie_domain, cookie_path ); + +end: + if (!ret) + { + free_cookie( cookie ); + heap_free( cookie_domain ); + heap_free( cookie_path ); + } + heap_free( buffer ); + return ret; +} + +BOOL add_cookie_headers( request_t *request ) +{ + struct list *domain_cursor; + session_t *session = request->connect->session; + + LIST_FOR_EACH( domain_cursor, &session->cookie_cache ) + { + domain_t *domain = LIST_ENTRY( domain_cursor, domain_t, entry ); + if (domain_match( request->connect->servername, domain, TRUE )) + { + struct list *cookie_cursor; + TRACE("found domain %s\n", debugstr_w(domain->name)); + + LIST_FOR_EACH( cookie_cursor, &domain->cookies ) + { + cookie_t *cookie = LIST_ENTRY( cookie_cursor, cookie_t, entry ); + + TRACE("comparing path %s with %s\n", debugstr_w(request->path), debugstr_w(cookie->path)); + + if (strstrW( request->path, cookie->path ) == request->path) + { + const WCHAR format[] = {'C','o','o','k','i','e',':',' ','%','s','=','%','s',0}; + int len; + WCHAR *header; + + len = strlenW( cookie->name ) + strlenW( format ) + strlenW( cookie->value ); + if (!(header = heap_alloc( (len + 1) * sizeof(WCHAR) ))) return FALSE; + + sprintfW( header, format, cookie->name, cookie->value ); + + TRACE("%s\n", debugstr_w(header)); + add_request_headers( request, header, len, WINHTTP_ADDREQ_FLAG_ADD ); + heap_free( header ); + } + } + } + } + return TRUE; +} Propchange: trunk/reactos/dll/win32/winhttp/cookie.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/dll/win32/winhttp/main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/winhttp/main.c?r…
============================================================================== --- trunk/reactos/dll/win32/winhttp/main.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/winhttp/main.c [iso-8859-1] Sun Jun 7 16:32:05 2009 @@ -38,8 +38,6 @@ { switch(fdwReason) { - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls(hInstDLL); break; @@ -84,41 +82,3 @@ FIXME("()\n"); return S_OK; } - -#define SCHEME_HTTP 3 -#define SCHEME_HTTPS 4 - -BOOL WINAPI InternetCrackUrlW( LPCWSTR, DWORD, DWORD, LPURL_COMPONENTSW ); -BOOL WINAPI InternetCreateUrlW( LPURL_COMPONENTS, DWORD, LPWSTR, LPDWORD ); - -/*********************************************************************** - * WinHttpCrackUrl (winhttp.@) - */ -BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONENTSW components ) -{ - BOOL ret; - - TRACE("%s, %d, %x, %p\n", debugstr_w(url), len, flags, components); - - if ((ret = InternetCrackUrlW( url, len, flags, components ))) - { - /* fix up an incompatibility between wininet and winhttp */ - if (components->nScheme == SCHEME_HTTP) components->nScheme = INTERNET_SCHEME_HTTP; - else if (components->nScheme == SCHEME_HTTPS) components->nScheme = INTERNET_SCHEME_HTTPS; - else - { - set_last_error( ERROR_WINHTTP_UNRECOGNIZED_SCHEME ); - return FALSE; - } - } - return ret; -} - -/*********************************************************************** - * WinHttpCreateUrl (winhttp.@) - */ -BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS comps, DWORD flags, LPWSTR url, LPDWORD len ) -{ - TRACE("%p, 0x%08x, %p, %p\n", comps, flags, url, len); - return InternetCreateUrlW( comps, flags, url, len ); -} Modified: trunk/reactos/dll/win32/winhttp/net.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/winhttp/net.c?re…
============================================================================== --- trunk/reactos/dll/win32/winhttp/net.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/winhttp/net.c [iso-8859-1] Sun Jun 7 16:32:05 2009 @@ -48,12 +48,13 @@ #include "windef.h" #include "winbase.h" #include "winhttp.h" +#include "wincrypt.h" + +#include "winhttp_private.h" /* to avoid conflicts with the Unix socket headers */ #define USE_WS_PREFIX #include "winsock2.h" - -#include "winhttp_private.h" WINE_DEFAULT_DEBUG_CHANNEL(winhttp); @@ -83,6 +84,7 @@ static void *libcrypto_handle; static SSL_METHOD *method; +static SSL_CTX *ctx; #define MAKE_FUNCPTR(f) static typeof(f) * p##f @@ -90,7 +92,6 @@ MAKE_FUNCPTR( SSL_load_error_strings ); MAKE_FUNCPTR( SSLv23_method ); MAKE_FUNCPTR( SSL_CTX_new ); -MAKE_FUNCPTR( SSL_CTX_free ); MAKE_FUNCPTR( SSL_new ); MAKE_FUNCPTR( SSL_free ); MAKE_FUNCPTR( SSL_set_fd ); @@ -107,14 +108,15 @@ MAKE_FUNCPTR( BIO_new_fp ); MAKE_FUNCPTR( ERR_get_error ); MAKE_FUNCPTR( ERR_error_string ); +MAKE_FUNCPTR( i2d_X509 ); #undef MAKE_FUNCPTR #endif -#if 0 /* translate a unix error code into a winsock error code */ static int sock_get_error( int err ) { +#if !defined(__MINGW32__) && !defined (_MSC_VER) switch (err) { case EINTR: return WSAEINTR; @@ -174,11 +176,9 @@ #endif default: errno = err; perror( "sock_set_error" ); return WSAEFAULT; } +#endif return err; } -#else -#define sock_get_error(x) WSAGetLastError() -#endif BOOL netconn_init( netconn_t *conn, BOOL secure ) { @@ -210,7 +210,6 @@ LOAD_FUNCPTR( SSL_load_error_strings ); LOAD_FUNCPTR( SSLv23_method ); LOAD_FUNCPTR( SSL_CTX_new ); - LOAD_FUNCPTR( SSL_CTX_free ); LOAD_FUNCPTR( SSL_new ); LOAD_FUNCPTR( SSL_free ); LOAD_FUNCPTR( SSL_set_fd ); @@ -235,6 +234,7 @@ LOAD_FUNCPTR( BIO_new_fp ); LOAD_FUNCPTR( ERR_get_error ); LOAD_FUNCPTR( ERR_error_string ); + LOAD_FUNCPTR( i2d_X509 ); #undef LOAD_FUNCPTR pSSL_library_init(); @@ -242,8 +242,6 @@ pBIO_new_fp( stderr, BIO_NOCLOSE ); method = pSSLv23_method(); - conn->ssl_ctx = pSSL_CTX_new( method ); - #else WARN("SSL support not compiled in.\n"); set_last_error( ERROR_WINHTTP_SECURE_CHANNEL_ERROR ); @@ -314,13 +312,14 @@ X509 *cert; long res; - if (!pSSL_CTX_set_default_verify_paths( conn->ssl_ctx )) + ctx = pSSL_CTX_new( method ); + if (!pSSL_CTX_set_default_verify_paths( ctx )) { ERR("SSL_CTX_set_default_verify_paths failed: %s\n", pERR_error_string( pERR_get_error(), 0 )); set_last_error( ERROR_OUTOFMEMORY ); return FALSE; } - if (!(conn->ssl_conn = pSSL_new( conn->ssl_ctx ))) + if (!(conn->ssl_conn = pSSL_new( ctx ))) { ERR("SSL_new failed: %s\n", pERR_error_string( pERR_get_error(), 0 )); set_last_error( ERROR_OUTOFMEMORY ); @@ -468,11 +467,7 @@ return TRUE; } #ifdef FIONREAD - if (!(ret = ioctlsocket( conn->socket, FIONREAD, &unread ))) - { - TRACE("%d bytes of queued, but unread data\n", unread); - *available += unread; - } + if (!(ret = ioctlsocket( conn->socket, FIONREAD, &unread ))) *available = unread; #endif return TRUE; } @@ -491,8 +486,8 @@ #ifdef SONAME_LIBSSL long timeout; - timeout = pSSL_CTX_get_timeout( conn->ssl_ctx ); - pSSL_CTX_set_timeout( conn->ssl_ctx, DEFAULT_RECEIVE_TIMEOUT ); + timeout = pSSL_CTX_get_timeout( ctx ); + pSSL_CTX_set_timeout( ctx, DEFAULT_RECEIVE_TIMEOUT ); while (recvd < *buflen) { @@ -509,7 +504,7 @@ } if (buffer[recvd] != '\r') recvd++; } - pSSL_CTX_set_timeout( conn->ssl_ctx, timeout ); + pSSL_CTX_set_timeout( ctx, timeout ); if (ret) { buffer[recvd++] = 0; @@ -567,7 +562,7 @@ tv.tv_sec = value / 1000; tv.tv_usec = (value % 1000) * 1000; - if ((res = setsockopt( netconn->socket, SOL_SOCKET, send ? SO_SNDTIMEO : SO_RCVTIMEO, &tv, sizeof(tv) ) == -1)) + if ((res = setsockopt( netconn->socket, SOL_SOCKET, send ? SO_SNDTIMEO : SO_RCVTIMEO, (void*)&tv, sizeof(tv) ) == -1)) { WARN("setsockopt failed (%s)\n", strerror( errno )); return sock_get_error( errno ); @@ -595,7 +590,7 @@ heap_free( hostname ); if (ret != 0) { - TRACE("failed to get address of %s (%s)\n", debugstr_a(hostname), gai_strerror(ret)); + TRACE("failed to get address of %s (%s)\n", debugstr_w(hostnameW), gai_strerror(ret)); return FALSE; } memset( sa, 0, sizeof(struct sockaddr_in) ); @@ -611,12 +606,12 @@ heap_free( hostname ); if (!he) { - TRACE("failed to get address of %s (%d)\n", debugstr_a(hostname), h_errno); + TRACE("failed to get address of %s (%d)\n", debugstr_w(hostnameW), h_errno); LeaveCriticalSection( &cs_gethostbyname ); return FALSE; } memset( sa, 0, sizeof(struct sockaddr_in) ); - memcpy( (char *)&sa->sin_addr, he->h_addr, he->h_length ); + memcpy( &sa->sin_addr, he->h_addr, he->h_length ); sa->sin_family = he->h_addrtype; sa->sin_port = htons( port ); @@ -624,3 +619,46 @@ #endif return TRUE; } + +const void *netconn_get_certificate( netconn_t *conn ) +{ +#ifdef SONAME_LIBSSL + X509 *cert; + unsigned char *buffer, *p; + int len; + BOOL malloc = FALSE; + const CERT_CONTEXT *ret; + + if (!conn->secure) return NULL; + + if (!(cert = pSSL_get_peer_certificate( conn->ssl_conn ))) return NULL; + p = NULL; + if ((len = pi2d_X509( cert, &p )) < 0) return NULL; + /* + * SSL 0.9.7 and above malloc the buffer if it is null. + * however earlier version do not and so we would need to alloc the buffer. + * + * see the i2d_X509 man page for more details. + */ + if (!p) + { + if (!(buffer = heap_alloc( len ))) return NULL; + p = buffer; + len = pi2d_X509( cert, &p ); + } + else + { + buffer = p; + malloc = TRUE; + } + + ret = CertCreateCertificateContext( X509_ASN_ENCODING, buffer, len ); + + if (malloc) free( buffer ); + else heap_free( buffer ); + + return ret; +#else + return NULL; +#endif +} Modified: trunk/reactos/dll/win32/winhttp/request.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/winhttp/request.…
============================================================================== --- trunk/reactos/dll/win32/winhttp/request.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/winhttp/request.c [iso-8859-1] Sun Jun 7 16:32:05 2009 @@ -175,6 +175,22 @@ NULL /* WINHTTP_QUERY_PASSPORT_CONFIG = 78 */ }; +static DWORD CALLBACK task_thread( LPVOID param ) +{ + task_header_t *task = param; + + task->proc( task ); + + release_object( &task->request->hdr ); + heap_free( task ); + return ERROR_SUCCESS; +} + +static BOOL queue_task( task_header_t *task ) +{ + return QueueUserWorkItem( task_thread, task, WT_EXECUTELONGFUNCTION ); +} + static void free_header( header_t *header ) { heap_free( header->field ); @@ -391,13 +407,13 @@ return TRUE; } -static BOOL add_request_headers( request_t *request, LPCWSTR headers, DWORD len, DWORD flags ) +BOOL add_request_headers( request_t *request, LPCWSTR headers, DWORD len, DWORD flags ) { BOOL ret = FALSE; WCHAR *buffer, *p, *q; header_t *header; - if (len == ~0UL) len = strlenW( headers ); + if (len == ~0u) len = strlenW( headers ); if (!(buffer = heap_alloc( (len + 1) * sizeof(WCHAR) ))) return FALSE; strcpyW( buffer, headers ); @@ -467,28 +483,20 @@ static const WCHAR crlf[] = {'\r','\n',0}; static const WCHAR colon[] = {':',' ',0}; static const WCHAR twocrlf[] = {'\r','\n','\r','\n',0}; - static const WCHAR get[] = {'G','E','T',0}; - static const WCHAR slash[] = {'/',0}; - static const WCHAR http1_1[] = {'H','T','T','P','/','1','.','1',0}; WCHAR *ret; const WCHAR **headers, **p; - const WCHAR *verb = get, *path = slash, *version = http1_1; unsigned int len, i = 0, j; - - if (request->verb && request->verb[0]) verb = request->verb; - if (request->path && request->path[0]) path = request->path; - if (request->version && request->version[0]) version = request->version; /* allocate space for an array of all the string pointers to be added */ len = request->num_headers * 4 + 7; if (!(headers = heap_alloc( len * sizeof(LPCWSTR) ))) return NULL; - headers[i++] = verb; + headers[i++] = request->verb; headers[i++] = space; - headers[i++] = path; + headers[i++] = request->path; headers[i++] = space; - headers[i++] = version; + headers[i++] = request->version; for (j = 0; j < request->num_headers; j++) { @@ -561,7 +569,7 @@ } else if (buffer) { - for (p = headers, q = (WCHAR *)buffer; *p; p++, q++) + for (p = headers, q = buffer; *p; p++, q++) { if (*p != '\r') *q = *p; else @@ -571,7 +579,7 @@ } } *q = 0; - TRACE("returning data: %s\n", debugstr_wn((WCHAR *)buffer, len)); + TRACE("returning data: %s\n", debugstr_wn(buffer, len)); ret = TRUE; } *buflen = len * sizeof(WCHAR); @@ -606,7 +614,7 @@ } default: { - if (attr > sizeof(attribute_table)/sizeof(attribute_table[0]) || !attribute_table[attr]) + if (attr >= sizeof(attribute_table)/sizeof(attribute_table[0]) || !attribute_table[attr]) { FIXME("attribute %u not implemented\n", attr); return FALSE; @@ -710,13 +718,16 @@ connect_t *connect; char address[32]; WCHAR *addressW; + INTERNET_PORT port; if (netconn_connected( &request->netconn )) return TRUE; + connect = request->connect; + port = connect->hostport ? connect->hostport : (request->hdr.flags & WINHTTP_FLAG_SECURE ? 443 : 80); send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_RESOLVING_NAME, connect->servername, strlenW(connect->servername) + 1 ); - if (!netconn_resolve( connect->servername, connect->serverport, &connect->sockaddr )) return FALSE; + if (!netconn_resolve( connect->servername, port, &connect->sockaddr )) return FALSE; inet_ntop( connect->sockaddr.sin_family, &connect->sockaddr.sin_addr, address, sizeof(address) ); addressW = strdupAW( address ); @@ -759,32 +770,35 @@ send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED, 0, 0 ); } -static BOOL add_host_header( request_t *request, WCHAR *hostname, INTERNET_PORT port, DWORD modifier ) +static BOOL add_host_header( request_t *request, DWORD modifier ) { BOOL ret; DWORD len; WCHAR *host; static const WCHAR fmt[] = {'%','s',':','%','u',0}; + connect_t *connect = request->connect; + INTERNET_PORT port; + + port = connect->hostport ? connect->hostport : (request->hdr.flags & WINHTTP_FLAG_SECURE ? 443 : 80); if (port == INTERNET_DEFAULT_HTTP_PORT || port == INTERNET_DEFAULT_HTTPS_PORT) { - return process_header( request, attr_host, hostname, modifier, TRUE ); - } - len = strlenW( hostname ) + 7; /* sizeof(":65335") */ + return process_header( request, attr_host, connect->hostname, modifier, TRUE ); + } + len = strlenW( connect->hostname ) + 7; /* sizeof(":65335") */ if (!(host = heap_alloc( len * sizeof(WCHAR) ))) return FALSE; - sprintfW( host, fmt, hostname, port ); + sprintfW( host, fmt, connect->hostname, port ); ret = process_header( request, attr_host, host, modifier, TRUE ); heap_free( host ); return ret; } static BOOL send_request( request_t *request, LPCWSTR headers, DWORD headers_len, LPVOID optional, - DWORD optional_len, DWORD total_len, DWORD_PTR context ) + DWORD optional_len, DWORD total_len, DWORD_PTR context, BOOL async ) { static const WCHAR keep_alive[] = {'K','e','e','p','-','A','l','i','v','e',0}; static const WCHAR no_cache[] = {'n','o','-','c','a','c','h','e',0}; static const WCHAR length_fmt[] = {'%','l','d',0}; - static const WCHAR post[] = {'P','O','S','T',0}; BOOL ret = FALSE; connect_t *connect = request->connect; @@ -798,9 +812,9 @@ process_header( request, attr_user_agent, session->agent, WINHTTP_ADDREQ_FLAG_ADD_IF_NEW, TRUE ); if (connect->hostname) - add_host_header( request, connect->hostname, connect->hostport, WINHTTP_ADDREQ_FLAG_ADD_IF_NEW ); - - if (total_len || (request->verb && !strcmpW( request->verb, post ))) + add_host_header( request, WINHTTP_ADDREQ_FLAG_ADD_IF_NEW ); + + if (total_len || (request->verb && !strcmpW( request->verb, postW ))) { WCHAR length[21]; /* decimal long int + null */ sprintfW( length, length_fmt, total_len ); @@ -820,6 +834,11 @@ TRACE("failed to add request headers\n"); return FALSE; } + if (!(request->hdr.disable_flags & WINHTTP_DISABLE_COOKIES) && !add_cookie_headers( request )) + { + WARN("failed to add cookie headers\n"); + return FALSE; + } if (!(ret = open_connection( request ))) goto end; if (!(req = build_request_string( request ))) goto end; @@ -840,8 +859,26 @@ send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_REQUEST_SENT, &len, sizeof(DWORD) ); end: + if (async) + { + if (ret) send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE, NULL, 0 ); + else + { + WINHTTP_ASYNC_RESULT result; + result.dwResult = API_SEND_REQUEST; + result.dwError = get_last_error(); + send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_REQUEST_ERROR, &result, sizeof(result) ); + } + } heap_free( req ); return ret; +} + +static void task_send_request( task_header_t *task ) +{ + send_request_t *s = (send_request_t *)task; + send_request( s->hdr.request, s->headers, s->headers_len, s->optional, s->optional_len, s->total_len, s->context, TRUE ); + heap_free( s->headers ); } /*********************************************************************** @@ -868,7 +905,25 @@ return FALSE; } - ret = send_request( request, headers, headers_len, optional, optional_len, total_len, context ); + if (request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) + { + send_request_t *s; + + if (!(s = heap_alloc( sizeof(send_request_t) ))) return FALSE; + s->hdr.request = request; + s->hdr.proc = task_send_request; + s->headers = strdupW( headers ); + s->headers_len = headers_len; + s->optional = optional; + s->optional_len = optional_len; + s->total_len = total_len; + s->context = context; + + addref_object( &request->hdr ); + ret = queue_task( (task_header_t *)s ); + } + else + ret = send_request( request, headers, headers_len, optional, optional_len, total_len, context, FALSE ); release_object( &request->hdr ); return ret; @@ -889,9 +944,9 @@ } #define MAX_REPLY_LEN 1460 -#define INITIAL_HEADER_BUFFER_SIZE 512 - -static BOOL receive_response( request_t *request, BOOL clear ) +#define INITIAL_HEADER_BUFFER_LEN 512 + +static BOOL read_reply( request_t *request ) { static const WCHAR crlf[] = {'\r','\n',0}; @@ -902,9 +957,6 @@ WCHAR status_codeW[4]; /* sizeof("nnn") */ if (!netconn_connected( &request->netconn )) return FALSE; - - /* clear old response headers (eg. from a redirect response) */ - if (clear) clear_response_headers( request ); send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE, NULL, 0 ); @@ -949,7 +1001,7 @@ heap_free( request->status_text ); request->status_text = status_textW; - len = max( buflen + crlf_len, INITIAL_HEADER_BUFFER_SIZE ); + len = max( buflen + crlf_len, INITIAL_HEADER_BUFFER_LEN ); if (!(raw_headers = heap_alloc( len * sizeof(WCHAR) ))) return FALSE; MultiByteToWideChar( CP_ACP, 0, buffer, buflen, raw_headers, buflen ); memcpy( raw_headers + buflen - 1, crlf, sizeof(crlf) ); @@ -1002,6 +1054,7 @@ connect_t *connect = request->connect; INTERNET_PORT port; WCHAR *hostname = NULL, *location = NULL; + int index; size = 0; query_headers( request, WINHTTP_QUERY_LOCATION, NULL, NULL, &size, NULL ); @@ -1012,48 +1065,73 @@ memset( &uc, 0, sizeof(uc) ); uc.dwStructSize = sizeof(uc); - uc.dwSchemeLength = uc.dwHostNameLength = uc.dwUrlPathLength = uc.dwExtraInfoLength = ~0UL; - - if (!(ret = WinHttpCrackUrl( location, size / sizeof(WCHAR), 0, &uc ))) goto end; - - if (uc.nScheme == INTERNET_SCHEME_HTTP && request->hdr.flags & WINHTTP_FLAG_SECURE) - { - TRACE("redirect from secure page to non-secure page\n"); - request->hdr.flags &= ~WINHTTP_FLAG_SECURE; - } - else if (uc.nScheme == INTERNET_SCHEME_HTTPS && !(request->hdr.flags & WINHTTP_FLAG_SECURE)) - { - TRACE("redirect from non-secure page to secure page\n"); - request->hdr.flags |= WINHTTP_FLAG_SECURE; - } - - len = uc.dwHostNameLength; - if (!(hostname = heap_alloc( (len + 1) * sizeof(WCHAR) ))) goto end; - memcpy( hostname, uc.lpszHostName, len * sizeof(WCHAR) ); - hostname[len] = 0; - - port = uc.nPort ? uc.nPort : (uc.nScheme == INTERNET_SCHEME_HTTPS ? 443 : 80); - if (strcmpiW( connect->servername, hostname ) || connect->serverport != port) - { - heap_free( connect->servername ); - connect->servername = hostname; - connect->serverport = connect->hostport = port; - - netconn_close( &request->netconn ); - if (!(ret = netconn_init( &request->netconn, request->hdr.flags & WINHTTP_FLAG_SECURE ))) goto end; - } - if (!(ret = add_host_header( request, hostname, port, WINHTTP_ADDREQ_FLAG_REPLACE ))) goto end; - if (!(ret = open_connection( request ))) goto end; - - heap_free( request->path ); - request->path = NULL; - if (uc.lpszUrlPath) - { - len = uc.dwUrlPathLength + uc.dwExtraInfoLength; - if (!(request->path = heap_alloc( (len + 1) * sizeof(WCHAR) ))) goto end; - strcpyW( request->path, uc.lpszUrlPath ); - } - + uc.dwSchemeLength = uc.dwHostNameLength = uc.dwUrlPathLength = uc.dwExtraInfoLength = ~0u; + + if (!WinHttpCrackUrl( location, size / sizeof(WCHAR), 0, &uc )) /* assume relative redirect */ + { + WCHAR *path, *p; + + len = strlenW( location ) + 1; + if (location[0] != '/') len++; + if (!(p = path = heap_alloc( len * sizeof(WCHAR) ))) goto end; + + if (location[0] != '/') *p++ = '/'; + strcpyW( p, location ); + + heap_free( request->path ); + request->path = path; + } + else + { + if (uc.nScheme == INTERNET_SCHEME_HTTP && request->hdr.flags & WINHTTP_FLAG_SECURE) + { + TRACE("redirect from secure page to non-secure page\n"); + request->hdr.flags &= ~WINHTTP_FLAG_SECURE; + } + else if (uc.nScheme == INTERNET_SCHEME_HTTPS && !(request->hdr.flags & WINHTTP_FLAG_SECURE)) + { + TRACE("redirect from non-secure page to secure page\n"); + request->hdr.flags |= WINHTTP_FLAG_SECURE; + } + + len = uc.dwHostNameLength; + if (!(hostname = heap_alloc( (len + 1) * sizeof(WCHAR) ))) goto end; + memcpy( hostname, uc.lpszHostName, len * sizeof(WCHAR) ); + hostname[len] = 0; + + port = uc.nPort ? uc.nPort : (uc.nScheme == INTERNET_SCHEME_HTTPS ? 443 : 80); + if (strcmpiW( connect->servername, hostname ) || connect->serverport != port) + { + heap_free( connect->hostname ); + connect->hostname = hostname; + heap_free( connect->servername ); + connect->servername = strdupW( connect->hostname ); + connect->serverport = connect->hostport = port; + + netconn_close( &request->netconn ); + if (!(ret = netconn_init( &request->netconn, request->hdr.flags & WINHTTP_FLAG_SECURE ))) goto end; + } + if (!(ret = add_host_header( request, WINHTTP_ADDREQ_FLAG_REPLACE ))) goto end; + if (!(ret = open_connection( request ))) goto end; + + heap_free( request->path ); + request->path = NULL; + if (uc.dwUrlPathLength) + { + len = uc.dwUrlPathLength + uc.dwExtraInfoLength; + if (!(request->path = heap_alloc( (len + 1) * sizeof(WCHAR) ))) goto end; + strcpyW( request->path, uc.lpszUrlPath ); + } + else request->path = strdupW( slashW ); + } + + /* remove content-type/length headers */ + if ((index = get_header_index( request, attr_content_type, 0, TRUE )) >= 0) delete_header( request, index ); + if ((index = get_header_index( request, attr_content_length, 0, TRUE )) >= 0 ) delete_header( request, index ); + + /* redirects are always GET requests */ + heap_free( request->verb ); + request->verb = strdupW( getW ); ret = TRUE; end: @@ -1062,7 +1140,7 @@ return ret; } -static BOOL read_data( request_t *request, void *buffer, DWORD size, DWORD *read, BOOL async ) +static BOOL receive_data( request_t *request, void *buffer, DWORD size, DWORD *read, BOOL async ) { DWORD to_read; int bytes_read; @@ -1081,99 +1159,6 @@ request->content_read += bytes_read; *read = bytes_read; return TRUE; -} - -/* read any content returned by the server so that the connection can be reused */ -static void drain_content( request_t *request ) -{ - DWORD bytes_read; - char buffer[2048]; - - if (request->content_length == ~0UL) return; - for (;;) - { - if (!read_data( request, buffer, sizeof(buffer), &bytes_read, FALSE ) || !bytes_read) return; - } -} - -/*********************************************************************** - * WinHttpReceiveResponse (winhttp.@) - */ -BOOL WINAPI WinHttpReceiveResponse( HINTERNET hrequest, LPVOID reserved ) -{ - BOOL ret = TRUE; - request_t *request; - DWORD size, query, status; - - TRACE("%p, %p\n", hrequest, reserved); - - if (!(request = (request_t *)grab_object( hrequest ))) - { - set_last_error( ERROR_INVALID_HANDLE ); - return FALSE; - } - if (request->hdr.type != WINHTTP_HANDLE_TYPE_REQUEST) - { - release_object( &request->hdr ); - set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); - return FALSE; - } - - for (;;) - { - if (!(ret = receive_response( request, TRUE ))) break; - - size = sizeof(DWORD); - query = WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER; - if (!(ret = query_headers( request, query, NULL, &status, &size, NULL ))) break; - - size = sizeof(DWORD); - query = WINHTTP_QUERY_CONTENT_LENGTH | WINHTTP_QUERY_FLAG_NUMBER; - if (!query_headers( request, query, NULL, &request->content_length, &size, NULL )) - request->content_length = ~0UL; - - if (status == 200) break; - if (status == 301 || status == 302) - { - if (request->hdr.disable_flags & WINHTTP_DISABLE_REDIRECTS) break; - drain_content( request ); - if (!(ret = handle_redirect( request ))) break; - } - ret = send_request( request, NULL, 0, NULL, 0, 0, 0 ); - } - - release_object( &request->hdr ); - return ret; -} - -/*********************************************************************** - * WinHttpQueryDataAvailable (winhttp.@) - */ -BOOL WINAPI WinHttpQueryDataAvailable( HINTERNET hrequest, LPDWORD available ) -{ - BOOL ret; - DWORD num_bytes; - request_t *request; - - TRACE("%p, %p\n", hrequest, available); - - if (!(request = (request_t *)grab_object( hrequest ))) - { - set_last_error( ERROR_INVALID_HANDLE ); - return FALSE; - } - if (request->hdr.type != WINHTTP_HANDLE_TYPE_REQUEST) - { - release_object( &request->hdr ); - set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); - return FALSE; - } - - ret = netconn_query_data_available( &request->netconn, &num_bytes ); - - if (ret && available) *available = num_bytes; - release_object( &request->hdr ); - return ret; } static DWORD get_chunk_size( const char *buffer ) @@ -1191,7 +1176,7 @@ return size; } -static BOOL read_data_chunked( request_t *request, void *buffer, DWORD size, DWORD *read, BOOL async ) +static BOOL receive_data_chunked( request_t *request, void *buffer, DWORD size, DWORD *read, BOOL async ) { char reply[MAX_REPLY_LEN], *p = buffer; DWORD buflen, to_read, to_write = size; @@ -1202,7 +1187,7 @@ { if (*read == size) break; - if (request->content_length == ~0UL) /* new chunk */ + if (request->content_length == ~0u) /* new chunk */ { buflen = sizeof(reply); if (!netconn_get_next_line( &request->netconn, reply, &buflen )) break; @@ -1210,7 +1195,7 @@ if (!(request->content_length = get_chunk_size( reply ))) { /* zero sized chunk marks end of transfer; read any trailing headers and return */ - receive_response( request, FALSE ); + read_reply( request ); break; } } @@ -1236,7 +1221,7 @@ if (request->content_read == request->content_length) /* chunk complete */ { request->content_read = 0; - request->content_length = ~0UL; + request->content_length = ~0u; buflen = sizeof(reply); if (!netconn_get_next_line( &request->netconn, reply, &buflen )) @@ -1250,17 +1235,285 @@ return TRUE; } +static void finished_reading( request_t *request ) +{ + static const WCHAR closeW[] = {'c','l','o','s','e',0}; + + BOOL close = FALSE; + WCHAR connection[20]; + DWORD size = sizeof(connection); + + if (request->hdr.disable_flags & WINHTTP_DISABLE_KEEP_ALIVE) close = TRUE; + else if (query_headers( request, WINHTTP_QUERY_CONNECTION, NULL, connection, &size, NULL ) || + query_headers( request, WINHTTP_QUERY_PROXY_CONNECTION, NULL, connection, &size, NULL )) + { + if (!strcmpiW( connection, closeW )) close = TRUE; + } + else if (!strcmpW( request->version, http1_0 )) close = TRUE; + + if (close) close_connection( request ); + request->content_length = ~0u; + request->content_read = 0; +} + +static BOOL read_data( request_t *request, void *buffer, DWORD to_read, DWORD *read, BOOL async ) +{ + static const WCHAR chunked[] = {'c','h','u','n','k','e','d',0}; + + BOOL ret; + WCHAR encoding[20]; + DWORD num_bytes, buflen = sizeof(encoding); + + if (query_headers( request, WINHTTP_QUERY_TRANSFER_ENCODING, NULL, encoding, &buflen, NULL ) && + !strcmpiW( encoding, chunked )) + { + ret = receive_data_chunked( request, buffer, to_read, &num_bytes, async ); + } + else + ret = receive_data( request, buffer, to_read, &num_bytes, async ); + + if (async) + { + if (ret) send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_READ_COMPLETE, buffer, num_bytes ); + else + { + WINHTTP_ASYNC_RESULT result; + result.dwResult = API_READ_DATA; + result.dwError = get_last_error(); + send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_REQUEST_ERROR, &result, sizeof(result) ); + } + } + if (ret) + { + if (read) *read = num_bytes; + if (!num_bytes) finished_reading( request ); + } + return ret; +} + +/* read any content returned by the server so that the connection can be reused */ +static void drain_content( request_t *request ) +{ + DWORD bytes_read; + char buffer[2048]; + + if (!request->content_length) return; + for (;;) + { + if (!read_data( request, buffer, sizeof(buffer), &bytes_read, FALSE ) || !bytes_read) return; + } +} + +static void record_cookies( request_t *request ) +{ + unsigned int i; + + for (i = 0; i < request->num_headers; i++) + { + header_t *set_cookie = &request->headers[i]; + if (!strcmpiW( set_cookie->field, attr_set_cookie ) && !set_cookie->is_request) + { + set_cookies( request, set_cookie->value ); + } + } +} + +static BOOL receive_response( request_t *request, BOOL async ) +{ + BOOL ret; + DWORD size, query, status; + + for (;;) + { + if (!(ret = read_reply( request ))) break; + + size = sizeof(DWORD); + query = WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER; + if (!(ret = query_headers( request, query, NULL, &status, &size, NULL ))) break; + + size = sizeof(DWORD); + query = WINHTTP_QUERY_CONTENT_LENGTH | WINHTTP_QUERY_FLAG_NUMBER; + if (!query_headers( request, query, NULL, &request->content_length, &size, NULL )) + request->content_length = ~0u; + + if (!(request->hdr.disable_flags & WINHTTP_DISABLE_COOKIES)) record_cookies( request ); + + if (status == 301 || status == 302) + { + if (request->hdr.disable_flags & WINHTTP_DISABLE_REDIRECTS) break; + + drain_content( request ); + if (!(ret = handle_redirect( request ))) break; + + clear_response_headers( request ); + ret = send_request( request, NULL, 0, NULL, 0, 0, 0, FALSE ); /* recurse synchronously */ + continue; + } + if (status == 401) FIXME("authentication not supported\n"); + break; + } + + if (async) + { + if (ret) send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE, NULL, 0 ); + else + { + WINHTTP_ASYNC_RESULT result; + result.dwResult = API_RECEIVE_RESPONSE; + result.dwError = get_last_error(); + send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_REQUEST_ERROR, &result, sizeof(result) ); + } + } + return ret; +} + +static void task_receive_response( task_header_t *task ) +{ + receive_response_t *r = (receive_response_t *)task; + receive_response( r->hdr.request, TRUE ); +} + +/*********************************************************************** + * WinHttpReceiveResponse (winhttp.@) + */ +BOOL WINAPI WinHttpReceiveResponse( HINTERNET hrequest, LPVOID reserved ) +{ + BOOL ret; + request_t *request; + + TRACE("%p, %p\n", hrequest, reserved); + + if (!(request = (request_t *)grab_object( hrequest ))) + { + set_last_error( ERROR_INVALID_HANDLE ); + return FALSE; + } + if (request->hdr.type != WINHTTP_HANDLE_TYPE_REQUEST) + { + release_object( &request->hdr ); + set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); + return FALSE; + } + + if (request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) + { + receive_response_t *r; + + if (!(r = heap_alloc( sizeof(receive_response_t) ))) return FALSE; + r->hdr.request = request; + r->hdr.proc = task_receive_response; + + addref_object( &request->hdr ); + ret = queue_task( (task_header_t *)r ); + } + else + ret = receive_response( request, FALSE ); + + release_object( &request->hdr ); + return ret; +} + +static BOOL query_data( request_t *request, LPDWORD available, BOOL async ) +{ + BOOL ret; + DWORD num_bytes; + + if ((ret = netconn_query_data_available( &request->netconn, &num_bytes ))) + { + if (request->content_read < request->content_length) + { + if (!num_bytes) + { + char buffer[4096]; + size_t to_read = min( sizeof(buffer), request->content_length - request->content_read ); + + ret = netconn_recv( &request->netconn, buffer, to_read, MSG_PEEK, (int *)&num_bytes ); + if (ret && !num_bytes) WARN("expected more data to be available\n"); + } + } + else if (num_bytes) + { + WARN("extra data available %u\n", num_bytes); + ret = FALSE; + } + } + TRACE("%u bytes available\n", num_bytes); + + if (async) + { + if (ret) send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE, &num_bytes, sizeof(DWORD) ); + else + { + WINHTTP_ASYNC_RESULT result; + result.dwResult = API_QUERY_DATA_AVAILABLE; + result.dwError = get_last_error(); + send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_REQUEST_ERROR, &result, sizeof(result) ); + } + } + if (ret && available) *available = num_bytes; + return ret; +} + +static void task_query_data( task_header_t *task ) +{ + query_data_t *q = (query_data_t *)task; + query_data( q->hdr.request, q->available, TRUE ); +} + +/*********************************************************************** + * WinHttpQueryDataAvailable (winhttp.@) + */ +BOOL WINAPI WinHttpQueryDataAvailable( HINTERNET hrequest, LPDWORD available ) +{ + BOOL ret; + request_t *request; + + TRACE("%p, %p\n", hrequest, available); + + if (!(request = (request_t *)grab_object( hrequest ))) + { + set_last_error( ERROR_INVALID_HANDLE ); + return FALSE; + } + if (request->hdr.type != WINHTTP_HANDLE_TYPE_REQUEST) + { + release_object( &request->hdr ); + set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); + return FALSE; + } + + if (request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) + { + query_data_t *q; + + if (!(q = heap_alloc( sizeof(query_data_t) ))) return FALSE; + q->hdr.request = request; + q->hdr.proc = task_query_data; + q->available = available; + + addref_object( &request->hdr ); + ret = queue_task( (task_header_t *)q ); + } + else + ret = query_data( request, available, FALSE ); + + release_object( &request->hdr ); + return ret; +} + +static void task_read_data( task_header_t *task ) +{ + read_data_t *r = (read_data_t *)task; + read_data( r->hdr.request, r->buffer, r->to_read, r->read, TRUE ); +} + /*********************************************************************** * WinHttpReadData (winhttp.@) */ BOOL WINAPI WinHttpReadData( HINTERNET hrequest, LPVOID buffer, DWORD to_read, LPDWORD read ) { - static const WCHAR chunked[] = {'c','h','u','n','k','e','d',0}; - BOOL ret; request_t *request; - WCHAR encoding[20]; - DWORD num_bytes, buflen = sizeof(encoding); TRACE("%p, %p, %d, %p\n", hrequest, buffer, to_read, read); @@ -1276,17 +1529,53 @@ return FALSE; } - if (query_headers( request, WINHTTP_QUERY_TRANSFER_ENCODING, NULL, encoding, &buflen, NULL ) && - !strcmpiW( encoding, chunked )) - { - ret = read_data_chunked( request, buffer, to_read, &num_bytes, request->hdr.flags & WINHTTP_FLAG_ASYNC ); + if (request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) + { + read_data_t *r; + + if (!(r = heap_alloc( sizeof(read_data_t) ))) return FALSE; + r->hdr.request = request; + r->hdr.proc = task_read_data; + r->buffer = buffer; + r->to_read = to_read; + r->read = read; + + addref_object( &request->hdr ); + ret = queue_task( (task_header_t *)r ); } else - ret = read_data( request, buffer, to_read, &num_bytes, request->hdr.flags & WINHTTP_FLAG_ASYNC ); - - if (ret && read) *read = num_bytes; + ret = read_data( request, buffer, to_read, read, FALSE ); + release_object( &request->hdr ); return ret; +} + +static BOOL write_data( request_t *request, LPCVOID buffer, DWORD to_write, LPDWORD written, BOOL async ) +{ + BOOL ret; + int num_bytes; + + ret = netconn_send( &request->netconn, buffer, to_write, 0, &num_bytes ); + + if (async) + { + if (ret) send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE, &num_bytes, sizeof(DWORD) ); + else + { + WINHTTP_ASYNC_RESULT result; + result.dwResult = API_WRITE_DATA; + result.dwError = get_last_error(); + send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_REQUEST_ERROR, &result, sizeof(result) ); + } + } + if (ret && written) *written = num_bytes; + return ret; +} + +static void task_write_data( task_header_t *task ) +{ + write_data_t *w = (write_data_t *)task; + write_data( w->hdr.request, w->buffer, w->to_write, w->written, TRUE ); } /*********************************************************************** @@ -1311,7 +1600,22 @@ return FALSE; } - ret = netconn_send( &request->netconn, buffer, to_write, 0, (int *)written ); + if (request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) + { + write_data_t *w; + + if (!(w = heap_alloc( sizeof(write_data_t) ))) return FALSE; + w->hdr.request = request; + w->hdr.proc = task_write_data; + w->buffer = buffer; + w->to_write = to_write; + w->written = written; + + addref_object( &request->hdr ); + ret = queue_task( (task_header_t *)w ); + } + else + ret = write_data( request, buffer, to_write, written, FALSE ); release_object( &request->hdr ); return ret; Modified: trunk/reactos/dll/win32/winhttp/session.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/winhttp/session.…
============================================================================== --- trunk/reactos/dll/win32/winhttp/session.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/winhttp/session.c [iso-8859-1] Sun Jun 7 16:32:05 2009 @@ -25,6 +25,7 @@ #include "windef.h" #include "winbase.h" #include "winhttp.h" +#include "wincrypt.h" #include "winhttp_private.h" @@ -36,11 +37,17 @@ SetLastError( error ); } +DWORD get_last_error( void ) +{ + /* FIXME */ + return GetLastError(); +} + void send_callback( object_header_t *hdr, DWORD status, LPVOID info, DWORD buflen ) { TRACE("%p, 0x%08x, %p, %u\n", hdr, status, info, buflen); - if (hdr->notify_mask & status) hdr->callback( hdr->handle, hdr->context, status, info, buflen ); + if (hdr->callback && (hdr->notify_mask & status)) hdr->callback( hdr->handle, hdr->context, status, info, buflen ); } /*********************************************************************** @@ -58,9 +65,16 @@ static void session_destroy( object_header_t *hdr ) { session_t *session = (session_t *)hdr; + struct list *item, *next; + domain_t *domain; TRACE("%p\n", session); + LIST_FOR_EACH_SAFE( item, next, &session->cookie_cache ) + { + domain = LIST_ENTRY( item, domain_t, entry ); + delete_domain( domain ); + } heap_free( session->agent ); heap_free( session->proxy_server ); heap_free( session->proxy_bypass ); @@ -69,6 +83,30 @@ heap_free( session ); } +static BOOL session_query_option( object_header_t *hdr, DWORD option, LPVOID buffer, LPDWORD buflen ) +{ + switch (option) + { + case WINHTTP_OPTION_REDIRECT_POLICY: + { + if (!buffer || *buflen < sizeof(DWORD)) + { + *buflen = sizeof(DWORD); + set_last_error( ERROR_INSUFFICIENT_BUFFER ); + return FALSE; + } + + *(DWORD *)buffer = hdr->redirect_policy; + *buflen = sizeof(DWORD); + return TRUE; + } + default: + FIXME("unimplemented option %u\n", option); + set_last_error( ERROR_INVALID_PARAMETER ); + return FALSE; + } +} + static BOOL session_set_option( object_header_t *hdr, DWORD option, LPVOID buffer, DWORD buflen ) { switch (option) @@ -82,22 +120,33 @@ } case WINHTTP_OPTION_REDIRECT_POLICY: { - DWORD policy = *(DWORD *)buffer; - + DWORD policy; + + if (buflen != sizeof(policy)) + { + set_last_error( ERROR_INSUFFICIENT_BUFFER ); + return FALSE; + } + + policy = *(DWORD *)buffer; TRACE("0x%x\n", policy); hdr->redirect_policy = policy; return TRUE; } + case WINHTTP_OPTION_DISABLE_FEATURE: + set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); + return FALSE; default: FIXME("unimplemented option %u\n", option); - return TRUE; + set_last_error( ERROR_INVALID_PARAMETER ); + return FALSE; } } static const object_vtbl_t session_vtbl = { session_destroy, - NULL, + session_query_option, session_set_option }; @@ -118,6 +167,8 @@ session->hdr.flags = flags; session->hdr.refs = 1; session->access = access; + session->hdr.redirect_policy = WINHTTP_OPTION_REDIRECT_POLICY_DISALLOW_HTTPS_TO_HTTP; + list_init( &session->cookie_cache ); if (agent && !(session->agent = strdupW( agent ))) goto end; if (proxy && !(session->proxy_server = strdupW( proxy ))) goto end; @@ -202,10 +253,10 @@ list_add_head( &session->hdr.children, &connect->hdr.entry ); if (server && !(connect->hostname = strdupW( server ))) goto end; - connect->hostport = port ? port : (connect->hdr.flags & WINHTTP_FLAG_SECURE ? 443 : 80); + connect->hostport = port; if (server && !(connect->servername = strdupW( server ))) goto end; - connect->serverport = port ? port : (connect->hdr.flags & WINHTTP_FLAG_SECURE ? 443 : 80); + connect->serverport = port; if (!(hconnect = alloc_handle( &connect->hdr ))) goto end; connect->hdr.handle = hconnect; @@ -225,7 +276,7 @@ static void request_destroy( object_header_t *hdr ) { request_t *request = (request_t *)hdr; - int i; + DWORD i; TRACE("%p\n", request); @@ -251,15 +302,54 @@ { case WINHTTP_OPTION_SECURITY_FLAGS: { - DWORD flags = 0; - + DWORD flags; + + if (!buffer || *buflen < sizeof(flags)) + { + *buflen = sizeof(flags); + set_last_error( ERROR_INSUFFICIENT_BUFFER ); + return FALSE; + } + + flags = 0; if (hdr->flags & WINHTTP_FLAG_SECURE) flags |= SECURITY_FLAG_SECURE; *(DWORD *)buffer = flags; + *buflen = sizeof(flags); + return TRUE; + } + case WINHTTP_OPTION_SERVER_CERT_CONTEXT: + { + const CERT_CONTEXT *cert; + request_t *request = (request_t *)hdr; + + if (!buffer || *buflen < sizeof(cert)) + { + *buflen = sizeof(cert); + set_last_error( ERROR_INSUFFICIENT_BUFFER ); + return FALSE; + } + + if (!(cert = netconn_get_certificate( &request->netconn ))) return FALSE; + *(CERT_CONTEXT **)buffer = (CERT_CONTEXT *)cert; + *buflen = sizeof(cert); + return TRUE; + } + case WINHTTP_OPTION_SECURITY_KEY_BITNESS: + { + if (!buffer || *buflen < sizeof(DWORD)) + { + *buflen = sizeof(DWORD); + set_last_error( ERROR_INSUFFICIENT_BUFFER ); + return FALSE; + } + + *(DWORD *)buffer = 128; /* FIXME */ *buflen = sizeof(DWORD); return TRUE; } default: FIXME("unimplemented option %u\n", option); + set_last_error( ERROR_INVALID_PARAMETER ); return FALSE; } } @@ -277,30 +367,52 @@ } case WINHTTP_OPTION_DISABLE_FEATURE: { - DWORD disable = *(DWORD *)buffer; - + DWORD disable; + + if (buflen != sizeof(DWORD)) + { + set_last_error( ERROR_INSUFFICIENT_BUFFER ); + return FALSE; + } + + disable = *(DWORD *)buffer; TRACE("0x%x\n", disable); - hdr->disable_flags &= disable; + hdr->disable_flags |= disable; return TRUE; } case WINHTTP_OPTION_AUTOLOGON_POLICY: { - DWORD policy = *(DWORD *)buffer; - + DWORD policy; + + if (buflen != sizeof(DWORD)) + { + set_last_error( ERROR_INSUFFICIENT_BUFFER ); + return FALSE; + } + + policy = *(DWORD *)buffer; TRACE("0x%x\n", policy); hdr->logon_policy = policy; return TRUE; } case WINHTTP_OPTION_REDIRECT_POLICY: { - DWORD policy = *(DWORD *)buffer; - + DWORD policy; + + if (buflen != sizeof(DWORD)) + { + set_last_error( ERROR_INSUFFICIENT_BUFFER ); + return FALSE; + } + + policy = *(DWORD *)buffer; TRACE("0x%x\n", policy); hdr->redirect_policy = policy; return TRUE; } default: FIXME("unimplemented option %u\n", option); + set_last_error( ERROR_INVALID_PARAMETER ); return TRUE; } } @@ -355,9 +467,26 @@ if (!netconn_init( &request->netconn, request->hdr.flags & WINHTTP_FLAG_SECURE )) goto end; - if (verb && !(request->verb = strdupW( verb ))) goto end; - if (object && !(request->path = strdupW( object ))) goto end; - if (version && !(request->version = strdupW( version ))) goto end; + if (!verb || !verb[0]) verb = getW; + if (!(request->verb = strdupW( verb ))) goto end; + + if (object) + { + WCHAR *path, *p; + unsigned int len; + + len = strlenW( object ) + 1; + if (object[0] != '/') len++; + if (!(p = path = heap_alloc( len * sizeof(WCHAR) ))) goto end; + + if (object[0] != '/') *p++ = '/'; + strcpyW( p, object ); + request->path = path; + } + else if (!(request->path = strdupW( slashW ))) goto end; + + if (!version || !version[0]) version = http1_1; + if (!(request->version = strdupW( version ))) goto end; if (!(hrequest = alloc_handle( &request->hdr ))) goto end; request->hdr.handle = hrequest; @@ -394,19 +523,36 @@ { BOOL ret = FALSE; + if (!buflen) + { + set_last_error( ERROR_INVALID_PARAMETER ); + return FALSE; + } + switch (option) { case WINHTTP_OPTION_CONTEXT_VALUE: { + if (!buffer || *buflen < sizeof(DWORD_PTR)) + { + *buflen = sizeof(DWORD_PTR); + set_last_error( ERROR_INSUFFICIENT_BUFFER ); + return FALSE; + } + *(DWORD_PTR *)buffer = hdr->context; *buflen = sizeof(DWORD_PTR); return TRUE; } default: - { if (hdr->vtbl->query_option) ret = hdr->vtbl->query_option( hdr, option, buffer, buflen ); - else FIXME("unimplemented option %u\n", option); - } + else + { + FIXME("unimplemented option %u\n", option); + set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); + return FALSE; + } + break; } return ret; } @@ -437,18 +583,34 @@ { BOOL ret = TRUE; + if (!buffer) + { + set_last_error( ERROR_INVALID_PARAMETER ); + return FALSE; + } + switch (option) { case WINHTTP_OPTION_CONTEXT_VALUE: { + if (buflen != sizeof(DWORD_PTR)) + { + set_last_error( ERROR_INSUFFICIENT_BUFFER ); + return FALSE; + } + hdr->context = *(DWORD_PTR *)buffer; return TRUE; } default: - { if (hdr->vtbl->set_option) ret = hdr->vtbl->set_option( hdr, option, buffer, buflen ); - else FIXME("unimplemented option %u\n", option); - } + else + { + FIXME("unimplemented option %u\n", option); + set_last_error( ERROR_WINHTTP_INCORRECT_HANDLE_TYPE ); + return FALSE; + } + break; } return ret; } Added: trunk/reactos/dll/win32/winhttp/url.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/winhttp/url.c?re…
============================================================================== --- trunk/reactos/dll/win32/winhttp/url.c (added) +++ trunk/reactos/dll/win32/winhttp/url.c [iso-8859-1] Sun Jun 7 16:32:05 2009 @@ -1,0 +1,484 @@ +/* + * Copyright 2008 Hans Leidekker for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "config.h" +#include <stdarg.h> + +#include "wine/debug.h" + +#include "windef.h" +#include "winbase.h" +#include "winreg.h" +#include "winhttp.h" +#include "shlwapi.h" + +#include "winhttp_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(winhttp); + +static const WCHAR scheme_http[] = {'h','t','t','p',0}; +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) + { + if (len && (flags & ICU_DECODE)) + { + set_last_error( ERROR_INVALID_PARAMETER ); + return FALSE; + } + *str = value; + *str_len = len; + } + else + { + if (len > (*str_len) - 1) + { + *str_len = len + 1; + set_last_error( ERROR_INSUFFICIENT_BUFFER ); + return FALSE; + } + memcpy( *str, value, len * sizeof(WCHAR) ); + (*str)[len] = 0; + *str_len = len; + } + return TRUE; +} + +static BOOL decode_url( LPCWSTR url, LPWSTR buffer, LPDWORD buflen ) +{ + HRESULT hr = UrlCanonicalizeW( url, buffer, buflen, URL_WININET_COMPATIBILITY | URL_UNESCAPE ); + if (hr == E_POINTER) set_last_error( ERROR_INSUFFICIENT_BUFFER ); + if (hr == E_INVALIDARG) set_last_error( ERROR_INVALID_PARAMETER ); + return (SUCCEEDED(hr)) ? TRUE : FALSE; +} + +/*********************************************************************** + * WinHttpCrackUrl (winhttp.@) + */ +BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONENTSW uc ) +{ + BOOL ret = FALSE; + WCHAR *p, *q, *r; + WCHAR *url_decoded = NULL; + + TRACE("%s, %d, %x, %p\n", debugstr_w(url), len, flags, uc); + + if (flags & ICU_ESCAPE) FIXME("flag ICU_ESCAPE not supported\n"); + + if (!url || !uc || uc->dwStructSize != sizeof(URL_COMPONENTS)) + { + set_last_error( ERROR_INVALID_PARAMETER ); + return FALSE; + } + if (!len) len = strlenW( url ); + + if (flags & ICU_DECODE) + { + WCHAR *url_tmp; + DWORD url_len = len + 1; + + if (!(url_tmp = HeapAlloc( GetProcessHeap(), 0, url_len * sizeof(WCHAR) ))) + { + set_last_error( ERROR_OUTOFMEMORY ); + return FALSE; + } + memcpy( url_tmp, url, len * sizeof(WCHAR) ); + url_tmp[len] = 0; + if (!(url_decoded = HeapAlloc( GetProcessHeap(), 0, url_len * sizeof(WCHAR) ))) + { + HeapFree( GetProcessHeap(), 0, url_tmp ); + set_last_error( ERROR_OUTOFMEMORY ); + return FALSE; + } + if (decode_url( url_tmp, url_decoded, &url_len )) + { + len = url_len; + url = url_decoded; + } + HeapFree( GetProcessHeap(), 0, url_tmp ); + } + if (!(p = strchrW( url, ':' ))) + { + 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; + else + { + set_last_error( ERROR_WINHTTP_UNRECOGNIZED_SCHEME ); + goto exit; + } + if (!(set_component( &uc->lpszScheme, &uc->dwSchemeLength, (WCHAR *)url, p - url, flags ))) goto exit; + + p++; /* skip ':' */ + if (!p[0] || p[0] != '/' || p[1] != '/') goto exit; + p += 2; + + if (!p[0]) goto exit; + if ((q = memchrW( p, '@', len - (p - url) ))) + { + if ((r = memchrW( p, ':', q - p ))) + { + if (!(set_component( &uc->lpszUserName, &uc->dwUserNameLength, p, r - p, flags ))) goto exit; + r++; + if (!(set_component( &uc->lpszPassword, &uc->dwPasswordLength, r, q - r, flags ))) goto exit; + } + else + { + if (!(set_component( &uc->lpszUserName, &uc->dwUserNameLength, p, q - p, flags ))) goto exit; + if (!(set_component( &uc->lpszPassword, &uc->dwPasswordLength, NULL, 0, flags ))) goto exit; + } + p = q + 1; + } + else + { + if (!(set_component( &uc->lpszUserName, &uc->dwUserNameLength, NULL, 0, flags ))) goto exit; + if (!(set_component( &uc->lpszPassword, &uc->dwPasswordLength, NULL, 0, flags ))) goto exit; + } + if ((q = memchrW( p, '/', len - (p - url) ))) + { + if ((r = memchrW( p, ':', q - p ))) + { + if (!(set_component( &uc->lpszHostName, &uc->dwHostNameLength, p, r - p, flags ))) goto exit; + r++; + uc->nPort = atoiW( r ); + } + 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 ((r = memchrW( q, '?', len - (q - url) ))) + { + if (!(set_component( &uc->lpszUrlPath, &uc->dwUrlPathLength, q, r - q, flags ))) goto exit; + if (!(set_component( &uc->lpszExtraInfo, &uc->dwExtraInfoLength, r, len - (r - url), flags ))) goto exit; + } + else + { + if (!(set_component( &uc->lpszUrlPath, &uc->dwUrlPathLength, q, len - (q - url), flags ))) goto exit; + if (!(set_component( &uc->lpszExtraInfo, &uc->dwExtraInfoLength, (WCHAR *)url + len, 0, flags ))) goto exit; + } + } + else + { + if ((r = memchrW( p, ':', len - (p - url) ))) + { + if (!(set_component( &uc->lpszHostName, &uc->dwHostNameLength, p, r - p, flags ))) goto exit; + r++; + uc->nPort = atoiW( r ); + } + 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 (!(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; + } + + ret = TRUE; + + TRACE("scheme(%s) host(%s) port(%d) path(%s) extra(%s)\n", + debugstr_wn( uc->lpszScheme, uc->dwSchemeLength ), + debugstr_wn( uc->lpszHostName, uc->dwHostNameLength ), + uc->nPort, + debugstr_wn( uc->lpszUrlPath, uc->dwUrlPathLength ), + debugstr_wn( uc->lpszExtraInfo, uc->dwExtraInfoLength )); + +exit: + HeapFree( GetProcessHeap(), 0, url_decoded ); + return ret; +} + +static INTERNET_SCHEME get_scheme( const WCHAR *scheme, DWORD len ) +{ + if (!strncmpW( scheme, scheme_http, len )) return INTERNET_SCHEME_HTTP; + if (!strncmpW( scheme, scheme_https, len )) return INTERNET_SCHEME_HTTPS; + return 0; +} + +static const WCHAR *get_scheme_string( INTERNET_SCHEME scheme ) +{ + if (scheme == INTERNET_SCHEME_HTTP) return scheme_http; + if (scheme == INTERNET_SCHEME_HTTPS) return scheme_https; + return NULL; +} + +static BOOL uses_default_port( INTERNET_SCHEME scheme, INTERNET_PORT port ) +{ + if ((scheme == INTERNET_SCHEME_HTTP) && (port == INTERNET_DEFAULT_HTTP_PORT)) return TRUE; + if ((scheme == INTERNET_SCHEME_HTTPS) && (port == INTERNET_DEFAULT_HTTPS_PORT)) return TRUE; + return FALSE; +} + +static BOOL need_escape( WCHAR c ) +{ + if (isalnumW( c )) return FALSE; + + if (c <= 31 || c >= 127) return TRUE; + else + { + switch (c) + { + case ' ': + case '"': + case '#': + case '%': + case '<': + case '>': + case ']': + case '\\': + case '[': + case '^': + case '`': + case '{': + case '|': + case '}': + case '~': + return TRUE; + default: + return FALSE; + } + } +} + +static DWORD copy_escape( WCHAR *dst, const WCHAR *src, DWORD len ) +{ + static const WCHAR hex[] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; + DWORD ret = len; + unsigned int i; + WCHAR *p = dst; + + for (i = 0; i < len; i++, p++) + { + if (need_escape( src[i] )) + { + p[0] = '%'; + p[1] = hex[(src[i] >> 4) & 0xf]; + p[2] = hex[src[i] & 0xf]; + ret += 2; + p += 2; + } + else *p = src[i]; + } + dst[ret] = 0; + return ret; +} + +static DWORD comp_length( DWORD len, DWORD flags, WCHAR *comp ) +{ + DWORD ret; + unsigned int i; + + ret = len ? len : strlenW( comp ); + if (!(flags & ICU_ESCAPE)) return ret; + for (i = 0; i < len; i++) if (need_escape( comp[i] )) ret += 2; + return ret; +} + +static BOOL calc_length( URL_COMPONENTS *uc, DWORD flags, LPDWORD len ) +{ + static const WCHAR formatW[] = {'%','d',0}; + INTERNET_SCHEME scheme; + + *len = 0; + if (uc->lpszScheme) + { + DWORD scheme_len = comp_length( uc->dwSchemeLength, 0, uc->lpszScheme ); + *len += scheme_len; + scheme = get_scheme( uc->lpszScheme, scheme_len ); + } + else + { + scheme = uc->nScheme; + if (!scheme) scheme = INTERNET_SCHEME_HTTP; + *len += strlenW( get_scheme_string( scheme ) ); + } + *len += 1; /* ':' */ + if (uc->lpszHostName) *len += 2; /* "//" */ + + if (uc->lpszUserName) + { + *len += comp_length( uc->dwUserNameLength, 0, uc->lpszUserName ); + *len += 1; /* "@" */ + } + else + { + if (uc->lpszPassword) + { + set_last_error( ERROR_INVALID_PARAMETER ); + return FALSE; + } + } + if (uc->lpszPassword) + { + *len += 1; /* ":" */ + *len += comp_length( uc->dwPasswordLength, 0, uc->lpszPassword ); + } + if (uc->lpszHostName) + { + *len += comp_length( uc->dwHostNameLength, 0, uc->lpszHostName ); + + if (!uses_default_port( scheme, uc->nPort )) + { + WCHAR port[sizeof("65535")]; + + sprintfW( port, formatW, uc->nPort ); + *len += strlenW( port ); + *len += 1; /* ":" */ + } + if (uc->lpszUrlPath && *uc->lpszUrlPath != '/') *len += 1; /* '/' */ + } + if (uc->lpszUrlPath) *len += comp_length( uc->dwUrlPathLength, flags, uc->lpszUrlPath ); + if (uc->lpszExtraInfo) *len += comp_length( uc->dwExtraInfoLength, flags, uc->lpszExtraInfo ); + return TRUE; +} + +/*********************************************************************** + * WinHttpCreateUrl (winhttp.@) + */ +BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDWORD required ) +{ + static const WCHAR formatW[] = {'%','d',0}; + static const WCHAR twoslashW[] = {'/','/'}; + + DWORD len; + INTERNET_SCHEME scheme; + + TRACE("%p, 0x%08x, %p, %p\n", uc, flags, url, required); + + if (!uc || uc->dwStructSize != sizeof(URL_COMPONENTS) || !required) + { + set_last_error( ERROR_INVALID_PARAMETER ); + return FALSE; + } + + if (!calc_length( uc, flags, &len )) return FALSE; + + if (!url || *required < len) + { + *required = len + 1; + set_last_error( ERROR_INSUFFICIENT_BUFFER ); + return FALSE; + } + + url[0] = 0; + *required = len; + if (uc->lpszScheme) + { + len = comp_length( uc->dwSchemeLength, 0, uc->lpszScheme ); + memcpy( url, uc->lpszScheme, len * sizeof(WCHAR) ); + url += len; + + scheme = get_scheme( uc->lpszScheme, len ); + } + else + { + const WCHAR *schemeW; + scheme = uc->nScheme; + + if (!scheme) scheme = INTERNET_SCHEME_HTTP; + + schemeW = get_scheme_string( scheme ); + len = strlenW( schemeW ); + memcpy( url, schemeW, len * sizeof(WCHAR) ); + url += len; + } + + /* all schemes are followed by at least a colon */ + *url = ':'; + url++; + + if (uc->lpszHostName) + { + memcpy( url, twoslashW, sizeof(twoslashW) ); + url += sizeof(twoslashW) / sizeof(twoslashW[0]); + } + if (uc->lpszUserName) + { + len = comp_length( uc->dwUserNameLength, 0, uc->lpszUserName ); + memcpy( url, uc->lpszUserName, len * sizeof(WCHAR) ); + url += len; + + if (uc->lpszPassword) + { + *url = ':'; + url++; + + len = comp_length( uc->dwPasswordLength, 0, uc->lpszPassword ); + memcpy( url, uc->lpszPassword, len * sizeof(WCHAR) ); + url += len; + } + *url = '@'; + url++; + } + if (uc->lpszHostName) + { + len = comp_length( uc->dwHostNameLength, 0, uc->lpszHostName ); + memcpy( url, uc->lpszHostName, len * sizeof(WCHAR) ); + url += len; + + if (!uses_default_port( scheme, uc->nPort )) + { + WCHAR port[sizeof("65535")]; + + sprintfW( port, formatW, uc->nPort ); + *url = ':'; + url++; + + len = strlenW( port ); + memcpy( url, port, len * sizeof(WCHAR) ); + url += len; + } + + /* add slash between hostname and path if necessary */ + if (uc->lpszUrlPath && *uc->lpszUrlPath != '/') + { + *url = '/'; + url++; + } + } + if (uc->lpszUrlPath) + { + len = comp_length( uc->dwUrlPathLength, 0, uc->lpszUrlPath ); + if (flags & ICU_ESCAPE) url += copy_escape( url, uc->lpszUrlPath, len ); + else + { + memcpy( url, uc->lpszUrlPath, len * sizeof(WCHAR) ); + url += len; + } + } + if (uc->lpszExtraInfo) + { + len = comp_length( uc->dwExtraInfoLength, 0, uc->lpszExtraInfo ); + if (flags & ICU_ESCAPE) url += copy_escape( url, uc->lpszExtraInfo, len ); + else + { + memcpy( url, uc->lpszExtraInfo, len * sizeof(WCHAR) ); + url += len; + } + } + *url = 0; + return TRUE; +} Propchange: trunk/reactos/dll/win32/winhttp/url.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/dll/win32/winhttp/winhttp.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/winhttp/winhttp.…
============================================================================== --- trunk/reactos/dll/win32/winhttp/winhttp.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/win32/winhttp/winhttp.rbuild [iso-8859-1] Sun Jun 7 16:32:05 2009 @@ -7,12 +7,15 @@ <include base="winhttp">.</include> <include base="ReactOS">include/reactos/wine</include> <define name="__WINESRC__" /> + <file>cookie.c</file> <file>handle.c</file> <file>main.c</file> <file>net.c</file> <file>request.c</file> <file>session.c</file> + <file>url.c</file> <library>wine</library> + <library>shlwapi</library> <library>wininet</library> <library>ws2_32</library> <library>kernel32</library> Modified: trunk/reactos/dll/win32/winhttp/winhttp_private.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/winhttp/winhttp_…
============================================================================== --- trunk/reactos/dll/win32/winhttp/winhttp_private.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/winhttp/winhttp_private.h [iso-8859-1] Sun Jun 7 16:32:05 2009 @@ -26,6 +26,7 @@ #include "wine/list.h" #include "wine/unicode.h" +#include <sys/types.h> #ifdef HAVE_NETINET_IN_H # include <netinet/in.h> #endif @@ -33,14 +34,17 @@ # include <netdb.h> #endif #if defined(__MINGW32__) || defined (_MSC_VER) -# include "ws2tcpip.h" -# ifndef MSG_WAITALL -# define MSG_WAITALL 0 -# endif +# include <ws2tcpip.h> #else -# define closesocket close -# define ioctlsocket ioctl -#endif /* __MINGW32__ */ +# define closesocket close +# define ioctlsocket ioctl +#endif + +static const WCHAR getW[] = {'G','E','T',0}; +static const WCHAR postW[] = {'P','O','S','T',0}; +static const WCHAR slashW[] = {'/',0}; +static const WCHAR http1_0[] = {'H','T','T','P','/','1','.','0',0}; +static const WCHAR http1_1[] = {'H','T','T','P','/','1','.','1',0}; typedef struct _object_header_t object_header_t; @@ -71,6 +75,21 @@ typedef struct { + struct list entry; + WCHAR *name; + struct list cookies; +} domain_t; + +typedef struct +{ + struct list entry; + WCHAR *name; + WCHAR *value; + WCHAR *path; +} cookie_t; + +typedef struct +{ object_header_t hdr; LPWSTR agent; DWORD access; @@ -78,6 +97,7 @@ LPWSTR proxy_bypass; LPWSTR proxy_username; LPWSTR proxy_password; + struct list cookie_cache; } session_t; typedef struct @@ -97,7 +117,6 @@ { int socket; BOOL secure; /* SSL active on connection? */ - void *ssl_ctx; void *ssl_conn; char *peek_msg; char *peek_msg_mem; @@ -127,6 +146,52 @@ DWORD num_headers; } request_t; +typedef struct _task_header_t task_header_t; + +struct _task_header_t +{ + request_t *request; + void (*proc)( task_header_t * ); +}; + +typedef struct +{ + task_header_t hdr; + LPWSTR headers; + DWORD headers_len; + LPVOID optional; + DWORD optional_len; + DWORD total_len; + DWORD_PTR context; +} send_request_t; + +typedef struct +{ + task_header_t hdr; +} receive_response_t; + +typedef struct +{ + task_header_t hdr; + LPDWORD available; +} query_data_t; + +typedef struct +{ + task_header_t hdr; + LPVOID buffer; + DWORD to_read; + LPDWORD read; +} read_data_t; + +typedef struct +{ + task_header_t hdr; + LPCVOID buffer; + DWORD to_write; + LPDWORD written; +} write_data_t; + object_header_t *addref_object( object_header_t * ); object_header_t *grab_object( HINTERNET ); void release_object( object_header_t * ); @@ -134,6 +199,7 @@ BOOL free_handle( HINTERNET ); void set_last_error( DWORD ); +DWORD get_last_error( void ); void send_callback( object_header_t *, DWORD, LPVOID, DWORD ); void close_connection( request_t * ); @@ -148,6 +214,12 @@ BOOL netconn_resolve( WCHAR *, INTERNET_PORT, struct sockaddr_in * ); BOOL netconn_secure_connect( netconn_t * ); BOOL netconn_send( netconn_t *, const void *, size_t, int, int * ); +const void *netconn_get_certificate( netconn_t * ); + +BOOL set_cookies( request_t *, const WCHAR * ); +BOOL add_cookie_headers( request_t * ); +BOOL add_request_headers( request_t *, LPCWSTR, DWORD, DWORD ); +void delete_domain( domain_t * ); static inline void *heap_alloc( SIZE_T size ) { Modified: trunk/reactos/include/psdk/winhttp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winhttp.h?rev…
============================================================================== --- trunk/reactos/include/psdk/winhttp.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/winhttp.h [iso-8859-1] Sun Jun 7 16:32:05 2009 @@ -35,6 +35,8 @@ #define INTERNET_SCHEME_HTTP 1 #define INTERNET_SCHEME_HTTPS 2 typedef int INTERNET_SCHEME, *LPINTERNET_SCHEME; + +#define ICU_ESCAPE 0x80000000 /* flags for WinHttpOpen */ #define WINHTTP_FLAG_ASYNC 0x10000000
15 years, 5 months
1
0
0
0
[cwittich] 41332: sync msiexec to wine 1.1.23
by cwittich@svn.reactos.org
Author: cwittich Date: Sun Jun 7 15:34:39 2009 New Revision: 41332 URL:
http://svn.reactos.org/svn/reactos?rev=41332&view=rev
Log: sync msiexec to wine 1.1.23 Modified: trunk/reactos/base/system/msiexec/msiexec.c trunk/reactos/base/system/msiexec/msiexec.ico trunk/reactos/base/system/msiexec/service.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/base/system/msiexec/msiexec.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/msiexec/msiexe…
============================================================================== --- trunk/reactos/base/system/msiexec/msiexec.c [iso-8859-1] (original) +++ trunk/reactos/base/system/msiexec/msiexec.c [iso-8859-1] Sun Jun 7 15:34:39 2009 @@ -1,7 +1,7 @@ /* * msiexec.exe implementation * - * Copyright 2004 Vincent Béron + * Copyright 2004 Vincent Béron * Copyright 2005 Mike McCormack * * This library is free software; you can redistribute it and/or @@ -69,7 +69,7 @@ " msiexec {/h|/?}\n" "NOTE: Product code on commandline unimplemented as of yet\n" "\n" -"Copyright 2004 Vincent Béron\n"; +"Copyright 2004 Vincent Béron\n"; static const WCHAR ActionAdmin[] = { 'A','C','T','I','O','N','=','A','D','M','I','N',0 }; @@ -388,9 +388,9 @@ static int chomp( WCHAR *str ) { - enum chomp_state state = cs_whitespace; + enum chomp_state state = cs_token; WCHAR *p, *out; - int count = 0, ignore; + int count = 1, ignore; for( p = str, out = str; *p; p++ ) { @@ -493,7 +493,7 @@ return ret; } -int main(int argc, char **argv) +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { int i; BOOL FunctionInstall = FALSE; @@ -529,9 +529,10 @@ LPWSTR DllName = NULL; DWORD ReturnCode; + int argc; LPWSTR *argvW = NULL; - /* overwrite the command line */ + /* parse the command line */ process_args( GetCommandLineW(), &argc, &argvW ); /* Modified: trunk/reactos/base/system/msiexec/msiexec.ico URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/msiexec/msiexe…
============================================================================== Binary files - no diff available. Modified: trunk/reactos/base/system/msiexec/service.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/msiexec/servic…
============================================================================== --- trunk/reactos/base/system/msiexec/service.c [iso-8859-1] (original) +++ trunk/reactos/base/system/msiexec/service.c [iso-8859-1] Sun Jun 7 15:34:39 2009 @@ -32,7 +32,7 @@ static HANDLE thread; static HANDLE kill_event; -void KillService(void) +static void KillService(void) { WINE_TRACE("Killing service\n"); SetEvent(kill_event); Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sun Jun 7 15:34:39 2009 @@ -186,7 +186,7 @@ reactos/base/applications/wordpad # Autosync reactos/base/services/rpcss # Synced to Wine-20081105 reactos/base/system/expand # Out of sync -reactos/base/system/msiexec # Synced to Wine-1_1_5 +reactos/base/system/msiexec # Synced to Wine-1_1_23 reactos/modules/rosapps/winfile # Autosync In addition the following libs, dlls and source files are mostly based on code ported
15 years, 5 months
1
0
0
0
[cwittich] 41331: sync msvcrt_winetest with wine 1.1.23
by cwittich@svn.reactos.org
Author: cwittich Date: Sun Jun 7 15:27:20 2009 New Revision: 41331 URL:
http://svn.reactos.org/svn/reactos?rev=41331&view=rev
Log: sync msvcrt_winetest with wine 1.1.23 Modified: trunk/rostests/winetests/msvcrt/cpp.c trunk/rostests/winetests/msvcrt/data.c trunk/rostests/winetests/msvcrt/file.c trunk/rostests/winetests/msvcrt/headers.c trunk/rostests/winetests/msvcrt/heap.c trunk/rostests/winetests/msvcrt/printf.c trunk/rostests/winetests/msvcrt/string.c Modified: trunk/rostests/winetests/msvcrt/cpp.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msvcrt/cpp.c?re…
============================================================================== --- trunk/rostests/winetests/msvcrt/cpp.c [iso-8859-1] (original) +++ trunk/rostests/winetests/msvcrt/cpp.c [iso-8859-1] Sun Jun 7 15:27:20 2009 @@ -55,10 +55,10 @@ /* Function pointers. We need to use these to call these funcs as __thiscall */ static HMODULE hMsvcrt; -static void* (*poperator_new)(unsigned int); -static void (*poperator_delete)(void*); -static void* (*pmalloc)(unsigned int); -static void (*pfree)(void*); +static void* (__cdecl *poperator_new)(unsigned int); +static void (__cdecl *poperator_delete)(void*); +static void* (__cdecl *pmalloc)(unsigned int); +static void (__cdecl *pfree)(void*); /* exception */ static void (WINAPI *pexception_ctor)(exception*,LPCSTR*); @@ -113,12 +113,12 @@ static int (WINAPI *ptype_info_opnot_equals)(type_info*,type_info*); /* RTTI */ -static type_info* (*p__RTtypeid)(void*); -static void* (*p__RTCastToVoid)(void*); -static void* (*p__RTDynamicCast)(void*,int,void*,void*,int); +static type_info* (__cdecl *p__RTtypeid)(void*); +static void* (__cdecl *p__RTCastToVoid)(void*); +static void* (__cdecl *p__RTDynamicCast)(void*,int,void*,void*,int); /*Demangle*/ -static char* (*p__unDName)(char*,const char*,int,void*,void*,unsigned short int); +static char* (__cdecl *p__unDName)(char*,const char*,int,void*,void*,unsigned short int); /* _very_ early native versions have serious RTTI bugs, so we check */ Modified: trunk/rostests/winetests/msvcrt/data.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msvcrt/data.c?r…
============================================================================== --- trunk/rostests/winetests/msvcrt/data.c [iso-8859-1] (original) +++ trunk/rostests/winetests/msvcrt/data.c [iso-8859-1] Sun Jun 7 15:27:20 2009 @@ -31,12 +31,12 @@ #include <process.h> #include <errno.h> -typedef void (*_INITTERMFUN)(void); -static void (*p_initterm)(_INITTERMFUN *start, _INITTERMFUN *end); +typedef void (__cdecl *_INITTERMFUN)(void); +static void (__cdecl *p_initterm)(_INITTERMFUN *start, _INITTERMFUN *end); static int callbacked; -static void initcallback(void) +static void __cdecl initcallback(void) { callbacked++; } Modified: trunk/rostests/winetests/msvcrt/file.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msvcrt/file.c?r…
============================================================================== --- trunk/rostests/winetests/msvcrt/file.c [iso-8859-1] (original) +++ trunk/rostests/winetests/msvcrt/file.c [iso-8859-1] Sun Jun 7 15:27:20 2009 @@ -179,7 +179,7 @@ const int *ip; int i, j, m, ao, pl; unsigned int fp; - long l; + LONG l; fd = open ("fdopen.tst", O_WRONLY | O_CREAT | O_BINARY, _S_IREAD |_S_IWRITE); /* an internal buffer of BUFSIZ is maintained, so make a file big @@ -212,7 +212,7 @@ ok(fgets(buffer,2*BUFSIZ+256,file) !=0,"padding line fgets failed unexpected in %s\n", IOMODE); l = ftell(file); pl = 2*BUFSIZ-2; - ok(l == pl,"padding line ftell got %ld should be %d in %s\n", l, pl, IOMODE); + ok(l == pl,"padding line ftell got %d should be %d in %s\n", l, pl, IOMODE); ok(lstrlenA(buffer) == pl+ao,"padding line fgets got size %d should be %d in %s\n", lstrlenA(buffer), pl+ao, IOMODE); for (fp=0; fp<strlen(outbuffer); fp++) @@ -220,23 +220,23 @@ fp++; ok(fgets(buffer,256,file) !=0,"line 1 fgets failed unexpected in %s\n", IOMODE); l = ftell(file); - ok(l == pl+fp,"line 1 ftell got %ld should be %d in %s\n", l, pl+fp, IOMODE); + ok(l == pl+fp,"line 1 ftell got %d should be %d in %s\n", l, pl+fp, IOMODE); ok(lstrlenA(buffer) == fp+ao,"line 1 fgets got size %d should be %d in %s\n", lstrlenA(buffer), fp+ao, IOMODE); /* test a seek back across the buffer boundary */ l = pl; ok(fseek(file,l,SEEK_SET)==0,"seek failure in %s\n", IOMODE); l = ftell(file); - ok(l == pl,"ftell after seek got %ld should be %d in %s\n", l, pl, IOMODE); + ok(l == pl,"ftell after seek got %d should be %d in %s\n", l, pl, IOMODE); ok(fgets(buffer,256,file) !=0,"second read of line 1 fgets failed unexpected in %s\n", IOMODE); l = ftell(file); - ok(l == pl+fp,"second read of line 1 ftell got %ld should be %d in %s\n", l, pl+fp, IOMODE); + ok(l == pl+fp,"second read of line 1 ftell got %d should be %d in %s\n", l, pl+fp, IOMODE); ok(lstrlenA(buffer) == fp+ao,"second read of line 1 fgets got size %d should be %d in %s\n", lstrlenA(buffer), fp+ao, IOMODE); ok(fgets(buffer,256,file) !=0,"line 2 fgets failed unexpected in %s\n", IOMODE); fp += 2; l = ftell(file); - ok(l == pl+fp,"line 2 ftell got %ld should be %d in %s\n", l, pl+fp, IOMODE); + ok(l == pl+fp,"line 2 ftell got %d should be %d in %s\n", l, pl+fp, IOMODE); ok(lstrlenA(buffer) == 2+ao,"line 2 fgets got size %d should be %d in %s\n", lstrlenA(buffer), 2+ao, IOMODE); @@ -248,7 +248,7 @@ i=fread(buffer,1,BUFSIZ+strlen(outbuffer),file); ok(i==BUFSIZ+j,"fread failed, expected %d got %d in %s\n", BUFSIZ+j, i, IOMODE); l = ftell(file); - ok(l == pl+j-(ao*4)-5,"ftell after fread got %ld should be %d in %s\n", l, pl+j-(ao*4)-5, IOMODE); + ok(l == pl+j-(ao*4)-5,"ftell after fread got %d should be %d in %s\n", l, pl+j-(ao*4)-5, IOMODE); for (m=0; m<3; m++) ok(buffer[m]==padbuffer[m+(BUFSIZ-4)%strlen(padbuffer)],"expected %c got %c\n", padbuffer[m], buffer[m]); m+=BUFSIZ+2+ao; @@ -531,7 +531,7 @@ BOOL diff_found = FALSE; int j; unsigned int i; - long l; + LONG l; tempf=_tempnam(".","wne"); tempfh = fopen(tempf,"wb"); @@ -550,10 +550,10 @@ tempfh = fopen(tempf,"rt"); /* open in TEXT mode */ fgetws(wtextW,LLEN,tempfh); l=ftell(tempfh); - ok(l==BUFSIZ-2, "ftell expected %d got %ld\n", BUFSIZ-2, l); + ok(l==BUFSIZ-2, "ftell expected %d got %d\n", BUFSIZ-2, l); fgetws(wtextW,LLEN,tempfh); l=ftell(tempfh); - ok(l==BUFSIZ-2+strlen(mytext), "ftell expected %d got %ld\n", BUFSIZ-2+lstrlen(mytext), l); + ok(l==BUFSIZ-2+strlen(mytext), "ftell expected %d got %d\n", BUFSIZ-2+lstrlen(mytext), l); mytextW = AtoW (mytext); aptr = mytextW; wptr = wtextW; @@ -586,25 +586,25 @@ fgetws(wtextW,j,tempfh); l=ftell(tempfh); j=(j-1)*sizeof(WCHAR); - ok(l==j, "ftell expected %d got %ld\n", j, l); + ok(l==j, "ftell expected %d got %d\n", j, l); i=fgetc(tempfh); ok(i=='a', "fgetc expected %d got %d\n", 0x61, i); l=ftell(tempfh); j++; - ok(l==j, "ftell expected %d got %ld\n", j, l); + ok(l==j, "ftell expected %d got %d\n", j, l); fgetws(wtextW,3,tempfh); ok(wtextW[0]=='\r',"expected carriage return got %04hx\n", wtextW[0]); ok(wtextW[1]=='\n',"expected newline got %04hx\n", wtextW[1]); l=ftell(tempfh); j += 4; - ok(l==j, "ftell expected %d got %ld\n", j, l); + ok(l==j, "ftell expected %d got %d\n", j, l); for(i=0; i<strlen(mytext); i++) wtextW[i] = 0; /* the first time we get the string, it should be entirely within the local buffer */ fgetws(wtextW,LLEN,tempfh); l=ftell(tempfh); j += (strlen(mytext)-1)*sizeof(WCHAR); - ok(l==j, "ftell expected %d got %ld\n", j, l); + ok(l==j, "ftell expected %d got %d\n", j, l); diff_found = FALSE; aptr = mytextW; wptr = wtextW; @@ -643,7 +643,7 @@ static const char mytext[]= "This is test_ctrlz"; char buffer[256]; int i, j; - long l; + LONG l; tempf=_tempnam(".","wne"); tempfh = fopen(tempf,"wb"); @@ -664,7 +664,7 @@ ok(i==j, "returned string length expected %d got %d\n", j, i); j+=4; /* ftell should indicate the true end of file */ l=ftell(tempfh); - ok(l==j, "ftell expected %d got %ld\n", j, l); + ok(l==j, "ftell expected %d got %d\n", j, l); ok(feof(tempfh), "did not get EOF\n"); fclose(tempfh); @@ -674,7 +674,7 @@ j=strlen(mytext)+3; /* should get through newline */ ok(i==j, "returned string length expected %d got %d\n", j, i); l=ftell(tempfh); - ok(l==j, "ftell expected %d got %ld\n", j, l); + ok(l==j, "ftell expected %d got %d\n", j, l); ok(fgets(buffer,256,tempfh) != 0,"fgets failed unexpected\n"); i=strlen(buffer); ok(i==1, "returned string length expected %d got %d\n", 1, i); @@ -785,7 +785,7 @@ memset(btext, 0, LLEN); tempfd = _open(tempf,_O_APPEND|_O_RDWR); /* open for APPEND in default mode */ - ok(tell(tempfd) == 0, "bad position %lu expecting 0\n", tell(tempfd)); + ok(tell(tempfd) == 0, "bad position %u expecting 0\n", tell(tempfd)); ok(_read(tempfd,btext,LLEN) == lstrlenA(mytext), "_read _O_APPEND got bad length\n"); ok( memcmp(mytext,btext,strlen(mytext)) == 0, "problems with _O_APPEND _read\n"); _close(tempfd); @@ -801,7 +801,7 @@ _lseek(tempfd, -3, FILE_END); ret = _read(tempfd,btext,2); ok(ret == 1 && *btext == 'e', "_read expected 'e' got \"%.*s\" bad length: %d\n", ret, btext, ret); - ok(tell(tempfd) == 42, "bad position %lu expecting 42\n", tell(tempfd)); + ok(tell(tempfd) == 42, "bad position %u expecting 42\n", tell(tempfd)); _close(tempfd); ret = unlink(tempf); @@ -872,7 +872,7 @@ arg_v[3] = buffer; sprintf(buffer, "%d", fd); arg_v[4] = 0; _spawnvp(_P_WAIT, selfname, arg_v); - ok(tell(fd) == 8, "bad position %lu expecting 8\n", tell(fd)); + ok(tell(fd) == 8, "bad position %u expecting 8\n", tell(fd)); lseek(fd, 0, SEEK_SET); ok(read(fd, buffer, sizeof (buffer)) == 8 && memcmp(buffer, "Success", 8) == 0, "Couldn't read back the data\n"); close (fd); @@ -886,7 +886,7 @@ arg_v[3] = buffer; sprintf(buffer, "%d", fd); arg_v[4] = 0; _spawnvp(_P_WAIT, selfname, arg_v); - ok(tell(fd) == 0, "bad position %lu expecting 0\n", tell(fd)); + ok(tell(fd) == 0, "bad position %u expecting 0\n", tell(fd)); ok(read(fd, buffer, sizeof (buffer)) == 0, "Found unexpected data (%s)\n", buffer); close (fd); ok(unlink("fdopen.tst") == 0, "Couldn't unlink\n"); @@ -914,7 +914,7 @@ static void test_chsize( void ) { int fd; - long cur, pos, count; + LONG cur, pos, count; char temptext[] = "012345678"; char *tempfile = _tempnam( ".", "tst" ); @@ -933,14 +933,14 @@ ok( _chsize( fd, sizeof(temptext) / 2 ) == 0, "_chsize() failed\n" ); pos = _lseek( fd, 0, SEEK_CUR ); - ok( cur == pos, "File pointer changed from: %ld to: %ld\n", cur, pos ); + ok( cur == pos, "File pointer changed from: %d to: %d\n", cur, pos ); ok( _filelength( fd ) == sizeof(temptext) / 2, "Wrong file size\n" ); /* enlarge the file */ ok( _chsize( fd, sizeof(temptext) * 2 ) == 0, "_chsize() failed\n" ); pos = _lseek( fd, 0, SEEK_CUR ); - ok( cur == pos, "File pointer changed from: %ld to: %ld\n", cur, pos ); + ok( cur == pos, "File pointer changed from: %d to: %d\n", cur, pos ); ok( _filelength( fd ) == sizeof(temptext) * 2, "Wrong file size\n" ); _close( fd ); Modified: trunk/rostests/winetests/msvcrt/headers.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msvcrt/headers.…
============================================================================== --- trunk/rostests/winetests/msvcrt/headers.c [iso-8859-1] (original) +++ trunk/rostests/winetests/msvcrt/headers.c [iso-8859-1] Sun Jun 7 15:27:20 2009 @@ -87,7 +87,6 @@ CHECK_TYPE(_dev_t); CHECK_TYPE(_off_t); CHECK_TYPE(clock_t); - CHECK_TYPE(time_t); CHECK_TYPE(__time32_t); CHECK_TYPE(__time64_t); CHECK_TYPE(fpos_t); @@ -115,11 +114,16 @@ CHECK_FIELD(tm, tm_wday); CHECK_FIELD(tm, tm_yday); CHECK_FIELD(tm, tm_isdst); - CHECK_STRUCT(_timeb); - CHECK_FIELD(_timeb, time); - CHECK_FIELD(_timeb, millitm); - CHECK_FIELD(_timeb, timezone); - CHECK_FIELD(_timeb, dstflag); + CHECK_STRUCT(__timeb32); + CHECK_FIELD(__timeb32, time); + CHECK_FIELD(__timeb32, millitm); + CHECK_FIELD(__timeb32, timezone); + CHECK_FIELD(__timeb32, dstflag); + CHECK_STRUCT(__timeb64); + CHECK_FIELD(__timeb64, time); + CHECK_FIELD(__timeb64, millitm); + CHECK_FIELD(__timeb64, timezone); + CHECK_FIELD(__timeb64, dstflag); CHECK_STRUCT(_iobuf); CHECK_FIELD(_iobuf, _ptr); CHECK_FIELD(_iobuf, _cnt); @@ -214,9 +218,12 @@ CHECK_FIELD(_wfinddatai64_t, time_write); CHECK_FIELD(_wfinddatai64_t, size); CHECK_FIELD(_wfinddatai64_t, name[260]); - CHECK_STRUCT(_utimbuf); - CHECK_FIELD(_utimbuf, actime); - CHECK_FIELD(_utimbuf, modtime); + CHECK_STRUCT(__utimbuf32); + CHECK_FIELD(__utimbuf32, actime); + CHECK_FIELD(__utimbuf32, modtime); + CHECK_STRUCT(__utimbuf64); + CHECK_FIELD(__utimbuf64, actime); + CHECK_FIELD(__utimbuf64, modtime); CHECK_STRUCT(_stat); CHECK_FIELD(_stat, st_dev); CHECK_FIELD(_stat, st_ino); @@ -229,62 +236,6 @@ CHECK_FIELD(_stat, st_atime); CHECK_FIELD(_stat, st_mtime); CHECK_FIELD(_stat, st_ctime); - CHECK_FIELD(_stat, st_dev); - CHECK_FIELD(_stat, st_ino); - CHECK_FIELD(_stat, st_mode); - CHECK_FIELD(_stat, st_nlink); - CHECK_FIELD(_stat, st_uid); - CHECK_FIELD(_stat, st_gid); - CHECK_FIELD(_stat, st_rdev); - CHECK_FIELD(_stat, st_size); - CHECK_FIELD(_stat, st_atime); - CHECK_FIELD(_stat, st_mtime); - CHECK_FIELD(_stat, st_ctime); - CHECK_FIELD(_stat, st_dev); - CHECK_FIELD(_stat, st_ino); - CHECK_FIELD(_stat, st_mode); - CHECK_FIELD(_stat, st_nlink); - CHECK_FIELD(_stat, st_uid); - CHECK_FIELD(_stat, st_gid); - CHECK_FIELD(_stat, st_rdev); - CHECK_FIELD(_stat, st_size); - CHECK_FIELD(_stat, st_atime); - CHECK_FIELD(_stat, st_mtime); - CHECK_FIELD(_stat, st_ctime); - CHECK_STRUCT(stat); - CHECK_FIELD(stat, st_dev); - CHECK_FIELD(stat, st_ino); - CHECK_FIELD(stat, st_mode); - CHECK_FIELD(stat, st_nlink); - CHECK_FIELD(stat, st_uid); - CHECK_FIELD(stat, st_gid); - CHECK_FIELD(stat, st_rdev); - CHECK_FIELD(stat, st_size); - CHECK_FIELD(stat, st_atime); - CHECK_FIELD(stat, st_mtime); - CHECK_FIELD(stat, st_ctime); - CHECK_FIELD(stat, st_dev); - CHECK_FIELD(stat, st_ino); - CHECK_FIELD(stat, st_mode); - CHECK_FIELD(stat, st_nlink); - CHECK_FIELD(stat, st_uid); - CHECK_FIELD(stat, st_gid); - CHECK_FIELD(stat, st_rdev); - CHECK_FIELD(stat, st_size); - CHECK_FIELD(stat, st_atime); - CHECK_FIELD(stat, st_mtime); - CHECK_FIELD(stat, st_ctime); - CHECK_FIELD(stat, st_dev); - CHECK_FIELD(stat, st_ino); - CHECK_FIELD(stat, st_mode); - CHECK_FIELD(stat, st_nlink); - CHECK_FIELD(stat, st_uid); - CHECK_FIELD(stat, st_gid); - CHECK_FIELD(stat, st_rdev); - CHECK_FIELD(stat, st_size); - CHECK_FIELD(stat, st_atime); - CHECK_FIELD(stat, st_mtime); - CHECK_FIELD(stat, st_ctime); CHECK_STRUCT(_stati64); CHECK_FIELD(_stati64, st_dev); CHECK_FIELD(_stati64, st_ino); Modified: trunk/rostests/winetests/msvcrt/heap.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msvcrt/heap.c?r…
============================================================================== --- trunk/rostests/winetests/msvcrt/heap.c [iso-8859-1] (original) +++ trunk/rostests/winetests/msvcrt/heap.c [iso-8859-1] Sun Jun 7 15:27:20 2009 @@ -23,11 +23,11 @@ #include <errno.h> #include "wine/test.h" -static void (*p_aligned_free)(void*) = NULL; -static void * (*p_aligned_malloc)(size_t,size_t) = NULL; -static void * (*p_aligned_offset_malloc)(size_t,size_t,size_t) = NULL; -static void * (*p_aligned_realloc)(void*,size_t,size_t) = NULL; -static void * (*p_aligned_offset_realloc)(void*,size_t,size_t,size_t) = NULL; +static void (__cdecl *p_aligned_free)(void*) = NULL; +static void * (__cdecl *p_aligned_malloc)(size_t,size_t) = NULL; +static void * (__cdecl *p_aligned_offset_malloc)(size_t,size_t,size_t) = NULL; +static void * (__cdecl *p_aligned_realloc)(void*,size_t,size_t) = NULL; +static void * (__cdecl *p_aligned_offset_realloc)(void*,size_t,size_t,size_t) = NULL; static void test_aligned_malloc(unsigned int size, unsigned int alignment) { Modified: trunk/rostests/winetests/msvcrt/printf.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msvcrt/printf.c…
============================================================================== --- trunk/rostests/winetests/msvcrt/printf.c [iso-8859-1] (original) +++ trunk/rostests/winetests/msvcrt/printf.c [iso-8859-1] Sun Jun 7 15:27:20 2009 @@ -782,7 +782,7 @@ } } -static int _vsnwprintf_wrapper(wchar_t *str, size_t len, const wchar_t *format, ...) +static int __cdecl _vsnwprintf_wrapper(wchar_t *str, size_t len, const wchar_t *format, ...) { int ret; __ms_va_list valist; @@ -810,8 +810,8 @@ ok( !strcmp(buf, "onetwothree"), "got %s expected 'onetwothree'\n", buf ); } -static int (*p__vscprintf)(const char *format, __ms_va_list valist); -static int (*p__vscwprintf)(const wchar_t *format, __ms_va_list valist); +static int (__cdecl *p__vscprintf)(const char *format, __ms_va_list valist); +static int (__cdecl *p__vscwprintf)(const wchar_t *format, __ms_va_list valist); static int __cdecl _vscprintf_wrapper(const char *format, ...) { Modified: trunk/rostests/winetests/msvcrt/string.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msvcrt/string.c…
============================================================================== --- trunk/rostests/winetests/msvcrt/string.c [iso-8859-1] (original) +++ trunk/rostests/winetests/msvcrt/string.c [iso-8859-1] Sun Jun 7 15:27:20 2009 @@ -45,12 +45,12 @@ #define expect_eq(expr, value, type, format) { type ret = (expr); ok((value) == ret, #expr " expected " format " got " format "\n", value, ret); } #define expect_bin(buf, value, len) { ok(memcmp((buf), value, len) == 0, "Binary buffer mismatch - expected %s, got %s\n", buf_to_string((unsigned char *)value, len, 1), buf_to_string((buf), len, 0)); } -static void* (*pmemcpy)(void *, const void *, size_t n); -static int* (*pmemcmp)(void *, const void *, size_t n); -static int (*pstrcpy_s)(char *dst, size_t len, const char *src); -static int (*pstrcat_s)(char *dst, size_t len, const char *src); -static int (*p_mbsnbcpy_s)(unsigned char * dst, size_t size, const unsigned char * src, size_t count); -static int (*p_wcscpy_s)(wchar_t *wcDest, size_t size, const wchar_t *wcSrc); +static void* (__cdecl *pmemcpy)(void *, const void *, size_t n); +static int* (__cdecl *pmemcmp)(void *, const void *, size_t n); +static int (__cdecl *pstrcpy_s)(char *dst, size_t len, const char *src); +static int (__cdecl *pstrcat_s)(char *dst, size_t len, const char *src); +static int (__cdecl *p_mbsnbcpy_s)(unsigned char * dst, size_t size, const unsigned char * src, size_t count); +static int (__cdecl *p_wcscpy_s)(wchar_t *wcDest, size_t size, const wchar_t *wcSrc); static int *p__mb_cur_max; static unsigned char *p_mbctype;
15 years, 5 months
1
0
0
0
[cwittich] 41330: fix msvcrt data winetests
by cwittich@svn.reactos.org
Author: cwittich Date: Sun Jun 7 15:24:37 2009 New Revision: 41330 URL:
http://svn.reactos.org/svn/reactos?rev=41330&view=rev
Log: fix msvcrt data winetests Modified: trunk/reactos/dll/win32/msvcrt/dllmain.c Modified: trunk/reactos/dll/win32/msvcrt/dllmain.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msvcrt/dllmain.c…
============================================================================== --- trunk/reactos/dll/win32/msvcrt/dllmain.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msvcrt/dllmain.c [iso-8859-1] Sun Jun 7 15:24:37 2009 @@ -60,17 +60,19 @@ WINAPI DllMain(PVOID hinstDll, ULONG dwReason, PVOID reserved) { + OSVERSIONINFOW osvi; switch (dwReason) { case DLL_PROCESS_ATTACH://1 /* initialize version info */ //DPRINT1("Process Attach %d\n", nAttachCount); //DPRINT1("Process Attach\n"); - _osver = GetVersion(); - _winmajor = (_osver >> 8) & 0xFF; - _winminor = _osver & 0xFF; - _winver = (_winmajor << 8) + _winminor; - _osver = (_osver >> 16) & 0xFFFF; + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); + GetVersionExW( &osvi ); + _winver = (osvi.dwMajorVersion << 8) | osvi.dwMinorVersion; + _winmajor = osvi.dwMajorVersion; + _winminor = osvi.dwMinorVersion; + _osver = osvi.dwBuildNumber; hHeap = HeapCreate(0, 100000, 0); if (hHeap == NULL) return FALSE;
15 years, 5 months
1
0
0
0
[cwittich] 41329: sync version with wine 1.1.23
by cwittich@svn.reactos.org
Author: cwittich Date: Sun Jun 7 15:12:48 2009 New Revision: 41329 URL:
http://svn.reactos.org/svn/reactos?rev=41329&view=rev
Log: sync version with wine 1.1.23 Removed: trunk/reactos/dll/win32/version/ver16.c Modified: trunk/reactos/dll/win32/version/info.c trunk/reactos/dll/win32/version/install.c trunk/reactos/dll/win32/version/resource.c Modified: trunk/reactos/dll/win32/version/info.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/version/info.c?r…
============================================================================== --- trunk/reactos/dll/win32/version/info.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/version/info.c [iso-8859-1] Sun Jun 7 15:12:48 2009 @@ -555,7 +555,7 @@ DWORD datasize, LPVOID data ) { DWORD len; - VS_VERSION_INFO_STRUCT32* vvis = (VS_VERSION_INFO_STRUCT32*)data; + VS_VERSION_INFO_STRUCT32* vvis = data; TRACE("(%s,%d,size=%d,data=%p)\n", debugstr_w(filename), handle, datasize, data ); @@ -677,6 +677,7 @@ if (!strncmpiW( child->szKey, szKey, cbKey ) && !child->szKey[cbKey]) return child; + if (!(child->wLength)) return NULL; child = VersionInfo32_Next( child ); } @@ -688,7 +689,7 @@ * * Gets a value from a 16-bit NE resource */ -static BOOL WINAPI VersionInfo16_QueryValue( const VS_VERSION_INFO_STRUCT16 *info, LPCSTR lpSubBlock, +static BOOL VersionInfo16_QueryValue( const VS_VERSION_INFO_STRUCT16 *info, LPCSTR lpSubBlock, LPVOID *lplpBuffer, UINT *puLen ) { while ( *lpSubBlock ) @@ -732,7 +733,7 @@ * * Gets a value from a 32-bit PE resource */ -static BOOL WINAPI VersionInfo32_QueryValue( const VS_VERSION_INFO_STRUCT32 *info, LPCWSTR lpSubBlock, +static BOOL VersionInfo32_QueryValue( const VS_VERSION_INFO_STRUCT32 *info, LPCWSTR lpSubBlock, LPVOID *lplpBuffer, UINT *puLen ) { TRACE("lpSubBlock : (%s)\n", debugstr_w(lpSubBlock)); @@ -781,13 +782,16 @@ { static const char rootA[] = "\\"; static const char varfileinfoA[] = "\\VarFileInfo\\Translation"; - const VS_VERSION_INFO_STRUCT16 *info = (const VS_VERSION_INFO_STRUCT16 *)pBlock; + const VS_VERSION_INFO_STRUCT16 *info = pBlock; TRACE("(%p,%s,%p,%p)\n", pBlock, debugstr_a(lpSubBlock), lplpBuffer, puLen ); if (!pBlock) return FALSE; + + if (lpSubBlock == NULL || lpSubBlock[0] == '\0') + lpSubBlock = rootA; if ( !VersionInfoIs16( info ) ) { @@ -815,7 +819,7 @@ LPSTR lpBufferA = (LPSTR)pBlock + info->wLength + 4; DWORD pos = (LPCSTR)*lplpBuffer - (LPCSTR)pBlock; - len = WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)*lplpBuffer, -1, + len = WideCharToMultiByte(CP_ACP, 0, *lplpBuffer, -1, lpBufferA + pos, info->wLength - pos, NULL, NULL); *lplpBuffer = lpBufferA + pos; *puLen = len; @@ -832,17 +836,21 @@ BOOL WINAPI VerQueryValueW( LPCVOID pBlock, LPCWSTR lpSubBlock, LPVOID *lplpBuffer, PUINT puLen ) { + static const WCHAR nullW[] = { 0 }; static const WCHAR rootW[] = { '\\', 0 }; static const WCHAR varfileinfoW[] = { '\\','V','a','r','F','i','l','e','I','n','f','o', '\\','T','r','a','n','s','l','a','t','i','o','n', 0 }; - const VS_VERSION_INFO_STRUCT32 *info = (const VS_VERSION_INFO_STRUCT32 *)pBlock; + const VS_VERSION_INFO_STRUCT32 *info = pBlock; TRACE("(%p,%s,%p,%p)\n", pBlock, debugstr_w(lpSubBlock), lplpBuffer, puLen ); if (!pBlock) return FALSE; + + if (lpSubBlock == NULL || lpSubBlock[0] == nullW[0]) + lpSubBlock = rootW; if ( VersionInfoIs16( info ) ) { @@ -871,7 +879,7 @@ DWORD pos = (LPCSTR)*lplpBuffer - (LPCSTR)pBlock; DWORD max = (info->wLength - sizeof(VS_FIXEDFILEINFO)) * 4 - info->wLength; - len = MultiByteToWideChar(CP_ACP, 0, (LPCSTR)*lplpBuffer, -1, + len = MultiByteToWideChar(CP_ACP, 0, *lplpBuffer, -1, lpBufferW + pos, max/sizeof(WCHAR) - pos ); *lplpBuffer = lpBufferW + pos; *puLen = len; Modified: trunk/reactos/dll/win32/version/install.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/version/install.…
============================================================================== --- trunk/reactos/dll/win32/version/install.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/version/install.c [iso-8859-1] Sun Jun 7 15:12:48 2009 @@ -535,7 +535,7 @@ LPCWSTR destdir,LPCWSTR curdir,LPWSTR tmpfile,PUINT tmpfilelen ) { LPSTR wsrcf = NULL, wsrcd = NULL, wdestf = NULL, wdestd = NULL, wtmpf = NULL, wcurd = NULL; - DWORD ret; + DWORD ret = 0; UINT len; if (srcfilename) @@ -543,34 +543,50 @@ len = WideCharToMultiByte( CP_ACP, 0, srcfilename, -1, NULL, 0, NULL, NULL ); if ((wsrcf = HeapAlloc( GetProcessHeap(), 0, len ))) WideCharToMultiByte( CP_ACP, 0, srcfilename, -1, wsrcf, len, NULL, NULL ); - } - if (srcdir) + else + ret = VIF_OUTOFMEMORY; + } + if (srcdir && !ret) { len = WideCharToMultiByte( CP_ACP, 0, srcdir, -1, NULL, 0, NULL, NULL ); if ((wsrcd = HeapAlloc( GetProcessHeap(), 0, len ))) WideCharToMultiByte( CP_ACP, 0, srcdir, -1, wsrcd, len, NULL, NULL ); - } - if (destfilename) + else + ret = VIF_OUTOFMEMORY; + } + if (destfilename && !ret) { len = WideCharToMultiByte( CP_ACP, 0, destfilename, -1, NULL, 0, NULL, NULL ); if ((wdestf = HeapAlloc( GetProcessHeap(), 0, len ))) WideCharToMultiByte( CP_ACP, 0, destfilename, -1, wdestf, len, NULL, NULL ); - } - if (destdir) + else + ret = VIF_OUTOFMEMORY; + } + if (destdir && !ret) { len = WideCharToMultiByte( CP_ACP, 0, destdir, -1, NULL, 0, NULL, NULL ); if ((wdestd = HeapAlloc( GetProcessHeap(), 0, len ))) WideCharToMultiByte( CP_ACP, 0, destdir, -1, wdestd, len, NULL, NULL ); - } - if (curdir) + else + ret = VIF_OUTOFMEMORY; + } + if (curdir && !ret) { len = WideCharToMultiByte( CP_ACP, 0, curdir, -1, NULL, 0, NULL, NULL ); if ((wcurd = HeapAlloc( GetProcessHeap(), 0, len ))) WideCharToMultiByte( CP_ACP, 0, curdir, -1, wcurd, len, NULL, NULL ); - } - len = *tmpfilelen * sizeof(WCHAR); - wtmpf = HeapAlloc( GetProcessHeap(), 0, len ); - ret = VerInstallFileA(flags,wsrcf,wdestf,wsrcd,wdestd,wcurd,wtmpf,&len); + else + ret = VIF_OUTOFMEMORY; + } + if (!ret) + { + len = *tmpfilelen * sizeof(WCHAR); + wtmpf = HeapAlloc( GetProcessHeap(), 0, len ); + if (!wtmpf) + ret = VIF_OUTOFMEMORY; + } + if (!ret) + ret = VerInstallFileA(flags,wsrcf,wdestf,wsrcd,wdestd,wcurd,wtmpf,&len); if (!ret) *tmpfilelen = MultiByteToWideChar( CP_ACP, 0, wtmpf, -1, tmpfile, *tmpfilelen ); else if (ret & VIF_BUFFTOOSMALL) Modified: trunk/reactos/dll/win32/version/resource.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/version/resource…
============================================================================== --- trunk/reactos/dll/win32/version/resource.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/version/resource.c [iso-8859-1] Sun Jun 7 15:12:48 2009 @@ -173,7 +173,7 @@ #ifndef __REACTOS__ /*********************************************************************** - * load_ne_resource [internal] + * find_ne_resource [internal] */ static BOOL find_ne_resource( HFILE lzfd, LPCSTR typeid, LPCSTR resid, DWORD *resLen, DWORD *resOff ) @@ -273,7 +273,7 @@ #endif /* ! __REACTOS__ */ /*********************************************************************** - * load_pe_resource [internal] + * find_pe_resource [internal] */ static BOOL find_pe_resource( HFILE lzfd, LPCSTR typeid, LPCSTR resid, DWORD *resLen, DWORD *resOff ) @@ -348,7 +348,7 @@ /* Find resource */ resDir = resSection + (resDataDir->VirtualAddress - sections[i].VirtualAddress); - resPtr = (const IMAGE_RESOURCE_DIRECTORY*)resDir; + resPtr = resDir; resPtr = find_entry_by_name( resPtr, typeid, resDir ); if ( !resPtr ) { @@ -406,9 +406,8 @@ OFSTRUCT ofs; DWORD reslen; - TRACE("(%s,type=0x%x,id=0x%x,off=%p)\n", - debugstr_a(lpszFileName), (LONG)lpszResType, (LONG)lpszResId, - lpszResId ); + TRACE("(%s,type=%p,id=%p,off=%p)\n", + debugstr_a(lpszFileName), lpszResType, lpszResId, lpszResId ); lzfd = LZOpenFileA( (LPSTR)lpszFileName, &ofs, OF_READ ); if ( lzfd < 0 ) return 0; Removed: trunk/reactos/dll/win32/version/ver16.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/version/ver16.c?…
============================================================================== --- trunk/reactos/dll/win32/version/ver16.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/version/ver16.c (removed) @@ -1,122 +1,0 @@ -/* - * Implementation of VER.DLL - * - * Copyright 1999 Ulrich Weigand - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include <stdarg.h> - -#include "windef.h" -#include "wine/winbase16.h" -#include "winver.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(ver); - - -/************************************************************************* - * GetFileVersionInfoSize [VER.6] - */ -DWORD WINAPI GetFileVersionInfoSize16( LPCSTR lpszFileName, LPDWORD lpdwHandle ) -{ - TRACE("(%s, %p)\n", debugstr_a(lpszFileName), lpdwHandle ); - return GetFileVersionInfoSizeA( lpszFileName, lpdwHandle ); -} - -/************************************************************************* - * GetFileVersionInfo [VER.7] - */ -DWORD WINAPI GetFileVersionInfo16( LPCSTR lpszFileName, DWORD handle, - DWORD cbBuf, LPVOID lpvData ) -{ - TRACE("(%s, %08x, %d, %p)\n", - debugstr_a(lpszFileName), handle, cbBuf, lpvData ); - - return GetFileVersionInfoA( lpszFileName, handle, cbBuf, lpvData ); -} - -/************************************************************************* - * VerFindFile [VER.8] - */ -DWORD WINAPI VerFindFile16( UINT16 flags, LPSTR lpszFilename, - LPSTR lpszWinDir, LPSTR lpszAppDir, - LPSTR lpszCurDir, UINT16 *lpuCurDirLen, - LPSTR lpszDestDir, UINT16 *lpuDestDirLen ) -{ - UINT curDirLen, destDirLen; - DWORD retv = VerFindFileA( flags, lpszFilename, lpszWinDir, lpszAppDir, - lpszCurDir, &curDirLen, lpszDestDir, &destDirLen ); - - *lpuCurDirLen = (UINT16)curDirLen; - *lpuDestDirLen = (UINT16)destDirLen; - return retv; -} - -/************************************************************************* - * VerInstallFile [VER.9] - */ -DWORD WINAPI VerInstallFile16( UINT16 flags, - LPSTR lpszSrcFilename, LPSTR lpszDestFilename, - LPSTR lpszSrcDir, LPSTR lpszDestDir, LPSTR lpszCurDir, - LPSTR lpszTmpFile, UINT16 *lpwTmpFileLen ) -{ - UINT filelen; - DWORD retv = VerInstallFileA( flags, lpszSrcFilename, lpszDestFilename, - lpszSrcDir, lpszDestDir, lpszCurDir, - lpszTmpFile, &filelen); - - *lpwTmpFileLen = (UINT16)filelen; - return retv; -} - -/************************************************************************* - * VerLanguageName [VER.10] - */ -DWORD WINAPI VerLanguageName16( UINT16 uLang, LPSTR lpszLang, UINT16 cbLang ) -{ - return VerLanguageNameA( uLang, lpszLang, cbLang ); -} - -/************************************************************************* - * VerQueryValue [VER.11] - */ -DWORD WINAPI VerQueryValue16( SEGPTR spvBlock, LPSTR lpszSubBlock, - SEGPTR *lpspBuffer, UINT16 *lpcb ) -{ - LPVOID lpvBlock = MapSL( spvBlock ); - LPVOID buffer = lpvBlock; - UINT buflen; - DWORD retv; - - TRACE("(%p, %s, %p, %p)\n", - lpvBlock, debugstr_a(lpszSubBlock), lpspBuffer, lpcb ); - - retv = VerQueryValueA( lpvBlock, lpszSubBlock, &buffer, &buflen ); - if ( !retv ) return FALSE; - - if ( OFFSETOF( spvBlock ) + ((char *) buffer - (char *) lpvBlock) >= 0x10000 ) - { - FIXME("offset %08X too large relative to %04X:%04X\n", - (char *) buffer - (char *) lpvBlock, SELECTOROF( spvBlock ), OFFSETOF( spvBlock ) ); - return FALSE; - } - - if (lpcb) *lpcb = buflen; - *lpspBuffer = (SEGPTR) ((char *) spvBlock + ((char *) buffer - (char *) lpvBlock)); - - return retv; -}
15 years, 5 months
1
0
0
0
[cwittich] 41328: sync advapi32_winetest with wine 1.1.23
by cwittich@svn.reactos.org
Author: cwittich Date: Sun Jun 7 14:58:10 2009 New Revision: 41328 URL:
http://svn.reactos.org/svn/reactos?rev=41328&view=rev
Log: sync advapi32_winetest with wine 1.1.23 Modified: trunk/rostests/winetests/advapi32/registry.c Modified: trunk/rostests/winetests/advapi32/registry.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/advapi32/regist…
============================================================================== --- trunk/rostests/winetests/advapi32/registry.c [iso-8859-1] (original) +++ trunk/rostests/winetests/advapi32/registry.c [iso-8859-1] Sun Jun 7 14:58:10 2009 @@ -52,7 +52,11 @@ UINT idx; idx = ++pos % (sizeof(list)/sizeof(list[0])); - if ((ret = realloc( list[idx], size ))) list[idx] = ret; + if (list[idx]) + ret = HeapReAlloc( GetProcessHeap(), 0, list[idx], size ); + else + ret = HeapAlloc( GetProcessHeap(), 0, size ); + if (ret) list[idx] = ret; return ret; }
15 years, 5 months
1
0
0
0
[cwittich] 41327: sync shlwapi with wine 1.1.23
by cwittich@svn.reactos.org
Author: cwittich Date: Sun Jun 7 14:54:09 2009 New Revision: 41327 URL:
http://svn.reactos.org/svn/reactos?rev=41327&view=rev
Log: sync shlwapi with wine 1.1.23 Modified: trunk/reactos/dll/win32/shlwapi/url.c Modified: trunk/reactos/dll/win32/shlwapi/url.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/url.c?re…
============================================================================== --- trunk/reactos/dll/win32/shlwapi/url.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shlwapi/url.c [iso-8859-1] Sun Jun 7 14:54:09 2009 @@ -128,19 +128,6 @@ return URL_SCHEME_UNKNOWN; } - -static BOOL URL_JustLocation(LPCWSTR str) -{ - while(*str && (*str == '/')) str++; - if (*str) { - while (*str && ((*str == '-') || - (*str == '.') || - isalnumW(*str))) str++; - if (*str == '/') return FALSE; - } - return TRUE; -} - /************************************************************************* * @ [SHLWAPI.1] @@ -608,7 +595,6 @@ DWORD len, res1, res2, process_case = 0; LPWSTR work, preliminary, mbase, mrelative; static const WCHAR myfilestr[] = {'f','i','l','e',':','/','/','/','\0'}; - static const WCHAR single_slash[] = {'/','\0'}; HRESULT ret; TRACE("(base %s, Relative %s, Combine size %d, flags %08x)\n", @@ -768,14 +754,8 @@ strcatW(preliminary, mrelative); break; - case 2: /* - * Same as case 1, but if URL_PLUGGABLE_PROTOCOL was specified - * and pszRelative starts with "//", then append a "/" - */ + case 2: /* case where pszRelative replaces scheme, and location */ strcpyW(preliminary, mrelative); - if (!(dwFlags & URL_PLUGGABLE_PROTOCOL) && - URL_JustLocation(relative.pszSuffix)) - strcatW(preliminary, single_slash); break; case 3: /*
15 years, 5 months
1
0
0
0
[cwittich] 41326: sync shlwapi_winetest with wine 1.1.23
by cwittich@svn.reactos.org
Author: cwittich Date: Sun Jun 7 14:50:06 2009 New Revision: 41326 URL:
http://svn.reactos.org/svn/reactos?rev=41326&view=rev
Log: sync shlwapi_winetest with wine 1.1.23 Modified: trunk/rostests/winetests/shlwapi/url.c Modified: trunk/rostests/winetests/shlwapi/url.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shlwapi/url.c?r…
============================================================================== --- trunk/rostests/winetests/shlwapi/url.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shlwapi/url.c [iso-8859-1] Sun Jun 7 14:50:06 2009 @@ -263,7 +263,28 @@ {"foo:/today", "foo:calendar", 0, S_OK, "foo:/calendar"}, {"foo:/today/", "foo:calendar", 0, S_OK, "foo:/today/calendar"}, {"mk:@MSITStore:dir/test.chm::dir/index.html", "image.jpg", 0, S_OK, "mk:@MSITStore:dir/test.chm::dir/image.jpg"}, - {"mk:@MSITStore:dir/test.chm::dir/dir2/index.html", "../image.jpg", 0, S_OK, "mk:@MSITStore:dir/test.chm::dir/image.jpg"} + {"mk:@MSITStore:dir/test.chm::dir/dir2/index.html", "../image.jpg", 0, S_OK, "mk:@MSITStore:dir/test.chm::dir/image.jpg"}, + /* UrlCombine case 2 tests. Schemes do not match */ + {"outbind://xxxxxxxxx","
http://wine1/dir
",0, S_OK,"
http://wine1/dir
"}, + {"xxxx://xxxxxxxxx","
http://wine2/dir
",0, S_OK,"
http://wine2/dir
"}, + {"ftp://xxxxxxxxx/","
http://wine3/dir
",0, S_OK,"
http://wine3/dir
"}, + {"outbind://xxxxxxxxx","
http://wine4/dir
",URL_PLUGGABLE_PROTOCOL, S_OK,"
http://wine4/dir
"}, + {"xxx://xxxxxxxxx","
http://wine5/dir
",URL_PLUGGABLE_PROTOCOL, S_OK,"
http://wine5/dir
"}, + {"ftp://xxxxxxxxx/","
http://wine6/dir
",URL_PLUGGABLE_PROTOCOL, S_OK,"
http://wine6/dir
"}, + {"
http://xxxxxxxxx
","outbind://wine7/dir",0, S_OK,"outbind://wine7/dir"}, + {"xxx://xxxxxxxxx","ftp://wine8/dir",0, S_OK,"ftp://wine8/dir"}, + {"ftp://xxxxxxxxx/","xxx://wine9/dir",0, S_OK,"xxx://wine9/dir"}, + {"
http://xxxxxxxxx
","outbind://wine10/dir",URL_PLUGGABLE_PROTOCOL, S_OK,"outbind://wine10/dir"}, + {"xxx://xxxxxxxxx","ftp://wine11/dir",URL_PLUGGABLE_PROTOCOL, S_OK,"ftp://wine11/dir"}, + {"ftp://xxxxxxxxx/","xxx://wine12/dir",URL_PLUGGABLE_PROTOCOL, S_OK,"xxx://wine12/dir"}, + {"
http://xxxxxxxxx
","outbind:wine13/dir",0, S_OK,"outbind:wine13/dir"}, + {"xxx://xxxxxxxxx","ftp:wine14/dir",0, S_OK,"ftp:wine14/dir"}, + {"ftp://xxxxxxxxx/","xxx:wine15/dir",0, S_OK,"xxx:wine15/dir"}, + {"outbind://xxxxxxxxx/","http:wine16/dir",0, S_OK,"http:wine16/dir"}, + {"
http://xxxxxxxxx
","outbind:wine17/dir",URL_PLUGGABLE_PROTOCOL, S_OK,"outbind:wine17/dir"}, + {"xxx://xxxxxxxxx","ftp:wine18/dir",URL_PLUGGABLE_PROTOCOL, S_OK,"ftp:wine18/dir"}, + {"ftp://xxxxxxxxx/","xxx:wine19/dir",URL_PLUGGABLE_PROTOCOL, S_OK,"xxx:wine19/dir"}, + {"outbind://xxxxxxxxx/","http:wine20/dir",URL_PLUGGABLE_PROTOCOL, S_OK,"http:wine20/dir"} }; /* ################ */
15 years, 5 months
1
0
0
0
← Newer
1
...
37
38
39
40
41
42
43
...
50
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Results per page:
10
25
50
100
200