3

我们正计划进行 Windows 8.1 桌面应用程序认证。该应用程序位于 c++-CLI 中。认证的要求之一是应用程序应在 App Verifier 下运行以检测错误。

该应用程序连接到我们公司的服务器以满足其所有数据需求。所以基本上所有的调用都是HTTPS。可以肯定的是,我们想在App Verifier下测试一个简单的win32控制台应用程序(在Windows 8.1 x64上的VS2013专业试用版)和与http(s)相关的调用,我们使用windows.web .httpclient。应用程序在启用 UAC 的标准用户模式下运行“asInvoker”时,在应用程序验证程序(和进程监视器)下失败,给出了一些与 winsock2 注册表相关的 luaPriv 错误。但是使用 SUA,没有错误。应用程序验证器日志:

 <avrf:logEntry Time="2014-05-06 : 17:44:16" LayerName="LuaPriv" StopCode="0x332D" Severity="Error">
        <avrf:message>The application was denied access to an object.</avrf:message>
        <avrf:formatmessage>RegOpenKeyExW: Key (HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\WinSock2\Parameters) is denied &apos;DELETE READ_CONTROL WRITE_DAC WRITE_OWNER KEY_QUERY_VALUE KEY_SET_VALUE KEY_CREATE_SUB_KEY KEY_ENUMERATE_SUB_KEYS KEY_NOTIFY KEY_CREATE_LINK&apos; access with error 0x5.</avrf:formatmessage>
        <avrf:parameter1>5 - Error returned</avrf:parameter1>
        <avrf:parameter2>f003f - Access Requested (if applicable)</avrf:parameter2>
        <avrf:parameter3>f003f - Access Requested (for compatibility)</avrf:parameter3>
        <avrf:parameter4>0 - n/a</avrf:parameter4>
        <avrf:stackTrace>
            <avrf:trace>vfluapriv!+7ff962d985c8 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d9283f ( @ 0)</avrf:trace>
            <avrf:trace>WS2_32!WahCreateHandleContextTable+1d1 ( @ 0)</avrf:trace>
            <avrf:trace>WS2_32!WahCreateHandleContextTable+15b0 ( @ 0)</avrf:trace>
            <avrf:trace>WS2_32!WahCreateHandleContextTable+1551 ( @ 0)</avrf:trace>
            <avrf:trace>WS2_32!WahCreateHandleContextTable+1440 ( @ 0)</avrf:trace>
            <avrf:trace>vfnet!+7ff962cfb42e ( @ 0)</avrf:trace>
            <avrf:trace>WININET!UrlCacheCreateContainer+2614 ( @ 0)</avrf:trace>
            <avrf:trace>WININET!UrlCacheCreateContainer+2f44 ( @ 0)</avrf:trace>
            <avrf:trace>WININET!InternetTimeToSystemTimeA+ad ( @ 0)</avrf:trace>
            <avrf:trace>WININET!InternetOpenW+12f ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!DllCanUnloadNow+4c3b ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960bf2bab ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960bf24e3 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c4ba86 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c4a32a ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960bf4325 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c4eb32 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c46098 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c45403 ( @ 0)</avrf:trace>
            <avrf:trace>ConsoleApplication1!Windows::Web::Http::IHttpClient::GetAsync+32 (c:\program files (x86)\microsoft visual studio 12.0\vc\include\xmemory0 @ 15732480)</avrf:trace>
            <avrf:trace>ConsoleApplication1!main+446 (c:\users\mswarna\documents\visual studio 2013\projects\consoleapplication1\consoleapplication1\consoleapplication1.cpp @ 83)</avrf:trace>
            <avrf:trace>ConsoleApplication1!_main+9d (f:\dd\vctools\winrt\vccorlib\climain.cpp @ 52)</avrf:trace>
            <avrf:trace>ConsoleApplication1!__tmainCRTStartup+10f (f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c @ 626)</avrf:trace>
            <avrf:trace>KERNEL32!BaseThreadInitThunk+d ( @ 0)</avrf:trace>
            <avrf:trace>ntdll!RtlUserThreadStart+1d ( @ 0)</avrf:trace>
        </avrf:stackTrace>
    </avrf:logEntry>
    <avrf:logEntry Time="2014-05-06 : 17:44:16" LayerName="LuaPriv" StopCode="0x331B" Severity="Error">
        <avrf:message>Access was restricted to trusted users only.</avrf:message>
        <avrf:formatmessage>RegOpenKeyExW: Key (\REGISTRY\MACHINE\SYSTEM\ControlSet001\Services\WinSock2\Parameters) only grants requested &apos;KEY_SET_VALUE&apos; to &apos;BUILTIN\Administrators, NT AUTHORITY\SYSTEM&apos;</avrf:formatmessage>
        <avrf:parameter1>7ff962d835b0 - Object Type</avrf:parameter1>
        <avrf:parameter2>16535e9f60 - Object Name</avrf:parameter2>
        <avrf:parameter3>2 - Access Mask</avrf:parameter3>
        <avrf:parameter4>16535e7fa0 - String SID</avrf:parameter4>
        <avrf:stackTrace>
            <avrf:trace>vfluapriv!+7ff962d88714 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d888d2 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d88d20 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d88e99 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d893ca ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d895f9 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d928ec ( @ 0)</avrf:trace>
            <avrf:trace>WS2_32!WahCreateHandleContextTable+1d1 ( @ 0)</avrf:trace>
            <avrf:trace>WS2_32!WahCreateHandleContextTable+15b0 ( @ 0)</avrf:trace>
            <avrf:trace>WS2_32!WahCreateHandleContextTable+1551 ( @ 0)</avrf:trace>
            <avrf:trace>WS2_32!WahCreateHandleContextTable+1440 ( @ 0)</avrf:trace>
            <avrf:trace>vfnet!+7ff962cfb42e ( @ 0)</avrf:trace>
            <avrf:trace>WININET!UrlCacheCreateContainer+2614 ( @ 0)</avrf:trace>
            <avrf:trace>WININET!UrlCacheCreateContainer+2f44 ( @ 0)</avrf:trace>
            <avrf:trace>WININET!InternetTimeToSystemTimeA+ad ( @ 0)</avrf:trace>
            <avrf:trace>WININET!InternetOpenW+12f ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!DllCanUnloadNow+4c3b ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960bf2bab ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960bf24e3 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c4ba86 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c4a32a ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960bf4325 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c4eb32 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c46098 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c45403 ( @ 0)</avrf:trace>
            <avrf:trace>ConsoleApplication1!Windows::Web::Http::IHttpClient::GetAsync+32 (c:\program files (x86)\microsoft visual studio 12.0\vc\include\xmemory0 @ 15732480)</avrf:trace>
            <avrf:trace>ConsoleApplication1!main+446 (c:\users\mswarna\documents\visual studio 2013\projects\consoleapplication1\consoleapplication1\consoleapplication1.cpp @ 83)</avrf:trace>
            <avrf:trace>ConsoleApplication1!_main+9d (f:\dd\vctools\winrt\vccorlib\climain.cpp @ 52)</avrf:trace>
            <avrf:trace>ConsoleApplication1!__tmainCRTStartup+10f (f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c @ 626)</avrf:trace>
            <avrf:trace>KERNEL32!BaseThreadInitThunk+d ( @ 0)</avrf:trace>
            <avrf:trace>ntdll!RtlUserThreadStart+1d ( @ 0)</avrf:trace>
        </avrf:stackTrace>
    </avrf:logEntry>
    <avrf:logEntry Time="2014-05-06 : 17:44:16" LayerName="LuaPriv" StopCode="0x331B" Severity="Error">
        <avrf:message>Access was restricted to trusted users only.</avrf:message>
        <avrf:formatmessage>RegOpenKeyExW: Key (\REGISTRY\MACHINE\SYSTEM\ControlSet001\Services\WinSock2\Parameters) only grants requested &apos;KEY_CREATE_SUB_KEY&apos; to &apos;BUILTIN\Administrators, NT AUTHORITY\SYSTEM&apos;</avrf:formatmessage>
        <avrf:parameter1>7ff962d835b0 - Object Type</avrf:parameter1>
        <avrf:parameter2>16535e9f60 - Object Name</avrf:parameter2>
        <avrf:parameter3>4 - Access Mask</avrf:parameter3>
        <avrf:parameter4>16535f3fa0 - String SID</avrf:parameter4>
        <avrf:stackTrace>
            <avrf:trace>vfluapriv!+7ff962d88714 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d888d2 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d88d20 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d88e99 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d893ca ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d895f9 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d928ec ( @ 0)</avrf:trace>
            <avrf:trace>WS2_32!WahCreateHandleContextTable+1d1 ( @ 0)</avrf:trace>
            <avrf:trace>WS2_32!WahCreateHandleContextTable+15b0 ( @ 0)</avrf:trace>
            <avrf:trace>WS2_32!WahCreateHandleContextTable+1551 ( @ 0)</avrf:trace>
            <avrf:trace>WS2_32!WahCreateHandleContextTable+1440 ( @ 0)</avrf:trace>
            <avrf:trace>vfnet!+7ff962cfb42e ( @ 0)</avrf:trace>
            <avrf:trace>WININET!UrlCacheCreateContainer+2614 ( @ 0)</avrf:trace>
            <avrf:trace>WININET!UrlCacheCreateContainer+2f44 ( @ 0)</avrf:trace>
            <avrf:trace>WININET!InternetTimeToSystemTimeA+ad ( @ 0)</avrf:trace>
            <avrf:trace>WININET!InternetOpenW+12f ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!DllCanUnloadNow+4c3b ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960bf2bab ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960bf24e3 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c4ba86 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c4a32a ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960bf4325 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c4eb32 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c46098 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c45403 ( @ 0)</avrf:trace>
            <avrf:trace>ConsoleApplication1!Windows::Web::Http::IHttpClient::GetAsync+32 (c:\program files (x86)\microsoft visual studio 12.0\vc\include\xmemory0 @ 15732480)</avrf:trace>
            <avrf:trace>ConsoleApplication1!main+446 (c:\users\mswarna\documents\visual studio 2013\projects\consoleapplication1\consoleapplication1\consoleapplication1.cpp @ 83)</avrf:trace>
            <avrf:trace>ConsoleApplication1!_main+9d (f:\dd\vctools\winrt\vccorlib\climain.cpp @ 52)</avrf:trace>
            <avrf:trace>ConsoleApplication1!__tmainCRTStartup+10f (f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c @ 626)</avrf:trace>
            <avrf:trace>KERNEL32!BaseThreadInitThunk+d ( @ 0)</avrf:trace>
            <avrf:trace>ntdll!RtlUserThreadStart+1d ( @ 0)</avrf:trace>
        </avrf:stackTrace>
    </avrf:logEntry>
    <avrf:logEntry Time="2014-05-06 : 17:44:16" LayerName="LuaPriv" StopCode="0x331B" Severity="Error">
        <avrf:message>Access was restricted to trusted users only.</avrf:message>
        <avrf:formatmessage>RegOpenKeyExW: Key (\REGISTRY\MACHINE\SYSTEM\ControlSet001\Services\WinSock2\Parameters) only grants requested &apos;KEY_CREATE_LINK&apos; to &apos;BUILTIN\Administrators, NT AUTHORITY\SYSTEM&apos;</avrf:formatmessage>
        <avrf:parameter1>7ff962d835b0 - Object Type</avrf:parameter1>
        <avrf:parameter2>16535e9f60 - Object Name</avrf:parameter2>
        <avrf:parameter3>20 - Access Mask</avrf:parameter3>
        <avrf:parameter4>16535fbfa0 - String SID</avrf:parameter4>
        <avrf:stackTrace>
            <avrf:trace>vfluapriv!+7ff962d88714 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d888d2 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d88d20 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d88e99 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d893ca ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d895f9 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d928ec ( @ 0)</avrf:trace>
            <avrf:trace>WS2_32!WahCreateHandleContextTable+1d1 ( @ 0)</avrf:trace>
            <avrf:trace>WS2_32!WahCreateHandleContextTable+15b0 ( @ 0)</avrf:trace>
            <avrf:trace>WS2_32!WahCreateHandleContextTable+1551 ( @ 0)</avrf:trace>
            <avrf:trace>WS2_32!WahCreateHandleContextTable+1440 ( @ 0)</avrf:trace>
            <avrf:trace>vfnet!+7ff962cfb42e ( @ 0)</avrf:trace>
            <avrf:trace>WININET!UrlCacheCreateContainer+2614 ( @ 0)</avrf:trace>
            <avrf:trace>WININET!UrlCacheCreateContainer+2f44 ( @ 0)</avrf:trace>
            <avrf:trace>WININET!InternetTimeToSystemTimeA+ad ( @ 0)</avrf:trace>
            <avrf:trace>WININET!InternetOpenW+12f ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!DllCanUnloadNow+4c3b ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960bf2bab ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960bf24e3 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c4ba86 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c4a32a ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960bf4325 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c4eb32 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c46098 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c45403 ( @ 0)</avrf:trace>
            <avrf:trace>ConsoleApplication1!Windows::Web::Http::IHttpClient::GetAsync+32 (c:\program files (x86)\microsoft visual studio 12.0\vc\include\xmemory0 @ 15732480)</avrf:trace>
            <avrf:trace>ConsoleApplication1!main+446 (c:\users\mswarna\documents\visual studio 2013\projects\consoleapplication1\consoleapplication1\consoleapplication1.cpp @ 83)</avrf:trace>
            <avrf:trace>ConsoleApplication1!_main+9d (f:\dd\vctools\winrt\vccorlib\climain.cpp @ 52)</avrf:trace>
            <avrf:trace>ConsoleApplication1!__tmainCRTStartup+10f (f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c @ 626)</avrf:trace>
            <avrf:trace>KERNEL32!BaseThreadInitThunk+d ( @ 0)</avrf:trace>
            <avrf:trace>ntdll!RtlUserThreadStart+1d ( @ 0)</avrf:trace>
        </avrf:stackTrace>
    </avrf:logEntry>
    <avrf:logEntry Time="2014-05-06 : 17:44:16" LayerName="LuaPriv" StopCode="0x331B" Severity="Error">
        <avrf:message>Access was restricted to trusted users only.</avrf:message>
        <avrf:formatmessage>RegOpenKeyExW: Key (\REGISTRY\MACHINE\SYSTEM\ControlSet001\Services\WinSock2\Parameters) only grants requested &apos;DELETE&apos; to &apos;BUILTIN\Administrators, NT AUTHORITY\SYSTEM&apos;</avrf:formatmessage>
        <avrf:parameter1>7ff962d835b0 - Object Type</avrf:parameter1>
        <avrf:parameter2>16535e9f60 - Object Name</avrf:parameter2>
        <avrf:parameter3>10000 - Access Mask</avrf:parameter3>
        <avrf:parameter4>16535f5fa0 - String SID</avrf:parameter4>
        <avrf:stackTrace>
            <avrf:trace>vfluapriv!+7ff962d88714 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d888d2 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d88d20 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d88e99 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d893fe ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d895f9 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d928ec ( @ 0)</avrf:trace>
            <avrf:trace>WS2_32!WahCreateHandleContextTable+1d1 ( @ 0)</avrf:trace>
            <avrf:trace>WS2_32!WahCreateHandleContextTable+15b0 ( @ 0)</avrf:trace>
            <avrf:trace>WS2_32!WahCreateHandleContextTable+1551 ( @ 0)</avrf:trace>
            <avrf:trace>WS2_32!WahCreateHandleContextTable+1440 ( @ 0)</avrf:trace>
            <avrf:trace>vfnet!+7ff962cfb42e ( @ 0)</avrf:trace>
            <avrf:trace>WININET!UrlCacheCreateContainer+2614 ( @ 0)</avrf:trace>
            <avrf:trace>WININET!UrlCacheCreateContainer+2f44 ( @ 0)</avrf:trace>
            <avrf:trace>WININET!InternetTimeToSystemTimeA+ad ( @ 0)</avrf:trace>
            <avrf:trace>WININET!InternetOpenW+12f ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!DllCanUnloadNow+4c3b ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960bf2bab ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960bf24e3 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c4ba86 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c4a32a ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960bf4325 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c4eb32 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c46098 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c45403 ( @ 0)</avrf:trace>
            <avrf:trace>ConsoleApplication1!Windows::Web::Http::IHttpClient::GetAsync+32 (c:\program files (x86)\microsoft visual studio 12.0\vc\include\xmemory0 @ 15732480)</avrf:trace>
            <avrf:trace>ConsoleApplication1!main+446 (c:\users\mswarna\documents\visual studio 2013\projects\consoleapplication1\consoleapplication1\consoleapplication1.cpp @ 83)</avrf:trace>
            <avrf:trace>ConsoleApplication1!_main+9d (f:\dd\vctools\winrt\vccorlib\climain.cpp @ 52)</avrf:trace>
            <avrf:trace>ConsoleApplication1!__tmainCRTStartup+10f (f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c @ 626)</avrf:trace>
            <avrf:trace>KERNEL32!BaseThreadInitThunk+d ( @ 0)</avrf:trace>
            <avrf:trace>ntdll!RtlUserThreadStart+1d ( @ 0)</avrf:trace>
        </avrf:stackTrace>
    </avrf:logEntry>
    <avrf:logEntry Time="2014-05-06 : 17:44:16" LayerName="LuaPriv" StopCode="0x331B" Severity="Error">
        <avrf:message>Access was restricted to trusted users only.</avrf:message>
        <avrf:formatmessage>RegOpenKeyExW: Key (\REGISTRY\MACHINE\SYSTEM\ControlSet001\Services\WinSock2\Parameters) only grants requested &apos;WRITE_DAC&apos; to &apos;BUILTIN\Administrators, NT AUTHORITY\SYSTEM&apos;</avrf:formatmessage>
        <avrf:parameter1>7ff962d835b0 - Object Type</avrf:parameter1>
        <avrf:parameter2>16535e9f60 - Object Name</avrf:parameter2>
        <avrf:parameter3>40000 - Access Mask</avrf:parameter3>
        <avrf:parameter4>16535fffa0 - String SID</avrf:parameter4>
        <avrf:stackTrace>
            <avrf:trace>vfluapriv!+7ff962d88714 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d888d2 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d88d20 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d88e99 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d893fe ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d895f9 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d928ec ( @ 0)</avrf:trace>
            <avrf:trace>WS2_32!WahCreateHandleContextTable+1d1 ( @ 0)</avrf:trace>
            <avrf:trace>WS2_32!WahCreateHandleContextTable+15b0 ( @ 0)</avrf:trace>
            <avrf:trace>WS2_32!WahCreateHandleContextTable+1551 ( @ 0)</avrf:trace>
            <avrf:trace>WS2_32!WahCreateHandleContextTable+1440 ( @ 0)</avrf:trace>
            <avrf:trace>vfnet!+7ff962cfb42e ( @ 0)</avrf:trace>
            <avrf:trace>WININET!UrlCacheCreateContainer+2614 ( @ 0)</avrf:trace>
            <avrf:trace>WININET!UrlCacheCreateContainer+2f44 ( @ 0)</avrf:trace>
            <avrf:trace>WININET!InternetTimeToSystemTimeA+ad ( @ 0)</avrf:trace>
            <avrf:trace>WININET!InternetOpenW+12f ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!DllCanUnloadNow+4c3b ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960bf2bab ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960bf24e3 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c4ba86 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c4a32a ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960bf4325 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c4eb32 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c46098 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c45403 ( @ 0)</avrf:trace>
            <avrf:trace>ConsoleApplication1!Windows::Web::Http::IHttpClient::GetAsync+32 (c:\program files (x86)\microsoft visual studio 12.0\vc\include\xmemory0 @ 15732480)</avrf:trace>
            <avrf:trace>ConsoleApplication1!main+446 (c:\users\mswarna\documents\visual studio 2013\projects\consoleapplication1\consoleapplication1\consoleapplication1.cpp @ 83)</avrf:trace>
            <avrf:trace>ConsoleApplication1!_main+9d (f:\dd\vctools\winrt\vccorlib\climain.cpp @ 52)</avrf:trace>
            <avrf:trace>ConsoleApplication1!__tmainCRTStartup+10f (f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c @ 626)</avrf:trace>
            <avrf:trace>KERNEL32!BaseThreadInitThunk+d ( @ 0)</avrf:trace>
            <avrf:trace>ntdll!RtlUserThreadStart+1d ( @ 0)</avrf:trace>
        </avrf:stackTrace>
    </avrf:logEntry>
    <avrf:logEntry Time="2014-05-06 : 17:44:16" LayerName="LuaPriv" StopCode="0x331B" Severity="Error">
        <avrf:message>Access was restricted to trusted users only.</avrf:message>
        <avrf:formatmessage>RegOpenKeyExW: Key (\REGISTRY\MACHINE\SYSTEM\ControlSet001\Services\WinSock2\Parameters) only grants requested &apos;WRITE_OWNER&apos; to &apos;BUILTIN\Administrators, NT AUTHORITY\SYSTEM&apos;</avrf:formatmessage>
        <avrf:parameter1>7ff962d835b0 - Object Type</avrf:parameter1>
        <avrf:parameter2>16535e9f60 - Object Name</avrf:parameter2>
        <avrf:parameter3>80000 - Access Mask</avrf:parameter3>
        <avrf:parameter4>16535fdfa0 - String SID</avrf:parameter4>
        <avrf:stackTrace>
            <avrf:trace>vfluapriv!+7ff962d88714 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d888d2 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d88d20 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d88e99 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d893fe ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d895f9 ( @ 0)</avrf:trace>
            <avrf:trace>vfluapriv!+7ff962d928ec ( @ 0)</avrf:trace>
            <avrf:trace>WS2_32!WahCreateHandleContextTable+1d1 ( @ 0)</avrf:trace>
            <avrf:trace>WS2_32!WahCreateHandleContextTable+15b0 ( @ 0)</avrf:trace>
            <avrf:trace>WS2_32!WahCreateHandleContextTable+1551 ( @ 0)</avrf:trace>
            <avrf:trace>WS2_32!WahCreateHandleContextTable+1440 ( @ 0)</avrf:trace>
            <avrf:trace>vfnet!+7ff962cfb42e ( @ 0)</avrf:trace>
            <avrf:trace>WININET!UrlCacheCreateContainer+2614 ( @ 0)</avrf:trace>
            <avrf:trace>WININET!UrlCacheCreateContainer+2f44 ( @ 0)</avrf:trace>
            <avrf:trace>WININET!InternetTimeToSystemTimeA+ad ( @ 0)</avrf:trace>
            <avrf:trace>WININET!InternetOpenW+12f ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!DllCanUnloadNow+4c3b ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960bf2bab ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960bf24e3 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c4ba86 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c4a32a ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960bf4325 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c4eb32 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c46098 ( @ 0)</avrf:trace>
            <avrf:trace>Windows.Web.Http!+7ff960c45403 ( @ 0)</avrf:trace>
            <avrf:trace>ConsoleApplication1!Windows::Web::Http::IHttpClient::GetAsync+32 (c:\program files (x86)\microsoft visual studio 12.0\vc\include\xmemory0 @ 15732480)</avrf:trace>
            <avrf:trace>ConsoleApplication1!main+446 (c:\users\mswarna\documents\visual studio 2013\projects\consoleapplication1\consoleapplication1\consoleapplication1.cpp @ 83)</avrf:trace>
            <avrf:trace>ConsoleApplication1!_main+9d (f:\dd\vctools\winrt\vccorlib\climain.cpp @ 52)</avrf:trace>
            <avrf:trace>ConsoleApplication1!__tmainCRTStartup+10f (f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c @ 626)</avrf:trace>
            <avrf:trace>KERNEL32!BaseThreadInitThunk+d ( @ 0)</avrf:trace>
            <avrf:trace>ntdll!RtlUserThreadStart+1d ( @ 0)</avrf:trace>
        </avrf:stackTrace>
    </avrf:logEntry>

