这个函数是用来正常提权的,内部提权,只有用户有权限(管理员)时才有用

要注意lpVerb要用open而不是书上说的runna,有待看文档。

#include <windows.h>
#include <stdio.h>
#include <tchar.h>
#include <strsafe.h>

int _tmain(int argc, TCHAR* argv[])
{

    _SHELLEXECUTEINFOW sei = { sizeof(SHELLEXECUTEINFO) };
    sei.lpVerb = L"open";
    sei.lpFile = L"E:\\Net-Keeper\\NetKeeper\\NetKeeper.exe";
    sei.nShow = SW_SHOWNORMAL;


    if (ShellExecuteEx(&sei))
    {
        if (sei.hProcess)
            WaitForSingleObject(sei.hProcess, INFINITE);
    }

    return 0;
}