c++ - SetSecurityInfo error = 6 -


i new c++ programming on windows kernel. last few hours been trying figure out how works. error setsecurityinfo(hnewdesktop) failed error = 6. passes first loop unable setsecurityinfo new desktop.

    hdesk dnew;     bool closedesk;     handle happ;     hdesk hthreaddt = getthreaddesktop(getcurrentthreadid());     //make new desktop     dnew = createdesktop(_t("test"), 0, 0, 0, desktop_switchdesktop|                                               desktop_writeobjects|                                               desktop_readobjects|                                               desktop_enumerate|                                               desktop_createwindow|                                               desktop_createmenu, null);      if(!dnew)     {         _tprintf(_t("failed create new desktop !!\n\n"));         return 0;     }  pacl psacl; psecurity_descriptor psecuritydescriptor; dword dwresult;  dwresult = getsecurityinfo(hthreaddt, se_window_object, label_security_information, null, null, null, &psacl, &psecuritydescriptor);  if (dwresult == error_success) {     if (psacl != null) {         dwresult = setsecurityinfo(_t("test"), se_window_object, label_security_information, null, null, null, psacl);          if (dwresult != error_success)             _tprintf(_t("setsecurityinfo(hnewdesktop) failed, error = %d"), dwresult);     }      localfree(psecuritydescriptor); } else {     _tprintf(_t("getsecurityinfo(hdefaultdesktop) failed, error = %d"), dwresult); } 

error code 6 error_invalid_handle. makes sense because passed _t("test") null terminated string , not desktop handle. pass dnew instead.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -