Author: jimtabor
Date: Mon Jul 31 10:01:09 2006
New Revision: 23390
URL:
http://svn.reactos.org/svn/reactos?rev=23390&view=rev
Log:
Sync, patch from Vassily Tarasov bug 1658 : Implement GetUserObjectSecurity()and
SetUserObjectSecurity()
Modified:
branches/ros-branch-0_3_0/reactos/dll/win32/user32/misc/misc.c
branches/ros-branch-0_3_0/reactos/dll/win32/user32/misc/stubs.c
Modified: branches/ros-branch-0_3_0/reactos/dll/win32/user32/misc/misc.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_0/reactos/dll/wi…
==============================================================================
--- branches/ros-branch-0_3_0/reactos/dll/win32/user32/misc/misc.c (original)
+++ branches/ros-branch-0_3_0/reactos/dll/win32/user32/misc/misc.c Mon Jul 31 10:01:09
2006
@@ -146,3 +146,125 @@
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;
+}
Modified: branches/ros-branch-0_3_0/reactos/dll/win32/user32/misc/stubs.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_0/reactos/dll/wi…
==============================================================================
--- branches/ros-branch-0_3_0/reactos/dll/win32/user32/misc/stubs.c (original)
+++ branches/ros-branch-0_3_0/reactos/dll/win32/user32/misc/stubs.c Mon Jul 31 10:01:09
2006
@@ -147,31 +147,6 @@
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 @@
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