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
Post a Comment