Raising exception for SC_RPC_HANDLE being NULL

Michael Martin martinmnet at hotmail.com
Mon Aug 18 08:06:21 CDT 2008


In widl code generated for services an
exception is raised for null string with RPC_X_NULL_REF_POINTER
In windows calls made to for example CreateService with all NULL's
checks are made on the handle being null and its checked first before null strings.

Windows documentation on RPC_X_ exceptions say that
RPC_X_SS_IN_NULL_CONTEXT is raised for null handles.

suggested patch

Index: widl/client.c
===================================================================
--- widl/client.c    (trunk) 
+++ widl/client.c    (working copy) 
@@ -67,6 +67,15 @@
             indent--;
             print_client("}\n\n");
         }
+        else if ((var->type->name) && (strncmp(var->type->name,"SC_RPC_HANDLE", 13)==0)) 
+        { 
+            print_client("if (!%s)\n",var->name); 
+            print_client("{\n"); 
+            indent++; 
+            print_client("RpcRaiseException(RPC_X_SS_IN_NULL_CONTEXT);\n"); 
+            indent--; 
+            print_client("}\n\n"); 
+        } 
     }
 }
 
Index: widl/proxy.c
===================================================================
--- widl/proxy.c    (trunk) 
+++ widl/proxy.c    (working copy) 
@@ -182,6 +182,13 @@
         print_proxy( "RpcRaiseException(RPC_X_NULL_REF_POINTER);\n");
         indent--;
     }
+    else if ((arg->type->name) && (strncmp(arg->type->name,"SC_RPC_HANDLE", 13)==0)) 
+    { 
+        print_proxy("if (!%s)\n",arg->name); 
+        indent++; 
+        print_proxy("RpcRaiseException(RPC_X_SS_IN_NULL_CONTEXT);\n"); 
+        indent--; 
+    } 
   }
 }
  
_________________________________________________________________
Talk to your Yahoo! Friends via Windows Live Messenger.  Find out how.
http://www.windowslive.com/explore/messenger?ocid=TXT_TAGLM_WL_messenger_yahoo_082008


More information about the wine-patches mailing list