示例代码:

Windows::Web::Http::HttpClient^ httpClient;
Windows::Web::Http::HttpResponseMessage^ response;
httpClient = ref new HttpClient();
HttpRequestHeaderCollection ^headers = httpClient->DefaultRequestHeaders;
headers->UserAgent->ParseAdd("ie");
headers->UserAgent->ParseAdd("Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)");

Uri^ resourceUri;
response = ref new HttpResponseMessage();

String^ uriString = "http://yahoo.co.in";

try
{
    resourceUri = ref new Uri(uriString);
}
catch (Exception ^ex)
{
    cout << "\nInvalid URI, please re-enter a valid URI.";
    return 0;
}

if (resourceUri->SchemeName != "http" && resourceUri->SchemeName != "https")
{
    cout << "\nOnly 'http' and 'https' schemes supported. Please re-enter URI";
    return 0;
}

String^ responseBodyAsText;

cout << "\nWaiting for response ...";

create_task(httpClient->GetAsync(resourceUri)).then([=](HttpResponseMessage^ response)
{
    response->EnsureSuccessStatusCode();
    String^ outputStr = response->StatusCode.ToString() + " " + response->ReasonPhrase;
    cout << outputStr->Data();

    return create_task(response->Content->ReadAsStringAsync());
}).then([=](String^ responseBodyAsText){

    wstring fooW(responseBodyAsText->Begin());
    string fooA(fooW.begin(), fooW.end());
    const char* charStr = fooA.c_str();
    cout << "\n Response Data = " << charStr;
}).then([=](task<void> prevTask)
{
    try
    {
        prevTask.get();
    }
    catch (Exception ^ex)
    {
        String^ errorStr = "Error = " + ex->HResult + "  Message: " + ex->Message;
        cout << errorStr->Data();
        return;
    }
});

