• <legend id='fhzTf'><style id='fhzTf'><dir id='fhzTf'><q id='fhzTf'></q></dir></style></legend>
  • <i id='fhzTf'><tr id='fhzTf'><dt id='fhzTf'><q id='fhzTf'><span id='fhzTf'><b id='fhzTf'><form id='fhzTf'><ins id='fhzTf'></ins><ul id='fhzTf'></ul><sub id='fhzTf'></sub></form><legend id='fhzTf'></legend><bdo id='fhzTf'><pre id='fhzTf'><center id='fhzTf'></center></pre></bdo></b><th id='fhzTf'></th></span></q></dt></tr></i><div id='fhzTf'><tfoot id='fhzTf'></tfoot><dl id='fhzTf'><fieldset id='fhzTf'></fieldset></dl></div>

      1. <small id='fhzTf'></small><noframes id='fhzTf'>

        <tfoot id='fhzTf'></tfoot>

          <bdo id='fhzTf'></bdo><ul id='fhzTf'></ul>
      2. C++ 登录任务计划错误:未完成帐户名称和安全 I

        时间:2023-08-01

        <small id='7Rc62'></small><noframes id='7Rc62'>

        <legend id='7Rc62'><style id='7Rc62'><dir id='7Rc62'><q id='7Rc62'></q></dir></style></legend>
          <bdo id='7Rc62'></bdo><ul id='7Rc62'></ul>
              • <i id='7Rc62'><tr id='7Rc62'><dt id='7Rc62'><q id='7Rc62'><span id='7Rc62'><b id='7Rc62'><form id='7Rc62'><ins id='7Rc62'></ins><ul id='7Rc62'></ul><sub id='7Rc62'></sub></form><legend id='7Rc62'></legend><bdo id='7Rc62'><pre id='7Rc62'><center id='7Rc62'></center></pre></bdo></b><th id='7Rc62'></th></span></q></dt></tr></i><div id='7Rc62'><tfoot id='7Rc62'></tfoot><dl id='7Rc62'><fieldset id='7Rc62'></fieldset></dl></div>

                  <tfoot id='7Rc62'></tfoot>
                    <tbody id='7Rc62'></tbody>
                • 本文介绍了C++ 登录任务计划错误:未完成帐户名称和安全 ID 之间的映射的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试在 Windows 7 上使用 C++ 编写一个 Windows 登录触发任务.

                  I am trying to write a windows Logon trigger task using C++ on Windows 7.

                  我正在关注 本微软教程.

                  但是我在将任务保存到根文件夹时遇到了问题.这里:

                  But I am facing problem in saving the task to root folder. Here:

                  //  ------------------------------------------------------
                      //  Save the task in the root folder.
                      IRegisteredTask *pRegisteredTask = NULL;
                  
                      hr = pRootFolder->RegisterTaskDefinition(
                              _bstr_t( wszTaskName ),
                              pTask,
                              TASK_CREATE_OR_UPDATE, 
                              _variant_t(L"Builtin\Administrators"), 
                              _variant_t(), 
                              TASK_LOGON_GROUP,
                              _variant_t(L""),
                              &pRegisteredTask);
                  

                  hr 出现错误的地方:未完成帐户名称和安全 ID 之间的映射

                  Where the hr is getting error : No Mapping between account names and security ids was done

                  我还尝试将 _variant_t(L"Builtin\Administrators") 替换为 _variant_t(L"S-1-5-32-544") 到 NULL out语言硬编码问题,仍然没有运气.

                  I also tried replacing _variant_t(L"Builtin\Administrators") with _variant_t(L"S-1-5-32-544") to NULL out language hard coding issue, still No luck.

                  我怎样才能让它发挥作用?

                  How can I make it work?

                  推荐答案

                  我怀疑您拥有的演示代码是 XP 时代的,并且尚未更新以匹配 Vista/Win7 规则.

                  I suspect the demo code you have is XP-era, and hasn't been updated to match the Vista/Win7 rules.

                  我在设置登录触发器后更新了示例以设置 LUA 设置,它似乎有效:

                  I updated the sample to set the LUA settings after setting the logon trigger, and it seems to work:

                      hr = pLogonTrigger->put_UserId(_bstr_t(L"DOMAINusername"));
                      if (FAILED(hr))
                      {
                          printf("
                  Cannot add user ID to logon trigger: %x", hr);
                          CoUninitialize();
                          return 1;
                      }
                  
                  
                      //*** NEW**** Set the LUA settings
                      CComPtr<IPrincipal>         pPrincipal;
                  
                      hr = pTask->get_Principal(&pPrincipal);
                      if (SUCCEEDED(hr))
                      {
                          hr = pPrincipal->put_RunLevel(TASK_RUNLEVEL_LUA);
                      }
                      if (SUCCEEDED(hr))
                      {
                          hr = pPrincipal->put_GroupId(_bstr_t(L"Builtin\Administrators"));
                      }
                      if (FAILED(hr))
                      {
                          printf("
                  Cannot set runlevel/groupid: %x", hr);
                          CoUninitialize();
                          return 1;
                      }
                  

                  如果你需要它在 XP 上运行,那么 get_Principal 调用很可能会失败,所以让这个失败通过.

                  If you need it to run on XP, then it's likely that the get_Principal call will fail, so let that failure through.

                  这篇关于C++ 登录任务计划错误:未完成帐户名称和安全 ID 之间的映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:C++:在 Windows 上使用 C++ 读写 BMP 文件的最简单方法 下一篇:GDI+ 是否具有标准图像编码器 CLSID?

                  相关文章

                  最新文章

                  <small id='uYWjA'></small><noframes id='uYWjA'>

                  • <bdo id='uYWjA'></bdo><ul id='uYWjA'></ul>

                  1. <i id='uYWjA'><tr id='uYWjA'><dt id='uYWjA'><q id='uYWjA'><span id='uYWjA'><b id='uYWjA'><form id='uYWjA'><ins id='uYWjA'></ins><ul id='uYWjA'></ul><sub id='uYWjA'></sub></form><legend id='uYWjA'></legend><bdo id='uYWjA'><pre id='uYWjA'><center id='uYWjA'></center></pre></bdo></b><th id='uYWjA'></th></span></q></dt></tr></i><div id='uYWjA'><tfoot id='uYWjA'></tfoot><dl id='uYWjA'><fieldset id='uYWjA'></fieldset></dl></div>

                    1. <tfoot id='uYWjA'></tfoot>
                    2. <legend id='uYWjA'><style id='uYWjA'><dir id='uYWjA'><q id='uYWjA'></q></dir></style></legend>