Qt Change file permissions

Source: Internet
Author: User

Qt Change file permissions

static void Changefilepermission (const QString &filepath)
{
#ifdef WIN32
QString cmd ("Icacls.exe \" ");
cmd + = FilePath;
cmd + = "\"/grant Everyone: (F) ";
Startupinfow si;
Process_information Pi;
ZeroMemory (&si, sizeof (SI));
SI.CB = sizeof (SI);

#ifndef _DEBUG
Si.dwflags = Startf_useshowwindow;
Si.wshowwindow = Sw_hide;
#endif


ZeroMemory (&pi, sizeof (PI));
CREATEPROCESSW (NULL,//No module name (with command line).
(wchar_t*) Cmd.utf16 (),//Command line.
NULL,//Process handle not inheritable.
NULL,//Thread handle not inheritable.
False,//Set handle inheritance to false.
0,//No creation flags.
NULL,//Use the parent ' s environment block.
NULL,//Use parent ' s starting directory.
&si,//Pointer to STARTUPINFO structure.
&PI); Pointer to Process_information structure.
WaitForSingleObject (pi.hprocess, INFINITE);
CloseHandle (pi.hprocess);
CloseHandle (Pi.hthread);
#endif
}

qt Change file permissions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.