创建项目的步骤【步骤 3、4、5 添加 WinRT 支持以使用 windows.web.httpclient】:

  1. 在标准用户模式下打开 VS 2013 Professional。
  2. 转到文件->新建->项目->已安装->模板->Visual C++->Win32->Win 32 控制台应用程序并创建。
  3. 在 C/C++->General 选项卡中,将“使用 Windows 运行时扩展”设置为 Yes (/ZW)
  4. 设置/通用
  5. 将 Windows.winmd 和 Platform.winmd 路径添加到“其他 #using 目录”

我们可以忽略这些错误还是有其他替代方法来完成 http(s) 任务?

一种方法是为 http 相关任务使用 Out-of-Proc COM 服务器,应用程序将使用 COM Elevation Moniker 来提升进程外服务器(在应用程序验证程序中尝试并成功,没有任何错误)。[再一次,这个 COM 提升是不是有点复杂(至少在这种情况下),对于每次调用,我们都必须提升进程并显示 UAC 屏蔽图标?] 如果没有其他选择,只能进行提升,那么我有以下疑问:

  • 从 UAC 角度处理网络相关任务,我们应该选择“Admin COM Object Model”还是“Back-End Service Model”?

  • 对于每个 http(s) 调用,必须使用 UAC 盾牌图标提示用户进行提升?

  • COM 客户端和 COM 服务器都应该通过 App 验证程序测试吗?还是只应使用 App Verifier 检查客户端?如果 com 服务器也应该通过,那么是否有任何推荐的设计更改(例如在安装过程中以管理员模式启动 COM 服务器等),我们应该考虑因为当前 COM 服务器在所有 COM 实例化期间使用 App Verifier 引发 LuaPriv 相关错误初始化发生。

4

0 回答 0