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
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
List overview
Download
Ros-diffs
February 2009
----- 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
ros-diffs@reactos.org
29 participants
559 discussions
Start a n
N
ew thread
[dchapyshev] 39767: - Update Russian translation
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Thu Feb 26 13:36:26 2009 New Revision: 39767 URL:
http://svn.reactos.org/svn/reactos?rev=39767&view=rev
Log: - Update Russian translation Modified: trunk/reactos/base/applications/sndvol32/lang/ru-RU.rc Modified: trunk/reactos/base/applications/sndvol32/lang/ru-RU.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/sndvol32…
============================================================================== --- trunk/reactos/base/applications/sndvol32/lang/ru-RU.rc [iso-8859-1] (original) +++ trunk/reactos/base/applications/sndvol32/lang/ru-RU.rc [iso-8859-1] Thu Feb 26 13:36:26 2009 @@ -33,7 +33,7 @@ LTEXT "&Ìèêøåð:", -1, 7,8,48,9 COMBOBOX IDC_MIXERDEVICE, 55,8,162,80, CBS_DROPDOWNLIST | WS_TABSTOP GROUPBOX "Íàñòðîéêè ãðîìêîñòè:", -1, 7,25,211,77 - PUSHBUTTON "&Âîñïðîèçâåäåíèå", IDC_PLAYBACK, 13,43,47,8, BS_AUTORADIOBUTTON + PUSHBUTTON "&Âîñïðîèçâåäåíèå", IDC_PLAYBACK, 13,43,80,8, BS_AUTORADIOBUTTON PUSHBUTTON "&Çàïèñü", IDC_RECORDING, 13,61,47,8, BS_AUTORADIOBUTTON PUSHBUTTON "&Äðóãîå:", IDC_OTHER, 13,80,42,8, BS_AUTORADIOBUTTON | WS_DISABLED COMBOBOX IDC_LINE, 55,80,155,50, CBS_DROPDOWNLIST | WS_TABSTOP | WS_DISABLED
15 years, 10 months
1
0
0
0
[dchapyshev] 39766: - Sync itss, mlang with Wine head
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Thu Feb 26 13:34:15 2009 New Revision: 39766 URL:
http://svn.reactos.org/svn/reactos?rev=39766&view=rev
Log: - Sync itss, mlang with Wine head Modified: trunk/reactos/dll/win32/itss/chm_lib.c trunk/reactos/dll/win32/itss/chm_lib.h trunk/reactos/dll/win32/itss/itss.c trunk/reactos/dll/win32/itss/lzx.c trunk/reactos/dll/win32/itss/moniker.c trunk/reactos/dll/win32/itss/protocol.c trunk/reactos/dll/win32/mlang/mlang.c trunk/reactos/dll/win32/mlang/mlang.spec trunk/reactos/include/psdk/mlang.idl Modified: trunk/reactos/dll/win32/itss/chm_lib.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/itss/chm_lib.c?r…
============================================================================== --- trunk/reactos/dll/win32/itss/chm_lib.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/itss/chm_lib.c [iso-8859-1] Thu Feb 26 13:34:15 2009 @@ -759,6 +759,10 @@ if (newHandle->index_root == -1) newHandle->index_root = newHandle->index_head; + /* initialize cache */ + chm_set_param(newHandle, CHM_PARAM_MAX_BLOCKS_CACHED, + CHM_MAX_BLOCKS_CACHED); + /* By default, compression is enabled. */ newHandle->compression_enabled = 1; @@ -821,10 +825,6 @@ ctlData.windowsPerReset; #endif } - - /* initialize cache */ - chm_set_param(newHandle, CHM_PARAM_MAX_BLOCKS_CACHED, - CHM_MAX_BLOCKS_CACHED); return newHandle; } @@ -1373,12 +1373,16 @@ } } -/* enumerate the objects in the .chm archive */ -int chm_enumerate(struct chmFile *h, - int what, - CHM_ENUMERATOR e, - void *context) -{ +int chm_enumerate_dir(struct chmFile *h, + const WCHAR *prefix, + int what, + CHM_ENUMERATOR e, + void *context) +{ + /* + * XXX: do this efficiently (i.e. using the tree index) + */ + Int32 curPage; /* buffer to hold whatever page we're looking at */ @@ -1387,14 +1391,38 @@ UChar *end; UChar *cur; unsigned int lenRemain; - UInt64 ui_path_len; + + /* set to 1 once we've started */ + int it_has_begun=0; /* the current ui */ struct chmUnitInfo ui; int flag; + UInt64 ui_path_len; + + /* the length of the prefix */ + WCHAR prefixRectified[CHM_MAX_PATHLEN+1]; + int prefixLen; + WCHAR lastPath[CHM_MAX_PATHLEN]; + int lastPathLen; /* starting page */ curPage = h->index_head; + + /* initialize pathname state */ + lstrcpynW(prefixRectified, prefix, CHM_MAX_PATHLEN); + prefixLen = strlenW(prefixRectified); + if (prefixLen != 0) + { + if (prefixRectified[prefixLen-1] != '/') + { + prefixRectified[prefixLen] = '/'; + prefixRectified[prefixLen+1] = '\0'; + ++prefixLen; + } + } + lastPath[0] = '\0'; + lastPathLen = -1; /* until we have either returned or given up */ while (curPage != -1) @@ -1428,6 +1456,37 @@ HeapFree(GetProcessHeap(), 0, page_buf); return 0; } + + /* check if we should start */ + if (! it_has_begun) + { + if (ui.length == 0 && strncmpiW(ui.path, prefixRectified, prefixLen) == 0) + it_has_begun = 1; + else + continue; + + if (ui.path[prefixLen] == '\0') + continue; + } + + /* check if we should stop */ + else + { + if (strncmpiW(ui.path, prefixRectified, prefixLen) != 0) + { + HeapFree(GetProcessHeap(), 0, page_buf); + return 1; + } + } + + /* check if we should include this path */ + if (lastPathLen != -1) + { + if (strncmpiW(ui.path, lastPath, lastPathLen) == 0) + continue; + } + strcpyW(lastPath, ui.path); + lastPathLen = strlenW(lastPath); /* get the length of the path */ ui_path_len = strlenW(ui.path)-1; @@ -1481,171 +1540,3 @@ HeapFree(GetProcessHeap(), 0, page_buf); return 1; } - -int chm_enumerate_dir(struct chmFile *h, - const WCHAR *prefix, - int what, - CHM_ENUMERATOR e, - void *context) -{ - /* - * XXX: do this efficiently (i.e. using the tree index) - */ - - Int32 curPage; - - /* buffer to hold whatever page we're looking at */ - UChar *page_buf = HeapAlloc(GetProcessHeap(), 0, h->block_len); - struct chmPmglHeader header; - UChar *end; - UChar *cur; - unsigned int lenRemain; - - /* set to 1 once we've started */ - int it_has_begun=0; - - /* the current ui */ - struct chmUnitInfo ui; - int flag; - UInt64 ui_path_len; - - /* the length of the prefix */ - WCHAR prefixRectified[CHM_MAX_PATHLEN+1]; - int prefixLen; - WCHAR lastPath[CHM_MAX_PATHLEN]; - int lastPathLen; - - /* starting page */ - curPage = h->index_head; - - /* initialize pathname state */ - lstrcpynW(prefixRectified, prefix, CHM_MAX_PATHLEN); - prefixLen = strlenW(prefixRectified); - if (prefixLen != 0) - { - if (prefixRectified[prefixLen-1] != '/') - { - prefixRectified[prefixLen] = '/'; - prefixRectified[prefixLen+1] = '\0'; - ++prefixLen; - } - } - lastPath[0] = '\0'; - lastPathLen = -1; - - /* until we have either returned or given up */ - while (curPage != -1) - { - - /* try to fetch the index page */ - if (_chm_fetch_bytes(h, - page_buf, - h->dir_offset + (UInt64)curPage*h->block_len, - h->block_len) != h->block_len) - { - HeapFree(GetProcessHeap(), 0, page_buf); - return 0; - } - - /* figure out start and end for this page */ - cur = page_buf; - lenRemain = _CHM_PMGL_LEN; - if (! _unmarshal_pmgl_header(&cur, &lenRemain, &header)) - { - HeapFree(GetProcessHeap(), 0, page_buf); - return 0; - } - end = page_buf + h->block_len - (header.free_space); - - /* loop over this page */ - while (cur < end) - { - if (! _chm_parse_PMGL_entry(&cur, &ui)) - { - HeapFree(GetProcessHeap(), 0, page_buf); - return 0; - } - - /* check if we should start */ - if (! it_has_begun) - { - if (ui.length == 0 && strncmpiW(ui.path, prefixRectified, prefixLen) == 0) - it_has_begun = 1; - else - continue; - - if (ui.path[prefixLen] == '\0') - continue; - } - - /* check if we should stop */ - else - { - if (strncmpiW(ui.path, prefixRectified, prefixLen) != 0) - { - HeapFree(GetProcessHeap(), 0, page_buf); - return 1; - } - } - - /* check if we should include this path */ - if (lastPathLen != -1) - { - if (strncmpiW(ui.path, lastPath, lastPathLen) == 0) - continue; - } - strcpyW(lastPath, ui.path); - lastPathLen = strlenW(lastPath); - - /* get the length of the path */ - ui_path_len = strlenW(ui.path)-1; - - /* check for DIRS */ - if (ui.path[ui_path_len] == '/' && !(what & CHM_ENUMERATE_DIRS)) - continue; - - /* check for FILES */ - if (ui.path[ui_path_len] != '/' && !(what & CHM_ENUMERATE_FILES)) - continue; - - /* check for NORMAL vs. META */ - if (ui.path[0] == '/') - { - - /* check for NORMAL vs. SPECIAL */ - if (ui.path[1] == '#' || ui.path[1] == '$') - flag = CHM_ENUMERATE_SPECIAL; - else - flag = CHM_ENUMERATE_NORMAL; - } - else - flag = CHM_ENUMERATE_META; - if (! (what & flag)) - continue; - - /* call the enumerator */ - { - int status = (*e)(h, &ui, context); - switch (status) - { - case CHM_ENUMERATOR_FAILURE: - HeapFree(GetProcessHeap(), 0, page_buf); - return 0; - case CHM_ENUMERATOR_CONTINUE: - break; - case CHM_ENUMERATOR_SUCCESS: - HeapFree(GetProcessHeap(), 0, page_buf); - return 1; - default: - break; - } - } - } - - /* advance to next page */ - curPage = header.block_next; - } - - HeapFree(GetProcessHeap(), 0, page_buf); - return 1; -} Modified: trunk/reactos/dll/win32/itss/chm_lib.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/itss/chm_lib.h?r…
============================================================================== --- trunk/reactos/dll/win32/itss/chm_lib.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/itss/chm_lib.h [iso-8859-1] Thu Feb 26 13:34:15 2009 @@ -104,11 +104,6 @@ #define CHM_ENUMERATOR_FAILURE (0) #define CHM_ENUMERATOR_CONTINUE (1) #define CHM_ENUMERATOR_SUCCESS (2) -int chm_enumerate(struct chmFile *h, - int what, - CHM_ENUMERATOR e, - void *context); - int chm_enumerate_dir(struct chmFile *h, const WCHAR *prefix, int what, Modified: trunk/reactos/dll/win32/itss/itss.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/itss/itss.c?rev=…
============================================================================== --- trunk/reactos/dll/win32/itss/itss.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/itss/itss.c [iso-8859-1] Thu Feb 26 13:34:15 2009 @@ -363,7 +363,7 @@ its->ref = 1; TRACE("-> %p\n", its); - *ppObj = (LPVOID) its; + *ppObj = its; ITSS_LockModule(); return S_OK; Modified: trunk/reactos/dll/win32/itss/lzx.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/itss/lzx.c?rev=3…
============================================================================== --- trunk/reactos/dll/win32/itss/lzx.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/itss/lzx.c [iso-8859-1] Thu Feb 26 13:34:15 2009 @@ -36,15 +36,17 @@ ***************************************************************************/ #include "lzx.h" +#include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include "windef.h" +#include "winbase.h" + /* sized types */ typedef unsigned char UBYTE; /* 8 bits exactly */ typedef unsigned short UWORD; /* 16 bits (or more) */ -typedef unsigned int ULONG; /* 32 bits (or more) */ -typedef signed int LONG; /* 32 bits (or more) */ /* some constants defined by the LZX specification */ #define LZX_MIN_MATCH (2) @@ -178,10 +180,10 @@ if (window < 15 || window > 21) return NULL; /* allocate state and associated window */ - pState = malloc(sizeof(struct LZXstate)); - if (!(pState->window = malloc(wndsize))) + pState = HeapAlloc(GetProcessHeap(), 0, sizeof(struct LZXstate)); + if (!(pState->window = HeapAlloc(GetProcessHeap(), 0, wndsize))) { - free(pState); + HeapFree(GetProcessHeap(), 0, pState); return NULL; } pState->actual_size = wndsize; @@ -217,8 +219,8 @@ { if (pState) { - free(pState->window); - free(pState); + HeapFree(GetProcessHeap(), 0, pState->window); + HeapFree(GetProcessHeap(), 0, pState); } } Modified: trunk/reactos/dll/win32/itss/moniker.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/itss/moniker.c?r…
============================================================================== --- trunk/reactos/dll/win32/itss/moniker.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/itss/moniker.c [iso-8859-1] Thu Feb 26 13:34:15 2009 @@ -473,7 +473,7 @@ its->ref = 1; TRACE("-> %p\n", its); - *ppObj = (LPVOID) its; + *ppObj = its; ITSS_LockModule(); return S_OK; Modified: trunk/reactos/dll/win32/itss/protocol.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/itss/protocol.c?…
============================================================================== --- trunk/reactos/dll/win32/itss/protocol.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/itss/protocol.c [iso-8859-1] Thu Feb 26 13:34:15 2009 @@ -47,7 +47,7 @@ } ITSProtocol; #define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpInternetProtocolVtbl) -#define PROTINFO(x) ((IInternetProtocolInfo*) &(x)->lpInternetProtocolInfoVtbl) +#define PROTINFO(x) (&(x)->lpInternetProtocolInfoVtbl) static void release_chm(ITSProtocol *This) { Modified: trunk/reactos/dll/win32/mlang/mlang.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mlang/mlang.c?re…
============================================================================== --- trunk/reactos/dll/win32/mlang/mlang.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mlang/mlang.c [iso-8859-1] Thu Feb 26 13:34:15 2009 @@ -42,8 +42,6 @@ #include "initguid.h" #define CP_UNICODE 1200 - -#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field)) static HRESULT MultiLanguage_create(IUnknown *pUnkOuter, LPVOID *ppObj); static HRESULT EnumRfc1766_create(LANGID LangId, IEnumRfc1766 **ppEnum); @@ -450,10 +448,11 @@ const MIME_CP_INFO *mime_cp_info; const char *fixed_font; const char *proportional_font; + SCRIPT_ID sid; } mlang_data[] = { { "Arabic",1256,sizeof(arabic_cp)/sizeof(arabic_cp[0]),arabic_cp, - "Courier","Arial" }, /* FIXME */ + "Courier","Arial", sidArabic }, /* FIXME */ { "Baltic",1257,sizeof(baltic_cp)/sizeof(baltic_cp[0]),baltic_cp, "Courier","Arial" }, /* FIXME */ { "Chinese Simplified",936,sizeof(chinese_simplified_cp)/sizeof(chinese_simplified_cp[0]),chinese_simplified_cp, @@ -463,23 +462,23 @@ { "Central European",1250,sizeof(central_european_cp)/sizeof(central_european_cp[0]),central_european_cp, "Courier","Arial" }, /* FIXME */ { "Cyrillic",1251,sizeof(cyrillic_cp)/sizeof(cyrillic_cp[0]),cyrillic_cp, - "Courier","Arial" }, /* FIXME */ + "Courier","Arial", sidCyrillic }, /* FIXME */ { "Greek",1253,sizeof(greek_cp)/sizeof(greek_cp[0]),greek_cp, - "Courier","Arial" }, /* FIXME */ + "Courier","Arial", sidGreek }, /* FIXME */ { "Hebrew",1255,sizeof(hebrew_cp)/sizeof(hebrew_cp[0]),hebrew_cp, - "Courier","Arial" }, /* FIXME */ + "Courier","Arial", sidHebrew }, /* FIXME */ { "Japanese",932,sizeof(japanese_cp)/sizeof(japanese_cp[0]),japanese_cp, "MS Gothic","MS PGothic" }, { "Korean",949,sizeof(korean_cp)/sizeof(korean_cp[0]),korean_cp, "Courier","Arial" }, /* FIXME */ { "Thai",874,sizeof(thai_cp)/sizeof(thai_cp[0]),thai_cp, - "Courier","Arial" }, /* FIXME */ + "Courier","Arial", sidThai }, /* FIXME */ { "Turkish",1254,sizeof(turkish_cp)/sizeof(turkish_cp[0]),turkish_cp, "Courier","Arial" }, /* FIXME */ { "Vietnamese",1258,sizeof(vietnamese_cp)/sizeof(vietnamese_cp[0]),vietnamese_cp, "Courier","Arial" }, /* FIXME */ { "Western European",1252,sizeof(western_cp)/sizeof(western_cp[0]),western_cp, - "Courier","Arial" }, /* FIXME */ + "Courier","Arial", sidLatin }, /* FIXME */ { "Unicode",CP_UNICODE,sizeof(unicode_cp)/sizeof(unicode_cp[0]),unicode_cp, "Courier","Arial" } /* FIXME */ }; @@ -800,22 +799,30 @@ int code = DetectJapaneseCode(input,count); TRACE("Japanese code %i\n",code); - if (code == 932) - { + switch (code) + { + case 0: + if (output) + rc = MultiByteToWideChar(CP_ACP,0,input,count,output,out_count); + else + rc = MultiByteToWideChar(CP_ACP,0,input,count,0,0); + break; + + case 932: if (output) rc = MultiByteToWideChar(932,0,input,count,output,out_count); else rc = MultiByteToWideChar(932,0,input,count,0,0); - } - else if (code == 51932) - { + break; + + case 51932: if (output) rc = MultiByteToWideChar(20932,0,input,count,output,out_count); else rc = MultiByteToWideChar(20932,0,input,count,0,0); - } - else if (code == 50220) - { + break; + + case 50220: sjis_string = HeapAlloc(GetProcessHeap(),0,count); rc = ConvertJIS2SJIS(input,count,sjis_string); if (rc) @@ -827,6 +834,7 @@ rc = MultiByteToWideChar(932,0,sjis_string,rc,0,0); } HeapFree(GetProcessHeap(),0,sjis_string); + break; } return rc; } @@ -1485,12 +1493,17 @@ DWORD total, pos; } EnumCodePage_impl; +static inline EnumCodePage_impl *impl_from_IEnumCodePage( IEnumCodePage *iface ) +{ + return (EnumCodePage_impl *)CONTAINING_RECORD( iface, EnumCodePage_impl, vtbl_IEnumCodePage ); +} + static HRESULT WINAPI fnIEnumCodePage_QueryInterface( IEnumCodePage* iface, REFIID riid, void** ppvObject) { - ICOM_THIS_MULTI(EnumCodePage_impl, vtbl_IEnumCodePage, iface); + EnumCodePage_impl *This = impl_from_IEnumCodePage( iface ); TRACE("%p -> %s\n", This, debugstr_guid(riid) ); @@ -1510,14 +1523,14 @@ static ULONG WINAPI fnIEnumCodePage_AddRef( IEnumCodePage* iface) { - ICOM_THIS_MULTI(EnumCodePage_impl, vtbl_IEnumCodePage, iface); + EnumCodePage_impl *This = impl_from_IEnumCodePage( iface ); return InterlockedIncrement(&This->ref); } static ULONG WINAPI fnIEnumCodePage_Release( IEnumCodePage* iface) { - ICOM_THIS_MULTI(EnumCodePage_impl, vtbl_IEnumCodePage, iface); + EnumCodePage_impl *This = impl_from_IEnumCodePage( iface ); ULONG ref = InterlockedDecrement(&This->ref); TRACE("%p ref = %d\n", This, ref); @@ -1535,7 +1548,7 @@ IEnumCodePage* iface, IEnumCodePage** ppEnum) { - ICOM_THIS_MULTI(EnumCodePage_impl, vtbl_IEnumCodePage, iface); + EnumCodePage_impl *This = impl_from_IEnumCodePage( iface ); FIXME("%p %p\n", This, ppEnum); return E_NOTIMPL; } @@ -1547,8 +1560,8 @@ ULONG* pceltFetched) { ULONG i; - - ICOM_THIS_MULTI(EnumCodePage_impl, vtbl_IEnumCodePage, iface); + EnumCodePage_impl *This = impl_from_IEnumCodePage( iface ); + TRACE("%p %u %p %p\n", This, celt, rgelt, pceltFetched); if (!pceltFetched) return S_FALSE; @@ -1584,7 +1597,8 @@ static HRESULT WINAPI fnIEnumCodePage_Reset( IEnumCodePage* iface) { - ICOM_THIS_MULTI(EnumCodePage_impl, vtbl_IEnumCodePage, iface); + EnumCodePage_impl *This = impl_from_IEnumCodePage( iface ); + TRACE("%p\n", This); This->pos = 0; @@ -1595,7 +1609,8 @@ IEnumCodePage* iface, ULONG celt) { - ICOM_THIS_MULTI(EnumCodePage_impl, vtbl_IEnumCodePage, iface); + EnumCodePage_impl *This = impl_from_IEnumCodePage( iface ); + TRACE("%p %u\n", This, celt); if (celt >= This->total) return S_FALSE; @@ -1671,12 +1686,17 @@ DWORD total, pos; } EnumScript_impl; +static inline EnumScript_impl *impl_from_IEnumScript( IEnumScript *iface ) +{ + return (EnumScript_impl *)CONTAINING_RECORD( iface, EnumScript_impl, vtbl_IEnumScript ); +} + static HRESULT WINAPI fnIEnumScript_QueryInterface( IEnumScript* iface, REFIID riid, void** ppvObject) { - ICOM_THIS_MULTI(EnumScript_impl, vtbl_IEnumScript, iface); + EnumScript_impl *This = impl_from_IEnumScript( iface ); TRACE("%p -> %s\n", This, debugstr_guid(riid) ); @@ -1696,14 +1716,14 @@ static ULONG WINAPI fnIEnumScript_AddRef( IEnumScript* iface) { - ICOM_THIS_MULTI(EnumScript_impl, vtbl_IEnumScript, iface); + EnumScript_impl *This = impl_from_IEnumScript( iface ); return InterlockedIncrement(&This->ref); } static ULONG WINAPI fnIEnumScript_Release( IEnumScript* iface) { - ICOM_THIS_MULTI(EnumScript_impl, vtbl_IEnumScript, iface); + EnumScript_impl *This = impl_from_IEnumScript( iface ); ULONG ref = InterlockedDecrement(&This->ref); TRACE("%p ref = %d\n", This, ref); @@ -1721,7 +1741,7 @@ IEnumScript* iface, IEnumScript** ppEnum) { - ICOM_THIS_MULTI(EnumScript_impl, vtbl_IEnumScript, iface); + EnumScript_impl *This = impl_from_IEnumScript( iface ); FIXME("%p %p: stub!\n", This, ppEnum); return E_NOTIMPL; } @@ -1732,7 +1752,8 @@ PSCRIPTINFO rgelt, ULONG* pceltFetched) { - ICOM_THIS_MULTI(EnumScript_impl, vtbl_IEnumScript, iface); + EnumScript_impl *This = impl_from_IEnumScript( iface ); + TRACE("%p %u %p %p\n", This, celt, rgelt, pceltFetched); if (!pceltFetched || !rgelt) return E_FAIL; @@ -1754,7 +1775,8 @@ static HRESULT WINAPI fnIEnumScript_Reset( IEnumScript* iface) { - ICOM_THIS_MULTI(EnumScript_impl, vtbl_IEnumScript, iface); + EnumScript_impl *This = impl_from_IEnumScript( iface ); + TRACE("%p\n", This); This->pos = 0; @@ -1765,7 +1787,8 @@ IEnumScript* iface, ULONG celt) { - ICOM_THIS_MULTI(EnumScript_impl, vtbl_IEnumScript, iface); + EnumScript_impl *This = impl_from_IEnumScript( iface ); + TRACE("%p %u\n", This, celt); if (celt >= This->total) return S_FALSE; @@ -1825,26 +1848,31 @@ /******************************************************************************/ +static inline MLang_impl *impl_from_IMLangFontLink( IMLangFontLink *iface ) +{ + return (MLang_impl *)CONTAINING_RECORD( iface, MLang_impl, vtbl_IMLangFontLink ); +} + static HRESULT WINAPI fnIMLangFontLink_QueryInterface( IMLangFontLink* iface, REFIID riid, void** ppvObject) { - ICOM_THIS_MULTI(MLang_impl, vtbl_IMLangFontLink, iface); + MLang_impl *This = impl_from_IMLangFontLink( iface ); return MLang_QueryInterface( This, riid, ppvObject ); } static ULONG WINAPI fnIMLangFontLink_AddRef( IMLangFontLink* iface) { - ICOM_THIS_MULTI(MLang_impl, vtbl_IMLangFontLink, iface); + MLang_impl *This = impl_from_IMLangFontLink( iface ); return MLang_AddRef( This ); } static ULONG WINAPI fnIMLangFontLink_Release( IMLangFontLink* iface) { - ICOM_THIS_MULTI(MLang_impl, vtbl_IMLangFontLink, iface); + MLang_impl *This = impl_from_IMLangFontLink( iface ); return MLang_Release( This ); } @@ -1895,7 +1923,7 @@ UINT uCodePage, DWORD* pdwCodePages) { - ICOM_THIS_MULTI(MLang_impl, vtbl_IMLangFontLink, iface); + MLang_impl *This = impl_from_IMLangFontLink( iface ); CHARSETINFO cs; BOOL rc; @@ -1921,7 +1949,7 @@ UINT uDefaultCodePage, UINT* puCodePage) { - ICOM_THIS_MULTI(MLang_impl, vtbl_IMLangFontLink, iface); + MLang_impl *This = impl_from_IMLangFontLink( iface ); DWORD mask = 0x00000000; UINT i; CHARSETINFO cs; @@ -1951,7 +1979,7 @@ DWORD Csb[2]; Csb[0] = mask; Csb[1] = 0x0; - rc = TranslateCharsetInfo((DWORD*)Csb, &cs, TCI_SRCFONTSIG); + rc = TranslateCharsetInfo(Csb, &cs, TCI_SRCFONTSIG); if (!rc) continue; @@ -1974,7 +2002,7 @@ { HFONT old_font; FONTSIGNATURE fontsig; - ICOM_THIS_MULTI(MLang_impl, vtbl_IMLangFontLink, iface); + MLang_impl *This = impl_from_IMLangFontLink( iface ); TRACE("(%p)\n",This); @@ -2032,24 +2060,29 @@ /******************************************************************************/ +static inline MLang_impl *impl_from_IMultiLanguage( IMultiLanguage *iface ) +{ + return (MLang_impl *)CONTAINING_RECORD( iface, MLang_impl, vtbl_IMultiLanguage ); +} + static HRESULT WINAPI fnIMultiLanguage_QueryInterface( IMultiLanguage* iface, REFIID riid, void** ppvObject) { - ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage, iface); + MLang_impl *This = impl_from_IMultiLanguage( iface ); return MLang_QueryInterface( This, riid, ppvObject ); } static ULONG WINAPI fnIMultiLanguage_AddRef( IMultiLanguage* iface ) { - ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage, iface); + MLang_impl *This = impl_from_IMultiLanguage( iface ); return IMLangFontLink_AddRef( ((IMLangFontLink*)This) ); } static ULONG WINAPI fnIMultiLanguage_Release( IMultiLanguage* iface ) { - ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage, iface); + MLang_impl *This = impl_from_IMultiLanguage( iface ); return IMLangFontLink_Release( ((IMLangFontLink*)This) ); } @@ -2067,8 +2100,8 @@ PMIMECPINFO pCodePageInfo) { UINT i, n; - - ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage, iface); + MLang_impl *This = impl_from_IMultiLanguage( iface ); + TRACE("%p, %u, %p\n", This, uiCodePage, pCodePageInfo); for (i = 0; i < sizeof(mlang_data)/sizeof(mlang_data[0]); i++) @@ -2099,7 +2132,8 @@ DWORD grfFlags, IEnumCodePage** ppEnumCodePage) { - ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage, iface); + MLang_impl *This = impl_from_IMultiLanguage( iface ); + TRACE("%p %08x %p\n", This, grfFlags, ppEnumCodePage); return EnumCodePage_create( This, grfFlags, 0, ppEnumCodePage ); @@ -2110,7 +2144,7 @@ BSTR Charset, PMIMECSETINFO pCharsetInfo) { - ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage, iface); + MLang_impl *This = impl_from_IMultiLanguage( iface ); return IMultiLanguage3_GetCharsetInfo((IMultiLanguage3*)&This->vtbl_IMultiLanguage3, Charset, pCharsetInfo); } @@ -2219,12 +2253,17 @@ DWORD total, pos; } EnumRfc1766_impl; +static inline EnumRfc1766_impl *impl_from_IEnumRfc1766( IEnumRfc1766 *iface ) +{ + return (EnumRfc1766_impl *)CONTAINING_RECORD( iface, EnumRfc1766_impl, vtbl_IEnumRfc1766 ); +} + static HRESULT WINAPI fnIEnumRfc1766_QueryInterface( IEnumRfc1766 *iface, REFIID riid, void** ppvObject) { - ICOM_THIS_MULTI(EnumRfc1766_impl, vtbl_IEnumRfc1766, iface); + EnumRfc1766_impl *This = impl_from_IEnumRfc1766( iface ); TRACE("%p -> %s\n", This, debugstr_guid(riid) ); @@ -2244,14 +2283,14 @@ static ULONG WINAPI fnIEnumRfc1766_AddRef( IEnumRfc1766 *iface) { - ICOM_THIS_MULTI(EnumRfc1766_impl, vtbl_IEnumRfc1766, iface); + EnumRfc1766_impl *This = impl_from_IEnumRfc1766( iface ); return InterlockedIncrement(&This->ref); } static ULONG WINAPI fnIEnumRfc1766_Release( IEnumRfc1766 *iface) { - ICOM_THIS_MULTI(EnumRfc1766_impl, vtbl_IEnumRfc1766, iface); + EnumRfc1766_impl *This = impl_from_IEnumRfc1766( iface ); ULONG ref = InterlockedDecrement(&This->ref); TRACE("%p ref = %d\n", This, ref); @@ -2268,7 +2307,8 @@ IEnumRfc1766 *iface, IEnumRfc1766 **ppEnum) { - ICOM_THIS_MULTI(EnumRfc1766_impl, vtbl_IEnumRfc1766, iface); + EnumRfc1766_impl *This = impl_from_IEnumRfc1766( iface ); + FIXME("%p %p\n", This, ppEnum); return E_NOTIMPL; } @@ -2280,8 +2320,8 @@ ULONG *pceltFetched) { ULONG i; - - ICOM_THIS_MULTI(EnumRfc1766_impl, vtbl_IEnumRfc1766, iface); + EnumRfc1766_impl *This = impl_from_IEnumRfc1766( iface ); + TRACE("%p %u %p %p\n", This, celt, rgelt, pceltFetched); if (!pceltFetched) return S_FALSE; @@ -2311,7 +2351,8 @@ static HRESULT WINAPI fnIEnumRfc1766_Reset( IEnumRfc1766 *iface) { - ICOM_THIS_MULTI(EnumRfc1766_impl, vtbl_IEnumRfc1766, iface); + EnumRfc1766_impl *This = impl_from_IEnumRfc1766( iface ); + TRACE("%p\n", This); This->pos = 0; @@ -2322,7 +2363,8 @@ IEnumRfc1766 *iface, ULONG celt) { - ICOM_THIS_MULTI(EnumRfc1766_impl, vtbl_IEnumRfc1766, iface); + EnumRfc1766_impl *This = impl_from_IEnumRfc1766( iface ); + TRACE("%p %u\n", This, celt); if (celt >= This->total) return S_FALSE; @@ -2427,7 +2469,8 @@ IMultiLanguage *iface, IEnumRfc1766 **ppEnumRfc1766) { - ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage, iface); + MLang_impl *This = impl_from_IMultiLanguage( iface ); + TRACE("%p %p\n", This, ppEnumRfc1766); return EnumRfc1766_create(0, ppEnumRfc1766); @@ -2480,24 +2523,29 @@ /******************************************************************************/ +static inline MLang_impl *impl_from_IMultiLanguage3( IMultiLanguage3 *iface ) +{ + return (MLang_impl *)CONTAINING_RECORD( iface, MLang_impl, vtbl_IMultiLanguage3 ); +} + static HRESULT WINAPI fnIMultiLanguage2_QueryInterface( IMultiLanguage3* iface, REFIID riid, void** ppvObject) { - ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage3, iface); + MLang_impl *This = impl_from_IMultiLanguage3( iface ); return MLang_QueryInterface( This, riid, ppvObject ); } static ULONG WINAPI fnIMultiLanguage2_AddRef( IMultiLanguage3* iface ) { - ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage3, iface); + MLang_impl *This = impl_from_IMultiLanguage3( iface ); return MLang_AddRef( This ); } static ULONG WINAPI fnIMultiLanguage2_Release( IMultiLanguage3* iface ) { - ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage3, iface); + MLang_impl *This = impl_from_IMultiLanguage3( iface ); return MLang_Release( This ); } @@ -2505,7 +2553,8 @@ IMultiLanguage3* iface, UINT* pcCodePage) { - ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage3, iface); + MLang_impl *This = impl_from_IMultiLanguage3( iface ); + TRACE("%p, %p\n", This, pcCodePage); if (!pcCodePage) return S_FALSE; @@ -2559,8 +2608,8 @@ PMIMECPINFO pCodePageInfo) { UINT i, n; - - ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage3, iface); + MLang_impl *This = impl_from_IMultiLanguage3( iface ); + TRACE("%p, %u, %04x, %p\n", This, uiCodePage, LangId, pCodePageInfo); for (i = 0; i < sizeof(mlang_data)/sizeof(mlang_data[0]); i++) @@ -2592,7 +2641,8 @@ LANGID LangId, IEnumCodePage** ppEnumCodePage) { - ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage3, iface); + MLang_impl *This = impl_from_IMultiLanguage3( iface ); + TRACE("%p %08x %04x %p\n", This, grfFlags, LangId, ppEnumCodePage); return EnumCodePage_create( This, grfFlags, LangId, ppEnumCodePage ); @@ -2604,8 +2654,8 @@ PMIMECSETINFO pCharsetInfo) { UINT i, n; - - ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage3, iface); + MLang_impl *This = impl_from_IMultiLanguage3( iface ); + TRACE("%p %s %p\n", This, debugstr_w(Charset), pCharsetInfo); if (!pCharsetInfo) return E_FAIL; @@ -2752,7 +2802,8 @@ LANGID LangId, IEnumRfc1766** ppEnumRfc1766) { - ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage, iface); + MLang_impl *This = impl_from_IMultiLanguage3( iface ); + TRACE("%p %p\n", This, ppEnumRfc1766); return EnumRfc1766_create(LangId, ppEnumRfc1766); @@ -2910,8 +2961,7 @@ UINT uiCodePage, HWND hwnd) { - FIXME("%u, %p\n", uiCodePage, hwnd); - return E_NOTIMPL; + return IMultiLanguage2_ValidateCodePageEx(iface,uiCodePage,hwnd,0); } static HRESULT WINAPI fnIMultiLanguage2_GetCodePageDescription( @@ -2962,7 +3012,8 @@ IMultiLanguage3* iface, UINT* pnScripts) { - ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage3, iface); + MLang_impl *This = impl_from_IMultiLanguage3( iface ); + TRACE("%p %p\n", This, pnScripts); if (!pnScripts) return S_FALSE; @@ -2977,7 +3028,8 @@ LANGID LangId, IEnumScript** ppEnumScript) { - ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage3, iface); + MLang_impl *This = impl_from_IMultiLanguage3( iface ); + TRACE("%p %08x %04x %p\n", This, dwFlags, LangId, ppEnumScript); return EnumScript_create( This, dwFlags, LangId, ppEnumScript ); @@ -2989,8 +3041,28 @@ HWND hwnd, DWORD dwfIODControl) { - ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage3, iface); - FIXME("%p %u %p %08x: stub!\n", This, uiCodePage, hwnd, dwfIODControl); + int i; + MLang_impl *This = impl_from_IMultiLanguage3( iface ); + + TRACE("%p %u %p %08x\n", This, uiCodePage, hwnd, dwfIODControl); + + /* quick check for kernel32 supported code pages */ + if (IsValidCodePage(uiCodePage)) + return S_OK; + + /* check for mlang supported code pages */ + for (i = 0; i < sizeof(mlang_data)/sizeof(mlang_data[0]); i++) + { + int n; + for (n = 0; n < mlang_data[i].number_of_cp; n++) + { + if (mlang_data[i].mime_cp_info[n].cp == uiCodePage) + return S_OK; + } + } + + if (dwfIODControl != CPIOD_PEEK) + FIXME("Request to install codepage language pack not handled\n"); return S_FALSE; } @@ -3006,7 +3078,8 @@ UINT *pnDetectedCodePages, WCHAR *lpSpecialChar) { - ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage3, iface); + MLang_impl *This = impl_from_IMultiLanguage3( iface ); + FIXME("(%p)->(%08x %s %u %p %u %p %p %p)\n", This, dwFlags, debugstr_w(lpWideCharStr), cchWideChar, puiPreferredCodePages, nPreferredCodePages, puiDetectedCodePages, pnDetectedCodePages, lpSpecialChar); @@ -3023,7 +3096,8 @@ UINT *pnDetectedCodePages, WCHAR *lpSpecialChar) { - ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage3, iface); + MLang_impl *This = impl_from_IMultiLanguage3( iface ); + FIXME("(%p)->(%08x %p %p %u %p %p %p)\n", This, dwFlags, pStrIn, puiPreferredCodePages, nPreferredCodePages, puiDetectedCodePages, pnDetectedCodePages, lpSpecialChar); @@ -3067,24 +3141,30 @@ }; /******************************************************************************/ + +static inline MLang_impl *impl_from_IMLangFontLink2( IMLangFontLink2 *iface ) +{ + return (MLang_impl *)CONTAINING_RECORD( iface, MLang_impl, vtbl_IMLangFontLink2 ); +} + static HRESULT WINAPI fnIMLangFontLink2_QueryInterface( IMLangFontLink2 * iface, REFIID riid, void** ppvObject) { - ICOM_THIS_MULTI(MLang_impl, vtbl_IMLangFontLink2, iface); + MLang_impl *This = impl_from_IMLangFontLink2( iface ); return MLang_QueryInterface( This, riid, ppvObject ); } static ULONG WINAPI fnIMLangFontLink2_AddRef( IMLangFontLink2* iface ) { - ICOM_THIS_MULTI(MLang_impl, vtbl_IMLangFontLink2, iface); + MLang_impl *This = impl_from_IMLangFontLink2( iface ); return MLang_AddRef( This ); } static ULONG WINAPI fnIMLangFontLink2_Release( IMLangFontLink2* iface ) { - ICOM_THIS_MULTI(MLang_impl, vtbl_IMLangFontLink2, iface); + MLang_impl *This = impl_from_IMLangFontLink2( iface ); return MLang_Release( This ); } @@ -3158,8 +3238,37 @@ SCRIPT_ID sid, DWORD dwFlags, UINT *puiFonts, SCRIPTFONTINFO *pScriptFont) { - FIXME("(%p)->%i %i %p %p\n",This, sid, dwFlags, puiFonts, pScriptFont); - return E_NOTIMPL; + UINT i, j; + + TRACE("(%p)->%u %x %p %p\n", This, sid, dwFlags, puiFonts, pScriptFont); + + if (!dwFlags) dwFlags = SCRIPTCONTF_PROPORTIONAL_FONT; + + for (i = 0, j = 0; i < sizeof(mlang_data)/sizeof(mlang_data[0]); i++) + { + if (sid == mlang_data[i].sid) + { + if (pScriptFont) + { + if (j >= *puiFonts) break; + + pScriptFont[j].scripts = 1 << mlang_data[i].sid; + if (dwFlags == SCRIPTCONTF_FIXED_FONT) + { + MultiByteToWideChar(CP_ACP, 0, mlang_data[i].fixed_font, -1, + pScriptFont[j].wszFont, MAX_MIMEFACE_NAME); + } + else if (dwFlags == SCRIPTCONTF_PROPORTIONAL_FONT) + { + MultiByteToWideChar(CP_ACP, 0, mlang_data[i].proportional_font, -1, + pScriptFont[j].wszFont, MAX_MIMEFACE_NAME); + } + } + j++; + } + } + *puiFonts = j; + return S_OK; } static HRESULT WINAPI fnIMLangFontLink2_CodePageToScriptID(IMLangFontLink2* This, @@ -3189,26 +3298,31 @@ /******************************************************************************/ +static inline MLang_impl *impl_from_IMLangLineBreakConsole( IMLangLineBreakConsole *iface ) +{ + return (MLang_impl *)CONTAINING_RECORD( iface, MLang_impl, vtbl_IMLangLineBreakConsole ); +} + static HRESULT WINAPI fnIMLangLineBreakConsole_QueryInterface( IMLangLineBreakConsole* iface, REFIID riid, void** ppvObject) { - ICOM_THIS_MULTI(MLang_impl, vtbl_IMLangLineBreakConsole, iface); + MLang_impl *This = impl_from_IMLangLineBreakConsole( iface ); return MLang_QueryInterface( This, riid, ppvObject ); } static ULONG WINAPI fnIMLangLineBreakConsole_AddRef( IMLangLineBreakConsole* iface ) { - ICOM_THIS_MULTI(MLang_impl, vtbl_IMLangLineBreakConsole, iface); + MLang_impl *This = impl_from_IMLangLineBreakConsole( iface ); return MLang_AddRef( This ); } static ULONG WINAPI fnIMLangLineBreakConsole_Release( IMLangLineBreakConsole* iface ) { - ICOM_THIS_MULTI(MLang_impl, vtbl_IMLangLineBreakConsole, iface); + MLang_impl *This = impl_from_IMLangLineBreakConsole( iface ); return MLang_Release( This ); } @@ -3294,7 +3408,7 @@ mlang->total_scripts = sizeof(mlang_data)/sizeof(mlang_data[0]) - 1; mlang->ref = 1; - *ppObj = (LPVOID) mlang; + *ppObj = mlang; TRACE("returning %p\n", mlang); LockModule(); Modified: trunk/reactos/dll/win32/mlang/mlang.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mlang/mlang.spec…
============================================================================== --- trunk/reactos/dll/win32/mlang/mlang.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mlang/mlang.spec [iso-8859-1] Thu Feb 26 13:34:15 2009 @@ -1,14 +1,15 @@ -@ stdcall ConvertINetMultiByteToUnicode(ptr long ptr ptr ptr ptr) -@ stub ConvertINetReset -@ stdcall ConvertINetString(ptr long long ptr ptr ptr ptr) -@ stdcall ConvertINetUnicodeToMultiByte(ptr long ptr ptr ptr ptr) +110 stdcall IsConvertINetStringAvailable(long long) +111 stdcall ConvertINetString(ptr long long ptr ptr ptr ptr) +112 stdcall ConvertINetUnicodeToMultiByte(ptr long ptr ptr ptr ptr) +113 stdcall ConvertINetMultiByteToUnicode(ptr long ptr ptr ptr ptr) +114 stub ConvertINetReset +120 stdcall LcidToRfc1766A(long ptr long) +121 stdcall LcidToRfc1766W(long ptr long) +122 stdcall Rfc1766ToLcidA(ptr str) +123 stdcall Rfc1766ToLcidW(ptr wstr) + @ stdcall -private DllCanUnloadNow() @ stdcall -private DllGetClassObject(ptr ptr ptr) @ stdcall -private DllRegisterServer() @ stdcall -private DllUnregisterServer() @ stdcall GetGlobalFontLinkObject() -@ stdcall IsConvertINetStringAvailable(long long) -@ stdcall LcidToRfc1766A(long ptr long) -@ stdcall LcidToRfc1766W(long ptr long) -@ stdcall Rfc1766ToLcidA(ptr str) -@ stdcall Rfc1766ToLcidW(ptr wstr) Modified: trunk/reactos/include/psdk/mlang.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/mlang.idl?rev…
============================================================================== --- trunk/reactos/include/psdk/mlang.idl [iso-8859-1] (original) +++ trunk/reactos/include/psdk/mlang.idl [iso-8859-1] Thu Feb 26 13:34:15 2009 @@ -21,6 +21,9 @@ #endif interface IStream; + +cpp_quote("#define CPIOD_PEEK 0x40000000") +cpp_quote("#define CPIOD_FORCE_PROMPT 0x80000000") /* FIXME: LANGID is defined in winnt.h and mlang.h in the platform SDK */ cpp_quote("#ifndef _WINNT_H")
15 years, 10 months
1
0
0
0
[dchapyshev] 39765: - Sync objsel, ntprint, netapi32, mshtml with Wine head
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Thu Feb 26 13:32:48 2009 New Revision: 39765 URL:
http://svn.reactos.org/svn/reactos?rev=39765&view=rev
Log: - Sync objsel, ntprint, netapi32, mshtml with Wine head Added: trunk/reactos/dll/win32/mshtml/Lt.rc (with props) Modified: trunk/reactos/dll/win32/mshtml/htmlanchor.c trunk/reactos/dll/win32/mshtml/htmlbody.c trunk/reactos/dll/win32/mshtml/htmlcomment.c trunk/reactos/dll/win32/mshtml/htmlcurstyle.c trunk/reactos/dll/win32/mshtml/htmlgeneric.c trunk/reactos/dll/win32/mshtml/htmliframe.c trunk/reactos/dll/win32/mshtml/htmlimg.c trunk/reactos/dll/win32/mshtml/htmlinput.c trunk/reactos/dll/win32/mshtml/htmloption.c trunk/reactos/dll/win32/mshtml/htmlscript.c trunk/reactos/dll/win32/mshtml/htmlstyle.c trunk/reactos/dll/win32/mshtml/htmlstyle.h trunk/reactos/dll/win32/mshtml/htmlstyle3.c trunk/reactos/dll/win32/mshtml/htmltable.c trunk/reactos/dll/win32/mshtml/htmltablerow.c trunk/reactos/dll/win32/mshtml/htmltextnode.c trunk/reactos/dll/win32/mshtml/install.c trunk/reactos/dll/win32/mshtml/protocol.c trunk/reactos/dll/win32/mshtml/rsrc.rc trunk/reactos/dll/win32/mshtml/script.c trunk/reactos/dll/win32/netapi32/nbnamecache.c trunk/reactos/dll/win32/netapi32/nbnamecache.h trunk/reactos/dll/win32/ntprint/ntprint.c trunk/reactos/dll/win32/objsel/factory.c trunk/reactos/dll/win32/objsel/objsel.c trunk/reactos/dll/win32/objsel/regsvr.c Added: trunk/reactos/dll/win32/mshtml/Lt.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/Lt.rc?rev…
============================================================================== --- trunk/reactos/dll/win32/mshtml/Lt.rc (added) +++ trunk/reactos/dll/win32/mshtml/Lt.rc [iso-8859-1] Thu Feb 26 13:32:48 2009 @@ -1,0 +1,59 @@ +/* + * Copyright 2009 Aurimas FiÅ¡eras <aurimas(a)gmail.com> + * + * 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 + */ + +/* UTF-8 */ +#pragma code_page(65001) + +LANGUAGE LANG_LITHUANIAN, SUBLANG_NEUTRAL + +STRINGTABLE DISCARDABLE +{ + IDS_HTMLDISABLED "HTML atvaizdavimas yra iÅ¡jungtas." + IDS_HTMLDOCUMENT "HTML dokumentas" + IDS_DOWNLOADING "AtsiunÄiama..." + IDS_INSTALLING "Ä®diegiama..." +} + +ID_DWL_DIALOG DIALOG LOADONCALL MOVEABLE DISCARDABLE 0, 0, 260, 85 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Wine Gecko diegimo programa" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Å i programa mÄgina parodyti HTML puslapį. Å iam puslapiui parodyti reikia, kad bÅ«tų " \ + "įdiegtas Gecko (Mozilla HTML variklis). Spauskite įdiegti, jei norite, kad Wine " \ + "automatiÅ¡kai atsiųstų ir įdiegtų Gecko.", ID_DWL_STATUS, 10, 10, 240, 30, SS_LEFT + CONTROL "Eiga", ID_DWL_PROGRESS, PROGRESS_CLASSA, WS_BORDER|PBS_SMOOTH, 10, 40, 240, 12 + DEFPUSHBUTTON "&Ä®diegti", ID_DWL_INSTALL, 200, 60, 50, 15, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Atsisakyti", IDCANCEL, 140, 60, 50, 15, WS_GROUP | WS_TABSTOP +} + +IDD_HYPERLINK DIALOG LOADONCALL MOVEABLE DISCARDABLE 0, 0, 250, 65 +STYLE DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Saitas" +FONT 8, "MS Shell Dlg" +{ + GROUPBOX "Saito informacija", -1, 5, 5, 190, 55 + LTEXT "&Tipas:", -1, 10, 22, 20, 10 + COMBOBOX IDC_TYPE, 35, 20, 45, 100, WS_TABSTOP | WS_GROUP | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_HASSTRINGS + LTEXT "&URL:", -1, 10, 42, 20, 10 + EDITTEXT IDC_URL, 35, 40, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_GROUP | WS_TABSTOP + PUSHBUTTON "Gerai", IDOK, 200, 10, 45, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP + PUSHBUTTON "Atsisakyti", IDCANCEL, 200, 28, 45, 14, WS_GROUP | WS_TABSTOP +} + +#pragma code_page(default) Propchange: trunk/reactos/dll/win32/mshtml/Lt.rc ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/dll/win32/mshtml/htmlanchor.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlancho…
============================================================================== --- trunk/reactos/dll/win32/mshtml/htmlanchor.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mshtml/htmlanchor.c [iso-8859-1] Thu Feb 26 13:32:48 2009 @@ -38,7 +38,7 @@ const IHTMLAnchorElementVtbl *lpHTMLAnchorElementVtbl; } HTMLAnchorElement; -#define HTMLANCHOR(x) ((IHTMLAnchorElement*) &(x)->lpHTMLAnchorElementVtbl) +#define HTMLANCHOR(x) (&(x)->lpHTMLAnchorElementVtbl) #define HTMLANCHOR_THIS(iface) DEFINE_THIS(HTMLAnchorElement, HTMLAnchorElement, iface) Modified: trunk/reactos/dll/win32/mshtml/htmlbody.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlbody.…
============================================================================== --- trunk/reactos/dll/win32/mshtml/htmlbody.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mshtml/htmlbody.c [iso-8859-1] Thu Feb 26 13:32:48 2009 @@ -42,7 +42,7 @@ nsIDOMHTMLBodyElement *nsbody; } HTMLBodyElement; -#define HTMLBODY(x) ((IHTMLBodyElement*) &(x)->lpHTMLBodyElementVtbl) +#define HTMLBODY(x) (&(x)->lpHTMLBodyElementVtbl) static BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr) { Modified: trunk/reactos/dll/win32/mshtml/htmlcomment.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlcomme…
============================================================================== --- trunk/reactos/dll/win32/mshtml/htmlcomment.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mshtml/htmlcomment.c [iso-8859-1] Thu Feb 26 13:32:48 2009 @@ -37,7 +37,7 @@ const IHTMLCommentElementVtbl *lpIHTMLCommentElementVtbl; }; -#define HTMLCOMMENT(x) ((IHTMLCommentElement*) &(x)->lpIHTMLCommentElementVtbl) +#define HTMLCOMMENT(x) (&(x)->lpIHTMLCommentElementVtbl) #define HTMLCOMMENT_THIS(iface) DEFINE_THIS(HTMLCommentElement, IHTMLCommentElement, iface) Modified: trunk/reactos/dll/win32/mshtml/htmlcurstyle.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlcurst…
============================================================================== --- trunk/reactos/dll/win32/mshtml/htmlcurstyle.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mshtml/htmlcurstyle.c [iso-8859-1] Thu Feb 26 13:32:48 2009 @@ -128,8 +128,10 @@ static HRESULT WINAPI HTMLCurrentStyle_get_position(IHTMLCurrentStyle *iface, BSTR *p) { HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + return get_nsstyle_attr(This->nsstyle, STYLEID_POSITION, p); } static HRESULT WINAPI HTMLCurrentStyle_get_styleFloat(IHTMLCurrentStyle *iface, BSTR *p) @@ -156,43 +158,45 @@ static HRESULT WINAPI HTMLCurrentStyle_get_fontFamily(IHTMLCurrentStyle *iface, BSTR *p) { HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + return get_nsstyle_attr(This->nsstyle, STYLEID_FONT_FAMILY, p); } static HRESULT WINAPI HTMLCurrentStyle_get_fontStyle(IHTMLCurrentStyle *iface, BSTR *p) { HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return get_nsstyle_attr(This->nsstyle, STYLEID_FONT_STYLE, p); } static HRESULT WINAPI HTMLCurrentStyle_get_fontVariant(IHTMLCurrentStyle *iface, BSTR *p) { HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return get_nsstyle_attr(This->nsstyle, STYLEID_FONT_VARIANT, p); } static HRESULT WINAPI HTMLCurrentStyle_get_fontWeight(IHTMLCurrentStyle *iface, VARIANT *p) { HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return get_nsstyle_attr_var(This->nsstyle, STYLEID_FONT_WEIGHT, p, ATTR_STR_TO_INT); } static HRESULT WINAPI HTMLCurrentStyle_get_fontSize(IHTMLCurrentStyle *iface, VARIANT *p) { HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return get_nsstyle_attr_var(This->nsstyle, STYLEID_FONT_SIZE, p, 0); } static HRESULT WINAPI HTMLCurrentStyle_get_backgroundImage(IHTMLCurrentStyle *iface, BSTR *p) { HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return get_nsstyle_attr(This->nsstyle, STYLEID_BACKGROUND_IMAGE, p); } static HRESULT WINAPI HTMLCurrentStyle_get_backgroundPositionX(IHTMLCurrentStyle *iface, VARIANT *p) @@ -247,29 +251,29 @@ static HRESULT WINAPI HTMLCurrentStyle_get_borderTopStyle(IHTMLCurrentStyle *iface, BSTR *p) { HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_TOP_STYLE, p); } static HRESULT WINAPI HTMLCurrentStyle_get_borderRightStyle(IHTMLCurrentStyle *iface, BSTR *p) { HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_RIGHT_STYLE, p); } static HRESULT WINAPI HTMLCurrentStyle_get_borderBottomStyle(IHTMLCurrentStyle *iface, BSTR *p) { HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_BOTTOM_STYLE, p); } static HRESULT WINAPI HTMLCurrentStyle_get_borderLeftStyle(IHTMLCurrentStyle *iface, BSTR *p) { HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return get_nsstyle_attr(This->nsstyle, STYLEID_BORDER_LEFT_STYLE, p); } static HRESULT WINAPI HTMLCurrentStyle_get_borderTopWidth(IHTMLCurrentStyle *iface, VARIANT *p) @@ -303,36 +307,36 @@ static HRESULT WINAPI HTMLCurrentStyle_get_left(IHTMLCurrentStyle *iface, VARIANT *p) { HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return get_nsstyle_attr_var(This->nsstyle, STYLEID_LEFT, p, 0); } static HRESULT WINAPI HTMLCurrentStyle_get_top(IHTMLCurrentStyle *iface, VARIANT *p) { HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return get_nsstyle_attr_var(This->nsstyle, STYLEID_TOP, p, 0); } static HRESULT WINAPI HTMLCurrentStyle_get_width(IHTMLCurrentStyle *iface, VARIANT *p) { HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return get_nsstyle_attr_var(This->nsstyle, STYLEID_WIDTH, p, 0); } static HRESULT WINAPI HTMLCurrentStyle_get_height(IHTMLCurrentStyle *iface, VARIANT *p) { HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return get_nsstyle_attr_var(This->nsstyle, STYLEID_HEIGHT, p, 0); } static HRESULT WINAPI HTMLCurrentStyle_get_paddingLeft(IHTMLCurrentStyle *iface, VARIANT *p) { HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return get_nsstyle_attr_var(This->nsstyle, STYLEID_PADDING_LEFT, p, 0); } static HRESULT WINAPI HTMLCurrentStyle_get_paddingTop(IHTMLCurrentStyle *iface, VARIANT *p) @@ -359,15 +363,15 @@ static HRESULT WINAPI HTMLCurrentStyle_get_textAlign(IHTMLCurrentStyle *iface, BSTR *p) { HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return get_nsstyle_attr(This->nsstyle, STYLEID_TEXT_ALIGN, p); } static HRESULT WINAPI HTMLCurrentStyle_get_textDecoration(IHTMLCurrentStyle *iface, BSTR *p) { HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return get_nsstyle_attr(This->nsstyle, STYLEID_TEXT_DECORATION, p); } static HRESULT WINAPI HTMLCurrentStyle_get_display(IHTMLCurrentStyle *iface, BSTR *p) @@ -389,8 +393,8 @@ static HRESULT WINAPI HTMLCurrentStyle_get_zIndex(IHTMLCurrentStyle *iface, VARIANT *p) { HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return get_nsstyle_attr_var(This->nsstyle, STYLEID_Z_INDEX, p, ATTR_STR_TO_INT); } static HRESULT WINAPI HTMLCurrentStyle_get_letterSpacing(IHTMLCurrentStyle *iface, VARIANT *p) @@ -417,8 +421,8 @@ static HRESULT WINAPI HTMLCurrentStyle_get_verticalAlign(IHTMLCurrentStyle *iface, VARIANT *p) { HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return get_nsstyle_attr_var(This->nsstyle, STYLEID_VERTICAL_ALIGN, p, 0); } static HRESULT WINAPI HTMLCurrentStyle_get_backgroundAttachment(IHTMLCurrentStyle *iface, BSTR *p) @@ -438,8 +442,8 @@ static HRESULT WINAPI HTMLCurrentStyle_get_marginRight(IHTMLCurrentStyle *iface, VARIANT *p) { HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_RIGHT, p, 0); } static HRESULT WINAPI HTMLCurrentStyle_get_marginBottom(IHTMLCurrentStyle *iface, VARIANT *p) @@ -536,8 +540,8 @@ static HRESULT WINAPI HTMLCurrentStyle_get_cursor(IHTMLCurrentStyle *iface, BSTR *p) { HTMLCurrentStyle *This = HTMLCURSTYLE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return get_nsstyle_attr(This->nsstyle, STYLEID_CURSOR, p); } static HRESULT WINAPI HTMLCurrentStyle_get_tableLayout(IHTMLCurrentStyle *iface, BSTR *p) Modified: trunk/reactos/dll/win32/mshtml/htmlgeneric.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlgener…
============================================================================== --- trunk/reactos/dll/win32/mshtml/htmlgeneric.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mshtml/htmlgeneric.c [iso-8859-1] Thu Feb 26 13:32:48 2009 @@ -38,7 +38,7 @@ const IHTMLGenericElementVtbl *lpHTMLGenericElementVtbl; } HTMLGenericElement; -#define HTMLGENERIC(x) ((IHTMLGenericElement*) &(x)->lpHTMLGenericElementVtbl) +#define HTMLGENERIC(x) (&(x)->lpHTMLGenericElementVtbl) #define HTMLGENERIC_THIS(iface) DEFINE_THIS(HTMLGenericElement, HTMLGenericElement, iface) Modified: trunk/reactos/dll/win32/mshtml/htmliframe.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlifram…
============================================================================== --- trunk/reactos/dll/win32/mshtml/htmliframe.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mshtml/htmliframe.c [iso-8859-1] Thu Feb 26 13:32:48 2009 @@ -41,7 +41,7 @@ HTMLDocument *content_doc; } HTMLIFrame; -#define HTMLFRAMEBASE2(x) ((IHTMLFrameBase2*) &(x)->lpIHTMLFrameBase2Vtbl) +#define HTMLFRAMEBASE2(x) (&(x)->lpIHTMLFrameBase2Vtbl) #define HTMLFRAMEBASE2_THIS(iface) DEFINE_THIS(HTMLIFrame, IHTMLFrameBase2, iface) Modified: trunk/reactos/dll/win32/mshtml/htmlimg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlimg.c…
============================================================================== --- trunk/reactos/dll/win32/mshtml/htmlimg.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mshtml/htmlimg.c [iso-8859-1] Thu Feb 26 13:32:48 2009 @@ -39,7 +39,7 @@ nsIDOMHTMLImageElement *nsimg; } HTMLImgElement; -#define HTMLIMG(x) ((IHTMLImgElement*) &(x)->lpHTMLImgElementVtbl) +#define HTMLIMG(x) (&(x)->lpHTMLImgElementVtbl) #define HTMLIMG_THIS(iface) DEFINE_THIS(HTMLImgElement, HTMLImgElement, iface) Modified: trunk/reactos/dll/win32/mshtml/htmlinput.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlinput…
============================================================================== --- trunk/reactos/dll/win32/mshtml/htmlinput.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mshtml/htmlinput.c [iso-8859-1] Thu Feb 26 13:32:48 2009 @@ -41,7 +41,7 @@ } HTMLInputElement; #define HTMLINPUT(x) ((IHTMLInputElement*) &(x)->lpHTMLInputElementVtbl) -#define HTMLINPUTTEXT(x) ((IHTMLInputTextElement*) &(x)->lpHTMLInputTextElementVtbl) +#define HTMLINPUTTEXT(x) (&(x)->lpHTMLInputTextElementVtbl) #define HTMLINPUT_THIS(iface) DEFINE_THIS(HTMLInputElement, HTMLInputElement, iface) Modified: trunk/reactos/dll/win32/mshtml/htmloption.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmloptio…
============================================================================== --- trunk/reactos/dll/win32/mshtml/htmloption.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mshtml/htmloption.c [iso-8859-1] Thu Feb 26 13:32:48 2009 @@ -39,7 +39,7 @@ nsIDOMHTMLOptionElement *nsoption; } HTMLOptionElement; -#define HTMLOPTION(x) ((IHTMLOptionElement*) &(x)->lpHTMLOptionElementVtbl) +#define HTMLOPTION(x) (&(x)->lpHTMLOptionElementVtbl) #define HTMLOPTION_THIS(iface) DEFINE_THIS(HTMLOptionElement, HTMLOptionElement, iface) Modified: trunk/reactos/dll/win32/mshtml/htmlscript.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlscrip…
============================================================================== --- trunk/reactos/dll/win32/mshtml/htmlscript.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mshtml/htmlscript.c [iso-8859-1] Thu Feb 26 13:32:48 2009 @@ -39,7 +39,7 @@ nsIDOMHTMLScriptElement *nsscript; } HTMLScriptElement; -#define HTMLSCRIPT(x) ((IHTMLScriptElement*) &(x)->lpHTMLScriptElementVtbl) +#define HTMLSCRIPT(x) (&(x)->lpHTMLScriptElementVtbl) #define HTMLSCRIPT_THIS(iface) DEFINE_THIS(HTMLScriptElement, HTMLScriptElement, iface) Modified: trunk/reactos/dll/win32/mshtml/htmlstyle.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlstyle…
============================================================================== --- trunk/reactos/dll/win32/mshtml/htmlstyle.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mshtml/htmlstyle.c [iso-8859-1] Thu Feb 26 13:32:48 2009 @@ -83,6 +83,8 @@ {'m','a','r','g','i','n','-','l','e','f','t',0}; static const WCHAR attrMarginRight[] = {'m','a','r','g','i','n','-','r','i','g','h','t',0}; +static const WCHAR attrMinHeight[] = + {'m','i','n','-','h','e','i','g','h','t',0}; static const WCHAR attrOverflow[] = {'o','v','e','r','f','l','o','w',0}; static const WCHAR attrPaddingLeft[] = @@ -132,6 +134,7 @@ {attrMargin, DISPID_IHTMLSTYLE_MARGIN}, {attrMarginLeft, DISPID_IHTMLSTYLE_MARGINLEFT}, {attrMarginRight, DISPID_IHTMLSTYLE_MARGINRIGHT}, + {attrMinHeight, DISPID_IHTMLSTYLE4_MINHEIGHT}, {attrOverflow, DISPID_IHTMLSTYLE_OVERFLOW}, {attrPaddingLeft, DISPID_IHTMLSTYLE_PADDINGLEFT}, {attrPosition, DISPID_IHTMLSTYLE2_POSITION}, @@ -209,10 +212,6 @@ return ret; } -#define ATTR_FIX_PX 1 -#define ATTR_FIX_URL 2 -#define ATTR_STR_TO_INT 4 - HRESULT set_nsstyle_attr(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, LPCWSTR value, DWORD flags) { nsAString str_name, str_value, str_empty; @@ -242,7 +241,7 @@ return S_OK; } -static HRESULT set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *value, DWORD flags) +HRESULT set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *value, DWORD flags) { switch(V_VT(value)) { case VT_NULL: @@ -251,6 +250,13 @@ case VT_BSTR: return set_nsstyle_attr(nsstyle, sid, V_BSTR(value), flags); + case VT_I4: { + WCHAR str[14]; + static const WCHAR format[] = {'%','d',0}; + + wsprintfW(str, format, V_I4(value)); + return set_nsstyle_attr(nsstyle, sid, str, flags); + } default: FIXME("not implemented vt %d\n", V_VT(value)); return E_NOTIMPL; @@ -301,7 +307,7 @@ return S_OK; } -static HRESULT get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *p, DWORD flags) +HRESULT get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *p, DWORD flags) { nsAString str_value; const PRUnichar *value; @@ -1121,8 +1127,8 @@ static HRESULT WINAPI HTMLStyle_get_marginRight(IHTMLStyle *iface, VARIANT *p) { HTMLStyle *This = HTMLSTYLE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_RIGHT, p, 0); } static HRESULT WINAPI HTMLStyle_put_marginBottom(IHTMLStyle *iface, VARIANT v) @@ -1186,8 +1192,8 @@ static HRESULT WINAPI HTMLStyle_get_marginLeft(IHTMLStyle *iface, VARIANT *p) { HTMLStyle *This = HTMLSTYLE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, p); + return get_nsstyle_attr_var(This->nsstyle, STYLEID_MARGIN_LEFT, p, 0); } static HRESULT WINAPI HTMLStyle_put_paddingTop(IHTMLStyle *iface, VARIANT v) @@ -2163,7 +2169,7 @@ if(lFlags == 1) FIXME("Parameter lFlags ignored\n"); - hres = HTMLStyle_GetIDsOfNames(iface, &IID_NULL, (LPOLESTR*)&strAttributeName, 1, + hres = HTMLStyle_GetIDsOfNames(iface, &IID_NULL, &strAttributeName, 1, LOCALE_USER_DEFAULT, &dispid); if(hres == S_OK) { @@ -2205,7 +2211,7 @@ if(lFlags == 1) FIXME("Parameter lFlags ignored\n"); - hres = HTMLStyle_GetIDsOfNames(iface, &IID_NULL, (LPOLESTR*)&strAttributeName, 1, + hres = HTMLStyle_GetIDsOfNames(iface, &IID_NULL, &strAttributeName, 1, LOCALE_USER_DEFAULT, &dispid); if(hres == S_OK) { Modified: trunk/reactos/dll/win32/mshtml/htmlstyle.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlstyle…
============================================================================== --- trunk/reactos/dll/win32/mshtml/htmlstyle.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mshtml/htmlstyle.h [iso-8859-1] Thu Feb 26 13:32:48 2009 @@ -59,6 +59,7 @@ STYLEID_MARGIN, STYLEID_MARGIN_LEFT, STYLEID_MARGIN_RIGHT, + STYLEID_MIN_HEIGHT, STYLEID_OVERFLOW, STYLEID_PADDING_LEFT, STYLEID_POSITION, @@ -76,3 +77,10 @@ HRESULT get_nsstyle_attr(nsIDOMCSSStyleDeclaration*,styleid_t,BSTR*); HRESULT set_nsstyle_attr(nsIDOMCSSStyleDeclaration*,styleid_t,LPCWSTR,DWORD); + +HRESULT set_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *value, DWORD flags); +HRESULT get_nsstyle_attr_var(nsIDOMCSSStyleDeclaration *nsstyle, styleid_t sid, VARIANT *p, DWORD flags); + +#define ATTR_FIX_PX 1 +#define ATTR_FIX_URL 2 +#define ATTR_STR_TO_INT 4 Modified: trunk/reactos/dll/win32/mshtml/htmlstyle3.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlstyle…
============================================================================== --- trunk/reactos/dll/win32/mshtml/htmlstyle3.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mshtml/htmlstyle3.c [iso-8859-1] Thu Feb 26 13:32:48 2009 @@ -409,15 +409,19 @@ static HRESULT WINAPI HTMLStyle4_put_minHeight(IHTMLStyle4 *iface, VARIANT v) { HTMLStyle *This = HTMLSTYLE4_THIS(iface); - FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); - return E_NOTIMPL; + + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + + return set_nsstyle_attr_var(This->nsstyle, STYLEID_MIN_HEIGHT, &v, 0); } static HRESULT WINAPI HTMLStyle4_get_minHeight(IHTMLStyle4 *iface, VARIANT *p) { HTMLStyle *This = HTMLSTYLE4_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + return get_nsstyle_attr_var(This->nsstyle, STYLEID_MIN_HEIGHT, p, 0); } static const IHTMLStyle4Vtbl HTMLStyle4Vtbl = { Modified: trunk/reactos/dll/win32/mshtml/htmltable.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmltable…
============================================================================== --- trunk/reactos/dll/win32/mshtml/htmltable.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mshtml/htmltable.c [iso-8859-1] Thu Feb 26 13:32:48 2009 @@ -40,7 +40,7 @@ nsIDOMHTMLTableElement *nstable; } HTMLTable; -#define HTMLTABLE(x) ((IHTMLTable*) &(x)->lpHTMLTableVtbl) +#define HTMLTABLE(x) (&(x)->lpHTMLTableVtbl) #define HTMLTABLE_THIS(iface) DEFINE_THIS(HTMLTable, HTMLTable, iface) Modified: trunk/reactos/dll/win32/mshtml/htmltablerow.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmltable…
============================================================================== --- trunk/reactos/dll/win32/mshtml/htmltablerow.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mshtml/htmltablerow.c [iso-8859-1] Thu Feb 26 13:32:48 2009 @@ -39,7 +39,7 @@ nsIDOMHTMLTableRowElement *nsrow; } HTMLTableRow; -#define HTMLTABLEROW(x) ((IHTMLTableRow*) &(x)->lpHTMLTableRowVtbl) +#define HTMLTABLEROW(x) (&(x)->lpHTMLTableRowVtbl) #define HTMLTABLEROW_THIS(iface) DEFINE_THIS(HTMLTableRow, HTMLTableRow, iface) Modified: trunk/reactos/dll/win32/mshtml/htmltextnode.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmltextn…
============================================================================== --- trunk/reactos/dll/win32/mshtml/htmltextnode.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mshtml/htmltextnode.c [iso-8859-1] Thu Feb 26 13:32:48 2009 @@ -37,7 +37,7 @@ const IHTMLDOMTextNodeVtbl *lpIHTMLDOMTextNodeVtbl; }; -#define HTMLTEXT(x) ((IHTMLDOMTextNode*) &(x)->lpIHTMLDOMTextNodeVtbl) +#define HTMLTEXT(x) (&(x)->lpIHTMLDOMTextNodeVtbl) #define HTMLTEXT_THIS(iface) DEFINE_THIS(HTMLDOMTextNode, IHTMLDOMTextNode, iface) Modified: trunk/reactos/dll/win32/mshtml/install.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/install.c…
============================================================================== --- trunk/reactos/dll/win32/mshtml/install.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mshtml/install.c [iso-8859-1] Thu Feb 26 13:32:48 2009 @@ -54,11 +54,6 @@ '\\','W','i','n','e', '\\','M','S','H','T','M','L',0}; -static const CHAR mshtml_keyA[] = - {'S','o','f','t','w','a','r','e', - '\\','W','i','n','e', - '\\','M','S','H','T','M','L',0}; - static HWND install_dialog = NULL; static LPWSTR tmp_file_name = NULL; static HANDLE tmp_file = INVALID_HANDLE_VALUE; @@ -224,18 +219,23 @@ static BOOL install_from_registered_dir(void) { char *file_name; + HKEY hkey; DWORD res, type, size = MAX_PATH; BOOL ret; + /* @@ Wine registry key: HKCU\Software\Wine\MSHTML */ + res = RegOpenKeyW(HKEY_CURRENT_USER, mshtml_keyW, &hkey); + if(res != ERROR_SUCCESS) + return FALSE; + file_name = heap_alloc(size+sizeof(GECKO_FILE_NAME)); - /* @@ Wine registry key: HKCU\Software\Wine\MSHTML */ - res = RegGetValueA(HKEY_CURRENT_USER, mshtml_keyA, "GeckoCabDir", RRF_RT_ANY, &type, (PBYTE)file_name, &size); + res = RegQueryValueExA(hkey, "GeckoCabDir", NULL, &type, (PBYTE)file_name, &size); if(res == ERROR_MORE_DATA) { file_name = heap_realloc(file_name, size+sizeof(GECKO_FILE_NAME)); - res = RegGetValueA(HKEY_CURRENT_USER, mshtml_keyA, "GeckoCabDir", RRF_RT_ANY, &type, (PBYTE)file_name, &size); - } - - if(res != ERROR_SUCCESS || (type != REG_SZ && type != REG_EXPAND_SZ)) { + res = RegQueryValueExA(hkey, "GeckoCabDir", NULL, &type, (PBYTE)file_name, &size); + } + RegCloseKey(hkey); + if(res != ERROR_SUCCESS || type != REG_SZ) { heap_free(file_name); return FALSE; } Modified: trunk/reactos/dll/win32/mshtml/protocol.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/protocol.…
============================================================================== --- trunk/reactos/dll/win32/mshtml/protocol.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mshtml/protocol.c [iso-8859-1] Thu Feb 26 13:32:48 2009 @@ -39,9 +39,9 @@ * common ProtocolFactory implementation */ +#define CLASSFACTORY(x) (&(x)->lpClassFactoryVtbl) +#define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpInternetProtocolVtbl) #define PROTOCOLINFO(x) ((IInternetProtocolInfo*) &(x)->lpInternetProtocolInfoVtbl) -#define CLASSFACTORY(x) ((IClassFactory*) &(x)->lpClassFactoryVtbl) -#define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpInternetProtocolVtbl) typedef struct { const IInternetProtocolInfoVtbl *lpInternetProtocolInfoVtbl; Modified: trunk/reactos/dll/win32/mshtml/rsrc.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/rsrc.rc?r…
============================================================================== --- trunk/reactos/dll/win32/mshtml/rsrc.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mshtml/rsrc.rc [iso-8859-1] Thu Feb 26 13:32:48 2009 @@ -43,6 +43,7 @@ #include "Hu.rc" #include "Ja.rc" #include "Ko.rc" +#include "Lt.rc" #include "Nl.rc" #include "No.rc" #include "Pl.rc" Modified: trunk/reactos/dll/win32/mshtml/script.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/script.c?…
============================================================================== --- trunk/reactos/dll/win32/mshtml/script.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/mshtml/script.c [iso-8859-1] Thu Feb 26 13:32:48 2009 @@ -63,9 +63,9 @@ } ScriptHost; #define ACTSCPSITE(x) ((IActiveScriptSite*) &(x)->lpIActiveScriptSiteVtbl) -#define ACTSCPPOLL(x) ((IActiveScriptSiteInterruptPoll*) &(x)->lpIActiveScriptSiteInterruptPollVtbl) -#define ACTSCPWIN(x) ((IActiveScriptSiteWindow*) &(x)->lpIActiveScriptSiteWindowVtbl) -#define ACTSCPDBG32(x) ((IActiveScriptSiteDebug32*) &(x)->lpIActiveScriptSiteDebug32Vtbl) +#define ACTSCPPOLL(x) (&(x)->lpIActiveScriptSiteInterruptPollVtbl) +#define ACTSCPWIN(x) (&(x)->lpIActiveScriptSiteWindowVtbl) +#define ACTSCPDBG32(x) (&(x)->lpIActiveScriptSiteDebug32Vtbl) static BOOL init_script_engine(ScriptHost *script_host) { Modified: trunk/reactos/dll/win32/netapi32/nbnamecache.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/nbnamec…
============================================================================== --- trunk/reactos/dll/win32/netapi32/nbnamecache.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netapi32/nbnamecache.c [iso-8859-1] Thu Feb 26 13:32:48 2009 @@ -176,31 +176,6 @@ return ret; } -BOOL NBNameCacheUpdateNBName(struct NBNameCache *cache, - const UCHAR name[NCBNAMSZ], const UCHAR nbname[NCBNAMSZ]) -{ - BOOL ret; - - if (cache) - { - NBNameCacheNode **node; - - EnterCriticalSection(&cache->cs); - node = NBNameCacheWalk(cache, (const char *)name); - if (node && *node && (*node)->entry) - { - memcpy((*node)->entry->nbname, nbname, NCBNAMSZ); - ret = TRUE; - } - else - ret = FALSE; - LeaveCriticalSection(&cache->cs); - } - else - ret = FALSE; - return ret; -} - void NBNameCacheDestroy(struct NBNameCache *cache) { if (cache) Modified: trunk/reactos/dll/win32/netapi32/nbnamecache.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/nbnamec…
============================================================================== --- trunk/reactos/dll/win32/netapi32/nbnamecache.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netapi32/nbnamecache.h [iso-8859-1] Thu Feb 26 13:32:48 2009 @@ -68,15 +68,6 @@ const NBNameCacheEntry *NBNameCacheFindEntry(struct NBNameCache *cache, const UCHAR name[NCBNAMSZ]); -/* If the entry with name name is in the cache, updates its nbname member to - * nbname. The entry's expire time is implicitly updated to entryExpireTimeMS - * + the current time in MS, since getting the NetBIOS name meant validating - * the name and address anyway. - * Returns TRUE on success or FALSE on failure. - */ -BOOL NBNameCacheUpdateNBName(struct NBNameCache *cache, - const UCHAR name[NCBNAMSZ], const UCHAR nbname[NCBNAMSZ]); - void NBNameCacheDestroy(struct NBNameCache *cache); #endif /* ndef __WINE_NBNAMECACHE_H */ Modified: trunk/reactos/dll/win32/ntprint/ntprint.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ntprint/ntprint.…
============================================================================== --- trunk/reactos/dll/win32/ntprint/ntprint.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ntprint/ntprint.c [iso-8859-1] Thu Feb 26 13:32:48 2009 @@ -102,7 +102,7 @@ } TRACE("=> %p (%u monitors installed)\n", mi, mi->installed); - return (HANDLE) mi; + return mi; } /***************************************************** @@ -112,7 +112,7 @@ VOID WINAPI PSetupDestroyMonitorInfo(HANDLE monitorinfo) { - monitorinfo_t * mi = (monitorinfo_t *) monitorinfo; + monitorinfo_t * mi = monitorinfo; TRACE("(%p)\n", mi); if (mi) { @@ -144,7 +144,7 @@ BOOL WINAPI PSetupEnumMonitor(HANDLE monitorinfo, DWORD index, LPWSTR buffer, LPDWORD psize) { - monitorinfo_t * mi = (monitorinfo_t *) monitorinfo; + monitorinfo_t * mi = monitorinfo; LPWSTR nameW; DWORD len; Modified: trunk/reactos/dll/win32/objsel/factory.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/objsel/factory.c…
============================================================================== --- trunk/reactos/dll/win32/objsel/factory.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/objsel/factory.c [iso-8859-1] Thu Feb 26 13:32:48 2009 @@ -41,7 +41,7 @@ if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IClassFactory)) { - *ppvObj = (LPVOID)iface; + *ppvObj = iface; IClassFactory_AddRef(iface); return S_OK; } Modified: trunk/reactos/dll/win32/objsel/objsel.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/objsel/objsel.c?…
============================================================================== --- trunk/reactos/dll/win32/objsel/objsel.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/objsel/objsel.c [iso-8859-1] Thu Feb 26 13:32:48 2009 @@ -72,7 +72,7 @@ /********************************************************************** * OBJSEL_IDsObjectPicker_Destroy (also IUnknown) */ -static VOID WINAPI OBJSEL_IDsObjectPicker_Destroy(IDsObjectPickerImpl *This) +static VOID OBJSEL_IDsObjectPicker_Destroy(IDsObjectPickerImpl *This) { HeapFree(GetProcessHeap(), 0, @@ -142,7 +142,7 @@ if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDsObjectPicker)) { - *ppvObj = (LPVOID)iface; + *ppvObj = iface; OBJSEL_IDsObjectPicker_AddRef(iface); return S_OK; } Modified: trunk/reactos/dll/win32/objsel/regsvr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/objsel/regsvr.c?…
============================================================================== --- trunk/reactos/dll/win32/objsel/regsvr.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/objsel/regsvr.c [iso-8859-1] Thu Feb 26 13:32:48 2009 @@ -34,6 +34,7 @@ #include "objsel.h" #include "wine/debug.h" +#include "wine/unicode.h" #include "initguid.h" @@ -168,7 +169,7 @@ KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR));
15 years, 10 months
1
0
0
0
[dchapyshev] 39764: - Sync rsaenh, shdocvw, shlwapi with Wine head
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Thu Feb 26 13:29:58 2009 New Revision: 39764 URL:
http://svn.reactos.org/svn/reactos?rev=39764&view=rev
Log: - Sync rsaenh, shdocvw, shlwapi with Wine head Modified: trunk/reactos/dll/win32/rsaenh/handle.c trunk/reactos/dll/win32/rsaenh/handle.h trunk/reactos/dll/win32/rsaenh/mpi.c trunk/reactos/dll/win32/rsaenh/rsaenh.c trunk/reactos/dll/win32/rsaenh/tomcrypt.h trunk/reactos/dll/win32/shdocvw/oleobject.c trunk/reactos/dll/win32/shlwapi/shlwapi.rc Modified: trunk/reactos/dll/win32/rsaenh/handle.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rsaenh/handle.c?…
============================================================================== --- trunk/reactos/dll/win32/rsaenh/handle.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rsaenh/handle.c [iso-8859-1] Thu Feb 26 13:29:58 2009 @@ -44,13 +44,10 @@ * lpTable [I] Pointer to the HANDLETABLE structure, which is to be initalized. * * NOTES - * Note that alloc_handle_table calls init_handle_table on it's own, which - * means that you only have to call init_handle_table, if you use a global - * variable of type HANDLETABLE for your handle table. However, in this - * case you have to call destroy_handle_table when you don't need the table + * You have to call destroy_handle_table when you don't need the table * any more. */ -void init_handle_table(HANDLETABLE *lpTable) +void init_handle_table(struct handle_table *lpTable) { TRACE("(lpTable=%p)\n", lpTable); @@ -68,11 +65,8 @@ * * PARAMS * lpTable [I] Pointer to the handle table, which is to be destroyed. - * - * NOTES - * Note that release_handle_table takes care of this. - */ -void destroy_handle_table(HANDLETABLE *lpTable) + */ +void destroy_handle_table(struct handle_table *lpTable) { TRACE("(lpTable=%p)\n", lpTable); @@ -96,7 +90,7 @@ * non zero, if handle is valid. * zero, if handle is not valid. */ -int is_valid_handle(HANDLETABLE *lpTable, HCRYPTKEY handle, DWORD dwType) +int is_valid_handle(struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType) { unsigned int index = HANDLE2INDEX(handle); int ret = 0; @@ -124,82 +118,6 @@ } /****************************************************************************** - * release_all_handles - * - * Releases all valid handles in the given handle table and shrinks the table - * to zero size. - * - * PARAMS - * lpTable [I] The table of which all valid handles shall be released. - */ -static void release_all_handles(HANDLETABLE *lpTable) -{ - unsigned int i; - - TRACE("(lpTable=%p)\n", lpTable); - - EnterCriticalSection(&lpTable->mutex); - for (i=0; i<lpTable->iEntries; i++) - if (lpTable->paEntries[i].pObject) - release_handle(lpTable, lpTable->paEntries[i].pObject->dwType, INDEX2HANDLE(i)); - LeaveCriticalSection(&lpTable->mutex); -} - -/****************************************************************************** - * alloc_handle_table - * - * Allocates a new handle table - * - * PARAMS - * lplpTable [O] Pointer to the variable, to which the pointer to the newly - * allocated handle table is written. - * RETURNS - * non zero, if successful - * zero, if not successful (out of process heap memory) - * - * NOTES - * If all you need is a single handle table, you may as well declare a global - * variable of type HANDLETABLE and call init_handle_table on your own. - */ -int alloc_handle_table(HANDLETABLE **lplpTable) -{ - TRACE("(lplpTable=%p)\n", lplpTable); - - *lplpTable = HeapAlloc(GetProcessHeap(), 0, sizeof(HANDLETABLE)); - if (*lplpTable) - { - init_handle_table(*lplpTable); - return 1; - } - else - return 0; -} - -/****************************************************************************** - * release_handle_table - * - * Releases a handle table and frees the resources it used. - * - * PARAMS - * lpTable [I] Pointer to the handle table, which is to be released. - * - * RETURNS - * non zero, if successful - * zero, if not successful - * - * NOTES - * All valid handles still in the table are released also. - */ -int release_handle_table(HANDLETABLE *lpTable) -{ - TRACE("(lpTable=%p)\n", lpTable); - - release_all_handles(lpTable); - destroy_handle_table(lpTable); - return HeapFree(GetProcessHeap(), 0, lpTable); -} - -/****************************************************************************** * grow_handle_table [Internal] * * Grows the number of entries in the given table by TABLE_SIZE_INCREMENT @@ -214,20 +132,20 @@ * NOTES * This is a support function for alloc_handle. Do not call! */ -static int grow_handle_table(HANDLETABLE *lpTable) -{ - HANDLETABLEENTRY *newEntries; +static int grow_handle_table(struct handle_table *lpTable) +{ + struct handle_table_entry *newEntries; unsigned int i, newIEntries; newIEntries = lpTable->iEntries + TABLE_SIZE_INCREMENT; - newEntries = HeapAlloc(GetProcessHeap(), 0, sizeof(HANDLETABLEENTRY)*newIEntries); + newEntries = HeapAlloc(GetProcessHeap(), 0, sizeof(struct handle_table_entry)*newIEntries); if (!newEntries) return 0; if (lpTable->paEntries) { - memcpy(newEntries, lpTable->paEntries, sizeof(HANDLETABLEENTRY)*lpTable->iEntries); + memcpy(newEntries, lpTable->paEntries, sizeof(struct handle_table_entry)*lpTable->iEntries); HeapFree(GetProcessHeap(), 0, lpTable->paEntries); } @@ -259,7 +177,7 @@ * non zero, if successful * zero, if not successful (no free handle) */ -static int alloc_handle(HANDLETABLE *lpTable, OBJECTHDR *lpObject, HCRYPTKEY *lpHandle) +static int alloc_handle(struct handle_table *lpTable, OBJECTHDR *lpObject, HCRYPTKEY *lpHandle) { int ret = 0; @@ -306,7 +224,7 @@ * non zero, if successful * zero, if not successful (invalid handle) */ -int release_handle(HANDLETABLE *lpTable, HCRYPTKEY handle, DWORD dwType) +int release_handle(struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType) { unsigned int index = HANDLE2INDEX(handle); OBJECTHDR *pObject; @@ -351,7 +269,7 @@ * non zero, if successful * zero, if not successful (invalid handle) */ -int lookup_handle(HANDLETABLE *lpTable, HCRYPTKEY handle, DWORD dwType, OBJECTHDR **lplpObject) +int lookup_handle(struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType, OBJECTHDR **lplpObject) { int ret = 0; @@ -386,7 +304,7 @@ * non zero, if successful * zero, if not successful (invalid handle or out of memory) */ -int copy_handle(HANDLETABLE *lpTable, HCRYPTKEY handle, DWORD dwType, HCRYPTKEY *copy) +int copy_handle(struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType, HCRYPTKEY *copy) { OBJECTHDR *pObject; int ret; @@ -429,7 +347,7 @@ * INVALID_HANDLE_VALUE, if something went wrong. * a handle to the new object, if successful. */ -HCRYPTKEY new_object(HANDLETABLE *lpTable, size_t cbSize, DWORD dwType, DESTRUCTOR destructor, +HCRYPTKEY new_object(struct handle_table *lpTable, size_t cbSize, DWORD dwType, DESTRUCTOR destructor, OBJECTHDR **ppObject) { OBJECTHDR *pObject; Modified: trunk/reactos/dll/win32/rsaenh/handle.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rsaenh/handle.h?…
============================================================================== --- trunk/reactos/dll/win32/rsaenh/handle.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rsaenh/handle.h [iso-8859-1] Thu Feb 26 13:29:58 2009 @@ -42,34 +42,28 @@ DESTRUCTOR destructor; }; -typedef struct tagHANDLETABLEENTRY +struct handle_table_entry { OBJECTHDR *pObject; unsigned int iNextFree; -} HANDLETABLEENTRY; +}; -/* Prevent conflict with wingdi.h */ -#define tagHANDLETABLE tagHANDLETABLE_RSA -#define HANDLETABLE HANDLETABLE_RSA - -typedef struct tagHANDLETABLE +struct handle_table { unsigned int iEntries; unsigned int iFirstFree; - HANDLETABLEENTRY *paEntries; + struct handle_table_entry *paEntries; CRITICAL_SECTION mutex; -} HANDLETABLE; +}; -int alloc_handle_table (HANDLETABLE **lplpTable); -void init_handle_table (HANDLETABLE *lpTable); -int release_handle_table(HANDLETABLE *lpTable); -void destroy_handle_table(HANDLETABLE *lpTable); -int release_handle (HANDLETABLE *lpTable, HCRYPTKEY handle, DWORD dwType); -int copy_handle (HANDLETABLE *lpTable, HCRYPTKEY handle, DWORD dwType, HCRYPTKEY *copy); -int lookup_handle (HANDLETABLE *lpTable, HCRYPTKEY handle, DWORD dwType, OBJECTHDR **lplpObject); -int is_valid_handle (HANDLETABLE *lpTable, HCRYPTKEY handle, DWORD dwType); +void init_handle_table (struct handle_table *lpTable); +void destroy_handle_table(struct handle_table *lpTable); +int release_handle (struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType); +int copy_handle (struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType, HCRYPTKEY *copy); +int lookup_handle (struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType, OBJECTHDR **lplpObject); +int is_valid_handle (struct handle_table *lpTable, HCRYPTKEY handle, DWORD dwType); -HCRYPTKEY new_object (HANDLETABLE *lpTable, size_t cbSize, DWORD dwType, DESTRUCTOR destructor, +HCRYPTKEY new_object (struct handle_table *lpTable, size_t cbSize, DWORD dwType, DESTRUCTOR destructor, OBJECTHDR **ppObject); #ifdef __cplusplus Modified: trunk/reactos/dll/win32/rsaenh/mpi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rsaenh/mpi.c?rev…
============================================================================== --- trunk/reactos/dll/win32/rsaenh/mpi.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rsaenh/mpi.c [iso-8859-1] Thu Feb 26 13:29:58 2009 @@ -29,6 +29,9 @@ */ #include <stdarg.h> + +#include "windef.h" +#include "winbase.h" #include "tomcrypt.h" /* Known optimal configurations @@ -51,6 +54,208 @@ static int mp_invmod_slow (const mp_int * a, mp_int * b, mp_int * c); static int mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c); static int mp_karatsuba_sqr(const mp_int *a, mp_int *b); + +/* grow as required */ +static int mp_grow (mp_int * a, int size) +{ + int i; + mp_digit *tmp; + + /* if the alloc size is smaller alloc more ram */ + if (a->alloc < size) { + /* ensure there are always at least MP_PREC digits extra on top */ + size += (MP_PREC * 2) - (size % MP_PREC); + + /* reallocate the array a->dp + * + * We store the return in a temporary variable + * in case the operation failed we don't want + * to overwrite the dp member of a. + */ + tmp = HeapReAlloc(GetProcessHeap(), 0, a->dp, sizeof (mp_digit) * size); + if (tmp == NULL) { + /* reallocation failed but "a" is still valid [can be freed] */ + return MP_MEM; + } + + /* reallocation succeeded so set a->dp */ + a->dp = tmp; + + /* zero excess digits */ + i = a->alloc; + a->alloc = size; + for (; i < a->alloc; i++) { + a->dp[i] = 0; + } + } + return MP_OKAY; +} + +/* b = a/2 */ +static int mp_div_2(const mp_int * a, mp_int * b) +{ + int x, res, oldused; + + /* copy */ + if (b->alloc < a->used) { + if ((res = mp_grow (b, a->used)) != MP_OKAY) { + return res; + } + } + + oldused = b->used; + b->used = a->used; + { + register mp_digit r, rr, *tmpa, *tmpb; + + /* source alias */ + tmpa = a->dp + b->used - 1; + + /* dest alias */ + tmpb = b->dp + b->used - 1; + + /* carry */ + r = 0; + for (x = b->used - 1; x >= 0; x--) { + /* get the carry for the next iteration */ + rr = *tmpa & 1; + + /* shift the current digit, add in carry and store */ + *tmpb-- = (*tmpa-- >> 1) | (r << (DIGIT_BIT - 1)); + + /* forward carry to next iteration */ + r = rr; + } + + /* zero excess digits */ + tmpb = b->dp + b->used; + for (x = b->used; x < oldused; x++) { + *tmpb++ = 0; + } + } + b->sign = a->sign; + mp_clamp (b); + return MP_OKAY; +} + +/* swap the elements of two integers, for cases where you can't simply swap the + * mp_int pointers around + */ +static void +mp_exch (mp_int * a, mp_int * b) +{ + mp_int t; + + t = *a; + *a = *b; + *b = t; +} + +/* init a new mp_int */ +static int mp_init (mp_int * a) +{ + int i; + + /* allocate memory required and clear it */ + a->dp = HeapAlloc(GetProcessHeap(), 0, sizeof (mp_digit) * MP_PREC); + if (a->dp == NULL) { + return MP_MEM; + } + + /* set the digits to zero */ + for (i = 0; i < MP_PREC; i++) { + a->dp[i] = 0; + } + + /* set the used to zero, allocated digits to the default precision + * and sign to positive */ + a->used = 0; + a->alloc = MP_PREC; + a->sign = MP_ZPOS; + + return MP_OKAY; +} + +/* init an mp_init for a given size */ +static int mp_init_size (mp_int * a, int size) +{ + int x; + + /* pad size so there are always extra digits */ + size += (MP_PREC * 2) - (size % MP_PREC); + + /* alloc mem */ + a->dp = HeapAlloc(GetProcessHeap(), 0, sizeof (mp_digit) * size); + if (a->dp == NULL) { + return MP_MEM; + } + + /* set the members */ + a->used = 0; + a->alloc = size; + a->sign = MP_ZPOS; + + /* zero the digits */ + for (x = 0; x < size; x++) { + a->dp[x] = 0; + } + + return MP_OKAY; +} + +/* clear one (frees) */ +static void +mp_clear (mp_int * a) +{ + int i; + + /* only do anything if a hasn't been freed previously */ + if (a->dp != NULL) { + /* first zero the digits */ + for (i = 0; i < a->used; i++) { + a->dp[i] = 0; + } + + /* free ram */ + HeapFree(GetProcessHeap(), 0, a->dp); + + /* reset members to make debugging easier */ + a->dp = NULL; + a->alloc = a->used = 0; + a->sign = MP_ZPOS; + } +} + +/* set to zero */ +static void +mp_zero (mp_int * a) +{ + a->sign = MP_ZPOS; + a->used = 0; + memset (a->dp, 0, sizeof (mp_digit) * a->alloc); +} + +/* b = |a| + * + * Simple function copies the input and fixes the sign to positive + */ +static int +mp_abs (const mp_int * a, mp_int * b) +{ + int res; + + /* copy a to b */ + if (a != b) { + if ((res = mp_copy (a, b)) != MP_OKAY) { + return res; + } + } + + /* force the sign of b to positive */ + b->sign = MP_ZPOS; + + return MP_OKAY; +} /* computes the modular inverse via binary extended euclidean algorithm, * that is c = 1/a mod b @@ -613,7 +818,7 @@ * Simple algorithm which zeroes the int, grows it then just sets one bit * as required. */ -int +static int mp_2expt (mp_int * a, int b) { int res; @@ -631,28 +836,6 @@ /* put the single bit in its place */ a->dp[b / DIGIT_BIT] = ((mp_digit)1) << (b % DIGIT_BIT); - - return MP_OKAY; -} - -/* b = |a| - * - * Simple function copies the input and fixes the sign to positive - */ -int -mp_abs (const mp_int * a, mp_int * b) -{ - int res; - - /* copy a to b */ - if (a != b) { - if ((res = mp_copy (a, b)) != MP_OKAY) { - return res; - } - } - - /* force the sign of b to positive */ - b->sign = MP_ZPOS; return MP_OKAY; } @@ -690,7 +873,7 @@ /* single digit addition */ -int +static int mp_add_d (mp_int * a, mp_digit b, mp_int * c) { int res, ix, oldused; @@ -799,30 +982,6 @@ } } -/* clear one (frees) */ -void -mp_clear (mp_int * a) -{ - int i; - - /* only do anything if a hasn't been freed previously */ - if (a->dp != NULL) { - /* first zero the digits */ - for (i = 0; i < a->used; i++) { - a->dp[i] = 0; - } - - /* free ram */ - free(a->dp); - - /* reset members to make debugging easier */ - a->dp = NULL; - a->alloc = a->used = 0; - a->sign = MP_ZPOS; - } -} - - void mp_clear_multi(mp_int *mp, ...) { mp_int* next_mp = mp; @@ -1016,6 +1175,333 @@ return r; } +/* calc a value mod 2**b */ +static int +mp_mod_2d (const mp_int * a, int b, mp_int * c) +{ + int x, res; + + /* if b is <= 0 then zero the int */ + if (b <= 0) { + mp_zero (c); + return MP_OKAY; + } + + /* if the modulus is larger than the value than return */ + if (b > a->used * DIGIT_BIT) { + res = mp_copy (a, c); + return res; + } + + /* copy */ + if ((res = mp_copy (a, c)) != MP_OKAY) { + return res; + } + + /* zero digits above the last digit of the modulus */ + for (x = (b / DIGIT_BIT) + ((b % DIGIT_BIT) == 0 ? 0 : 1); x < c->used; x++) { + c->dp[x] = 0; + } + /* clear the digit that is not completely outside/inside the modulus */ + c->dp[b / DIGIT_BIT] &= (1 << ((mp_digit)b % DIGIT_BIT)) - 1; + mp_clamp (c); + return MP_OKAY; +} + +/* shift right a certain amount of digits */ +static void mp_rshd (mp_int * a, int b) +{ + int x; + + /* if b <= 0 then ignore it */ + if (b <= 0) { + return; + } + + /* if b > used then simply zero it and return */ + if (a->used <= b) { + mp_zero (a); + return; + } + + { + register mp_digit *bottom, *top; + + /* shift the digits down */ + + /* bottom */ + bottom = a->dp; + + /* top [offset into digits] */ + top = a->dp + b; + + /* this is implemented as a sliding window where + * the window is b-digits long and digits from + * the top of the window are copied to the bottom + * + * e.g. + + b-2 | b-1 | b0 | b1 | b2 | ... | bb | ----> + /\ | ----> + \-------------------/ ----> + */ + for (x = 0; x < (a->used - b); x++) { + *bottom++ = *top++; + } + + /* zero the top digits */ + for (; x < a->used; x++) { + *bottom++ = 0; + } + } + + /* remove excess digits */ + a->used -= b; +} + +/* shift right by a certain bit count (store quotient in c, optional remainder in d) */ +static int mp_div_2d (const mp_int * a, int b, mp_int * c, mp_int * d) +{ + mp_digit D, r, rr; + int x, res; + mp_int t; + + + /* if the shift count is <= 0 then we do no work */ + if (b <= 0) { + res = mp_copy (a, c); + if (d != NULL) { + mp_zero (d); + } + return res; + } + + if ((res = mp_init (&t)) != MP_OKAY) { + return res; + } + + /* get the remainder */ + if (d != NULL) { + if ((res = mp_mod_2d (a, b, &t)) != MP_OKAY) { + mp_clear (&t); + return res; + } + } + + /* copy */ + if ((res = mp_copy (a, c)) != MP_OKAY) { + mp_clear (&t); + return res; + } + + /* shift by as many digits in the bit count */ + if (b >= DIGIT_BIT) { + mp_rshd (c, b / DIGIT_BIT); + } + + /* shift any bit count < DIGIT_BIT */ + D = (mp_digit) (b % DIGIT_BIT); + if (D != 0) { + register mp_digit *tmpc, mask, shift; + + /* mask */ + mask = (((mp_digit)1) << D) - 1; + + /* shift for lsb */ + shift = DIGIT_BIT - D; + + /* alias */ + tmpc = c->dp + (c->used - 1); + + /* carry */ + r = 0; + for (x = c->used - 1; x >= 0; x--) { + /* get the lower bits of this word in a temp */ + rr = *tmpc & mask; + + /* shift the current word and mix in the carry bits from the previous word */ + *tmpc = (*tmpc >> D) | (r << shift); + --tmpc; + + /* set the carry to the carry bits of the current word found above */ + r = rr; + } + } + mp_clamp (c); + if (d != NULL) { + mp_exch (&t, d); + } + mp_clear (&t); + return MP_OKAY; +} + +/* shift left a certain amount of digits */ +static int mp_lshd (mp_int * a, int b) +{ + int x, res; + + /* if its less than zero return */ + if (b <= 0) { + return MP_OKAY; + } + + /* grow to fit the new digits */ + if (a->alloc < a->used + b) { + if ((res = mp_grow (a, a->used + b)) != MP_OKAY) { + return res; + } + } + + { + register mp_digit *top, *bottom; + + /* increment the used by the shift amount then copy upwards */ + a->used += b; + + /* top */ + top = a->dp + a->used - 1; + + /* base */ + bottom = a->dp + a->used - 1 - b; + + /* much like mp_rshd this is implemented using a sliding window + * except the window goes the otherway around. Copying from + * the bottom to the top. see bn_mp_rshd.c for more info. + */ + for (x = a->used - 1; x >= b; x--) { + *top-- = *bottom--; + } + + /* zero the lower digits */ + top = a->dp; + for (x = 0; x < b; x++) { + *top++ = 0; + } + } + return MP_OKAY; +} + +/* shift left by a certain bit count */ +static int mp_mul_2d (const mp_int * a, int b, mp_int * c) +{ + mp_digit d; + int res; + + /* copy */ + if (a != c) { + if ((res = mp_copy (a, c)) != MP_OKAY) { + return res; + } + } + + if (c->alloc < c->used + b/DIGIT_BIT + 1) { + if ((res = mp_grow (c, c->used + b / DIGIT_BIT + 1)) != MP_OKAY) { + return res; + } + } + + /* shift by as many digits in the bit count */ + if (b >= DIGIT_BIT) { + if ((res = mp_lshd (c, b / DIGIT_BIT)) != MP_OKAY) { + return res; + } + } + + /* shift any bit count < DIGIT_BIT */ + d = (mp_digit) (b % DIGIT_BIT); + if (d != 0) { + register mp_digit *tmpc, shift, mask, r, rr; + register int x; + + /* bitmask for carries */ + mask = (((mp_digit)1) << d) - 1; + + /* shift for msbs */ + shift = DIGIT_BIT - d; + + /* alias */ + tmpc = c->dp; + + /* carry */ + r = 0; + for (x = 0; x < c->used; x++) { + /* get the higher bits of the current word */ + rr = (*tmpc >> shift) & mask; + + /* shift the current word and OR in the carry */ + *tmpc = ((*tmpc << d) | r) & MP_MASK; + ++tmpc; + + /* set the carry to the carry bits of the current word */ + r = rr; + } + + /* set final carry */ + if (r != 0) { + c->dp[(c->used)++] = r; + } + } + mp_clamp (c); + return MP_OKAY; +} + +/* multiply by a digit */ +static int +mp_mul_d (const mp_int * a, mp_digit b, mp_int * c) +{ + mp_digit u, *tmpa, *tmpc; + mp_word r; + int ix, res, olduse; + + /* make sure c is big enough to hold a*b */ + if (c->alloc < a->used + 1) { + if ((res = mp_grow (c, a->used + 1)) != MP_OKAY) { + return res; + } + } + + /* get the original destinations used count */ + olduse = c->used; + + /* set the sign */ + c->sign = a->sign; + + /* alias for a->dp [source] */ + tmpa = a->dp; + + /* alias for c->dp [dest] */ + tmpc = c->dp; + + /* zero carry */ + u = 0; + + /* compute columns */ + for (ix = 0; ix < a->used; ix++) { + /* compute product and carry sum for this term */ + r = ((mp_word) u) + ((mp_word)*tmpa++) * ((mp_word)b); + + /* mask off higher bits to get a single digit */ + *tmpc++ = (mp_digit) (r & ((mp_word) MP_MASK)); + + /* send carry into next iteration */ + u = (mp_digit) (r >> ((mp_word) DIGIT_BIT)); + } + + /* store final carry [if any] */ + *tmpc++ = u; + + /* now zero digits above the top */ + while (ix++ < olduse) { + *tmpc++ = 0; + } + + /* set used count */ + c->used = a->used + 1; + mp_clamp(c); + + return MP_OKAY; +} + /* integer signed division. * c*b + d == a [e.g. a/b, c=quotient, d=remainder] * HAC pp.598 Algorithm 14.20 @@ -1029,7 +1515,7 @@ * The overall algorithm is as described as * 14.20 from HAC but fixed to treat these cases. */ -int mp_div (const mp_int * a, const mp_int * b, mp_int * c, mp_int * d) +static int mp_div (const mp_int * a, const mp_int * b, mp_int * c, mp_int * d) { mp_int q, x, y, t1, t2; int res, n, t, i, norm, neg; @@ -1212,129 +1698,6 @@ return res; } -/* b = a/2 */ -int mp_div_2(const mp_int * a, mp_int * b) -{ - int x, res, oldused; - - /* copy */ - if (b->alloc < a->used) { - if ((res = mp_grow (b, a->used)) != MP_OKAY) { - return res; - } - } - - oldused = b->used; - b->used = a->used; - { - register mp_digit r, rr, *tmpa, *tmpb; - - /* source alias */ - tmpa = a->dp + b->used - 1; - - /* dest alias */ - tmpb = b->dp + b->used - 1; - - /* carry */ - r = 0; - for (x = b->used - 1; x >= 0; x--) { - /* get the carry for the next iteration */ - rr = *tmpa & 1; - - /* shift the current digit, add in carry and store */ - *tmpb-- = (*tmpa-- >> 1) | (r << (DIGIT_BIT - 1)); - - /* forward carry to next iteration */ - r = rr; - } - - /* zero excess digits */ - tmpb = b->dp + b->used; - for (x = b->used; x < oldused; x++) { - *tmpb++ = 0; - } - } - b->sign = a->sign; - mp_clamp (b); - return MP_OKAY; -} - -/* shift right by a certain bit count (store quotient in c, optional remainder in d) */ -int mp_div_2d (const mp_int * a, int b, mp_int * c, mp_int * d) -{ - mp_digit D, r, rr; - int x, res; - mp_int t; - - - /* if the shift count is <= 0 then we do no work */ - if (b <= 0) { - res = mp_copy (a, c); - if (d != NULL) { - mp_zero (d); - } - return res; - } - - if ((res = mp_init (&t)) != MP_OKAY) { - return res; - } - - /* get the remainder */ - if (d != NULL) { - if ((res = mp_mod_2d (a, b, &t)) != MP_OKAY) { - mp_clear (&t); - return res; - } - } - - /* copy */ - if ((res = mp_copy (a, c)) != MP_OKAY) { - mp_clear (&t); - return res; - } - - /* shift by as many digits in the bit count */ - if (b >= DIGIT_BIT) { - mp_rshd (c, b / DIGIT_BIT); - } - - /* shift any bit count < DIGIT_BIT */ - D = (mp_digit) (b % DIGIT_BIT); - if (D != 0) { - register mp_digit *tmpc, mask, shift; - - /* mask */ - mask = (((mp_digit)1) << D) - 1; - - /* shift for lsb */ - shift = DIGIT_BIT - D; - - /* alias */ - tmpc = c->dp + (c->used - 1); - - /* carry */ - r = 0; - for (x = c->used - 1; x >= 0; x--) { - /* get the lower bits of this word in a temp */ - rr = *tmpc & mask; - - /* shift the current word and mix in the carry bits from the previous word */ - *tmpc = (*tmpc >> D) | (r << shift); - --tmpc; - - /* set the carry to the carry bits of the current word found above */ - r = rr; - } - } - mp_clamp (c); - if (d != NULL) { - mp_exch (&t, d); - } - mp_clear (&t); - return MP_OKAY; -} - static int s_is_power_of_two(mp_digit b, int *p) { int x; @@ -1349,7 +1712,7 @@ } /* single digit division (based on routine from MPI) */ -int mp_div_d (const mp_int * a, mp_digit b, mp_int * c, mp_digit * d) +static int mp_div_d (const mp_int * a, mp_digit b, mp_int * c, mp_digit * d) { mp_int q; mp_word w; @@ -1430,7 +1793,7 @@ * * Input x must be in the range 0 <= x <= (n-1)**2 */ -int +static int mp_dr_reduce (mp_int * x, const mp_int * n, mp_digit k) { int err, i, m; @@ -1489,27 +1852,14 @@ return MP_OKAY; } -/* determines the setup value */ -void mp_dr_setup(const mp_int *a, mp_digit *d) +/* sets the value of "d" required for mp_dr_reduce */ +static void mp_dr_setup(const mp_int *a, mp_digit *d) { /* the casts are required if DIGIT_BIT is one less than * the number of bits in a mp_digit [e.g. DIGIT_BIT==31] */ *d = (mp_digit)((((mp_word)1) << ((mp_word)DIGIT_BIT)) - ((mp_word)a->dp[0])); -} - -/* swap the elements of two integers, for cases where you can't simply swap the - * mp_int pointers around - */ -void -mp_exch (mp_int * a, mp_int * b) -{ - mp_int t; - - t = *a; - *a = *b; - *b = t; } /* this is a shell function that calls either the normal or Montgomery @@ -1941,67 +2291,6 @@ /* force result to 32-bits always so it is consistent on non 32-bit platforms */ return res & 0xFFFFFFFFUL; -} - -/* grow as required */ -int mp_grow (mp_int * a, int size) -{ - int i; - mp_digit *tmp; - - /* if the alloc size is smaller alloc more ram */ - if (a->alloc < size) { - /* ensure there are always at least MP_PREC digits extra on top */ - size += (MP_PREC * 2) - (size % MP_PREC); - - /* reallocate the array a->dp - * - * We store the return in a temporary variable - * in case the operation failed we don't want - * to overwrite the dp member of a. - */ - tmp = realloc (a->dp, sizeof (mp_digit) * size); - if (tmp == NULL) { - /* reallocation failed but "a" is still valid [can be freed] */ - return MP_MEM; - } - - /* reallocation succeeded so set a->dp */ - a->dp = tmp; - - /* zero excess digits */ - i = a->alloc; - a->alloc = size; - for (; i < a->alloc; i++) { - a->dp[i] = 0; - } - } - return MP_OKAY; -} - -/* init a new mp_int */ -int mp_init (mp_int * a) -{ - int i; - - /* allocate memory required and clear it */ - a->dp = malloc (sizeof (mp_digit) * MP_PREC); - if (a->dp == NULL) { - return MP_MEM; - } - - /* set the digits to zero */ - for (i = 0; i < MP_PREC; i++) { - a->dp[i] = 0; - } - - /* set the used to zero, allocated digits to the default precision - * and sign to positive */ - a->used = 0; - a->alloc = MP_PREC; - a->sign = MP_ZPOS; - - return MP_OKAY; } /* creates "a" then copies b into it */ @@ -2051,33 +2340,6 @@ return res; /* Assumed ok, if error flagged above. */ } -/* init an mp_init for a given size */ -int mp_init_size (mp_int * a, int size) -{ - int x; - - /* pad size so there are always extra digits */ - size += (MP_PREC * 2) - (size % MP_PREC); - - /* alloc mem */ - a->dp = malloc (sizeof (mp_digit) * size); - if (a->dp == NULL) { - return MP_MEM; - } - - /* set the members */ - a->used = 0; - a->alloc = size; - a->sign = MP_ZPOS; - - /* zero the digits */ - for (x = 0; x < size; x++) { - a->dp[x] = 0; - } - - return MP_OKAY; -} - /* hac 14.61, pp608 */ int mp_invmod (const mp_int * a, mp_int * b, mp_int * c) { @@ -2533,52 +2795,6 @@ return res; } -/* shift left a certain amount of digits */ -int mp_lshd (mp_int * a, int b) -{ - int x, res; - - /* if its less than zero return */ - if (b <= 0) { - return MP_OKAY; - } - - /* grow to fit the new digits */ - if (a->alloc < a->used + b) { - if ((res = mp_grow (a, a->used + b)) != MP_OKAY) { - return res; - } - } - - { - register mp_digit *top, *bottom; - - /* increment the used by the shift amount then copy upwards */ - a->used += b; - - /* top */ - top = a->dp + a->used - 1; - - /* base */ - bottom = a->dp + a->used - 1 - b; - - /* much like mp_rshd this is implemented using a sliding window - * except the window goes the otherway around. Copying from - * the bottom to the top. see bn_mp_rshd.c for more info. - */ - for (x = a->used - 1; x >= b; x--) { - *top-- = *bottom--; - } - - /* zero the lower digits */ - top = a->dp; - for (x = 0; x < b; x++) { - *top++ = 0; - } - } - return MP_OKAY; -} - /* c = a mod b, 0 <= c < b */ int mp_mod (const mp_int * a, mp_int * b, mp_int * c) @@ -2606,43 +2822,71 @@ return res; } -/* calc a value mod 2**b */ -int -mp_mod_2d (const mp_int * a, int b, mp_int * c) -{ - int x, res; - - /* if b is <= 0 then zero the int */ - if (b <= 0) { - mp_zero (c); - return MP_OKAY; - } - - /* if the modulus is larger than the value than return */ - if (b > a->used * DIGIT_BIT) { - res = mp_copy (a, c); - return res; - } - - /* copy */ - if ((res = mp_copy (a, c)) != MP_OKAY) { - return res; - } - - /* zero digits above the last digit of the modulus */ - for (x = (b / DIGIT_BIT) + ((b % DIGIT_BIT) == 0 ? 0 : 1); x < c->used; x++) { - c->dp[x] = 0; - } - /* clear the digit that is not completely outside/inside the modulus */ - c->dp[b / DIGIT_BIT] &= (1 << ((mp_digit)b % DIGIT_BIT)) - 1; - mp_clamp (c); +static int +mp_mod_d (const mp_int * a, mp_digit b, mp_digit * c) +{ + return mp_div_d(a, b, NULL, c); +} + +/* b = a*2 */ +static int mp_mul_2(const mp_int * a, mp_int * b) +{ + int x, res, oldused; + + /* grow to accommodate result */ + if (b->alloc < a->used + 1) { + if ((res = mp_grow (b, a->used + 1)) != MP_OKAY) { + return res; + } + } + + oldused = b->used; + b->used = a->used; + + { + register mp_digit r, rr, *tmpa, *tmpb; + + /* alias for source */ + tmpa = a->dp; + + /* alias for dest */ + tmpb = b->dp; + + /* carry */ + r = 0; + for (x = 0; x < a->used; x++) { + + /* get what will be the *next* carry bit from the + * MSB of the current digit + */ + rr = *tmpa >> ((mp_digit)(DIGIT_BIT - 1)); + + /* now shift up this digit, add in the carry [from the previous] */ + *tmpb++ = ((*tmpa++ << ((mp_digit)1)) | r) & MP_MASK; + + /* copy the carry that would be from the source + * digit into the next iteration + */ + r = rr; + } + + /* new leading digit? */ + if (r != 0) { + /* add a MSB which is always 1 at this point */ + *tmpb = 1; + ++(b->used); + } + + /* now zero any excess digits on the destination + * that we didn't write to + */ + tmpb = b->dp + b->used; + for (x = b->used; x < oldused; x++) { + *tmpb++ = 0; + } + } + b->sign = a->sign; return MP_OKAY; -} - -int -mp_mod_d (const mp_int * a, mp_digit b, mp_digit * c) -{ - return mp_div_d(a, b, NULL, c); } /* @@ -2842,188 +3086,6 @@ return res; } -/* b = a*2 */ -int mp_mul_2(const mp_int * a, mp_int * b) -{ - int x, res, oldused; - - /* grow to accommodate result */ - if (b->alloc < a->used + 1) { - if ((res = mp_grow (b, a->used + 1)) != MP_OKAY) { - return res; - } - } - - oldused = b->used; - b->used = a->used; - - { - register mp_digit r, rr, *tmpa, *tmpb; - - /* alias for source */ - tmpa = a->dp; - - /* alias for dest */ - tmpb = b->dp; - - /* carry */ - r = 0; - for (x = 0; x < a->used; x++) { - - /* get what will be the *next* carry bit from the - * MSB of the current digit - */ - rr = *tmpa >> ((mp_digit)(DIGIT_BIT - 1)); - - /* now shift up this digit, add in the carry [from the previous] */ - *tmpb++ = ((*tmpa++ << ((mp_digit)1)) | r) & MP_MASK; - - /* copy the carry that would be from the source - * digit into the next iteration - */ - r = rr; - } - - /* new leading digit? */ - if (r != 0) { - /* add a MSB which is always 1 at this point */ - *tmpb = 1; - ++(b->used); - } - - /* now zero any excess digits on the destination - * that we didn't write to - */ - tmpb = b->dp + b->used; - for (x = b->used; x < oldused; x++) { - *tmpb++ = 0; - } - } - b->sign = a->sign; - return MP_OKAY; -} - -/* shift left by a certain bit count */ -int mp_mul_2d (const mp_int * a, int b, mp_int * c) -{ - mp_digit d; - int res; - - /* copy */ - if (a != c) { - if ((res = mp_copy (a, c)) != MP_OKAY) { - return res; - } - } - - if (c->alloc < c->used + b/DIGIT_BIT + 1) { - if ((res = mp_grow (c, c->used + b / DIGIT_BIT + 1)) != MP_OKAY) { - return res; - } - } - - /* shift by as many digits in the bit count */ - if (b >= DIGIT_BIT) { - if ((res = mp_lshd (c, b / DIGIT_BIT)) != MP_OKAY) { - return res; - } - } - - /* shift any bit count < DIGIT_BIT */ - d = (mp_digit) (b % DIGIT_BIT); - if (d != 0) { - register mp_digit *tmpc, shift, mask, r, rr; - register int x; - - /* bitmask for carries */ - mask = (((mp_digit)1) << d) - 1; - - /* shift for msbs */ - shift = DIGIT_BIT - d; - - /* alias */ - tmpc = c->dp; - - /* carry */ - r = 0; - for (x = 0; x < c->used; x++) { - /* get the higher bits of the current word */ - rr = (*tmpc >> shift) & mask; - - /* shift the current word and OR in the carry */ - *tmpc = ((*tmpc << d) | r) & MP_MASK; - ++tmpc; - - /* set the carry to the carry bits of the current word */ - r = rr; - } - - /* set final carry */ - if (r != 0) { - c->dp[(c->used)++] = r; - } - } - mp_clamp (c); - return MP_OKAY; -} - -/* multiply by a digit */ -int -mp_mul_d (const mp_int * a, mp_digit b, mp_int * c) -{ - mp_digit u, *tmpa, *tmpc; - mp_word r; - int ix, res, olduse; - - /* make sure c is big enough to hold a*b */ - if (c->alloc < a->used + 1) { - if ((res = mp_grow (c, a->used + 1)) != MP_OKAY) { - return res; - } - } - - /* get the original destinations used count */ - olduse = c->used; - - /* set the sign */ - c->sign = a->sign; - - /* alias for a->dp [source] */ - tmpa = a->dp; - - /* alias for c->dp [dest] */ - tmpc = c->dp; - - /* zero carry */ - u = 0; - - /* compute columns */ - for (ix = 0; ix < a->used; ix++) { - /* compute product and carry sum for this term */ - r = ((mp_word) u) + ((mp_word)*tmpa++) * ((mp_word)b); - - /* mask off higher bits to get a single digit */ - *tmpc++ = (mp_digit) (r & ((mp_word) MP_MASK)); - - /* send carry into next iteration */ - u = (mp_digit) (r >> ((mp_word) DIGIT_BIT)); - } - - /* store final carry [if any] */ - *tmpc++ = u; - - /* now zero digits above the top */ - while (ix++ < olduse) { - *tmpc++ = 0; - } - - /* set used count */ - c->used = a->used + 1; - mp_clamp(c); - - return MP_OKAY; -} - /* d = a * b (mod c) */ int mp_mulmod (const mp_int * a, const mp_int * b, mp_int * c, mp_int * d) @@ -3088,7 +3150,7 @@ * * sets result to 0 if not, 1 if yes */ -int mp_prime_is_divisible (const mp_int * a, int *result) +static int mp_prime_is_divisible (const mp_int * a, int *result) { int err, ix; mp_digit res; @@ -3112,68 +3174,6 @@ return MP_OKAY; } -/* performs a variable number of rounds of Miller-Rabin - * - * Probability of error after t rounds is no more than - - * - * Sets result to 1 if probably prime, 0 otherwise - */ -int mp_prime_is_prime (mp_int * a, int t, int *result) -{ - mp_int b; - int ix, err, res; - - /* default to no */ - *result = MP_NO; - - /* valid value of t? */ - if (t <= 0 || t > PRIME_SIZE) { - return MP_VAL; - } - - /* is the input equal to one of the primes in the table? */ - for (ix = 0; ix < PRIME_SIZE; ix++) { - if (mp_cmp_d(a, __prime_tab[ix]) == MP_EQ) { - *result = 1; - return MP_OKAY; - } - } - - /* first perform trial division */ - if ((err = mp_prime_is_divisible (a, &res)) != MP_OKAY) { - return err; - } - - /* return if it was trivially divisible */ - if (res == MP_YES) { - return MP_OKAY; - } - - /* now perform the miller-rabin rounds */ - if ((err = mp_init (&b)) != MP_OKAY) { - return err; - } - - for (ix = 0; ix < t; ix++) { - /* set the prime */ - mp_set (&b, __prime_tab[ix]); - - if ((err = mp_prime_miller_rabin (a, &b, &res)) != MP_OKAY) { - goto __B; - } - - if (res == MP_NO) { - goto __B; - } - } - - /* passed the test */ - *result = MP_YES; -__B:mp_clear (&b); - return err; -} - /* Miller-Rabin test of "a" to the base of "b" as described in * HAC pp. 139 Algorithm 4.24 * @@ -3181,7 +3181,7 @@ * Randomly the chance of error is no more than 1/4 and often * very much lower. */ -int mp_prime_miller_rabin (mp_int * a, const mp_int * b, int *result) +static int mp_prime_miller_rabin (mp_int * a, const mp_int * b, int *result) { mp_int n1, y, r; int s, j, err; @@ -3253,6 +3253,68 @@ __Y:mp_clear (&y); __R:mp_clear (&r); __N1:mp_clear (&n1); + return err; +} + +/* performs a variable number of rounds of Miller-Rabin + * + * Probability of error after t rounds is no more than + + * + * Sets result to 1 if probably prime, 0 otherwise + */ +static int mp_prime_is_prime (mp_int * a, int t, int *result) +{ + mp_int b; + int ix, err, res; + + /* default to no */ + *result = MP_NO; + + /* valid value of t? */ + if (t <= 0 || t > PRIME_SIZE) { + return MP_VAL; + } + + /* is the input equal to one of the primes in the table? */ + for (ix = 0; ix < PRIME_SIZE; ix++) { + if (mp_cmp_d(a, __prime_tab[ix]) == MP_EQ) { + *result = 1; + return MP_OKAY; + } + } + + /* first perform trial division */ + if ((err = mp_prime_is_divisible (a, &res)) != MP_OKAY) { + return err; + } + + /* return if it was trivially divisible */ + if (res == MP_YES) { + return MP_OKAY; + } + + /* now perform the miller-rabin rounds */ + if ((err = mp_init (&b)) != MP_OKAY) { + return err; + } + + for (ix = 0; ix < t; ix++) { + /* set the prime */ + mp_set (&b, __prime_tab[ix]); + + if ((err = mp_prime_miller_rabin (a, &b, &res)) != MP_OKAY) { + goto __B; + } + + if (res == MP_NO) { + goto __B; + } + } + + /* passed the test */ + *result = MP_YES; +__B:mp_clear (&b); return err; } @@ -3319,7 +3381,7 @@ bsize = (size>>3)+((size&7)?1:0); /* we need a buffer of bsize bytes */ - tmp = malloc(bsize); + tmp = HeapAlloc(GetProcessHeap(), 0, bsize); if (tmp == NULL) { return MP_MEM; } @@ -3384,7 +3446,7 @@ err = MP_OKAY; error: - free(tmp); + HeapFree(GetProcessHeap(), 0, tmp); return err; } @@ -3566,57 +3628,6 @@ return mp_div (a, b, a, NULL); } -/* shift right a certain amount of digits */ -void mp_rshd (mp_int * a, int b) -{ - int x; - - /* if b <= 0 then ignore it */ - if (b <= 0) { - return; - } - - /* if b > used then simply zero it and return */ - if (a->used <= b) { - mp_zero (a); - return; - } - - { - register mp_digit *bottom, *top; - - /* shift the digits down */ - - /* bottom */ - bottom = a->dp; - - /* top [offset into digits] */ - top = a->dp + b; - - /* this is implemented as a sliding window where - * the window is b-digits long and digits from - * the top of the window are copied to the bottom - * - * e.g. - - b-2 | b-1 | b0 | b1 | b2 | ... | bb | ----> - /\ | ----> - \-------------------/ ----> - */ - for (x = 0; x < (a->used - b); x++) { - *bottom++ = *top++; - } - - /* zero the top digits */ - for (; x < a->used; x++) { - *bottom++ = 0; - } - } - - /* remove excess digits */ - a->used -= b; -} - /* set to a digit */ void mp_set (mp_int * a, mp_digit b) { @@ -3657,7 +3668,7 @@ { mp_digit *tmp; if (a->alloc != a->used && a->used > 0) { - if ((tmp = realloc (a->dp, sizeof (mp_digit) * a->used)) == NULL) { + if ((tmp = HeapReAlloc(GetProcessHeap(), 0, a->dp, sizeof (mp_digit) * a->used)) == NULL) { return MP_MEM; } a->dp = tmp; @@ -3850,15 +3861,6 @@ return (size / 8 + ((size & 7) != 0 ? 1 : 0)); } -/* set to zero */ -void -mp_zero (mp_int * a) -{ - a->sign = MP_ZPOS; - a->used = 0; - memset (a->dp, 0, sizeof (mp_digit) * a->alloc); -} - /* reverse an array, used for radix code */ static void bn_reverse (unsigned char *s, int len) Modified: trunk/reactos/dll/win32/rsaenh/rsaenh.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rsaenh/rsaenh.c?…
============================================================================== --- trunk/reactos/dll/win32/rsaenh/rsaenh.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rsaenh/rsaenh.c [iso-8859-1] Thu Feb 26 13:29:58 2009 @@ -34,9 +34,9 @@ #include "winbase.h" #include "winreg.h" #include "wincrypt.h" -#include "objbase.h" #include "handle.h" #include "implglue.h" +#include "objbase.h" WINE_DEFAULT_DEBUG_CHANNEL(crypt); @@ -311,24 +311,23 @@ HCRYPTHASH hHash ); -BOOL WINAPI -RSAENH_CPExportKey( - HCRYPTPROV hProv, - HCRYPTKEY hKey, +static BOOL crypt_export_key( + CRYPTKEY *pCryptKey, HCRYPTKEY hPubKey, DWORD dwBlobType, DWORD dwFlags, + BOOL force, BYTE *pbData, DWORD *pdwDataLen ); -BOOL WINAPI -RSAENH_CPImportKey( +static BOOL import_key( HCRYPTPROV hProv, CONST BYTE *pbData, DWORD dwDataLen, HCRYPTKEY hPubKey, DWORD dwFlags, + BOOL fStoreKey, HCRYPTKEY *phKey ); @@ -344,7 +343,7 @@ /****************************************************************************** * CSP's handle table (used by all acquired key containers) */ -static HANDLETABLE handle_table; +static struct handle_table handle_table; /****************************************************************************** * DllMain (RSAENH.@) @@ -755,7 +754,8 @@ * hProv [I] Handle to the provider to which the created key will belong. * aiAlgid [I] The new key shall use the crypto algorithm idenfied by aiAlgid. * dwFlags [I] Upper 16 bits give the key length. - * Lower 16 bits: CRYPT_CREATE_SALT, CRYPT_NO_SALT + * Lower 16 bits: CRYPT_EXPORTABLE, CRYPT_CREATE_SALT, + * CRYPT_NO_SALT * ppCryptKey [O] Pointer to the created key * * RETURNS @@ -836,6 +836,8 @@ pCryptKey->dwModeBits = 0; pCryptKey->dwPermissions = CRYPT_ENCRYPT | CRYPT_DECRYPT | CRYPT_READ | CRYPT_WRITE | CRYPT_MAC; + if (dwFlags & CRYPT_EXPORTABLE) + pCryptKey->dwPermissions |= CRYPT_EXPORT; pCryptKey->dwKeyLen = dwKeyLen >> 3; pCryptKey->dwEffectiveKeyLen = 0; if ((dwFlags & CRYPT_CREATE_SALT) || (dwKeyLen == 40 && !(dwFlags & CRYPT_NO_SALT))) @@ -888,6 +890,37 @@ } /****************************************************************************** + * map_key_spec_to_key_pair_name [Internal] + * + * Returns the name of the registry value associated with a key spec. + * + * PARAMS + * dwKeySpec [I] AT_KEYEXCHANGE or AT_SIGNATURE + * + * RETURNS + * Success: Name of registry value. + * Failure: NULL + */ +static LPCSTR map_key_spec_to_key_pair_name(DWORD dwKeySpec) +{ + LPCSTR szValueName; + + switch (dwKeySpec) + { + case AT_KEYEXCHANGE: + szValueName = "KeyExchangeKeyPair"; + break; + case AT_SIGNATURE: + szValueName = "SignatureKeyPair"; + break; + default: + WARN("invalid key spec %d\n", dwKeySpec); + szValueName = NULL; + } + return szValueName; +} + +/****************************************************************************** * store_key_pair [Internal] * * Stores a key pair to the registry @@ -895,27 +928,29 @@ * PARAMS * hCryptKey [I] Handle to the key to be stored * hKey [I] Registry key where the key pair is to be stored - * szValueName [I] Registry value where key pair's value is to be stored + * dwKeySpec [I] AT_KEYEXCHANGE or AT_SIGNATURE * dwFlags [I] Flags for protecting the key */ -static void store_key_pair(HCRYPTKEY hCryptKey, HKEY hKey, LPCSTR szValueName, DWORD dwFlags) -{ +static void store_key_pair(HCRYPTKEY hCryptKey, HKEY hKey, DWORD dwKeySpec, DWORD dwFlags) +{ + LPCSTR szValueName; DATA_BLOB blobIn, blobOut; CRYPTKEY *pKey; DWORD dwLen; BYTE *pbKey; + if (!(szValueName = map_key_spec_to_key_pair_name(dwKeySpec))) + return; if (lookup_handle(&handle_table, hCryptKey, RSAENH_MAGIC_KEY, (OBJECTHDR**)&pKey)) { - if (RSAENH_CPExportKey(pKey->hProv, hCryptKey, 0, PRIVATEKEYBLOB, 0, 0, - &dwLen)) + if (crypt_export_key(pKey, 0, PRIVATEKEYBLOB, 0, TRUE, 0, &dwLen)) { pbKey = HeapAlloc(GetProcessHeap(), 0, dwLen); if (pbKey) { - if (RSAENH_CPExportKey(pKey->hProv, hCryptKey, 0, - PRIVATEKEYBLOB, 0, pbKey, &dwLen)) + if (crypt_export_key(pKey, 0, PRIVATEKEYBLOB, 0, TRUE, pbKey, + &dwLen)) { blobIn.pbData = pbKey; blobIn.cbData = dwLen; @@ -931,8 +966,63 @@ HeapFree(GetProcessHeap(), 0, pbKey); } } - release_handle(&handle_table, hCryptKey, RSAENH_MAGIC_KEY); - } + } +} + +/****************************************************************************** + * map_key_spec_to_permissions_name [Internal] + * + * Returns the name of the registry value associated with the permissions for + * a key spec. + * + * PARAMS + * dwKeySpec [I] AT_KEYEXCHANGE or AT_SIGNATURE + * + * RETURNS + * Success: Name of registry value. + * Failure: NULL + */ +static LPCSTR map_key_spec_to_permissions_name(DWORD dwKeySpec) +{ + LPCSTR szValueName; + + switch (dwKeySpec) + { + case AT_KEYEXCHANGE: + szValueName = "KeyExchangePermissions"; + break; + case AT_SIGNATURE: + szValueName = "SignaturePermissions"; + break; + default: + WARN("invalid key spec %d\n", dwKeySpec); + szValueName = NULL; + } + return szValueName; +} + +/****************************************************************************** + * store_key_permissions [Internal] + * + * Stores a key's permissions to the registry + * + * PARAMS + * hCryptKey [I] Handle to the key whose permissions are to be stored + * hKey [I] Registry key where the key permissions are to be stored + * dwKeySpec [I] AT_KEYEXCHANGE or AT_SIGNATURE + */ +static void store_key_permissions(HCRYPTKEY hCryptKey, HKEY hKey, DWORD dwKeySpec) +{ + LPCSTR szValueName; + CRYPTKEY *pKey; + + if (!(szValueName = map_key_spec_to_permissions_name(dwKeySpec))) + return; + if (lookup_handle(&handle_table, hCryptKey, RSAENH_MAGIC_KEY, + (OBJECTHDR**)&pKey)) + RegSetValueExA(hKey, szValueName, 0, REG_DWORD, + (BYTE *)&pKey->dwPermissions, + sizeof(pKey->dwPermissions)); } /****************************************************************************** @@ -1051,14 +1141,63 @@ if (create_container_key(pKeyContainer, KEY_WRITE, &hKey)) { store_key_pair(pKeyContainer->hKeyExchangeKeyPair, hKey, - "KeyExchangeKeyPair", dwFlags); + AT_KEYEXCHANGE, dwFlags); store_key_pair(pKeyContainer->hSignatureKeyPair, hKey, - "SignatureKeyPair", dwFlags); + AT_SIGNATURE, dwFlags); RegCloseKey(hKey); } } /****************************************************************************** + * store_key_container_permissions [Internal] + * + * Stores key container's key permissions in a persistent location. + * + * PARAMS + * pKeyContainer [I] Pointer to the key container whose key permissions are to + * be saved + */ +static void store_key_container_permissions(KEYCONTAINER *pKeyContainer) +{ + HKEY hKey; + DWORD dwFlags; + + /* On WinXP, persistent keys are stored in a file located at: + * $AppData$\\Microsoft\\Crypto\\RSA\\$SID$\\some_hex_string + */ + + if (pKeyContainer->dwFlags & CRYPT_MACHINE_KEYSET) + dwFlags = CRYPTPROTECT_LOCAL_MACHINE; + else + dwFlags = 0; + + if (create_container_key(pKeyContainer, KEY_WRITE, &hKey)) + { + store_key_permissions(pKeyContainer->hKeyExchangeKeyPair, hKey, + AT_KEYEXCHANGE); + store_key_permissions(pKeyContainer->hSignatureKeyPair, hKey, + AT_SIGNATURE); + RegCloseKey(hKey); + } +} + +/****************************************************************************** + * release_key_container_keys [Internal] + * + * Releases key container's keys. + * + * PARAMS + * pKeyContainer [I] Pointer to the key container whose keys are to be released. + */ +static void release_key_container_keys(KEYCONTAINER *pKeyContainer) +{ + release_handle(&handle_table, pKeyContainer->hKeyExchangeKeyPair, + RSAENH_MAGIC_KEY); + release_handle(&handle_table, pKeyContainer->hSignatureKeyPair, + RSAENH_MAGIC_KEY); +} + +/****************************************************************************** * destroy_key_container [Internal] * * Destructor for key containers. @@ -1071,7 +1210,11 @@ KEYCONTAINER *pKeyContainer = (KEYCONTAINER*)pObjectHdr; if (!(pKeyContainer->dwFlags & CRYPT_VERIFYCONTEXT)) + { store_key_container_keys(pKeyContainer); + store_key_container_permissions(pKeyContainer); + release_key_container_keys(pKeyContainer); + } HeapFree( GetProcessHeap(), 0, pKeyContainer ); } @@ -1139,17 +1282,20 @@ * PARAMS * hKeyContainer [I] Crypt provider to use to import the key * hKey [I] Registry key from which to read the key pair - * szValueName [I] Registry value from which to read the key pair's value + * dwKeySpec [I] AT_KEYEXCHANGE or AT_SIGNATURE * dwFlags [I] Flags for unprotecting the key * phCryptKey [O] Returned key */ -static BOOL read_key_value(HCRYPTPROV hKeyContainer, HKEY hKey, LPCSTR szValueName, DWORD dwFlags, HCRYPTKEY *phCryptKey) -{ +static BOOL read_key_value(HCRYPTPROV hKeyContainer, HKEY hKey, DWORD dwKeySpec, DWORD dwFlags, HCRYPTKEY *phCryptKey) +{ + LPCSTR szValueName; DWORD dwValueType, dwLen; BYTE *pbKey; DATA_BLOB blobIn, blobOut; BOOL ret = FALSE; + if (!(szValueName = map_key_spec_to_key_pair_name(dwKeySpec))) + return FALSE; if (RegQueryValueExA(hKey, szValueName, 0, &dwValueType, NULL, &dwLen) == ERROR_SUCCESS) { @@ -1165,12 +1311,27 @@ if (CryptUnprotectData(&blobIn, NULL, NULL, NULL, NULL, dwFlags, &blobOut)) { - ret = RSAENH_CPImportKey(hKeyContainer, blobOut.pbData, blobOut.cbData, 0, 0, - phCryptKey); + ret = import_key(hKeyContainer, blobOut.pbData, blobOut.cbData, 0, 0, + FALSE, phCryptKey); LocalFree(blobOut.pbData); } } HeapFree(GetProcessHeap(), 0, pbKey); + } + } + if (ret) + { + CRYPTKEY *pKey; + + if (lookup_handle(&handle_table, *phCryptKey, RSAENH_MAGIC_KEY, + (OBJECTHDR**)&pKey)) + { + if ((szValueName = map_key_spec_to_permissions_name(dwKeySpec))) + { + dwLen = sizeof(pKey->dwPermissions); + RegQueryValueExA(hKey, szValueName, 0, NULL, + (BYTE *)&pKey->dwPermissions, &dwLen); + } } } return ret; @@ -1213,10 +1374,10 @@ (OBJECTHDR**)&pKeyContainer)) return (HCRYPTPROV)INVALID_HANDLE_VALUE; - if (read_key_value(hKeyContainer, hKey, "KeyExchangeKeyPair", + if (read_key_value(hKeyContainer, hKey, AT_KEYEXCHANGE, dwProtectFlags, &hCryptKey)) pKeyContainer->hKeyExchangeKeyPair = hCryptKey; - if (read_key_value(hKeyContainer, hKey, "SignatureKeyPair", + if (read_key_value(hKeyContainer, hKey, AT_SIGNATURE, dwProtectFlags, &hCryptKey)) pKeyContainer->hSignatureKeyPair = hCryptKey; } @@ -2204,6 +2365,183 @@ return TRUE; } +static BOOL crypt_export_simple(CRYPTKEY *pCryptKey, CRYPTKEY *pPubKey, + DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen) +{ + BLOBHEADER *pBlobHeader = (BLOBHEADER*)pbData; + ALG_ID *pAlgid = (ALG_ID*)(pBlobHeader+1); + DWORD dwDataLen; + + if (!(GET_ALG_CLASS(pCryptKey->aiAlgid)&(ALG_CLASS_DATA_ENCRYPT|ALG_CLASS_MSG_ENCRYPT))) { + SetLastError(NTE_BAD_KEY); /* FIXME: error code? */ + return FALSE; + } + + dwDataLen = sizeof(BLOBHEADER) + sizeof(ALG_ID) + pPubKey->dwBlockLen; + if (pbData) { + if (*pdwDataLen < dwDataLen) { + SetLastError(ERROR_MORE_DATA); + *pdwDataLen = dwDataLen; + return FALSE; + } + + pBlobHeader->bType = SIMPLEBLOB; + pBlobHeader->bVersion = CUR_BLOB_VERSION; + pBlobHeader->reserved = 0; + pBlobHeader->aiKeyAlg = pCryptKey->aiAlgid; + + *pAlgid = pPubKey->aiAlgid; + + if (!pad_data(pCryptKey->abKeyValue, pCryptKey->dwKeyLen, (BYTE*)(pAlgid+1), + pPubKey->dwBlockLen, dwFlags)) + { + return FALSE; + } + + encrypt_block_impl(pPubKey->aiAlgid, PK_PUBLIC, &pPubKey->context, (BYTE*)(pAlgid+1), + (BYTE*)(pAlgid+1), RSAENH_ENCRYPT); + } + *pdwDataLen = dwDataLen; + return TRUE; +} + +static BOOL crypt_export_public_key(CRYPTKEY *pCryptKey, BYTE *pbData, + DWORD *pdwDataLen) +{ + BLOBHEADER *pBlobHeader = (BLOBHEADER*)pbData; + RSAPUBKEY *pRSAPubKey = (RSAPUBKEY*)(pBlobHeader+1); + DWORD dwDataLen; + + if ((pCryptKey->aiAlgid != CALG_RSA_KEYX) && (pCryptKey->aiAlgid != CALG_RSA_SIGN)) { + SetLastError(NTE_BAD_KEY); + return FALSE; + } + + dwDataLen = sizeof(BLOBHEADER) + sizeof(RSAPUBKEY) + pCryptKey->dwKeyLen; + if (pbData) { + if (*pdwDataLen < dwDataLen) { + SetLastError(ERROR_MORE_DATA); + *pdwDataLen = dwDataLen; + return FALSE; + } + + pBlobHeader->bType = PUBLICKEYBLOB; + pBlobHeader->bVersion = CUR_BLOB_VERSION; + pBlobHeader->reserved = 0; + pBlobHeader->aiKeyAlg = pCryptKey->aiAlgid; + + pRSAPubKey->magic = RSAENH_MAGIC_RSA1; + pRSAPubKey->bitlen = pCryptKey->dwKeyLen << 3; + + export_public_key_impl((BYTE*)(pRSAPubKey+1), &pCryptKey->context, + pCryptKey->dwKeyLen, &pRSAPubKey->pubexp); + } + *pdwDataLen = dwDataLen; + return TRUE; +} + +static BOOL crypt_export_private_key(CRYPTKEY *pCryptKey, BOOL force, + BYTE *pbData, DWORD *pdwDataLen) +{ + BLOBHEADER *pBlobHeader = (BLOBHEADER*)pbData; + RSAPUBKEY *pRSAPubKey = (RSAPUBKEY*)(pBlobHeader+1); + DWORD dwDataLen; + + if ((pCryptKey->aiAlgid != CALG_RSA_KEYX) && (pCryptKey->aiAlgid != CALG_RSA_SIGN)) { + SetLastError(NTE_BAD_KEY); + return FALSE; + } + if (!force && !(pCryptKey->dwPermissions & CRYPT_EXPORT)) + { + SetLastError(NTE_BAD_KEY_STATE); + return FALSE; + } + + dwDataLen = sizeof(BLOBHEADER) + sizeof(RSAPUBKEY) + + 2 * pCryptKey->dwKeyLen + 5 * ((pCryptKey->dwKeyLen + 1) >> 1); + if (pbData) { + if (*pdwDataLen < dwDataLen) { + SetLastError(ERROR_MORE_DATA); + *pdwDataLen = dwDataLen; + return FALSE; + } + + pBlobHeader->bType = PRIVATEKEYBLOB; + pBlobHeader->bVersion = CUR_BLOB_VERSION; + pBlobHeader->reserved = 0; + pBlobHeader->aiKeyAlg = pCryptKey->aiAlgid; + + pRSAPubKey->magic = RSAENH_MAGIC_RSA2; + pRSAPubKey->bitlen = pCryptKey->dwKeyLen << 3; + + export_private_key_impl((BYTE*)(pRSAPubKey+1), &pCryptKey->context, + pCryptKey->dwKeyLen, &pRSAPubKey->pubexp); + } + *pdwDataLen = dwDataLen; + return TRUE; +} + +/****************************************************************************** + * crypt_export_key [Internal] + * + * Export a key into a binary large object (BLOB). Called by CPExportKey and + * by store_key_pair. + * + * PARAMS + * pCryptKey [I] Key to be exported. + * hPubKey [I] Key used to encrypt sensitive BLOB data. + * dwBlobType [I] SIMPLEBLOB, PUBLICKEYBLOB or PRIVATEKEYBLOB. + * dwFlags [I] Currently none defined. + * force [I] If TRUE, the key is written no matter what the key's + * permissions are. Otherwise the key's permissions are + * checked before exporting. + * pbData [O] Pointer to a buffer where the BLOB will be written to. + * pdwDataLen [I/O] I: Size of buffer at pbData, O: Size of BLOB + * + * RETURNS + * Success: TRUE. + * Failure: FALSE. + */ +static BOOL crypt_export_key(CRYPTKEY *pCryptKey, HCRYPTKEY hPubKey, + DWORD dwBlobType, DWORD dwFlags, BOOL force, + BYTE *pbData, DWORD *pdwDataLen) +{ + CRYPTKEY *pPubKey; + + if (dwFlags & CRYPT_SSL2_FALLBACK) { + if (pCryptKey->aiAlgid != CALG_SSL2_MASTER) { + SetLastError(NTE_BAD_KEY); + return FALSE; + } + } + + switch ((BYTE)dwBlobType) + { + case SIMPLEBLOB: + if (!lookup_handle(&handle_table, hPubKey, RSAENH_MAGIC_KEY, (OBJECTHDR**)&pPubKey)){ + SetLastError(NTE_BAD_PUBLIC_KEY); /* FIXME: error_code? */ + return FALSE; + } + return crypt_export_simple(pCryptKey, pPubKey, dwFlags, pbData, + pdwDataLen); + + case PUBLICKEYBLOB: + if (is_valid_handle(&handle_table, hPubKey, RSAENH_MAGIC_KEY)) { + SetLastError(NTE_BAD_KEY); /* FIXME: error code? */ + return FALSE; + } + + return crypt_export_public_key(pCryptKey, pbData, pdwDataLen); + + case PRIVATEKEYBLOB: + return crypt_export_private_key(pCryptKey, force, pbData, pdwDataLen); + + default: + SetLastError(NTE_BAD_TYPE); /* FIXME: error code? */ + return FALSE; + } +} + /****************************************************************************** * CPExportKey (RSAENH.@) * @@ -2222,18 +2560,14 @@ * Success: TRUE. * Failure: FALSE. */ -BOOL WINAPI RSAENH_CPExportKey(HCRYPTPROV hProv, HCRYPTKEY hKey, HCRYPTKEY hPubKey, +BOOL WINAPI RSAENH_CPExportKey(HCRYPTPROV hProv, HCRYPTKEY hKey, HCRYPTKEY hPubKey, DWORD dwBlobType, DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen) { - CRYPTKEY *pCryptKey, *pPubKey; - BLOBHEADER *pBlobHeader = (BLOBHEADER*)pbData; - RSAPUBKEY *pRSAPubKey = (RSAPUBKEY*)(pBlobHeader+1); - ALG_ID *pAlgid = (ALG_ID*)(pBlobHeader+1); - DWORD dwDataLen; - + CRYPTKEY *pCryptKey; + TRACE("(hProv=%08lx, hKey=%08lx, hPubKey=%08lx, dwBlobType=%08x, dwFlags=%08x, pbData=%p," "pdwDataLen=%p)\n", hProv, hKey, hPubKey, dwBlobType, dwFlags, pbData, pdwDataLen); - + if (!is_valid_handle(&handle_table, hProv, RSAENH_MAGIC_CONTAINER)) { SetLastError(NTE_BAD_UID); @@ -2246,155 +2580,286 @@ return FALSE; } - if (dwFlags & CRYPT_SSL2_FALLBACK) { - if (pCryptKey->aiAlgid != CALG_SSL2_MASTER) { - SetLastError(NTE_BAD_KEY); - return FALSE; + return crypt_export_key(pCryptKey, hPubKey, dwBlobType, dwFlags, FALSE, + pbData, pdwDataLen); +} + +/****************************************************************************** + * release_and_install_key [Internal] + * + * Release an existing key, if present, and replaces it with a new one. + * + * PARAMS + * hProv [I] Key container into which the key is to be imported. + * src [I] Key which will replace *dest + * dest [I] Points to key to be released and replaced with src + * fStoreKey [I] If TRUE, the newly installed key is stored to the registry. + */ +static void release_and_install_key(HCRYPTPROV hProv, HCRYPTKEY src, + HCRYPTKEY *dest, DWORD fStoreKey) +{ + RSAENH_CPDestroyKey(hProv, *dest); + copy_handle(&handle_table, src, RSAENH_MAGIC_KEY, dest); + if (fStoreKey) + { + KEYCONTAINER *pKeyContainer; + + if (lookup_handle(&handle_table, hProv, RSAENH_MAGIC_CONTAINER, + (OBJECTHDR**)&pKeyContainer)) + { + store_key_container_keys(pKeyContainer); + store_key_container_permissions(pKeyContainer); } } - - switch ((BYTE)dwBlobType) - { - case SIMPLEBLOB: - if (!lookup_handle(&handle_table, hPubKey, RSAENH_MAGIC_KEY, (OBJECTHDR**)&pPubKey)){ - SetLastError(NTE_BAD_PUBLIC_KEY); /* FIXME: error_code? */ - return FALSE; - } - - if (!(GET_ALG_CLASS(pCryptKey->aiAlgid)&(ALG_CLASS_DATA_ENCRYPT|ALG_CLASS_MSG_ENCRYPT))) { - SetLastError(NTE_BAD_KEY); /* FIXME: error code? */ - return FALSE; - } - - dwDataLen = sizeof(BLOBHEADER) + sizeof(ALG_ID) + pPubKey->dwBlockLen; - if (pbData) { - if (*pdwDataLen < dwDataLen) { - SetLastError(ERROR_MORE_DATA); - *pdwDataLen = dwDataLen; - return FALSE; - } - - pBlobHeader->bType = SIMPLEBLOB; - pBlobHeader->bVersion = CUR_BLOB_VERSION; - pBlobHeader->reserved = 0; - pBlobHeader->aiKeyAlg = pCryptKey->aiAlgid; - - *pAlgid = pPubKey->aiAlgid; - - if (!pad_data(pCryptKey->abKeyValue, pCryptKey->dwKeyLen, (BYTE*)(pAlgid+1), - pPubKey->dwBlockLen, dwFlags)) - { - return FALSE; - } - - encrypt_block_impl(pPubKey->aiAlgid, PK_PUBLIC, &pPubKey->context, (BYTE*)(pAlgid+1), - (BYTE*)(pAlgid+1), RSAENH_ENCRYPT); - } - *pdwDataLen = dwDataLen; - return TRUE; - - case PUBLICKEYBLOB: - if (is_valid_handle(&handle_table, hPubKey, RSAENH_MAGIC_KEY)) { - SetLastError(NTE_BAD_KEY); /* FIXME: error code? */ - return FALSE; - } - - if ((pCryptKey->aiAlgid != CALG_RSA_KEYX) && (pCryptKey->aiAlgid != CALG_RSA_SIGN)) { - SetLastError(NTE_BAD_KEY); - return FALSE; - } - - dwDataLen = sizeof(BLOBHEADER) + sizeof(RSAPUBKEY) + pCryptKey->dwKeyLen; - if (pbData) { - if (*pdwDataLen < dwDataLen) { - SetLastError(ERROR_MORE_DATA); - *pdwDataLen = dwDataLen; - return FALSE; - } - - pBlobHeader->bType = PUBLICKEYBLOB; - pBlobHeader->bVersion = CUR_BLOB_VERSION; - pBlobHeader->reserved = 0; - pBlobHeader->aiKeyAlg = pCryptKey->aiAlgid; - - pRSAPubKey->magic = RSAENH_MAGIC_RSA1; - pRSAPubKey->bitlen = pCryptKey->dwKeyLen << 3; - - export_public_key_impl((BYTE*)(pRSAPubKey+1), &pCryptKey->context, - pCryptKey->dwKeyLen, &pRSAPubKey->pubexp); - } - *pdwDataLen = dwDataLen; - return TRUE; - - case PRIVATEKEYBLOB: - if ((pCryptKey->aiAlgid != CALG_RSA_KEYX) && (pCryptKey->aiAlgid != CALG_RSA_SIGN)) { - SetLastError(NTE_BAD_KEY); - return FALSE; - } - - dwDataLen = sizeof(BLOBHEADER) + sizeof(RSAPUBKEY) + - 2 * pCryptKey->dwKeyLen + 5 * ((pCryptKey->dwKeyLen + 1) >> 1); - if (pbData) { - if (*pdwDataLen < dwDataLen) { - SetLastError(ERROR_MORE_DATA); - *pdwDataLen = dwDataLen; - return FALSE; - } - - pBlobHeader->bType = PRIVATEKEYBLOB; - pBlobHeader->bVersion = CUR_BLOB_VERSION; - pBlobHeader->reserved = 0; - pBlobHeader->aiKeyAlg = pCryptKey->aiAlgid; - - pRSAPubKey->magic = RSAENH_MAGIC_RSA2; - pRSAPubKey->bitlen = pCryptKey->dwKeyLen << 3; - - export_private_key_impl((BYTE*)(pRSAPubKey+1), &pCryptKey->context, - pCryptKey->dwKeyLen, &pRSAPubKey->pubexp); - } - *pdwDataLen = dwDataLen; - return TRUE; - - default: - SetLastError(NTE_BAD_TYPE); /* FIXME: error code? */ - return FALSE; - } -} - -/****************************************************************************** - * CPImportKey (RSAENH.@) - * - * Import a BLOB'ed key into a key container. +} + +/****************************************************************************** + * import_private_key [Internal] + * + * Import a BLOB'ed private key into a key container. + * + * PARAMS + * hProv [I] Key container into which the private key is to be imported. + * pbData [I] Pointer to a buffer which holds the private key BLOB. + * dwDataLen [I] Length of data in buffer at pbData. + * dwFlags [I] One of: + * CRYPT_EXPORTABLE: the imported key is marked exportable + * fStoreKey [I] If TRUE, the imported key is stored to the registry. + * phKey [O] Handle to the imported key. + * + * + * NOTES + * Assumes the caller has already checked the BLOBHEADER at pbData to ensure + * it's a PRIVATEKEYBLOB. + * + * RETURNS + * Success: TRUE. + * Failure: FALSE. + */ +static BOOL import_private_key(HCRYPTPROV hProv, CONST BYTE *pbData, DWORD dwDataLen, + DWORD dwFlags, BOOL fStoreKey, HCRYPTKEY *phKey) +{ + KEYCONTAINER *pKeyContainer; + CRYPTKEY *pCryptKey; + CONST BLOBHEADER *pBlobHeader = (CONST BLOBHEADER*)pbData; + CONST RSAPUBKEY *pRSAPubKey = (CONST RSAPUBKEY*)(pBlobHeader+1); + BOOL ret; + + if (!lookup_handle(&handle_table, hProv, RSAENH_MAGIC_CONTAINER, + (OBJECTHDR**)&pKeyContainer)) + { + SetLastError(NTE_BAD_UID); + return FALSE; + } + + if ((dwDataLen < sizeof(BLOBHEADER) + sizeof(RSAPUBKEY)) || + (pRSAPubKey->magic != RSAENH_MAGIC_RSA2) || + (dwDataLen < sizeof(BLOBHEADER) + sizeof(RSAPUBKEY) + + (2 * pRSAPubKey->bitlen >> 3) + (5 * ((pRSAPubKey->bitlen+8)>>4)))) + { + SetLastError(NTE_BAD_DATA); + return FALSE; + } + + *phKey = new_key(hProv, pBlobHeader->aiKeyAlg, MAKELONG(0,pRSAPubKey->bitlen), &pCryptKey); + if (*phKey == (HCRYPTKEY)INVALID_HANDLE_VALUE) return FALSE; + setup_key(pCryptKey); + ret = import_private_key_impl((CONST BYTE*)(pRSAPubKey+1), &pCryptKey->context, + pRSAPubKey->bitlen/8, pRSAPubKey->pubexp); + if (ret) { + if (dwFlags & CRYPT_EXPORTABLE) + pCryptKey->dwPermissions |= CRYPT_EXPORT; + switch (pBlobHeader->aiKeyAlg) + { + case AT_SIGNATURE: + case CALG_RSA_SIGN: + TRACE("installing signing key\n"); + release_and_install_key(hProv, *phKey, &pKeyContainer->hSignatureKeyPair, + fStoreKey); + break; + case AT_KEYEXCHANGE: + case CALG_RSA_KEYX: + TRACE("installing key exchange key\n"); + release_and_install_key(hProv, *phKey, &pKeyContainer->hKeyExchangeKeyPair, + fStoreKey); + break; + } + } + return ret; +} + +/****************************************************************************** + * import_public_key [Internal] + * + * Import a BLOB'ed public key into a key container. + * + * PARAMS + * hProv [I] Key container into which the public key is to be imported. + * pbData [I] Pointer to a buffer which holds the public key BLOB. + * dwDataLen [I] Length of data in buffer at pbData. + * dwFlags [I] One of: + * CRYPT_EXPORTABLE: the imported key is marked exportable + * fStoreKey [I] If TRUE, the imported key is stored to the registry. + * phKey [O] Handle to the imported key. + * + * + * NOTES + * Assumes the caller has already checked the BLOBHEADER at pbData to ensure + * it's a PUBLICKEYBLOB. + * + * RETURNS + * Success: TRUE. + * Failure: FALSE. + */ +static BOOL import_public_key(HCRYPTPROV hProv, CONST BYTE *pbData, DWORD dwDataLen, + DWORD dwFlags, BOOL fStoreKey, HCRYPTKEY *phKey) +{ + KEYCONTAINER *pKeyContainer; + CRYPTKEY *pCryptKey; + CONST BLOBHEADER *pBlobHeader = (CONST BLOBHEADER*)pbData; + CONST RSAPUBKEY *pRSAPubKey = (CONST RSAPUBKEY*)(pBlobHeader+1); + ALG_ID algID; + BOOL ret; + + if (!lookup_handle(&handle_table, hProv, RSAENH_MAGIC_CONTAINER, + (OBJECTHDR**)&pKeyContainer)) + { + SetLastError(NTE_BAD_UID); + return FALSE; + } + + if ((dwDataLen < sizeof(BLOBHEADER) + sizeof(RSAPUBKEY)) || + (pRSAPubKey->magic != RSAENH_MAGIC_RSA1) || + (dwDataLen < sizeof(BLOBHEADER) + sizeof(RSAPUBKEY) + (pRSAPubKey->bitlen >> 3))) + { + SetLastError(NTE_BAD_DATA); + return FALSE; + } + + /* Since this is a public key blob, only the public key is + * available, so only signature verification is possible. + */ + algID = pBlobHeader->aiKeyAlg; + *phKey = new_key(hProv, algID, MAKELONG(0,pRSAPubKey->bitlen), &pCryptKey); + if (*phKey == (HCRYPTKEY)INVALID_HANDLE_VALUE) return FALSE; + setup_key(pCryptKey); + ret = import_public_key_impl((CONST BYTE*)(pRSAPubKey+1), &pCryptKey->context, + pRSAPubKey->bitlen >> 3, pRSAPubKey->pubexp); + if (ret) { + if (dwFlags & CRYPT_EXPORTABLE) + pCryptKey->dwPermissions |= CRYPT_EXPORT; + switch (pBlobHeader->aiKeyAlg) + { + case AT_KEYEXCHANGE: + case CALG_RSA_KEYX: + TRACE("installing public key\n"); + release_and_install_key(hProv, *phKey, &pKeyContainer->hKeyExchangeKeyPair, + fStoreKey); + break; + } + } + return ret; +} + +/****************************************************************************** + * import_symmetric_key [Internal] + * + * Import a BLOB'ed symmetric key into a key container. + * + * PARAMS + * hProv [I] Key container into which the symmetric key is to be imported. + * pbData [I] Pointer to a buffer which holds the symmetric key BLOB. + * dwDataLen [I] Length of data in buffer at pbData. + * hPubKey [I] Key used to decrypt sensitive BLOB data. + * dwFlags [I] One of: + * CRYPT_EXPORTABLE: the imported key is marked exportable + * phKey [O] Handle to the imported key. + * + * + * NOTES + * Assumes the caller has already checked the BLOBHEADER at pbData to ensure + * it's a SIMPLEBLOB. + * + * RETURNS + * Success: TRUE. + * Failure: FALSE. + */ +static BOOL import_symmetric_key(HCRYPTPROV hProv, CONST BYTE *pbData, + DWORD dwDataLen, HCRYPTKEY hPubKey, + DWORD dwFlags, HCRYPTKEY *phKey) +{ + CRYPTKEY *pCryptKey, *pPubKey; + CONST BLOBHEADER *pBlobHeader = (CONST BLOBHEADER*)pbData; + CONST ALG_ID *pAlgid = (CONST ALG_ID*)(pBlobHeader+1); + CONST BYTE *pbKeyStream = (CONST BYTE*)(pAlgid + 1); + BYTE *pbDecrypted; + DWORD dwKeyLen; + + if (!lookup_handle(&handle_table, hPubKey, RSAENH_MAGIC_KEY, (OBJECTHDR**)&pPubKey) || + pPubKey->aiAlgid != CALG_RSA_KEYX) + { + SetLastError(NTE_BAD_PUBLIC_KEY); /* FIXME: error code? */ + return FALSE; + } + + if (dwDataLen < sizeof(BLOBHEADER)+sizeof(ALG_ID)+pPubKey->dwBlockLen) + { + SetLastError(NTE_BAD_DATA); /* FIXME: error code */ + return FALSE; + } + + pbDecrypted = HeapAlloc(GetProcessHeap(), 0, pPubKey->dwBlockLen); + if (!pbDecrypted) return FALSE; + encrypt_block_impl(pPubKey->aiAlgid, PK_PRIVATE, &pPubKey->context, pbKeyStream, pbDecrypted, + RSAENH_DECRYPT); + + dwKeyLen = RSAENH_MAX_KEY_SIZE; + if (!unpad_data(pbDecrypted, pPubKey->dwBlockLen, pbDecrypted, &dwKeyLen, dwFlags)) { + HeapFree(GetProcessHeap(), 0, pbDecrypted); + return FALSE; + } + + *phKey = new_key(hProv, pBlobHeader->aiKeyAlg, dwKeyLen<<19, &pCryptKey); + if (*phKey == (HCRYPTKEY)INVALID_HANDLE_VALUE) + { + HeapFree(GetProcessHeap(), 0, pbDecrypted); + return FALSE; + } + memcpy(pCryptKey->abKeyValue, pbDecrypted, dwKeyLen); + HeapFree(GetProcessHeap(), 0, pbDecrypted); + setup_key(pCryptKey); + if (dwFlags & CRYPT_EXPORTABLE) + pCryptKey->dwPermissions |= CRYPT_EXPORT; + return TRUE; +} + +/****************************************************************************** + * import_key [Internal] + * + * Import a BLOB'ed key into a key container, optionally storing the key's + * value to the registry. * * PARAMS * hProv [I] Key container into which the key is to be imported. * pbData [I] Pointer to a buffer which holds the BLOB. * dwDataLen [I] Length of data in buffer at pbData. * hPubKey [I] Key used to decrypt sensitive BLOB data. - * dwFlags [I] Currently none defined. + * dwFlags [I] One of: + * CRYPT_EXPORTABLE: the imported key is marked exportable + * fStoreKey [I] If TRUE, the imported key is stored to the registry. * phKey [O] Handle to the imported key. * * RETURNS * Success: TRUE. * Failure: FALSE. */ -BOOL WINAPI RSAENH_CPImportKey(HCRYPTPROV hProv, CONST BYTE *pbData, DWORD dwDataLen, - HCRYPTKEY hPubKey, DWORD dwFlags, HCRYPTKEY *phKey) +static BOOL import_key(HCRYPTPROV hProv, CONST BYTE *pbData, DWORD dwDataLen, + HCRYPTKEY hPubKey, DWORD dwFlags, BOOL fStoreKey, + HCRYPTKEY *phKey) { KEYCONTAINER *pKeyContainer; - CRYPTKEY *pCryptKey, *pPubKey; CONST BLOBHEADER *pBlobHeader = (CONST BLOBHEADER*)pbData; - CONST RSAPUBKEY *pRSAPubKey = (CONST RSAPUBKEY*)(pBlobHeader+1); - CONST ALG_ID *pAlgid = (CONST ALG_ID*)(pBlobHeader+1); - CONST BYTE *pbKeyStream = (CONST BYTE*)(pAlgid + 1); - ALG_ID algID; - BYTE *pbDecrypted; - DWORD dwKeyLen; - BOOL ret; - - TRACE("(hProv=%08lx, pbData=%p, dwDataLen=%d, hPubKey=%08lx, dwFlags=%08x, phKey=%p)\n", - hProv, pbData, dwDataLen, hPubKey, dwFlags, phKey); - + if (!lookup_handle(&handle_table, hProv, RSAENH_MAGIC_CONTAINER, (OBJECTHDR**)&pKeyContainer)) { @@ -2410,116 +2875,55 @@ return FALSE; } + /* If this is a verify-only context, the key is not persisted regardless of + * fStoreKey's original value. + */ + fStoreKey = fStoreKey && !(dwFlags & CRYPT_VERIFYCONTEXT); switch (pBlobHeader->bType) { case PRIVATEKEYBLOB: - if ((dwDataLen < sizeof(BLOBHEADER) + sizeof(RSAPUBKEY)) || - (pRSAPubKey->magic != RSAENH_MAGIC_RSA2) || - (dwDataLen < sizeof(BLOBHEADER) + sizeof(RSAPUBKEY) + - (2 * pRSAPubKey->bitlen >> 3) + (5 * ((pRSAPubKey->bitlen+8)>>4)))) - { - SetLastError(NTE_BAD_DATA); - return FALSE; - } - - *phKey = new_key(hProv, pBlobHeader->aiKeyAlg, MAKELONG(0,pRSAPubKey->bitlen), &pCryptKey); - if (*phKey == (HCRYPTKEY)INVALID_HANDLE_VALUE) return FALSE; - setup_key(pCryptKey); - ret = import_private_key_impl((CONST BYTE*)(pRSAPubKey+1), &pCryptKey->context, - pRSAPubKey->bitlen/8, pRSAPubKey->pubexp); - if (ret) { - switch (pBlobHeader->aiKeyAlg) - { - case AT_SIGNATURE: - case CALG_RSA_SIGN: - TRACE("installing signing key\n"); - RSAENH_CPDestroyKey(hProv, pKeyContainer->hSignatureKeyPair); - copy_handle(&handle_table, *phKey, RSAENH_MAGIC_KEY, - &pKeyContainer->hSignatureKeyPair); - break; - case AT_KEYEXCHANGE: - case CALG_RSA_KEYX: - TRACE("installing key exchange key\n"); - RSAENH_CPDestroyKey(hProv, pKeyContainer->hKeyExchangeKeyPair); - copy_handle(&handle_table, *phKey, RSAENH_MAGIC_KEY, - &pKeyContainer->hKeyExchangeKeyPair); - break; - } - } - return ret; + return import_private_key(hProv, pbData, dwDataLen, dwFlags, + fStoreKey, phKey); case PUBLICKEYBLOB: - if ((dwDataLen < sizeof(BLOBHEADER) + sizeof(RSAPUBKEY)) || - (pRSAPubKey->magic != RSAENH_MAGIC_RSA1) || - (dwDataLen < sizeof(BLOBHEADER) + sizeof(RSAPUBKEY) + (pRSAPubKey->bitlen >> 3))) - { - SetLastError(NTE_BAD_DATA); - return FALSE; - } - - /* Since this is a public key blob, only the public key is - * available, so only signature verification is possible. - */ - algID = pBlobHeader->aiKeyAlg; - *phKey = new_key(hProv, algID, MAKELONG(0,pRSAPubKey->bitlen), &pCryptKey); - if (*phKey == (HCRYPTKEY)INVALID_HANDLE_VALUE) return FALSE; - setup_key(pCryptKey); - ret = import_public_key_impl((CONST BYTE*)(pRSAPubKey+1), &pCryptKey->context, - pRSAPubKey->bitlen >> 3, pRSAPubKey->pubexp); - if (ret) { - switch (pBlobHeader->aiKeyAlg) - { - case AT_KEYEXCHANGE: - case CALG_RSA_KEYX: - TRACE("installing public key\n"); - RSAENH_CPDestroyKey(hProv, pKeyContainer->hKeyExchangeKeyPair); - copy_handle(&handle_table, *phKey, RSAENH_MAGIC_KEY, - &pKeyContainer->hKeyExchangeKeyPair); - break; - } - } - return ret; + return import_public_key(hProv, pbData, dwDataLen, dwFlags, + fStoreKey, phKey); case SIMPLEBLOB: - if (!lookup_handle(&handle_table, hPubKey, RSAENH_MAGIC_KEY, (OBJECTHDR**)&pPubKey) || - pPubKey->aiAlgid != CALG_RSA_KEYX) - { - SetLastError(NTE_BAD_PUBLIC_KEY); /* FIXME: error code? */ - return FALSE; - } - - if (dwDataLen < sizeof(BLOBHEADER)+sizeof(ALG_ID)+pPubKey->dwBlockLen) - { - SetLastError(NTE_BAD_DATA); /* FIXME: error code */ - return FALSE; - } - - pbDecrypted = HeapAlloc(GetProcessHeap(), 0, pPubKey->dwBlockLen); - if (!pbDecrypted) return FALSE; - encrypt_block_impl(pPubKey->aiAlgid, PK_PRIVATE, &pPubKey->context, pbKeyStream, pbDecrypted, - RSAENH_DECRYPT); - - dwKeyLen = RSAENH_MAX_KEY_SIZE; - if (!unpad_data(pbDecrypted, pPubKey->dwBlockLen, pbDecrypted, &dwKeyLen, dwFlags)) { - HeapFree(GetProcessHeap(), 0, pbDecrypted); - return FALSE; - } - - *phKey = new_key(hProv, pBlobHeader->aiKeyAlg, dwKeyLen<<19, &pCryptKey); - if (*phKey == (HCRYPTKEY)INVALID_HANDLE_VALUE) - { - HeapFree(GetProcessHeap(), 0, pbDecrypted); - return FALSE; - } - memcpy(pCryptKey->abKeyValue, pbDecrypted, dwKeyLen); - HeapFree(GetProcessHeap(), 0, pbDecrypted); - setup_key(pCryptKey); - return TRUE; + return import_symmetric_key(hProv, pbData, dwDataLen, hPubKey, + dwFlags, phKey); default: SetLastError(NTE_BAD_TYPE); /* FIXME: error code? */ return FALSE; } +} + +/****************************************************************************** + * CPImportKey (RSAENH.@) + * + * Import a BLOB'ed key into a key container. + * + * PARAMS + * hProv [I] Key container into which the key is to be imported. + * pbData [I] Pointer to a buffer which holds the BLOB. + * dwDataLen [I] Length of data in buffer at pbData. + * hPubKey [I] Key used to decrypt sensitive BLOB data. + * dwFlags [I] One of: + * CRYPT_EXPORTABLE: the imported key is marked exportable + * phKey [O] Handle to the imported key. + * + * RETURNS + * Success: TRUE. + * Failure: FALSE. + */ +BOOL WINAPI RSAENH_CPImportKey(HCRYPTPROV hProv, CONST BYTE *pbData, DWORD dwDataLen, + HCRYPTKEY hPubKey, DWORD dwFlags, HCRYPTKEY *phKey) +{ + TRACE("(hProv=%08lx, pbData=%p, dwDataLen=%d, hPubKey=%08lx, dwFlags=%08x, phKey=%p)\n", + hProv, pbData, dwDataLen, hPubKey, dwFlags, phKey); + + return import_key(hProv, pbData, dwDataLen, hPubKey, dwFlags, TRUE, phKey); } /****************************************************************************** @@ -2737,8 +3141,8 @@ finalize_hash(pCryptHash); pCryptHash->dwState = RSAENH_HASHSTATE_FINISHED; } - - return copy_param(pbData, pdwDataLen, (CONST BYTE*)pCryptHash->abHashValue, + + return copy_param(pbData, pdwDataLen, pCryptHash->abHashValue, pCryptHash->dwHashSize); default: @@ -2814,8 +3218,26 @@ return TRUE; case KP_PERMISSIONS: - pCryptKey->dwPermissions = *(DWORD*)pbData; + { + DWORD perms = *(DWORD *)pbData; + + if ((perms & CRYPT_EXPORT) && + !(pCryptKey->dwPermissions & CRYPT_EXPORT)) + { + SetLastError(NTE_BAD_DATA); + return FALSE; + } + else if (!(perms & CRYPT_EXPORT) && + (pCryptKey->dwPermissions & CRYPT_EXPORT)) + { + /* Clearing the export permission appears to be ignored, + * see tests. + */ + perms |= CRYPT_EXPORT; + } + pCryptKey->dwPermissions = perms; return TRUE; + } case KP_IV: memcpy(pCryptKey->abInitVector, pbData, pCryptKey->dwBlockLen); @@ -2950,13 +3372,13 @@ switch (dwParam) { case KP_IV: - return copy_param(pbData, pdwDataLen, (CONST BYTE*)pCryptKey->abInitVector, + return copy_param(pbData, pdwDataLen, pCryptKey->abInitVector, pCryptKey->dwBlockLen); case KP_SALT: return copy_param(pbData, pdwDataLen, - (CONST BYTE*)&pCryptKey->abKeyValue[pCryptKey->dwKeyLen], pCryptKey->dwSaltLen); - + &pCryptKey->abKeyValue[pCryptKey->dwKeyLen], pCryptKey->dwSaltLen); + case KP_PADDING: dwValue = PKCS5_PADDING; return copy_param(pbData, pdwDataLen, (CONST BYTE*)&dwValue, sizeof(DWORD)); Modified: trunk/reactos/dll/win32/rsaenh/tomcrypt.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rsaenh/tomcrypt.…
============================================================================== --- trunk/reactos/dll/win32/rsaenh/tomcrypt.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rsaenh/tomcrypt.h [iso-8859-1] Thu Feb 26 13:29:58 2009 @@ -235,39 +235,20 @@ /* error code to char* string */ char *mp_error_to_string(int code); -/* ---> init and deinit bignum functions <--- */ -/* init a bignum */ -int mp_init(mp_int *a); - -/* free a bignum */ -void mp_clear(mp_int *a); - /* init a null terminated series of arguments */ int mp_init_multi(mp_int *mp, ...); /* clear a null terminated series of arguments */ void mp_clear_multi(mp_int *mp, ...); -/* exchange two ints */ -void mp_exch(mp_int *a, mp_int *b); - /* shrink ram required for a bignum */ int mp_shrink(mp_int *a); - -/* grow an int to a given size */ -int mp_grow(mp_int *a, int size); - -/* init to a given number of digits */ -int mp_init_size(mp_int *a, int size); /* ---> Basic Manipulations <--- */ #define mp_iszero(a) (((a)->used == 0) ? MP_YES : MP_NO) #define mp_iseven(a) (((a)->used > 0 && (((a)->dp[0] & 1) == 0)) ? MP_YES : MP_NO) #define mp_isodd(a) (((a)->used > 0 && (((a)->dp[0] & 1) == 1)) ? MP_YES : MP_NO) -/* set to zero */ -void mp_zero(mp_int *a); - /* set to a digit */ void mp_set(mp_int *a, mp_digit b); @@ -293,30 +274,6 @@ void mp_clamp(mp_int *a); /* ---> digit manipulation <--- */ - -/* right shift by "b" digits */ -void mp_rshd(mp_int *a, int b); - -/* left shift by "b" digits */ -int mp_lshd(mp_int *a, int b); - -/* c = a / 2**b */ -int mp_div_2d(const mp_int *a, int b, mp_int *c, mp_int *d); - -/* b = a/2 */ -int mp_div_2(const mp_int *a, mp_int *b); - -/* c = a * 2**b */ -int mp_mul_2d(const mp_int *a, int b, mp_int *c); - -/* b = a*2 */ -int mp_mul_2(const mp_int *a, mp_int *b); - -/* c = a mod 2**d */ -int mp_mod_2d(const mp_int *a, int b, mp_int *c); - -/* computes a = 2**b */ -int mp_2expt(mp_int *a, int b); /* Counts the number of lsbs which are zero before the first zero bit */ int mp_cnt_lsb(const mp_int *a); @@ -341,9 +298,6 @@ /* b = -a */ int mp_neg(mp_int *a, mp_int *b); -/* b = |a| */ -int mp_abs(const mp_int *a, mp_int *b); - /* compare a to b */ int mp_cmp(const mp_int *a, const mp_int *b); @@ -362,9 +316,6 @@ /* b = a*a */ int mp_sqr(const mp_int *a, mp_int *b); -/* a/b => cb + d == a */ -int mp_div(const mp_int *a, const mp_int *b, mp_int *c, mp_int *d); - /* c = a mod b, 0 <= c < b */ int mp_mod(const mp_int *a, mp_int *b, mp_int *c); @@ -373,27 +324,15 @@ /* compare against a single digit */ int mp_cmp_d(const mp_int *a, mp_digit b); -/* c = a + b */ -int mp_add_d(mp_int *a, mp_digit b, mp_int *c); - /* c = a - b */ int mp_sub_d(mp_int *a, mp_digit b, mp_int *c); -/* c = a * b */ -int mp_mul_d(const mp_int *a, mp_digit b, mp_int *c); - -/* a/b => cb + d == a */ -int mp_div_d(const mp_int *a, mp_digit b, mp_int *c, mp_digit *d); - /* a/3 => 3c + d == a */ int mp_div_3(mp_int *a, mp_int *c, mp_digit *d); /* c = a**b */ int mp_expt_d(mp_int *a, mp_digit b, mp_int *c); -/* c = a mod b, 0 <= c < b */ -int mp_mod_d(const mp_int *a, mp_digit b, mp_digit *c); - /* ---> number theory <--- */ /* d = a + b (mod c) */ @@ -459,12 +398,6 @@ /* returns 1 if a is a valid DR modulus */ int mp_dr_is_modulus(mp_int *a); -/* sets the value of "d" required for mp_dr_reduce */ -void mp_dr_setup(const mp_int *a, mp_digit *d); - -/* reduces a modulo b using the Diminished Radix method */ -int mp_dr_reduce(mp_int *a, const mp_int *b, mp_digit mp); - /* returns true if a can be reduced with mp_reduce_2k */ int mp_reduce_is_2k(mp_int *a); @@ -482,32 +415,15 @@ /* number of primes */ #define PRIME_SIZE 256 -/* result=1 if a is divisible by one of the first PRIME_SIZE primes */ -int mp_prime_is_divisible(const mp_int *a, int *result); - /* performs one Fermat test of "a" using base "b". * Sets result to 0 if composite or 1 if probable prime */ int mp_prime_fermat(mp_int *a, mp_int *b, int *result); -/* performs one Miller-Rabin test of "a" using base "b". - * Sets result to 0 if composite or 1 if probable prime - */ -int mp_prime_miller_rabin(mp_int *a, const mp_int *b, int *result); - /* This gives [for a given bit size] the number of trials required * such that Miller-Rabin gives a prob of failure lower than 2^-96 */ int mp_prime_rabin_miller_trials(int size); - -/* performs t rounds of Miller-Rabin on "a" using the first - * t prime bases. Also performs an initial sieve of trial - * division. Determines if "a" is prime with probability - * of error no more than (1/4)**t. - * - * Sets result to 1 if probably prime, 0 otherwise - */ -int mp_prime_is_prime(mp_int *a, int t, int *result); /* finds the next prime after the number "a" using "t" trials * of Miller-Rabin. Modified: trunk/reactos/dll/win32/shdocvw/oleobject.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shdocvw/oleobjec…
============================================================================== --- trunk/reactos/dll/win32/shdocvw/oleobject.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shdocvw/oleobject.c [iso-8859-1] Thu Feb 26 13:29:58 2009 @@ -868,9 +868,26 @@ const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText) { WebBrowser *This = OLECMD_THIS(iface); - FIXME("(%p)->(%s %u %p %p)\n", This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, + IOleCommandTarget *cmdtrg; + HRESULT hres; + + TRACE("(%p)->(%s %u %p %p)\n", This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, pCmdText); - return E_NOTIMPL; + + if(!This->doc_host.document) + return 0x80040104; + + /* NOTE: There are probably some commands that we should handle here + * instead of forwarding to document object. */ + + hres = IUnknown_QueryInterface(This->doc_host.document, &IID_IOleCommandTarget, (void**)&cmdtrg); + if(FAILED(hres)) + return hres; + + hres = IOleCommandTarget_QueryStatus(cmdtrg, pguidCmdGroup, cCmds, prgCmds, pCmdText); + IOleCommandTarget_Release(cmdtrg); + + return hres; } static HRESULT WINAPI WBOleCommandTarget_Exec(IOleCommandTarget *iface, Modified: trunk/reactos/dll/win32/shlwapi/shlwapi.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/shlwapi.…
============================================================================== --- trunk/reactos/dll/win32/shlwapi/shlwapi.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shlwapi/shlwapi.rc [iso-8859-1] Thu Feb 26 13:29:58 2009 @@ -46,4 +46,5 @@ #include "shlwapi_Sk.rc" #include "shlwapi_Sv.rc" #include "shlwapi_Tr.rc" -#include "shlwapi_Uk.rc"#include "shlwapi_Zh.rc" +#include "shlwapi_Uk.rc" +#include "shlwapi_Zh.rc"
15 years, 10 months
1
0
0
0
[dchapyshev] 39763: - Sync wldap32, uxtheme, sxs with Wine head
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Thu Feb 26 13:27:27 2009 New Revision: 39763 URL:
http://svn.reactos.org/svn/reactos?rev=39763&view=rev
Log: - Sync wldap32, uxtheme, sxs with Wine head Modified: trunk/reactos/dll/win32/sxs/sxs.c trunk/reactos/dll/win32/uxtheme/msstyles.c trunk/reactos/dll/win32/uxtheme/msstyles.h trunk/reactos/dll/win32/uxtheme/system.c trunk/reactos/dll/win32/uxtheme/uxini.c trunk/reactos/dll/win32/wldap32/option.c trunk/reactos/dll/win32/wldap32/parse.c trunk/reactos/dll/win32/wldap32/winldap_private.h Modified: trunk/reactos/dll/win32/sxs/sxs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/sxs/sxs.c?rev=39…
============================================================================== --- trunk/reactos/dll/win32/sxs/sxs.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/sxs/sxs.c [iso-8859-1] Thu Feb 26 13:27:27 2009 @@ -22,9 +22,6 @@ #include "windef.h" #include "winbase.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(sxs); /*********************************************************************** Modified: trunk/reactos/dll/win32/uxtheme/msstyles.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/msstyles…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/msstyles.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/msstyles.c [iso-8859-1] Thu Feb 26 13:27:27 2009 @@ -733,9 +733,9 @@ memset (state, 0, sizeof (*state)); state->metrics.cbSize = sizeof (NONCLIENTMETRICSW); SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, sizeof (NONCLIENTMETRICSW), - (PVOID)&state->metrics, 0); + &state->metrics, 0); SystemParametersInfoW (SPI_GETICONTITLELOGFONT, sizeof (LOGFONTW), - (PVOID)&state->iconTitleFont, 0); + &state->iconTitleFont, 0); } static BOOL parse_handle_nonclient_font (struct PARSENONCLIENTSTATE* state, @@ -838,9 +838,9 @@ if (state->metricsDirty) { SystemParametersInfoW (SPI_SETNONCLIENTMETRICS, sizeof (state->metrics), - (PVOID)&state->metrics, 0); + &state->metrics, 0); SystemParametersInfoW (SPI_SETICONTITLELOGFONT, sizeof (state->iconTitleFont), - (PVOID)&state->iconTitleFont, 0); + &state->iconTitleFont, 0); } } @@ -1086,7 +1086,7 @@ return TRUE; *hasAlpha = TRUE; - p = (BYTE*)dib.dsBm.bmBits; + p = dib.dsBm.bmBits; n = abs(dib.dsBmih.biHeight) * dib.dsBmih.biWidth; /* AlphaBlend() wants premultiplied alpha, so do that now */ while (n-- > 0) Modified: trunk/reactos/dll/win32/uxtheme/msstyles.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/msstyles…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/msstyles.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/msstyles.h [iso-8859-1] Thu Feb 26 13:27:27 2009 @@ -110,7 +110,6 @@ PUXINI_FILE UXINI_LoadINI(HMODULE hTheme, LPCWSTR lpName); void UXINI_CloseINI(PUXINI_FILE uf); -void UXINI_ResetINI(PUXINI_FILE uf); LPCWSTR UXINI_GetNextSection(PUXINI_FILE uf, DWORD *dwLen); BOOL UXINI_FindSection(PUXINI_FILE uf, LPCWSTR lpName); LPCWSTR UXINI_GetNextValue(PUXINI_FILE uf, DWORD *dwNameLen, LPCWSTR *lpValue, DWORD *dwValueLen); Modified: trunk/reactos/dll/win32/uxtheme/system.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/system.c…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/system.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/system.c [iso-8859-1] Thu Feb 26 13:27:27 2009 @@ -126,7 +126,7 @@ RegQueryValueExW (hKey, lpszValue, 0, NULL, (LPBYTE)szData, &nBytesToAlloc); dwExpDataLen = ExpandEnvironmentStringsW(szData, &cNull, 1); dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen); - LocalFree((HLOCAL) szData); + LocalFree(szData); } else { @@ -136,7 +136,7 @@ dwExpDataLen = ExpandEnvironmentStringsW(szData, pvData, MAX_PATH ); if (dwExpDataLen > MAX_PATH) dwRet = ERROR_MORE_DATA; dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen); - LocalFree((HLOCAL) szData); + LocalFree(szData); } } @@ -411,7 +411,7 @@ &type, (LPBYTE)&ncm, &count) == ERROR_SUCCESS) { SystemParametersInfoW (SPI_SETNONCLIENTMETRICS, - count, (LPVOID)&ncm, SPIF_UPDATEINIFILE); + count, &ncm, SPIF_UPDATEINIFILE); } count = sizeof(iconTitleFont); @@ -420,7 +420,7 @@ &type, (LPBYTE)&iconTitleFont, &count) == ERROR_SUCCESS) { SystemParametersInfoW (SPI_SETICONTITLELOGFONT, - count, (LPVOID)&iconTitleFont, SPIF_UPDATEINIFILE); + count, &iconTitleFont, SPIF_UPDATEINIFILE); } } @@ -453,17 +453,15 @@ memset (&ncm, 0, sizeof (ncm)); ncm.cbSize = sizeof (ncm); - SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, - sizeof (ncm), (LPVOID)&ncm, 0); - SystemParametersInfoW (SPI_SETNONCLIENTMETRICS, - sizeof (ncm), (LPVOID)&ncm, SPIF_UPDATEINIFILE); + SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, sizeof (ncm), &ncm, 0); + SystemParametersInfoW (SPI_SETNONCLIENTMETRICS, sizeof (ncm), &ncm, + SPIF_UPDATEINIFILE); memset (&iconTitleFont, 0, sizeof (iconTitleFont)); - SystemParametersInfoW (SPI_GETICONTITLELOGFONT, - sizeof (iconTitleFont), (LPVOID)&iconTitleFont, 0); - SystemParametersInfoW (SPI_SETICONTITLELOGFONT, - sizeof (iconTitleFont), (LPVOID)&iconTitleFont, - SPIF_UPDATEINIFILE | SPIF_SENDCHANGE); + SystemParametersInfoW (SPI_GETICONTITLELOGFONT, sizeof (iconTitleFont), + &iconTitleFont, 0); + SystemParametersInfoW (SPI_SETICONTITLELOGFONT, sizeof (iconTitleFont), + &iconTitleFont, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE); } /*********************************************************************** Modified: trunk/reactos/dll/win32/uxtheme/uxini.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/uxini.c?…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/uxini.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/uxini.c [iso-8859-1] Thu Feb 26 13:27:27 2009 @@ -93,19 +93,6 @@ void UXINI_CloseINI(PUXINI_FILE uf) { HeapFree(GetProcessHeap(), 0, uf); -} - -/********************************************************************** - * UXINI_ResetINI - * - * Reset the current pointer into INI file to the beginning of the file - * - * PARAMS - * uf Theme INI file to reset - */ -void UXINI_ResetINI(PUXINI_FILE uf) -{ - uf->lpCurLoc = uf->lpIni; } /********************************************************************** @@ -212,7 +199,6 @@ * * Locate a section with the specified name, search starts * at current location in ini file - * to start search from start, call UXINI_ResetINI * * PARAMS * uf INI file to search, search starts at current location Modified: trunk/reactos/dll/win32/wldap32/option.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wldap32/option.c…
============================================================================== --- trunk/reactos/dll/win32/wldap32/option.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wldap32/option.c [iso-8859-1] Thu Feb 26 13:27:27 2009 @@ -327,7 +327,7 @@ { LDAPControlW **ctrlsW; - ctrlsW = controlarrayAtoW( (LDAPControlA **)value ); + ctrlsW = controlarrayAtoW( value ); if (!ctrlsW) return WLDAP32_LDAP_NO_MEMORY; ret = ldap_set_optionW( ld, option, ctrlsW ); @@ -430,7 +430,7 @@ { LDAPControl **ctrlsU; - ctrlsU = controlarrayWtoU( (LDAPControlW **)value ); + ctrlsU = controlarrayWtoU( value ); if (!ctrlsU) return WLDAP32_LDAP_NO_MEMORY; ret = map_error( ldap_set_option( ld, option, ctrlsU )); Modified: trunk/reactos/dll/win32/wldap32/parse.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wldap32/parse.c?…
============================================================================== --- trunk/reactos/dll/win32/wldap32/parse.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wldap32/parse.c [iso-8859-1] Thu Feb 26 13:27:27 2009 @@ -444,7 +444,7 @@ #ifdef HAVE_LDAP_PARSE_VLV_CONTROL if (!(ret = ldap_parse_vlv_control( ld, controlU, &pos, &count, - (struct berval **)context, errcode ))) + context, errcode ))) { *targetpos = pos; *listcount = count; Modified: trunk/reactos/dll/win32/wldap32/winldap_private.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wldap32/winldap_…
============================================================================== --- trunk/reactos/dll/win32/wldap32/winldap_private.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wldap32/winldap_private.h [iso-8859-1] Thu Feb 26 13:27:27 2009 @@ -276,8 +276,8 @@ int ldapaif_version; } LDAPAPIFeatureInfoW; -WLDAP32_LDAP CDECL *cldap_openA(PCHAR,ULONG); -WLDAP32_LDAP CDECL *cldap_openW(PWCHAR,ULONG); +WLDAP32_LDAP * CDECL cldap_openA(PCHAR,ULONG); +WLDAP32_LDAP * CDECL cldap_openW(PWCHAR,ULONG); ULONG CDECL WLDAP32_ldap_abandon(WLDAP32_LDAP*,ULONG); ULONG CDECL ldap_addA(WLDAP32_LDAP*,PCHAR,LDAPModA*[]); ULONG CDECL ldap_addW(WLDAP32_LDAP*,PWCHAR,LDAPModW*[]); @@ -304,7 +304,7 @@ ULONG CDECL ldap_compare_sA(WLDAP32_LDAP*,PCHAR,PCHAR,PCHAR); ULONG CDECL ldap_compare_sW(WLDAP32_LDAP*,PWCHAR,PWCHAR,PWCHAR); ULONG CDECL ldap_connect(WLDAP32_LDAP*,LDAP_TIMEVAL*); -WLDAP32_LDAP CDECL *ldap_conn_from_msg(WLDAP32_LDAP*,WLDAP32_LDAPMessage*); +WLDAP32_LDAP * CDECL ldap_conn_from_msg(WLDAP32_LDAP*,WLDAP32_LDAPMessage*); ULONG CDECL ldap_control_freeA(LDAPControlA*); ULONG CDECL ldap_control_freeW(LDAPControlW*); ULONG CDECL ldap_controls_freeA(LDAPControlA**); @@ -336,8 +336,8 @@ PWCHAR CDECL ldap_err2stringW(ULONG); ULONG CDECL ldap_escape_filter_elementA(PCHAR,ULONG,PCHAR,ULONG); ULONG CDECL ldap_escape_filter_elementW(PCHAR,ULONG,PWCHAR,ULONG); -PCHAR CDECL *ldap_explode_dnA(PCHAR,ULONG); -PWCHAR CDECL *ldap_explode_dnW(PWCHAR,ULONG); +PCHAR * CDECL ldap_explode_dnA(PCHAR,ULONG); +PWCHAR * CDECL ldap_explode_dnW(PWCHAR,ULONG); ULONG CDECL ldap_extended_operationA(WLDAP32_LDAP*,PCHAR,struct WLDAP32_berval*,PLDAPControlA*,PLDAPControlA*,ULONG*); ULONG CDECL ldap_extended_operationW(WLDAP32_LDAP*,PWCHAR,struct WLDAP32_berval*,PLDAPControlW*,PLDAPControlW*,ULONG*); ULONG CDECL ldap_extended_operation_sA(WLDAP32_LDAP*,PCHAR,struct WLDAP32_berval*,PLDAPControlA*, PLDAPControlA*, @@ -346,8 +346,8 @@ PWCHAR*,struct WLDAP32_berval**); PCHAR CDECL ldap_first_attributeA(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,WLDAP32_BerElement**); PWCHAR CDECL ldap_first_attributeW(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,WLDAP32_BerElement**); -WLDAP32_LDAPMessage CDECL *WLDAP32_ldap_first_entry(WLDAP32_LDAP*,WLDAP32_LDAPMessage*); -WLDAP32_LDAPMessage CDECL *WLDAP32_ldap_first_reference(WLDAP32_LDAP*,WLDAP32_LDAPMessage*); +WLDAP32_LDAPMessage * CDECL WLDAP32_ldap_first_entry(WLDAP32_LDAP*,WLDAP32_LDAPMessage*); +WLDAP32_LDAPMessage * CDECL WLDAP32_ldap_first_reference(WLDAP32_LDAP*,WLDAP32_LDAPMessage*); ULONG CDECL ldap_free_controlsA(LDAPControlA**); ULONG CDECL ldap_free_controlsW(LDAPControlW**); PCHAR CDECL ldap_get_dnA(WLDAP32_LDAP*,WLDAP32_LDAPMessage*); @@ -357,12 +357,12 @@ ULONG CDECL ldap_get_optionA(WLDAP32_LDAP*,int,void*); ULONG CDECL ldap_get_optionW(WLDAP32_LDAP*,int,void*); ULONG CDECL ldap_get_paged_count(WLDAP32_LDAP*,PLDAPSearch,ULONG*,WLDAP32_LDAPMessage*); -PCHAR CDECL *ldap_get_valuesA(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,PCHAR); -PWCHAR CDECL *ldap_get_valuesW(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,PWCHAR); -PBERVAL CDECL *ldap_get_values_lenA(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,PCHAR); -PBERVAL CDECL *ldap_get_values_lenW(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,PWCHAR); -WLDAP32_LDAP CDECL *ldap_initA(const PCHAR,ULONG); -WLDAP32_LDAP CDECL *ldap_initW(const PWCHAR,ULONG); +PCHAR * CDECL ldap_get_valuesA(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,PCHAR); +PWCHAR * CDECL ldap_get_valuesW(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,PWCHAR); +PBERVAL * CDECL ldap_get_values_lenA(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,PCHAR); +PBERVAL * CDECL ldap_get_values_lenW(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,PWCHAR); +WLDAP32_LDAP * CDECL ldap_initA(const PCHAR,ULONG); +WLDAP32_LDAP * CDECL ldap_initW(const PWCHAR,ULONG); void CDECL ldap_memfreeA(PCHAR); void CDECL ldap_memfreeW(PWCHAR); ULONG CDECL ldap_modifyA(WLDAP32_LDAP*,PCHAR,LDAPModA*[]); @@ -384,10 +384,10 @@ ULONG CDECL WLDAP32_ldap_msgfree(WLDAP32_LDAPMessage*); PCHAR CDECL ldap_next_attributeA(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,WLDAP32_BerElement*); PWCHAR CDECL ldap_next_attributeW(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,WLDAP32_BerElement*); -WLDAP32_LDAPMessage CDECL *WLDAP32_ldap_next_entry(WLDAP32_LDAP*,WLDAP32_LDAPMessage*); -WLDAP32_LDAPMessage CDECL *WLDAP32_ldap_next_reference(WLDAP32_LDAP*,WLDAP32_LDAPMessage*); -WLDAP32_LDAP CDECL *ldap_openA(PCHAR,ULONG); -WLDAP32_LDAP CDECL *ldap_openW(PWCHAR,ULONG); +WLDAP32_LDAPMessage * CDECL WLDAP32_ldap_next_entry(WLDAP32_LDAP*,WLDAP32_LDAPMessage*); +WLDAP32_LDAPMessage * CDECL WLDAP32_ldap_next_reference(WLDAP32_LDAP*,WLDAP32_LDAPMessage*); +WLDAP32_LDAP * CDECL ldap_openA(PCHAR,ULONG); +WLDAP32_LDAP * CDECL ldap_openW(PWCHAR,ULONG); ULONG CDECL ldap_parse_extended_resultA(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,PCHAR*,struct WLDAP32_berval**,BOOLEAN); ULONG CDECL ldap_parse_extended_resultW(WLDAP32_LDAP*,WLDAP32_LDAPMessage*,PWCHAR*,struct WLDAP32_berval**,BOOLEAN); ULONG CDECL ldap_parse_page_controlA(WLDAP32_LDAP*,PLDAPControlA*,ULONG*,struct WLDAP32_berval**); @@ -438,8 +438,8 @@ ULONG CDECL ldap_simple_bindW(WLDAP32_LDAP*,PWCHAR,PWCHAR); ULONG CDECL ldap_simple_bind_sA(WLDAP32_LDAP*,PCHAR,PCHAR); ULONG CDECL ldap_simple_bind_sW(WLDAP32_LDAP*,PWCHAR,PWCHAR); -WLDAP32_LDAP CDECL *ldap_sslinitA(PCHAR,ULONG,int); -WLDAP32_LDAP CDECL *ldap_sslinitW(PWCHAR,ULONG,int); +WLDAP32_LDAP * CDECL ldap_sslinitA(PCHAR,ULONG,int); +WLDAP32_LDAP * CDECL ldap_sslinitW(PWCHAR,ULONG,int); ULONG CDECL ldap_start_tls_sA(WLDAP32_PLDAP,PULONG,WLDAP32_LDAPMessage**,PLDAPControlA*,PLDAPControlA*); ULONG CDECL ldap_start_tls_sW(WLDAP32_PLDAP,PULONG,WLDAP32_LDAPMessage**,PLDAPControlW*,PLDAPControlW*); ULONG CDECL ldap_startup(PLDAP_VERSION_INFO,HANDLE*);
15 years, 10 months
1
0
0
0
[dchapyshev] 39762: - Delete unneeded file
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Thu Feb 26 13:24:39 2009 New Revision: 39762 URL:
http://svn.reactos.org/svn/reactos?rev=39762&view=rev
Log: - Delete unneeded file Removed: trunk/reactos/dll/win32/iphlpapi/Makefile.in Removed: trunk/reactos/dll/win32/iphlpapi/Makefile.in URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/iphlpapi/Makefil…
============================================================================== --- trunk/reactos/dll/win32/iphlpapi/Makefile.in [iso-8859-1] (original) +++ trunk/reactos/dll/win32/iphlpapi/Makefile.in (removed) @@ -1,26 +1,0 @@ -EXTRADEFS = -TOPSRCDIR = @top_srcdir@ -TOPOBJDIR = ../.. -SRCDIR = @srcdir@ -VPATH = @srcdir@ -MODULE = iphlpapi.dll -IMPORTS = advapi32 kernel32 rtl -DELAYIMPORTS = -EXTRALIBS = - -C_SRCS = \ - ifenum_reactos.c \ - ipstats_reactos.c \ - iphlpapi_main.c \ - media.c \ - registry.c \ - resinfo_reactos.c \ - route_reactos.c - -RC_SRCS = iphlpapi.rc -RC_BINSRC = iphlpapi.rc -RC_BINARIES = - -@MAKE_DLL_RULES@ - -### Dependencies:
15 years, 10 months
1
0
0
0
[dchapyshev] 39761: - Sync gdiplus, hhctrl and inetcomm with Wine head
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Thu Feb 26 13:24:00 2009 New Revision: 39761 URL:
http://svn.reactos.org/svn/reactos?rev=39761&view=rev
Log: - Sync gdiplus, hhctrl and inetcomm with Wine head Modified: trunk/reactos/dll/win32/gdiplus/graphics.c trunk/reactos/dll/win32/gdiplus/graphicspath.c trunk/reactos/dll/win32/gdiplus/image.c trunk/reactos/dll/win32/gdiplus/region.c trunk/reactos/dll/win32/hhctrl.ocx/hhctrl.c trunk/reactos/dll/win32/inetcomm/inetcomm.rbuild trunk/reactos/dll/win32/inetcomm/inetcomm_private.h trunk/reactos/dll/win32/inetcomm/internettransport.c trunk/reactos/dll/win32/inetcomm/mimeintl.c trunk/reactos/dll/win32/inetcomm/mimeole.c trunk/reactos/dll/win32/inetcomm/smtptransport.c Modified: trunk/reactos/dll/win32/gdiplus/graphics.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/graphics…
============================================================================== --- trunk/reactos/dll/win32/gdiplus/graphics.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdiplus/graphics.c [iso-8859-1] Thu Feb 26 13:24:00 2009 @@ -1901,7 +1901,6 @@ j++; } - stringdup[j] = 0; length = j; while(sum < length){ Modified: trunk/reactos/dll/win32/gdiplus/graphicspath.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/graphics…
============================================================================== --- trunk/reactos/dll/win32/gdiplus/graphicspath.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdiplus/graphicspath.c [iso-8859-1] Thu Feb 26 13:24:00 2009 @@ -1384,16 +1384,33 @@ return GdipIsVisiblePathPoint(path, x, y, graphics, result); } +/***************************************************************************** + * GdipIsVisiblePathPoint [GDIPLUS.@] + */ GpStatus WINGDIPAPI GdipIsVisiblePathPoint(GpPath* path, REAL x, REAL y, GpGraphics *graphics, BOOL *result) { - static int calls; - - if(!path) return InvalidParameter; - - if(!(calls++)) - FIXME("not implemented\n"); - - return NotImplemented; + GpRegion *region; + HRGN hrgn; + GpStatus status; + + if(!path || !result) return InvalidParameter; + + status = GdipCreateRegionPath(path, ®ion); + if(status != Ok) + return status; + + status = GdipGetRegionHRgn(region, graphics, &hrgn); + if(status != Ok){ + GdipDeleteRegion(region); + return status; + } + + *result = PtInRegion(hrgn, roundr(x), roundr(y)); + + DeleteObject(hrgn); + GdipDeleteRegion(region); + + return Ok; } GpStatus WINGDIPAPI GdipStartPathFigure(GpPath *path) Modified: trunk/reactos/dll/win32/gdiplus/image.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/image.c?…
============================================================================== --- trunk/reactos/dll/win32/gdiplus/image.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdiplus/image.c [iso-8859-1] Thu Feb 26 13:24:00 2009 @@ -496,12 +496,6 @@ if(scan0 && !stride) return InvalidParameter; - /* FIXME: windows allows negative stride (reads backwards from scan0) */ - if(stride < 0){ - FIXME("negative stride\n"); - return InvalidParameter; - } - *bitmap = GdipAlloc(sizeof(GpBitmap)); if(!*bitmap) return OutOfMemory; @@ -527,16 +521,29 @@ bmih->biSize = sizeof(BITMAPINFOHEADER); bmih->biWidth = width; - bmih->biHeight = -height; /* FIXME: use the rest of the data from format */ bmih->biBitCount = PIXELFORMATBPP(format); bmih->biCompression = BI_RGB; bmih->biSizeImage = datalen; - if(scan0) - memcpy(bmih + 1, scan0, datalen); + if (scan0) + { + if (stride > 0) + { + bmih->biHeight = -height; + memcpy(bmih + 1, scan0, datalen); + } + else + { + bmih->biHeight = height; + memcpy(bmih + 1, scan0 + stride * (height - 1), datalen); + } + } else + { + bmih->biHeight = height; memset(bmih + 1, 0, datalen); + } if(CreateStreamOnHGlobal(buff, TRUE, &stream) != S_OK){ ERR("could not make stream\n"); @@ -1492,6 +1499,7 @@ BITMAP bm; GpStatus retval; PixelFormat format; + BYTE* bits; TRACE("%p %p %p\n", hbm, hpal, bitmap); @@ -1532,8 +1540,16 @@ return InvalidParameter; } - retval = GdipCreateBitmapFromScan0(bm.bmWidth, bm.bmHeight, bm.bmWidthBytes, - format, bm.bmBits, bitmap); + if (bm.bmBits) + bits = (BYTE*)bm.bmBits + (bm.bmHeight - 1) * bm.bmWidthBytes; + else + { + FIXME("can only get image data from DIB sections\n"); + bits = NULL; + } + + retval = GdipCreateBitmapFromScan0(bm.bmWidth, bm.bmHeight, -bm.bmWidthBytes, + format, bits, bitmap); return retval; } Modified: trunk/reactos/dll/win32/gdiplus/region.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/region.c…
============================================================================== --- trunk/reactos/dll/win32/gdiplus/region.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdiplus/region.c [iso-8859-1] Thu Feb 26 13:24:00 2009 @@ -339,6 +339,9 @@ return GdipCombineRegionRect(region, &rectf, mode); } +/***************************************************************************** + * GdipCombineRegionRegion [GDIPLUS.@] + */ GpStatus WINGDIPAPI GdipCombineRegionRegion(GpRegion *region1, GpRegion *region2, CombineMode mode) { @@ -544,6 +547,9 @@ return Ok; } +/***************************************************************************** + * GdipCreateRegionRectI [GDIPLUS.@] + */ GpStatus WINGDIPAPI GdipCreateRegionRectI(GDIPCONST GpRect *rect, GpRegion **region) { @@ -621,6 +627,9 @@ return stat; } +/***************************************************************************** + * GdipDeleteRegion [GDIPLUS.@] + */ GpStatus WINGDIPAPI GdipDeleteRegion(GpRegion *region) { TRACE("%p\n", region); @@ -799,7 +808,7 @@ * * RETURNS * SUCCESS: Ok - * FAILURE: InvalidParamter + * FAILURE: InvalidParameter * * NOTES * The header contains the size, a checksum, a version string, and the number Modified: trunk/reactos/dll/win32/hhctrl.ocx/hhctrl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/hhctrl.ocx/hhctr…
============================================================================== --- trunk/reactos/dll/win32/hhctrl.ocx/hhctrl.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/hhctrl.ocx/hhctrl.c [iso-8859-1] Thu Feb 26 13:24:00 2009 @@ -249,11 +249,28 @@ int WINAPI doWinMain(HINSTANCE hInstance, LPSTR szCmdLine) { MSG msg; + int len, buflen; + WCHAR *filename; + char *endq = NULL; hh_process = TRUE; /* FIXME: Check szCmdLine for bad arguments */ - HtmlHelpA(GetDesktopWindow(), szCmdLine, HH_DISPLAY_TOPIC, 0); + if (*szCmdLine == '\"') + endq = strchr(++szCmdLine, '\"'); + + if (endq) + len = endq - szCmdLine; + else + len = strlen(szCmdLine); + buflen = MultiByteToWideChar(CP_ACP, 0, szCmdLine, len, NULL, 0) + 1; + filename = heap_alloc(buflen * sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, szCmdLine, len, filename, buflen); + filename[buflen-1] = 0; + + HtmlHelpW(GetDesktopWindow(), filename, HH_DISPLAY_TOPIC, 0); + + heap_free(filename); while (GetMessageW(&msg, 0, 0, 0)) { Modified: trunk/reactos/dll/win32/inetcomm/inetcomm.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/inetcomm/inetcom…
============================================================================== --- trunk/reactos/dll/win32/inetcomm/inetcomm.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/win32/inetcomm/inetcomm.rbuild [iso-8859-1] Thu Feb 26 13:24:00 2009 @@ -1,7 +1,7 @@ <?xml version="1.0"?> <!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd"> <group> -<module name="inetcomm" type="win32dll" baseaddress="${BASEADDRESS_INETCOMM}" installbase="system32" installname="inetcomm.dll"> +<module name="inetcomm" type="win32dll" baseaddress="${BASEADDRESS_INETCOMM}" installbase="system32" installname="inetcomm.dll" allowwarnings="true"> <autoregister infsection="OleControlDlls" type="DllRegisterServer" /> <importlibrary definition="inetcomm.spec" /> <include base="inetcomm">.</include> Modified: trunk/reactos/dll/win32/inetcomm/inetcomm_private.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/inetcomm/inetcom…
============================================================================== --- trunk/reactos/dll/win32/inetcomm/inetcomm_private.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/inetcomm/inetcomm_private.h [iso-8859-1] Thu Feb 26 13:24:00 2009 @@ -61,8 +61,6 @@ HRESULT InternetTransport_GetStatus(InternetTransport *This, IXPSTATUS *pCurrentStatus); HRESULT InternetTransport_ChangeStatus(InternetTransport *This, IXPSTATUS Status); -HRESULT InternetTransport_Read(InternetTransport *This, int cbBuffer, - INETXPORT_COMPLETION_FUNCTION fnCompletion); HRESULT InternetTransport_ReadLine(InternetTransport *This, INETXPORT_COMPLETION_FUNCTION fnCompletion); HRESULT InternetTransport_Write(InternetTransport *This, const char *pvData, Modified: trunk/reactos/dll/win32/inetcomm/internettransport.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/inetcomm/interne…
============================================================================== --- trunk/reactos/dll/win32/inetcomm/internettransport.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/inetcomm/internettransport.c [iso-8859-1] Thu Feb 26 13:24:00 2009 @@ -204,29 +204,6 @@ return S_OK; } -HRESULT InternetTransport_Read(InternetTransport *This, int cbBuffer, - INETXPORT_COMPLETION_FUNCTION fnCompletion) -{ - if (This->Status == IXP_DISCONNECTED) - return IXP_E_NOT_CONNECTED; - - if (This->fnCompletion) - return IXP_E_BUSY; - - This->fnCompletion = fnCompletion; - - This->cbBuffer = cbBuffer; - This->pBuffer = HeapAlloc(GetProcessHeap(), 0, This->cbBuffer); - This->iCurrentBufferOffset = 0; - - if (WSAAsyncSelect(This->Socket, This->hwnd, IX_READ, FD_READ) == SOCKET_ERROR) - { - ERR("WSAAsyncSelect failed with error %d\n", WSAGetLastError()); - /* FIXME: handle error */ - } - return S_OK; -} - HRESULT InternetTransport_ReadLine(InternetTransport *This, INETXPORT_COMPLETION_FUNCTION fnCompletion) { Modified: trunk/reactos/dll/win32/inetcomm/mimeintl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/inetcomm/mimeint…
============================================================================== --- trunk/reactos/dll/win32/inetcomm/mimeintl.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/inetcomm/mimeintl.c [iso-8859-1] Thu Feb 26 13:24:00 2009 @@ -119,7 +119,7 @@ if(hCharset == NULL) return E_INVALIDARG; /* FIXME check hCharset is valid */ - (void)InterlockedExchangePointer(&This->default_charset, hCharset); + InterlockedExchangePointer(&This->default_charset, hCharset); return S_OK; } @@ -136,7 +136,7 @@ HCHARSET hcs; hr = IMimeInternational_GetCodePageCharset(iface, GetACP(), CHARSET_BODY, &hcs); if(SUCCEEDED(hr)) - (void)InterlockedCompareExchangePointer(&This->default_charset, hcs, NULL); + InterlockedCompareExchangePointer(&This->default_charset, hcs, NULL); } *phCharset = This->default_charset; Modified: trunk/reactos/dll/win32/inetcomm/mimeole.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/inetcomm/mimeole…
============================================================================== --- trunk/reactos/dll/win32/inetcomm/mimeole.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/inetcomm/mimeole.c [iso-8859-1] Thu Feb 26 13:24:00 2009 @@ -1125,7 +1125,7 @@ body_offsets.cbBodyStart = body_offsets.cbBodyEnd = 0; MimeBody_set_offsets(This, &body_offsets); - *obj = (IMimeBody *)&This->lpVtbl; + *obj = &This->lpVtbl; return S_OK; } @@ -2563,7 +2563,7 @@ list_init(&This->body_tree); This->next_hbody = (HBODY)1; - *obj = (IMimeMessage *)&This->lpVtbl; + *obj = &This->lpVtbl; return S_OK; } @@ -2774,7 +2774,7 @@ This->lpVtbl = &MimeSecurityVtbl; This->refs = 1; - *obj = (IMimeSecurity *)&This->lpVtbl; + *obj = &This->lpVtbl; return S_OK; } Modified: trunk/reactos/dll/win32/inetcomm/smtptransport.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/inetcomm/smtptra…
============================================================================== --- trunk/reactos/dll/win32/inetcomm/smtptransport.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/inetcomm/smtptransport.c [iso-8859-1] Thu Feb 26 13:24:00 2009 @@ -735,7 +735,7 @@ int len = sizeof(szCommandFormat) - 2 /* "%s" */ + strlen(pszEmailFrom); HRESULT hr; - TRACE("(%s)\n", pszEmailFrom); + TRACE("(%s)\n", debugstr_a(pszEmailFrom)); if (!pszEmailFrom) return E_INVALIDARG; @@ -761,7 +761,7 @@ int len = sizeof(szCommandFormat) - 2 /* "%s" */ + strlen(pszEmailTo); HRESULT hr; - TRACE("(%s)\n", pszEmailTo); + TRACE("(%s)\n", debugstr_a(pszEmailTo)); if (!pszEmailTo) return E_INVALIDARG; @@ -836,7 +836,7 @@ int len = sizeof(szCommandFormat) - 2 /* "%s" */ + strlen(pszAuthType); HRESULT hr; - TRACE("(%s)\n", pszAuthType); + TRACE("(%s)\n", debugstr_a(pszAuthType)); if (!pszAuthType) return E_INVALIDARG;
15 years, 10 months
1
0
0
0
[dchapyshev] 39760: - Sync crypt32 and cryptui with Wine head
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Thu Feb 26 13:21:59 2009 New Revision: 39760 URL:
http://svn.reactos.org/svn/reactos?rev=39760&view=rev
Log: - Sync crypt32 and cryptui with Wine head Modified: trunk/reactos/dll/win32/crypt32/chain.c trunk/reactos/dll/win32/crypt32/crypt32_Ko.rc trunk/reactos/dll/win32/cryptui/cryptui_En.rc trunk/reactos/dll/win32/cryptui/cryptui_Ko.rc trunk/reactos/dll/win32/cryptui/cryptuires.h trunk/reactos/dll/win32/cryptui/main.c Modified: trunk/reactos/dll/win32/crypt32/chain.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/crypt32/chain.c?…
============================================================================== --- trunk/reactos/dll/win32/crypt32/chain.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/crypt32/chain.c [iso-8859-1] Thu Feb 26 13:21:59 2009 @@ -28,6 +28,7 @@ #include "crypt32_private.h" WINE_DEFAULT_DEBUG_CHANNEL(crypt); +WINE_DECLARE_DEBUG_CHANNEL(chain); #define DEFAULT_CYCLE_MODULUS 7 @@ -355,7 +356,7 @@ CRYPT_VERIFY_CERT_SIGN_SUBJECT_CERT, (void *)root, CRYPT_VERIFY_CERT_SIGN_ISSUER_CERT, (void *)root, 0, NULL)) { - TRACE("Last certificate's signature is invalid\n"); + TRACE_(chain)("Last certificate's signature is invalid\n"); rootElement->TrustStatus.dwErrorStatus |= CERT_TRUST_IS_NOT_SIGNATURE_VALID; } @@ -411,8 +412,12 @@ } /* Checks element's basic constraints to see if it can act as a CA, with - * remainingCAs CAs left in this chain. Updates chainConstraints with the - * element's constraints, if: + * remainingCAs CAs left in this chain. A root certificate is assumed to be + * allowed to be a CA whether or not the basic constraints extension is present, + * whereas an intermediate CA cert is not. This matches the expected usage in + * RFC 3280: a conforming intermediate CA MUST contain the basic constraints + * extension. It also appears to match Microsoft's implementation. + * Updates chainConstraints with the element's constraints, if: * 1. chainConstraints doesn't have a path length constraint, or * 2. element's path length constraint is smaller than chainConstraints's * Sets *pathLengthConstraintViolated to TRUE if a path length violation @@ -422,17 +427,17 @@ */ static BOOL CRYPT_CheckBasicConstraintsForCA(PCCERT_CONTEXT cert, CERT_BASIC_CONSTRAINTS2_INFO *chainConstraints, DWORD remainingCAs, - BOOL *pathLengthConstraintViolated) + BOOL isRoot, BOOL *pathLengthConstraintViolated) { BOOL validBasicConstraints; CERT_BASIC_CONSTRAINTS2_INFO constraints; if ((validBasicConstraints = CRYPT_DecodeBasicConstraints(cert, - &constraints, TRUE))) + &constraints, isRoot))) { if (!constraints.fCA) { - TRACE("chain element %d can't be a CA\n", remainingCAs + 1); + TRACE_(chain)("chain element %d can't be a CA\n", remainingCAs + 1); validBasicConstraints = FALSE; } else if (constraints.fPathLenConstraint) @@ -444,7 +449,7 @@ constraints.dwPathLenConstraint < chainConstraints->dwPathLenConstraint) { - TRACE("setting path length constraint to %d\n", + TRACE_(chain)("setting path length constraint to %d\n", chainConstraints->dwPathLenConstraint); chainConstraints->fPathLenConstraint = TRUE; chainConstraints->dwPathLenConstraint = @@ -455,8 +460,8 @@ if (chainConstraints->fPathLenConstraint && remainingCAs > chainConstraints->dwPathLenConstraint) { - TRACE("remaining CAs %d exceed max path length %d\n", remainingCAs, - chainConstraints->dwPathLenConstraint); + TRACE_(chain)("remaining CAs %d exceed max path length %d\n", + remainingCAs, chainConstraints->dwPathLenConstraint); validBasicConstraints = FALSE; *pathLengthConstraintViolated = TRUE; } @@ -709,6 +714,100 @@ } } +static void dump_basic_constraints(PCERT_EXTENSION ext) +{ + CERT_BASIC_CONSTRAINTS_INFO *info; + DWORD size = 0; + + if (CryptDecodeObjectEx(X509_ASN_ENCODING, szOID_BASIC_CONSTRAINTS, + ext->Value.pbData, ext->Value.cbData, CRYPT_DECODE_ALLOC_FLAG, + NULL, &info, &size)) + { + TRACE_(chain)("SubjectType: %02x\n", info->SubjectType.pbData[0]); + TRACE_(chain)("%s path length constraint\n", + info->fPathLenConstraint ? "has" : "doesn't have"); + TRACE_(chain)("path length=%d\n", info->dwPathLenConstraint); + LocalFree(info); + } +} + +static void dump_basic_constraints2(PCERT_EXTENSION ext) +{ + CERT_BASIC_CONSTRAINTS2_INFO constraints; + DWORD size = sizeof(CERT_BASIC_CONSTRAINTS2_INFO); + + if (CryptDecodeObjectEx(X509_ASN_ENCODING, + szOID_BASIC_CONSTRAINTS2, ext->Value.pbData, ext->Value.cbData, + 0, NULL, &constraints, &size)) + { + TRACE_(chain)("basic constraints:\n"); + TRACE_(chain)("can%s be a CA\n", constraints.fCA ? "" : "not"); + TRACE_(chain)("%s path length constraint\n", + constraints.fPathLenConstraint ? "has" : "doesn't have"); + TRACE_(chain)("path length=%d\n", constraints.dwPathLenConstraint); + } +} + +static void dump_extension(PCERT_EXTENSION ext) +{ + TRACE_(chain)("%s (%scritical)\n", debugstr_a(ext->pszObjId), + ext->fCritical ? "" : "not "); + if (!strcmp(ext->pszObjId, szOID_BASIC_CONSTRAINTS)) + dump_basic_constraints(ext); + else if (!strcmp(ext->pszObjId, szOID_BASIC_CONSTRAINTS2)) + dump_basic_constraints2(ext); +} + +static LPCWSTR filetime_to_str(const FILETIME *time) +{ + static WCHAR date[80]; + WCHAR dateFmt[80]; /* sufficient for all versions of LOCALE_SSHORTDATE */ + SYSTEMTIME sysTime; + + if (!time) return NULL; + + GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT, LOCALE_SSHORTDATE, dateFmt, + sizeof(dateFmt) / sizeof(dateFmt[0])); + FileTimeToSystemTime(time, &sysTime); + GetDateFormatW(LOCALE_SYSTEM_DEFAULT, 0, &sysTime, dateFmt, date, + sizeof(date) / sizeof(date[0])); + return date; +} + +static void dump_element(PCCERT_CONTEXT cert) +{ + LPWSTR name = NULL; + DWORD len, i; + + TRACE_(chain)("%p\n", cert); + len = CertGetNameStringW(cert, CERT_NAME_SIMPLE_DISPLAY_TYPE, + CERT_NAME_ISSUER_FLAG, NULL, NULL, 0); + name = CryptMemAlloc(len * sizeof(WCHAR)); + if (name) + { + CertGetNameStringW(cert, CERT_NAME_SIMPLE_DISPLAY_TYPE, + CERT_NAME_ISSUER_FLAG, NULL, name, len); + TRACE_(chain)("issued by %s\n", debugstr_w(name)); + CryptMemFree(name); + } + len = CertGetNameStringW(cert, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0, NULL, + NULL, 0); + name = CryptMemAlloc(len * sizeof(WCHAR)); + if (name) + { + CertGetNameStringW(cert, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0, NULL, + name, len); + TRACE_(chain)("issued to %s\n", debugstr_w(name)); + CryptMemFree(name); + } + TRACE_(chain)("valid from %s to %s\n", + debugstr_w(filetime_to_str(&cert->pCertInfo->NotBefore)), + debugstr_w(filetime_to_str(&cert->pCertInfo->NotAfter))); + TRACE_(chain)("%d extensions\n", cert->pCertInfo->cExtension); + for (i = 0; i < cert->pCertInfo->cExtension; i++) + dump_extension(&cert->pCertInfo->rgExtension[i]); +} + static void CRYPT_CheckSimpleChain(PCertificateChainEngine engine, PCERT_SIMPLE_CHAIN chain, LPFILETIME time) { @@ -717,14 +816,25 @@ BOOL pathLengthConstraintViolated = FALSE; CERT_BASIC_CONSTRAINTS2_INFO constraints = { TRUE, FALSE, 0 }; + TRACE_(chain)("checking chain with %d elements for time %s\n", + chain->cElement, debugstr_w(filetime_to_str(time))); for (i = chain->cElement - 1; i >= 0; i--) { + if (TRACE_ON(chain)) + dump_element(chain->rgpElement[i]->pCertContext); if (CertVerifyTimeValidity(time, chain->rgpElement[i]->pCertContext->pCertInfo) != 0) chain->rgpElement[i]->TrustStatus.dwErrorStatus |= CERT_TRUST_IS_NOT_TIME_VALID; if (i != 0) { + BOOL isRoot; + + if (i == chain->cElement - 1) + isRoot = CRYPT_IsCertificateSelfSigned( + chain->rgpElement[i]->pCertContext); + else + isRoot = FALSE; /* Check the signature of the cert this issued */ if (!CryptVerifyCertificateSignatureEx(0, X509_ASN_ENCODING, CRYPT_VERIFY_CERT_SIGN_SUBJECT_CERT, @@ -741,7 +851,7 @@ CERT_TRUST_INVALID_BASIC_CONSTRAINTS; else if (!CRYPT_CheckBasicConstraintsForCA( chain->rgpElement[i]->pCertContext, &constraints, i - 1, - &pathLengthConstraintViolated)) + isRoot, &pathLengthConstraintViolated)) chain->rgpElement[i]->TrustStatus.dwErrorStatus |= CERT_TRUST_INVALID_BASIC_CONSTRAINTS; else if (constraints.fPathLenConstraint && @@ -884,8 +994,7 @@ issuer = CertFindCertificateInStore(store, subject->dwCertEncodingType, 0, CERT_FIND_SUBJECT_NAME, &subject->pCertInfo->Issuer, prevIssuer); - if (issuer) - *infoStatus = CERT_TRUST_HAS_NAME_MATCH_ISSUER; + *infoStatus = CERT_TRUST_HAS_NAME_MATCH_ISSUER; } return issuer; } @@ -902,12 +1011,13 @@ while (ret && !CRYPT_IsSimpleChainCyclic(chain) && !CRYPT_IsCertificateSelfSigned(cert)) { - DWORD infoStatus; - PCCERT_CONTEXT issuer = CRYPT_GetIssuer(world, cert, NULL, &infoStatus); + PCCERT_CONTEXT issuer = CRYPT_GetIssuer(world, cert, NULL, + &chain->rgpElement[chain->cElement - 1]->TrustStatus.dwInfoStatus); if (issuer) { - ret = CRYPT_AddCertToSimpleChain(engine, chain, issuer, infoStatus); + ret = CRYPT_AddCertToSimpleChain(engine, chain, issuer, + chain->rgpElement[chain->cElement - 1]->TrustStatus.dwInfoStatus); /* CRYPT_AddCertToSimpleChain add-ref's the issuer, so free it to * close the enumeration that found it */ @@ -916,7 +1026,7 @@ } else { - TRACE("Couldn't find issuer, halting chain creation\n"); + TRACE_(chain)("Couldn't find issuer, halting chain creation\n"); chain->TrustStatus.dwErrorStatus |= CERT_TRUST_IS_PARTIAL_CHAIN; break; } Modified: trunk/reactos/dll/win32/crypt32/crypt32_Ko.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/crypt32/crypt32_…
============================================================================== --- trunk/reactos/dll/win32/crypt32/crypt32_Ko.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/crypt32/crypt32_Ko.rc [iso-8859-1] Thu Feb 26 13:21:59 2009 @@ -172,6 +172,7 @@ IDS_LOCALIZEDNAME_MY "°³ÀÎ" IDS_LOCALIZEDNAME_CA "Áß°³ °ËÁõ ±â°ü" IDS_LOCALIZEDNAME_ADDRESSBOOK "´Ù¸¥ »ç¶÷" + IDS_LOCALIZEDNAME_TRUSTEDPUBLISHER "½Å·ÚÇÒ ¼ö ÀÖ´Â ¹ßÇàÀÚ" } STRINGTABLE DISCARDABLE Modified: trunk/reactos/dll/win32/cryptui/cryptui_En.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/cryptui/cryptui_…
============================================================================== --- trunk/reactos/dll/win32/cryptui/cryptui_En.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/cryptui/cryptui_En.rc [iso-8859-1] Thu Feb 26 13:21:59 2009 @@ -102,8 +102,8 @@ IDS_FRIENDLY_NAME_COLUMN "Friendly Name" IDS_ALLOWED_PURPOSE_ALL "<All>" IDS_ALLOWED_PURPOSE_NONE "<None>" - IDS_WARN_REMOVE_MY "You will no longer be able to decrypt mesages with this certificate, or sign messages with it.\nAre you sure you want to remove this certificate?" - IDS_WARN_REMOVE_PLURAL_MY "You will no longer be able to decrypt mesages with these certificate, or sign messages with them.\nAre you sure you want to remove these certificates?" + IDS_WARN_REMOVE_MY "You will no longer be able to decrypt messages with this certificate, or sign messages with it.\nAre you sure you want to remove this certificate?" + IDS_WARN_REMOVE_PLURAL_MY "You will no longer be able to decrypt messages with these certificates, or sign messages with them.\nAre you sure you want to remove these certificates?" IDS_WARN_REMOVE_ADDRESSBOOK "You will no longer be able to encrypt messages with this certificate, or verify messages signed with it.\nAre you sure you want to remove this certificate?" IDS_WARN_REMOVE_PLURAL_ADDRESSBOOK "You will no longer be able to encrypt messages with these certificates, or verify messages signed with it.\nAre you sure you want to remove these certificates?" IDS_WARN_REMOVE_CA "Certificates issued by this certification authority will no longer be trusted.\nAre you sure you want to remove this certificate?" @@ -161,6 +161,13 @@ IDS_NO "No" IDS_EXPORT_SUCCEEDED "The export was successful." IDS_EXPORT_FAILED "The export failed." + IDS_EXPORT_PRIVATE_KEY_TITLE "Export Private Key" + IDS_EXPORT_PRIVATE_KEY_SUBTITLE "The certificate contains a private key which may be exported along with the certificate." + IDS_EXPORT_PASSWORD_TITLE "Enter Password" + IDS_EXPORT_PASSWORD_SUBTITLE "You may password-protect a private key." + IDS_EXPORT_PASSWORD_MISMATCH "The passwords do not match." + IDS_EXPORT_PRIVATE_KEY_UNAVAILABLE "Note: The private key for this certificate could not be opened." + IDS_EXPORT_PRIVATE_KEY_NON_EXPORTABLE "Note: The private key for this certificate is not exportable." } IDD_GENERAL DIALOG DISCARDABLE 0, 0, 255, 236 @@ -379,6 +386,29 @@ -1, 115,56,195,40 LTEXT "To continue, click Next.", -1, 115,103,195,8 +END + +IDD_EXPORT_PRIVATE_KEY DIALOG DISCARDABLE 0,0,317,143 +CAPTION "Certificate Export Wizard" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "If you choose to export the private key, you will be prompted for a password to protect the private key on a later page.", -1, 21,1,195,23 + LTEXT "Do you wish to export the private key?", -1, 21,24,195,15 + AUTORADIOBUTTON "&Yes, export the private key", + IDC_EXPORT_PRIVATE_KEY_YES, 31,36,200,12, BS_AUTORADIOBUTTON|WS_TABSTOP + AUTORADIOBUTTON "N&o, do not export the private key", + IDC_EXPORT_PRIVATE_KEY_NO, 31,48,200,12, BS_AUTORADIOBUTTON + LTEXT "", IDC_EXPORT_PRIVATE_KEY_UNAVAILABLE, 21,60,200,24 +END + +IDD_EXPORT_PASSWORD DIALOG DISCARDABLE 0,0,317,143 +CAPTION "Certificate Export Wizard" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "&Password:", -1, 21,1,195,10 + EDITTEXT IDC_EXPORT_PASSWORD, 21,11,208,14, ES_AUTOHSCROLL|WS_TABSTOP + LTEXT "&Confirm password:", -1, 21,35,195,10 + EDITTEXT IDC_EXPORT_PASSWORD_CONFIRM, 21,45,208,14, ES_AUTOHSCROLL|WS_TABSTOP END IDD_EXPORT_FORMAT DIALOG DISCARDABLE 0,0,317,143 Modified: trunk/reactos/dll/win32/cryptui/cryptui_Ko.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/cryptui/cryptui_…
============================================================================== --- trunk/reactos/dll/win32/cryptui/cryptui_Ko.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/cryptui/cryptui_Ko.rc [iso-8859-1] Thu Feb 26 13:21:59 2009 @@ -143,6 +143,34 @@ IDS_PURPOSE_CA_EXCHANGE "»çÀû Å° º¸°ü¼Ò" IDS_PURPOSE_KEY_RECOVERY_AGENT "Å° º¹±¸ ¿¡ÀÌÀüÆ®" IDS_PURPOSE_DS_EMAIL_REPLICATION "µð·ºÅ丮 ¼ºñ½º ÀüÀÚ¿ìÆí º¹Á¦" + IDS_EXPORT_WIZARD "ÀÎÁõ¼ ³»º¸³»±â ¸¶¹ý»ç" + IDS_EXPORT_FORMAT_TITLE "³»º¸³¾ Çü½Ä" + IDS_EXPORT_FORMAT_SUBTITLE "³»¿ëÀ» ÀúÀåÇÒ Çü½Ä ¼±ÅÃ." + IDS_EXPORT_FILE_TITLE "³»º¸³¾ ÆÄÀÏÀ̸§" + IDS_EXPORT_FILE_SUBTITLE "³»¿ëÀ» ÀúÀåÇÒ ÆÄÀÏ À̸§ ÁöÁ¤." + IDS_EXPORT_FILE_EXISTS "ÁöÁ¤µÈ ÆÄÀÏÀº ÀÌ¹Ì Á¸ÀçÇÕ´Ï´Ù.µ¤¾î ¾²½Ã°Ú½À´Ï±î?" + IDS_EXPORT_FILTER_CERT "DER-¾ÏÈ£ÈµÈ ¹ÙÀ̳ʸ® X.509 (*.cer)" + IDS_EXPORT_FILTER_BASE64_CERT "Base64-¾ÏÈ£ÈµÈ X.509 (*.cer)" + IDS_EXPORT_FILTER_CRL "ÀÎÁõ¼ Æó±â ¸ñ·Ï (*.crl)" + IDS_EXPORT_FILTER_CTL "ÀÎÁõ¼ ½Å·Ú ¸ñ·Ï (*.stl)" + IDS_EXPORT_FILTER_CMS "CMS/PKCS #7 ¸Þ¼¼Áö (*.p7b)" + IDS_EXPORT_FILTER_PFX "°³ÀÎ Á¤º¸ ±³È¯ (*.pfx)" + IDS_EXPORT_FILTER_SERIALIZED_CERT_STORE "³ª¿µÈ ÀÎÁõ¼ ÀúÀå¼Ò (*.sst)" + IDS_EXPORT_FORMAT "ÆÄÀÏ Çü½Ä" + IDS_EXPORT_INCLUDE_CHAIN "ÀÎÁõ °æ·Î¿¡ ÀÖ´Â ¸ðµç ÀÎÁõ¼ Æ÷ÇÔ" + IDS_EXPORT_KEYS "³»º¸³¾ Å°" + IDS_YES "¿¹" + IDS_NO "¾Æ´Ï¿À" + IDS_EXPORT_SUCCEEDED "³»º¸³»±â ¼º°ø." + IDS_EXPORT_FAILED "³»º¸³»±â ½ÇÆÐ." + IDS_EXPORT_PRIVATE_KEY_TITLE "³»º¸³¾ °³ÀÎ Å°" + IDS_EXPORT_PRIVATE_KEY_SUBTITLE "ÀÌ ÀÎÁõ¼´Â ÀÎÁõ¼¸¦ ³»º¸³¾ ¶§ °°ÀÌ ³ª°¥ °³ÀÎÅ°¸¦ Æ÷ÇÔÇÏ°í ÀÖ½À´Ï´Ù." + IDS_EXPORT_PASSWORD_TITLE "¾ÏÈ£ ÀÔ·Â" + IDS_EXPORT_PASSWORD_SUBTITLE "ÀÌ °³ÀÎÅ°´Â ¾Æ¸¶µµ ¾ÏÈ£·Î º¸È£µÇ¾îÀÖ´Â °Í °°½À´Ï´Ù." + IDS_EXPORT_PASSWORD_MISMATCH "ÀÌ ¾ÏÈ£´Â ¸ÂÁö ¾Ê½À´Ï´Ù." + IDS_EXPORT_PRIVATE_KEY_UNAVAILABLE "ÁÖÀÇ: ÀÌ ÀÎÁõ¼¸¦ À§ÇÑ °³ÀÎ Å°¸¦ ¿ ¼ö ¾ø½À´Ï´Ù." + IDS_EXPORT_PRIVATE_KEY_NON_EXPORTABLE "ÁÖÀÇ: ÀÌ ÀÎÁõ¼¸¦ À§ÇÑ °³ÀÎ Å°¸¦ ³»º¸³¾ ¼ö ¾ø½À´Ï´Ù." + } IDD_GENERAL DIALOG DISCARDABLE 0, 0, 255, 236 @@ -330,3 +358,90 @@ PUSHBUTTON "È®ÀÎ", IDOK, 132,155,51,14, BS_DEFPUSHBUTTON PUSHBUTTON "Ãë¼Ò", IDCANCEL, 190,155,51,14 END + + +IDD_EXPORT_WELCOME DIALOG DISCARDABLE 0,0,317,143 +CAPTION "ÀÎÁõ¼ ³»º¸³»±â ¸¶¹ý»ç" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "ÀÎÁõ¼ ³»º¸³»±â ¸¶¹ý»ç¿¡ ¿À½Å °ÍÀ» ȯ¿µÇÕ´Ï´Ù", IDC_EXPORT_TITLE, + 115,1,195,40 + LTEXT "ÀÌ ¸¶¹ý»ç´Â ÀÎÁõ¼,ÀÎÁõ¼ Æó±â ¸ñ·Ï,ÀÎÁõ¼ ½Å·Ú ¸ñ·ÏÀ» ÀÎÁõ¼ ÀúÀå¼Ò·ÎºÎÅÍ ÆÄÀÏ·Î ³»º¸³»´Â °ÍÀ» µµ¿ÍÁÙ°Ì´Ï´Ù.", + -1, 115,33,195,16 + LTEXT " ÀÎÁõ¼´Â ´ç½ÅÀ̳ª ´ç½ÅÀÌ Åë½Å¿¡ »ç¿ëÇÏ´Â ÄÄÇ»Å͸¦ ½Å¿øº¸ÁõÇÏ´Â µ¥ »ç¿ëµË´Ï´Ù. ¶ÇÇÑ ¸Þ¼¼Áö¿¡ »çÀÎÇÏ°í ÀÎÁõÇÏ´Â µ¥µµ »ç¿ëµË´Ï´Ù. ÀÎÁõ¼ º¸°ü¼Ò´Â ÀÎÁõ¼, ÀÎÁõ¼ Æı⠸ñ·Ï, ÀÎÁõ¼ ½Å·Ú ¸ñ·ÏÀÇ ÀúÀå¼ÒÀÔ´Ï´Ù..", + -1, 115,56,195,40 + LTEXT "°è¼Ó ÇϽǷÁ¸é, <´ÙÀ½>À» Ŭ¸¯ÇϽʽÿÀ.", + -1, 115,103,195,8 +END + +IDD_EXPORT_PRIVATE_KEY DIALOG DISCARDABLE 0,0,317,143 +CAPTION "ÀÎÁõ¼ ³»º¸³»±â ¸¶¹ý»ç" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "´ç½ÅÀÌ °³ÀÎ Å°¸¦ ³»º¸³»±â¸¦ ¼±ÅÃÇϸé, ´ç½ÅÀº ´ÙÀ½ ÆäÀÌÁö¿¡¼ °³ÀÎ Å°¸¦ º¸È£ÇÒ ¾ÏÈ£¸¦ ÀÔ·ÂÇÏ°Ô µÉ °ÍÀÔ´Ï´Ù.", -1, 21,1,195,23 + LTEXT "°³ÀÎ Å°¸¦ ³»º¸³»±â¸¦ ¿øÇմϱî?", -1, 21,24,195,15 + AUTORADIOBUTTON "¿¹(&Y), °³ÀÎ Å° ³»º¸³»±â", + IDC_EXPORT_PRIVATE_KEY_YES, 31,36,200,12, BS_AUTORADIOBUTTON|WS_TABSTOP + AUTORADIOBUTTON "¾Æ´Ï¿À(&O), °³ÀÎ Å° ¾È ³»º¸³»±â", + IDC_EXPORT_PRIVATE_KEY_NO, 31,48,200,12, BS_AUTORADIOBUTTON + LTEXT "", IDC_EXPORT_PRIVATE_KEY_UNAVAILABLE, 21,60,200,24 +END + +IDD_EXPORT_PASSWORD DIALOG DISCARDABLE 0,0,317,143 +CAPTION "ÀÎÁõ¼ ³»º¸³»±â ¸¶¹ý»ç" +FONT 8, "MS Shell Dlg" +BEGIN +LTEXT "¾ÏÈ£(&P):", -1, 21,1,195,10 +EDITTEXT IDC_EXPORT_PASSWORD, 21,11,208,14, ES_AUTOHSCROLL|WS_TABSTOP +LTEXT "¾ÏÈ£ È®ÀÎ(&C):", -1, 21,35,195,10 +EDITTEXT IDC_EXPORT_PASSWORD_CONFIRM, 21,45,208,14, ES_AUTOHSCROLL|WS_TABSTOP +END + +IDD_EXPORT_FORMAT DIALOG DISCARDABLE 0,0,317,143 +CAPTION "ÀÎÁõ¼ ³»º¸³»±â ¸¶¹ý»ç" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "»ç¿ëÇÒ ÆÄÀÏ Çü½Ä ¼±ÅÃ:", -1, 21,1,195,10 + AUTORADIOBUTTON "&DER-¾ÏÈ£ÈµÈ X.509 (.cer)", + IDC_EXPORT_FORMAT_DER, 31,18,200,12, BS_AUTORADIOBUTTON|WS_TABSTOP + AUTORADIOBUTTON "Ba&se64-¾ÏÈ£ÈµÈ X.509 (.cer):", + IDC_EXPORT_FORMAT_BASE64, 31,30,200,12, BS_AUTORADIOBUTTON + AUTORADIOBUTTON "¾ÏÈ£ ¸Þ½ÃÁö ¹®¹ý Ç¥ÁØ/PKCS #7 ¸Þ½ÃÁö(&C) (.p7b)", + IDC_EXPORT_FORMAT_CMS, 31,42,200,12, BS_AUTORADIOBUTTON + CHECKBOX "°¡´ÉÇÑ ÀÎÁõ¼ °æ·Î¿¡ ÀÖ´Â ¸ðµç ÀÎÁõ¼ Æ÷ÇÔ(&I)", + IDC_EXPORT_CMS_INCLUDE_CHAIN, 44,57,200,8, BS_AUTOCHECKBOX|WS_TABSTOP|WS_DISABLED + AUTORADIOBUTTON "°³ÀÎ Á¤º¸ ±³È¯(&P)/PKCS #12 (.pfx)", + IDC_EXPORT_FORMAT_PFX, 31,72,200,12, BS_AUTORADIOBUTTON|WS_DISABLED + CHECKBOX "°¡´ÉÇÑ ÀÎÁõ¼ °æ·Î¿¡ ÀÖ´Â ¸ðµç ÀÎÁõ¼ Æ÷ÇÔ(&U)", + IDC_EXPORT_PFX_INCLUDE_CHAIN, 44,87,200,8, BS_AUTOCHECKBOX|WS_TABSTOP|WS_DISABLED + CHECKBOX "°ÇÑ ¾ÏÈ£È °¡´É(&E)", + IDC_EXPORT_PFX_STRONG_ENCRYPTION, 44,102,200,8, + BS_AUTOCHECKBOX|WS_TABSTOP|WS_DISABLED + CHECKBOX "³»º¸³»±â°¡ ¼º°øÇÏ¸é °³ÀÎ Å° Áö¿ì±â(&K)", + IDC_EXPORT_PFX_DELETE_PRIVATE_KEY, 44,117,200,8, + BS_AUTOCHECKBOX|WS_TABSTOP|WS_DISABLED +END + +IDD_EXPORT_FILE DIALOG DISCARDABLE 0,0,317,143 +CAPTION "ÀÎÁõ¼ ³»º¸³»±â ¸¶¹ý»ç" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "ÆÄÀÏ À̸§(&F):", -1, 21,1,195,10 + EDITTEXT IDC_EXPORT_FILENAME, 21,11,208,14, ES_AUTOHSCROLL|WS_TABSTOP + PUSHBUTTON "ã±â(&R)...", IDC_EXPORT_BROWSE_FILE, 236,11,60,14 +END + +IDD_EXPORT_FINISH DIALOG DISCARDABLE 0,0,317,143 +CAPTION "ÀÎÁõ¼ ³»º¸³»±â ¸¶¹ý»ç" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "ÀÎÁõ¼ ³»º¸³»±â ¸¶¹ý¼ ¿Ï·áÇÏ´Â Áß", IDC_EXPORT_TITLE, + 115,1,195,40 + LTEXT "´ç½ÅÀº ÀÎÁõ¼ ³»º¸³»±â ¸¶¹ý¸¦ ¿Ï·áÇÏ´Â µ¥ ¼º°øÇÏ¿´½À´Ï´Ù.", + -1, 115,33,195,24 + LTEXT "´ç½ÅÀº ´ÙÀ½ ¼³Á¤À» ÁöÁ¤Çß½À´Ï´Ù:", + -1, 115,57,195,12 + CONTROL "", IDC_EXPORT_SETTINGS, "SysListView32", + LVS_REPORT|LVS_NOCOLUMNHEADER|LVS_SINGLESEL|WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_BORDER, + 115,67,174,100 +END Modified: trunk/reactos/dll/win32/cryptui/cryptuires.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/cryptui/cryptuir…
============================================================================== --- trunk/reactos/dll/win32/cryptui/cryptuires.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/cryptui/cryptuires.h [iso-8859-1] Thu Feb 26 13:21:59 2009 @@ -160,6 +160,13 @@ #define IDS_NO 1217 #define IDS_EXPORT_SUCCEEDED 1218 #define IDS_EXPORT_FAILED 1219 +#define IDS_EXPORT_PRIVATE_KEY_TITLE 1220 +#define IDS_EXPORT_PRIVATE_KEY_SUBTITLE 1221 +#define IDS_EXPORT_PASSWORD_TITLE 1222 +#define IDS_EXPORT_PASSWORD_SUBTITLE 1223 +#define IDS_EXPORT_PASSWORD_MISMATCH 1224 +#define IDS_EXPORT_PRIVATE_KEY_UNAVAILABLE 1225 +#define IDS_EXPORT_PRIVATE_KEY_NON_EXPORTABLE 1226 #define IDD_GENERAL 100 #define IDD_DETAIL 101 @@ -175,9 +182,11 @@ #define IDD_CERT_MGR 111 #define IDD_CERT_MGR_ADVANCED 112 #define IDD_EXPORT_WELCOME 113 -#define IDD_EXPORT_FORMAT 114 -#define IDD_EXPORT_FILE 115 -#define IDD_EXPORT_FINISH 116 +#define IDD_EXPORT_PRIVATE_KEY 114 +#define IDD_EXPORT_PASSWORD 115 +#define IDD_EXPORT_FORMAT 116 +#define IDD_EXPORT_FILE 117 +#define IDD_EXPORT_FINISH 118 #define IDB_SMALL_ICONS 200 #define IDB_CERT 201 @@ -253,5 +262,10 @@ #define IDC_EXPORT_FILENAME 2909 #define IDC_EXPORT_BROWSE_FILE 2910 #define IDC_EXPORT_SETTINGS 2911 +#define IDC_EXPORT_PRIVATE_KEY_YES 2912 +#define IDC_EXPORT_PRIVATE_KEY_NO 2913 +#define IDC_EXPORT_PRIVATE_KEY_UNAVAILABLE 2914 +#define IDC_EXPORT_PASSWORD 2915 +#define IDC_EXPORT_PASSWORD_CONFIRM 2916 #endif /* ndef __CRYPTUIRES_H_ */ Modified: trunk/reactos/dll/win32/cryptui/main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/cryptui/main.c?r…
============================================================================== --- trunk/reactos/dll/win32/cryptui/main.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/cryptui/main.c [iso-8859-1] Thu Feb 26 13:21:59 2009 @@ -1076,25 +1076,24 @@ HWND tab = GetDlgItem(hwnd, IDC_MGR_STORES); data = HeapAlloc(GetProcessHeap(), 0, sizeof(struct CertMgrData)); - if (data) - { - data->imageList = ImageList_Create(16, 16, ILC_COLOR4 | ILC_MASK, - 2, 0); - if (data->imageList) - { - HBITMAP bmp; - COLORREF backColor = RGB(255, 0, 255); - - bmp = LoadBitmapW(hInstance, MAKEINTRESOURCEW(IDB_SMALL_ICONS)); - ImageList_AddMasked(data->imageList, bmp, backColor); - DeleteObject(bmp); - ImageList_SetBkColor(data->imageList, CLR_NONE); - SendMessageW(GetDlgItem(hwnd, IDC_MGR_CERTS), LVM_SETIMAGELIST, - LVSIL_SMALL, (LPARAM)data->imageList); - } - SetWindowLongPtrW(hwnd, DWLP_USER, (LPARAM)data); - data->title = pCryptUICertMgr->pwszTitle; - } + if (!data) + return 0; + data->imageList = ImageList_Create(16, 16, ILC_COLOR4 | ILC_MASK, 2, 0); + if (data->imageList) + { + HBITMAP bmp; + COLORREF backColor = RGB(255, 0, 255); + + bmp = LoadBitmapW(hInstance, MAKEINTRESOURCEW(IDB_SMALL_ICONS)); + ImageList_AddMasked(data->imageList, bmp, backColor); + DeleteObject(bmp); + ImageList_SetBkColor(data->imageList, CLR_NONE); + SendMessageW(GetDlgItem(hwnd, IDC_MGR_CERTS), LVM_SETIMAGELIST, + LVSIL_SMALL, (LPARAM)data->imageList); + } + SetWindowLongPtrW(hwnd, DWLP_USER, (LPARAM)data); + data->title = pCryptUICertMgr->pwszTitle; + initialize_purpose_selection(hwnd); add_cert_columns(hwnd); if (pCryptUICertMgr->pwszTitle) @@ -5516,8 +5515,11 @@ HFONT titleFont; DWORD dwFlags; LPCWSTR pwszWizardTitle; - PCCRYPTUI_WIZ_EXPORT_INFO pExportInfo; + CRYPTUI_WIZ_EXPORT_INFO exportInfo; CRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO contextInfo; + BOOL freePassword; + PCRYPT_KEY_PROV_INFO keyProvInfo; + BOOL deleteKeys; LPWSTR fileName; HANDLE file; BOOL success; @@ -5567,6 +5569,141 @@ return ret; } +static PCRYPT_KEY_PROV_INFO export_get_private_key_info(PCCERT_CONTEXT cert) +{ + PCRYPT_KEY_PROV_INFO info = NULL; + DWORD size; + + if (CertGetCertificateContextProperty(cert, CERT_KEY_PROV_INFO_PROP_ID, + NULL, &size)) + { + info = HeapAlloc(GetProcessHeap(), 0, size); + if (info) + { + if (!CertGetCertificateContextProperty(cert, + CERT_KEY_PROV_INFO_PROP_ID, info, &size)) + { + HeapFree(GetProcessHeap(), 0, info); + info = NULL; + } + } + } + return info; +} + +static BOOL export_acquire_private_key(PCRYPT_KEY_PROV_INFO info, + HCRYPTPROV *phProv) +{ + BOOL ret; + + ret = CryptAcquireContextW(phProv, info->pwszContainerName, + info->pwszProvName, info->dwProvType, 0); + if (ret) + { + DWORD i; + + for (i = 0; i < info->cProvParam; i++) + CryptSetProvParam(*phProv, info->rgProvParam[i].dwParam, + info->rgProvParam[i].pbData, info->rgProvParam[i].dwFlags); + } + return ret; +} + +static BOOL export_is_key_exportable(HCRYPTPROV hProv, DWORD keySpec) +{ + BOOL ret; + HCRYPTKEY key; + + if ((ret = CryptGetUserKey(hProv, keySpec, &key))) + { + DWORD permissions, size = sizeof(permissions); + + if ((ret = CryptGetKeyParam(key, KP_PERMISSIONS, (BYTE *)&permissions, + &size, 0)) && !(permissions & CRYPT_EXPORT)) + ret = FALSE; + CryptDestroyKey(key); + } + return ret; +} + +static LRESULT CALLBACK export_private_key_dlg_proc(HWND hwnd, UINT msg, + WPARAM wp, LPARAM lp) +{ + LRESULT ret = 0; + struct ExportWizData *data; + + switch (msg) + { + case WM_INITDIALOG: + { + PROPSHEETPAGEW *page = (PROPSHEETPAGEW *)lp; + PCRYPT_KEY_PROV_INFO info; + HCRYPTPROV hProv = 0; + int errorID = 0; + + data = (struct ExportWizData *)page->lParam; + SetWindowLongPtrW(hwnd, DWLP_USER, (LPARAM)data); + /* Get enough information about a key to see whether it's exportable. + */ + if (!(info = export_get_private_key_info( + data->exportInfo.u.pCertContext))) + errorID = IDS_EXPORT_PRIVATE_KEY_UNAVAILABLE; + else if (!export_acquire_private_key(info, &hProv)) + errorID = IDS_EXPORT_PRIVATE_KEY_UNAVAILABLE; + else if (!export_is_key_exportable(hProv, info->dwKeySpec)) + errorID = IDS_EXPORT_PRIVATE_KEY_NON_EXPORTABLE; + + if (errorID) + { + WCHAR error[MAX_STRING_LEN]; + + LoadStringW(hInstance, errorID, error, + sizeof(error) / sizeof(error[0])); + SendMessageW(GetDlgItem(hwnd, IDC_EXPORT_PRIVATE_KEY_UNAVAILABLE), + WM_SETTEXT, 0, (LPARAM)error); + EnableWindow(GetDlgItem(hwnd, IDC_EXPORT_PRIVATE_KEY_YES), FALSE); + } + else + data->keyProvInfo = info; + if (hProv) + CryptReleaseContext(hProv, 0); + SendMessageW(GetDlgItem(hwnd, IDC_EXPORT_PRIVATE_KEY_NO), BM_CLICK, + 0, 0); + break; + } + case WM_NOTIFY: + { + NMHDR *hdr = (NMHDR *)lp; + + switch (hdr->code) + { + case PSN_SETACTIVE: + PostMessageW(GetParent(hwnd), PSM_SETWIZBUTTONS, 0, + PSWIZB_BACK | PSWIZB_NEXT); + ret = TRUE; + break; + case PSN_WIZNEXT: + data = (struct ExportWizData *)GetWindowLongPtrW(hwnd, DWLP_USER); + if (IsDlgButtonChecked(hwnd, IDC_EXPORT_PRIVATE_KEY_NO)) + { + data->contextInfo.dwExportFormat = + CRYPTUI_WIZ_EXPORT_FORMAT_DER; + data->contextInfo.fExportPrivateKeys = FALSE; + } + else + { + data->contextInfo.dwExportFormat = + CRYPTUI_WIZ_EXPORT_FORMAT_PFX; + data->contextInfo.fExportPrivateKeys = TRUE; + } + break; + } + break; + } + } + return ret; +} + static BOOL export_info_has_private_key(PCCRYPTUI_WIZ_EXPORT_INFO pExportInfo) { BOOL ret = FALSE; @@ -5585,6 +5722,41 @@ return ret; } +static void export_format_enable_controls(HWND hwnd, struct ExportWizData *data) +{ + int defaultFormatID; + + switch (data->contextInfo.dwExportFormat) + { + case CRYPTUI_WIZ_EXPORT_FORMAT_BASE64: + defaultFormatID = IDC_EXPORT_FORMAT_BASE64; + break; + case CRYPTUI_WIZ_EXPORT_FORMAT_PKCS7: + defaultFormatID = IDC_EXPORT_FORMAT_CMS; + break; + case CRYPTUI_WIZ_EXPORT_FORMAT_PFX: + defaultFormatID = IDC_EXPORT_FORMAT_PFX; + break; + default: + defaultFormatID = IDC_EXPORT_FORMAT_DER; + } + SendMessageW(GetDlgItem(hwnd, defaultFormatID), BM_CLICK, 0, 0); + if (defaultFormatID == IDC_EXPORT_FORMAT_PFX) + { + EnableWindow(GetDlgItem(hwnd, IDC_EXPORT_FORMAT_DER), FALSE); + EnableWindow(GetDlgItem(hwnd, IDC_EXPORT_FORMAT_BASE64), FALSE); + EnableWindow(GetDlgItem(hwnd, IDC_EXPORT_FORMAT_CMS), FALSE); + EnableWindow(GetDlgItem(hwnd, IDC_EXPORT_FORMAT_PFX), TRUE); + } + else + { + EnableWindow(GetDlgItem(hwnd, IDC_EXPORT_FORMAT_DER), TRUE); + EnableWindow(GetDlgItem(hwnd, IDC_EXPORT_FORMAT_BASE64), TRUE); + EnableWindow(GetDlgItem(hwnd, IDC_EXPORT_FORMAT_CMS), TRUE); + EnableWindow(GetDlgItem(hwnd, IDC_EXPORT_FORMAT_PFX), FALSE); + } +} + static LRESULT CALLBACK export_format_dlg_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) { @@ -5596,32 +5768,10 @@ case WM_INITDIALOG: { PROPSHEETPAGEW *page = (PROPSHEETPAGEW *)lp; - int defaultFormatID; - BOOL hasPrivateKey; data = (struct ExportWizData *)page->lParam; SetWindowLongPtrW(hwnd, DWLP_USER, (LPARAM)data); - hasPrivateKey = export_info_has_private_key(data->pExportInfo); - if (hasPrivateKey) - EnableWindow(GetDlgItem(hwnd, IDC_EXPORT_FORMAT_PFX), TRUE); - switch (data->contextInfo.dwExportFormat) - { - case CRYPTUI_WIZ_EXPORT_FORMAT_BASE64: - defaultFormatID = IDC_EXPORT_FORMAT_BASE64; - break; - case CRYPTUI_WIZ_EXPORT_FORMAT_PKCS7: - defaultFormatID = IDC_EXPORT_FORMAT_CMS; - break; - case CRYPTUI_WIZ_EXPORT_FORMAT_PFX: - if (hasPrivateKey) - defaultFormatID = IDC_EXPORT_FORMAT_PFX; - else - defaultFormatID = IDC_EXPORT_FORMAT_DER; - break; - default: - defaultFormatID = IDC_EXPORT_FORMAT_DER; - } - SendMessageW(GetDlgItem(hwnd, defaultFormatID), BM_CLICK, 0, 0); + export_format_enable_controls(hwnd, data); break; } case WM_NOTIFY: @@ -5633,10 +5783,14 @@ case PSN_SETACTIVE: PostMessageW(GetParent(hwnd), PSM_SETWIZBUTTONS, 0, PSWIZB_BACK | PSWIZB_NEXT); + data = (struct ExportWizData *)GetWindowLongPtrW(hwnd, DWLP_USER); + export_format_enable_controls(hwnd, data); ret = TRUE; break; case PSN_WIZNEXT: { + BOOL skipPasswordPage = TRUE; + data = (struct ExportWizData *)GetWindowLongPtrW(hwnd, DWLP_USER); if (IsDlgButtonChecked(hwnd, IDC_EXPORT_FORMAT_DER)) data->contextInfo.dwExportFormat = @@ -5661,8 +5815,12 @@ if (IsDlgButtonChecked(hwnd, IDC_EXPORT_PFX_STRONG_ENCRYPTION)) data->contextInfo.fStrongEncryption = TRUE; if (IsDlgButtonChecked(hwnd, IDC_EXPORT_PFX_DELETE_PRIVATE_KEY)) - data->contextInfo.fExportPrivateKeys = TRUE; + data->deleteKeys = TRUE; + skipPasswordPage = FALSE; } + SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, + skipPasswordPage ? IDD_EXPORT_FILE : 0); + ret = 1; break; } } @@ -5705,6 +5863,111 @@ return ret; } +static void export_password_mismatch(HWND hwnd, struct ExportWizData *data) +{ + WCHAR title[MAX_STRING_LEN], error[MAX_STRING_LEN]; + LPCWSTR pTitle; + + if (data->pwszWizardTitle) + pTitle = data->pwszWizardTitle; + else + { + LoadStringW(hInstance, IDS_EXPORT_WIZARD, title, + sizeof(title) / sizeof(title[0])); + pTitle = title; + } + LoadStringW(hInstance, IDS_EXPORT_PASSWORD_MISMATCH, error, + sizeof(error) / sizeof(error[0])); + MessageBoxW(hwnd, error, pTitle, MB_ICONERROR | MB_OK); + SetFocus(GetDlgItem(hwnd, IDC_EXPORT_PASSWORD)); +} + +static LRESULT CALLBACK export_password_dlg_proc(HWND hwnd, UINT msg, + WPARAM wp, LPARAM lp) +{ + LRESULT ret = 0; + struct ExportWizData *data; + + switch (msg) + { + case WM_INITDIALOG: + { + PROPSHEETPAGEW *page = (PROPSHEETPAGEW *)lp; + + data = (struct ExportWizData *)page->lParam; + SetWindowLongPtrW(hwnd, DWLP_USER, (LPARAM)data); + break; + } + case WM_NOTIFY: + { + NMHDR *hdr = (NMHDR *)lp; + + switch (hdr->code) + { + case PSN_SETACTIVE: + PostMessageW(GetParent(hwnd), PSM_SETWIZBUTTONS, 0, + PSWIZB_BACK | PSWIZB_NEXT); + ret = TRUE; + break; + case PSN_WIZNEXT: + { + HWND passwordEdit = GetDlgItem(hwnd, IDC_EXPORT_PASSWORD); + HWND passwordConfirmEdit = GetDlgItem(hwnd, + IDC_EXPORT_PASSWORD_CONFIRM); + DWORD passwordLen = SendMessageW(passwordEdit, WM_GETTEXTLENGTH, + 0, 0); + DWORD passwordConfirmLen = SendMessageW(passwordConfirmEdit, + WM_GETTEXTLENGTH, 0, 0); + + data = (struct ExportWizData *)GetWindowLongPtrW(hwnd, DWLP_USER); + if (!passwordLen && !passwordConfirmLen) + data->contextInfo.pwszPassword = NULL; + else if (passwordLen != passwordConfirmLen) + { + export_password_mismatch(hwnd, data); + SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, 1); + ret = 1; + } + else + { + LPWSTR password = HeapAlloc(GetProcessHeap(), 0, + (passwordLen + 1) * sizeof(WCHAR)); + LPWSTR passwordConfirm = HeapAlloc(GetProcessHeap(), 0, + (passwordConfirmLen + 1) * sizeof(WCHAR)); + BOOL freePassword = TRUE; + + if (password && passwordConfirm) + { + SendMessageW(passwordEdit, WM_GETTEXT, passwordLen + 1, + (LPARAM)password); + SendMessageW(passwordConfirmEdit, WM_GETTEXT, + passwordConfirmLen + 1, (LPARAM)passwordConfirm); + if (strcmpW(password, passwordConfirm)) + { + export_password_mismatch(hwnd, data); + SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, 1); + ret = 1; + } + else + { + data->contextInfo.pwszPassword = password; + freePassword = FALSE; + data->freePassword = TRUE; + } + } + if (freePassword) + HeapFree(GetProcessHeap(), 0, password); + HeapFree(GetProcessHeap(), 0, passwordConfirm); + } + break; + } + } + break; + } + } + return ret; +} + static LPWSTR export_append_extension(struct ExportWizData *data, LPWSTR fileName) { @@ -5727,7 +5990,7 @@ extension = pfx; break; default: - switch (data->pExportInfo->dwSubjectChoice) + switch (data->exportInfo.dwSubjectChoice) { case CRYPTUI_WIZ_EXPORT_CRL_CONTEXT: extension = crl; @@ -5926,9 +6189,9 @@ data = (struct ExportWizData *)page->lParam; SetWindowLongPtrW(hwnd, DWLP_USER, (LPARAM)data); - if (data->pExportInfo->pwszExportFileName) + if (data->exportInfo.pwszExportFileName) SendMessageW(GetDlgItem(hwnd, IDC_EXPORT_FILENAME), WM_SETTEXT, 0, - (LPARAM)data->pExportInfo->pwszExportFileName); + (LPARAM)data->exportInfo.pwszExportFileName); break; } case WM_NOTIFY: @@ -5937,6 +6200,15 @@ switch (hdr->code) { + case PSN_WIZBACK: + data = (struct ExportWizData *)GetWindowLongPtrW(hwnd, DWLP_USER); + if (data->contextInfo.dwExportFormat != + CRYPTUI_WIZ_EXPORT_FORMAT_PFX) + { + SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, IDD_EXPORT_FORMAT); + ret = 1; + } + break; case PSN_WIZNEXT: { HWND fileNameEdit = GetDlgItem(hwnd, IDC_EXPORT_FILENAME); @@ -6006,7 +6278,7 @@ ofn.hwndOwner = hwnd; ofn.lpstrFilter = make_export_file_filter( data->contextInfo.dwExportFormat, - data->pExportInfo->dwSubjectChoice); + data->exportInfo.dwSubjectChoice); ofn.lpstrFile = fileBuf; ofn.nMaxFile = sizeof(fileBuf) / sizeof(fileBuf[0]); fileBuf[0] = 0; @@ -6043,7 +6315,7 @@ } item.pszText = text; - switch (data->pExportInfo->dwSubjectChoice) + switch (data->exportInfo.dwSubjectChoice) { case CRYPTUI_WIZ_EXPORT_CRL_CONTEXT: case CRYPTUI_WIZ_EXPORT_CTL_CONTEXT: @@ -6084,7 +6356,7 @@ SendMessageW(lv, LVM_INSERTITEMW, 0, (LPARAM)&item); item.iSubItem = 1; - switch (data->pExportInfo->dwSubjectChoice) + switch (data->exportInfo.dwSubjectChoice) { case CRYPTUI_WIZ_EXPORT_CRL_CONTEXT: contentID = IDS_EXPORT_FILTER_CRL; @@ -6227,8 +6499,140 @@ CERT_STORE_SAVE_AS_STORE, CERT_STORE_SAVE_TO_FILE, file, 0); } +static BOOL save_pfx(HANDLE file, PCCRYPTUI_WIZ_EXPORT_INFO pExportInfo, + PCCRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO pContextInfo, + PCRYPT_KEY_PROV_INFO keyProvInfo, BOOL deleteKeys) +{ + HCERTSTORE store = CertOpenStore(CERT_STORE_PROV_MEMORY, X509_ASN_ENCODING, + 0, CERT_STORE_CREATE_NEW_FLAG, NULL); + BOOL ret = FALSE; + + if (store) + { + CRYPT_DATA_BLOB pfxBlob = { 0, NULL }; + PCCERT_CONTEXT cert = NULL; + BOOL freeKeyProvInfo = FALSE; + + if (pContextInfo->fExportChain) + { + HCERTCHAINENGINE engine = NULL; + + if (pExportInfo->cStores) + { + CERT_CHAIN_ENGINE_CONFIG config; + + memset(&config, 0, sizeof(config)); + config.cbSize = sizeof(config); + config.cAdditionalStore = pExportInfo->cStores; + config.rghAdditionalStore = pExportInfo->rghStores; + ret = CertCreateCertificateChainEngine(&config, &engine); + } + else + ret = TRUE; + if (ret) + { + CERT_CHAIN_PARA chainPara; + PCCERT_CHAIN_CONTEXT chain; + + memset(&chainPara, 0, sizeof(chainPara)); + chainPara.cbSize = sizeof(chainPara); + ret = CertGetCertificateChain(engine, + pExportInfo->u.pCertContext, NULL, NULL, &chainPara, 0, NULL, + &chain); + if (ret) + { + DWORD i, j; + + for (i = 0; ret && i < chain->cChain; i++) + for (j = 0; ret && j < chain->rgpChain[i]->cElement; + j++) + { + if (i == 0 && j == 0) + ret = CertAddCertificateContextToStore(store, + chain->rgpChain[i]->rgpElement[j]->pCertContext, + CERT_STORE_ADD_ALWAYS, &cert); + else + ret = CertAddCertificateContextToStore(store, + chain->rgpChain[i]->rgpElement[j]->pCertContext, + CERT_STORE_ADD_ALWAYS, NULL); + } + CertFreeCertificateChain(chain); + } + } + if (engine) + CertFreeCertificateChainEngine(engine); + } + else + ret = CertAddCertificateContextToStore(store, + pExportInfo->u.pCertContext, CERT_STORE_ADD_ALWAYS, &cert); + /* Copy private key info to newly created cert, so it'll get exported + * along with the cert. + */ + if (ret && pContextInfo->fExportPrivateKeys) + { + if (keyProvInfo) + ret = CertSetCertificateContextProperty(cert, + CERT_KEY_PROV_INFO_PROP_ID, 0, keyProvInfo); + else + { + if (!(keyProvInfo = export_get_private_key_info(cert))) + ret = FALSE; + else + { + ret = CertSetCertificateContextProperty(cert, + CERT_KEY_PROV_INFO_PROP_ID, 0, keyProvInfo); + freeKeyProvInfo = TRUE; + } + } + } + if (ret) + { + DWORD exportFlags = + REPORT_NOT_ABLE_TO_EXPORT_PRIVATE_KEY | EXPORT_PRIVATE_KEYS; + + ret = PFXExportCertStore(store, &pfxBlob, + pContextInfo->pwszPassword, exportFlags); + if (ret) + { + pfxBlob.pbData = HeapAlloc(GetProcessHeap(), 0, pfxBlob.cbData); + if (pfxBlob.pbData) + { + ret = PFXExportCertStore(store, &pfxBlob, + pContextInfo->pwszPassword, exportFlags); + if (ret) + { + DWORD bytesWritten; + + ret = WriteFile(file, pfxBlob.pbData, pfxBlob.cbData, + &bytesWritten, NULL); + } + } + else + { + SetLastError(ERROR_OUTOFMEMORY); + ret = FALSE; + } + } + } + if (ret && deleteKeys) + { + HCRYPTPROV prov; + + CryptAcquireContextW(&prov, keyProvInfo->pwszContainerName, + keyProvInfo->pwszProvName, keyProvInfo->dwProvType, + CRYPT_DELETEKEYSET); + } + if (freeKeyProvInfo) + HeapFree(GetProcessHeap(), 0, keyProvInfo); + CertFreeCertificateContext(cert); + CertCloseStore(store, 0); + } + return ret; +} + static BOOL do_export(HANDLE file, PCCRYPTUI_WIZ_EXPORT_INFO pExportInfo, - PCCRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO pContextInfo) + PCCRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO pContextInfo, + PCRYPT_KEY_PROV_INFO keyProvInfo, BOOL deleteKeys) { BOOL ret; @@ -6272,8 +6676,8 @@ pContextInfo->fExportChain); break; case CRYPTUI_WIZ_EXPORT_FORMAT_PFX: - FIXME("unimplemented for PFX\n"); - ret = FALSE; + ret = save_pfx(file, pExportInfo, pContextInfo, keyProvInfo, + deleteKeys); break; default: SetLastError(E_FAIL); @@ -6336,8 +6740,8 @@ DWORD mbFlags; data = (struct ExportWizData *)GetWindowLongPtrW(hwnd, DWLP_USER); - if ((data->success = do_export(data->file, data->pExportInfo, - &data->contextInfo))) + if ((data->success = do_export(data->file, &data->exportInfo, + &data->contextInfo, data->keyProvInfo, data->deleteKeys))) { messageID = IDS_EXPORT_SUCCEEDED; mbFlags = MB_OK; @@ -6371,24 +6775,33 @@ LPCWSTR pwszWizardTitle, PCCRYPTUI_WIZ_EXPORT_INFO pExportInfo, void *pvoid) { PROPSHEETHEADERW hdr; - PROPSHEETPAGEW pages[4]; + PROPSHEETPAGEW pages[6]; struct ExportWizData data; int nPages = 0; - BOOL showFormatPage = TRUE; + BOOL hasPrivateKey, showFormatPage = TRUE; + INT_PTR l; data.dwFlags = dwFlags; data.pwszWizardTitle = pwszWizardTitle; - data.pExportInfo = pExportInfo; + memset(&data.exportInfo, 0, sizeof(data.exportInfo)); + memcpy(&data.exportInfo, pExportInfo, + min(sizeof(data.exportInfo), pExportInfo->dwSize)); + if (pExportInfo->dwSize > sizeof(data.exportInfo)) + data.exportInfo.dwSize = sizeof(data.exportInfo); data.contextInfo.dwSize = sizeof(data.contextInfo); data.contextInfo.dwExportFormat = CRYPTUI_WIZ_EXPORT_FORMAT_DER; data.contextInfo.fExportChain = FALSE; data.contextInfo.fStrongEncryption = FALSE; data.contextInfo.fExportPrivateKeys = FALSE; + data.contextInfo.pwszPassword = NULL; + data.freePassword = FALSE; if (pExportInfo->dwSubjectChoice == CRYPTUI_WIZ_EXPORT_CERT_CONTEXT && pvoid) memcpy(&data.contextInfo, pvoid, min(((PCCRYPTUI_WIZ_EXPORT_CERTCONTEXT_INFO)pvoid)->dwSize, sizeof(data.contextInfo))); + data.keyProvInfo = NULL; + data.deleteKeys = FALSE; data.fileName = NULL; data.file = INVALID_HANDLE_VALUE; data.success = FALSE; @@ -6403,6 +6816,7 @@ pages[nPages].lParam = (LPARAM)&data; nPages++; + hasPrivateKey = export_info_has_private_key(pExportInfo); switch (pExportInfo->dwSubjectChoice) { case CRYPTUI_WIZ_EXPORT_CRL_CONTEXT: @@ -6419,6 +6833,21 @@ showFormatPage = FALSE; data.contextInfo.dwExportFormat = CRYPTUI_WIZ_EXPORT_FORMAT_PKCS7; break; + } + + if (hasPrivateKey && showFormatPage) + { + pages[nPages].dwSize = sizeof(pages[0]); + pages[nPages].hInstance = hInstance; + pages[nPages].u.pszTemplate = MAKEINTRESOURCEW(IDD_EXPORT_PRIVATE_KEY); + pages[nPages].pfnDlgProc = export_private_key_dlg_proc; + pages[nPages].dwFlags = PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; + pages[nPages].pszHeaderTitle = + MAKEINTRESOURCEW(IDS_EXPORT_PRIVATE_KEY_TITLE); + pages[nPages].pszHeaderSubTitle = + MAKEINTRESOURCEW(IDS_EXPORT_PRIVATE_KEY_SUBTITLE); + pages[nPages].lParam = (LPARAM)&data; + nPages++; } if (showFormatPage) { @@ -6431,6 +6860,20 @@ MAKEINTRESOURCEW(IDS_EXPORT_FORMAT_TITLE); pages[nPages].pszHeaderSubTitle = MAKEINTRESOURCEW(IDS_EXPORT_FORMAT_SUBTITLE); + pages[nPages].lParam = (LPARAM)&data; + nPages++; + } + if (hasPrivateKey && showFormatPage) + { + pages[nPages].dwSize = sizeof(pages[0]); + pages[nPages].hInstance = hInstance; + pages[nPages].u.pszTemplate = MAKEINTRESOURCEW(IDD_EXPORT_PASSWORD); + pages[nPages].pfnDlgProc = export_password_dlg_proc; + pages[nPages].dwFlags = PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; + pages[nPages].pszHeaderTitle = + MAKEINTRESOURCEW(IDS_EXPORT_PASSWORD_TITLE); + pages[nPages].pszHeaderSubTitle = + MAKEINTRESOURCEW(IDS_EXPORT_PASSWORD_SUBTITLE); pages[nPages].lParam = (LPARAM)&data; nPages++; } @@ -6468,11 +6911,21 @@ hdr.nPages = nPages; hdr.u4.pszbmWatermark = MAKEINTRESOURCEW(IDB_CERT_WATERMARK); hdr.u5.pszbmHeader = MAKEINTRESOURCEW(IDB_CERT_HEADER); - PropertySheetW(&hdr); + l = PropertySheetW(&hdr); DeleteObject(data.titleFont); + if (data.freePassword) + HeapFree(GetProcessHeap(), 0, + (LPWSTR)data.contextInfo.pwszPassword); + HeapFree(GetProcessHeap(), 0, data.keyProvInfo); CloseHandle(data.file); HeapFree(GetProcessHeap(), 0, data.fileName); - return data.success; + if (l == 0) + { + SetLastError(ERROR_CANCELLED); + return FALSE; + } + else + return data.success; } BOOL WINAPI CryptUIWizExport(DWORD dwFlags, HWND hwndParent, @@ -6494,7 +6947,7 @@ if (file != INVALID_HANDLE_VALUE) { - ret = do_export(file, pExportInfo, pvoid); + ret = do_export(file, pExportInfo, pvoid, NULL, FALSE); CloseHandle(file); } else
15 years, 10 months
1
0
0
0
[dchapyshev] 39759: - Sync atl and cabinet with Wine head
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Thu Feb 26 13:20:22 2009 New Revision: 39759 URL:
http://svn.reactos.org/svn/reactos?rev=39759&view=rev
Log: - Sync atl and cabinet with Wine head Modified: trunk/reactos/dll/win32/atl/atl_ax.c trunk/reactos/dll/win32/cabinet/cabinet.h trunk/reactos/dll/win32/cabinet/fdi.c Modified: trunk/reactos/dll/win32/atl/atl_ax.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/atl/atl_ax.c?rev…
============================================================================== --- trunk/reactos/dll/win32/atl/atl_ax.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/atl/atl_ax.c [iso-8859-1] Thu Feb 26 13:20:22 2009 @@ -126,11 +126,11 @@ return ref; } -#define THIS2IOLECLIENTSITE(This) ((IOleClientSite*)&This->lpOleClientSiteVtbl) -#define THIS2IOLECONTAINER(This) ((IOleContainer*)&This->lpOleContainerVtbl) -#define THIS2IOLEINPLACESITEWINDOWLESS(This) ((IOleInPlaceSiteWindowless*)&This->lpOleInPlaceSiteWindowlessVtbl) -#define THIS2IOLEINPLACEFRAME(This) ((IOleInPlaceFrame*)&This->lpOleInPlaceFrameVtbl) -#define THIS2IOLECONTROLSITE(This) ((IOleControlSite*)&This->lpOleControlSiteVtbl) +#define THIS2IOLECLIENTSITE(This) ((IOleClientSite*)&(This)->lpOleClientSiteVtbl) +#define THIS2IOLECONTAINER(This) (&(This)->lpOleContainerVtbl) +#define THIS2IOLEINPLACESITEWINDOWLESS(This) (&(This)->lpOleInPlaceSiteWindowlessVtbl) +#define THIS2IOLEINPLACEFRAME(This) (&(This)->lpOleInPlaceFrameVtbl) +#define THIS2IOLECONTROLSITE(This) (&(This)->lpOleControlSiteVtbl) static HRESULT IOCS_QueryInterface(IOCS *This, REFIID riid, void **ppv) { Modified: trunk/reactos/dll/win32/cabinet/cabinet.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/cabinet/cabinet.…
============================================================================== --- trunk/reactos/dll/win32/cabinet/cabinet.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/cabinet/cabinet.h [iso-8859-1] Thu Feb 26 13:20:22 2009 @@ -653,8 +653,4 @@ struct FILELIST *FilterList; } SESSION; -/* from fdi.c */ -void QTMupdatemodel(struct QTMmodel *model, int sym); -int make_decode_table(cab_ULONG nsyms, cab_ULONG nbits, const cab_UBYTE *length, cab_UWORD *table); - #endif /* __WINE_CABINET_H */ Modified: trunk/reactos/dll/win32/cabinet/fdi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/cabinet/fdi.c?re…
============================================================================== --- trunk/reactos/dll/win32/cabinet/fdi.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/cabinet/fdi.c [iso-8859-1] Thu Feb 26 13:20:22 2009 @@ -151,7 +151,7 @@ /**************************************************************** * QTMupdatemodel (internal) */ -void QTMupdatemodel(struct QTMmodel *model, int sym) { +static void QTMupdatemodel(struct QTMmodel *model, int sym) { struct QTMmodelsym temp; int i, j; @@ -220,7 +220,8 @@ * OK: 0 * error: 1 */ -int make_decode_table(cab_ULONG nsyms, cab_ULONG nbits, const cab_UBYTE *length, cab_UWORD *table) { +static int make_decode_table(cab_ULONG nsyms, cab_ULONG nbits, + const cab_UBYTE *length, cab_UWORD *table) { register cab_UWORD sym; register cab_ULONG leaf; register cab_UBYTE bit_num = 1;
15 years, 10 months
1
0
0
0
[janderwald] 39758: - Fix wdmaud / sysaudio service installation when a driver is installed
by janderwald@svn.reactos.org
Author: janderwald Date: Thu Feb 26 03:04:26 2009 New Revision: 39758 URL:
http://svn.reactos.org/svn/reactos?rev=39758&view=rev
Log: - Fix wdmaud / sysaudio service installation when a driver is installed Modified: trunk/reactos/dll/cpl/mmsys/mmsys.c Modified: trunk/reactos/dll/cpl/mmsys/mmsys.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/mmsys/mmsys.c?rev=…
============================================================================== --- trunk/reactos/dll/cpl/mmsys/mmsys.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/mmsys/mmsys.c [iso-8859-1] Thu Feb 26 03:04:26 2009 @@ -166,7 +166,8 @@ PVOID Context; BOOL Result; - if (!IsEqualIID(&pspDevInfoData->ClassGuid, &GUID_DEVCLASS_SOUND)) + if (!IsEqualIID(&pspDevInfoData->ClassGuid, &GUID_DEVCLASS_SOUND) && + !IsEqualIID(&pspDevInfoData->ClassGuid, &GUID_DEVCLASS_MEDIA)) return ERROR_DI_DO_DEFAULT; Length = GetWindowsDirectoryW(szBuffer, MAX_PATH);
15 years, 10 months
1
0
0
0
← Newer
1
2
3
4
5
6
7
8
9
...
56
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
Results per page:
10
25
50
100
200