< prev index next >

src/hotspot/os/windows/perfMemory_windows.cpp

Print this page

   1 /*
   2  * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *

1056 
1057   // initialize the security descriptor
1058   if (!InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION)) {
1059     if (PrintMiscellaneous && Verbose) {
1060       warning("InitializeSecurityDescriptor failure: "
1061               "lasterror = %d \n", GetLastError());
1062     }
1063     free_security_desc(pSD);
1064     return NULL;
1065   }
1066 
1067   // add the access control entries
1068   if (!add_allow_aces(pSD, aces, count)) {
1069     free_security_desc(pSD);
1070     return NULL;
1071   }
1072 
1073   // allocate and initialize the security attributes structure and
1074   // return it to the caller.
1075   //
1076   LPSECURITY_ATTRIBUTES lpSA = (LPSECURITY_ATTRIBUTES)
1077     NEW_C_HEAP_ARRAY(char, sizeof(SECURITY_ATTRIBUTES), mtInternal);
1078   lpSA->nLength = sizeof(SECURITY_ATTRIBUTES);
1079   lpSA->lpSecurityDescriptor = pSD;
1080   lpSA->bInheritHandle = FALSE;
1081 
1082   return(lpSA);
1083 }
1084 
1085 // method to create a security attributes structure with a restrictive
1086 // access control list that creates a set access rights for the user/owner
1087 // of the securable object and a separate set access rights for everyone else.
1088 // also provides for full access rights for the administrator group.
1089 //
1090 // the caller must free the resources associated with the security
1091 // attributes structure created by this method by calling the
1092 // free_security_attr() method.
1093 //
1094 
1095 static LPSECURITY_ATTRIBUTES make_user_everybody_admin_security_attr(
1096                                 DWORD umask, DWORD emask, DWORD amask) {
1097 

   1 /*
   2  * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *

1056 
1057   // initialize the security descriptor
1058   if (!InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION)) {
1059     if (PrintMiscellaneous && Verbose) {
1060       warning("InitializeSecurityDescriptor failure: "
1061               "lasterror = %d \n", GetLastError());
1062     }
1063     free_security_desc(pSD);
1064     return NULL;
1065   }
1066 
1067   // add the access control entries
1068   if (!add_allow_aces(pSD, aces, count)) {
1069     free_security_desc(pSD);
1070     return NULL;
1071   }
1072 
1073   // allocate and initialize the security attributes structure and
1074   // return it to the caller.
1075   //
1076   LPSECURITY_ATTRIBUTES lpSA =
1077       NEW_C_HEAP_OBJ(SECURITY_ATTRIBUTES, mtInternal);
1078   lpSA->nLength = sizeof(SECURITY_ATTRIBUTES);
1079   lpSA->lpSecurityDescriptor = pSD;
1080   lpSA->bInheritHandle = FALSE;
1081 
1082   return(lpSA);
1083 }
1084 
1085 // method to create a security attributes structure with a restrictive
1086 // access control list that creates a set access rights for the user/owner
1087 // of the securable object and a separate set access rights for everyone else.
1088 // also provides for full access rights for the administrator group.
1089 //
1090 // the caller must free the resources associated with the security
1091 // attributes structure created by this method by calling the
1092 // free_security_attr() method.
1093 //
1094 
1095 static LPSECURITY_ATTRIBUTES make_user_everybody_admin_security_attr(
1096                                 DWORD umask, DWORD emask, DWORD amask) {
1097 
< prev index next >