winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
July 2007
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
3 participants
957 discussions
Start a n
N
ew thread
Vitaliy Margolen : msvcrt: Preserve registers when calling unwind function.
by Alexandre Julliard
16 Jul '07
16 Jul '07
Module: wine Branch: master Commit: b25ad76a224b21db8062db5b8f28d6880417524b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b25ad76a224b21db8062db5b8…
Author: Vitaliy Margolen <wine-patches(a)kievinfo.com> Date: Sat Jul 14 23:45:02 2007 -0600 msvcrt: Preserve registers when calling unwind function. --- dlls/msvcrt/except.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/dlls/msvcrt/except.c b/dlls/msvcrt/except.c index aef5133..9af5ff2 100644 --- a/dlls/msvcrt/except.c +++ b/dlls/msvcrt/except.c @@ -84,7 +84,16 @@ static inline int call_filter( int (*func)(PEXCEPTION_POINTERS), void *arg, void static inline int call_unwind_func( int (*func)(void), void *ebp ) { int ret; - __asm__ __volatile__ ("pushl %%ebp; movl %2,%%ebp; call *%0; popl %%ebp" + __asm__ __volatile__ ("pushl %%ebp\n\t" + "pushl %%ebx\n\t" + "pushl %%esi\n\t" + "pushl %%edi\n\t" + "movl %2,%%ebp\n\t" + "call *%0\n\t" + "popl %%edi\n\t" + "popl %%esi\n\t" + "popl %%ebx\n\t" + "popl %%ebp" : "=a" (ret) : "0" (func), "r" (ebp) : "ecx", "edx", "memory" );
1
0
0
0
Huw Davies : kernel32: Overlapped pipe tests.
by Alexandre Julliard
16 Jul '07
16 Jul '07
Module: wine Branch: master Commit: e59a947c8860a07db11b047a75d897d2a0007217 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e59a947c8860a07db11b047a7…
Author: Huw Davies <huw(a)codeweavers.com> Date: Mon Jul 16 12:12:18 2007 +0100 kernel32: Overlapped pipe tests. --- dlls/kernel32/tests/pipe.c | 85 +++++++++++++++++++++++++++++++++++++++---- 1 files changed, 77 insertions(+), 8 deletions(-) diff --git a/dlls/kernel32/tests/pipe.c b/dlls/kernel32/tests/pipe.c index 1850e77..ccb72ba 100644 --- a/dlls/kernel32/tests/pipe.c +++ b/dlls/kernel32/tests/pipe.c @@ -1257,6 +1257,82 @@ static void test_impersonation(void) CloseHandle(hClientToken); } +struct overlapped_server_args +{ + HANDLE pipe_created; +}; + +static DWORD CALLBACK overlapped_server(LPVOID arg) +{ + OVERLAPPED ol; + HANDLE pipe; + int ret, err; + struct overlapped_server_args *a = (struct overlapped_server_args*)arg; + DWORD num; + char buf[100]; + + pipe = CreateNamedPipeA("\\\\.\\pipe\\my pipe", FILE_FLAG_OVERLAPPED | PIPE_ACCESS_DUPLEX, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE, 1, 0, 0, 100000, NULL); + ok(pipe != NULL, "pipe NULL\n"); + + ol.hEvent = CreateEventA(0, 1, 0, 0); + ok(ol.hEvent != NULL, "event NULL\n"); + ret = ConnectNamedPipe(pipe, &ol); + err = GetLastError(); + ok(ret == 0, "ret %d\n", ret); + ok(err == ERROR_IO_PENDING, "gle %d\n", err); + SetEvent(a->pipe_created); + + ret = WaitForSingleObjectEx(ol.hEvent, INFINITE, 1); + if(ret == WAIT_IO_COMPLETION) + todo_wine ok(ret == WAIT_OBJECT_0, "ret %x\n", ret); + else + ok(ret == WAIT_OBJECT_0, "ret %x\n", ret); + + ret = GetOverlappedResult(pipe, &ol, &num, 1); + ok(ret == 1, "ret %d\n", ret); + + /* This should block */ + ret = ReadFile(pipe, buf, sizeof(buf), &num, NULL); + if(ret == 0) + todo_wine ok(ret == 1, "ret %d\n", ret); + else + ok(ret == 1, "ret %d\n", ret); + + DisconnectNamedPipe(pipe); + CloseHandle(ol.hEvent); + CloseHandle(pipe); + return 1; +} + +static void test_overlapped(void) +{ + DWORD tid, num; + HANDLE thread, pipe; + int ret; + struct overlapped_server_args args; + + args.pipe_created = CreateEventA(0, 1, 0, 0); + thread = CreateThread(NULL, 0, overlapped_server, &args, 0, &tid); + + WaitForSingleObject(args.pipe_created, INFINITE); + pipe = CreateFileA("\\\\.\\pipe\\my pipe", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); + ok(pipe != INVALID_HANDLE_VALUE, "cf failed\n"); + + /* Sleep to try to get the ReadFile in the server to occur before the following WriteFile */ + Sleep(1); + + ret = WriteFile(pipe, "x", 1, &num, NULL); + if(ret == 0) + todo_wine ok(ret == 1, "ret %d\n", ret); + else + ok(ret == 1, "ret %d\n", ret); + + WaitForSingleObject(thread, INFINITE); + CloseHandle(pipe); + CloseHandle(args.pipe_created); + CloseHandle(thread); +} + START_TEST(pipe) { HMODULE hmod; @@ -1264,20 +1340,13 @@ START_TEST(pipe) hmod = GetModuleHandle("advapi32.dll"); pDuplicateTokenEx = (void *) GetProcAddress(hmod, "DuplicateTokenEx"); - trace("test 1 of 7:\n"); if (test_DisconnectNamedPipe()) return; - trace("test 2 of 7:\n"); test_CreateNamedPipe_instances_must_match(); - trace("test 3 of 7:\n"); test_NamedPipe_2(); - trace("test 4 of 7:\n"); test_CreateNamedPipe(PIPE_TYPE_BYTE); - trace("test 5 of 7\n"); test_CreateNamedPipe(PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE); - trace("test 6 of 7\n"); test_CreatePipe(); - trace("test 7 of 7\n"); test_impersonation(); - trace("all tests done\n"); + test_overlapped(); }
1
0
0
0
Dmitry Timoshkov : shlwapi: Fix parameter types of SHGetIniStringW.
by Alexandre Julliard
16 Jul '07
16 Jul '07
Module: wine Branch: master Commit: f27e5299c96c1956d6f92073b900165d83829748 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f27e5299c96c1956d6f92073b…
Author: Dmitry Timoshkov <dmitry(a)codeweavers.com> Date: Mon Jul 16 13:11:27 2007 +0900 shlwapi: Fix parameter types of SHGetIniStringW. --- dlls/shlwapi/ordinal.c | 22 ++++------------------ dlls/shlwapi/shlwapi.spec | 2 +- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/dlls/shlwapi/ordinal.c b/dlls/shlwapi/ordinal.c index e8738f3..6ebabfa 100644 --- a/dlls/shlwapi/ordinal.c +++ b/dlls/shlwapi/ordinal.c @@ -3088,24 +3088,10 @@ BOOL WINAPI PlaySoundWrapW(LPCWSTR pszSound, HMODULE hmod, DWORD fdwSound) /************************************************************************* * @ [SHLWAPI.294] */ -BOOL WINAPI SHGetIniStringW(LPSTR str1, LPSTR str2, LPSTR pStr, DWORD some_len, LPCSTR lpStr2) -{ - /* - * str1: "I" "I" pushl esp+0x20 - * str2: "U" "I" pushl 0x77c93810 - * (is "I" and "U" "integer" and "unsigned" ??) - * - * pStr: "" "" pushl eax - * some_len: 0x824 0x104 pushl 0x824 - * lpStr2: "%l" "%l" pushl esp+0xc - * - * shlwapi. StrCpyNW(lpStr2, irrelevant_var, 0x104); - * LocalAlloc(0x00, some_len) -> irrelevant_var - * LocalAlloc(0x40, irrelevant_len) -> pStr - * shlwapi.294(str1, str2, pStr, some_len, lpStr2); - * shlwapi.PathRemoveBlanksW(pStr); - */ - FIXME("('%s', '%s', '%s', %08x, '%s'): stub!\n", str1, str2, pStr, some_len, lpStr2); +BOOL WINAPI SHGetIniStringW(LPCWSTR str1, LPCWSTR str2, LPWSTR pStr, DWORD some_len, LPCWSTR lpStr2) +{ + FIXME("(%s,%s,%p,%08x,%s): stub!\n", debugstr_w(str1), debugstr_w(str2), + pStr, some_len, debugstr_w(lpStr2)); return TRUE; } diff --git a/dlls/shlwapi/shlwapi.spec b/dlls/shlwapi/shlwapi.spec index 5821865..bca51ee 100644 --- a/dlls/shlwapi/shlwapi.spec +++ b/dlls/shlwapi/shlwapi.spec @@ -291,7 +291,7 @@ 291 stdcall -noname SHMessageBoxCheckExA(ptr ptr ptr ptr ptr long str) 292 stdcall -noname SHMessageBoxCheckExW(ptr ptr ptr ptr ptr long wstr) 293 stub -noname SHCancelUserWorkItems -294 stdcall -noname SHGetIniStringW(long long long long long) +294 stdcall -noname SHGetIniStringW(wstr wstr ptr long wstr) 295 stdcall -noname SHSetIniStringW(wstr ptr wstr wstr) 296 stub -noname CreateURLFileContentsW 297 stub -noname CreateURLFileContentsA
1
0
0
0
H. Verbeet : wined3d: Fix STATE_IS_ACTIVELIGHT.
by Alexandre Julliard
16 Jul '07
16 Jul '07
Module: wine Branch: master Commit: cb4c9b620840be1c51ea0e99ba4245e876aad3ef URL:
http://source.winehq.org/git/wine.git/?a=commit;h=cb4c9b620840be1c51ea0e99b…
Author: H. Verbeet <hverbeet(a)gmail.com> Date: Sun Jul 15 23:46:06 2007 +0200 wined3d: Fix STATE_IS_ACTIVELIGHT. --- dlls/wined3d/wined3d_private.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 1169310..07a9db3 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -467,7 +467,7 @@ typedef void (*APPLYSTATEFUNC)(DWORD state, IWineD3DStateBlockImpl *stateblock, #define STATE_IS_PIXELSHADERCONSTANT(a) ((a) == STATE_PIXELSHADERCONSTANT) #define STATE_ACTIVELIGHT(a) (STATE_PIXELSHADERCONSTANT + (a) + 1) -#define STATE_IS_ACTIVELIGHT(a) ((a) >= STATE_ACTIVELIGHT(0) && (a) < STATE_PIXELSHADERCONSTANT(MAX_ACTIVE_LIGHTS)) +#define STATE_IS_ACTIVELIGHT(a) ((a) >= STATE_ACTIVELIGHT(0) && (a) < STATE_ACTIVELIGHT(MAX_ACTIVE_LIGHTS)) #define STATE_SCISSORRECT (STATE_ACTIVELIGHT(MAX_ACTIVE_LIGHTS - 1) + 1) #define STATE_IS_SCISSORRECT(a) ((a) == STATE_SCISSORRECT)
1
0
0
0
Alec Berryman : itss: Replace malloc/free with HeapAlloc/HeapFree.
by Alexandre Julliard
16 Jul '07
16 Jul '07
Module: wine Branch: master Commit: 6b266a7610a373de043b4ebd95166056b0bfc156 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6b266a7610a373de043b4ebd9…
Author: Alec Berryman <alec(a)thened.net> Date: Sat Jul 14 12:33:42 2007 -0500 itss: Replace malloc/free with HeapAlloc/HeapFree. --- dlls/itss/chm_lib.c | 29 ++++++++++++++++------------- 1 files changed, 16 insertions(+), 13 deletions(-) diff --git a/dlls/itss/chm_lib.c b/dlls/itss/chm_lib.c index cd69448..788ec54 100644 --- a/dlls/itss/chm_lib.c +++ b/dlls/itss/chm_lib.c @@ -627,8 +627,8 @@ static void chm_set_param(struct chmFile *h, int i; /* allocate new cached blocks */ - newBlocks = malloc(paramVal * sizeof (UChar *)); - newIndices = malloc(paramVal * sizeof (UInt64)); + newBlocks = HeapAlloc(GetProcessHeap(), 0, paramVal * sizeof (UChar *)); + newIndices = HeapAlloc(GetProcessHeap(), 0, paramVal * sizeof (UInt64)); for (i=0; i<paramVal; i++) { newBlocks[i] = NULL; @@ -647,7 +647,7 @@ static void chm_set_param(struct chmFile *h, /* in case of collision, destroy newcomer */ if (newBlocks[newSlot]) { - free(h->cache_blocks[i]); + HeapFree(GetProcessHeap(), 0, h->cache_blocks[i]); h->cache_blocks[i] = NULL; } else @@ -659,8 +659,8 @@ static void chm_set_param(struct chmFile *h, } } - free(h->cache_blocks); - free(h->cache_block_indices); + HeapFree(GetProcessHeap(), 0, h->cache_blocks); + HeapFree(GetProcessHeap(), 0, h->cache_block_indices); } /* now, set new values */ @@ -692,7 +692,7 @@ struct chmFile *chm_openW(const WCHAR *filename) struct chmLzxcControlData ctlData; /* allocate handle */ - newHandle = malloc(sizeof(struct chmFile)); + newHandle = HeapAlloc(GetProcessHeap(), 0, sizeof(struct chmFile)); newHandle->fd = CHM_NULL_FD; newHandle->lzx_state = NULL; newHandle->cache_blocks = NULL; @@ -708,7 +708,7 @@ struct chmFile *chm_openW(const WCHAR *filename) FILE_ATTRIBUTE_NORMAL, NULL)) == CHM_NULL_FD) { - free(newHandle); + HeapFree(GetProcessHeap(), 0, newHandle); return NULL; } @@ -855,16 +855,16 @@ void chm_close(struct chmFile *h) for (i=0; i<h->cache_num_blocks; i++) { if (h->cache_blocks[i]) - free(h->cache_blocks[i]); + HeapFree(GetProcessHeap(), 0, h->cache_blocks[i]); } - free(h->cache_blocks); + HeapFree(GetProcessHeap(), 0, h->cache_blocks); h->cache_blocks = NULL; } - free(h->cache_block_indices); + HeapFree(GetProcessHeap(), 0, h->cache_block_indices); h->cache_block_indices = NULL; - free(h); + HeapFree(GetProcessHeap(), 0, h); } } @@ -1193,7 +1193,9 @@ static Int64 _chm_decompress_block(struct chmFile *h, indexSlot = (int)((curBlockIdx) % h->cache_num_blocks); h->cache_block_indices[indexSlot] = curBlockIdx; if (! h->cache_blocks[indexSlot]) - h->cache_blocks[indexSlot] = malloc( (unsigned int)(h->reset_table.block_len)); + h->cache_blocks[indexSlot] = + HeapAlloc(GetProcessHeap(), 0, + (unsigned int)(h->reset_table.block_len)); lbuffer = h->cache_blocks[indexSlot]; /* decompress the previous block */ @@ -1231,7 +1233,8 @@ static Int64 _chm_decompress_block(struct chmFile *h, indexSlot = (int)(block % h->cache_num_blocks); h->cache_block_indices[indexSlot] = block; if (! h->cache_blocks[indexSlot]) - h->cache_blocks[indexSlot] = malloc( ((unsigned int)h->reset_table.block_len)); + h->cache_blocks[indexSlot] = + HeapAlloc(GetProcessHeap(), 0, ((unsigned int)h->reset_table.block_len)); lbuffer = h->cache_blocks[indexSlot]; *ubuffer = lbuffer;
1
0
0
0
Juan Lang : crypt32: Implement decoding data messages ( when opened in non-streaming mode).
by Alexandre Julliard
16 Jul '07
16 Jul '07
Module: wine Branch: master Commit: 76061f403b0a2491803259ef30293fcdfa6a2d7d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=76061f403b0a2491803259ef3…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Fri Jul 13 11:47:46 2007 -0700 crypt32: Implement decoding data messages (when opened in non-streaming mode). --- dlls/crypt32/msg.c | 19 ++++++++++++++----- dlls/crypt32/tests/msg.c | 1 - 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c index 470bf58..854ee7c 100644 --- a/dlls/crypt32/msg.c +++ b/dlls/crypt32/msg.c @@ -607,10 +607,11 @@ HCRYPTMSG WINAPI CryptMsgOpenToEncode(DWORD dwMsgEncodingType, DWORD dwFlags, typedef struct _CDecodeMsg { - CryptMsgBase base; - DWORD type; - HCRYPTPROV crypt_prov; - CRYPT_DATA_BLOB msg_data; + CryptMsgBase base; + DWORD type; + HCRYPTPROV crypt_prov; + CRYPT_DATA_BLOB msg_data; + PCRYPT_DATA_BLOB data; /* for type == CMSG_DATA */ } CDecodeMsg; static void CDecodeMsg_Close(HCRYPTMSG hCryptMsg) @@ -620,6 +621,7 @@ static void CDecodeMsg_Close(HCRYPTMSG hCryptMsg) if (msg->base.open_flags & CMSG_CRYPT_RELEASE_CONTEXT_FLAG) CryptReleaseContext(msg->crypt_prov, 0); CryptMemFree(msg->msg_data.pbData); + LocalFree(msg->data); } static BOOL CDecodeMsg_CopyData(CDecodeMsg *msg, const BYTE *pbData, @@ -654,10 +656,17 @@ static BOOL CDecodeMsg_DecodeContent(CDecodeMsg *msg, CRYPT_DER_BLOB *blob, DWORD type) { BOOL ret; + DWORD size; switch (type) { case CMSG_DATA: + ret = CryptDecodeObjectEx(X509_ASN_ENCODING, X509_OCTET_STRING, + blob->pbData, blob->cbData, CRYPT_DECODE_ALLOC_FLAG, NULL, + (LPBYTE)&msg->data, &size); + if (ret) + msg->type = CMSG_DATA; + break; case CMSG_HASHED: case CMSG_ENVELOPED: case CMSG_SIGNED: @@ -667,7 +676,6 @@ static BOOL CDecodeMsg_DecodeContent(CDecodeMsg *msg, CRYPT_DER_BLOB *blob, default: { CRYPT_CONTENT_INFO *info; - DWORD size; ret = CryptDecodeObjectEx(X509_ASN_ENCODING, PKCS_CONTENT_INFO, msg->msg_data.pbData, msg->msg_data.cbData, CRYPT_DECODE_ALLOC_FLAG, @@ -774,6 +782,7 @@ HCRYPTMSG WINAPI CryptMsgOpenToDecode(DWORD dwMsgEncodingType, DWORD dwFlags, } msg->msg_data.cbData = 0; msg->msg_data.pbData = NULL; + msg->data = NULL; } return msg; } diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c index 17beca1..1293070 100644 --- a/dlls/crypt32/tests/msg.c +++ b/dlls/crypt32/tests/msg.c @@ -1092,7 +1092,6 @@ static void test_decode_msg_update(void) SetLastError(0xdeadbeef); ret = CryptMsgUpdate(msg, dataEmptyContent, sizeof(dataEmptyContent), TRUE); - todo_wine ok(!ret && GetLastError() == CRYPT_E_ASN1_BADTAG, "Expected CRYPT_E_ASN1_BADTAG, got %x\n", GetLastError()); CryptMsgClose(msg);
1
0
0
0
Juan Lang : crypt32: Partially implement updating decode messages.
by Alexandre Julliard
16 Jul '07
16 Jul '07
Module: wine Branch: master Commit: 2cca297ba657c9ee03a1a7d271a4a0a4b6f599e3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=2cca297ba657c9ee03a1a7d27…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Fri Jul 13 11:45:03 2007 -0700 crypt32: Partially implement updating decode messages. --- dlls/crypt32/msg.c | 111 +++++++++++++++++++++++++++++++++++++++++++-- dlls/crypt32/tests/msg.c | 11 ----- 2 files changed, 106 insertions(+), 16 deletions(-) diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c index 78130d2..470bf58 100644 --- a/dlls/crypt32/msg.c +++ b/dlls/crypt32/msg.c @@ -607,9 +607,10 @@ HCRYPTMSG WINAPI CryptMsgOpenToEncode(DWORD dwMsgEncodingType, DWORD dwFlags, typedef struct _CDecodeMsg { - CryptMsgBase base; - DWORD type; - HCRYPTPROV crypt_prov; + CryptMsgBase base; + DWORD type; + HCRYPTPROV crypt_prov; + CRYPT_DATA_BLOB msg_data; } CDecodeMsg; static void CDecodeMsg_Close(HCRYPTMSG hCryptMsg) @@ -618,13 +619,111 @@ static void CDecodeMsg_Close(HCRYPTMSG hCryptMsg) if (msg->base.open_flags & CMSG_CRYPT_RELEASE_CONTEXT_FLAG) CryptReleaseContext(msg->crypt_prov, 0); + CryptMemFree(msg->msg_data.pbData); +} + +static BOOL CDecodeMsg_CopyData(CDecodeMsg *msg, const BYTE *pbData, + DWORD cbData) +{ + BOOL ret = TRUE; + + if (cbData) + { + if (msg->msg_data.cbData) + msg->msg_data.pbData = CryptMemRealloc(msg->msg_data.pbData, + msg->msg_data.cbData + cbData); + else + msg->msg_data.pbData = CryptMemAlloc(cbData); + if (msg->msg_data.pbData) + { + memcpy(msg->msg_data.pbData + msg->msg_data.cbData, pbData, cbData); + msg->msg_data.cbData += cbData; + } + else + ret = FALSE; + } + return ret; +} + +/* Decodes the content in blob as the type given, and updates the value + * (type, parameters, etc.) of msg based on what blob contains. + * It doesn't just use msg's type, to allow a recursive call from an implicitly + * typed message once the outer content info has been decoded. + */ +static BOOL CDecodeMsg_DecodeContent(CDecodeMsg *msg, CRYPT_DER_BLOB *blob, + DWORD type) +{ + BOOL ret; + + switch (type) + { + case CMSG_DATA: + case CMSG_HASHED: + case CMSG_ENVELOPED: + case CMSG_SIGNED: + FIXME("unimplemented for type %s\n", MSG_TYPE_STR(type)); + ret = TRUE; + break; + default: + { + CRYPT_CONTENT_INFO *info; + DWORD size; + + ret = CryptDecodeObjectEx(X509_ASN_ENCODING, PKCS_CONTENT_INFO, + msg->msg_data.pbData, msg->msg_data.cbData, CRYPT_DECODE_ALLOC_FLAG, + NULL, (LPBYTE)&info, &size); + if (ret) + { + if (!strcmp(info->pszObjId, szOID_RSA_data)) + ret = CDecodeMsg_DecodeContent(msg, &info->Content, CMSG_DATA); + else if (!strcmp(info->pszObjId, szOID_RSA_digestedData)) + ret = CDecodeMsg_DecodeContent(msg, &info->Content, + CMSG_HASHED); + else if (!strcmp(info->pszObjId, szOID_RSA_envelopedData)) + ret = CDecodeMsg_DecodeContent(msg, &info->Content, + CMSG_ENVELOPED); + else if (!strcmp(info->pszObjId, szOID_RSA_signedData)) + ret = CDecodeMsg_DecodeContent(msg, &info->Content, + CMSG_SIGNED); + else + { + SetLastError(CRYPT_E_INVALID_MSG_TYPE); + ret = FALSE; + } + LocalFree(info); + } + } + } + return ret; } static BOOL CDecodeMsg_Update(HCRYPTMSG hCryptMsg, const BYTE *pbData, DWORD cbData, BOOL fFinal) { - FIXME("(%p, %p, %d, %d): stub\n", hCryptMsg, pbData, cbData, fFinal); - return FALSE; + CDecodeMsg *msg = (CDecodeMsg *)hCryptMsg; + BOOL ret = FALSE; + + TRACE("(%p, %p, %d, %d)\n", hCryptMsg, pbData, cbData, fFinal); + + if (msg->base.streamed) + { + ret = CDecodeMsg_CopyData(msg, pbData, cbData); + FIXME("(%p, %p, %d, %d): streamed update stub\n", hCryptMsg, pbData, + cbData, fFinal); + } + else + { + if (!fFinal) + SetLastError(CRYPT_E_MSG_ERROR); + else + { + ret = CDecodeMsg_CopyData(msg, pbData, cbData); + if (ret) + ret = CDecodeMsg_DecodeContent(msg, &msg->msg_data, msg->type); + + } + } + return ret; } static BOOL CDecodeMsg_GetParam(HCRYPTMSG hCryptMsg, DWORD dwParamType, @@ -673,6 +772,8 @@ HCRYPTMSG WINAPI CryptMsgOpenToDecode(DWORD dwMsgEncodingType, DWORD dwFlags, msg->crypt_prov = CRYPT_GetDefaultProvider(); msg->base.open_flags &= ~CMSG_CRYPT_RELEASE_CONTEXT_FLAG; } + msg->msg_data.cbData = 0; + msg->msg_data.pbData = NULL; } return msg; } diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c index a41a310..17beca1 100644 --- a/dlls/crypt32/tests/msg.c +++ b/dlls/crypt32/tests/msg.c @@ -989,7 +989,6 @@ static void test_decode_msg_update(void) msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, NULL); /* Update with a full message in a final update */ ret = CryptMsgUpdate(msg, dataEmptyContent, sizeof(dataEmptyContent), TRUE); - todo_wine ok(ret, "CryptMsgUpdate failed: %x\n", GetLastError()); /* Can't update after a final update */ SetLastError(0xdeadbeef); @@ -1003,12 +1002,10 @@ static void test_decode_msg_update(void) SetLastError(0xdeadbeef); ret = CryptMsgUpdate(msg, dataEmptyContent, sizeof(dataEmptyContent), FALSE); - todo_wine ok(!ret && GetLastError() == CRYPT_E_MSG_ERROR, "Expected CRYPT_E_MSG_ERROR, got %x\n", GetLastError()); /* A subsequent final update succeeds */ ret = CryptMsgUpdate(msg, dataEmptyContent, sizeof(dataEmptyContent), TRUE); - todo_wine ok(ret, "CryptMsgUpdate failed: %x\n", GetLastError()); CryptMsgClose(msg); @@ -1035,7 +1032,6 @@ static void test_decode_msg_update(void) /* Empty non-final updates are allowed when streaming.. */ msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, &streamInfo); ret = CryptMsgUpdate(msg, NULL, 0, FALSE); - todo_wine ok(ret, "CryptMsgUpdate failed: %x\n", GetLastError()); /* but final updates aren't when not enough data has been received. */ SetLastError(0xdeadbeef); @@ -1051,11 +1047,9 @@ static void test_decode_msg_update(void) msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, &streamInfo); for (i = 0, ret = TRUE; ret && i < sizeof(dataEmptyContent); i++) ret = CryptMsgUpdate(msg, &dataEmptyContent[i], 1, FALSE); - todo_wine { ok(ret, "CryptMsgUpdate failed on byte %d: %x\n", i, GetLastError()); ret = CryptMsgUpdate(msg, NULL, 0, TRUE); ok(ret, "CryptMsgUpdate failed on byte %d: %x\n", i, GetLastError()); - } CryptMsgClose(msg); todo_wine check_updates("byte-by-byte empty content", &a4, &accum); @@ -1065,7 +1059,6 @@ static void test_decode_msg_update(void) msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, NULL); SetLastError(0xdeadbeef); ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE); - todo_wine ok(!ret && GetLastError() == CRYPT_E_ASN1_BADTAG, "Expected CRYPT_E_ASN1_BADTAG, got %x\n", GetLastError()); CryptMsgClose(msg); @@ -1092,7 +1085,6 @@ static void test_decode_msg_update(void) msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, NULL); ret = CryptMsgUpdate(msg, dataEmptyContent, sizeof(dataEmptyContent), TRUE); - todo_wine ok(ret, "CryptMsgUpdate failed: %x\n", GetLastError()); /* but decoding it as an explicitly typed message fails. */ msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, CMSG_DATA, 0, NULL, @@ -1111,7 +1103,6 @@ static void test_decode_msg_update(void) SetLastError(0xdeadbeef); ret = CryptMsgUpdate(msg, dataEmptyBareContent, sizeof(dataEmptyBareContent), TRUE); - todo_wine ok(!ret && GetLastError() == CRYPT_E_ASN1_BADTAG, "Expected CRYPT_E_ASN1_BADTAG, got %x\n", GetLastError()); CryptMsgClose(msg); @@ -1120,7 +1111,6 @@ static void test_decode_msg_update(void) NULL); ret = CryptMsgUpdate(msg, dataEmptyBareContent, sizeof(dataEmptyBareContent), TRUE); - todo_wine ok(ret, "CryptMsgUpdate failed: %x\n", GetLastError()); CryptMsgClose(msg); @@ -1128,7 +1118,6 @@ static void test_decode_msg_update(void) msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, NULL); SetLastError(0xdeadbeef); ret = CryptMsgUpdate(msg, bogusOIDContent, sizeof(bogusOIDContent), TRUE); - todo_wine ok(!ret && GetLastError() == CRYPT_E_INVALID_MSG_TYPE, "Expected CRYPT_E_INVALID_MSG_TYPE, got %x\n", GetLastError()); CryptMsgClose(msg);
1
0
0
0
Juan Lang : crypt32: Store crypt provider in decode message.
by Alexandre Julliard
16 Jul '07
16 Jul '07
Module: wine Branch: master Commit: 6a07ca44420076056467742f780b445b91fd0af4 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6a07ca44420076056467742f7…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Fri Jul 13 10:58:10 2007 -0700 crypt32: Store crypt provider in decode message. --- dlls/crypt32/msg.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c index e97aa0c..78130d2 100644 --- a/dlls/crypt32/msg.c +++ b/dlls/crypt32/msg.c @@ -666,6 +666,13 @@ HCRYPTMSG WINAPI CryptMsgOpenToDecode(DWORD dwMsgEncodingType, DWORD dwFlags, CryptMsgBase_Init((CryptMsgBase *)msg, dwFlags, pStreamInfo, CDecodeMsg_Close, CDecodeMsg_GetParam, CDecodeMsg_Update); msg->type = dwMsgType; + if (hCryptProv) + msg->crypt_prov = hCryptProv; + else + { + msg->crypt_prov = CRYPT_GetDefaultProvider(); + msg->base.open_flags &= ~CMSG_CRYPT_RELEASE_CONTEXT_FLAG; + } } return msg; }
1
0
0
0
Juan Lang : crypt32: Fix decoding sequences with extra trailing data.
by Alexandre Julliard
16 Jul '07
16 Jul '07
Module: wine Branch: master Commit: 8dcd9e4279ef6601440b92fd94a30e046be589da URL:
http://source.winehq.org/git/wine.git/?a=commit;h=8dcd9e4279ef6601440b92fd9…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Fri Jul 13 10:35:58 2007 -0700 crypt32: Fix decoding sequences with extra trailing data. --- dlls/crypt32/decode.c | 74 +++++++++++++++++++++++++++++++++---------- dlls/crypt32/tests/crl.c | 8 +--- dlls/crypt32/tests/encode.c | 4 +-- 3 files changed, 60 insertions(+), 26 deletions(-) diff --git a/dlls/crypt32/decode.c b/dlls/crypt32/decode.c index d3f3322..3a3a195 100644 --- a/dlls/crypt32/decode.c +++ b/dlls/crypt32/decode.c @@ -297,15 +297,21 @@ struct AsnDecodeSequenceItem DWORD size; }; +/* Decodes the items in a sequence, where the items are described in items, + * the encoded data are in pbEncoded with length cbEncoded. Decodes into + * pvStructInfo. nextData is a pointer to the memory location at which the + * first decoded item with a dynamic pointer should point. + * Upon decoding, *cbDecoded is the total number of bytes decoded. + */ static BOOL CRYPT_AsnDecodeSequenceItems(DWORD dwCertEncodingType, struct AsnDecodeSequenceItem items[], DWORD cItem, const BYTE *pbEncoded, - DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, BYTE *nextData) + DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, BYTE *nextData, + DWORD *cbDecoded) { BOOL ret; - DWORD i; - const BYTE *ptr; + DWORD i, decoded = 0; + const BYTE *ptr = pbEncoded; - ptr = pbEncoded + 1 + GET_LEN_BYTES(pbEncoded[1]); for (i = 0, ret = TRUE; ret && i < cItem; i++) { if (cbEncoded - (ptr - pbEncoded) != 0) @@ -353,6 +359,7 @@ static BOOL CRYPT_AsnDecodeSequenceItems(DWORD dwCertEncodingType, items[i].size += sizeof(DWORD) - items[i].size % sizeof(DWORD); ptr += 1 + nextItemLenBytes + nextItemLen; + decoded += 1 + nextItemLenBytes + nextItemLen; } else if (items[i].optional && GetLastError() == CRYPT_E_ASN1_BADTAG) @@ -367,7 +374,10 @@ static BOOL CRYPT_AsnDecodeSequenceItems(DWORD dwCertEncodingType, GetLastError()); } else + { + decoded += 1 + nextItemLenBytes + nextItemLen; items[i].size = items[i].minSize; + } } else if (items[i].optional) { @@ -395,13 +405,8 @@ static BOOL CRYPT_AsnDecodeSequenceItems(DWORD dwCertEncodingType, ret = FALSE; } } - if (cbEncoded - (ptr - pbEncoded) != 0) - { - TRACE("%d remaining bytes, failing\n", cbEncoded - - (ptr - pbEncoded)); - SetLastError(CRYPT_E_ASN1_CORRUPT); - ret = FALSE; - } + if (ret) + *cbDecoded = decoded; return ret; } @@ -412,7 +417,6 @@ static BOOL CRYPT_AsnDecodeSequenceItems(DWORD dwCertEncodingType, * data will be stored. If you know the starting offset, you may pass it * here. Otherwise, pass NULL, and one will be inferred from the items. * Each item decoder is never called with CRYPT_DECODE_ALLOC_FLAG set. - * If any undecoded data are left over, fails with CRYPT_E_ASN1_CORRUPT. */ static BOOL CRYPT_AsnDecodeSequence(DWORD dwCertEncodingType, struct AsnDecodeSequenceItem items[], DWORD cItem, const BYTE *pbEncoded, @@ -431,13 +435,30 @@ static BOOL CRYPT_AsnDecodeSequence(DWORD dwCertEncodingType, if ((ret = CRYPT_GetLen(pbEncoded, cbEncoded, &dataLen))) { - DWORD i; + DWORD lenBytes = GET_LEN_BYTES(pbEncoded[1]), cbDecoded; + const BYTE *ptr = pbEncoded + 1 + lenBytes; - ret = CRYPT_AsnDecodeSequenceItems(dwFlags, items, cItem, pbEncoded, - cbEncoded, dwFlags, NULL, NULL); + cbEncoded -= 1 + lenBytes; + if (cbEncoded < dataLen) + { + TRACE("dataLen %d exceeds cbEncoded %d, failing\n", dataLen, + cbEncoded); + SetLastError(CRYPT_E_ASN1_CORRUPT); + ret = FALSE; + } + else + ret = CRYPT_AsnDecodeSequenceItems(dwFlags, items, cItem, ptr, + cbEncoded, dwFlags, NULL, NULL, &cbDecoded); + if (ret && cbDecoded != dataLen) + { + TRACE("expected %d decoded, got %d, failing\n", dataLen, + cbDecoded); + SetLastError(CRYPT_E_ASN1_CORRUPT); + ret = FALSE; + } if (ret) { - DWORD bytesNeeded = 0, structSize = 0; + DWORD i, bytesNeeded = 0, structSize = 0; for (i = 0; i < cItem; i++) { @@ -459,7 +480,8 @@ static BOOL CRYPT_AsnDecodeSequence(DWORD dwCertEncodingType, nextData = (BYTE *)pvStructInfo + structSize; memset(pvStructInfo, 0, structSize); ret = CRYPT_AsnDecodeSequenceItems(dwFlags, items, cItem, - pbEncoded, cbEncoded, dwFlags, pvStructInfo, nextData); + ptr, cbEncoded, dwFlags, pvStructInfo, nextData, + &cbDecoded); } } } @@ -872,6 +894,24 @@ static BOOL WINAPI CRYPT_AsnDecodeCertInfo(DWORD dwCertEncodingType, ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items, sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags, pDecodePara, pvStructInfo, pcbStructInfo, NULL); + if (ret && pvStructInfo) + { + CERT_INFO *info; + + if (dwFlags & CRYPT_DECODE_ALLOC_FLAG) + info = *(CERT_INFO **)pvStructInfo; + else + info = (CERT_INFO *)pvStructInfo; + if (!info->SerialNumber.cbData || !info->Issuer.cbData || + !info->Subject.cbData) + { + SetLastError(CRYPT_E_ASN1_CORRUPT); + /* Don't need to deallocate, because it should have failed on the + * first pass (and no memory was allocated.) + */ + ret = FALSE; + } + } TRACE("Returning %d (%08x)\n", ret, GetLastError()); return ret; diff --git a/dlls/crypt32/tests/crl.c b/dlls/crypt32/tests/crl.c index 462d89f..7ecf6d4 100644 --- a/dlls/crypt32/tests/crl.c +++ b/dlls/crypt32/tests/crl.c @@ -98,14 +98,10 @@ static void testCreateCRL(void) "Expected CRYPT_E_ASN1_EOD or OSS_MORE_INPUT, got %08x\n", GLE); context = CertCreateCRLContext(X509_ASN_ENCODING, bigCert, sizeof(bigCert)); GLE = GetLastError(); - ok(!context && (GLE == CRYPT_E_ASN1_CORRUPT || GLE == OSS_DATA_ERROR), - "Expected CRYPT_E_ASN1_CORRUPT or OSS_DATA_ERROR, got %08x\n", GLE); + ok(!context, "Expected failure\n"); context = CertCreateCRLContext(X509_ASN_ENCODING, signedCRL, sizeof(signedCRL) - 1); - ok(!context && (GLE == CRYPT_E_ASN1_EOD || GLE == CRYPT_E_ASN1_CORRUPT || - GLE == OSS_DATA_ERROR), - "Expected CRYPT_E_ASN1_EOD or CRYPT_E_ASN1_CORRUPT or OSS_DATA_ERROR, got %08x\n", - GLE); + ok(!context, "Expected failure\n"); context = CertCreateCRLContext(X509_ASN_ENCODING, signedCRL, sizeof(signedCRL)); ok(context != NULL, "CertCreateCRLContext failed: %08x\n", GetLastError()); diff --git a/dlls/crypt32/tests/encode.c b/dlls/crypt32/tests/encode.c index 881f6cb..8173a12 100644 --- a/dlls/crypt32/tests/encode.c +++ b/dlls/crypt32/tests/encode.c @@ -2765,8 +2765,7 @@ static void test_decodeCertToBeSigned(DWORD dwEncoding) ret = CryptDecodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED, corruptCerts[i], corruptCerts[i][1] + 2, CRYPT_DECODE_ALLOC_FLAG, NULL, (BYTE *)&buf, &size); - ok(!ret && (GetLastError() == CRYPT_E_ASN1_CORRUPT), - "Expected CRYPT_E_ASN1_CORRUPT, got %08x\n", GetLastError()); + ok(!ret, "Expected failure\n"); } /* Now check with serial number, subject and issuer specified */ ret = CryptDecodeObjectEx(dwEncoding, X509_CERT_TO_BE_SIGNED, bigCert, @@ -4642,7 +4641,6 @@ static void test_decodePKCSContentInfo(DWORD dwEncoding) ret = CryptDecodeObjectEx(dwEncoding, PKCS_CONTENT_INFO, emptyPKCSContentInfoExtraBytes, sizeof(emptyPKCSContentInfoExtraBytes), 0, NULL, NULL, &size); - todo_wine ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError()); SetLastError(0xdeadbeef); ret = CryptDecodeObjectEx(dwEncoding, PKCS_CONTENT_INFO,
1
0
0
0
Juan Lang : crypt32: Add test showing extra trailing bytes should be tolerated in encoded data.
by Alexandre Julliard
16 Jul '07
16 Jul '07
Module: wine Branch: master Commit: 01685bca0e3a5eedfda8f5b18a4f769b5450dffa URL:
http://source.winehq.org/git/wine.git/?a=commit;h=01685bca0e3a5eedfda8f5b18…
Author: Juan Lang <juan.lang(a)gmail.com> Date: Fri Jul 13 10:08:50 2007 -0700 crypt32: Add test showing extra trailing bytes should be tolerated in encoded data. --- dlls/crypt32/tests/encode.c | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-) diff --git a/dlls/crypt32/tests/encode.c b/dlls/crypt32/tests/encode.c index 52603e5..881f6cb 100644 --- a/dlls/crypt32/tests/encode.c +++ b/dlls/crypt32/tests/encode.c @@ -200,6 +200,7 @@ static void test_decodeInt(DWORD dwEncoding) static const BYTE testStr[] = { 0x16, 4, 't', 'e', 's', 't' }; static const BYTE longForm[] = { 2, 0x81, 0x01, 0x01 }; static const BYTE bigBogus[] = { 0x02, 0x84, 0x01, 0xff, 0xff, 0xf9 }; + static const BYTE extraBytes[] = { 2, 1, 1, 0, 0, 0, 0 }; BYTE *buf = NULL; DWORD bufSize = 0; int i; @@ -310,6 +311,15 @@ static void test_decodeInt(DWORD dwEncoding) ok(*(int *)buf == 1, "Expected 1, got %d\n", *(int *)buf); LocalFree(buf); } + /* check with extra bytes at the end */ + ret = CryptDecodeObjectEx(dwEncoding, X509_INTEGER, extraBytes, + sizeof(extraBytes), CRYPT_DECODE_ALLOC_FLAG, NULL, (BYTE *)&buf, &bufSize); + ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError()); + if (buf) + { + ok(*(int *)buf == 1, "Expected 1, got %d\n", *(int *)buf); + LocalFree(buf); + } /* Try to decode some bogus large items */ /* The buffer size is smaller than the encoded length, so this should fail * with CRYPT_E_ASN1_EOD if it's being decoded. @@ -969,6 +979,11 @@ static void compareNames(const CERT_NAME_INFO *expected, } } +static const BYTE twoRDNsExtraBytes[] = { + 0x30,0x23,0x31,0x21,0x30,0x0c,0x06,0x03,0x55,0x04,0x04, + 0x13,0x05,0x4c,0x61,0x6e,0x67,0x00,0x30,0x11,0x06,0x03,0x55,0x04,0x03, + 0x13,0x0a,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0,0,0,0,0,0}; + static void test_decodeName(DWORD dwEncoding) { BYTE *buf = NULL; @@ -1035,6 +1050,11 @@ static void test_decodeName(DWORD dwEncoding) compareNames(&info, (CERT_NAME_INFO *)buf); LocalFree(buf); } + /* test that two RDN attrs with extra bytes succeeds */ + bufSize = 0; + ret = CryptDecodeObjectEx(dwEncoding, X509_NAME, twoRDNsExtraBytes, + sizeof(twoRDNsExtraBytes), 0, NULL, NULL, &bufSize); + ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError()); /* And, a slightly more complicated name */ buf = NULL; bufSize = 0; @@ -1257,6 +1277,7 @@ static void test_decodeNameValue(DWORD dwEncoding) } static const BYTE emptyURL[] = { 0x30, 0x02, 0x86, 0x00 }; +static const BYTE emptyURLExtraBytes[] = { 0x30, 0x02, 0x86, 0x00, 0, 0, 0 }; static const WCHAR url[] = { 'h','t','t','p',':','/','/','w','i','n','e', 'h','q','.','o','r','g',0 }; static const BYTE encodedURL[] = { 0x30, 0x13, 0x86, 0x11, 0x68, 0x74, @@ -1412,6 +1433,9 @@ static void test_decodeAltName(DWORD dwEncoding) "Expected empty URL\n"); LocalFree(buf); } + ret = CryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, + emptyURLExtraBytes, sizeof(emptyURLExtraBytes), 0, NULL, NULL, &bufSize); + ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError()); ret = CryptDecodeObjectEx(dwEncoding, X509_ALTERNATE_NAME, encodedURL, encodedURL[1] + 2, CRYPT_DECODE_ALLOC_FLAG, NULL, (BYTE *)&buf, &bufSize); @@ -4535,6 +4559,8 @@ static void test_decodeAuthorityKeyId2(DWORD dwEncoding) } static const BYTE emptyPKCSContentInfo[] = { 0x30,0x04,0x06,0x02,0x2a,0x03 }; +static const BYTE emptyPKCSContentInfoExtraBytes[] = { 0x30,0x04,0x06,0x02,0x2a, + 0x03,0,0,0,0,0,0 }; static const BYTE bogusPKCSContentInfo[] = { 0x30,0x07,0x06,0x02,0x2a,0x03, 0xa0,0x01,0x01 }; static const BYTE intPKCSContentInfo[] = { 0x30,0x09,0x06,0x02,0x2a,0x03,0xa0, @@ -4613,6 +4639,11 @@ static void test_decodePKCSContentInfo(DWORD dwEncoding) info->Content.cbData); LocalFree(buf); } + ret = CryptDecodeObjectEx(dwEncoding, PKCS_CONTENT_INFO, + emptyPKCSContentInfoExtraBytes, sizeof(emptyPKCSContentInfoExtraBytes), + 0, NULL, NULL, &size); + todo_wine + ok(ret, "CryptDecodeObjectEx failed: %x\n", GetLastError()); SetLastError(0xdeadbeef); ret = CryptDecodeObjectEx(dwEncoding, PKCS_CONTENT_INFO, bogusPKCSContentInfo, sizeof(bogusPKCSContentInfo),
1
0
0
0
← Newer
1
...
54
55
56
57
58
59
60
...
96
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
Results per page:
10
25
50
100
200