mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
naive USER32.ExitWindows
svn path=/trunk/; revision=469
This commit is contained in:
parent
19c00dc04f
commit
6ddcb50e38
3 changed files with 184 additions and 28 deletions
|
@ -681,7 +681,8 @@ SetFileTime = SetFileTime@16
|
||||||
;SetHandleCount@4
|
;SetHandleCount@4
|
||||||
;SetHandleInformation@12
|
;SetHandleInformation@12
|
||||||
;SetLastConsoleEventActive@0
|
;SetLastConsoleEventActive@0
|
||||||
;SetLastError@4
|
SetLastError = SetLastError@4
|
||||||
|
SetLastError@4
|
||||||
SetLocalTime@4
|
SetLocalTime@4
|
||||||
SetLocalTime = SetLocalTime@4
|
SetLocalTime = SetLocalTime@4
|
||||||
;SetLocaleInfoA@12
|
;SetLocaleInfoA@12
|
||||||
|
|
|
@ -1,58 +1,83 @@
|
||||||
|
# $Id: makefile_rex,v 1.2 1999/05/15 13:35:57 ea Exp $
|
||||||
|
#
|
||||||
|
# ReactOS Operating System
|
||||||
|
#
|
||||||
|
# Makefile for user32.dll
|
||||||
|
#
|
||||||
include ../../rules.mak
|
include ../../rules.mak
|
||||||
|
|
||||||
|
TARGET=user32
|
||||||
|
|
||||||
ifneq ($(HOST),mingw32-windows)
|
ifneq ($(HOST),mingw32-windows)
|
||||||
ifneq ($(HOST),mingw32-linux)
|
ifneq ($(HOST),mingw32-linux)
|
||||||
DLLTARGET=user32.a
|
DLLTARGET=$(TARGET).a
|
||||||
else
|
else
|
||||||
DLLTARGET=user32.dll
|
DLLTARGET=$(TARGET).dll
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
DLLTARGET=user32.dll
|
DLLTARGET=$(TARGET).dll
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all: $(DLLTARGET)
|
all: $(DLLTARGET)
|
||||||
|
|
||||||
|
|
||||||
MISC_OBJECTS = misc/sprintf.o misc/dllmain.o
|
MISC_OBJECTS = misc/sprintf.o misc/exitwin.o misc/dllmain.o
|
||||||
|
|
||||||
RESOURCE_OBJECT = user32.coff
|
RESOURCE_OBJECT = $(TARGET).coff
|
||||||
|
|
||||||
|
|
||||||
OBJECTS = $(MISC_OBJECTS) $(RESOURCE_OBJECT)
|
OBJECTS = $(MISC_OBJECTS) $(RESOURCE_OBJECT)
|
||||||
|
|
||||||
ifeq ($(DOSCLI),yes)
|
ifeq ($(DOSCLI),yes)
|
||||||
CLEAN_FILES = misc\*.o \
|
CLEAN_FILES = misc\*.o \
|
||||||
user32.o user32.a junk.tmp base.tmp temp.exp user32.dll user32.sym
|
$(TARGET).o $(TARGET).a junk.tmp base.tmp temp.exp $(TARGET).dll $(TARGET).sym
|
||||||
else
|
else
|
||||||
CLEAN_FILES = misc/*.o \
|
CLEAN_FILES = misc/*.o \
|
||||||
user32.o user32.a junk.tmp base.tmp temp.exp user32.dll user32.sym
|
$(TARGET).o $(TARGET).a junk.tmp base.tmp temp.exp $(TARGET).dll $(TARGET).sym
|
||||||
endif
|
endif
|
||||||
|
|
||||||
user32.coff: user32.rc ../../include/reactos/resource.h
|
$(TARGET).coff: $(TARGET).rc ../../include/reactos/resource.h
|
||||||
windres user32.rc user32.coff
|
$(RC) $(TARGET).rc $(TARGET).coff
|
||||||
|
|
||||||
user32.a: $(OBJECTS)
|
$(TARGET).a: $(OBJECTS)
|
||||||
$(AR) csr user32.a $(OBJECTS)
|
$(AR) csr $(TARGET).a $(OBJECTS)
|
||||||
|
|
||||||
user32.dll: $(DLLMAIN) $(OBJECTS) user32.def
|
$(TARGET).dll: $(DLLMAIN) $(OBJECTS) $(TARGET).def
|
||||||
$(LD) -r $(OBJECTS) -o user32.o
|
$(LD) -r $(OBJECTS) -o $(TARGET).o
|
||||||
$(DLLTOOL) --dllname user32.dll --def user32.def \
|
$(DLLTOOL) \
|
||||||
--output-lib user32.a --add-stdcall-alias \
|
--dllname $(TARGET).dll \
|
||||||
|
--def $(TARGET).def \
|
||||||
|
--output-lib $(TARGET).a \
|
||||||
|
--add-stdcall-alias \
|
||||||
--kill-at
|
--kill-at
|
||||||
$(CC) -specs=user32_specs -mdll -o junk.tmp \
|
$(CC) $(TARGET).o \
|
||||||
-Wl,--base-file,base.tmp user32.o ../ntdll/ntdll.a
|
../ntdll/ntdll.a \
|
||||||
|
../kernel32/kernel32.a \
|
||||||
|
-specs=$(TARGET)_specs \
|
||||||
|
-mdll \
|
||||||
|
-o junk.tmp \
|
||||||
|
-Wl,--base-file,base.tmp
|
||||||
- $(RM) junk.tmp
|
- $(RM) junk.tmp
|
||||||
$(DLLTOOL) --dllname user32.dll --base-file base.tmp \
|
$(DLLTOOL) \
|
||||||
--output-exp temp.exp --def user32.def \
|
--dllname $(TARGET).dll \
|
||||||
--add-stdcall-alias --kill-at
|
--base-file base.tmp \
|
||||||
|
--output-exp temp.exp \
|
||||||
|
--def $(TARGET).def \
|
||||||
|
--add-stdcall-alias \
|
||||||
|
--kill-at
|
||||||
- $(RM) base.tmp
|
- $(RM) base.tmp
|
||||||
$(CC) -specs=user32_specs -mdll -o user32.dll user32.o ../ntdll/ntdll.a\
|
$(CC) $(TARGET).o \
|
||||||
|
../ntdll/ntdll.a\
|
||||||
|
../kernel32/kernel32.a \
|
||||||
|
-specs=$(TARGET)_specs \
|
||||||
|
-mdll \
|
||||||
|
-o $(TARGET).dll \
|
||||||
-Wl,--image-base,0x70000000 \
|
-Wl,--image-base,0x70000000 \
|
||||||
-Wl,--file-alignment,0x1000 \
|
-Wl,--file-alignment,0x1000 \
|
||||||
-Wl,--section-alignment,0x1000 \
|
-Wl,--section-alignment,0x1000 \
|
||||||
-Wl,temp.exp
|
-Wl,temp.exp
|
||||||
- $(RM) temp.exp
|
- $(RM) temp.exp
|
||||||
$(NM) --numeric-sort user32.dll > user32.sym
|
$(NM) --numeric-sort $(TARGET).dll > $(TARGET).sym
|
||||||
|
|
||||||
clean: $(CLEAN_FILES:%=%_clean)
|
clean: $(CLEAN_FILES:%=%_clean)
|
||||||
|
|
||||||
|
@ -61,3 +86,4 @@ $(CLEAN_FILES:%=%_clean): %_clean:
|
||||||
|
|
||||||
.PHONY: clean $(CLEAN_FILES:%=%_clean)
|
.PHONY: clean $(CLEAN_FILES:%=%_clean)
|
||||||
|
|
||||||
|
# EOF
|
||||||
|
|
129
reactos/lib/user32/misc/exitwin.c
Normal file
129
reactos/lib/user32/misc/exitwin.c
Normal file
|
@ -0,0 +1,129 @@
|
||||||
|
/* $Id: exitwin.c,v 1.1 1999/05/15 13:35:57 ea Exp $
|
||||||
|
*
|
||||||
|
* exitwin.c
|
||||||
|
*
|
||||||
|
* Copyright (c) 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.
|
||||||
|
*
|
||||||
|
* --------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* ReactOS user32.dll ExitWindows functions.
|
||||||
|
*
|
||||||
|
* 19990515 EA Naive implementation.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <ddk/ntddk.h>
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* ExitWindowsEx
|
||||||
|
*
|
||||||
|
* ARGUMENTS
|
||||||
|
* uFlags shutdown operation
|
||||||
|
* EWX_FORCE Processes are killed.
|
||||||
|
*
|
||||||
|
* EWX_LOGOFF Caller owned processed are killed.
|
||||||
|
*
|
||||||
|
* EWX_POWEROFF Turns off the power.
|
||||||
|
*
|
||||||
|
* EWX_REBOOT Restart the system.
|
||||||
|
* SE_SHUTDOWN_NAME privilege reqired.
|
||||||
|
*
|
||||||
|
* EWX_SHUTDOWN Same as EWX_REBOOT, but rebooting.
|
||||||
|
* SE_SHUTDOWN_NAME privilege reqired.
|
||||||
|
*
|
||||||
|
* dwReserved reserved
|
||||||
|
*
|
||||||
|
* REVISIONS
|
||||||
|
* 1999-05-15 EA
|
||||||
|
*/
|
||||||
|
BOOL
|
||||||
|
__stdcall
|
||||||
|
ExitWindowsEx(
|
||||||
|
UINT uFlags,
|
||||||
|
DWORD dwReserved
|
||||||
|
)
|
||||||
|
{
|
||||||
|
NTSTATUS rv;
|
||||||
|
|
||||||
|
if (uFlags & (
|
||||||
|
EWX_FORCE |
|
||||||
|
EWX_LOGOFF |
|
||||||
|
EWX_POWEROFF |
|
||||||
|
EWX_REBOOT |
|
||||||
|
EWX_SHUTDOWN
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
/* Unknown flag! */
|
||||||
|
SetLastError(ERROR_INVALID_FLAG_NUMBER);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
/* FIXME: call csrss.exe;
|
||||||
|
*
|
||||||
|
* Naive implementation: call the kernel directly.
|
||||||
|
* This code will be moved in csrss.exe when
|
||||||
|
* available.
|
||||||
|
*/
|
||||||
|
if (EWX_POWEROFF & uFlags)
|
||||||
|
{
|
||||||
|
rv = NtShutdownSystem(ShutdownPowerOff);
|
||||||
|
}
|
||||||
|
else if (EWX_REBOOT & uFlags)
|
||||||
|
{
|
||||||
|
rv = NtShutdownSystem(ShutdownReboot);
|
||||||
|
}
|
||||||
|
else if (EWX_SHUTDOWN & uFlags)
|
||||||
|
{
|
||||||
|
rv = NtShutdownSystem(ShutdownNoReboot);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* How to implement others flags semantics? */
|
||||||
|
SetLastError(ERROR_INVALID_FLAG_NUMBER);
|
||||||
|
rv = (NTSTATUS) -1;
|
||||||
|
}
|
||||||
|
return NT_SUCCESS(rv)
|
||||||
|
? TRUE
|
||||||
|
: FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* ExitWindows
|
||||||
|
*
|
||||||
|
* ARGUMENTS
|
||||||
|
* dwReserved, reserved
|
||||||
|
* uReserved reserved
|
||||||
|
*/
|
||||||
|
BOOL
|
||||||
|
__stdcall
|
||||||
|
ExitWindows(
|
||||||
|
DWORD dwReserved, // reserved
|
||||||
|
UINT uReserved // reserved
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return ExitWindowsEx(
|
||||||
|
EWX_SHUTDOWN,
|
||||||
|
dwReserved
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* EOF */
|
Loading…
Reference in a new issue