[crypt32 5/5] Bail out on registry errors and return the error (if any)

Paul Vriens Paul.Vriens at xs4all.nl
Fri Sep 8 06:19:26 CDT 2006


Hi,

Last one. Now we really bail out in registry errors in the main function.
Will sent in some tests soon that show (part of) the behaviour. I have
problems with compiling the test with 'make crosstest' as it reports several
undefined functions. I guess I need an update to MingW.

Changelog
  Bail out on registry errors and return the error (if any)

Cheers,

Paul.

---
 dlls/crypt32/main.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/dlls/crypt32/main.c b/dlls/crypt32/main.c
index 4c0166d..3c9c050 100644
--- a/dlls/crypt32/main.c
+++ b/dlls/crypt32/main.c
@@ -198,6 +198,7 @@ BOOL WINAPI CryptSIPAddProvider(SIP_ADD_
     static const WCHAR szVerify[] = {
        'V','e','r','i','f','y',
        'I','n','d','i','r','e','c','t','D','a','t','a',0};
+    LONG r = ERROR_SUCCESS;
 
     TRACE("%p\n", psNewProv);
 
@@ -220,8 +221,9 @@ BOOL WINAPI CryptSIPAddProvider(SIP_ADD_
           debugstr_w( psNewProv->pwszIsFunctionName ) );
 
 #define CRYPT_SIPADDPROV( key, field ) \
-    CRYPT_SIPWriteFunction( psNewProv->pgSubject, key, \
-           psNewProv->pwszDLLFileName, psNewProv->field)
+    r = CRYPT_SIPWriteFunction( psNewProv->pgSubject, key, \
+           psNewProv->pwszDLLFileName, psNewProv->field); \
+    if (r != ERROR_SUCCESS) goto end_function
 
     CRYPT_SIPADDPROV( szPutSigned, pwszPutFuncName );
     CRYPT_SIPADDPROV( szGetSigned, pwszGetFuncName );
@@ -232,6 +234,14 @@ #define CRYPT_SIPADDPROV( key, field ) \
 
 #undef CRYPT_SIPADDPROV
 
+end_function:
+
+    if (r != ERROR_SUCCESS)
+    {
+        SetLastError(r);
+        return FALSE;
+    }
+
     return TRUE;
 }
 
-- 
1.4.2




More information about the wine-patches mailing list