mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 17:05:46 +00:00
Small addition to token.c
svn path=/trunk/; revision=671
This commit is contained in:
parent
52498a577a
commit
15e29ff254
4 changed files with 65 additions and 24 deletions
|
@ -22,7 +22,7 @@ BEGIN
|
|||
BEGIN
|
||||
VALUE "CompanyName", RES_STR_COMPANY_NAME
|
||||
VALUE "FileDescription", "Advanced W32 Base API\0"
|
||||
VALUE "FileVersion", RES_STR_FILE_VERSION
|
||||
VALUE "FileVersion", "post 0.0.13\0"
|
||||
VALUE "InternalName", "advapi32\0"
|
||||
VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT
|
||||
VALUE "OriginalFilename", "advapi32.dll\0"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: makefile,v 1.7 1999/08/29 13:44:52 dwelch Exp $
|
||||
# $Id: makefile,v 1.8 1999/09/25 06:25:51 ariadne Exp $
|
||||
#
|
||||
# Makefile for ReactOS advapi32.dll
|
||||
#
|
||||
|
@ -18,7 +18,7 @@ endif
|
|||
|
||||
|
||||
MISC_OBJECTS = misc/dllmain.o misc/shutdown.o \
|
||||
misc/sysfunc.o misc/stubs.o
|
||||
misc/sysfunc.o
|
||||
|
||||
REGISTRY_OBJECTS = reg/reg.o
|
||||
|
||||
|
@ -37,6 +37,9 @@ OBJECTS = $(MISC_OBJECTS) $(REGISTRY_OBJECTS) $(SECURITY_OBJECTS) \
|
|||
|
||||
all: $(DLLTARGET)
|
||||
|
||||
$(TARGET).coff: $(TARGET).rc ../../include/reactos/resource.h
|
||||
windres $(TARGET).rc $(TARGET).coff
|
||||
|
||||
$(TARGET).a: $(OBJECTS)
|
||||
$(LD) -r $(OBJECTS) -o $(TARGET).a
|
||||
|
||||
|
@ -76,7 +79,6 @@ $(TARGET).dll: $(DLLMAIN) $(OBJECTS) $(TARGET).def
|
|||
- $(RM) temp.exp
|
||||
$(NM) --numeric-sort $(TARGET).dll > $(TARGET).sym
|
||||
|
||||
$(TARGET).coff: $(TARGET).rc ../../include/reactos/resource.h
|
||||
|
||||
clean:
|
||||
|
||||
|
|
|
@ -358,7 +358,7 @@ RegOpenKeyW (
|
|||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
|
||||
SubKeyString.Buffer = (LPWSTR)lpSubKey;
|
||||
SubKeyString.Length = wcslen(lpSubKey);
|
||||
SubKeyString.Length = wcslen(SubKeyString.Buffer);
|
||||
SubKeyString.MaximumLength = SubKeyString.Length;
|
||||
|
||||
ObjectAttributes.RootDirectory = hKey;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/advapi32/token/token.c
|
||||
* PURPOSE: Registry functions
|
||||
* PURPOSE: Token functions
|
||||
* PROGRAMMER: Ariadne ( ariadne@xs4all.nl)
|
||||
* UPDATE HISTORY:
|
||||
* Created 01/11/98
|
||||
|
@ -168,25 +168,19 @@ SetThreadToken (
|
|||
HANDLE TokenHandle
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return FALSE;
|
||||
NTSTATUS errCode;
|
||||
HANDLE hThread = NtCurrentThread();
|
||||
if ( ThreadHandle != NULL )
|
||||
hThread = ThreadHandle;
|
||||
errCode = NtSetInformationThread(hThread,ThreadImpersonationToken,TokenHandle,sizeof(HANDLE));
|
||||
if ( !NT_SUCCESS(errCode) ) {
|
||||
SetLastError(RtlNtStatusToDosError(errCode));
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
DuplicateToken (
|
||||
HANDLE ExistingTokenHandle,
|
||||
SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,
|
||||
PHANDLE DuplicateTokenHandle
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
DuplicateTokenEx (
|
||||
|
@ -198,9 +192,54 @@ DuplicateTokenEx (
|
|||
PHANDLE DuplicateTokenHandle
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return FALSE;
|
||||
NTSTATUS errCode;
|
||||
HANDLE NewToken;
|
||||
|
||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||
|
||||
|
||||
ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES);
|
||||
ObjectAttributes.RootDirectory = NULL;
|
||||
ObjectAttributes.ObjectName = NULL;
|
||||
ObjectAttributes.Attributes = 0;
|
||||
if ( lpTokenAttributes->bInheritHandle )
|
||||
ObjectAttributes.Attributes |= OBJ_INHERIT;
|
||||
|
||||
ObjectAttributes.SecurityDescriptor = lpTokenAttributes->lpSecurityDescriptor;
|
||||
ObjectAttributes.SecurityQualityOfService = NULL;
|
||||
|
||||
errCode = NtDuplicateToken( ExistingTokenHandle, dwDesiredAccess,
|
||||
&ObjectAttributes, ImpersonationLevel,
|
||||
TokenType, &NewToken );
|
||||
|
||||
if ( !NT_SUCCESS(errCode) ) {
|
||||
SetLastError(RtlNtStatusToDosError(errCode));
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
DuplicateToken (
|
||||
HANDLE ExistingTokenHandle,
|
||||
SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,
|
||||
PHANDLE DuplicateTokenHandle
|
||||
)
|
||||
{
|
||||
return DuplicateTokenEx (
|
||||
ExistingTokenHandle,
|
||||
TOKEN_DUPLICATE|TOKEN_IMPERSONATE|TOKEN_QUERY,
|
||||
NULL,
|
||||
ImpersonationLevel,
|
||||
TokenImpersonation,
|
||||
DuplicateTokenHandle
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Reference in a new issue