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 2009
----- 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
5 participants
1115 discussions
Start a n
N
ew thread
Piotr Caban : jscript: Fixed Date_setMilliseconds implementation.
by Alexandre Julliard
23 Jun '09
23 Jun '09
Module: wine Branch: master Commit: 37883a66fae40715e63226a134c2134f54f18176 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=37883a66fae40715e63226a13…
Author: Piotr Caban <piotr.caban(a)gmail.com> Date: Mon Jun 22 20:41:01 2009 +0200 jscript: Fixed Date_setMilliseconds implementation. Previous implementation was not working when: utc_time != to_utc(to_local_time(utc_time)) --- dlls/jscript/date.c | 39 +++++++++++++++++++++++++++++++++++++-- dlls/jscript/tests/api.js | 3 ++- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/dlls/jscript/date.c b/dlls/jscript/date.c index 0a865e4..ab279c0 100644 --- a/dlls/jscript/date.c +++ b/dlls/jscript/date.c @@ -882,6 +882,7 @@ static HRESULT Date_setMilliseconds(DispatchEx *dispex, LCID lcid, WORD flags, D VARIANT v; HRESULT hres; DateInstance *date; + DOUBLE t; TRACE("\n"); @@ -901,7 +902,10 @@ static HRESULT Date_setMilliseconds(DispatchEx *dispex, LCID lcid, WORD flags, D return hres; date = (DateInstance*)dispex; - date->time = time_clip(date->time - ms_from_time(date->time) + num_val(&v)); + t = local_time(date->time, date); + t = make_date(day(t), make_time(hour_from_time(t), min_from_time(t), + sec_from_time(t), num_val(&v))); + date->time = time_clip(utc(t, date)); if(retv) num_set_val(retv, date->time); @@ -913,7 +917,38 @@ static HRESULT Date_setMilliseconds(DispatchEx *dispex, LCID lcid, WORD flags, D static HRESULT Date_setUTCMilliseconds(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller) { - return Date_setMilliseconds(dispex, lcid, flags, dp, retv, ei, caller); + VARIANT v; + HRESULT hres; + DateInstance *date; + DOUBLE t; + + TRACE("\n"); + + if(!is_class(dispex, JSCLASS_DATE)) { + FIXME("throw TypeError\n"); + return E_FAIL; + } + + if(!arg_cnt(dp)) { + FIXME("throw ArgumentNotOptional\n"); + if(retv) num_set_nan(retv); + return S_OK; + } + + hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &v); + if(FAILED(hres)) + return hres; + + date = (DateInstance*)dispex; + t = date->time; + t = make_date(day(t), make_time(hour_from_time(t), min_from_time(t), + sec_from_time(t), num_val(&v))); + date->time = time_clip(t); + + if(retv) + num_set_val(retv, date->time); + + return S_OK; } /* ECMA-262 3rd Edition 15.9.5.30 */ diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index 5236152..a865e9f 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -1003,7 +1003,8 @@ ok(isNaN(date.setMilliseconds(0)), "date.setMilliseconds() is not NaN"); date.setTime(0); date.setMilliseconds(-10, 2); ok(date.getUTCMilliseconds() === 990, "date.getUTCMilliseconds() = " + date.getUTCMilliseconds()); -ok(date.setMilliseconds(10) === date.setUTCMilliseconds(10), "date.setUTCMilliseconds(10) !== date.setUTCMilliseconds(10)"); +date.setUTCMilliseconds(10); +ok(date.getUTCMilliseconds() === 10, "date.getUTCMilliseconds() = " + date.getUTCMilliseconds()); date.setSeconds(-10); ok(date.getUTCSeconds() === 50, "date.getUTCSeconds() = " + date.getUTCSeconds()); ok(date.setSeconds(10) === date.setUTCSeconds(10), "date.setUTCSeconds(10) !== date.setUTCSeconds(10)");
1
0
0
0
Piotr Caban : jscript: Fix typos in comments, add missing ones.
by Alexandre Julliard
23 Jun '09
23 Jun '09
Module: wine Branch: master Commit: b45f01b6ce1ed1edab339ff5c1ca7049e41f35c7 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b45f01b6ce1ed1edab339ff5c…
Author: Piotr Caban <piotr.caban(a)gmail.com> Date: Mon Jun 22 20:40:46 2009 +0200 jscript: Fix typos in comments, add missing ones. --- dlls/jscript/date.c | 74 +++++++++++++++++++++++++++++--------------------- 1 files changed, 43 insertions(+), 31 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=b45f01b6ce1ed1edab339…
1
0
0
0
Piotr Caban : jscript: Added Date_getTimezoneOffset and fixed Date_get... functions.
by Alexandre Julliard
23 Jun '09
23 Jun '09
Module: wine Branch: master Commit: 305aee069aa27d9a139369eb65b7be52060e5522 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=305aee069aa27d9a139369eb6…
Author: Piotr Caban <piotr.caban(a)gmail.com> Date: Mon Jun 22 20:40:33 2009 +0200 jscript: Added Date_getTimezoneOffset and fixed Date_get... functions. --- dlls/jscript/date.c | 37 +++++++++++++++++++++++++++---------- dlls/jscript/tests/api.js | 16 ++++++++++++++++ 2 files changed, 43 insertions(+), 10 deletions(-) diff --git a/dlls/jscript/date.c b/dlls/jscript/date.c index 52eac08..156afeb 100644 --- a/dlls/jscript/date.c +++ b/dlls/jscript/date.c @@ -315,6 +315,12 @@ static inline DOUBLE daylight_saving_ta(DOUBLE time, DateInstance *date) } /* ECMA-262 3rd Edition 15.9.1.9 */ +static inline DOUBLE local_time(DOUBLE time, DateInstance *date) +{ + return time - (daylight_saving_ta(time, date)+date->bias)*MS_PER_MINUTE; +} + +/* ECMA-262 3rd Edition 15.9.1.9 */ static inline DOUBLE utc(DOUBLE time, DateInstance *date) { time += date->bias * MS_PER_MINUTE; @@ -525,7 +531,7 @@ static HRESULT Date_getFullYear(DispatchEx *dispex, LCID lcid, WORD flags, DISPP if(retv) { DateInstance *date = (DateInstance*)dispex; - DOUBLE time = date->time - date->bias*MS_PER_MINUTE; + DOUBLE time = local_time(date->time, date); num_set_val(retv, year_from_time(time)); } @@ -563,7 +569,7 @@ static HRESULT Date_getMonth(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARA if(retv) { DateInstance *date = (DateInstance*)dispex; - DOUBLE time = date->time - date->bias*MS_PER_MINUTE; + DOUBLE time = local_time(date->time, date); num_set_val(retv, month_from_time(time)); } @@ -601,7 +607,7 @@ static HRESULT Date_getDate(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM if(retv) { DateInstance *date = (DateInstance*)dispex; - DOUBLE time = date->time - date->bias*MS_PER_MINUTE; + DOUBLE time = local_time(date->time, date); num_set_val(retv, date_from_time(time)); } @@ -639,7 +645,7 @@ static HRESULT Date_getDay(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS if(retv) { DateInstance *date = (DateInstance*)dispex; - DOUBLE time = date->time - date->bias*MS_PER_MINUTE; + DOUBLE time = local_time(date->time, date); num_set_val(retv, week_day(time)); } @@ -677,7 +683,7 @@ static HRESULT Date_getHours(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARA if(retv) { DateInstance *date = (DateInstance*)dispex; - DOUBLE time = date->time - date->bias*MS_PER_MINUTE; + DOUBLE time = local_time(date->time, date); num_set_val(retv, hour_from_time(time)); } @@ -715,7 +721,7 @@ static HRESULT Date_getMinutes(DispatchEx *dispex, LCID lcid, WORD flags, DISPPA if(retv) { DateInstance *date = (DateInstance*)dispex; - DOUBLE time = date->time - date->bias*MS_PER_MINUTE; + DOUBLE time = local_time(date->time, date); num_set_val(retv, min_from_time(time)); } @@ -753,7 +759,7 @@ static HRESULT Date_getSeconds(DispatchEx *dispex, LCID lcid, WORD flags, DISPPA if(retv) { DateInstance *date = (DateInstance*)dispex; - DOUBLE time = date->time - date->bias*MS_PER_MINUTE; + DOUBLE time = local_time(date->time, date); num_set_val(retv, sec_from_time(time)); } @@ -791,7 +797,7 @@ static HRESULT Date_getMilliseconds(DispatchEx *dispex, LCID lcid, WORD flags, D if(retv) { DateInstance *date = (DateInstance*)dispex; - DOUBLE time = date->time - date->bias*MS_PER_MINUTE; + DOUBLE time = local_time(date->time, date); num_set_val(retv, ms_from_time(time)); } @@ -819,8 +825,19 @@ static HRESULT Date_getUTCMilliseconds(DispatchEx *dispex, LCID lcid, WORD flags static HRESULT Date_getTimezoneOffset(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller) { - FIXME("\n"); - return E_NOTIMPL; + TRACE("\n"); + + if(!is_class(dispex, JSCLASS_DATE)) { + FIXME("throw TypeError\n"); + return E_FAIL; + } + + if(retv) { + DateInstance *date = (DateInstance*)dispex; + num_set_val(retv, floor( + (date->time-local_time(date->time, date))/MS_PER_MINUTE)); + } + return S_OK; } static HRESULT Date_setTime(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp, diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index ad4822c..5236152 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -940,6 +940,22 @@ date = new Date(8.64e15+1); ok(isNaN(0+date.getTime()), "date.getTime() is not NaN"); date = new Date(Infinity); ok(isNaN(0+date.getTime()), "date.getTime() is not NaN"); +date = new Date(1984, 11, 29, 13, 51, 24, 120); +ok(date.getFullYear() === 1984, "date.getFullYear() = " + date.getFullYear()); +ok(date.getMonth() === 11, "date.getMonth() = " + date.getMonth()); +ok(date.getDate() === 29, "date.getDate() = " + date.getDate()); +ok(date.getHours() === 13, "date.getHours() = " + date.getHours()); +ok(date.getMinutes() === 51, "date.getMinutes() = " + date.getMinutes()); +ok(date.getSeconds() === 24, "date.getSeconds() = " + date.getSeconds()); +ok(date.getMilliseconds() === 120, "date.getMilliseconds() = " + date.getMilliseconds()); +date = new Date(731, -32, 40, -1, 70, 65, -13); +ok(date.getFullYear() === 728, "date.getFullYear() = " + date.getFullYear()); +ok(date.getMonth() === 5, "date.getMonth() = " + date.getMonth()); +ok(date.getDate() === 9, "date.getDate() = " + date.getDate()); +ok(date.getHours() === 0, "date.getHours() = " + date.getHours()); +ok(date.getMinutes() === 11, "date.getMinutes() = " + date.getMinutes()); +ok(date.getSeconds() === 4, "date.getSeconds() = " + date.getSeconds()); +ok(date.getMilliseconds() === 987, "date.getMilliseconds() = " + date.getMilliseconds()); ok(date.setTime(123) === 123, "date.setTime(123) !== 123"); ok(date.setTime("123", NaN) === 123, "date.setTime(\"123\") !== 123");
1
0
0
0
Piotr Caban : jscript: Added implementation of Date constructor with more then one argument.
by Alexandre Julliard
23 Jun '09
23 Jun '09
Module: wine Branch: master Commit: b529cdb65ea879c59ab8f428164fc6f35b0efaa9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b529cdb65ea879c59ab8f4281…
Author: Piotr Caban <piotr.caban(a)gmail.com> Date: Mon Jun 22 20:40:01 2009 +0200 jscript: Added implementation of Date constructor with more then one argument. --- dlls/jscript/date.c | 228 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 219 insertions(+), 9 deletions(-) diff --git a/dlls/jscript/date.c b/dlls/jscript/date.c index 3fd856e..52eac08 100644 --- a/dlls/jscript/date.c +++ b/dlls/jscript/date.c @@ -35,6 +35,10 @@ typedef struct { DOUBLE time; LONG bias; + SYSTEMTIME standardDate; + LONG standardBias; + SYSTEMTIME daylightDate; + LONG daylightBias; } DateInstance; static const WCHAR toStringW[] = {'t','o','S','t','r','i','n','g',0}; @@ -112,14 +116,42 @@ static inline DOUBLE days_in_year(DOUBLE year) /* ECMA-262 3th Edition 15.9.1.3 */ static inline DOUBLE day_from_year(DOUBLE year) { - int y; - if(year != (int)year) return ret_nan(); - y = year; - return 365*(y-1970) + floor((y-1969)/4) - - floor((y-1901)/100) + floor((y-1601)/400); + return floor(365.0*(year-1970) + floor((year-1969)/4) + - floor((year-1901)/100) + floor((year-1601)/400)); +} + +static inline int day_from_month(int month, int in_leap_year) +{ + switch(month) + { + case 0: + return 0; + case 1: + return 31; + case 2: + return 59+in_leap_year; + case 3: + return 90+in_leap_year; + case 4: + return 120+in_leap_year; + case 5: + return 151+in_leap_year; + case 6: + return 181+in_leap_year; + case 7: + return 212+in_leap_year; + case 8: + return 243+in_leap_year; + case 9: + return 273+in_leap_year; + case 10: + return 304+in_leap_year; + default: + return 334+in_leap_year; + } } /* ECMA-262 3th Edition 15.9.1.3 */ @@ -221,6 +253,74 @@ static inline DOUBLE week_day(DOUBLE time) return ret; } +static inline DOUBLE convert_time(int year, SYSTEMTIME st) +{ + DOUBLE time; + int set_week_day; + + if(st.wMonth == 0) + return ret_nan(); + + if(st.wYear != 0) + year = st.wYear; + + time = time_from_year(year); + time += (DOUBLE)day_from_month(st.wMonth-1, in_leap_year(time)) * MS_PER_DAY; + + if(st.wYear == 0) { + set_week_day = st.wDayOfWeek-week_day(time); + if(set_week_day < 0) + set_week_day += 7; + time += set_week_day * MS_PER_DAY; + + time += (DOUBLE)(st.wDay-1) * 7 * MS_PER_DAY; + if(month_from_time(time) != st.wMonth-1) + time -= 7 * MS_PER_DAY; + } + else + time += st.wDay * MS_PER_DAY; + + time += st.wHour * MS_PER_HOUR; + time += st.wMinute * MS_PER_MINUTE; + + return time; +} + +/* ECMA-262 3rd Edition 15.9.1.9 */ +static inline DOUBLE daylight_saving_ta(DOUBLE time, DateInstance *date) +{ + int year = year_from_time(time); + DOUBLE standardTime, daylightTime; + + if(isnan(time)) + return 0; + + standardTime = convert_time(year, date->standardDate); + daylightTime = convert_time(year, date->daylightDate); + + if(isnan(standardTime) || isnan(daylightTime)) + return 0; + else if(standardTime > daylightTime) { + if(daylightTime <= time && time < standardTime) + return date->daylightBias; + + return date->standardBias; + } + else { + if(standardTime <= time && time < daylightTime) + return date->standardBias; + + return date->daylightBias; + } +} + +/* ECMA-262 3rd Edition 15.9.1.9 */ +static inline DOUBLE utc(DOUBLE time, DateInstance *date) +{ + time += date->bias * MS_PER_MINUTE; + return time + daylight_saving_ta(time, date)*MS_PER_MINUTE; +} + /* ECMA-262 3th Edition 15.9.1.10 */ static inline DOUBLE hour_from_time(DOUBLE time) { @@ -277,6 +377,36 @@ static inline DOUBLE ms_from_time(DOUBLE time) return ret; } +/* ECMA-262 3rd Edition 15.9.1.11 */ +static inline DOUBLE make_time(DOUBLE hour, DOUBLE min, DOUBLE sec, DOUBLE ms) +{ + return hour*MS_PER_HOUR + min*MS_PER_MINUTE + sec*1000 + ms; +} + +/* ECMA-262 3rd Edition 15.9.1.12 */ +static inline DOUBLE make_day(DOUBLE year, DOUBLE month, DOUBLE day) +{ + DOUBLE time; + + year += floor(month/12); + + month = fmod(month, 12); + if(month<0) month += 12; + + time = time_from_year(year); + + day += floor(time / MS_PER_DAY); + day += day_from_month(month, in_leap_year(time)); + + return day-1; +} + +/* ECMA-262 3rd Edition 15.9.1.13 */ +static inline DOUBLE make_date(DOUBLE day, DOUBLE time) +{ + return day*MS_PER_DAY + time; +} + /* ECMA-262 3rd Edition 15.9.1.14 */ static inline DOUBLE time_clip(DOUBLE time) { @@ -1022,8 +1152,9 @@ static HRESULT create_date(script_ctx_t *ctx, BOOL use_constr, DOUBLE time, Disp DateInstance *date; HRESULT hres; TIME_ZONE_INFORMATION tzi; + DWORD dret; - GetTimeZoneInformation(&tzi); + dret = GetTimeZoneInformation(&tzi); date = heap_alloc_zero(sizeof(DateInstance)); if(!date) @@ -1040,6 +1171,10 @@ static HRESULT create_date(script_ctx_t *ctx, BOOL use_constr, DOUBLE time, Disp date->time = time; date->bias = tzi.Bias; + date->standardDate = tzi.StandardDate; + date->standardBias = tzi.StandardBias; + date->daylightDate = tzi.DaylightDate; + date->daylightBias = tzi.DaylightBias; *ret = &date->dispex; return S_OK; @@ -1095,9 +1230,84 @@ static HRESULT DateConstr_value(DispatchEx *dispex, LCID lcid, WORD flags, DISPP break; } - default: - FIXME("unimplemented argcnt %d\n", arg_cnt(dp)); - return E_NOTIMPL; + /* ECMA-262 3rd Edition 15.9.3.1 */ + default: { + VARIANT year, month, vdate, hours, minutes, seconds, ms; + DateInstance *di; + int arg_no = arg_cnt(dp), y; + + hres = to_number(dispex->ctx, get_arg(dp, 0), ei, &year); + if(FAILED(hres)) + return hres; + y = num_val(&year); + if(0<=y && y<=99) + y += 1900; + + + hres = to_number(dispex->ctx, get_arg(dp, 1), ei, &month); + if(FAILED(hres)) + return hres; + + if(arg_no>2) { + hres = to_number(dispex->ctx, get_arg(dp, 2), ei, &vdate); + if(FAILED(hres)) + return hres; + } + else { + V_VT(&vdate) = VT_R8; + V_R8(&vdate) = 1; + } + + if(arg_no>3) { + hres = to_number(dispex->ctx, get_arg(dp, 3), ei, &hours); + if(FAILED(hres)) + return hres; + } + else { + V_VT(&hours) = VT_R8; + V_R8(&hours) = 0; + } + + if(arg_no>4) { + hres = to_number(dispex->ctx, get_arg(dp, 4), ei, &minutes); + if(FAILED(hres)) + return hres; + } + else { + V_VT(&minutes) = VT_R8; + V_R8(&minutes) = 0; + } + + if(arg_no>5) { + hres = to_number(dispex->ctx, get_arg(dp, 5), ei, &seconds); + if(FAILED(hres)) + return hres; + } + else { + V_VT(&seconds) = VT_R8; + V_R8(&seconds) = 0; + } + + if(arg_no>6) { + hres = to_number(dispex->ctx, get_arg(dp, 6), ei, &ms); + if(FAILED(hres)) + return hres; + } + else { + V_VT(&ms) = VT_R8; + V_R8(&ms) = 0; + } + + hres = create_date(dispex->ctx, TRUE, time_clip( + make_date(make_day(y, num_val(&month), num_val(&vdate)), + make_time(num_val(&hours), num_val(&minutes), + num_val(&seconds), num_val(&ms)))), &date); + if(FAILED(hres)) + return hres; + + di = (DateInstance*)date; + di->time = utc(di->time, di); + } } V_VT(retv) = VT_DISPATCH;
1
0
0
0
Jacek Caban : mshtml: Fixed tests on IE8 and change Wine behavior to IE8.
by Alexandre Julliard
23 Jun '09
23 Jun '09
Module: wine Branch: master Commit: 51f13ac14451f4adfb92dda966e9631c688abd8d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=51f13ac14451f4adfb92dda96…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Jun 22 19:25:58 2009 +0200 mshtml: Fixed tests on IE8 and change Wine behavior to IE8. --- dlls/mshtml/dispex.c | 2 ++ dlls/mshtml/htmllocation.c | 2 +- dlls/mshtml/mshtml_private.h | 2 ++ dlls/mshtml/omnavigator.c | 2 +- dlls/mshtml/tests/dom.c | 36 ++++++++++++++++++++++++++++++------ 5 files changed, 36 insertions(+), 8 deletions(-) diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 0d0422c..3dd11b1 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -77,6 +77,8 @@ static REFIID tid_ids[] = { &DIID_DispHTMLIFrame, &DIID_DispHTMLImg, &DIID_DispHTMLInputElement, + &DIID_DispHTMLLocation, + &DIID_DispHTMLNavigator, &DIID_DispHTMLOptionElement, &DIID_DispHTMLSelectElement, &DIID_DispHTMLStyle, diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c index c671073..35f042a 100644 --- a/dlls/mshtml/htmllocation.c +++ b/dlls/mshtml/htmllocation.c @@ -293,7 +293,7 @@ static const tid_t HTMLLocation_iface_tids[] = { }; static dispex_static_data_t HTMLLocation_dispex = { NULL, - IHTMLLocation_tid, + DispHTMLLocation_tid, NULL, HTMLLocation_iface_tids }; diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index ebb63bb..6ab70f2 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -74,6 +74,8 @@ typedef enum { DispHTMLIFrame_tid, DispHTMLImg_tid, DispHTMLInputElement_tid, + DispHTMLLocation_tid, + DispHTMLNavigator_tid, DispHTMLOptionElement_tid, DispHTMLSelectElement_tid, DispHTMLStyle_tid, diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index a3eed8b..e86537f 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -329,7 +329,7 @@ static const tid_t OmNavigator_iface_tids[] = { }; static dispex_static_data_t OmNavigator_dispex = { NULL, - IOmNavigator_tid, + DispHTMLNavigator_tid, NULL, OmNavigator_iface_tids }; diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 92b379b..cb25926 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -438,18 +438,19 @@ static void _test_ifaces(unsigned line, IUnknown *iface, REFIID *iids) } } -#define test_disp(u,id) _test_disp(__LINE__,u,id) -static void _test_disp(unsigned line, IUnknown *unk, const IID *diid) +#define test_get_dispid(u,id) _test_disp(__LINE__,u,id) +static BOOL _test_get_dispid(unsigned line, IUnknown *unk, IID *iid) { IDispatchEx *dispex; ITypeInfo *typeinfo; + BOOL ret = FALSE; UINT ticnt; HRESULT hres; hres = IUnknown_QueryInterface(unk, &IID_IDispatchEx, (void**)&dispex); ok_(__FILE__,line) (hres == S_OK, "Could not get IDispatch: %08x\n", hres); if(FAILED(hres)) - return; + return FALSE; ticnt = 0xdeadbeef; hres = IDispatchEx_GetTypeInfoCount(dispex, &ticnt); @@ -464,13 +465,36 @@ static void _test_disp(unsigned line, IUnknown *unk, const IID *diid) hres = ITypeInfo_GetTypeAttr(typeinfo, &type_attr); ok_(__FILE__,line) (hres == S_OK, "GetTypeAttr failed: %08x\n", hres); - ok_(__FILE__,line) (IsEqualGUID(&type_attr->guid, diid), "unexpected guid %s\n", dbgstr_guid(&type_attr->guid)); + if(hres == S_OK) { + *iid = type_attr->guid; + ret = TRUE; + } ITypeInfo_ReleaseTypeAttr(typeinfo, type_attr); ITypeInfo_Release(typeinfo); } IDispatchEx_Release(dispex); + return ret; +} + +#define test_disp(u,id) _test_disp(__LINE__,u,id) +static void _test_disp(unsigned line, IUnknown *unk, const IID *diid) +{ + IID iid; + + if(_test_get_dispid(line, unk, &iid)) + ok_(__FILE__,line) (IsEqualGUID(&iid, diid), "unexpected guid %s\n", dbgstr_guid(&iid)); +} + +#define test_disp2(u,id,id2) _test_disp2(__LINE__,u,id,id2) +static void _test_disp2(unsigned line, IUnknown *unk, const IID *diid, const IID *diid2) +{ + IID iid; + + if(_test_get_dispid(line, unk, &iid)) + ok_(__FILE__,line) (IsEqualGUID(&iid, diid) || broken(IsEqualGUID(&iid, diid2)), + "unexpected guid %s\n", dbgstr_guid(&iid)); } #define get_elem_iface(u) _get_elem_iface(__LINE__,u) @@ -2366,7 +2390,7 @@ static void test_location(IHTMLDocument2 *doc) IHTMLLocation_Release(location2); test_ifaces((IUnknown*)location, location_iids); - test_disp((IUnknown*)location, &IID_IHTMLLocation); + test_disp2((IUnknown*)location, &DIID_DispHTMLLocation, &IID_IHTMLLocation); ref = IHTMLLocation_Release(location); ok(!ref, "location chould be destroyed here\n"); @@ -2388,7 +2412,7 @@ static void test_navigator(IHTMLDocument2 *doc) hres = IHTMLWindow2_get_navigator(window, &navigator); ok(hres == S_OK, "get_navigator failed: %08x\n", hres); ok(navigator != NULL, "navigator == NULL\n"); - test_disp((IUnknown*)navigator, &IID_IOmNavigator); + test_disp2((IUnknown*)navigator, &DIID_DispHTMLNavigator, &IID_IOmNavigator); hres = IHTMLWindow2_get_navigator(window, &navigator2); ok(hres == S_OK, "get_navigator failed: %08x\n", hres);
1
0
0
0
Jacek Caban : mshtml.idl: Added DispHTMLLocation and DispHTMLNavigation dispinterfaces.
by Alexandre Julliard
23 Jun '09
23 Jun '09
Module: wine Branch: master Commit: 6f5591f3b2f225fe8599b5baf3c27e7fd834bfa8 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6f5591f3b2f225fe8599b5baf…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon Jun 22 18:27:57 2009 +0200 mshtml.idl: Added DispHTMLLocation and DispHTMLNavigation dispinterfaces. --- include/mshtmdid.h | 7 ++ include/mshtml.idl | 156 +++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 161 insertions(+), 2 deletions(-) diff --git a/include/mshtmdid.h b/include/mshtmdid.h index 8f882f8..980fbdd 100644 --- a/include/mshtmdid.h +++ b/include/mshtmdid.h @@ -1315,6 +1315,13 @@ #define DISPID_IHTMLDATABINDING_DATASRC DISPID_ELEMENT+22 #define DISPID_IHTMLDATABINDING_DATAFORMATAS DISPID_ELEMENT+23 +/* IHTMLDOMConstructor */ +#define DISPID_IHTMLDOMCONSTRUCTOR_CONSTRUCTOR DISPID_HTMLOBJECT+9 +#define DISPID_IHTMLDOMCONSTRUCTOR_LOOKUPGETTER +#define DISPID_IHTMLDOMCONSTRUCTOR_LOOKUPSETTER +#define DISPID_IHTMLDOMCONSTRUCTOR_DEFINEGETTER +#define DISPID_IHTMLDOMCONSTRUCTOR_DEFINESETTER + /* IHTMLStyle */ #define DISPID_IHTMLSTYLE_PIXELTOP DISPID_STYLE #define DISPID_IHTMLSTYLE_PIXELLEFT (DISPID_STYLE+1) diff --git a/include/mshtml.idl b/include/mshtml.idl index c8537fc..e219005 100644 --- a/include/mshtml.idl +++ b/include/mshtml.idl @@ -13017,13 +13017,89 @@ interface IOmNavigator : IDispatch HRESULT userProfile([retval, out] IHTMLOpsProfile **p); } +/***************************************************************************** + * DispHTMLNavigator dispinterface + */ +[ + hidden, + uuid(3050f54c-98b5-11cf-bb82-00aa00bdce0b) +] +dispinterface DispHTMLNavigator +{ +properties: +methods: + [propget, id(DISPID_IOMNAVIGATOR_APPCODENAME)] + BSTR appCodeName(); + + [propget, id(DISPID_IOMNAVIGATOR_APPNAME)] + BSTR appName(); + + [propget, id(DISPID_IOMNAVIGATOR_APPVERSION)] + BSTR appVersion(); + + [propget, id(DISPID_IOMNAVIGATOR_USERAGENT)] + BSTR userAgent(); + + [id(DISPID_IOMNAVIGATOR_JAVAENABLED)] + VARIANT_BOOL javaEnabled(); + + [id(DISPID_IOMNAVIGATOR_TAINTENABLED)] + VARIANT_BOOL taintEnabled(); + + [propget, id(DISPID_IOMNAVIGATOR_MIMETYPES)] + IHTMLMimeTypesCollection *mimeTypes(); + + [propget, id(DISPID_IOMNAVIGATOR_PLUGINS)] + IHTMLPluginsCollection *plugins(); + + [propget, id(DISPID_IOMNAVIGATOR_COOKIEENABLED)] + VARIANT_BOOL cookieEnabled(); + + [propget, id(DISPID_IOMNAVIGATOR_OPSPROFILE)] + IHTMLOpsProfile *opsProfile(); + + [id(DISPID_IOMNAVIGATOR_TOSTRING)] + BSTR toString(); + + [propget, id(DISPID_IOMNAVIGATOR_CPUCLASS)] + BSTR cpuClass(); + + [propget, id(DISPID_IOMNAVIGATOR_SYSTEMLANGUAGE)] + BSTR systemLanguage(); + + [propget, id(DISPID_IOMNAVIGATOR_BROWSERLANGUAGE), hidden] + BSTR browserLanguage(); + + [propget, id(DISPID_IOMNAVIGATOR_USERLANGUAGE)] + BSTR userLanguage(); + + [propget, id(DISPID_IOMNAVIGATOR_PLATFORM)] + BSTR platform(); + + [propget, id(DISPID_IOMNAVIGATOR_APPMINORVERSION)] + BSTR appMinorVersion(); + + [propget, id(DISPID_IOMNAVIGATOR_CONNECTIONSPEED), hidden] + LONG connectionSpeed(); + + [propget, id(DISPID_IOMNAVIGATOR_ONLINE)] + VARIANT_BOOL onLine(); + + [propget, id(DISPID_IOMNAVIGATOR_USERPROFILE)] + IHTMLOpsProfile *userProfile(); + + [propget, id(DISPID_IHTMLDOMCONSTRUCTOR_CONSTRUCTOR), hidden] + IDispatch *constructor(); +} + [ noncreatable, uuid(FECEAAA6-8405-11cf-8BA1-00AA00476DA6) ] coclass HTMLNavigator { - [default] interface IOmNavigator; + [default] dispinterface DispHTMLNavigator; + interface IOmNavigator; } /***************************************************************************** @@ -13098,13 +13174,89 @@ interface IHTMLLocation : IDispatch HRESULT toString([retval, out] BSTR *String); } +/***************************************************************************** + * DispHTMLLocation dispinterface + */ +[ + hidden, + uuid(3050f54e-98b5-11cf-bb82-00aa00bdce0b) +] +dispinterface DispHTMLLocation +{ +properties: +methods: + [propput, id(DISPID_IHTMLLOCATION_HREF)] + void href(BSTR v); + + [propget, id(DISPID_IHTMLLOCATION_HREF)] + BSTR href(); + + [propput, id(DISPID_IHTMLLOCATION_PROTOCOL)] + void protocol(BSTR v); + + [propget, id(DISPID_IHTMLLOCATION_PROTOCOL)] + BSTR protocol(); + + [propput, id(DISPID_IHTMLLOCATION_HOST)] + void host(BSTR v); + + [propget, id(DISPID_IHTMLLOCATION_HOST)] + BSTR host(); + + [propput, id(DISPID_IHTMLLOCATION_HOSTNAME)] + void hostname(BSTR v); + + [propget, id(DISPID_IHTMLLOCATION_HOSTNAME)] + BSTR hostname(); + + [propput, id(DISPID_IHTMLLOCATION_PORT)] + void port(BSTR v); + + [propget, id(DISPID_IHTMLLOCATION_PORT)] + BSTR port(); + + [propput, id(DISPID_IHTMLLOCATION_PATHNAME)] + void pathname(BSTR v); + + [propget, id(DISPID_IHTMLLOCATION_PATHNAME)] + BSTR pathname(); + + [propput, id(DISPID_IHTMLLOCATION_SEARCH)] + void search(BSTR v); + + [propget, id(DISPID_IHTMLLOCATION_SEARCH)] + BSTR search(); + + [propput, id(DISPID_IHTMLLOCATION_HASH)] + void hash(BSTR v); + + [propget, id(DISPID_IHTMLLOCATION_HASH)] + BSTR hash(); + + [id(DISPID_IHTMLLOCATION_RELOAD)] + void reload([in, defaultvalue(0)] VARIANT_BOOL flag); + + [id(DISPID_IHTMLLOCATION_REPLACE)] + void replace([in] BSTR bstr); + + [id(DISPID_IHTMLLOCATION_ASSIGN)] + void assign([in] BSTR bstr); + + [id(DISPID_IHTMLLOCATION_TOSTRING)] + BSTR toString(); + + [propget, id(DISPID_IHTMLDOMCONSTRUCTOR_CONSTRUCTOR), hidden] + IDispatch *constructor(); +} + [ noncreatable, uuid(163BB1E1-6E00-11cf-837A-48DC04C10000) ] coclass HTMLLocation { - [default] interface IHTMLLocation; + [default] dispinterface DispHTMLLocation; + interface IHTMLLocation; } [
1
0
0
0
Hans Leidekker : ole32: Add tests for CoGetContextToken.
by Alexandre Julliard
23 Jun '09
23 Jun '09
Module: wine Branch: master Commit: 82bcafe8eb877e79689f7858ac0b526f8243bd06 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=82bcafe8eb877e79689f7858a…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Tue Jun 23 09:37:30 2009 +0200 ole32: Add tests for CoGetContextToken. --- dlls/ole32/tests/compobj.c | 73 +++++++++++++++++++++++++++++++++++++++++++- dlls/ole32/tests/marshal.c | 2 +- dlls/ole32/tests/moniker.c | 1 + 3 files changed, 74 insertions(+), 2 deletions(-) diff --git a/dlls/ole32/tests/compobj.c b/dlls/ole32/tests/compobj.c index d9d684d..ff2462f 100644 --- a/dlls/ole32/tests/compobj.c +++ b/dlls/ole32/tests/compobj.c @@ -25,11 +25,12 @@ #include "windef.h" #include "winbase.h" +#define USE_COM_CONTEXT_DEF +#include "initguid.h" #include "objbase.h" #include "shlguid.h" #include "urlmon.h" /* for CLSID_FileProtocol */ -#include "initguid.h" #include "ctxtcall.h" #include "wine/test.h" @@ -39,6 +40,7 @@ HRESULT (WINAPI * pCoInitializeEx)(LPVOID lpReserved, DWORD dwCoInit); HRESULT (WINAPI * pCoGetObjectContext)(REFIID riid, LPVOID *ppv); HRESULT (WINAPI * pCoSwitchCallContext)(IUnknown *pObject, IUnknown **ppOldObject); HRESULT (WINAPI * pCoGetTreatAsClass)(REFCLSID clsidOld, LPCLSID pClsidNew); +HRESULT (WINAPI * pCoGetContextToken)(ULONG_PTR *token); #define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x\n", hr) #define ok_more_than_one_lock() ok(cLocks > 0, "Number of locks should be > 0, but actually is %d\n", cLocks) @@ -1077,6 +1079,7 @@ static void test_CoGetObjectContext(void) ULONG refs; IComThreadingInfo *pComThreadingInfo; IContextCallback *pContextCallback; + IObjContext *pObjContext; APTTYPE apttype; THDTYPE thdtype; @@ -1142,6 +1145,12 @@ static void test_CoGetObjectContext(void) ok(refs == 0, "pContextCallback should have 0 refs instead of %d refs\n", refs); } + hr = pCoGetObjectContext(&IID_IObjContext, (void **)&pObjContext); + ok_ole_success(hr, "CoGetObjectContext"); + + refs = IObjContext_Release(pObjContext); + ok(refs == 0, "pObjContext should have 0 refs instead of %d refs\n", refs); + CoUninitialize(); } @@ -1245,6 +1254,66 @@ static void test_CoGetCallContext(void) CoUninitialize(); } +static void test_CoGetContextToken(void) +{ + HRESULT hr; + ULONG refs; + ULONG_PTR token; + IObjContext *ctx; + + if (!pCoGetContextToken) + { + win_skip("CoGetContextToken not present\n"); + return; + } + + token = 0xdeadbeef; + hr = pCoGetContextToken(&token); + ok(hr == CO_E_NOTINITIALIZED, "Expected CO_E_NOTINITIALIZED, got 0x%08x\n", hr); + ok(token == 0xdeadbeef, "Expected 0, got 0x%lx\n", token); + + CoInitialize(NULL); + + hr = pCoGetContextToken(NULL); + ok(hr == E_POINTER, "Expected E_POINTER, got 0x%08x\n", hr); + + token = 0; + hr = pCoGetContextToken(&token); + ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr); + ok(token, "Expected token != 0\n"); + + refs = IUnknown_AddRef((IUnknown *)token); + todo_wine ok(refs == 1, "Expected 1, got %u\n", refs); + + refs = IUnknown_Release((IUnknown *)token); + todo_wine ok(refs == 0, "Expected 0, got %u\n", refs); + + hr = pCoGetObjectContext(&IID_IObjContext, (void **)&ctx); + ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr); + todo_wine ok(ctx == (IObjContext *)token, "Expected interface pointers to be the same\n"); + + refs = IUnknown_AddRef((IUnknown *)ctx); + ok(refs == 2, "Expected 1, got %u\n", refs); + + refs = IUnknown_Release((IUnknown *)ctx); + ok(refs == 1, "Expected 0, got %u\n", refs); + + /* CoGetContextToken does not add a reference */ + token = 0; + hr = pCoGetContextToken(&token); + ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr); + ok(token, "Expected token != 0\n"); + todo_wine ok(ctx == (IObjContext *)token, "Expected interface pointers to be the same\n"); + + refs = IUnknown_AddRef((IUnknown *)ctx); + ok(refs == 2, "Expected 1, got %u\n", refs); + + refs = IUnknown_Release((IUnknown *)ctx); + ok(refs == 1, "Expected 0, got %u\n", refs); + + CoUninitialize(); +} + static void test_CoGetTreatAsClass(void) { HRESULT hr; @@ -1288,6 +1357,7 @@ START_TEST(compobj) pCoGetObjectContext = (void*)GetProcAddress(hOle32, "CoGetObjectContext"); pCoSwitchCallContext = (void*)GetProcAddress(hOle32, "CoSwitchCallContext"); pCoGetTreatAsClass = (void*)GetProcAddress(hOle32,"CoGetTreatAsClass"); + pCoGetContextToken = (void*)GetProcAddress(hOle32, "CoGetContextToken"); if (!(pCoInitializeEx = (void*)GetProcAddress(hOle32, "CoInitializeEx"))) { trace("You need DCOM95 installed to run this test\n"); @@ -1313,6 +1383,7 @@ START_TEST(compobj) test_CoFreeUnusedLibraries(); test_CoGetObjectContext(); test_CoGetCallContext(); + test_CoGetContextToken(); test_CoGetTreatAsClass(); test_CoInitializeEx(); } diff --git a/dlls/ole32/tests/marshal.c b/dlls/ole32/tests/marshal.c index 4082488..dacb7b6 100644 --- a/dlls/ole32/tests/marshal.c +++ b/dlls/ole32/tests/marshal.c @@ -27,11 +27,11 @@ #include "windef.h" #include "winbase.h" -#include "initguid.h" #include "objbase.h" #include "olectl.h" #include "shlguid.h" #include "shobjidl.h" +#include "initguid.h" #include "wine/test.h" diff --git a/dlls/ole32/tests/moniker.c b/dlls/ole32/tests/moniker.c index 413045a..5d3f6f5 100644 --- a/dlls/ole32/tests/moniker.c +++ b/dlls/ole32/tests/moniker.c @@ -28,6 +28,7 @@ #include "windef.h" #include "winbase.h" #include "objbase.h" +#include "initguid.h" #include "comcat.h" #include "olectl.h"
1
0
0
0
Hans Leidekker : ole32: Implement CoGetContextToken.
by Alexandre Julliard
23 Jun '09
23 Jun '09
Module: wine Branch: master Commit: b9be3970245b25814a639a4721846b5548503720 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b9be3970245b25814a639a472…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Tue Jun 23 15:25:56 2009 +0200 ole32: Implement CoGetContextToken. --- dlls/ole32/compobj.c | 153 ++++++++++++++++++++++++++++++++++++++++-- dlls/ole32/compobj_private.h | 2 +- 2 files changed, 149 insertions(+), 6 deletions(-) diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index 586a930..739c86d 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c @@ -52,6 +52,7 @@ #include "winerror.h" #include "winreg.h" #include "winuser.h" +#define USE_COM_CONTEXT_DEF #include "objbase.h" #include "ole2.h" #include "ole2ver.h" @@ -228,6 +229,7 @@ static void COM_TlsDestroy(void) if (info->errorinfo) IErrorInfo_Release(info->errorinfo); if (info->state) IUnknown_Release(info->state); if (info->spy) IUnknown_Release(info->spy); + if (info->context_token) IObjContext_Release(info->context_token); HeapFree(GetProcessHeap(), 0, info); NtCurrentTeb()->ReservedForOle = NULL; } @@ -3748,6 +3750,7 @@ typedef struct Context { const IComThreadingInfoVtbl *lpVtbl; const IContextCallbackVtbl *lpCallbackVtbl; + const IObjContextVtbl *lpContextVtbl; LONG refs; APTTYPE apttype; } Context; @@ -3762,6 +3765,11 @@ static inline Context *impl_from_IContextCallback( IContextCallback *iface ) return (Context *)((char*)iface - FIELD_OFFSET(Context, lpCallbackVtbl)); } +static inline Context *impl_from_IObjContext( IObjContext *iface ) +{ + return (Context *)((char*)iface - FIELD_OFFSET(Context, lpContextVtbl)); +} + static HRESULT Context_QueryInterface(Context *iface, REFIID riid, LPVOID *ppv) { *ppv = NULL; @@ -3770,10 +3778,15 @@ static HRESULT Context_QueryInterface(Context *iface, REFIID riid, LPVOID *ppv) IsEqualIID(riid, &IID_IUnknown)) { *ppv = &iface->lpVtbl; - } else if (IsEqualIID(riid, &IID_IContextCallback)) + } + else if (IsEqualIID(riid, &IID_IContextCallback)) { *ppv = &iface->lpCallbackVtbl; } + else if (IsEqualIID(riid, &IID_IObjContext)) + { + *ppv = &iface->lpContextVtbl; + } if (*ppv) { @@ -3903,6 +3916,115 @@ static const IContextCallbackVtbl Context_Callback_Vtbl = Context_CC_ContextCallback }; +static HRESULT WINAPI Context_OC_QueryInterface(IObjContext *iface, REFIID riid, LPVOID *ppv) +{ + Context *This = impl_from_IObjContext(iface); + return Context_QueryInterface(This, riid, ppv); +} + +static ULONG WINAPI Context_OC_AddRef(IObjContext *iface) +{ + Context *This = impl_from_IObjContext(iface); + return Context_AddRef(This); +} + +static ULONG WINAPI Context_OC_Release(IObjContext *iface) +{ + Context *This = impl_from_IObjContext(iface); + return Context_Release(This); +} + +static HRESULT WINAPI Context_OC_SetProperty(IObjContext *iface, REFGUID propid, CPFLAGS flags, IUnknown *punk) +{ + Context *This = impl_from_IObjContext(iface); + + FIXME("(%p/%p)->(%s, %x, %p)\n", This, iface, debugstr_guid(propid), flags, punk); + return E_NOTIMPL; +} + +static HRESULT WINAPI Context_OC_RemoveProperty(IObjContext *iface, REFGUID propid) +{ + Context *This = impl_from_IObjContext(iface); + + FIXME("(%p/%p)->(%s)\n", This, iface, debugstr_guid(propid)); + return E_NOTIMPL; +} + +static HRESULT WINAPI Context_OC_GetProperty(IObjContext *iface, REFGUID propid, CPFLAGS *flags, IUnknown **punk) +{ + Context *This = impl_from_IObjContext(iface); + + FIXME("(%p/%p)->(%s, %p, %p)\n", This, iface, debugstr_guid(propid), flags, punk); + return E_NOTIMPL; +} + +static HRESULT WINAPI Context_OC_EnumContextProps(IObjContext *iface, IEnumContextProps **props) +{ + Context *This = impl_from_IObjContext(iface); + + FIXME("(%p/%p)->(%p)\n", This, iface, props); + return E_NOTIMPL; +} + +static void WINAPI Context_OC_Reserved1(IObjContext *iface) +{ + Context *This = impl_from_IObjContext(iface); + FIXME("(%p/%p)\n", This, iface); +} + +static void WINAPI Context_OC_Reserved2(IObjContext *iface) +{ + Context *This = impl_from_IObjContext(iface); + FIXME("(%p/%p)\n", This, iface); +} + +static void WINAPI Context_OC_Reserved3(IObjContext *iface) +{ + Context *This = impl_from_IObjContext(iface); + FIXME("(%p/%p)\n", This, iface); +} + +static void WINAPI Context_OC_Reserved4(IObjContext *iface) +{ + Context *This = impl_from_IObjContext(iface); + FIXME("(%p/%p)\n", This, iface); +} + +static void WINAPI Context_OC_Reserved5(IObjContext *iface) +{ + Context *This = impl_from_IObjContext(iface); + FIXME("(%p/%p)\n", This, iface); +} + +static void WINAPI Context_OC_Reserved6(IObjContext *iface) +{ + Context *This = impl_from_IObjContext(iface); + FIXME("(%p/%p)\n", This, iface); +} + +static void WINAPI Context_OC_Reserved7(IObjContext *iface) +{ + Context *This = impl_from_IObjContext(iface); + FIXME("(%p/%p)\n", This, iface); +} + +static const IObjContextVtbl Context_Object_Vtbl = +{ + Context_OC_QueryInterface, + Context_OC_AddRef, + Context_OC_Release, + Context_OC_SetProperty, + Context_OC_RemoveProperty, + Context_OC_GetProperty, + Context_OC_EnumContextProps, + Context_OC_Reserved1, + Context_OC_Reserved2, + Context_OC_Reserved3, + Context_OC_Reserved4, + Context_OC_Reserved5, + Context_OC_Reserved6, + Context_OC_Reserved7 +}; /*********************************************************************** * CoGetObjectContext [OLE32.@] @@ -3938,6 +4060,7 @@ HRESULT WINAPI CoGetObjectContext(REFIID riid, void **ppv) context->lpVtbl = &Context_Threading_Vtbl; context->lpCallbackVtbl = &Context_Callback_Vtbl; + context->lpContextVtbl = &Context_Object_Vtbl; context->refs = 1; if (apt->multi_threaded) context->apttype = APTTYPE_MTA; @@ -3959,12 +4082,32 @@ HRESULT WINAPI CoGetObjectContext(REFIID riid, void **ppv) HRESULT WINAPI CoGetContextToken( ULONG_PTR *token ) { struct oletls *info = COM_CurrentInfo(); - static int calls; - if(!(calls++)) FIXME( "stub\n" ); + + TRACE("(%p)\n", token); + if (!info) return E_OUTOFMEMORY; - if (token) *token = info->context_token; - return E_NOTIMPL; + + if (!info->apt) + return CO_E_NOTINITIALIZED; + + if (!token) + return E_POINTER; + + if (!info->context_token) + { + HRESULT hr; + IObjContext *ctx; + + hr = CoGetObjectContext(&IID_IObjContext, (void **)&ctx); + if (FAILED(hr)) return hr; + info->context_token = ctx; + } + + *token = (ULONG_PTR)info->context_token; + TRACE("apt->context_token=%p\n", info->context_token); + + return S_OK; } diff --git a/dlls/ole32/compobj_private.h b/dlls/ole32/compobj_private.h index 43e6e25..58e3856 100644 --- a/dlls/ole32/compobj_private.h +++ b/dlls/ole32/compobj_private.h @@ -183,7 +183,7 @@ struct oletls LONG pending_call_count_client; /* number of client calls pending */ LONG pending_call_count_server; /* number of server calls pending */ DWORD unknown; - ULONG_PTR context_token; /* (+38h on x86) */ + IObjContext *context_token; /* (+38h on x86) */ IUnknown *call_state; /* current call context (+3Ch on x86) */ DWORD unknown2[46]; IUnknown *cancel_object; /* cancel object set by CoSetCancelObject (+F8h on x86) */
1
0
0
0
Hans Leidekker : include: Add definition of IObjContext.
by Alexandre Julliard
23 Jun '09
23 Jun '09
Module: wine Branch: master Commit: ceee7415f58d52060ab25527c8ed1d492c838cc3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ceee7415f58d52060ab25527c…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Tue Jun 23 09:36:49 2009 +0200 include: Add definition of IObjContext. --- dlls/uuid/uuid.c | 1 + include/objidl.idl | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 0 deletions(-) diff --git a/dlls/uuid/uuid.c b/dlls/uuid/uuid.c index 840a346..18b4d55 100644 --- a/dlls/uuid/uuid.c +++ b/dlls/uuid/uuid.c @@ -32,6 +32,7 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); #include "wingdi.h" #include "winuser.h" +#define USE_COM_CONTEXT_DEF #include "objbase.h" #include "servprov.h" diff --git a/include/objidl.idl b/include/objidl.idl index 29b907d..2aa6065 100644 --- a/include/objidl.idl +++ b/include/objidl.idl @@ -2454,4 +2454,21 @@ interface IContext : IUnknown [out] IEnumContextProps **ppEnumContextProps); } +[ + local, + object, + uuid(000001c6-0000-0000-c000-000000000046), + pointer_default(unique) +] +interface IObjContext : IContext +{ + void Reserved1(); + void Reserved2(); + void Reserved3(); + void Reserved4(); + void Reserved5(); + void Reserved6(); + void Reserved7(); +} + cpp_quote("#endif /* defined USE_COM_CONTEXT_DEF */")
1
0
0
0
Hans Leidekker : crypt32: Add a partial implementation of CertCreateContext .
by Alexandre Julliard
23 Jun '09
23 Jun '09
Module: wine Branch: master Commit: 764b9bef196608f21a0a56e1f46b47beea2c0c62 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=764b9bef196608f21a0a56e1f…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Tue Jun 23 09:36:26 2009 +0200 crypt32: Add a partial implementation of CertCreateContext. --- dlls/crypt32/cert.c | 32 ++++++++++++++++++++++++++++++++ dlls/crypt32/crypt32.spec | 1 + 2 files changed, 33 insertions(+), 0 deletions(-) diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c index 2b43d3e..1c0c74e 100644 --- a/dlls/crypt32/cert.c +++ b/dlls/crypt32/cert.c @@ -2951,3 +2951,35 @@ BOOL WINAPI CertVerifyCTLUsage(DWORD dwEncodingType, DWORD dwSubjectType, SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; } + +const void * WINAPI CertCreateContext(DWORD dwContextType, DWORD dwEncodingType, + const BYTE *pbEncoded, DWORD cbEncoded, + DWORD dwFlags, PCERT_CREATE_CONTEXT_PARA pCreatePara) +{ + TRACE("(0x%x, 0x%x, %p, %d, 0x%08x, %p)\n", dwContextType, dwEncodingType, + pbEncoded, cbEncoded, dwFlags, pCreatePara); + + if (dwFlags) + { + FIXME("dwFlags 0x%08x not handled\n", dwFlags); + return NULL; + } + if (pCreatePara) + { + FIXME("pCreatePara not handled\n"); + return NULL; + } + + switch (dwContextType) + { + case CERT_STORE_CERTIFICATE_CONTEXT: + return CertCreateCertificateContext(dwEncodingType, pbEncoded, cbEncoded); + case CERT_STORE_CRL_CONTEXT: + return CertCreateCRLContext(dwEncodingType, pbEncoded, cbEncoded); + case CERT_STORE_CTL_CONTEXT: + return CertCreateCTLContext(dwEncodingType, pbEncoded, cbEncoded); + default: + WARN("unknown context type: 0x%x\n", dwContextType); + return NULL; + } +} diff --git a/dlls/crypt32/crypt32.spec b/dlls/crypt32/crypt32.spec index 3591d17..f271b62 100644 --- a/dlls/crypt32/crypt32.spec +++ b/dlls/crypt32/crypt32.spec @@ -20,6 +20,7 @@ @ stdcall CertCreateCTLContext(long ptr long) @ stdcall CertCreateCertificateChainEngine(ptr ptr) @ stdcall CertCreateCertificateContext(long ptr long) +@ stdcall CertCreateContext(long long ptr long long ptr) @ stdcall CertCreateSelfSignCertificate(long ptr long ptr ptr ptr ptr ptr) @ stdcall CertDeleteCRLFromStore(ptr) @ stdcall CertDeleteCTLFromStore(ptr)
1
0
0
0
← Newer
1
...
30
31
32
33
34
35
36
...
112
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
Results per page:
10
25
50
100
200