home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1997 October
/
Chip_1997-10_cd.bin
/
tema
/
sybase
/
powerj
/
hpp.z
/
WREGISTR.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1996-10-18
|
8KB
|
234 lines
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright (C) 1994, by WATCOM International Inc. All rights %
% reserved. No part of this software may be reproduced or %
% used in any form or by any means - graphic, electronic or %
% mechanical, including photocopying, recording, taping or %
% information storage and retrieval systems - except with the %
% written permission of WATCOM International Inc. %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
/*************************************************************************
*
* WRegistryKey -- Wrapper for the Windows 95 Registry Key.
*
* Events:
*
*************************************************************************/
#ifndef _WREGISTR_HPP_INCLUDED
#define _WREGISTR_HPP_INCLUDED
#ifndef _WNO_PRAGMA_PUSH
#pragma pack(push,8);
#pragma enum int;
#endif
#ifndef _WOBJECT_HPP_INCLUDED
# include "wobject.hpp"
#endif
#ifndef _WSTRING_HPP_INCLUDED
# include "wstring.hpp"
#endif
#ifndef _WBUFFER_HPP_INCLUDED
# include "wbuffer.hpp"
#endif
typedef WULong WRegistryKeyHandle;
#define WRKeyClassesRoot ((WRegistryKeyHandle)0x80000000)
#define WRKeyCurrentUser ((WRegistryKeyHandle)0x80000001)
#define WRKeyLocalMachine ((WRegistryKeyHandle)0x80000002)
#define WRKeyUsers ((WRegistryKeyHandle)0x80000003)
#define WRKeyPerformanceData ((WRegistryKeyHandle)0x80000004)
#define WRKeyCurrentConfig ((WRegistryKeyHandle)0x80000005)
#define WRKeyDynData ((WRegistryKeyHandle)0x80000006)
enum WRegistryDataType {
WRegNone = 0,
WRegDataString,
WRegDataExpandString,
WRegDataBinary,
WRegDataDWord,
WRegDataDWordBigEndian,
WRegDataLink,
WRegDataMultiString,
WRegDataResourceList,
WRegDataFullResourceDesc,
WRegDataResourceReqList
};
enum WAccessType {
WAccessDelete = 0x00010000L,
WAccessReadControl = 0x00020000L,
WAccessWriteDAC = 0x00040000L,
WAccessWriteOwner = 0x00080000L,
WAccessSynchronize = 0x00100000L,
WAccessStandardRightsRequired = 0x000F0000L,
WAccessStandardRightsRead = WAccessReadControl,
WAccessStandardRightsWrite = WAccessReadControl,
WAccessStandardRightsExecute = WAccessReadControl,
WAccessStandardRightsAll = 0x001F0000L,
WAccessSpecificRightsAll = 0x0000FFFFL,
};
enum WRegistryAccessType {
WRegAccessQueryValue = 0x0001,
WRegAccessSetValue = 0x0002,
WRegAccessCreateSubkey = 0x0004,
WRegAccessEnumerateSubkeys = 0x0008,
WRegAccessNotify = 0x0010,
WRegAccessCreateLink = 0x0020,
WRegAccessRead = ((WAccessStandardRightsRead | WRegAccessQueryValue
| WRegAccessEnumerateSubkeys | WRegAccessNotify)
& (~WAccessSynchronize)),
WRegAccessWrite = ((WAccessStandardRightsWrite | WRegAccessSetValue
| WRegAccessCreateSubkey)
& (~WAccessSynchronize)),
WRegAccessExecute = ((WRegAccessRead)
& (~WAccessSynchronize)),
WRegAccessAllAccess = ((WAccessStandardRightsAll | WRegAccessQueryValue
| WRegAccessSetValue | WRegAccessCreateSubkey
| WRegAccessEnumerateSubkeys
| WRegAccessNotify | WRegAccessCreateLink)
& (~WAccessSynchronize))
};
class WCMCLASS WRegistryKey : public WObject {
WDeclareSubclass( WRegistryKey, WObject )
public:
/**********************************************************
* Constructors and Destructors
*********************************************************/
WRegistryKey();
~WRegistryKey();
/**********************************************************
* Properties
*********************************************************/
// Handle
WRegistryKeyHandle GetHandle() { return _key; }
/**********************************************************
* Methods
*********************************************************/
// Create
//
// Note: subkey must NOT begin with the backslash character ('\')
WBool Create( WRegistryKeyHandle key, const WString & subkey );
// Close
WBool Close( WBool writeToDisk=FALSE );
// Delete
WBool Delete( const WString & valueName );
// EnumerateSubkey
WBool EnumerateSubkey( WInt subkeyindex, WString & str );
// EnumerateValue
WBool EnumerateValue( WInt valueIndex, WString & valueName,
WString & value );
WBool EnumerateValue( WInt valueindex, WString &valueName,
WRegistryDataType &dataType, WBuffer &buffer );
WBool EnumerateValue( WInt valueindex, WString &valueName,
WString &value, WRegistryDataType &dataType );
// Flush
WBool Flush();
// Load
WBool Load( const WString & subkey, const WString & fileName );
// Open
//
// Note: subkey must NOT begin with the backslash character ('\')
WBool Open( WRegistryKeyHandle key, const WString & subkey,
WULong access=WRegAccessAllAccess );
// Restore
WBool Restore( const WString & fileName, WBool voltile );
// Save
WBool Save( const WString & fileName );
// Unload
WBool Unload( const WString & subkey );
/**********************************************************
* Item Properties
*********************************************************/
// StringValue
WBool SetStringValue( const WString & valueName,
const WString & value );
WString GetStringValue( const WString & valueName );
// Value
WBool SetValue( const WString & valueName, WRegistryDataType dataType,
const WBuffer & data );
WBuffer GetValue( const WString & valueName,
WRegistryDataType dataType );
// ValueSize
WULong GetValueSize( const WString & valueName,
WRegistryDataType dataType );
/**********************************************************
* Item Methods
*********************************************************/
// DeleteValue
WBool DeleteValue( const WString & valueName );
// HasStringValue
WBool HasStringValue( const WString & valueName );
// HasValue
WBool HasValue( const WString & valueName,
WRegistryDataType dataType );
WBool HasValue( const WString & valueName );
/**********************************************************
* Data Members
*********************************************************/
private:
WRegistryKeyHandle _key;
};
#ifndef _WNO_PRAGMA_PUSH
#pragma enum pop;
#pragma pack(pop);
#endif
#endif // _WREGISTR_HPP_INCLUDED