The Eclipse executable launcher was unable to locate its companion shared library
#include <Windows.h> #include <tchar.h> /* 系统特权提升 @lpName: SE_SHUTDOWN_NAME 关机,重启权限 */ BOOL PrivilegePromote(LPCTSTR lpName) { HANDLE hToken = NULL; TOKEN_PRIVILEGES tkp = {0}; // 打开进程令牌 if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,&hToken)) { return FALSE; } // 查找系统权限的特权值 if (!LookupPrivilegeValue(NULL,lpName,&tkp.Privileges[0].Luid)) { CloseHandle(hToken); return TRUE; } // 调整令牌特权 if(!AdjustTokenPrivileges(hToken,FALSE,&tkp,sizeof(TOKEN_PRIVILEGES),NULL,NULL)) { CloseHandle(hToken); return FALSE; } return TRUE; } /* 系统启动控制:注销,重启,关机 @dwFlags:EWX_LOGOFF | EWX_REBOOT | EWX_SHUTDOWN @bForce:是否强制 */ BOOL StartUpContrl(DWORD dwFlags,BOOL bForce) { // 参数校验 if (dwFlags != EWX_LOGOFF && dwFlags != EWX_REBOOT && dwFlags != EWX_SHUTDOWN) { return FALSE; } // 获取系统版本,ExitWindowsEx 在NT平台上需要提升权限 OSVERSIONINFO osvi = {0}; osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); // 版本信息获取 if ( !GetVersionEx(&osvi)) { return FALSE; } // 是NT系统 需要进行权限提升 if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) { PrivilegePromote(SE_SHUTDOWN_NAME); } dwFlags |= (bForce != FALSE)? EWX_FORCE : EWX_FORCEIFHUNG; return ExitWindowsEx(dwFlags, 0); } int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nShowCmd ) { if (_tcscmp(lpCmdLine,_T("/r")) == 0){ StartUpContrl(EWX_REBOOT,TRUE); } else if (_tcscmp(lpCmdLine,_T("/s")) == 0){ StartUpContrl(EWX_SHUTDOWN,TRUE); } else if (_tcscmp(lpCmdLine,_T("/l")) == 0){ StartUpContrl(EWX_LOGOFF,TRUE); } return 0; }
The Eclipse executable launcher was unable to locate its companion shared library,古老的榕树,5-wow.com
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。