mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
remove obsolete shutdown tool from rosapps
svn path=/trunk/; revision=19755
This commit is contained in:
parent
ff15a308a5
commit
f9f4b54a9f
3 changed files with 0 additions and 204 deletions
|
@ -1,186 +0,0 @@
|
|||
/* $Id$
|
||||
*
|
||||
* EAU shutdown.c 1.4.1
|
||||
*
|
||||
* Copyright (C) 1997,1998,1999 Emanuele Aliberti
|
||||
*
|
||||
* --------------------------------------------------------------------
|
||||
*
|
||||
* This software is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this software; see the file COPYING.LIB. If
|
||||
* not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
* Cambridge, MA 02139, USA.
|
||||
*
|
||||
* --------------------------------------------------------------------
|
||||
* 1999-05-14 (Emanuele Aliberti)
|
||||
* Released version 1.4.1 under GNU GPL for the ReactOS project.
|
||||
* --------------------------------------------------------------------
|
||||
*/
|
||||
#define UNICODE
|
||||
#define _UNICODE
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <tchar.h>
|
||||
#include "../win32err.h"
|
||||
|
||||
#ifndef SE_PRIVILEGE_ENABLED
|
||||
#define NTOS_MODE_USER
|
||||
#include <ntos.h>
|
||||
#endif
|
||||
|
||||
|
||||
struct _EWX
|
||||
{
|
||||
CHAR mode;
|
||||
UINT id;
|
||||
};
|
||||
|
||||
static
|
||||
struct _EWX modes[] =
|
||||
{
|
||||
{ 'f', EWX_FORCE },
|
||||
{ 'l', EWX_LOGOFF },
|
||||
{ 'p', EWX_POWEROFF },
|
||||
{ 'r', EWX_REBOOT },
|
||||
{ 's', EWX_SHUTDOWN },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
static
|
||||
UINT
|
||||
DecodeArg( CHAR * modestr )
|
||||
{
|
||||
register int i;
|
||||
|
||||
if (modestr[0] != '-' && modestr[0] != '/')
|
||||
{
|
||||
return (UINT) -1;
|
||||
}
|
||||
for ( i = 0; modes[i].mode; ++i)
|
||||
{
|
||||
if (modestr[1] == modes[i].mode)
|
||||
{
|
||||
return modes[i].id;
|
||||
}
|
||||
}
|
||||
return (UINT) -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static
|
||||
const
|
||||
char * usage = "\
|
||||
Shutdown ver. 1.4.1 (compiled on %s, at %s)\n\
|
||||
Copyright (C) 1997-1999 Emanuele Aliberti\n\n\
|
||||
usage: %s [-f] [-l] [-p] [-r] [-s]\n\
|
||||
f (FORCE) processes are unconditionally terminated\n\
|
||||
l (LOGOFF) logs the current user off\n\
|
||||
p (POWEROFF) turns off the power, if possibile\n\
|
||||
r (REBOOT) reboots the system\n\
|
||||
s (SHUTDOWN) shuts down the system to a point at which\n\
|
||||
it is safe to turn off the power\n\n\
|
||||
Any other letter will print this help message.\n";
|
||||
|
||||
int
|
||||
main(
|
||||
int argc,
|
||||
char * argv []
|
||||
)
|
||||
{
|
||||
UINT mode;
|
||||
HANDLE h;
|
||||
TOKEN_PRIVILEGES tp;
|
||||
|
||||
mode = (argc == 2)
|
||||
? DecodeArg(argv[1])
|
||||
: DecodeArg("-?");
|
||||
if (mode == (UINT) -1)
|
||||
{
|
||||
fprintf(
|
||||
stderr,
|
||||
usage,
|
||||
__DATE__,
|
||||
__TIME__,
|
||||
argv[0]
|
||||
);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
/*
|
||||
* Get the current process token handle
|
||||
* so we can get shutdown privilege.
|
||||
*/
|
||||
if (FALSE == OpenProcessToken(
|
||||
GetCurrentProcess(),
|
||||
(TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY),
|
||||
& h
|
||||
)
|
||||
) {
|
||||
PrintWin32Error(
|
||||
L"while opening the process",
|
||||
GetLastError()
|
||||
);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
/*
|
||||
* Get the LUID for shutdown privilege.
|
||||
*/
|
||||
if (FALSE == LookupPrivilegeValue(
|
||||
NULL,
|
||||
SE_SHUTDOWN_NAME,
|
||||
& tp.Privileges[0].Luid
|
||||
)
|
||||
) {
|
||||
PrintWin32Error(
|
||||
L"while looking up privileges",
|
||||
GetLastError()
|
||||
);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
tp.PrivilegeCount = 1; /* One privilege to seat */
|
||||
tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
|
||||
/*
|
||||
* Get shutdown privilege for this process.
|
||||
*/
|
||||
if (FALSE == AdjustTokenPrivileges(
|
||||
h,
|
||||
FALSE,
|
||||
& tp,
|
||||
0,
|
||||
(PTOKEN_PRIVILEGES) NULL,
|
||||
0
|
||||
)
|
||||
) {
|
||||
PrintWin32Error(
|
||||
L"while adjusting shutdown privilege",
|
||||
GetLastError()
|
||||
);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
/* Now really exit! */
|
||||
if (FALSE == ExitWindowsEx(mode, 0))
|
||||
{
|
||||
PrintWin32Error(
|
||||
L"ExitWindowsEx",
|
||||
GetLastError()
|
||||
);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
/* $Id$ */
|
||||
|
||||
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Shutdown Utility (Win32)\0"
|
||||
#define REACTOS_STR_INTERNAL_NAME "shutdown\0"
|
||||
#define REACTOS_STR_ORIGINAL_FILENAME "shutdown.exe\0"
|
||||
#define REACTOS_STR_ORIGINAL_COPYRIGHT "1997-1999 Emanuele Aliberti\0"
|
||||
#include <reactos/version.rc>
|
|
@ -1,11 +0,0 @@
|
|||
<module name="shutdown" type="win32cui" installbase="system32" installname="shutdown.exe">
|
||||
<linkerflag>--numeric-sort</linkerflag>
|
||||
<define name="__USE_W32API" />
|
||||
<define name="_WIN32_IE">0x0501</define>
|
||||
<define name="_WIN32_WINNT">0x0501</define>
|
||||
<library>kernel32</library>
|
||||
<library>user32</library>
|
||||
<library>lib</library>
|
||||
<file>shutdown.c</file>
|
||||
<file>shutdown.rc</file>
|
||||
</module>
|
Loading…
Reference in a new issue