mirror of
https://github.com/reactos/reactos.git
synced 2025-08-01 00:13:16 +00:00
patch from Vassily Tarasov bug 1658 : Implement GetUserObjectSecurity()and SetUserObjectSecurity()
svn path=/trunk/; revision=22964
This commit is contained in:
parent
9656ee1e85
commit
df8822f30d
2 changed files with 123 additions and 55 deletions
|
@ -146,3 +146,125 @@ GetW32ProcessInfo(VOID)
|
|||
|
||||
return pi;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* GetUserObjectSecurity
|
||||
*
|
||||
* Retrieves security information for user object specified
|
||||
* with handle 'hObject'. Descriptor returned in self-relative
|
||||
* format.
|
||||
*
|
||||
* Arguments:
|
||||
* 1) hObject - handle to an object to retrieve information for
|
||||
* 2) pSecurityInfo - type of information to retrieve
|
||||
* 3) pSecurityDescriptor - buffer which receives descriptor
|
||||
* 4) dwLength - size, in bytes, of buffer 'pSecurityDescriptor'
|
||||
* 5) pdwLengthNeeded - reseives actual size of descriptor
|
||||
*
|
||||
* Return Vaules:
|
||||
* TRUE on success
|
||||
* FALSE on failure, call GetLastError() for more information
|
||||
*/
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL
|
||||
WINAPI
|
||||
GetUserObjectSecurity(
|
||||
IN HANDLE hObject,
|
||||
IN PSECURITY_INFORMATION pSecurityInfo,
|
||||
OUT PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
||||
IN DWORD dwLength,
|
||||
OUT PDWORD pdwLengthNeeded
|
||||
)
|
||||
{
|
||||
DWORD dwWin32Error;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
Status = NtQuerySecurityObject(
|
||||
hObject, // Object Handle
|
||||
*pSecurityInfo, // Security Information
|
||||
pSecurityDescriptor,// Security Descriptor
|
||||
dwLength, // Buffer Length
|
||||
pdwLengthNeeded // Actual Length
|
||||
);
|
||||
|
||||
if ( ! NT_SUCCESS( Status ) ) {
|
||||
dwWin32Error = RtlNtStatusToDosError( Status );
|
||||
NtCurrentTeb()->LastErrorValue = dwWin32Error;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* SetUserObjectSecurity
|
||||
*
|
||||
* Sets new security descriptor to user object specified by
|
||||
* handle 'hObject'. Descriptor must be in self-relative format.
|
||||
*
|
||||
* Arguments:
|
||||
* 1) hObject - handle to an object to set information for
|
||||
* 2) pSecurityInfo - type of information to apply
|
||||
* 3) pSecurityDescriptor - buffer which descriptor to set
|
||||
*
|
||||
* Return Vaules:
|
||||
* TRUE on success
|
||||
* FALSE on failure, call GetLastError() for more information
|
||||
*/
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL
|
||||
WINAPI
|
||||
SetUserObjectSecurity(
|
||||
IN HANDLE hObject,
|
||||
IN PSECURITY_INFORMATION pSecurityInfo,
|
||||
IN PSECURITY_DESCRIPTOR pSecurityDescriptor
|
||||
)
|
||||
{
|
||||
DWORD dwWin32Error;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
||||
Status = NtSetSecurityObject(
|
||||
hObject, // Object Handle
|
||||
*pSecurityInfo, // Security Information
|
||||
pSecurityDescriptor // Security Descriptor
|
||||
);
|
||||
|
||||
if ( ! NT_SUCCESS( Status ) ) {
|
||||
dwWin32Error = RtlNtStatusToDosError( Status );
|
||||
NtCurrentTeb()->LastErrorValue = dwWin32Error;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL
|
||||
STDCALL
|
||||
EndTask(
|
||||
HWND hWnd,
|
||||
BOOL fShutDown,
|
||||
BOOL fForce)
|
||||
{
|
||||
SendMessageW(hWnd, WM_CLOSE, 0, 0);
|
||||
|
||||
if (IsWindow(hWnd))
|
||||
{
|
||||
if (fForce)
|
||||
return DestroyWindow(hWnd);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -147,31 +147,6 @@ SetDebugErrorLevel( DWORD dwLevel )
|
|||
DbgPrint("(%ld): stub\n", dwLevel);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL
|
||||
STDCALL
|
||||
EndTask(
|
||||
HWND hWnd,
|
||||
BOOL fShutDown,
|
||||
BOOL fForce)
|
||||
{
|
||||
SendMessageW(hWnd, WM_CLOSE, 0, 0);
|
||||
|
||||
if (IsWindow(hWnd))
|
||||
{
|
||||
if (fForce)
|
||||
return DestroyWindow(hWnd);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
|
@ -271,37 +246,8 @@ DragObject(
|
|||
return NtUserDragObject(hwnd1, hwnd2, u1, dw1, hc1);
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
BOOL
|
||||
STDCALL
|
||||
GetUserObjectSecurity(
|
||||
HANDLE hObj,
|
||||
PSECURITY_INFORMATION pSIRequested,
|
||||
PSECURITY_DESCRIPTOR pSID,
|
||||
DWORD nLength,
|
||||
LPDWORD lpnLengthNeeded
|
||||
)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
BOOL
|
||||
STDCALL
|
||||
SetUserObjectSecurity(
|
||||
HANDLE hObj,
|
||||
PSECURITY_INFORMATION pSIRequested,
|
||||
PSECURITY_DESCRIPTOR pSID
|
||||
)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue