OSDN Git Service

nvdaHelperLocal's createRemoteBindingHandle: on versions less win8, the 'AC' sid...
authorMichael Curran <mick@kulgan.net>
Thu, 19 Apr 2012 23:52:08 +0000 (09:52 +1000)
committerMichael Curran <mick@kulgan.net>
Thu, 19 Apr 2012 23:52:08 +0000 (09:52 +1000)
nvdaHelper/local/nvdaHelperLocal.cpp

index ebf78c6..52a0091 100644 (file)
@@ -53,16 +53,21 @@ handle_t createRemoteBindingHandle(wchar_t* uuidString) {
                LOG_ERROR(L"RpcBindingFromStringBinding failed with status "<<rpcStatus);\r
                return NULL;\r
        } \r
-       PSECURITY_DESCRIPTOR psd=NULL;\r
-       ULONG size;\r
-       if(!ConvertStringSecurityDescriptorToSecurityDescriptor(L"D:(A;;GA;;;wd)(A;;GA;;;AC)",SDDL_REVISION_1,&psd,&size)) {\r
-               LOG_ERROR(L"ConvertStringSecurityDescriptorToSecurityDescriptor failed");\r
-               return NULL;\r
-       }\r
-       RPC_SECURITY_QOS_V5_W securityQos={5,0,0,0,0,NULL,NULL,0,psd};\r
-       if((rpcStatus=RpcBindingSetAuthInfoEx(bindingHandle,NULL,RPC_C_AUTHN_LEVEL_DEFAULT,RPC_C_AUTHN_DEFAULT,NULL,0,(RPC_SECURITY_QOS*)&securityQos))!=RPC_S_OK) {\r
-               LOG_ERROR(L"RpcBindingSetAuthInfoEx failed with status "<<rpcStatus);\r
-               return NULL;\r
+       //On Windows 8 we must allow AppContainer servers to communicate back to us\r
+       //Detect Windows 8 by looking for RpcServerRegisterIf3\r
+       HANDLE rpcrt4Handle=GetModuleHandle(L"rpcrt4.dll");\r
+       if(rpcrt4Handle&&GetProcAddress((HMODULE)rpcrt4Handle,"RpcServerRegisterIf3")) {\r
+               PSECURITY_DESCRIPTOR psd=NULL;\r
+               ULONG size;\r
+               if(!ConvertStringSecurityDescriptorToSecurityDescriptor(L"D:(A;;GA;;;wd)(A;;GA;;;AC)",SDDL_REVISION_1,&psd,&size)) {\r
+                       LOG_ERROR(L"ConvertStringSecurityDescriptorToSecurityDescriptor failed");\r
+                       return NULL;\r
+               }\r
+               RPC_SECURITY_QOS_V5_W securityQos={5,0,0,0,0,NULL,NULL,0,psd};\r
+               if((rpcStatus=RpcBindingSetAuthInfoEx(bindingHandle,NULL,RPC_C_AUTHN_LEVEL_DEFAULT,RPC_C_AUTHN_DEFAULT,NULL,0,(RPC_SECURITY_QOS*)&securityQos))!=RPC_S_OK) {\r
+                       LOG_ERROR(L"RpcBindingSetAuthInfoEx failed with status "<<rpcStatus);\r
+                       return NULL;\r
+               }\r
        }\r
        return bindingHandle;\r
 }\r