You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2011/04/18 21:23:28 UTC

svn commit: r1094700 - in /commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows: Security.java Win32.java

Author: mturk
Date: Mon Apr 18 19:23:27 2011
New Revision: 1094700

URL: http://svn.apache.org/viewvc?rev=1094700&view=rev
Log:
More Win32 API

Added:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Security.java   (with props)
Modified:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Win32.java

Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Security.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Security.java?rev=1094700&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Security.java (added)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Security.java Mon Apr 18 19:23:27 2011
@@ -0,0 +1,65 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.runtime.platform.windows;
+
+import org.apache.commons.runtime.Status;
+import org.apache.commons.runtime.AlreadyExistsException;
+import org.apache.commons.runtime.NoSuchObjectException;
+import org.apache.commons.runtime.ClosedDescriptorException;
+import org.apache.commons.runtime.SystemException;
+
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Win32 Security API class.
+ */
+final class Security
+{
+    private Security()
+    {
+        // No instance.
+    }
+
+    private static ConcurrentHashMap<String,Long> sdcache = new ConcurrentHashMap<String,Long>();
+
+    public static final int         PROT_SCOPE_WORLD        = 0;
+    public static final int         PROT_SCOPE_GROUP        = 4;
+    public static final int         PROT_SCOPE_USER         = 8;
+
+    /** Object types */
+    public static final int         FILE                    = 0;
+    public static final int         MUTEX                   = 1;
+    public static final int         SHMEM                   = 3;
+    public static final int         SEMAPHORE               = 4;
+
+    /* Win32 API defines */
+    public static final int         SDDL_REVISION_1         = 1;
+
+
+    public static native int        GetAccessMask(int objectType, int scope, int prot);
+    public static native long       AllocateWellKnownSid(int sidType)
+        throws SystemException;
+    public static native long       ConvertStringSecurityDescriptorToSecurityDescriptor(String securityDescriptor, int revision)
+        throws SystemException;
+    public static native long       GetNullDacl()
+        throws OutOfMemoryError, SystemException;
+    public static native long       GetSaWithNullDacl(boolean inherit)
+        throws OutOfMemoryError, SystemException;
+    public static native long       GetCurrentProcessToken()
+        throws SystemException;
+
+}

Propchange: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Security.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Win32.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Win32.java?rev=1094700&r1=1094699&r2=1094700&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Win32.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Win32.java Mon Apr 18 19:23:27 2011
@@ -64,6 +64,7 @@ final class Win32
     public static final int         WAIT_FAILED             = 0xFFFFFFFF;
     public static final int         WAIT_OBJECT_O           = 0;
     public static final int         WAIT_ABANDONED          = 0x00000080;
+    public static final int         WAIT_TIMEOUT            = 0x00000102;
 
     public static native int        CloseHandle(long handle);
     public static native int        LocalFree(long ptr);