OSDN Git Service

nvdaHelperLocal's startServer: while we're fiddling with rpc and doing lots of testi...
authorMichael Curran <mick@kulgan.net>
Thu, 19 Apr 2012 23:54:22 +0000 (09:54 +1000)
committerMichael Curran <mick@kulgan.net>
Thu, 19 Apr 2012 23:54:22 +0000 (09:54 +1000)
nvdaHelper/local/rpcSrv.cpp

index d9d2e47..853476e 100644 (file)
@@ -68,26 +68,20 @@ RPC_STATUS startServer() {
        //Register the interfaces\r
        if(RpcServerRegisterIf3) { //Windows 8\r
                for(int i=0;i<ARRAYSIZE(availableInterfaces);i++) {\r
-                       if((status=RpcServerRegisterIf3(availableInterfaces[i],NULL,NULL,RPC_IF_ALLOW_CALLBACKS_WITH_NO_AUTH,RPC_C_LISTEN_MAX_CALLS_DEFAULT,0,NULL,psd))!=RPC_S_OK) {\r
+                       if((status=RpcServerRegisterIf3(availableInterfaces[i],NULL,NULL,RPC_IF_AUTOLISTEN|RPC_IF_ALLOW_CALLBACKS_WITH_NO_AUTH,RPC_C_LISTEN_MAX_CALLS_DEFAULT,0,NULL,psd))!=RPC_S_OK) {\r
                                LOG_ERROR(L"RpcServerRegisterIf3 failed to register interface at index "<<i<<L", status "<<status);\r
                                return status;\r
                        }\r
                }\r
        } else { // Pre Windows 8\r
                for(int i=0;i<ARRAYSIZE(availableInterfaces);i++) {\r
-                       if((status=RpcServerRegisterIf(availableInterfaces[i],NULL,NULL))!=RPC_S_OK) {\r
+                       if((status=RpcServerRegisterIfEx(availableInterfaces[i],NULL,NULL,RPC_IF_AUTOLISTEN,RPC_C_LISTEN_MAX_CALLS_DEFAULT,NULL))!=RPC_S_OK) {\r
                                LOG_ERROR(L"RpcServerRegisterIf failed to register interface at index "<<i<<L", status "<<status);\r
                                return status;\r
                        }\r
                }\r
        }\r
        LocalFree(psd);\r
-       //Start listening\r
-       if((status=RpcServerListen(1,RPC_C_LISTEN_MAX_CALLS_DEFAULT,TRUE))!=RPC_S_OK) {\r
-               LOG_ERROR(L"RpcServerListen failed with status "<<status);\r
-               return status;\r
-       }\r
-       CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)RpcMgmtWaitServerListen,NULL,0,NULL);\r
        return status;\r
 }\r
 \r
@@ -99,5 +93,5 @@ RPC_STATUS stopServer() {
                        return status;\r
                }\r
        }\r
-       return RpcMgmtStopServerListening(NULL); \r
+       return status;\r
 }\r