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
December 2005
----- 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
40 participants
704 discussions
Start a n
N
ew thread
[gvg] 20347: Sync to Wine-0_9_4:
by gvg@svn.reactos.com
Sync to Wine-0_9_4: Juan Lang <juan_lang(a)yahoo.com> - crypt32: Implement more implicit properties, with tests. - crypt32: Implement CRLDistPoints encoding/decoding. - rewrite sequence decoding to support context-specific tags, and eliminate duplicated code - implement encoding and decoding of CRLDistPoints - crypt32: Decode cleanups. - implement a helper to decode sequences of like types - use helper functions wherever applicable when decoding - correct "expected" vs. "got" usage in tests - fix a few other small bugs Alexandre Julliard <julliard(a)winehq.org> - Take advantage of the __EXCEPT_PAGE_FAULT macro. Modified: trunk/reactos/lib/crypt32/cert.c Modified: trunk/reactos/lib/crypt32/encode.c Modified: trunk/reactos/w32api/include/wincrypt.h _____ Modified: trunk/reactos/lib/crypt32/cert.c --- trunk/reactos/lib/crypt32/cert.c 2005-12-26 22:57:56 UTC (rev 20346) +++ trunk/reactos/lib/crypt32/cert.c 2005-12-26 23:05:15 UTC (rev 20347) @@ -313,14 +313,6 @@ static const void * WINAPI CRYPT_ReadSerializedElement(const BYTE *pbElement, DWORD cbElement, DWORD dwContextTypeFlags, DWORD *pdwContentType); -/* filter for page-fault exceptions */ -static WINE_EXCEPTION_FILTER(page_fault) -{ - if (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION) - return EXCEPTION_EXECUTE_HANDLER; - return EXCEPTION_CONTINUE_SEARCH; -} - static void CRYPT_InitStore(WINECRYPT_CERTSTORE *store, HCRYPTPROV hCryptProv, DWORD dwFlags, CertStoreType type) { @@ -1885,6 +1877,22 @@ return ret; } +static BOOL CRYPT_GetCertHashProp(PWINE_CERT_CONTEXT context, DWORD dwPropId, + ALG_ID algID, const BYTE *toHash, DWORD toHashLen, void *pvData, + DWORD *pcbData) +{ + BOOL ret = CryptHashCertificate(0, algID, 0, toHash, toHashLen, pvData, + pcbData); + if (ret) + { + CRYPT_DATA_BLOB blob = { *pcbData, pvData }; + + ret = CRYPT_SetCertificateContextProperty(context, dwPropId, + 0, &blob); + } + return ret; +} + static BOOL WINAPI CRYPT_GetCertificateContextProperty( PWINE_CERT_CONTEXT context, DWORD dwPropId, void *pvData, DWORD *pcbData) { @@ -1927,26 +1935,34 @@ switch (dwPropId) { case CERT_SHA1_HASH_PROP_ID: - ret = CryptHashCertificate(0, CALG_SHA1, 0, + ret = CRYPT_GetCertHashProp(context, dwPropId, CALG_SHA1, context->cert.pbCertEncoded, context->cert.cbCertEncoded, pvData, pcbData); - if (ret) - { - CRYPT_DATA_BLOB blob = { *pcbData, pvData }; - - ret = CRYPT_SetCertificateContextProperty(context, dwPropId, - 0, &blob); - } break; - case CERT_KEY_PROV_INFO_PROP_ID: case CERT_MD5_HASH_PROP_ID: + ret = CRYPT_GetCertHashProp(context, dwPropId, CALG_MD5, + context->cert.pbCertEncoded, context->cert.cbCertEncoded, pvData, + pcbData); + break; + case CERT_SUBJECT_NAME_MD5_HASH_PROP_ID: + ret = CRYPT_GetCertHashProp(context, dwPropId, CALG_MD5, + context->cert.pCertInfo->Subject.pbData, + context->cert.pCertInfo->Subject.cbData, + pvData, pcbData); + break; + case CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID: + ret = CRYPT_GetCertHashProp(context, dwPropId, CALG_MD5, + context->cert.pCertInfo->SubjectPublicKeyInfo.PublicKey.pbData, + context->cert.pCertInfo->SubjectPublicKeyInfo.PublicKey.cbData, + pvData, pcbData); + break; case CERT_SIGNATURE_HASH_PROP_ID: - case CERT_KEY_IDENTIFIER_PROP_ID: - case CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID: case CERT_ISSUER_SERIAL_NUMBER_MD5_HASH_PROP_ID: - case CERT_SUBJECT_NAME_MD5_HASH_PROP_ID: FIXME("implicit property %ld\n", dwPropId); + SetLastError(CRYPT_E_NOT_FOUND); break; + default: + SetLastError(CRYPT_E_NOT_FOUND); } } LeaveCriticalSection(&context->cs); @@ -2108,6 +2124,7 @@ case CERT_PVK_FILE_PROP_ID: case CERT_SIGNATURE_HASH_PROP_ID: case CERT_ISSUER_PUBLIC_KEY_MD5_HASH_PROP_ID: + case CERT_SUBJECT_NAME_MD5_HASH_PROP_ID: case CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID: case CERT_ENROLLMENT_PROP_ID: case CERT_CROSS_CERT_DIST_POINTS_PROP_ID: @@ -2787,7 +2804,7 @@ } } } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); context = NULL; _____ Modified: trunk/reactos/lib/crypt32/encode.c --- trunk/reactos/lib/crypt32/encode.c 2005-12-26 22:57:56 UTC (rev 20346) +++ trunk/reactos/lib/crypt32/encode.c 2005-12-26 23:05:15 UTC (rev 20347) @@ -61,8 +61,8 @@ #define ASN_UTCTIME (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x17) #define ASN_GENERALTIME (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x18) -#define ASN_FLAGS_MASK 0xf0 -#define ASN_TYPE_MASK 0x0f +#define ASN_FLAGS_MASK 0xe0 +#define ASN_TYPE_MASK 0x1f WINE_DEFAULT_DEBUG_CHANNEL(crypt); @@ -134,10 +134,11 @@ PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo); static BOOL WINAPI CRYPT_AsnDecodeOid(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, LPSTR pszObjId, DWORD *pcbObjId); -/* Assumes algo->Parameters.pbData is set ahead of time */ +/* Assumes algo->Parameters.pbData is set ahead of time. Internal func. */ static BOOL WINAPI CRYPT_AsnDecodeAlgorithmId(DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo); +/* Internal function */ static BOOL WINAPI CRYPT_AsnDecodeBool(DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo); @@ -171,14 +172,6 @@ DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo); -/* filter for page-fault exceptions */ -static WINE_EXCEPTION_FILTER(page_fault) -{ - if (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION) - return EXCEPTION_EXECUTE_HANDLER; - return EXCEPTION_CONTINUE_SEARCH; -} - BOOL WINAPI CryptEncodeObject(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, BYTE *pbEncoded, DWORD *pcbEncoded) { @@ -311,6 +304,9 @@ ret = items[i].encodeFunc(dwCertEncodingType, NULL, items[i].pvStructInfo, dwFlags & ~CRYPT_ENCODE_ALLOC_FLAG, NULL, NULL, &items[i].size); + /* Some functions propagate their errors through the size */ + if (!ret) + *pcbEncoded = items[i].size; dataLen += items[i].size; } if (ret) @@ -336,6 +332,9 @@ ret = items[i].encodeFunc(dwCertEncodingType, NULL, items[i].pvStructInfo, dwFlags & ~CRYPT_ENCODE_ALLOC_FLAG, NULL, pbEncoded, &items[i].size); + /* Some functions propagate their errors through the size */ + if (!ret) + *pcbEncoded = items[i].size; pbEncoded += items[i].size; } } @@ -381,11 +380,47 @@ ret = item->encodeFunc(dwCertEncodingType, lpszStructType, item->pvStructInfo, dwFlags & ~CRYPT_ENCODE_ALLOC_FLAG, NULL, pbEncoded, &len); + if (!ret) + { + /* Some functions propagate their errors through the size */ + *pcbEncoded = len; + } } } + else + { + /* Some functions propagate their errors through the size */ + *pcbEncoded = len; + } return ret; } +struct AsnEncodeTagSwappedItem +{ + BYTE tag; + const void *pvStructInfo; + CryptEncodeObjectExFunc encodeFunc; +}; + +/* Sort of a wacky hack, it encodes something using the struct + * AsnEncodeTagSwappedItem's encodeFunc, then replaces the tag byte with the tag + * given in the struct AsnEncodeTagSwappedItem. + */ +static BOOL WINAPI CRYPT_AsnEncodeSwapTag(DWORD dwCertEncodingType, + LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, + PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded) +{ + BOOL ret; + const struct AsnEncodeTagSwappedItem *item = + (const struct AsnEncodeTagSwappedItem *)pvStructInfo; + + ret = item->encodeFunc(dwCertEncodingType, lpszStructType, + item->pvStructInfo, dwFlags, pEncodePara, pbEncoded, pcbEncoded); + if (ret && pbEncoded) + *pbEncoded = item->tag; + return ret; +} + static BOOL WINAPI CRYPT_AsnEncodeCertVersion(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded) @@ -495,7 +530,7 @@ sizeof(items) / sizeof(items[0]), dwFlags, pEncodePara, pbEncoded, pcbEncoded); } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -526,7 +561,7 @@ sizeof(items) / sizeof(items[0]), dwFlags, pEncodePara, pbEncoded, pcbEncoded); } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -595,7 +630,7 @@ ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items, cItem, dwFlags, pEncodePara, pbEncoded, pcbEncoded); } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -739,7 +774,7 @@ ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items, cItem, dwFlags, pEncodePara, pbEncoded, pcbEncoded); } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -823,7 +858,7 @@ } } } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -1031,7 +1066,7 @@ } else { - *pbEncoded++ = ASN_CONSTRUCTOR | ASN_SEQUENCE; + *pbEncoded++ = ASN_SEQUENCE; CRYPT_EncodeLen(bytesNeeded - lenBytes - 1, pbEncoded, &lenBytes); pbEncoded += lenBytes; @@ -1140,7 +1175,7 @@ CryptMemFree(blobs[i].pbData); } } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -1202,7 +1237,7 @@ } } } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -1339,7 +1374,6 @@ { const CERT_ALT_NAME_INFO *info = (const CERT_ALT_NAME_INFO *)pvStructInfo; - DWORD bytesNeeded, dataLen, lenBytes, i; ret = TRUE; @@ -1399,7 +1433,7 @@ } } } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -1436,7 +1470,7 @@ ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items, cItem, dwFlags, pEncodePara, pbEncoded, pcbEncoded); } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -1477,7 +1511,7 @@ pcbEncoded); } } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -1522,7 +1556,7 @@ } } } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -1593,7 +1627,7 @@ } } } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -1632,7 +1666,7 @@ &newBlob, dwFlags, pEncodePara, pbEncoded, pcbEncoded); CryptMemFree(newBlob.pbData); } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -1731,7 +1765,7 @@ } } } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -1802,7 +1836,7 @@ } } } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -1881,7 +1915,7 @@ } } } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -1930,7 +1964,7 @@ } } } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -1960,7 +1994,7 @@ lpszStructType, pvStructInfo, dwFlags, pEncodePara, pbEncoded, pcbEncoded); } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -2009,7 +2043,7 @@ } } } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -2018,6 +2052,145 @@ return ret; } +static BOOL CRYPT_AsnEncodeDistPoint(const CRL_DIST_POINT *distPoint, + BYTE *pbEncoded, DWORD *pcbEncoded) +{ + BOOL ret = TRUE; + struct AsnEncodeSequenceItem items[3] = { { 0 } }; + struct AsnConstructedItem constructed = { 0 }; + struct AsnEncodeTagSwappedItem swapped[3] = { { 0 } }; + DWORD cItem = 0, cSwapped = 0; + + switch (distPoint->DistPointName.dwDistPointNameChoice) + { + case CRL_DIST_POINT_NO_NAME: + /* do nothing */ + break; + case CRL_DIST_POINT_FULL_NAME: + swapped[cSwapped].tag = ASN_CONTEXT | ASN_CONSTRUCTOR | 0; + swapped[cSwapped].pvStructInfo = &distPoint->DistPointName.u.FullName; + swapped[cSwapped].encodeFunc = CRYPT_AsnEncodeAltName; + constructed.tag = 0; + constructed.pvStructInfo = &swapped[cSwapped]; + constructed.encodeFunc = CRYPT_AsnEncodeSwapTag; + items[cItem].pvStructInfo = &constructed; + items[cItem].encodeFunc = CRYPT_AsnEncodeConstructed; + cSwapped++; + cItem++; + break; + case CRL_DIST_POINT_ISSUER_RDN_NAME: + FIXME("unimplemented for CRL_DIST_POINT_ISSUER_RDN_NAME\n"); + ret = FALSE; + break; + default: + ret = FALSE; + } + if (ret && distPoint->ReasonFlags.cbData) + { + swapped[cSwapped].tag = ASN_CONTEXT | 1; + swapped[cSwapped].pvStructInfo = &distPoint->ReasonFlags; + swapped[cSwapped].encodeFunc = CRYPT_AsnEncodeBits; + items[cItem].pvStructInfo = &swapped[cSwapped]; + items[cItem].encodeFunc = CRYPT_AsnEncodeSwapTag; + cSwapped++; + cItem++; + } + if (ret && distPoint->CRLIssuer.cAltEntry) + { + swapped[cSwapped].tag = ASN_CONTEXT | ASN_CONSTRUCTOR | 2; + swapped[cSwapped].pvStructInfo = &distPoint->CRLIssuer; + swapped[cSwapped].encodeFunc = CRYPT_AsnEncodeAltName; + items[cItem].pvStructInfo = &swapped[cSwapped]; + items[cItem].encodeFunc = CRYPT_AsnEncodeSwapTag; + cSwapped++; + cItem++; + } + if (ret) + ret = CRYPT_AsnEncodeSequence(X509_ASN_ENCODING, items, cItem, 0, NULL, + pbEncoded, pcbEncoded); + return ret; +} + +static BOOL WINAPI CRYPT_AsnEncodeCRLDistPoints(DWORD dwCertEncodingType, + LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, + PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded) +{ + BOOL ret; + + __TRY + { + const CRL_DIST_POINTS_INFO *info = + (const CRL_DIST_POINTS_INFO *)pvStructInfo; + + if (!info->cDistPoint) + { + SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)); + ret = FALSE; + } + else + { + DWORD bytesNeeded, dataLen, lenBytes, i; + + ret = TRUE; + for (i = 0, dataLen = 0; ret && i < info->cDistPoint; i++) + { + DWORD len; + + ret = CRYPT_AsnEncodeDistPoint(&info->rgDistPoint[i], NULL, + &len); + if (ret) + dataLen += len; + else if (GetLastError() == CRYPT_E_INVALID_IA5_STRING) + { + /* Have to propagate index of failing character */ + *pcbEncoded = len; + } + } + if (ret) + { + CRYPT_EncodeLen(dataLen, NULL, &lenBytes); + bytesNeeded = 1 + lenBytes + dataLen; + if (!pbEncoded) + { + *pcbEncoded = bytesNeeded; + ret = TRUE; + } + else + { + if ((ret = CRYPT_EncodeEnsureSpace(dwFlags, pEncodePara, + pbEncoded, pcbEncoded, bytesNeeded))) + { + if (dwFlags & CRYPT_ENCODE_ALLOC_FLAG) + pbEncoded = *(BYTE **)pbEncoded; + *pbEncoded++ = ASN_SEQUENCEOF; + CRYPT_EncodeLen(dataLen, pbEncoded, &lenBytes); + pbEncoded += lenBytes; + for (i = 0; ret && i < info->cDistPoint; i++) + { + DWORD len = dataLen; + + ret = CRYPT_AsnEncodeDistPoint( + &info->rgDistPoint[i], pbEncoded, &len); + if (ret) + { + pbEncoded += len; + dataLen -= len; + } + } + } + } + } + } + } + __EXCEPT_PAGE_FAULT + { + SetLastError(STATUS_ACCESS_VIOLATION); + ret = FALSE; + } + __ENDTRY + return ret; +} + BOOL WINAPI CryptEncodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, void *pvEncoded, DWORD *pcbEncoded) @@ -2105,6 +2278,9 @@ case (WORD)PKCS_UTC_TIME: encodeFunc = CRYPT_AsnEncodeUtcTime; break; + case (WORD)X509_CRL_DIST_POINTS: + encodeFunc = CRYPT_AsnEncodeCRLDistPoints; + break; default: FIXME("%d: unimplemented\n", LOWORD(lpszStructType)); } @@ -2291,7 +2467,9 @@ return ret; } -/* A few of the members need explanation: +/* tag: + * The expected tag of the item. If tag is 0, decodeFunc is called + * regardless of the tag value seen. * offset: * A sequence is decoded into a struct. The offset member is the * offset of this item within that struct. @@ -2301,9 +2479,9 @@ * minSize: * The minimum amount of space occupied after decoding. You must set this. * optional: - * If true, and a decoding function fails with CRYPT_E_ASN1_BADTAG, then - * minSize space is filled with 0 for this member. (Any other failure - * results in CRYPT_AsnDecodeSequence failing.) + * If true, and the tag doesn't match the expected tag for this item, + * or the decodeFunc fails with CRYPT_E_ASN1_BADTAG, then minSize space is + * filled with 0 for this member. * hasPointer, pointerOffset, minSize: * If the item has dynamic data, set hasPointer to TRUE, pointerOffset to * the offset within the (outer) struct of the data pointer (or to the @@ -2313,6 +2491,7 @@ */ struct AsnDecodeSequenceItem { + BYTE tag; DWORD offset; CryptDecodeObjectExFunc decodeFunc; DWORD minSize; @@ -2322,6 +2501,114 @@ DWORD size; }; +static BOOL CRYPT_AsnDecodeSequenceItems(DWORD dwCertEncodingType, + struct AsnDecodeSequenceItem items[], DWORD cItem, const BYTE *pbEncoded, + DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, BYTE *nextData) +{ + BOOL ret; + DWORD i; + const BYTE *ptr; + + ptr = pbEncoded + 1 + GET_LEN_BYTES(pbEncoded[1]); + for (i = 0, ret = TRUE; ret && i < cItem; i++) + { + if (cbEncoded - (ptr - pbEncoded) != 0) + { + DWORD nextItemLen; + + if ((ret = CRYPT_GetLen(ptr, cbEncoded - (ptr - pbEncoded), + &nextItemLen))) + { + BYTE nextItemLenBytes = GET_LEN_BYTES(ptr[1]); + + if (ptr[0] == items[i].tag || !items[i].tag) + { + if (nextData && pvStructInfo && items[i].hasPointer) + { + TRACE("Setting next pointer to %p\n", + nextData); + *(BYTE **)((BYTE *)pvStructInfo + + items[i].pointerOffset) = nextData; + } + if (items[i].decodeFunc) + { + if (pvStructInfo) + TRACE("decoding item %ld\n", i); + else + TRACE("sizing item %ld\n", i); + ret = items[i].decodeFunc(dwCertEncodingType, + NULL, ptr, 1 + nextItemLenBytes + nextItemLen, + dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, NULL, + pvStructInfo ? (BYTE *)pvStructInfo + items[i].offset + : NULL, &items[i].size); + if (ret) + { + if (nextData && items[i].hasPointer && + items[i].size > items[i].minSize) + { + nextData += items[i].size - items[i].minSize; + /* align nextData to DWORD boundaries */ + if (items[i].size % sizeof(DWORD)) + nextData += sizeof(DWORD) - items[i].size % + sizeof(DWORD); + } + /* Account for alignment padding */ + if (items[i].size % sizeof(DWORD)) + items[i].size += sizeof(DWORD) - + items[i].size % sizeof(DWORD); + ptr += 1 + nextItemLenBytes + nextItemLen; + } + else if (items[i].optional && + GetLastError() == CRYPT_E_ASN1_BADTAG) + { + TRACE("skipping optional item %ld\n", i); + items[i].size = items[i].minSize; + SetLastError(NOERROR); + ret = TRUE; + } + else + TRACE("item %ld failed: %08lx\n", i, + GetLastError()); + } + else + items[i].size = items[i].minSize; + } + else if (items[i].optional) + { + TRACE("skipping optional item %ld\n", i); + items[i].size = items[i].minSize; + } + else + { + TRACE("tag %02x doesn't match expected %02x\n", + ptr[0], items[i].tag); + SetLastError(CRYPT_E_ASN1_BADTAG); + ret = FALSE; + } + } + } + else if (items[i].optional) + { + TRACE("missing optional item %ld, skipping\n", i); + items[i].size = items[i].minSize; + } + else + { + TRACE("not enough bytes for item %ld, failing\n", i); + SetLastError(CRYPT_E_ASN1_CORRUPT); + ret = FALSE; + } + } + if (cbEncoded - (ptr - pbEncoded) != 0) + { + TRACE("%ld remaining bytes, failing\n", cbEncoded - + (ptr - pbEncoded)); + SetLastError(CRYPT_E_ASN1_CORRUPT); + ret = FALSE; + } + return ret; +} + /* This decodes an arbitrary sequence into a contiguous block of memory * (basically, a struct.) Each element being decoded is described by a struct * AsnDecodeSequenceItem, see above. @@ -2348,70 +2635,160 @@ if ((ret = CRYPT_GetLen(pbEncoded, cbEncoded, &dataLen))) { + DWORD i; + + ret = CRYPT_AsnDecodeSequenceItems(dwFlags, items, cItem, pbEncoded, + cbEncoded, dwFlags, NULL, NULL); + if (ret) + { + DWORD bytesNeeded = 0, structSize = 0; + + for (i = 0; i < cItem; i++) + { + bytesNeeded += items[i].size; + structSize += items[i].minSize; + } + if (!pvStructInfo) + *pcbStructInfo = bytesNeeded; + else if ((ret = CRYPT_DecodeEnsureSpace(dwFlags, + pDecodePara, pvStructInfo, pcbStructInfo, bytesNeeded))) + { + BYTE *nextData; + + if (dwFlags & CRYPT_DECODE_ALLOC_FLAG) + pvStructInfo = *(BYTE **)pvStructInfo; + if (startingPointer) + nextData = (BYTE *)startingPointer; + else + nextData = (BYTE *)pvStructInfo + structSize; + memset(pvStructInfo, 0, structSize); + ret = CRYPT_AsnDecodeSequenceItems(dwFlags, items, cItem, + pbEncoded, cbEncoded, dwFlags, pvStructInfo, nextData); + } + } + } + } + else + { + SetLastError(CRYPT_E_ASN1_BADTAG); + ret = FALSE; + } + TRACE("returning %d (%08lx)\n", ret, GetLastError()); + return ret; +} + +/* tag: + * The expected tag of the entire encoded array (usually a variant + * of ASN_SETOF or ASN_SEQUENCEOF.) + * decodeFunc: + * used to decode each item in the array + * itemSize: + * is the minimum size of each decoded item + * hasPointer: + * indicates whether each item has a dynamic pointer + * pointerOffset: + * indicates the offset within itemSize at which the pointer exists + */ +struct AsnArrayDescriptor +{ + BYTE tag; + CryptDecodeObjectExFunc decodeFunc; + DWORD itemSize; + BOOL hasPointer; + DWORD pointerOffset; +}; + +struct AsnArrayItemSize +{ + DWORD encodedLen; + DWORD size; +}; + +struct GenericArray +{ + DWORD cItems; + BYTE *rgItems; +}; + +/* Decodes an array of like types into a struct GenericArray. + * The layout and decoding of the array are described by a struct + * AsnArrayDescriptor. + */ +static BOOL CRYPT_AsnDecodeArray(const struct AsnArrayDescriptor *arrayDesc, + const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, + PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo, + void *startingPointer) +{ + BOOL ret = TRUE; + + TRACE("%p, %p, %ld, %08lx, %p, %p, %ld, %p\n", arrayDesc, pbEncoded, + cbEncoded, dwFlags, pDecodePara, pvStructInfo, *pcbStructInfo, + startingPointer); + + if (pbEncoded[0] == arrayDesc->tag) + { + DWORD dataLen; + + if ((ret = CRYPT_GetLen(pbEncoded, cbEncoded, &dataLen))) + { + DWORD bytesNeeded, cItems = 0; BYTE lenBytes = GET_LEN_BYTES(pbEncoded[1]); - DWORD i, bytesNeeded = 0, minSize = 0; - const BYTE *ptr; + /* There can be arbitrarily many items, but there is often only one. + */ + struct AsnArrayItemSize itemSize = { 0 }, *itemSizes = &itemSize; - ptr = pbEncoded + 1 + lenBytes; - for (i = 0; ret && i < cItem; i++) + bytesNeeded = sizeof(struct GenericArray); + if (dataLen) { - DWORD nextItemLen; + const BYTE *ptr; - minSize += items[i].minSize; - if (cbEncoded - (ptr - pbEncoded) != 0) + for (ptr = pbEncoded + 1 + lenBytes; ret && + ptr - pbEncoded - 1 - lenBytes < dataLen; ) { - if ((ret = CRYPT_GetLen(ptr, cbEncoded - (ptr - pbEncoded), - &nextItemLen))) + DWORD itemLenBytes, itemDataLen, size; + + itemLenBytes = GET_LEN_BYTES(ptr[1]); + /* Each item decoded may not tolerate extraneous bytes, so + * get the length of the next element and pass it directly. + */ + ret = CRYPT_GetLen(ptr, cbEncoded - (ptr - pbEncoded), + &itemDataLen); + if (ret) + ret = arrayDesc->decodeFunc(X509_ASN_ENCODING, 0, ptr, + 1 + itemLenBytes + itemDataLen, + dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, NULL, NULL, + &size); + if (ret) { - BYTE nextItemLenBytes = GET_LEN_BYTES(ptr[1]); + DWORD nextLen; - if (items[i].decodeFunc) + cItems++; + if (itemSizes != &itemSize) + itemSizes = CryptMemRealloc(itemSizes, + cItems * sizeof(struct AsnArrayItemSize)); + else { - TRACE("sizing item %ld\n", i); - ret = items[i].decodeFunc(dwCertEncodingType, NULL, - ptr, 1 + nextItemLenBytes + nextItemLen, - dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, NULL, NULL, - &items[i].size); + itemSizes = + CryptMemAlloc( + cItems * sizeof(struct AsnArrayItemSize)); + memcpy(itemSizes, &itemSize, sizeof(itemSize)); + } + if (itemSizes) + { + itemSizes[cItems - 1].encodedLen = 1 + itemLenBytes + + itemDataLen; + itemSizes[cItems - 1].size = size; + bytesNeeded += size; + ret = CRYPT_GetLen(ptr, + cbEncoded - (ptr - pbEncoded), &nextLen); if (ret) - { - /* Account for alignment padding */ - bytesNeeded += items[i].size; - if (items[i].size % sizeof(DWORD)) - bytesNeeded += sizeof(DWORD) - - items[i].size % sizeof(DWORD); - ptr += 1 + nextItemLenBytes + nextItemLen; - } - else if (items[i].optional && - GetLastError() == CRYPT_E_ASN1_BADTAG) - { - TRACE("skipping optional item %ld\n", i); - bytesNeeded += items[i].minSize; - SetLastError(NOERROR); - ret = TRUE; - } - else - TRACE("item %ld failed: %08lx\n", i, - GetLastError()); + ptr += nextLen + 1 + GET_LEN_BYTES(ptr[1]); } else - bytesNeeded += items[i].minSize; + ret = FALSE; } } - else if (items[i].optional) - bytesNeeded += items[i].minSize; - else - { - SetLastError(CRYPT_E_ASN1_CORRUPT); - ret = FALSE; - } } - if (cbEncoded - (ptr - pbEncoded) != 0) - { - TRACE("%ld remaining bytes, failing\n", cbEncoded - - (ptr - pbEncoded)); - SetLastError(CRYPT_E_ASN1_CORRUPT); - ret = FALSE; - } if (ret) { if (!pvStructInfo) @@ -2419,75 +2796,49 @@ else if ((ret = CRYPT_DecodeEnsureSpace(dwFlags, pDecodePara, pvStructInfo, pcbStructInfo, bytesNeeded))) { + DWORD i; BYTE *nextData; + const BYTE *ptr; + struct GenericArray *array; if (dwFlags & CRYPT_DECODE_ALLOC_FLAG) pvStructInfo = *(BYTE **)pvStructInfo; + array = (struct GenericArray *)pvStructInfo; + array->cItems = cItems; if (startingPointer) - nextData = (BYTE *)startingPointer; + array->rgItems = startingPointer; else - nextData = (BYTE *)pvStructInfo + minSize; - memset(pvStructInfo, 0, minSize); - ptr = pbEncoded + 1 + lenBytes; - for (i = 0; ret && i < cItem; i++) + array->rgItems = (BYTE *)array + + sizeof(struct GenericArray); + nextData = (BYTE *)array->rgItems + + array->cItems * arrayDesc->itemSize; + for (i = 0, ptr = pbEncoded + 1 + lenBytes; ret && + i < cItems && ptr - pbEncoded - 1 - lenBytes < + dataLen; i++) { - if (cbEncoded - (ptr - pbEncoded) != 0) + if (arrayDesc->hasPointer) + *(BYTE **)(array->rgItems + i * arrayDesc->itemSize + + arrayDesc->pointerOffset) = nextData; + ret = arrayDesc->decodeFunc(X509_ASN_ENCODING, 0, ptr, + itemSizes[i].encodedLen, + dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, NULL, + array->rgItems + i * arrayDesc->itemSize, + &itemSizes[i].size); + if (ret) { - DWORD nextItemLen; - BYTE nextItemLenBytes = GET_LEN_BYTES(ptr[1]); + DWORD nextLen; - CRYPT_GetLen(ptr, cbEncoded - (ptr - pbEncoded), - &nextItemLen); - if (items[i].hasPointer) - { - *(BYTE **)((BYTE *)pvStructInfo + - items[i].pointerOffset) = nextData; - } - if (items[i].decodeFunc) - { - TRACE("decoding item %ld\n", i); - ret = items[i].decodeFunc(dwCertEncodingType, - NULL, ptr, 1 + nextItemLenBytes + nextItemLen, - dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, NULL, - (BYTE *)pvStructInfo + items[i].offset, - &items[i].size); - if (!ret) - TRACE("item %ld failed: %08lx\n", i, - GetLastError()); - } - else - items[i].size = items[i].minSize; + nextData += itemSizes[i].size - arrayDesc->itemSize; + ret = CRYPT_GetLen(ptr, + cbEncoded - (ptr - pbEncoded), &nextLen); if (ret) - { - if (items[i].hasPointer && - items[i].size > items[i].minSize) - { - nextData += items[i].size - - items[i].minSize; - /* align nextData to DWORD boundaries */ - if (items[i].size % sizeof(DWORD)) - { - nextData += sizeof(DWORD) - - items[i].size % sizeof(DWORD); - } [truncated at 1000 lines; 1655 more skipped]
18 years, 12 months
1
0
0
0
[gvg] 20346: Sync to Wine-0_9_4:
by gvg@svn.reactos.com
Sync to Wine-0_9_4: Eric Pouech <eric.pouech(a)wanadoo.fr> - Const correctness fixes. - Removed some dead-code. Modified: trunk/reactos/lib/comdlg32/finddlg32.c Modified: trunk/reactos/lib/comdlg32/fontdlg.c _____ Modified: trunk/reactos/lib/comdlg32/finddlg32.c --- trunk/reactos/lib/comdlg32/finddlg32.c 2005-12-26 22:56:31 UTC (rev 20345) +++ trunk/reactos/lib/comdlg32/finddlg32.c 2005-12-26 22:57:56 UTC (rev 20346) @@ -385,7 +385,7 @@ hmod = (HMODULE)pdata->fr.hInstance; if(pdata->fr.Flags & FR_WINE_UNICODE) { - htemplate = FindResourceW(hmod, (LPWSTR)pdata->fr.lpTemplateName, (LPWSTR)RT_DIALOG); + htemplate = FindResourceW(hmod, (LPCWSTR)pdata->fr.lpTemplateName, (LPWSTR)RT_DIALOG); } else { _____ Modified: trunk/reactos/lib/comdlg32/fontdlg.c --- trunk/reactos/lib/comdlg32/fontdlg.c 2005-12-26 22:56:31 UTC (rev 20345) +++ trunk/reactos/lib/comdlg32/fontdlg.c 2005-12-26 22:57:56 UTC (rev 20346) @@ -1076,7 +1076,6 @@ HDC hdc; HPEN hOrigPen; HFONT hOrigFont; - COLORREF rgbPrev; LOGFONTW lf = *(lpcf->lpLogFont); MapWindowPoints( 0, hDlg, (LPPOINT) &info.rcWindow, 2); @@ -1104,7 +1103,7 @@ info.rcWindow.top++; info.rcWindow.left++; hOrigFont = SelectObject( hdc, CreateFontIndirectW( &lf ) ); - rgbPrev=SetTextColor( hdc, lpcf->rgbColors ); + SetTextColor( hdc, lpcf->rgbColors ); DrawTextW( hdc, sample_lang_text[CHARSET_ORDER[lpcf->lpLogFont->lfCharSet]],
18 years, 12 months
1
0
0
0
[gvg] 20345: Sync to Wine-0_9_4:
by gvg@svn.reactos.com
Sync to Wine-0_9_4: Dmitry Timoshkov <dmitry(a)codeweavers.com> - comctl32: Add a test for the initial tooltip window style settings, make it pass under Wine. Eric Pouech <eric.pouech(a)wanadoo.fr> - comctl32: Fixed (harmless) typo. Modified: trunk/reactos/lib/comctl32/tooltips.c Modified: trunk/reactos/lib/comctl32/treeview.c _____ Modified: trunk/reactos/lib/comctl32/tooltips.c --- trunk/reactos/lib/comctl32/tooltips.c 2005-12-26 22:51:29 UTC (rev 20344) +++ trunk/reactos/lib/comctl32/tooltips.c 2005-12-26 22:56:31 UTC (rev 20345) @@ -2400,7 +2400,7 @@ DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE); DWORD dwExStyle = GetWindowLongW (hwnd, GWL_EXSTYLE); - dwStyle &= 0x0000FFFF; + dwStyle &= ~(WS_CHILD | /*WS_MAXIMIZE |*/ WS_BORDER | WS_DLGFRAME); dwStyle |= (WS_POPUP | WS_BORDER | WS_CLIPSIBLINGS); /* WS_BORDER only draws a border round the window rect, not the _____ Modified: trunk/reactos/lib/comctl32/treeview.c --- trunk/reactos/lib/comctl32/treeview.c 2005-12-26 22:51:29 UTC (rev 20344) +++ trunk/reactos/lib/comctl32/treeview.c 2005-12-26 22:56:31 UTC (rev 20345) @@ -565,7 +565,7 @@ TRACE("code:%d action:%x olditem:%p newitem:%p\n", code, action, oldItem, newItem); - ZeroMemory(&nmhdr, sizeof(NMTREEVIEWA)); + ZeroMemory(&nmhdr, sizeof(NMTREEVIEWW)); nmhdr.hdr.hwndFrom = hwnd; nmhdr.hdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID);
18 years, 12 months
1
0
0
0
[gvg] 20344: Sync to Wine-0_9_4:
by gvg@svn.reactos.com
Sync to Wine-0_9_4: Alexandre Julliard <julliard(a)winehq.org> - winebuild: Allow -register flag for Win32 too. This way it can be used as hint for the relay code. - ntdll: Make __wine_call_from_32_restore_regs take a context pointer. Changed exception raise functions to call it explicitly. - ntdll: New implementation of relay thunks. New implementation of relay thunks that doesn't require modifying code on the fly, so that the thunks can be put in the text section. Some performance improvements. Modified: trunk/reactos/tools/winebuild/build.h Modified: trunk/reactos/tools/winebuild/import.c Modified: trunk/reactos/tools/winebuild/parser.c Modified: trunk/reactos/tools/winebuild/relay.c Modified: trunk/reactos/tools/winebuild/spec32.c Modified: trunk/reactos/tools/winebuild/utils.c Modified: trunk/reactos/tools/winebuild/winebuild.man.in _____ Modified: trunk/reactos/tools/winebuild/build.h --- trunk/reactos/tools/winebuild/build.h 2005-12-26 21:47:28 UTC (rev 20343) +++ trunk/reactos/tools/winebuild/build.h 2005-12-26 22:51:29 UTC (rev 20344) @@ -189,6 +189,7 @@ extern const char *get_asm_ptr_keyword(void); extern const char *get_asm_string_keyword(void); extern const char *get_asm_short_keyword(void); +extern const char *get_asm_rodata_section(void); extern const char *get_asm_string_section(void); extern void output_function_size( FILE *outfile, const char *name ); @@ -199,6 +200,7 @@ extern void read_undef_symbols( DLLSPEC *spec, char **argv ); extern int resolve_imports( DLLSPEC *spec ); extern int has_imports(void); +extern int has_relays( DLLSPEC *spec ); extern void output_get_pc_thunk( FILE *outfile ); extern void output_stubs( FILE *outfile, DLLSPEC *spec ); extern void output_imports( FILE *outfile, DLLSPEC *spec ); _____ Modified: trunk/reactos/tools/winebuild/import.c --- trunk/reactos/tools/winebuild/import.c 2005-12-26 21:47:28 UTC (rev 20343) +++ trunk/reactos/tools/winebuild/import.c 2005-12-26 22:51:29 UTC (rev 20344) @@ -1245,5 +1245,6 @@ output_immediate_import_thunks( outfile ); output_delayed_import_thunks( outfile, spec ); output_external_link_imports( outfile, spec ); - if (nb_imports || ext_link_imports.count || has_stubs(spec)) output_get_pc_thunk( outfile ); + if (nb_imports || ext_link_imports.count || has_stubs(spec) || has_relays(spec)) + output_get_pc_thunk( outfile ); } _____ Modified: trunk/reactos/tools/winebuild/parser.c --- trunk/reactos/tools/winebuild/parser.c 2005-12-26 21:47:28 UTC (rev 20343) +++ trunk/reactos/tools/winebuild/parser.c 2005-12-26 22:51:29 UTC (rev 20344) @@ -516,12 +516,6 @@ odp->ordinal = ordinal; } - if (spec->type == SPEC_WIN32 && odp->flags & FLAG_REGISTER) - { - error( "-register flag not supported for Win32 entry points\n" ); - goto error; - } - if (odp->type == TYPE_STDCALL && !(odp->flags & FLAG_PRIVATE)) { if (!strcmp( odp->name, "DllRegisterServer" ) || _____ Modified: trunk/reactos/tools/winebuild/relay.c --- trunk/reactos/tools/winebuild/relay.c 2005-12-26 21:47:28 UTC (rev 20343) +++ trunk/reactos/tools/winebuild/relay.c 2005-12-26 22:51:29 UTC (rev 20344) @@ -849,7 +849,7 @@ output_function_size( outfile, "__wine_call_from_32_regs" ); function_header( outfile, "__wine_call_from_32_restore_regs" ); - fprintf( outfile, "\tleal 4(%%esp),%%ecx\n" ); + fprintf( outfile, "\tmovl 4(%%esp),%%ecx\n" ); fprintf( outfile, "\tjmp 2b\n" ); output_function_size( outfile, "__wine_call_from_32_restore_regs" ); } _____ Modified: trunk/reactos/tools/winebuild/spec32.c --- trunk/reactos/tools/winebuild/spec32.c 2005-12-26 21:47:28 UTC (rev 20343) +++ trunk/reactos/tools/winebuild/spec32.c 2005-12-26 22:51:29 UTC (rev 20344) @@ -37,8 +37,33 @@ #include "build.h" +/* check if entry point needs a relay thunk */ +static inline int needs_relay( const ORDDEF *odp ) +{ + /* skip nonexistent entry points */ + if (!odp) return 0; + /* skip non-functions */ + if ((odp->type != TYPE_STDCALL) && (odp->type != TYPE_CDECL)) return 0; + /* skip norelay and forward entry points */ + if (odp->flags & (FLAG_NORELAY|FLAG_FORWARD)) return 0; + return 1; +} +/* check if dll will output relay thunks */ +int has_relays( DLLSPEC *spec ) +{ + unsigned int i; + if (target_cpu != CPU_x86) return 0; + + for (i = spec->base; i <= spec->limit; i++) + { + ORDDEF *odp = spec->ordinals[i]; + if (needs_relay( odp )) return 1; + } + return 0; +} + /******************************************************************* * make_internal_name * @@ -62,6 +87,101 @@ /******************************************************************* + * output_relay_debug + * + * Output entry points for relay debugging + */ +static void output_relay_debug( FILE *outfile, DLLSPEC *spec ) +{ + unsigned int i, j, args, flags; + + /* first the table of entry point offsets */ + + fprintf( outfile, "\t%s\n", get_asm_rodata_section() ); + fprintf( outfile, "\t.align %d\n", get_alignment(4) ); + fprintf( outfile, ".L__wine_spec_relay_entry_point_offsets:\n" ); + + for (i = spec->base; i <= spec->limit; i++) + { + ORDDEF *odp = spec->ordinals[i]; + + if (needs_relay( odp )) + fprintf( outfile, "\t.long .L__wine_spec_relay_entry_point_%d-__wine_spec_relay_entry_points\n", i ); + else + fprintf( outfile, "\t.long 0\n" ); + } + + /* then the table of argument types */ + + fprintf( outfile, "\t.align %d\n", get_alignment(4) ); + fprintf( outfile, ".L__wine_spec_relay_arg_types:\n" ); + + for (i = spec->base; i <= spec->limit; i++) + { + ORDDEF *odp = spec->ordinals[i]; + unsigned int mask = 0; + + if (needs_relay( odp )) + { + for (j = 0; j < 16 && odp->u.func.arg_types[j]; j++) + { + if (odp->u.func.arg_types[j] == 't') mask |= 1<< (j*2); + if (odp->u.func.arg_types[j] == 'W') mask |= 2<< (j*2); + } + } + fprintf( outfile, "\t.long 0x%08x\n", mask ); + } + + /* then the relay thunks */ + + fprintf( outfile, "\t.text\n" ); + fprintf( outfile, "__wine_spec_relay_entry_points:\n" ); + fprintf( outfile, "\tnop\n" ); /* to avoid 0 offset */ + + for (i = spec->base; i <= spec->limit; i++) + { + ORDDEF *odp = spec->ordinals[i]; + + if (!needs_relay( odp )) continue; + + fprintf( outfile, "\t.align %d\n", get_alignment(4) ); + fprintf( outfile, ".L__wine_spec_relay_entry_point_%d:\n", i ); + + if (odp->flags & FLAG_REGISTER) + fprintf( outfile, "\tpushl %%eax\n" ); + else + fprintf( outfile, "\tpushl %%esp\n" ); + + args = strlen(odp->u.func.arg_types); + flags = 0; + if (odp->flags & FLAG_RET64) flags |= 1; + if (odp->type == TYPE_STDCALL) flags |= 2; + fprintf( outfile, "\tpushl $%u\n", (flags << 24) | (args << 16) | (i - spec->base) ); + + if (UsePIC) + { + fprintf( outfile, "\tcall %s\n", asm_name("__wine_spec_get_pc_thunk_eax") ); + fprintf( outfile, "1:\tleal .L__wine_spec_relay_descr-1b(%%eax),%%eax\n" ); + } + else fprintf( outfile, "\tmovl $.L__wine_spec_relay_descr,%%eax\n" ); + fprintf( outfile, "\tpushl %%eax\n" ); + + if (odp->flags & FLAG_REGISTER) + { + fprintf( outfile, "\tcall *8(%%eax)\n" ); + } + else + { + fprintf( outfile, "\tcall *4(%%eax)\n" ); + if (odp->type == TYPE_STDCALL) + fprintf( outfile, "\tret $%u\n", args * get_ptr_size() ); + else + fprintf( outfile, "\tret\n" ); + } + } +} + +/******************************************************************* * output_exports * * Output the export table for a Win32 module. @@ -183,58 +303,27 @@ fprintf( outfile, "\t%s \"%s\"\n", get_asm_string_keyword(), odp->link_name ); } } - fprintf( outfile, "\t.align %d\n", get_alignment(4) ); + fprintf( outfile, "\t.align %d\n", get_alignment(get_ptr_size()) ); fprintf( outfile, ".L__wine_spec_exports_end:\n" ); /* output relays */ /* we only support relay debugging on i386 */ - if (target_cpu == CPU_x86) + if (target_cpu != CPU_x86) { - for (i = spec->base; i <= spec->limit; i++) - { - ORDDEF *odp = spec->ordinals[i]; - unsigned int j, args, mask = 0; + fprintf( outfile, "\t%s 0\n", get_asm_ptr_keyword() ); + return; + } - /* skip nonexistent entry points */ - if (!odp) goto ignore; - /* skip non-functions */ - if ((odp->type != TYPE_STDCALL) && (odp->type != TYPE_CDECL)) goto ignore; - /* skip norelay and forward entry points */ - if (odp->flags & (FLAG_NORELAY|FLAG_FORWARD)) goto ignore; + fprintf( outfile, ".L__wine_spec_relay_descr:\n" ); + fprintf( outfile, "\t%s 0xdeb90001\n", get_asm_ptr_keyword() ); /* magic */ + fprintf( outfile, "\t%s 0,0\n", get_asm_ptr_keyword() ); /* relay funcs */ + fprintf( outfile, "\t%s 0\n", get_asm_ptr_keyword() ); /* private data */ + fprintf( outfile, "\t%s __wine_spec_relay_entry_points\n", get_asm_ptr_keyword() ); + fprintf( outfile, "\t%s .L__wine_spec_relay_entry_point_offsets\n", get_asm_ptr_keyword() ); + fprintf( outfile, "\t%s .L__wine_spec_relay_arg_types\n", get_asm_ptr_keyword() ); - for (j = 0; odp->u.func.arg_types[j]; j++) - { - if (odp->u.func.arg_types[j] == 't') mask |= 1<< (j*2); - if (odp->u.func.arg_types[j] == 'W') mask |= 2<< (j*2); - } - if ((odp->flags & FLAG_RET64) && (j < 16)) mask |= 0x80000000; - - args = strlen(odp->u.func.arg_types) * get_ptr_size(); - - switch(odp->type) - { - case TYPE_STDCALL: - fprintf( outfile, "\tjmp %s\n", asm_name(odp->link_name) ); - fprintf( outfile, "\tret $%d\n", args ); - fprintf( outfile, "\t.long %s,0x%08x\n", asm_name(odp->link_name), mask ); - break; - case TYPE_CDECL: - fprintf( outfile, "\tjmp %s\n", asm_name(odp->link_name) ); - fprintf( outfile, "\tret\n" ); - fprintf( outfile, "\t%s %d\n", get_asm_short_keyword(), args ); - fprintf( outfile, "\t.long %s,0x%08x\n", asm_name(odp->link_name), mask ); - break; - default: - assert(0); - } - continue; - - ignore: - fprintf( outfile, "\t.long 0,0,0,0\n" ); - } - } - else fprintf( outfile, "\t.long 0\n" ); + output_relay_debug( outfile, spec ); } _____ Modified: trunk/reactos/tools/winebuild/utils.c --- trunk/reactos/tools/winebuild/utils.c 2005-12-26 21:47:28 UTC (rev 20343) +++ trunk/reactos/tools/winebuild/utils.c 2005-12-26 22:51:29 UTC (rev 20344) @@ -585,6 +585,15 @@ } } +const char *get_asm_rodata_section(void) +{ + switch (target_platform) + { + case PLATFORM_APPLE: return ".const"; + default: return ".section .rodata"; + } +} + const char *get_asm_string_section(void) { switch (target_platform) _____ Modified: trunk/reactos/tools/winebuild/winebuild.man.in --- trunk/reactos/tools/winebuild/winebuild.man.in 2005-12-26 21:47:28 UTC (rev 20343) +++ trunk/reactos/tools/winebuild/winebuild.man.in 2005-12-26 22:51:29 UTC (rev 20344) @@ -260,7 +260,7 @@ The entry point is only available on i386 platforms. .TP .B -register -The function uses CPU register to pass arguments (Win16 only). +The function uses CPU register to pass arguments. .TP .B -private The function cannot be imported from other dlls, it can only be
18 years, 12 months
1
0
0
0
[hpoussin] 20343: Replace implementation of QueryServiceConfigW by a stub (like in pre-20255), as rpcrt4 throws sometimes an exception and breaks PnP manager
by hpoussin@svn.reactos.com
Replace implementation of QueryServiceConfigW by a stub (like in pre-20255), as rpcrt4 throws sometimes an exception and breaks PnP manager Modified: trunk/reactos/lib/advapi32/service/scm.c _____ Modified: trunk/reactos/lib/advapi32/service/scm.c --- trunk/reactos/lib/advapi32/service/scm.c 2005-12-26 21:41:02 UTC (rev 20342) +++ trunk/reactos/lib/advapi32/service/scm.c 2005-12-26 21:47:28 UTC (rev 20343) @@ -457,7 +457,7 @@ DWORD dwLength; LPWSTR lpStr; - DPRINT1("CreateServiceW() called\n"); + DPRINT("CreateServiceW() called\n"); /* Calculate the Dependencies length*/ if (lpDependencies != NULL) @@ -496,7 +496,7 @@ (unsigned int *)&hService); if (dwError != ERROR_SUCCESS) { - DPRINT1("ScmrCreateServiceW() failed (Error %lu)\n", dwError); + DPRINT1("ScmrCreateServiceW(%S) failed (Error %lu)\n", lpServiceName, dwError); SetLastError(dwError); return NULL; } @@ -1085,7 +1085,7 @@ (unsigned int*)&hService); if (dwError != ERROR_SUCCESS) { - DPRINT1("ScmrOpenServiceA() failed (Error %lu)\n", dwError); + DPRINT("ScmrOpenServiceA(%s) failed (Error %lu)\n", lpServiceName, dwError); SetLastError(dwError); return NULL; } @@ -1122,7 +1122,7 @@ (unsigned int*)&hService); if (dwError != ERROR_SUCCESS) { - DPRINT1("ScmrOpenServiceW() failed (Error %lu)\n", dwError); + DPRINT("ScmrOpenServiceW(%S) failed (Error %lu)\n", lpServiceName, dwError); SetLastError(dwError); return NULL; } @@ -1207,6 +1207,7 @@ DWORD cbBufSize, LPDWORD pcbBytesNeeded) { +#if 0 DWORD dwError; DPRINT("QueryServiceConfigW(%p, %p, %lu, %p)\n", @@ -1215,11 +1216,13 @@ HandleBind(); /* Call to services.exe using RPC */ + CHECKPOINT1; dwError = ScmrQueryServiceConfigW(BindingHandle, (unsigned int)hService, (unsigned char *)lpServiceConfig, cbBufSize, pcbBytesNeeded); + CHECKPOINT1; if (dwError != ERROR_SUCCESS) { DPRINT("ScmrQueryServiceConfigW() failed (Error %lu)\n", dwError); @@ -1256,6 +1259,20 @@ DPRINT("QueryServiceConfigW() done\n"); return TRUE; +#else + DPRINT1("QueryServiceConfigW is unimplemented\n"); + if (lpServiceConfig && cbBufSize >= sizeof(QUERY_SERVICE_CONFIGW)) + { + memset(lpServiceConfig, 0, *pcbBytesNeeded); + return TRUE; + } + else + { + *pcbBytesNeeded = sizeof(QUERY_SERVICE_CONFIGW); + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return FALSE; + } +#endif }
18 years, 12 months
1
0
0
0
[hpoussin] 20342: - Set SPINT_DEFAULT, SPINT_REMOVED and SPINT_ACTIVE in interface flags when needed
by hpoussin@svn.reactos.com
- Set SPINT_DEFAULT, SPINT_REMOVED and SPINT_ACTIVE in interface flags when needed - Precise some SP_DEVINSTALL_PARAMS, by replacing them by SP_DEVINSTALL_PARAMS_W - Don't hardcode some constants Modified: trunk/reactos/lib/setupapi/devinst.c _____ Modified: trunk/reactos/lib/setupapi/devinst.c --- trunk/reactos/lib/setupapi/devinst.c 2005-12-26 20:48:46 UTC (rev 20341) +++ trunk/reactos/lib/setupapi/devinst.c 2005-12-26 21:41:02 UTC (rev 20342) @@ -28,10 +28,12 @@ static const WCHAR ClassGUID[] = {'C','l','a','s','s','G','U','I','D',0}; static const WCHAR Class[] = {'C','l','a','s','s',0}; static const WCHAR ClassInstall32[] = {'C','l','a','s','s','I','n','s','t','a','l','l','3','2',0}; +static const WCHAR Control[] = {'C','o','n','t','r','o','l',0}; static const WCHAR DeviceInstance[] = {'D','e','v','i','c','e','I','n','s','t','a','n','c','e',0}; static const WCHAR DotCoInstallers[] = {'.','C','o','I','n','s','t','a','l','l','e','r','s',0}; static const WCHAR DotServices[] = {'.','S','e','r','v','i','c','e','s',0}; static const WCHAR InterfaceInstall32[] = {'I','n','t','e','r','f','a','c','e','I','n','s','t','a','l','l','3','2' ,0}; +static const WCHAR Linked[] = {'L','i','n','k','e','d',0}; static const WCHAR SymbolicLink[] = {'S','y','m','b','o','l','i','c','L','i','n','k',0}; static const WCHAR Version[] = {'V','e','r','s','i','o','n',0}; @@ -1652,6 +1654,7 @@ HeapFree(GetProcessHeap(), 0, devices); return GetLastError(); } + interfaceInfo->Flags |= SPINT_ACTIVE | SPINT_DEFAULT; InsertTailList(&deviceInfo->InterfaceListHead, &interfaceInfo->ListEntry); } } @@ -1671,6 +1674,7 @@ HKEY hInterfaceKey; /* HKLM\SYSTEM\CurrentControlSet\Control\DeviceClasses\{GUID} */ HKEY hDeviceInstanceKey; /* HKLM\SYSTEM\CurrentControlSet\Control\DeviceClasses\{GUID}\##?#{Instance Path} */ HKEY hReferenceKey; /* HKLM\SYSTEM\CurrentControlSet\Control\DeviceClasses\{GUID}\##?#{Instance Path}\#{ReferenceString} */ + HKEY hControlKey; /* HKLM\SYSTEM\CurrentControlSet\Control\DeviceClasses\{GUID}\##?#{Instance Path}\#{ReferenceString}\Control */ HKEY hEnumKey; /* HKLM\SYSTEM\CurrentControlSet\Enum */ HKEY hKey; /* HKLM\SYSTEM\CurrentControlSet\Enum\{Instance\Path} */ LONG rc; @@ -1679,6 +1683,7 @@ DWORD i, j; DWORD dwLength, dwInstancePathLength; DWORD dwRegType; + DWORD LinkedValue; GUID ClassGuid; struct DeviceInfoElement *deviceInfo; @@ -1897,6 +1902,22 @@ RegCloseKey(hInterfaceKey); return GetLastError(); } + + /* Step 3. Update flags */ + if (KeyBuffer[1] == '\0') + interfaceInfo->Flags |= SPINT_DEFAULT; + rc = RegOpenKeyExW(hReferenceKey, Control, 0, KEY_QUERY_VALUE, &hControlKey); + if (!rc) + interfaceInfo->Flags |= SPINT_REMOVED; + else + { + dwLength = sizeof(DWORD); + if (RegQueryValueExW(hControlKey, Linked, NULL, &dwRegType, (LPBYTE)&LinkedValue, &dwLength) + && dwRegType == REG_DWORD && LinkedValue) + interfaceInfo->Flags |= SPINT_ACTIVE; + RegCloseKey(hControlKey); + } + TRACE("Adding interface %s to list\n", debugstr_w(pSymbolicLink)); HeapFree(GetProcessHeap(), 0, pSymbolicLink); InsertTailList(&deviceInfo->InterfaceListHead, &interfaceInfo->ListEntry); @@ -2373,7 +2394,7 @@ memcpy(&DeviceInterfaceData->InterfaceClassGuid, &DevItf->InterfaceClassGuid, sizeof(GUID)); - DeviceInterfaceData->Flags = 0; /* FIXME */ + DeviceInterfaceData->Flags = DevItf->Flags; DeviceInterfaceData->Reserved = (ULONG_PTR)DevItf; Found = TRUE; } @@ -3532,7 +3553,7 @@ SP_DEVINSTALL_PARAMS_W InstallParams; BOOL Result; - InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS); + InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W); Result = SetupDiGetDeviceInstallParamsW(DeviceInfoSet, DeviceInfoData, &InstallParams); if (!Result) goto done; @@ -5418,7 +5439,7 @@ { BOOL Result; - InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS); + InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W); Result = SetupDiGetDeviceInstallParamsW(DeviceInfoSet, DeviceInfoData, &InstallParams); if (!Result) goto done; @@ -6302,7 +6323,7 @@ { SP_DEVINSTALL_PARAMS InstallParams; - InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS); + InstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W); if (SetupDiGetDeviceInstallParamsW(DeviceInfoSet, DeviceInfoData, &InstallParams)) { struct DriverInfoElement *driverInfo; @@ -6943,8 +6964,8 @@ } default: { - FIXME("Unknown StateChange 0x%lx\n", PropChange->StateChange); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + ERR("Unknown StateChange 0x%lx\n", PropChange->StateChange); + SetLastError(ERROR_NOT_SUPPORTED); } } @@ -7514,22 +7535,22 @@ if (rc == ERROR_SUCCESS) rc = RegSetValueEx(hKey, L"DriverDateData", 0, REG_BINARY, (const BYTE *)&SelectedDriver->Info.DriverDate, sizeof(FILETIME)); if (rc == ERROR_SUCCESS) - rc = RegSetValueEx(hKey, L"DriverDesc", 0, REG_SZ, (const BYTE *)SelectedDriver->Info.Description, (wcslen(SelectedDriver->Info.Description) + 1) * sizeof(WCHAR)); + rc = RegSetValueEx(hKey, REGSTR_VAL_DRVDESC, 0, REG_SZ, (const BYTE *)SelectedDriver->Info.Description, (wcslen(SelectedDriver->Info.Description) + 1) * sizeof(WCHAR)); if (rc == ERROR_SUCCESS) { swprintf(Buffer, L"%u.%u.%u.%u", fullVersion.HighPart >> 16, fullVersion.HighPart & 0xffff, fullVersion.LowPart >> 16, fullVersion.LowPart & 0xffff); rc = RegSetValueEx(hKey, L"DriverVersion", 0, REG_SZ, (const BYTE *)Buffer, (wcslen(Buffer) + 1) * sizeof(WCHAR)); } if (rc == ERROR_SUCCESS) - rc = RegSetValueEx(hKey, L"InfPath", 0, REG_SZ, (const BYTE *)SelectedDriver->Details.InfFileName, (wcslen(SelectedDriver->Details.InfFileName) + 1) * sizeof(WCHAR)); + rc = RegSetValueEx(hKey, REGSTR_VAL_INFPATH, 0, REG_SZ, (const BYTE *)SelectedDriver->Details.InfFileName, (wcslen(SelectedDriver->Details.InfFileName) + 1) * sizeof(WCHAR)); if (rc == ERROR_SUCCESS) - rc = RegSetValueEx(hKey, L"InfSection", 0, REG_SZ, (const BYTE *)SelectedDriver->Details.SectionName, (wcslen(SelectedDriver->Details.SectionName) + 1) * sizeof(WCHAR)); + rc = RegSetValueEx(hKey, REGSTR_VAL_INFSECTION, 0, REG_SZ, (const BYTE *)SelectedDriver->Details.SectionName, (wcslen(SelectedDriver->Details.SectionName) + 1) * sizeof(WCHAR)); if (rc == ERROR_SUCCESS) - rc = RegSetValueEx(hKey, L"InfSectionExt", 0, REG_SZ, (const BYTE *)&SectionName[wcslen(SelectedDriver->Details.SectionName)], (wcslen(SectionName) - wcslen(SelectedDriver->Details.SectionName) + 1) * sizeof(WCHAR)); + rc = RegSetValueEx(hKey, REGSTR_VAL_INFSECTIONEXT, 0, REG_SZ, (const BYTE *)&SectionName[wcslen(SelectedDriver->Details.SectionName)], (wcslen(SectionName) - wcslen(SelectedDriver->Details.SectionName) + 1) * sizeof(WCHAR)); if (rc == ERROR_SUCCESS) - rc = RegSetValueEx(hKey, L"MatchingDeviceId", 0, REG_SZ, (const BYTE *)SelectedDriver->MatchingId, (wcslen(SelectedDriver->MatchingId) + 1) * sizeof(WCHAR)); + rc = RegSetValueEx(hKey, REGSTR_VAL_MATCHINGDEVID, 0, REG_SZ, (const BYTE *)SelectedDriver->MatchingId, (wcslen(SelectedDriver->MatchingId) + 1) * sizeof(WCHAR)); if (rc == ERROR_SUCCESS) - rc = RegSetValueEx(hKey, L"ProviderName", 0, REG_SZ, (const BYTE *)SelectedDriver->Info.ProviderName, (wcslen(SelectedDriver->Info.ProviderName) + 1) * sizeof(WCHAR)); + rc = RegSetValueEx(hKey, REGSTR_VAL_PROVIDER_NAME, 0, REG_SZ, (const BYTE *)SelectedDriver->Info.ProviderName, (wcslen(SelectedDriver->Info.ProviderName) + 1) * sizeof(WCHAR)); if (rc != ERROR_SUCCESS) { SetLastError(rc);
18 years, 12 months
1
0
0
0
[gedmurphy] 20341: forgot to remove this
by gedmurphy@svn.reactos.com
forgot to remove this Modified: trunk/reactos/subsys/system/sc/query.c _____ Modified: trunk/reactos/subsys/system/sc/query.c --- trunk/reactos/subsys/system/sc/query.c 2005-12-26 20:46:36 UTC (rev 20340) +++ trunk/reactos/subsys/system/sc/query.c 2005-12-26 20:48:46 UTC (rev 20341) @@ -16,9 +16,6 @@ #include "sc.h" -#define DEBUG -#include <debug.h> - /* local function decs */ VOID PrintService(BOOL bExtended); BOOL EnumServices(DWORD ServiceType, DWORD ServiceState);
19 years
1
0
0
0
[gvg] 20340: Wine-0_9_4 vendor drop
by gvg@svn.reactos.com
Wine-0_9_4 vendor drop Modified: vendor/wine/dlls/comctl32/current/tooltips.c Modified: vendor/wine/dlls/comctl32/current/treeview.c Modified: vendor/wine/dlls/commdlg/current/finddlg32.c Modified: vendor/wine/dlls/commdlg/current/fontdlg.c Modified: vendor/wine/dlls/crypt32/current/cert.c Modified: vendor/wine/dlls/crypt32/current/encode.c Modified: vendor/wine/dlls/mpr/current/mpr_main.c Modified: vendor/wine/dlls/msi/current/dialog.c Modified: vendor/wine/dlls/msi/current/format.c Modified: vendor/wine/dlls/ole32/current/errorinfo.c Modified: vendor/wine/dlls/ole32/current/ole16.c Modified: vendor/wine/dlls/ole32/current/ole2.c Modified: vendor/wine/dlls/ole32/current/rpc.c Modified: vendor/wine/dlls/ole32/current/stg_stream.c Modified: vendor/wine/dlls/ole32/current/storage32.c Modified: vendor/wine/dlls/ole32/current/storage32.h Modified: vendor/wine/dlls/oleaut32/current/oleaut.c Modified: vendor/wine/dlls/oleaut32/current/safearray.c Modified: vendor/wine/dlls/oleaut32/current/typelib.c Modified: vendor/wine/dlls/riched20/current/editor.c Modified: vendor/wine/dlls/shell32/current/shellpath.c Modified: vendor/wine/dlls/shell32/current/shlview.c Modified: vendor/wine/dlls/shlwapi/current/regstream.c Modified: vendor/wine/dlls/urlmon/current/binding.c Modified: vendor/wine/dlls/urlmon/current/file.c Modified: vendor/wine/dlls/urlmon/current/umstream.c Modified: vendor/wine/tools/winebuild/current/build.h Modified: vendor/wine/tools/winebuild/current/import.c Modified: vendor/wine/tools/winebuild/current/parser.c Modified: vendor/wine/tools/winebuild/current/relay.c Modified: vendor/wine/tools/winebuild/current/spec32.c Modified: vendor/wine/tools/winebuild/current/utils.c Modified: vendor/wine/tools/winebuild/current/winebuild.man.in _____ Modified: vendor/wine/dlls/comctl32/current/tooltips.c --- vendor/wine/dlls/comctl32/current/tooltips.c 2005-12-26 20:40:45 UTC (rev 20339) +++ vendor/wine/dlls/comctl32/current/tooltips.c 2005-12-26 20:46:36 UTC (rev 20340) @@ -2400,7 +2400,7 @@ DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE); DWORD dwExStyle = GetWindowLongW (hwnd, GWL_EXSTYLE); - dwStyle &= 0x0000FFFF; + dwStyle &= ~(WS_CHILD | /*WS_MAXIMIZE |*/ WS_BORDER | WS_DLGFRAME); dwStyle |= (WS_POPUP | WS_BORDER | WS_CLIPSIBLINGS); /* WS_BORDER only draws a border round the window rect, not the _____ Modified: vendor/wine/dlls/comctl32/current/treeview.c --- vendor/wine/dlls/comctl32/current/treeview.c 2005-12-26 20:40:45 UTC (rev 20339) +++ vendor/wine/dlls/comctl32/current/treeview.c 2005-12-26 20:46:36 UTC (rev 20340) @@ -565,7 +565,7 @@ TRACE("code:%d action:%x olditem:%p newitem:%p\n", code, action, oldItem, newItem); - ZeroMemory(&nmhdr, sizeof(NMTREEVIEWA)); + ZeroMemory(&nmhdr, sizeof(NMTREEVIEWW)); nmhdr.hdr.hwndFrom = hwnd; nmhdr.hdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID); _____ Modified: vendor/wine/dlls/commdlg/current/finddlg32.c --- vendor/wine/dlls/commdlg/current/finddlg32.c 2005-12-26 20:40:45 UTC (rev 20339) +++ vendor/wine/dlls/commdlg/current/finddlg32.c 2005-12-26 20:46:36 UTC (rev 20340) @@ -385,7 +385,7 @@ hmod = (HMODULE)pdata->fr.hInstance; if(pdata->fr.Flags & FR_WINE_UNICODE) { - htemplate = FindResourceW(hmod, (LPWSTR)pdata->fr.lpTemplateName, (LPWSTR)RT_DIALOG); + htemplate = FindResourceW(hmod, (LPCWSTR)pdata->fr.lpTemplateName, (LPWSTR)RT_DIALOG); } else { _____ Modified: vendor/wine/dlls/commdlg/current/fontdlg.c --- vendor/wine/dlls/commdlg/current/fontdlg.c 2005-12-26 20:40:45 UTC (rev 20339) +++ vendor/wine/dlls/commdlg/current/fontdlg.c 2005-12-26 20:46:36 UTC (rev 20340) @@ -1076,7 +1076,6 @@ HDC hdc; HPEN hOrigPen; HFONT hOrigFont; - COLORREF rgbPrev; LOGFONTW lf = *(lpcf->lpLogFont); MapWindowPoints( 0, hDlg, (LPPOINT) &info.rcWindow, 2); @@ -1104,7 +1103,7 @@ info.rcWindow.top++; info.rcWindow.left++; hOrigFont = SelectObject( hdc, CreateFontIndirectW( &lf ) ); - rgbPrev=SetTextColor( hdc, lpcf->rgbColors ); + SetTextColor( hdc, lpcf->rgbColors ); DrawTextW( hdc, sample_lang_text[CHARSET_ORDER[lpcf->lpLogFont->lfCharSet]], _____ Modified: vendor/wine/dlls/crypt32/current/cert.c --- vendor/wine/dlls/crypt32/current/cert.c 2005-12-26 20:40:45 UTC (rev 20339) +++ vendor/wine/dlls/crypt32/current/cert.c 2005-12-26 20:46:36 UTC (rev 20340) @@ -313,14 +313,6 @@ static const void * WINAPI CRYPT_ReadSerializedElement(const BYTE *pbElement, DWORD cbElement, DWORD dwContextTypeFlags, DWORD *pdwContentType); -/* filter for page-fault exceptions */ -static WINE_EXCEPTION_FILTER(page_fault) -{ - if (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION) - return EXCEPTION_EXECUTE_HANDLER; - return EXCEPTION_CONTINUE_SEARCH; -} - static void CRYPT_InitStore(WINECRYPT_CERTSTORE *store, HCRYPTPROV hCryptProv, DWORD dwFlags, CertStoreType type) { @@ -1885,6 +1877,22 @@ return ret; } +static BOOL CRYPT_GetCertHashProp(PWINE_CERT_CONTEXT context, DWORD dwPropId, + ALG_ID algID, const BYTE *toHash, DWORD toHashLen, void *pvData, + DWORD *pcbData) +{ + BOOL ret = CryptHashCertificate(0, algID, 0, toHash, toHashLen, pvData, + pcbData); + if (ret) + { + CRYPT_DATA_BLOB blob = { *pcbData, pvData }; + + ret = CRYPT_SetCertificateContextProperty(context, dwPropId, + 0, &blob); + } + return ret; +} + static BOOL WINAPI CRYPT_GetCertificateContextProperty( PWINE_CERT_CONTEXT context, DWORD dwPropId, void *pvData, DWORD *pcbData) { @@ -1927,26 +1935,34 @@ switch (dwPropId) { case CERT_SHA1_HASH_PROP_ID: - ret = CryptHashCertificate(0, CALG_SHA1, 0, + ret = CRYPT_GetCertHashProp(context, dwPropId, CALG_SHA1, context->cert.pbCertEncoded, context->cert.cbCertEncoded, pvData, pcbData); - if (ret) - { - CRYPT_DATA_BLOB blob = { *pcbData, pvData }; - - ret = CRYPT_SetCertificateContextProperty(context, dwPropId, - 0, &blob); - } break; - case CERT_KEY_PROV_INFO_PROP_ID: case CERT_MD5_HASH_PROP_ID: + ret = CRYPT_GetCertHashProp(context, dwPropId, CALG_MD5, + context->cert.pbCertEncoded, context->cert.cbCertEncoded, pvData, + pcbData); + break; + case CERT_SUBJECT_NAME_MD5_HASH_PROP_ID: + ret = CRYPT_GetCertHashProp(context, dwPropId, CALG_MD5, + context->cert.pCertInfo->Subject.pbData, + context->cert.pCertInfo->Subject.cbData, + pvData, pcbData); + break; + case CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID: + ret = CRYPT_GetCertHashProp(context, dwPropId, CALG_MD5, + context->cert.pCertInfo->SubjectPublicKeyInfo.PublicKey.pbData, + context->cert.pCertInfo->SubjectPublicKeyInfo.PublicKey.cbData, + pvData, pcbData); + break; case CERT_SIGNATURE_HASH_PROP_ID: - case CERT_KEY_IDENTIFIER_PROP_ID: - case CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID: case CERT_ISSUER_SERIAL_NUMBER_MD5_HASH_PROP_ID: - case CERT_SUBJECT_NAME_MD5_HASH_PROP_ID: FIXME("implicit property %ld\n", dwPropId); + SetLastError(CRYPT_E_NOT_FOUND); break; + default: + SetLastError(CRYPT_E_NOT_FOUND); } } LeaveCriticalSection(&context->cs); @@ -2108,6 +2124,7 @@ case CERT_PVK_FILE_PROP_ID: case CERT_SIGNATURE_HASH_PROP_ID: case CERT_ISSUER_PUBLIC_KEY_MD5_HASH_PROP_ID: + case CERT_SUBJECT_NAME_MD5_HASH_PROP_ID: case CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID: case CERT_ENROLLMENT_PROP_ID: case CERT_CROSS_CERT_DIST_POINTS_PROP_ID: @@ -2787,7 +2804,7 @@ } } } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); context = NULL; _____ Modified: vendor/wine/dlls/crypt32/current/encode.c --- vendor/wine/dlls/crypt32/current/encode.c 2005-12-26 20:40:45 UTC (rev 20339) +++ vendor/wine/dlls/crypt32/current/encode.c 2005-12-26 20:46:36 UTC (rev 20340) @@ -61,8 +61,8 @@ #define ASN_UTCTIME (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x17) #define ASN_GENERALTIME (ASN_UNIVERSAL | ASN_PRIMITIVE | 0x18) -#define ASN_FLAGS_MASK 0xf0 -#define ASN_TYPE_MASK 0x0f +#define ASN_FLAGS_MASK 0xe0 +#define ASN_TYPE_MASK 0x1f WINE_DEFAULT_DEBUG_CHANNEL(crypt); @@ -134,10 +134,11 @@ PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo); static BOOL WINAPI CRYPT_AsnDecodeOid(const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, LPSTR pszObjId, DWORD *pcbObjId); -/* Assumes algo->Parameters.pbData is set ahead of time */ +/* Assumes algo->Parameters.pbData is set ahead of time. Internal func. */ static BOOL WINAPI CRYPT_AsnDecodeAlgorithmId(DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo); +/* Internal function */ static BOOL WINAPI CRYPT_AsnDecodeBool(DWORD dwCertEncodingType, LPCSTR lpszStructType, const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo); @@ -171,14 +172,6 @@ DWORD cbEncoded, DWORD dwFlags, PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo); -/* filter for page-fault exceptions */ -static WINE_EXCEPTION_FILTER(page_fault) -{ - if (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION) - return EXCEPTION_EXECUTE_HANDLER; - return EXCEPTION_CONTINUE_SEARCH; -} - BOOL WINAPI CryptEncodeObject(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, BYTE *pbEncoded, DWORD *pcbEncoded) { @@ -311,6 +304,9 @@ ret = items[i].encodeFunc(dwCertEncodingType, NULL, items[i].pvStructInfo, dwFlags & ~CRYPT_ENCODE_ALLOC_FLAG, NULL, NULL, &items[i].size); + /* Some functions propagate their errors through the size */ + if (!ret) + *pcbEncoded = items[i].size; dataLen += items[i].size; } if (ret) @@ -336,6 +332,9 @@ ret = items[i].encodeFunc(dwCertEncodingType, NULL, items[i].pvStructInfo, dwFlags & ~CRYPT_ENCODE_ALLOC_FLAG, NULL, pbEncoded, &items[i].size); + /* Some functions propagate their errors through the size */ + if (!ret) + *pcbEncoded = items[i].size; pbEncoded += items[i].size; } } @@ -381,11 +380,47 @@ ret = item->encodeFunc(dwCertEncodingType, lpszStructType, item->pvStructInfo, dwFlags & ~CRYPT_ENCODE_ALLOC_FLAG, NULL, pbEncoded, &len); + if (!ret) + { + /* Some functions propagate their errors through the size */ + *pcbEncoded = len; + } } } + else + { + /* Some functions propagate their errors through the size */ + *pcbEncoded = len; + } return ret; } +struct AsnEncodeTagSwappedItem +{ + BYTE tag; + const void *pvStructInfo; + CryptEncodeObjectExFunc encodeFunc; +}; + +/* Sort of a wacky hack, it encodes something using the struct + * AsnEncodeTagSwappedItem's encodeFunc, then replaces the tag byte with the tag + * given in the struct AsnEncodeTagSwappedItem. + */ +static BOOL WINAPI CRYPT_AsnEncodeSwapTag(DWORD dwCertEncodingType, + LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, + PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded) +{ + BOOL ret; + const struct AsnEncodeTagSwappedItem *item = + (const struct AsnEncodeTagSwappedItem *)pvStructInfo; + + ret = item->encodeFunc(dwCertEncodingType, lpszStructType, + item->pvStructInfo, dwFlags, pEncodePara, pbEncoded, pcbEncoded); + if (ret && pbEncoded) + *pbEncoded = item->tag; + return ret; +} + static BOOL WINAPI CRYPT_AsnEncodeCertVersion(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded) @@ -495,7 +530,7 @@ sizeof(items) / sizeof(items[0]), dwFlags, pEncodePara, pbEncoded, pcbEncoded); } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -526,7 +561,7 @@ sizeof(items) / sizeof(items[0]), dwFlags, pEncodePara, pbEncoded, pcbEncoded); } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -595,7 +630,7 @@ ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items, cItem, dwFlags, pEncodePara, pbEncoded, pcbEncoded); } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -739,7 +774,7 @@ ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items, cItem, dwFlags, pEncodePara, pbEncoded, pcbEncoded); } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -823,7 +858,7 @@ } } } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -1031,7 +1066,7 @@ } else { - *pbEncoded++ = ASN_CONSTRUCTOR | ASN_SEQUENCE; + *pbEncoded++ = ASN_SEQUENCE; CRYPT_EncodeLen(bytesNeeded - lenBytes - 1, pbEncoded, &lenBytes); pbEncoded += lenBytes; @@ -1140,7 +1175,7 @@ CryptMemFree(blobs[i].pbData); } } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -1202,7 +1237,7 @@ } } } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -1339,7 +1374,6 @@ { const CERT_ALT_NAME_INFO *info = (const CERT_ALT_NAME_INFO *)pvStructInfo; - DWORD bytesNeeded, dataLen, lenBytes, i; ret = TRUE; @@ -1399,7 +1433,7 @@ } } } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -1436,7 +1470,7 @@ ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items, cItem, dwFlags, pEncodePara, pbEncoded, pcbEncoded); } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -1477,7 +1511,7 @@ pcbEncoded); } } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -1522,7 +1556,7 @@ } } } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -1593,7 +1627,7 @@ } } } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -1632,7 +1666,7 @@ &newBlob, dwFlags, pEncodePara, pbEncoded, pcbEncoded); CryptMemFree(newBlob.pbData); } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -1731,7 +1765,7 @@ } } } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -1802,7 +1836,7 @@ } } } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -1881,7 +1915,7 @@ } } } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -1930,7 +1964,7 @@ } } } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -1960,7 +1994,7 @@ lpszStructType, pvStructInfo, dwFlags, pEncodePara, pbEncoded, pcbEncoded); } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -2009,7 +2043,7 @@ } } } - __EXCEPT(page_fault) + __EXCEPT_PAGE_FAULT { SetLastError(STATUS_ACCESS_VIOLATION); ret = FALSE; @@ -2018,6 +2052,145 @@ return ret; } +static BOOL CRYPT_AsnEncodeDistPoint(const CRL_DIST_POINT *distPoint, + BYTE *pbEncoded, DWORD *pcbEncoded) +{ + BOOL ret = TRUE; + struct AsnEncodeSequenceItem items[3] = { { 0 } }; + struct AsnConstructedItem constructed = { 0 }; + struct AsnEncodeTagSwappedItem swapped[3] = { { 0 } }; + DWORD cItem = 0, cSwapped = 0; + + switch (distPoint->DistPointName.dwDistPointNameChoice) + { + case CRL_DIST_POINT_NO_NAME: + /* do nothing */ + break; + case CRL_DIST_POINT_FULL_NAME: + swapped[cSwapped].tag = ASN_CONTEXT | ASN_CONSTRUCTOR | 0; + swapped[cSwapped].pvStructInfo = &distPoint->DistPointName.u.FullName; + swapped[cSwapped].encodeFunc = CRYPT_AsnEncodeAltName; + constructed.tag = 0; + constructed.pvStructInfo = &swapped[cSwapped]; + constructed.encodeFunc = CRYPT_AsnEncodeSwapTag; + items[cItem].pvStructInfo = &constructed; + items[cItem].encodeFunc = CRYPT_AsnEncodeConstructed; + cSwapped++; + cItem++; + break; + case CRL_DIST_POINT_ISSUER_RDN_NAME: + FIXME("unimplemented for CRL_DIST_POINT_ISSUER_RDN_NAME\n"); + ret = FALSE; + break; + default: + ret = FALSE; + } + if (ret && distPoint->ReasonFlags.cbData) + { + swapped[cSwapped].tag = ASN_CONTEXT | 1; + swapped[cSwapped].pvStructInfo = &distPoint->ReasonFlags; + swapped[cSwapped].encodeFunc = CRYPT_AsnEncodeBits; + items[cItem].pvStructInfo = &swapped[cSwapped]; + items[cItem].encodeFunc = CRYPT_AsnEncodeSwapTag; + cSwapped++; + cItem++; + } + if (ret && distPoint->CRLIssuer.cAltEntry) + { + swapped[cSwapped].tag = ASN_CONTEXT | ASN_CONSTRUCTOR | 2; + swapped[cSwapped].pvStructInfo = &distPoint->CRLIssuer; + swapped[cSwapped].encodeFunc = CRYPT_AsnEncodeAltName; + items[cItem].pvStructInfo = &swapped[cSwapped]; + items[cItem].encodeFunc = CRYPT_AsnEncodeSwapTag; + cSwapped++; + cItem++; + } + if (ret) + ret = CRYPT_AsnEncodeSequence(X509_ASN_ENCODING, items, cItem, 0, NULL, + pbEncoded, pcbEncoded); + return ret; +} + +static BOOL WINAPI CRYPT_AsnEncodeCRLDistPoints(DWORD dwCertEncodingType, + LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, + PCRYPT_ENCODE_PARA pEncodePara, BYTE *pbEncoded, DWORD *pcbEncoded) +{ + BOOL ret; + + __TRY + { + const CRL_DIST_POINTS_INFO *info = + (const CRL_DIST_POINTS_INFO *)pvStructInfo; + + if (!info->cDistPoint) + { + SetLastError(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)); + ret = FALSE; + } + else + { + DWORD bytesNeeded, dataLen, lenBytes, i; + + ret = TRUE; + for (i = 0, dataLen = 0; ret && i < info->cDistPoint; i++) + { + DWORD len; + + ret = CRYPT_AsnEncodeDistPoint(&info->rgDistPoint[i], NULL, + &len); + if (ret) + dataLen += len; + else if (GetLastError() == CRYPT_E_INVALID_IA5_STRING) + { + /* Have to propagate index of failing character */ + *pcbEncoded = len; + } + } + if (ret) + { + CRYPT_EncodeLen(dataLen, NULL, &lenBytes); + bytesNeeded = 1 + lenBytes + dataLen; + if (!pbEncoded) + { + *pcbEncoded = bytesNeeded; + ret = TRUE; + } + else + { + if ((ret = CRYPT_EncodeEnsureSpace(dwFlags, pEncodePara, + pbEncoded, pcbEncoded, bytesNeeded))) + { + if (dwFlags & CRYPT_ENCODE_ALLOC_FLAG) + pbEncoded = *(BYTE **)pbEncoded; + *pbEncoded++ = ASN_SEQUENCEOF; + CRYPT_EncodeLen(dataLen, pbEncoded, &lenBytes); + pbEncoded += lenBytes; + for (i = 0; ret && i < info->cDistPoint; i++) + { + DWORD len = dataLen; + + ret = CRYPT_AsnEncodeDistPoint( + &info->rgDistPoint[i], pbEncoded, &len); + if (ret) + { + pbEncoded += len; + dataLen -= len; + } + } + } + } + } + } + } + __EXCEPT_PAGE_FAULT + { + SetLastError(STATUS_ACCESS_VIOLATION); + ret = FALSE; + } + __ENDTRY + return ret; +} + BOOL WINAPI CryptEncodeObjectEx(DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwFlags, PCRYPT_ENCODE_PARA pEncodePara, void *pvEncoded, DWORD *pcbEncoded) @@ -2105,6 +2278,9 @@ case (WORD)PKCS_UTC_TIME: encodeFunc = CRYPT_AsnEncodeUtcTime; break; + case (WORD)X509_CRL_DIST_POINTS: + encodeFunc = CRYPT_AsnEncodeCRLDistPoints; + break; default: FIXME("%d: unimplemented\n", LOWORD(lpszStructType)); } @@ -2291,7 +2467,9 @@ return ret; } -/* A few of the members need explanation: +/* tag: + * The expected tag of the item. If tag is 0, decodeFunc is called + * regardless of the tag value seen. * offset: * A sequence is decoded into a struct. The offset member is the * offset of this item within that struct. @@ -2301,9 +2479,9 @@ * minSize: * The minimum amount of space occupied after decoding. You must set this. * optional: - * If true, and a decoding function fails with CRYPT_E_ASN1_BADTAG, then - * minSize space is filled with 0 for this member. (Any other failure - * results in CRYPT_AsnDecodeSequence failing.) + * If true, and the tag doesn't match the expected tag for this item, + * or the decodeFunc fails with CRYPT_E_ASN1_BADTAG, then minSize space is + * filled with 0 for this member. * hasPointer, pointerOffset, minSize: * If the item has dynamic data, set hasPointer to TRUE, pointerOffset to * the offset within the (outer) struct of the data pointer (or to the @@ -2313,6 +2491,7 @@ */ struct AsnDecodeSequenceItem { + BYTE tag; DWORD offset; CryptDecodeObjectExFunc decodeFunc; DWORD minSize; @@ -2322,6 +2501,114 @@ DWORD size; }; +static BOOL CRYPT_AsnDecodeSequenceItems(DWORD dwCertEncodingType, + struct AsnDecodeSequenceItem items[], DWORD cItem, const BYTE *pbEncoded, + DWORD cbEncoded, DWORD dwFlags, void *pvStructInfo, BYTE *nextData) +{ + BOOL ret; + DWORD i; + const BYTE *ptr; + + ptr = pbEncoded + 1 + GET_LEN_BYTES(pbEncoded[1]); + for (i = 0, ret = TRUE; ret && i < cItem; i++) + { + if (cbEncoded - (ptr - pbEncoded) != 0) + { + DWORD nextItemLen; + + if ((ret = CRYPT_GetLen(ptr, cbEncoded - (ptr - pbEncoded), + &nextItemLen))) + { + BYTE nextItemLenBytes = GET_LEN_BYTES(ptr[1]); + + if (ptr[0] == items[i].tag || !items[i].tag) + { + if (nextData && pvStructInfo && items[i].hasPointer) + { + TRACE("Setting next pointer to %p\n", + nextData); + *(BYTE **)((BYTE *)pvStructInfo + + items[i].pointerOffset) = nextData; + } + if (items[i].decodeFunc) + { + if (pvStructInfo) + TRACE("decoding item %ld\n", i); + else + TRACE("sizing item %ld\n", i); + ret = items[i].decodeFunc(dwCertEncodingType, + NULL, ptr, 1 + nextItemLenBytes + nextItemLen, + dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, NULL, + pvStructInfo ? (BYTE *)pvStructInfo + items[i].offset + : NULL, &items[i].size); + if (ret) + { + if (nextData && items[i].hasPointer && + items[i].size > items[i].minSize) + { + nextData += items[i].size - items[i].minSize; + /* align nextData to DWORD boundaries */ + if (items[i].size % sizeof(DWORD)) + nextData += sizeof(DWORD) - items[i].size % + sizeof(DWORD); + } + /* Account for alignment padding */ + if (items[i].size % sizeof(DWORD)) + items[i].size += sizeof(DWORD) - + items[i].size % sizeof(DWORD); + ptr += 1 + nextItemLenBytes + nextItemLen; + } + else if (items[i].optional && + GetLastError() == CRYPT_E_ASN1_BADTAG) + { + TRACE("skipping optional item %ld\n", i); + items[i].size = items[i].minSize; + SetLastError(NOERROR); + ret = TRUE; + } + else + TRACE("item %ld failed: %08lx\n", i, + GetLastError()); + } + else + items[i].size = items[i].minSize; + } + else if (items[i].optional) + { + TRACE("skipping optional item %ld\n", i); + items[i].size = items[i].minSize; + } + else + { + TRACE("tag %02x doesn't match expected %02x\n", + ptr[0], items[i].tag); + SetLastError(CRYPT_E_ASN1_BADTAG); + ret = FALSE; + } + } + } + else if (items[i].optional) + { + TRACE("missing optional item %ld, skipping\n", i); + items[i].size = items[i].minSize; + } + else + { + TRACE("not enough bytes for item %ld, failing\n", i); + SetLastError(CRYPT_E_ASN1_CORRUPT); + ret = FALSE; + } + } + if (cbEncoded - (ptr - pbEncoded) != 0) + { + TRACE("%ld remaining bytes, failing\n", cbEncoded - + (ptr - pbEncoded)); + SetLastError(CRYPT_E_ASN1_CORRUPT); + ret = FALSE; + } + return ret; +} + /* This decodes an arbitrary sequence into a contiguous block of memory * (basically, a struct.) Each element being decoded is described by a struct * AsnDecodeSequenceItem, see above. @@ -2348,70 +2635,160 @@ if ((ret = CRYPT_GetLen(pbEncoded, cbEncoded, &dataLen))) { + DWORD i; + + ret = CRYPT_AsnDecodeSequenceItems(dwFlags, items, cItem, pbEncoded, + cbEncoded, dwFlags, NULL, NULL); + if (ret) + { + DWORD bytesNeeded = 0, structSize = 0; + + for (i = 0; i < cItem; i++) + { + bytesNeeded += items[i].size; + structSize += items[i].minSize; + } + if (!pvStructInfo) + *pcbStructInfo = bytesNeeded; + else if ((ret = CRYPT_DecodeEnsureSpace(dwFlags, + pDecodePara, pvStructInfo, pcbStructInfo, bytesNeeded))) + { + BYTE *nextData; + + if (dwFlags & CRYPT_DECODE_ALLOC_FLAG) + pvStructInfo = *(BYTE **)pvStructInfo; + if (startingPointer) + nextData = (BYTE *)startingPointer; + else + nextData = (BYTE *)pvStructInfo + structSize; + memset(pvStructInfo, 0, structSize); + ret = CRYPT_AsnDecodeSequenceItems(dwFlags, items, cItem, + pbEncoded, cbEncoded, dwFlags, pvStructInfo, nextData); + } + } + } + } + else + { + SetLastError(CRYPT_E_ASN1_BADTAG); + ret = FALSE; + } + TRACE("returning %d (%08lx)\n", ret, GetLastError()); + return ret; +} + +/* tag: + * The expected tag of the entire encoded array (usually a variant + * of ASN_SETOF or ASN_SEQUENCEOF.) + * decodeFunc: + * used to decode each item in the array + * itemSize: + * is the minimum size of each decoded item + * hasPointer: + * indicates whether each item has a dynamic pointer + * pointerOffset: + * indicates the offset within itemSize at which the pointer exists + */ +struct AsnArrayDescriptor +{ + BYTE tag; + CryptDecodeObjectExFunc decodeFunc; + DWORD itemSize; + BOOL hasPointer; + DWORD pointerOffset; +}; + +struct AsnArrayItemSize +{ + DWORD encodedLen; + DWORD size; +}; + +struct GenericArray +{ + DWORD cItems; + BYTE *rgItems; +}; + +/* Decodes an array of like types into a struct GenericArray. + * The layout and decoding of the array are described by a struct + * AsnArrayDescriptor. + */ +static BOOL CRYPT_AsnDecodeArray(const struct AsnArrayDescriptor *arrayDesc, + const BYTE *pbEncoded, DWORD cbEncoded, DWORD dwFlags, + PCRYPT_DECODE_PARA pDecodePara, void *pvStructInfo, DWORD *pcbStructInfo, + void *startingPointer) +{ + BOOL ret = TRUE; + + TRACE("%p, %p, %ld, %08lx, %p, %p, %ld, %p\n", arrayDesc, pbEncoded, + cbEncoded, dwFlags, pDecodePara, pvStructInfo, *pcbStructInfo, + startingPointer); + + if (pbEncoded[0] == arrayDesc->tag) + { + DWORD dataLen; + + if ((ret = CRYPT_GetLen(pbEncoded, cbEncoded, &dataLen))) + { + DWORD bytesNeeded, cItems = 0; BYTE lenBytes = GET_LEN_BYTES(pbEncoded[1]); - DWORD i, bytesNeeded = 0, minSize = 0; - const BYTE *ptr; + /* There can be arbitrarily many items, but there is often only one. + */ + struct AsnArrayItemSize itemSize = { 0 }, *itemSizes = &itemSize; - ptr = pbEncoded + 1 + lenBytes; - for (i = 0; ret && i < cItem; i++) + bytesNeeded = sizeof(struct GenericArray); + if (dataLen) { - DWORD nextItemLen; + const BYTE *ptr; - minSize += items[i].minSize; - if (cbEncoded - (ptr - pbEncoded) != 0) + for (ptr = pbEncoded + 1 + lenBytes; ret && + ptr - pbEncoded - 1 - lenBytes < dataLen; ) { - if ((ret = CRYPT_GetLen(ptr, cbEncoded - (ptr - pbEncoded), - &nextItemLen))) + DWORD itemLenBytes, itemDataLen, size; + + itemLenBytes = GET_LEN_BYTES(ptr[1]); + /* Each item decoded may not tolerate extraneous bytes, so + * get the length of the next element and pass it directly. + */ + ret = CRYPT_GetLen(ptr, cbEncoded - (ptr - pbEncoded), + &itemDataLen); + if (ret) + ret = arrayDesc->decodeFunc(X509_ASN_ENCODING, 0, ptr, + 1 + itemLenBytes + itemDataLen, + dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, NULL, NULL, + &size); + if (ret) { - BYTE nextItemLenBytes = GET_LEN_BYTES(ptr[1]); + DWORD nextLen; - if (items[i].decodeFunc) + cItems++; + if (itemSizes != &itemSize) + itemSizes = CryptMemRealloc(itemSizes, + cItems * sizeof(struct AsnArrayItemSize)); + else { - TRACE("sizing item %ld\n", i); - ret = items[i].decodeFunc(dwCertEncodingType, NULL, - ptr, 1 + nextItemLenBytes + nextItemLen, - dwFlags & ~CRYPT_DECODE_ALLOC_FLAG, NULL, NULL, - &items[i].size); + itemSizes = + CryptMemAlloc( + cItems * sizeof(struct AsnArrayItemSize)); + memcpy(itemSizes, &itemSize, sizeof(itemSize)); + } + if (itemSizes) + { + itemSizes[cItems - 1].encodedLen = 1 + itemLenBytes + + itemDataLen; + itemSizes[cItems - 1].size = size; + bytesNeeded += size; + ret = CRYPT_GetLen(ptr, + cbEncoded - (ptr - pbEncoded), &nextLen); if (ret) - { - /* Account for alignment padding */ - bytesNeeded += items[i].size; - if (items[i].size % sizeof(DWORD)) - bytesNeeded += sizeof(DWORD) - - items[i].size % sizeof(DWORD); - ptr += 1 + nextItemLenBytes + nextItemLen; - } - else if (items[i].optional && - GetLastError() == CRYPT_E_ASN1_BADTAG) - { - TRACE("skipping optional item %ld\n", i); - bytesNeeded += items[i].minSize; - SetLastError(NOERROR); - ret = TRUE; - } - else - TRACE("item %ld failed: %08lx\n", i, - GetLastError()); + ptr += nextLen + 1 + GET_LEN_BYTES(ptr[1]); } else - bytesNeeded += items[i].minSize; + ret = FALSE; } } - else if (items[i].optional) - bytesNeeded += items[i].minSize; - else - { - SetLastError(CRYPT_E_ASN1_CORRUPT); - ret = FALSE; - } } - if (cbEncoded - (ptr - pbEncoded) != 0) - { - TRACE("%ld remaining bytes, failing\n", cbEncoded - - (ptr - pbEncoded)); - SetLastError(CRYPT_E_ASN1_CORRUPT); - ret = FALSE; - } if (ret) { if (!pvStructInfo) @@ -2419,75 +2796,49 @@ else if ((ret = CRYPT_DecodeEnsureSpace(dwFlags, pDecodePara, pvStructInfo, pcbStructInfo, bytesNeeded))) { + DWORD i; BYTE *nextData; + const BYTE *ptr; + struct GenericArray *array; if (dwFlags & CRYPT_DECODE_ALLOC_FLAG) pvStructInfo = *(BYTE **)pvStructInfo; + array = (struct GenericArray *)pvStructInfo; + array->cItems = cItems; if (startingPointer) - nextData = (BYTE *)startingPointer; + array->rgItems = startingPointer; else - nextData = (BYTE *)pvStructInfo + minSize; - memset(pvStructInfo, 0, minSize); - ptr = pbEncoded + 1 + lenBytes; - for (i = 0; ret && i < cItem; i++) [truncated at 1000 lines; 2943 more skipped]
19 years
1
0
0
0
[gedmurphy] 20339: Shut MSVC warnings up
by gedmurphy@svn.reactos.com
Shut MSVC warnings up Modified: trunk/reactos/subsys/system/sc/query.c Modified: trunk/reactos/subsys/system/sc/sc.c Modified: trunk/reactos/subsys/system/sc/usage.c _____ Modified: trunk/reactos/subsys/system/sc/query.c --- trunk/reactos/subsys/system/sc/query.c 2005-12-26 20:14:24 UTC (rev 20338) +++ trunk/reactos/subsys/system/sc/query.c 2005-12-26 20:40:45 UTC (rev 20339) @@ -16,9 +16,12 @@ #include "sc.h" +#define DEBUG +#include <debug.h> + /* local function decs */ VOID PrintService(BOOL bExtended); -BOOL EnumServices(LPCTSTR ServiceName, DWORD ServiceType, DWORD ServiceState); +BOOL EnumServices(DWORD ServiceType, DWORD ServiceState); BOOL QueryService(LPCTSTR ServiceName, BOOL bExtended); /* global variables */ @@ -29,11 +32,10 @@ BOOL Query(LPCTSTR ServiceName, LPCTSTR *ServiceArgs, BOOL bExtended) { - if (! ServiceName) /* display all running services and drivers */ { /* get default values */ - EnumServices(NULL, SERVICE_WIN32, SERVICE_ACTIVE); + EnumServices(SERVICE_WIN32, SERVICE_ACTIVE); /* print default values */ PrintService(bExtended); @@ -43,11 +45,11 @@ LPCTSTR Type = *ServiceArgs; if (_tcsicmp(Type, _T("driver")) == 0) - EnumServices(NULL, SERVICE_DRIVER, SERVICE_ACTIVE); + EnumServices(SERVICE_DRIVER, SERVICE_ACTIVE); else if (_tcsicmp(Type, _T("service")) == 0) - EnumServices(NULL, SERVICE_WIN32, SERVICE_ACTIVE); + EnumServices(SERVICE_WIN32, SERVICE_ACTIVE); else if (_tcsicmp(Type, _T("all")) == 0) - EnumServices(NULL, SERVICE_DRIVER|SERVICE_WIN32, SERVICE_ACTIVE); + EnumServices(SERVICE_DRIVER|SERVICE_WIN32, SERVICE_ACTIVE); else { _tprintf(_T("\nERROR following \"type=\"!\n")); @@ -61,9 +63,9 @@ LPCTSTR State = *ServiceArgs; if (_tcsicmp(State, _T("inactive")) == 0) - EnumServices(NULL, SERVICE_WIN32, SERVICE_INACTIVE); + EnumServices(SERVICE_WIN32, SERVICE_INACTIVE); else if (_tcsicmp(State, _T("all")) == 0) - EnumServices(NULL, SERVICE_WIN32, SERVICE_STATE_ALL); + EnumServices(SERVICE_WIN32, SERVICE_STATE_ALL); else { _tprintf(_T("\nERROR following \"state=\"!\n")); @@ -202,7 +204,7 @@ BOOL -EnumServices(LPCTSTR ServiceName, DWORD ServiceType, DWORD ServiceState) +EnumServices(DWORD ServiceType, DWORD ServiceState) { DWORD BufSize = 0; DWORD BytesNeeded = 0; @@ -265,7 +267,7 @@ VOID PrintService(BOOL bExtended) { - int i; + DWORD i; for (i=0; i < NumServices; i++) { _____ Modified: trunk/reactos/subsys/system/sc/sc.c --- trunk/reactos/subsys/system/sc/sc.c 2005-12-26 20:14:24 UTC (rev 20338) +++ trunk/reactos/subsys/system/sc/sc.c 2005-12-26 20:40:45 UTC (rev 20339) @@ -21,16 +21,17 @@ DWORD ErrorCode = GetLastError(); if (ErrorCode != ERROR_SUCCESS) { - if ((RetVal = FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - ErrorCode, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */ - (LPTSTR) &lpMsgBuf, - 0, - NULL ))) + RetVal = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + ErrorCode, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */ + (LPTSTR) &lpMsgBuf, + 0, + NULL ); + + if (RetVal != 0) { _tprintf(_T("%s"), (LPTSTR)lpMsgBuf); @@ -169,8 +170,6 @@ ServiceName = argv[2]; return ScControl(MachineName, Command, ServiceName, &argv[3], argc); } - - return MainUsage(); } _____ Modified: trunk/reactos/subsys/system/sc/usage.c --- trunk/reactos/subsys/system/sc/usage.c 2005-12-26 20:14:24 UTC (rev 20338) +++ trunk/reactos/subsys/system/sc/usage.c 2005-12-26 20:40:45 UTC (rev 20339) @@ -13,7 +13,7 @@ INT MainUsage(VOID) { - TCHAR c; + INT c; _tprintf(_T("DESCRIPTION:\n") _T("\tSC is a command line program used for communicating with\n")
19 years
1
0
0
0
[ekohl] 20338: Add CMP_Init_Detection and CMP_Report_LogOn prototypes.
by ekohl@svn.reactos.com
Add CMP_Init_Detection and CMP_Report_LogOn prototypes. Modified: trunk/reactos/w32api/include/ddk/cfgmgr32.h _____ Modified: trunk/reactos/w32api/include/ddk/cfgmgr32.h --- trunk/reactos/w32api/include/ddk/cfgmgr32.h 2005-12-26 15:55:33 UTC (rev 20337) +++ trunk/reactos/w32api/include/ddk/cfgmgr32.h 2005-12-26 20:14:24 UTC (rev 20338) @@ -596,10 +596,24 @@ #endif +#define CMP_MAGIC 0x01234567 -/* FIXME: Missing CMP_Init_Detection */ + +CMAPI +CONFIGRET +WINAPI +CMP_Init_Detection( + IN DWORD dwMagic); + /* FIXME: Missing CMP_RegisterNotification */ -/* FIXME: Missing CMP_Report_LogOn */ + +CMAPI +CONFIGRET +WINAPI +CMP_Report_LogOn( + IN DWORD dwMagic, + IN DWORD dwProcessId); + /* FIXME: Missing CMP_UnregisterNotification */ /* FIXME: Missing CMP_WaitNoPendingInstallEvents */ /* FIXME: Missing CMP_WaitServicesAvailable */ @@ -763,9 +777,9 @@ CONFIGRET WINAPI CM_Disable_DevNode_Ex( - IN DEVINST dnDevInst, - IN ULONG ulFlags, - IN HMACHINE hMachine); + IN DEVINST dnDevInst, + IN ULONG ulFlags, + IN HMACHINE hMachine); #define CM_Disable_DevInst CM_Disable_DevNode #define CM_Disable_DevInst_Ex CM_Disable_DevNode_Ex @@ -780,16 +794,16 @@ CONFIGRET WINAPI CM_Enable_DevNode( - IN DEVINST dnDevInst, - IN ULONG ulFlags); + IN DEVINST dnDevInst, + IN ULONG ulFlags); CMAPI CONFIGRET WINAPI CM_Enable_DevNode_Ex( - IN DEVINST dnDevInst, - IN ULONG ulFlags, - IN HMACHINE hMachine); + IN DEVINST dnDevInst, + IN ULONG ulFlags, + IN HMACHINE hMachine); #define CM_Enable_DevInst CM_Enable_DevNode #define CM_Enable_DevInst_Ex CM_Enable_DevNode_Ex
19 years
1
0
0
0
← Newer
1
...
13
14
15
16
17
18
19
...
71
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
Results per page:
10
25
50
100
200