MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / RelaunchElevated

Function RelaunchElevated

src/Notepad2.c:6108–6139  ·  view source on GitHub ↗

============================================================================= RelaunchElevated()

Source from the content-addressed store, hash-verified

6106//
6107//
6108BOOL RelaunchElevated()
6109{
6110 if ( !IsVista() || fIsElevated || !flagRelaunchElevated || flagDisplayHelp ) {
6111 return ( FALSE );
6112 } else {
6113 LPWSTR lpCmdLine;
6114 LPWSTR lpArg1, lpArg2;
6115 STARTUPINFO si;
6116 SHELLEXECUTEINFO sei;
6117 si.cb = sizeof ( STARTUPINFO );
6118 GetStartupInfo ( &si );
6119 lpCmdLine = GetCommandLine();
6120 lpArg1 = LocalAlloc ( LPTR, sizeof ( WCHAR ) * ( lstrlen ( lpCmdLine ) + 1 ) );
6121 lpArg2 = LocalAlloc ( LPTR, sizeof ( WCHAR ) * ( lstrlen ( lpCmdLine ) + 1 ) );
6122 ExtractFirstArgument ( lpCmdLine, lpArg1, lpArg2 );
6123 if ( lstrlen ( lpArg1 ) ) {
6124 ZeroMemory ( &sei, sizeof ( SHELLEXECUTEINFO ) );
6125 sei.cbSize = sizeof ( SHELLEXECUTEINFO );
6126 sei.fMask = SEE_MASK_FLAG_NO_UI | /*SEE_MASK_NOASYNC*/0x00000100 | /*SEE_MASK_NOZONECHECKS*/0x00800000;
6127 sei.hwnd = GetForegroundWindow();
6128 sei.lpVerb = L"runas";
6129 sei.lpFile = lpArg1;
6130 sei.lpParameters = lpArg2;
6131 sei.lpDirectory = g_wchWorkingDirectory;
6132 sei.nShow = si.wShowWindow;
6133 ShellExecuteEx ( &sei );
6134 }
6135 LocalFree ( lpArg1 );
6136 LocalFree ( lpArg2 );
6137 return ( TRUE );
6138 }
6139}
6140//=============================================================================
6141//
6142// SnapToDefaultPos()

Callers 1

WinMainFunction · 0.85

Calls 1

ExtractFirstArgumentFunction · 0.85

Tested by

no test coverage detected