winehq.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
2025
February
January
2024
December
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
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
June 2012
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 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
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
3 participants
827 discussions
Start a n
N
ew thread
Jacek Caban : wininet: Fixed returned buffer size in HttpQueryInfo( HTTP_QUERY_STATUS_CODE) when insufficient buffer is passed.
by Alexandre Julliard
15 Jun '12
15 Jun '12
Module: wine Branch: master Commit: 120c413f395da68ce369871cdd975109624e372f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=120c413f395da68ce369871cd…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Jun 15 18:15:20 2012 +0200 wininet: Fixed returned buffer size in HttpQueryInfo(HTTP_QUERY_STATUS_CODE) when insufficient buffer is passed. --- dlls/wininet/http.c | 10 ++++--- dlls/wininet/tests/http.c | 58 ++++++++++++++++++++++++++++++++++++-------- 2 files changed, 53 insertions(+), 15 deletions(-) diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index baba3d6..3d0ae34 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -3480,12 +3480,14 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel, DWORD size; static const WCHAR formatW[] = {'%','u',0}; - size = (sprintfW(buf, formatW, request->status_code)+1) * sizeof(WCHAR); + size = sprintfW(buf, formatW, request->status_code) * sizeof(WCHAR); - if(size <= *lpdwBufferLength) - memcpy(lpBuffer, buf, size); - else + if(size <= *lpdwBufferLength) { + memcpy(lpBuffer, buf, size+sizeof(WCHAR)); + }else { + size += sizeof(WCHAR); res = ERROR_INSUFFICIENT_BUFFER; + } *lpdwBufferLength = size; } diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c index fe986e4..84e7882 100644 --- a/dlls/wininet/tests/http.c +++ b/dlls/wininet/tests/http.c @@ -161,6 +161,13 @@ static const test_data_t test_data[] = { static INTERNET_STATUS_CALLBACK (WINAPI *pInternetSetStatusCallbackA)(HINTERNET ,INTERNET_STATUS_CALLBACK); static BOOL (WINAPI *pInternetGetSecurityInfoByURLA)(LPSTR,PCCERT_CHAIN_CONTEXT*,DWORD*); +static int strcmp_wa(LPCWSTR strw, const char *stra) +{ + WCHAR buf[512]; + MultiByteToWideChar(CP_ACP, 0, stra, -1, buf, sizeof(buf)/sizeof(WCHAR)); + return lstrcmpW(strw, buf); +} + static BOOL proxy_active(void) { HKEY internet_settings; @@ -185,41 +192,70 @@ static void _test_status_code(unsigned line, HINTERNET req, DWORD excode) { DWORD code, size, index; char exbuf[10], bufa[10]; + WCHAR bufw[10]; BOOL res; code = 0xdeadbeef; size = sizeof(code); - res = HttpQueryInfo(req, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &code, &size, NULL); - ok_(__FILE__,line)(res, "HttpQueryInfo(HTTP_QUERY_STATUS_CODE|number) failed: %u\n", GetLastError()); + res = HttpQueryInfoA(req, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &code, &size, NULL); + ok_(__FILE__,line)(res, "[1] HttpQueryInfoA(HTTP_QUERY_STATUS_CODE|number) failed: %u\n", GetLastError()); ok_(__FILE__,line)(code == excode, "code = %d, expected %d\n", code, excode); + ok_(__FILE__,line)(size == sizeof(code), "size = %u\n", size); code = 0xdeadbeef; index = 0; size = sizeof(code); - res = HttpQueryInfo(req, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &code, &size, &index); - ok_(__FILE__,line)(res, "HttpQueryInfo(HTTP_QUERY_STATUS_CODE|number index) failed: %u\n", GetLastError()); + res = HttpQueryInfoA(req, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &code, &size, &index); + ok_(__FILE__,line)(res, "[2] HttpQueryInfoA(HTTP_QUERY_STATUS_CODE|number index) failed: %u\n", GetLastError()); ok_(__FILE__,line)(code == excode, "code = %d, expected %d\n", code, excode); ok_(__FILE__,line)(!index, "index = %d, expected 0\n", code); + ok_(__FILE__,line)(size == sizeof(code), "size = %u\n", size); sprintf(exbuf, "%u", excode); size = sizeof(bufa); - res = HttpQueryInfo(req, HTTP_QUERY_STATUS_CODE, bufa, &size, NULL); - ok_(__FILE__,line)(res, "HttpQueryInfo(HTTP_QUERY_STATUS_CODE) failed: %u\n", GetLastError()); - ok_(__FILE__,line)(!strcmp(bufa, exbuf), "unexpected status code %s, expected %s", bufa, exbuf); + res = HttpQueryInfoA(req, HTTP_QUERY_STATUS_CODE, bufa, &size, NULL); + ok_(__FILE__,line)(res, "[3] HttpQueryInfoA(HTTP_QUERY_STATUS_CODE) failed: %u\n", GetLastError()); + ok_(__FILE__,line)(!strcmp(bufa, exbuf), "unexpected status code %s, expected %s\n", bufa, exbuf); + ok_(__FILE__,line)(size == strlen(exbuf), "unexpected size %d for \"%s\"\n", size, exbuf); + + size = 0; + res = HttpQueryInfoA(req, HTTP_QUERY_STATUS_CODE, NULL, &size, NULL); + ok_(__FILE__,line)(!res && GetLastError() == ERROR_INSUFFICIENT_BUFFER, + "[4] HttpQueryInfoA(HTTP_QUERY_STATUS_CODE) failed: %u\n", GetLastError()); + ok_(__FILE__,line)(size == strlen(exbuf)+1, "unexpected size %d for \"%s\"\n", size, exbuf); + + size = sizeof(bufw); + res = HttpQueryInfoW(req, HTTP_QUERY_STATUS_CODE, bufw, &size, NULL); + ok_(__FILE__,line)(res, "[5] HttpQueryInfoW(HTTP_QUERY_STATUS_CODE) failed: %u\n", GetLastError()); + ok_(__FILE__,line)(!strcmp_wa(bufw, exbuf), "unexpected status code %s, expected %s\n", bufa, exbuf); + ok_(__FILE__,line)(size == strlen(exbuf)*sizeof(WCHAR), "unexpected size %d for \"%s\"\n", size, exbuf); + + size = 0; + res = HttpQueryInfoW(req, HTTP_QUERY_STATUS_CODE, bufw, &size, NULL); + ok_(__FILE__,line)(!res && GetLastError() == ERROR_INSUFFICIENT_BUFFER, + "[6] HttpQueryInfoW(HTTP_QUERY_STATUS_CODE) failed: %u\n", GetLastError()); + ok_(__FILE__,line)(size == (strlen(exbuf)+1)*sizeof(WCHAR), "unexpected size %d for \"%s\"\n", size, exbuf); + + if(0) { + size = sizeof(bufw); + res = HttpQueryInfoW(req, HTTP_QUERY_STATUS_CODE, NULL, &size, NULL); + ok(!res && GetLastError() == ERROR_INVALID_PARAMETER, "HttpQueryInfo(HTTP_QUERY_STATUS_CODE) failed: %u\n", GetLastError()); + ok(size == sizeof(bufw), "unexpected size %d\n", size); + } code = 0xdeadbeef; index = 1; size = sizeof(code); - res = HttpQueryInfo(req, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &code, &size, &index); + res = HttpQueryInfoA(req, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &code, &size, &index); ok_(__FILE__,line)(!res && GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND, - "[invalid 1] HttpQueryInfo failed: %x(%d)\n", res, GetLastError()); + "[7] HttpQueryInfoA failed: %x(%d)\n", res, GetLastError()); code = 0xdeadbeef; size = sizeof(code); - res = HttpQueryInfo(req, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_REQUEST_HEADERS, &code, &size, NULL); + res = HttpQueryInfoA(req, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_REQUEST_HEADERS, &code, &size, NULL); ok_(__FILE__,line)(!res && GetLastError() == ERROR_HTTP_INVALID_QUERY_REQUEST, - "[invalid 2] HttpQueryInfo failed: %x(%d)\n", res, GetLastError()); + "[8] HttpQueryInfoA failed: %x(%d)\n", res, GetLastError()); } #define test_request_flags(a,b) _test_request_flags(__LINE__,a,b,FALSE)
1
0
0
0
Alexandre Julliard : wininet: Fix a compiler warning on Mingw.
by Alexandre Julliard
15 Jun '12
15 Jun '12
Module: wine Branch: master Commit: 3521e1b89b9a98166413654ca00b50fbd5608fb6 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=3521e1b89b9a98166413654ca…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Jun 15 17:58:23 2012 +0200 wininet: Fix a compiler warning on Mingw. --- dlls/wininet/http.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 0a3b8fe..baba3d6 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -1739,7 +1739,7 @@ static DWORD HTTP_ResolveName(http_request_t *request) { server_t *server = request->server; socklen_t addr_len; - const void *addr; + void *addr; if(server->addr_len) return ERROR_SUCCESS;
1
0
0
0
Hans Leidekker : wbemprox: Implement IEnumWbemClassObject::Next.
by Alexandre Julliard
15 Jun '12
15 Jun '12
Module: wine Branch: master Commit: 4cfd8189c8c5c1facf7c519bc072550378e8b77d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4cfd8189c8c5c1facf7c519bc…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Fri Jun 15 15:48:32 2012 +0200 wbemprox: Implement IEnumWbemClassObject::Next. --- dlls/wbemprox/class.c | 33 +++++++++++++++++++++++++++++---- dlls/wbemprox/query.c | 1 + dlls/wbemprox/wbemprox_private.h | 2 ++ 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/dlls/wbemprox/class.c b/dlls/wbemprox/class.c index d405206..a950e41 100644 --- a/dlls/wbemprox/class.c +++ b/dlls/wbemprox/class.c @@ -102,8 +102,27 @@ static HRESULT WINAPI enum_class_object_Next( IWbemClassObject **apObjects, ULONG *puReturned ) { - FIXME("%p, %d, %u, %p, %p\n", iface, lTimeout, uCount, apObjects, puReturned); - return E_NOTIMPL; + struct enum_class_object *ec = impl_from_IEnumWbemClassObject( iface ); + struct view *view = ec->query->view; + HRESULT hr; + + TRACE("%p, %d, %u, %p, %p\n", iface, lTimeout, uCount, apObjects, puReturned); + + if (!uCount) return WBEM_S_FALSE; + if (!apObjects || !puReturned) return WBEM_E_INVALID_PARAMETER; + if (lTimeout != WBEM_INFINITE) FIXME("timeout not supported\n"); + + *puReturned = 0; + if (view->index + uCount > view->count) return WBEM_S_FALSE; + + hr = WbemClassObject_create( NULL, iface, view->index, (void **)apObjects ); + if (hr != S_OK) return hr; + + view->index++; + *puReturned = 1; + if (view->index == view->count) return WBEM_S_FALSE; + if (uCount > 1) return WBEM_S_TIMEDOUT; + return WBEM_S_NO_ERROR; } static HRESULT WINAPI enum_class_object_NextAsync( @@ -168,6 +187,8 @@ struct class_object { IWbemClassObject IWbemClassObject_iface; LONG refs; + IEnumWbemClassObject *iter; + UINT index; }; static inline struct class_object *impl_from_IWbemClassObject( @@ -191,6 +212,7 @@ static ULONG WINAPI class_object_Release( if (!refs) { TRACE("destroying %p\n", co); + if (co->iter) IEnumWbemClassObject_Release( co->iter ); heap_free( co ); } return refs; @@ -472,7 +494,7 @@ static const IWbemClassObjectVtbl class_object_vtbl = }; HRESULT WbemClassObject_create( - IUnknown *pUnkOuter, LPVOID *ppObj ) + IUnknown *pUnkOuter, IEnumWbemClassObject *iter, UINT index, LPVOID *ppObj ) { struct class_object *co; @@ -482,7 +504,10 @@ HRESULT WbemClassObject_create( if (!co) return E_OUTOFMEMORY; co->IWbemClassObject_iface.lpVtbl = &class_object_vtbl; - co->refs = 1; + co->refs = 1; + co->iter = iter; + co->index = index; + if (iter) IEnumWbemClassObject_AddRef( iter ); *ppObj = &co->IWbemClassObject_iface; diff --git a/dlls/wbemprox/query.c b/dlls/wbemprox/query.c index eb2f332..701d656 100644 --- a/dlls/wbemprox/query.c +++ b/dlls/wbemprox/query.c @@ -41,6 +41,7 @@ HRESULT create_view( const struct property *proplist, const WCHAR *class, view->cond = cond; view->result = NULL; view->count = 0; + view->index = 0; *ret = view; return S_OK; } diff --git a/dlls/wbemprox/wbemprox_private.h b/dlls/wbemprox/wbemprox_private.h index bb29738..3b4af0d 100644 --- a/dlls/wbemprox/wbemprox_private.h +++ b/dlls/wbemprox/wbemprox_private.h @@ -95,6 +95,7 @@ struct view const struct expr *cond; UINT *result; UINT count; + UINT index; }; struct query @@ -113,6 +114,7 @@ struct table *get_table( const WCHAR * ) DECLSPEC_HIDDEN; HRESULT WbemLocator_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN; HRESULT WbemServices_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN; +HRESULT WbemClassObject_create(IUnknown *, IEnumWbemClassObject *, UINT, LPVOID *) DECLSPEC_HIDDEN; HRESULT EnumWbemClassObject_create(IUnknown *, struct query *, LPVOID *) DECLSPEC_HIDDEN; static void *heap_alloc( size_t len ) __WINE_ALLOC_SIZE(1);
1
0
0
0
Hans Leidekker : wbemprox: Add support for evaluating query conditions.
by Alexandre Julliard
15 Jun '12
15 Jun '12
Module: wine Branch: master Commit: 19f203c7b267f16d333a6013fa8b06b9d1e54b5e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=19f203c7b267f16d333a6013f…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Fri Jun 15 15:47:54 2012 +0200 wbemprox: Add support for evaluating query conditions. --- dlls/wbemprox/query.c | 270 +++++++++++++++++++++++++++++++++++++- dlls/wbemprox/wbemprox_private.h | 8 + 2 files changed, 273 insertions(+), 5 deletions(-) diff --git a/dlls/wbemprox/query.c b/dlls/wbemprox/query.c index 551cd20..eb2f332 100644 --- a/dlls/wbemprox/query.c +++ b/dlls/wbemprox/query.c @@ -39,15 +39,275 @@ HRESULT create_view( const struct property *proplist, const WCHAR *class, view->proplist = proplist; view->table = get_table( class ); view->cond = cond; + view->result = NULL; + view->count = 0; *ret = view; return S_OK; } void destroy_view( struct view *view ) { + heap_free( view->result ); heap_free( view ); } +static HRESULT get_column_index( const struct table *table, const WCHAR *name, UINT *column ) +{ + UINT i; + for (i = 0; i < table->num_cols; i++) + { + if (!strcmpiW( table->columns[i].name, name )) + { + *column = i; + return S_OK; + } + } + return WBEM_E_INVALID_QUERY; +} + +static UINT get_column_size( const struct table *table, UINT column ) +{ + if (table->columns[column].type & CIM_FLAG_ARRAY) return sizeof(void *); + + switch (table->columns[column].type) + { + case CIM_SINT16: + case CIM_UINT16: + return sizeof(INT16); + case CIM_SINT32: + case CIM_UINT32: + return sizeof(INT32); + case CIM_DATETIME: + case CIM_STRING: + return sizeof(WCHAR *); + default: + ERR("unkown column type %u\n", table->columns[column].type); + break; + } + return sizeof(INT32); +} + +static UINT get_column_offset( const struct table *table, UINT column ) +{ + UINT i, offset = 0; + for (i = 0; i < column; i++) offset += get_column_size( table, i ); + return offset; +} + +static UINT get_row_size( const struct table *table ) +{ + return get_column_offset( table, table->num_cols - 1 ) + get_column_size( table, table->num_cols - 1 ); +} + +static HRESULT get_value( const struct table *table, UINT row, UINT column, INT_PTR *val ) +{ + UINT col_offset, row_size; + const BYTE *ptr; + + col_offset = get_column_offset( table, column ); + row_size = get_row_size( table ); + ptr = table->data + row * row_size + col_offset; + + if (table->columns[column].type & CIM_FLAG_ARRAY) + { + *val = (INT_PTR)*(const void **)ptr; + return S_OK; + } + switch (table->columns[column].type) + { + case CIM_DATETIME: + case CIM_STRING: + *val = (INT_PTR)*(const WCHAR **)ptr; + break; + case CIM_SINT16: + *val = *(const INT16 *)ptr; + break; + case CIM_UINT16: + *val = *(const UINT16 *)ptr; + break; + case CIM_SINT32: + *val = *(const INT32 *)ptr; + break; + case CIM_UINT32: + *val = *(const UINT32 *)ptr; + break; + default: + ERR("invalid column type %u\n", table->columns[column].type); + *val = 0; + break; + } + return S_OK; +} + +static BOOL eval_like( INT_PTR lval, INT_PTR rval ) +{ + const WCHAR *p = (const WCHAR *)lval, *q = (const WCHAR *)rval; + + while (*p && *q) + { + if (*q == '%') + { + while (*q == '%') q++; + if (!*q) return TRUE; + while (*p && toupperW( p[1] ) != toupperW( q[1] )) p++; + if (!*p) return TRUE; + } + if (toupperW( *p++ ) != toupperW( *q++ )) return FALSE; + } + return TRUE; +} + +static HRESULT eval_cond( const struct table *, UINT, const struct expr *, INT_PTR * ); + +static BOOL eval_binary( const struct table *table, UINT row, const struct complex_expr *expr, + INT_PTR *val ) +{ + HRESULT lret, rret; + INT_PTR lval, rval; + + lret = eval_cond( table, row, expr->left, &lval ); + rret = eval_cond( table, row, expr->right, &rval ); + if (lret != S_OK || rret != S_OK) return WBEM_E_INVALID_QUERY; + + switch (expr->op) + { + case OP_EQ: + *val = (lval == rval); + break; + case OP_AND: + *val = (lval && rval); + break; + case OP_OR: + *val = (lval || rval); + break; + case OP_GT: + *val = (lval > rval); + break; + case OP_LT: + *val = (lval < rval); + break; + case OP_LE: + *val = (lval <= rval); + break; + case OP_GE: + *val = (lval >= rval); + break; + case OP_NE: + *val = (lval != rval); + break; + case OP_LIKE: + *val = eval_like( lval, rval ); + break; + default: + ERR("unknown operator %u\n", expr->op); + return WBEM_E_INVALID_QUERY; + } + return S_OK; +} + +static HRESULT eval_unary( const struct table *table, UINT row, const struct complex_expr *expr, + INT_PTR *val ) + +{ + HRESULT hr; + UINT column; + INT_PTR lval; + + hr = get_column_index( table, expr->left->u.propval->name, &column ); + if (hr != S_OK) + return hr; + + hr = get_value( table, row, column, &lval ); + if (hr != S_OK) + return hr; + + switch (expr->op) + { + case OP_ISNULL: + *val = !lval; + break; + case OP_NOTNULL: + *val = lval; + break; + default: + ERR("unknown operator %u\n", expr->op); + return WBEM_E_INVALID_QUERY; + } + return S_OK; +} + +static HRESULT eval_propval( const struct table *table, UINT row, const struct property *propval, + INT_PTR *val ) + +{ + HRESULT hr; + UINT column; + + hr = get_column_index( table, propval->name, &column ); + if (hr != S_OK) + return hr; + + return get_value( table, row, column, val ); +} + +static HRESULT eval_cond( const struct table *table, UINT row, const struct expr *cond, + INT_PTR *val ) +{ + if (!cond) + { + *val = 1; + return S_OK; + } + switch (cond->type) + { + case EXPR_COMPLEX: + return eval_binary( table, row, &cond->u.expr, val ); + case EXPR_UNARY: + return eval_unary( table, row, &cond->u.expr, val ); + case EXPR_PROPVAL: + return eval_propval( table, row, cond->u.propval, val ); + case EXPR_SVAL: + *val = (INT_PTR)cond->u.sval; + return S_OK; + case EXPR_IVAL: + case EXPR_BVAL: + *val = cond->u.ival; + return S_OK; + default: + ERR("invalid expression type\n"); + break; + } + return WBEM_E_INVALID_QUERY; +} + +static HRESULT execute_view( struct view *view ) +{ + UINT i, j = 0, len; + + if (!view->table || !view->table->num_rows) return S_OK; + + len = min( view->table->num_rows, 16 ); + if (!(view->result = heap_alloc( len * sizeof(UINT) ))) return E_OUTOFMEMORY; + + for (i = 0; i < view->table->num_rows; i++) + { + HRESULT hr; + INT_PTR val = 0; + + if (j >= len) + { + UINT *tmp; + len *= 2; + if (!(tmp = heap_realloc( view->result, len * sizeof(UINT) ))) return E_OUTOFMEMORY; + view->result = tmp; + } + if ((hr = eval_cond( view->table, i, view->cond, &val )) != S_OK) return hr; + if (val) view->result[j++] = i; + } + view->count = j; + return S_OK; +} + static struct query *alloc_query(void) { struct query *query; @@ -77,12 +337,12 @@ HRESULT exec_query( const WCHAR *str, IEnumWbemClassObject **result ) *result = NULL; if (!(query = alloc_query())) return E_OUTOFMEMORY; hr = parse_query( str, &query->view, &query->mem ); - if (hr != S_OK) - { - free_query( query ); - return hr; - } + if (hr != S_OK) goto done; + hr = execute_view( query->view ); + if (hr != S_OK) goto done; hr = EnumWbemClassObject_create( NULL, query, (void **)result ); + +done: if (hr != S_OK) free_query( query ); return hr; } diff --git a/dlls/wbemprox/wbemprox_private.h b/dlls/wbemprox/wbemprox_private.h index 346ed43..bb29738 100644 --- a/dlls/wbemprox/wbemprox_private.h +++ b/dlls/wbemprox/wbemprox_private.h @@ -93,6 +93,8 @@ struct view const struct property *proplist; struct table *table; const struct expr *cond; + UINT *result; + UINT count; }; struct query @@ -119,6 +121,12 @@ static inline void *heap_alloc( size_t len ) return HeapAlloc( GetProcessHeap(), 0, len ); } +static void *heap_realloc( void *mem, size_t len ) __WINE_ALLOC_SIZE(2); +static inline void *heap_realloc( void *mem, size_t len ) +{ + return HeapReAlloc( GetProcessHeap(), 0, mem, len ); +} + static inline BOOL heap_free( void *mem ) { return HeapFree( GetProcessHeap(), 0, mem );
1
0
0
0
Hans Leidekker : wbemprox: Add a partial Win32_BIOS class implementation.
by Alexandre Julliard
15 Jun '12
15 Jun '12
Module: wine Branch: master Commit: d75375ea451df85d991ead883205e0206682f6f2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d75375ea451df85d991ead883…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Fri Jun 15 15:47:28 2012 +0200 wbemprox: Add a partial Win32_BIOS class implementation. --- dlls/wbemprox/Makefile.in | 1 + dlls/wbemprox/builtin.c | 98 ++++++++++++++++++++++++++++++++++++++ dlls/wbemprox/query.c | 1 + dlls/wbemprox/wbemprox_private.h | 18 +++++++ 4 files changed, 118 insertions(+), 0 deletions(-) diff --git a/dlls/wbemprox/Makefile.in b/dlls/wbemprox/Makefile.in index 8c6c313..3a4d9f3 100644 --- a/dlls/wbemprox/Makefile.in +++ b/dlls/wbemprox/Makefile.in @@ -2,6 +2,7 @@ MODULE = wbemprox.dll IMPORTS = ole32 advapi32 C_SRCS = \ + builtin.c \ class.c \ main.c \ query.c \ diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c new file mode 100644 index 0000000..c6879e7 --- /dev/null +++ b/dlls/wbemprox/builtin.c @@ -0,0 +1,98 @@ +/* + * Copyright 2012 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 + */ + +#define COBJMACROS + +#include "config.h" +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "wbemcli.h" + +#include "wine/debug.h" +#include "wbemprox_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wbemprox); + +static const WCHAR class_biosW[] = + {'W','i','n','3','2','_','B','I','O','S',0}; + +static const WCHAR prop_captionW[] = + {'C','a','p','t','i','o','n',0}; +static const WCHAR prop_descriptionW[] = + {'D','e','s','c','r','i','p','t','i','o','n',0}; +static const WCHAR prop_manufacturerW[] = + {'M','a','n','u','f','a','c','t','u','r','e','r',0}; +static const WCHAR prop_releasedateW[] = + {'R','e','l','e','a','s','e','D','a','t','e',0}; +static const WCHAR prop_serialnumberW[] = + {'S','e','r','i','a','l','N','u','m','b','e','r',0}; + +static const struct column col_bios[] = +{ + { prop_descriptionW, CIM_STRING }, + { prop_manufacturerW, CIM_STRING }, + { prop_releasedateW, CIM_DATETIME }, + { prop_serialnumberW, CIM_STRING } +}; + +static const WCHAR bios_descriptionW[] = + {'D','e','f','a','u','l','t',' ','S','y','s','t','e','m',' ','B','I','O','S',0}; +static const WCHAR bios_manufacturerW[] = + {'T','h','e',' ','W','i','n','e',' ','P','r','o','j','e','c','t',0}; +static const WCHAR bios_releasedateW[] = + {'2','0','1','2','0','6','0','8','0','0','0','0','0','0','.','0','0','0','0','0','0','+','0','0','0',0}; +static const WCHAR bios_serialnumberW[] = + {'0',0}; + +#include "pshpack1.h" +struct record_bios +{ + const WCHAR *description; + const WCHAR *manufacturer; + const WCHAR *releasedate; + const WCHAR *serialnumber; +}; +#include "poppack.h" + +static const struct record_bios data_bios[] = +{ + { bios_descriptionW, bios_manufacturerW, bios_releasedateW, bios_serialnumberW } +}; + +static struct table classtable[] = +{ + { class_biosW, SIZEOF(col_bios), col_bios, SIZEOF(data_bios), (BYTE *)data_bios } +}; + +struct table *get_table( const WCHAR *name ) +{ + UINT i; + struct table *table = NULL; + + for (i = 0; i < SIZEOF(classtable); i++) + { + if (!strcmpiW( classtable[i].name, name )) + { + table = &classtable[i]; + break; + } + } + return table; +} diff --git a/dlls/wbemprox/query.c b/dlls/wbemprox/query.c index d40d7f1..551cd20 100644 --- a/dlls/wbemprox/query.c +++ b/dlls/wbemprox/query.c @@ -37,6 +37,7 @@ HRESULT create_view( const struct property *proplist, const WCHAR *class, if (!view) return E_OUTOFMEMORY; view->proplist = proplist; + view->table = get_table( class ); view->cond = cond; *ret = view; return S_OK; diff --git a/dlls/wbemprox/wbemprox_private.h b/dlls/wbemprox/wbemprox_private.h index 7e129f0..346ed43 100644 --- a/dlls/wbemprox/wbemprox_private.h +++ b/dlls/wbemprox/wbemprox_private.h @@ -17,9 +17,25 @@ */ #include "wine/list.h" +#include "wine/unicode.h" #define SIZEOF(array) (sizeof(array)/sizeof((array)[0])) +struct column +{ + const WCHAR *name; + CIMTYPE_ENUMERATION type; +}; + +struct table +{ + const WCHAR *name; + UINT num_cols; + const struct column *columns; + UINT num_rows; + BYTE *data; +}; + struct property { const WCHAR *name; @@ -75,6 +91,7 @@ struct expr struct view { const struct property *proplist; + struct table *table; const struct expr *cond; }; @@ -90,6 +107,7 @@ HRESULT parse_query( const WCHAR *, struct view **, struct list * ) DECLSPEC_HID HRESULT create_view( const struct property *, const WCHAR *, const struct expr *, struct view ** ) DECLSPEC_HIDDEN; void destroy_view( struct view * ) DECLSPEC_HIDDEN; +struct table *get_table( const WCHAR * ) DECLSPEC_HIDDEN; HRESULT WbemLocator_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN; HRESULT WbemServices_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN;
1
0
0
0
Hans Leidekker : wbemprox: Add support for parsing WQL queries.
by Alexandre Julliard
15 Jun '12
15 Jun '12
Module: wine Branch: master Commit: f6be21103b441180c8557aa6bc2845e5428271a4 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f6be21103b441180c8557aa6b…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Fri Jun 15 15:46:51 2012 +0200 wbemprox: Add support for parsing WQL queries. --- .gitignore | 2 + dlls/wbemprox/Makefile.in | 3 + dlls/wbemprox/class.c | 5 +- dlls/wbemprox/query.c | 87 +++++ dlls/wbemprox/services.c | 13 +- dlls/wbemprox/wbemprox_private.h | 76 ++++ dlls/wbemprox/wql.y | 698 ++++++++++++++++++++++++++++++++++++++ 7 files changed, 879 insertions(+), 5 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=f6be21103b441180c8557…
1
0
0
0
Jacek Caban : advapi32: Pass service name as argv[0] to ServiceMain.
by Alexandre Julliard
15 Jun '12
15 Jun '12
Module: wine Branch: master Commit: 52363aef65a3ad87ac2d840378cc6483c740ad80 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=52363aef65a3ad87ac2d84037…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Jun 15 16:37:27 2012 +0200 advapi32: Pass service name as argv[0] to ServiceMain. --- dlls/advapi32/service.c | 3 +-- programs/services/services.c | 5 +---- programs/services/tests/service.c | 4 ++++ 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dlls/advapi32/service.c b/dlls/advapi32/service.c index 0e5001a..088de91 100644 --- a/dlls/advapi32/service.c +++ b/dlls/advapi32/service.c @@ -430,8 +430,7 @@ static DWORD WINAPI service_control_dispatcher(LPVOID arg) !(service->full_access_handle = OpenServiceW( manager, data, GENERIC_READ|GENERIC_WRITE ))) FIXME( "failed to open service %s\n", debugstr_w(data) ); } - result = service_handle_start(service, data + info.name_size, - data_size / sizeof(WCHAR) - info.name_size ); + result = service_handle_start(service, data, data_size / sizeof(WCHAR)); break; case WINESERV_SENDCONTROL: result = service_handle_control(service, info.control); diff --git a/programs/services/services.c b/programs/services/services.c index 5d8e40f..d28e47e 100644 --- a/programs/services/services.c +++ b/programs/services/services.c @@ -299,11 +299,8 @@ static void scmdatabase_autostart_services(struct scmdatabase *db) for (i = 0; i < size; i++) { DWORD err; - const WCHAR *argv[2]; service = services_list[i]; - argv[0] = service->name; - argv[1] = NULL; - err = service_start(service, 1, argv); + err = service_start(service, 0, NULL); if (err != ERROR_SUCCESS) WINE_FIXME("Auto-start service %s failed to start: %d\n", wine_dbgstr_w(service->name), err); diff --git a/programs/services/tests/service.c b/programs/services/tests/service.c index 5348bb9..9de6085 100644 --- a/programs/services/tests/service.c +++ b/programs/services/tests/service.c @@ -94,6 +94,10 @@ static void WINAPI service_main(DWORD argc, char **argv) SERVICE_STATUS status; BOOL res; + service_ok(argc == 1, "argc = %d", argc); + if(argc) + service_ok(!strcmp(argv[0], service_name), "argv[0] = %s, expected %s", argv[0], service_name); + service_handle = pRegisterServiceCtrlHandlerExA(service_name, service_handler, NULL); service_ok(service_handle != NULL, "RegisterServiceCtrlHandlerEx failed: %u\n", GetLastError()); if(!service_handle)
1
0
0
0
Jacek Caban : services.exe: Added tests.
by Alexandre Julliard
15 Jun '12
15 Jun '12
Module: wine Branch: master Commit: d0244d761dcda907ece3a709e5a31afcc00315ea URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d0244d761dcda907ece3a709e…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Fri Jun 15 15:35:19 2012 +0200 services.exe: Added tests. --- configure | 1 + configure.ac | 1 + programs/services/tests/Makefile.in | 7 + programs/services/tests/service.c | 329 +++++++++++++++++++++++++++++++++++ 4 files changed, 338 insertions(+), 0 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=d0244d761dcda907ece3a…
1
0
0
0
Francois Gouget : kernel32: Use the English (United States) spelling of license.
by Alexandre Julliard
15 Jun '12
15 Jun '12
Module: wine Branch: master Commit: 27b8e7c1d8c41b9eee734d4eba381005f23c443d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=27b8e7c1d8c41b9eee734d4eb…
Author: Francois Gouget <fgouget(a)free.fr> Date: Fri Jun 15 15:22:52 2012 +0200 kernel32: Use the English (United States) spelling of license. --- dlls/kernel32/winerror.mc | 2 +- po/ar.po | 2 +- po/bg.po | 2 +- po/ca.po | 2 +- po/cs.po | 2 +- po/da.po | 2 +- po/de.po | 2 +- po/el.po | 2 +- po/en.po | 2 +- po/en_US.po | 4 ++-- po/eo.po | 2 +- po/es.po | 2 +- po/fa.po | 2 +- po/fi.po | 2 +- po/fr.po | 2 +- po/he.po | 2 +- po/hi.po | 2 +- po/hu.po | 2 +- po/it.po | 2 +- po/ja.po | 2 +- po/ko.po | 2 +- po/lt.po | 2 +- po/ml.po | 2 +- po/nb_NO.po | 2 +- po/nl.po | 2 +- po/or.po | 2 +- po/pa.po | 2 +- po/pl.po | 2 +- po/pt_BR.po | 2 +- po/pt_PT.po | 2 +- po/rm.po | 2 +- po/ro.po | 2 +- po/ru.po | 2 +- po/sk.po | 2 +- po/sl.po | 2 +- po/sr_RS(a)cyrillic.po | 2 +- po/sr_RS(a)latin.po | 2 +- po/sv.po | 2 +- po/te.po | 2 +- po/th.po | 2 +- po/tr.po | 2 +- po/uk.po | 2 +- po/wa.po | 2 +- po/wine.pot | 2 +- po/zh_CN.po | 2 +- po/zh_TW.po | 2 +- 46 files changed, 47 insertions(+), 47 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=27b8e7c1d8c41b9eee734…
1
0
0
0
Francois Gouget : shell32/tests: Get rid of unneeded function typedefs.
by Alexandre Julliard
15 Jun '12
15 Jun '12
Module: wine Branch: master Commit: ef6f3a30cc88ef4cbec79433f234de8b2fe1fe9b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ef6f3a30cc88ef4cbec79433f…
Author: Francois Gouget <fgouget(a)free.fr> Date: Fri Jun 15 15:20:30 2012 +0200 shell32/tests: Get rid of unneeded function typedefs. --- dlls/shell32/tests/shelllink.c | 21 ++++++++------------- 1 files changed, 8 insertions(+), 13 deletions(-) diff --git a/dlls/shell32/tests/shelllink.c b/dlls/shell32/tests/shelllink.c index d28cff0..8c6275d 100644 --- a/dlls/shell32/tests/shelllink.c +++ b/dlls/shell32/tests/shelllink.c @@ -37,15 +37,10 @@ # define SLDF_HAS_LOGO3ID 0x00000800 /* not available in the Vista SDK */ #endif -typedef void (WINAPI *fnILFree)(LPITEMIDLIST); -typedef BOOL (WINAPI *fnILIsEqual)(LPCITEMIDLIST, LPCITEMIDLIST); -typedef HRESULT (WINAPI *fnSHILCreateFromPath)(LPCWSTR, LPITEMIDLIST *,DWORD*); -typedef HRESULT (WINAPI *fnSHDefExtractIconA)(LPCSTR, int, UINT, HICON*, HICON*, UINT); - -static fnILFree pILFree; -static fnILIsEqual pILIsEqual; -static fnSHILCreateFromPath pSHILCreateFromPath; -static fnSHDefExtractIconA pSHDefExtractIconA; +static void (WINAPI *pILFree)(LPITEMIDLIST); +static BOOL (WINAPI *pILIsEqual)(LPCITEMIDLIST, LPCITEMIDLIST); +static HRESULT (WINAPI *pSHILCreateFromPath)(LPCWSTR, LPITEMIDLIST *,DWORD*); +static HRESULT (WINAPI *pSHDefExtractIconA)(LPCSTR, int, UINT, HICON*, HICON*, UINT); static DWORD (WINAPI *pGetLongPathNameA)(LPCSTR, LPSTR, DWORD); static DWORD (WINAPI *pGetShortPathNameA)(LPCSTR, LPSTR, DWORD); @@ -1005,10 +1000,10 @@ START_TEST(shelllink) HMODULE hmod = GetModuleHandleA("shell32.dll"); HMODULE hkernel32 = GetModuleHandleA("kernel32.dll"); - pILFree = (fnILFree) GetProcAddress(hmod, (LPSTR)155); - pILIsEqual = (fnILIsEqual) GetProcAddress(hmod, (LPSTR)21); - pSHILCreateFromPath = (fnSHILCreateFromPath) GetProcAddress(hmod, (LPSTR)28); - pSHDefExtractIconA = (fnSHDefExtractIconA) GetProcAddress(hmod, "SHDefExtractIconA"); + pILFree = (void *)GetProcAddress(hmod, (LPSTR)155); + pILIsEqual = (void *)GetProcAddress(hmod, (LPSTR)21); + pSHILCreateFromPath = (void *)GetProcAddress(hmod, (LPSTR)28); + pSHDefExtractIconA = (void *)GetProcAddress(hmod, "SHDefExtractIconA"); pGetLongPathNameA = (void *)GetProcAddress(hkernel32, "GetLongPathNameA"); pGetShortPathNameA = (void *)GetProcAddress(hkernel32, "GetShortPathNameA");
1
0
0
0
← Newer
1
...
44
45
46
47
48
49
50
...
83
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
Results per page:
10
25
50
100
200