Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
azure-cloud-mining-script
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Recolic
azure-cloud-mining-script
Commits
d8d403b2
There was an error fetching the commit references. Please try again later.
Commit
d8d403b2
authored
7 years ago
by
fireice-uk
Browse files
Options
Downloads
Patches
Plain Diff
Non-manifest UAC elevation
parent
2b9bcc2d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+0
-4
0 additions, 4 deletions
CMakeLists.txt
xmrstak/cli/cli-miner.cpp
+10
-1
10 additions, 1 deletion
xmrstak/cli/cli-miner.cpp
xmrstak/misc/uac.hpp
+44
-0
44 additions, 0 deletions
xmrstak/misc/uac.hpp
with
54 additions
and
5 deletions
CMakeLists.txt
+
0
−
4
View file @
d8d403b2
...
...
@@ -401,10 +401,6 @@ set(LIBRARY_OUTPUT_PATH "bin")
target_link_libraries
(
xmr-stak
${
LIBS
}
xmr-stak-c xmr-stak-backend
)
if
(
CMAKE_CXX_COMPILER_ID MATCHES
"MSVC"
)
set_property
(
TARGET xmr-stak PROPERTY LINK_FLAGS
"/level='requireAdministrator' /uiAccess='false'"
)
endif
()
################################################################################
# Install
################################################################################
...
...
This diff is collapsed.
Click to expand it.
xmrstak/cli/cli-miner.cpp
+
10
−
1
View file @
d8d403b2
...
...
@@ -33,7 +33,11 @@
#include
"xmrstak/version.hpp"
#ifndef CONF_NO_HTTPD
# include "xmrstak/http//httpd.hpp"
# include "xmrstak/http/httpd.hpp"
#endif
#ifdef _WIN32
# include "xmrstak/misc/uac.hpp"
#endif
#include
<stdlib.h>
...
...
@@ -88,6 +92,11 @@ void help()
int
main
(
int
argc
,
char
*
argv
[])
{
#ifdef _WIN32
if
(
!
IsElevated
()
&&
SelfElevate
(
argv
[
0
]))
return
0
;
#endif
#ifndef CONF_NO_TLS
SSL_library_init
();
SSL_load_error_strings
();
...
...
This diff is collapsed.
Click to expand it.
xmrstak/misc/uac.hpp
0 → 100644
+
44
−
0
View file @
d8d403b2
#pragma once
#include
<windows.h>
BOOL
IsElevated
()
{
BOOL
fRet
=
FALSE
;
HANDLE
hToken
=
NULL
;
if
(
OpenProcessToken
(
GetCurrentProcess
(),
TOKEN_QUERY
,
&
hToken
))
{
TOKEN_ELEVATION
Elevation
;
DWORD
cbSize
=
sizeof
(
TOKEN_ELEVATION
);
if
(
GetTokenInformation
(
hToken
,
TokenElevation
,
&
Elevation
,
sizeof
(
Elevation
),
&
cbSize
))
fRet
=
Elevation
.
TokenIsElevated
;
}
if
(
hToken
)
CloseHandle
(
hToken
);
return
fRet
;
}
BOOL
SelfElevate
(
const
char
*
my_path
)
{
if
(
IsElevated
())
return
FALSE
;
SHELLEXECUTEINFO
shExecInfo
=
{
0
};
shExecInfo
.
cbSize
=
sizeof
(
SHELLEXECUTEINFO
);
shExecInfo
.
fMask
=
NULL
;
shExecInfo
.
hwnd
=
NULL
;
shExecInfo
.
lpVerb
=
"runas"
;
shExecInfo
.
lpFile
=
my_path
;
shExecInfo
.
lpParameters
=
NULL
;
shExecInfo
.
lpDirectory
=
NULL
;
shExecInfo
.
nShow
=
SW_SHOW
;
shExecInfo
.
hInstApp
=
NULL
;
if
(
!
ShellExecuteEx
(
&
shExecInfo
))
return
FALSE
;
// Hide our window and loiter in the background to make scripting easier
// ShowWindow(GetConsoleWindow(), SW_HIDE);
// WaitForSingleObject(shExecInfo.hProcess, INFINITE);
return
TRUE
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment