[ofw] RE: NDinstall - return proper exit code.

Sean Hefty sean.hefty at intel.com
Wed Jul 15 11:07:44 PDT 2009


Signed off by Stan Smith <stan.smith at intel.com>
Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---
A slight deviation from Stan's patch to return err_no instead.  Compile tested only.

diff -up -r -X \mshefty\scm\winof\trunk\docs\dontdiff.txt -I '\$Id:' trunk\tools\ndinstall/user/installsp.c
branches\winverbs\tools\ndinstall/user/installsp.c
--- trunk\tools\ndinstall/user/installsp.c	2009-07-10 10:57:20.398750000 -0700
+++ branches\winverbs\tools\ndinstall/user/installsp.c	2009-07-15 11:03:05.114592800 -0700
@@ -163,10 +163,10 @@ static void print_providers(void)
  * Windows Sockets Direct Components".
  * The direct link is http://msdn.microsoft.com/library/default.asp?url=/library/en-us/network/hh/network/wsdp_2xrb.asp
  */
-static void install_provider(void)
+static int install_provider(void)
 {
 	int rc;
-	INT err_no;
+	INT err_no = 0;
 	LONG reg_error;
 	WSAPROTOCOL_INFOW provider;
 	HKEY hkey;
@@ -214,16 +214,17 @@ static void install_provider(void)
 	} else {
 		printf("successful\n");
 	}
+	return err_no;
 }
 
 /*
  * Function: remove_provider
  *   Description: removes our provider.
  */
-static void remove_provider(void)
+static int remove_provider(void)
 {
 	int rc;
-	int err_no;
+	int err_no = 0, err_no32 = 0;
 	LONG reg_error;
 	HKEY hkey;
 
@@ -239,13 +240,14 @@ static void remove_provider(void)
 #ifdef _WIN64
 	/* Remove from the 32-bit catalog too! */
 	printf("Removing 32-bit %s provider: ", provider_name[index]);
-	rc = WSCDeinstallProvider32(&provider_guid[index], &err_no);
+	rc = WSCDeinstallProvider32(&provider_guid[index], &err_no32);
 	if (rc == SOCKET_ERROR) {
-		printf ("WSCDeinstallProvider32 failed: %d\n", err_no);
+		printf ("WSCDeinstallProvider32 failed: %d\n", err_no32);
 	} else {
 		printf ("successful\n");
 	}
 #endif	/* _WIN64 */
+	return err_no ? err_no : err_no32;
 }
 
 static int get_prov_index(char *name)
@@ -305,14 +307,14 @@ int __cdecl main (int argc, char *argv[]
 	}
 
 	if (install) {
-		install_provider();
+		ret = install_provider();
 #ifdef PERFMON_ENABLED
 		_IBSPPerfmonIniFilesGenerate();
 		if ( _IBSPPerfmonRegisterKeys() == ERROR_SUCCESS )
 				_IBSPPerfmonRegisterCounters();
 #endif
 	} else if (remove) {
-		remove_provider();
+		ret = remove_provider();
 #ifdef PERFMON_ENABLED
 		_IBSPPerfmonIniFilesRemove();
 		if ( _IBSPPerfmonDeregisterCounters() == ERROR_SUCCESS )





More information about the ofw mailing list