jdk/src/windows/native/sun/java2d/windows/RegistryKey.h
changeset 1024 2253d6d6cf2c
parent 1023 9a1c25552b10
parent 945 6838c1a3296a
child 1025 a9ba5ea0f1f7
equal deleted inserted replaced
1023:9a1c25552b10 1024:2253d6d6cf2c
     1 /*
       
     2  * Copyright 2003 Sun Microsystems, Inc.  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.  Sun designates this
       
     8  * particular file as subject to the "Classpath" exception as provided
       
     9  * by Sun in the LICENSE file that accompanied this code.
       
    10  *
       
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    14  * version 2 for more details (a copy is included in the LICENSE file that
       
    15  * accompanied this code).
       
    16  *
       
    17  * You should have received a copy of the GNU General Public License version
       
    18  * 2 along with this work; if not, write to the Free Software Foundation,
       
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    20  *
       
    21  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
       
    22  * CA 95054 USA or visit www.sun.com if you need additional information or
       
    23  * have any questions.
       
    24  */
       
    25 
       
    26 
       
    27 #ifndef REGISTRYKEY_H
       
    28 #define REGISTRYKEY_H
       
    29 
       
    30 
       
    31 /**
       
    32  * Meaning of the following variables:
       
    33  * - UNVERIFIED: this value has not yet been tested (and needs to be)
       
    34  * - TESTING: this value is currently being tested.  If we get this value
       
    35  * from the registry, this indicates that we probably crashed while we were
       
    36  * testing it last time, so we should disable the appropriate component.
       
    37  * - FAILURE: this component failed testing, so it should be disabled
       
    38  * - SUCCESS: this component succeeded, so we can enable it
       
    39  */
       
    40 #define J2D_ACCEL_UNVERIFIED   -1
       
    41 #define J2D_ACCEL_TESTING      0
       
    42 #define J2D_ACCEL_FAILURE      1
       
    43 #define J2D_ACCEL_SUCCESS      2
       
    44 
       
    45 class RegistryKey {
       
    46 public:
       
    47     RegistryKey(WCHAR *keyName, REGSAM permissions);
       
    48     ~RegistryKey();
       
    49 
       
    50     DWORD EnumerateSubKeys(DWORD index, WCHAR *subKeyName,
       
    51                            DWORD *buffSize);
       
    52 
       
    53     int  GetIntValue(WCHAR *valueName);
       
    54 
       
    55     static int  GetIntValue(WCHAR *keyName, WCHAR *valueName);
       
    56 
       
    57     BOOL SetIntValue(WCHAR *valueName, int regValue, BOOL flush);
       
    58 
       
    59     static BOOL SetIntValue(WCHAR *keyName, WCHAR *valueName, int regValue,
       
    60                             BOOL flush);
       
    61 
       
    62     static void DeleteKey(WCHAR *keyName);
       
    63 
       
    64     static void PrintValue(WCHAR *keyName, WCHAR *valueName,
       
    65                            WCHAR *msg);
       
    66 
       
    67 private:
       
    68     HKEY hKey;
       
    69     static void PrintRegistryError(LONG errNum, char *message);
       
    70 };
       
    71 
       
    72 #endif REGISTRYKEY_H