home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tricks of the Windows Gam…ming Gurus (2nd Edition)
/
Disc2.iso
/
vc98
/
include
/
winreg.h
< prev
next >
Wrap
C/C++ Source or Header
|
1998-04-25
|
14KB
|
794 lines
/*++ BUILD Version: 0001 // Increment this if a change has global effects
Copyright 1991-1998 Microsoft Corporation
Module Name:
Winreg.h
Abstract:
This module contains the function prototypes and constant, type and
structure definitions for the Windows 32-Bit Registry API.
--*/
#ifndef _WINREG_
#define _WINREG_
#ifdef _MAC
#include <macwin32.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifndef WINVER
#define WINVER 0x0500 // version 5.0
#endif /* !WINVER */
//
// Requested Key access mask type.
//
typedef ACCESS_MASK REGSAM;
//
// Type definitions.
//
#ifndef _MAC
DECLARE_HANDLE(HKEY);
typedef HKEY *PHKEY;
#endif
//
// Reserved Key Handles.
//
#define HKEY_CLASSES_ROOT (( HKEY ) 0x80000000 )
#define HKEY_CURRENT_USER (( HKEY ) 0x80000001 )
#define HKEY_LOCAL_MACHINE (( HKEY ) 0x80000002 )
#define HKEY_USERS (( HKEY ) 0x80000003 )
#define HKEY_PERFORMANCE_DATA (( HKEY ) 0x80000004 )
#if(WINVER >= 0x0400)
#define HKEY_CURRENT_CONFIG (( HKEY ) 0x80000005 )
#define HKEY_DYN_DATA (( HKEY ) 0x80000006 )
/*NOINC*/
#ifndef _PROVIDER_STRUCTS_DEFINED
#define _PROVIDER_STRUCTS_DEFINED
#define PROVIDER_KEEPS_VALUE_LENGTH 0x1
struct val_context {
int valuelen; // the total length of this value
LPVOID value_context; // provider's context
LPVOID val_buff_ptr; // where in the ouput buffer the value is.
};
typedef struct val_context FAR *PVALCONTEXT;
typedef struct pvalueA { // Provider supplied value/context.
LPSTR pv_valuename; // The value name pointer
int pv_valuelen;
LPVOID pv_value_context;
DWORD pv_type;
}PVALUEA, FAR *PPVALUEA;
typedef struct pvalueW { // Provider supplied value/context.
LPWSTR pv_valuename; // The value name pointer
int pv_valuelen;
LPVOID pv_value_context;
DWORD pv_type;
}PVALUEW, FAR *PPVALUEW;
#ifdef UNICODE
typedef PVALUEW PVALUE;
typedef PPVALUEW PPVALUE;
#else
typedef PVALUEA PVALUE;
typedef PPVALUEA PPVALUE;
#endif // UNICODE
typedef
DWORD _cdecl
QUERYHANDLER (LPVOID keycontext, PVALCONTEXT val_list, DWORD num_vals,
LPVOID outputbuffer, DWORD FAR *total_outlen, DWORD input_blen);
typedef QUERYHANDLER FAR *PQUERYHANDLER;
typedef struct provider_info {
PQUERYHANDLER pi_R0_1val;
PQUERYHANDLER pi_R0_allvals;
PQUERYHANDLER pi_R3_1val;
PQUERYHANDLER pi_R3_allvals;
DWORD pi_flags; // capability flags (none defined yet).
LPVOID pi_key_context;
}REG_PROVIDER;
typedef struct provider_info FAR *PPROVIDER;
typedef struct value_entA {
LPSTR ve_valuename;
DWORD ve_valuelen;
DWORD ve_valueptr;
DWORD ve_type;
}VALENTA, FAR *PVALENTA;
typedef struct value_entW {
LPWSTR ve_valuename;
DWORD ve_valuelen;
DWORD ve_valueptr;
DWORD ve_type;
}VALENTW, FAR *PVALENTW;
#ifdef UNICODE
typedef VALENTW VALENT;
typedef PVALENTW PVALENT;
#else
typedef VALENTA VALENT;
typedef PVALENTA PVALENT;
#endif // UNICODE
#endif // not(_PROVIDER_STRUCTS_DEFINED)
/*INC*/
#endif /* WINVER >= 0x0400 */
//
// Default values for parameters that do not exist in the Win 3.1
// compatible APIs.
//
#define WIN31_CLASS NULL
//
// API Prototypes.
//
WINADVAPI
LONG
APIENTRY
RegCloseKey (
HKEY hKey
);
WINADVAPI
LONG
APIENTRY
RegOverridePredefKey (
HKEY hKey,
HKEY hNewHKey
);
WINADVAPI
LONG
APIENTRY
RegConnectRegistryA (
LPCSTR lpMachineName,
HKEY hKey,
PHKEY phkResult
);
WINADVAPI
LONG
APIENTRY
RegConnectRegistryW (
LPCWSTR lpMachineName,
HKEY hKey,
PHKEY phkResult
);
#ifdef UNICODE
#define RegConnectRegistry RegConnectRegistryW
#else
#define RegConnectRegistry RegConnectRegistryA
#endif // !UNICODE
WINADVAPI
LONG
APIENTRY
RegCreateKeyA (
HKEY hKey,
LPCSTR lpSubKey,
PHKEY phkResult
);
WINADVAPI
LONG
APIENTRY
RegCreateKeyW (
HKEY hKey,
LPCWSTR lpSubKey,
PHKEY phkResult
);
#ifdef UNICODE
#define RegCreateKey RegCreateKeyW
#else
#define RegCreateKey RegCreateKeyA
#endif // !UNICODE
WINADVAPI
LONG
APIENTRY
RegCreateKeyExA (
HKEY hKey,
LPCSTR lpSubKey,
DWORD Reserved,
LPSTR lpClass,
DWORD dwOptions,
REGSAM samDesired,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
PHKEY phkResult,
LPDWORD lpdwDisposition
);
WINADVAPI
LONG
APIENTRY
RegCreateKeyExW (
HKEY hKey,
LPCWSTR lpSubKey,
DWORD Reserved,
LPWSTR lpClass,
DWORD dwOptions,
REGSAM samDesired,
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
PHKEY phkResult,
LPDWORD lpdwDisposition
);
#ifdef UNICODE
#define RegCreateKeyEx RegCreateKeyExW
#else
#define RegCreateKeyEx RegCreateKeyExA
#endif // !UNICODE
WINADVAPI
LONG
APIENTRY
RegDeleteKeyA (
HKEY hKey,
LPCSTR lpSubKey
);
WINADVAPI
LONG
APIENTRY
RegDeleteKeyW (
HKEY hKey,
LPCWSTR lpSubKey
);
#ifdef UNICODE
#define RegDeleteKey RegDeleteKeyW
#else
#define RegDeleteKey RegDeleteKeyA
#endif // !UNICODE
WINADVAPI
LONG
APIENTRY
RegDeleteValueA (
HKEY hKey,
LPCSTR lpValueName
);
WINADVAPI
LONG
APIENTRY
RegDeleteValueW (
HKEY hKey,
LPCWSTR lpValueName
);
#ifdef UNICODE
#define RegDeleteValue RegDeleteValueW
#else
#define RegDeleteValue RegDeleteValueA
#endif // !UNICODE
WINADVAPI
LONG
APIENTRY
RegEnumKeyA (
HKEY hKey,
DWORD dwIndex,
LPSTR lpName,
DWORD cbName
);
WINADVAPI
LONG
APIENTRY
RegEnumKeyW (
HKEY hKey,
DWORD dwIndex,
LPWSTR lpName,
DWORD cbName
);
#ifdef UNICODE
#define RegEnumKey RegEnumKeyW
#else
#define RegEnumKey RegEnumKeyA
#endif // !UNICODE
WINADVAPI
LONG
APIENTRY
RegEnumKeyExA (
HKEY hKey,
DWORD dwIndex,
LPSTR lpName,
LPDWORD lpcbName,
LPDWORD lpReserved,
LPSTR lpClass,
LPDWORD lpcbClass,
PFILETIME lpftLastWriteTime
);
WINADVAPI
LONG
APIENTRY
RegEnumKeyExW (
HKEY hKey,
DWORD dwIndex,
LPWSTR lpName,
LPDWORD lpcbName,
LPDWORD lpReserved,
LPWSTR lpClass,
LPDWORD lpcbClass,
PFILETIME lpftLastWriteTime
);
#ifdef UNICODE
#define RegEnumKeyEx RegEnumKeyExW
#else
#define RegEnumKeyEx RegEnumKeyExA
#endif // !UNICODE
WINADVAPI
LONG
APIENTRY
RegEnumValueA (
HKEY hKey,
DWORD dwIndex,
LPSTR lpValueName,
LPDWORD lpcbValueName,
LPDWORD lpReserved,
LPDWORD lpType,
LPBYTE lpData,
LPDWORD lpcbData
);
WINADVAPI
LONG
APIENTRY
RegEnumValueW (
HKEY hKey,
DWORD dwIndex,
LPWSTR lpValueName,
LPDWORD lpcbValueName,
LPDWORD lpReserved,
LPDWORD lpType,
LPBYTE lpData,
LPDWORD lpcbData
);
#ifdef UNICODE
#define RegEnumValue RegEnumValueW
#else
#define RegEnumValue RegEnumValueA
#endif // !UNICODE
WINADVAPI
LONG
APIENTRY
RegFlushKey (
HKEY hKey
);
WINADVAPI
LONG
APIENTRY
RegGetKeySecurity (
HKEY hKey,
SECURITY_INFORMATION SecurityInformation,
PSECURITY_DESCRIPTOR pSecurityDescriptor,
LPDWORD lpcbSecurityDescriptor
);
WINADVAPI
LONG
APIENTRY
RegLoadKeyA (
HKEY hKey,
LPCSTR lpSubKey,
LPCSTR lpFile
);
WINADVAPI
LONG
APIENTRY
RegLoadKeyW (
HKEY hKey,
LPCWSTR lpSubKey,
LPCWSTR lpFile
);
#ifdef UNICODE
#define RegLoadKey RegLoadKeyW
#else
#define RegLoadKey RegLoadKeyA
#endif // !UNICODE
WINADVAPI
LONG
APIENTRY
RegNotifyChangeKeyValue (
HKEY hKey,
BOOL bWatchSubtree,
DWORD dwNotifyFilter,
HANDLE hEvent,
BOOL fAsynchronus
);
WINADVAPI
LONG
APIENTRY
RegOpenKeyA (
HKEY hKey,
LPCSTR lpSubKey,
PHKEY phkResult
);
WINADVAPI
LONG
APIENTRY
RegOpenKeyW (
HKEY hKey,
LPCWSTR lpSubKey,
PHKEY phkResult
);
#ifdef UNICODE
#define RegOpenKey RegOpenKeyW
#else
#define RegOpenKey RegOpenKeyA
#endif // !UNICODE
WINADVAPI
LONG
APIENTRY
RegOpenKeyExA (
HKEY hKey,
LPCSTR lpSubKey,
DWORD ulOptions,
REGSAM samDesired,
PHKEY phkResult
);
WINADVAPI
LONG
APIENTRY
RegOpenKeyExW (
HKEY hKey,
LPCWSTR lpSubKey,
DWORD ulOptions,
REGSAM samDesired,
PHKEY phkResult
);
#ifdef UNICODE
#define RegOpenKeyEx RegOpenKeyExW
#else
#define RegOpenKeyEx RegOpenKeyExA
#endif // !UNICODE
WINADVAPI
LONG
APIENTRY
RegQueryInfoKeyA (
HKEY hKey,
LPSTR lpClass,
LPDWORD lpcbClass,
LPDWORD lpReserved,
LPDWORD lpcSubKeys,
LPDWORD lpcbMaxSubKeyLen,
LPDWORD lpcbMaxClassLen,
LPDWORD lpcValues,
LPDWORD lpcbMaxValueNameLen,
LPDWORD lpcbMaxValueLen,
LPDWORD lpcbSecurityDescriptor,
PFILETIME lpftLastWriteTime
);
WINADVAPI
LONG
APIENTRY
RegQueryInfoKeyW (
HKEY hKey,
LPWSTR lpClass,
LPDWORD lpcbClass,
LPDWORD lpReserved,
LPDWORD lpcSubKeys,
LPDWORD lpcbMaxSubKeyLen,
LPDWORD lpcbMaxClassLen,
LPDWORD lpcValues,
LPDWORD lpcbMaxValueNameLen,
LPDWORD lpcbMaxValueLen,
LPDWORD lpcbSecurityDescriptor,
PFILETIME lpftLastWriteTime
);
#ifdef UNICODE
#define RegQueryInfoKey RegQueryInfoKeyW
#else
#define RegQueryInfoKey RegQueryInfoKeyA
#endif // !UNICODE
WINADVAPI
LONG
APIENTRY
RegQueryValueA (
HKEY hKey,
LPCSTR lpSubKey,
LPSTR lpValue,
PLONG lpcbValue
);
WINADVAPI
LONG
APIENTRY
RegQueryValueW (
HKEY hKey,
LPCWSTR lpSubKey,
LPWSTR lpValue,
PLONG lpcbValue
);
#ifdef UNICODE
#define RegQueryValue RegQueryValueW
#else
#define RegQueryValue RegQueryValueA
#endif // !UNICODE
#if(WINVER >= 0x0400)
WINADVAPI
LONG
APIENTRY
RegQueryMultipleValuesA (
HKEY hKey,
PVALENTA val_list,
DWORD num_vals,
LPSTR lpValueBuf,
LPDWORD ldwTotsize
);
WINADVAPI
LONG
APIENTRY
RegQueryMultipleValuesW (
HKEY hKey,
PVALENTW val_list,
DWORD num_vals,
LPWSTR lpValueBuf,
LPDWORD ldwTotsize
);
#ifdef UNICODE
#define RegQueryMultipleValues RegQueryMultipleValuesW
#else
#define RegQueryMultipleValues RegQueryMultipleValuesA
#endif // !UNICODE
#endif /* WINVER >= 0x0400 */
WINADVAPI
LONG
APIENTRY
RegQueryValueExA (
HKEY hKey,
LPCSTR lpValueName,
LPDWORD lpReserved,
LPDWORD lpType,
LPBYTE lpData,
LPDWORD lpcbData
);
WINADVAPI
LONG
APIENTRY
RegQueryValueExW (
HKEY hKey,
LPCWSTR lpValueName,
LPDWORD lpReserved,
LPDWORD lpType,
LPBYTE lpData,
LPDWORD lpcbData
);
#ifdef UNICODE
#define RegQueryValueEx RegQueryValueExW
#else
#define RegQueryValueEx RegQueryValueExA
#endif // !UNICODE
WINADVAPI
LONG
APIENTRY
RegReplaceKeyA (
HKEY hKey,
LPCSTR lpSubKey,
LPCSTR lpNewFile,
LPCSTR lpOldFile
);
WINADVAPI
LONG
APIENTRY
RegReplaceKeyW (
HKEY hKey,
LPCWSTR lpSubKey,
LPCWSTR lpNewFile,
LPCWSTR lpOldFile
);
#ifdef UNICODE
#define RegReplaceKey RegReplaceKeyW
#else
#define RegReplaceKey RegReplaceKeyA
#endif // !UNICODE
WINADVAPI
LONG
APIENTRY
RegRestoreKeyA (
HKEY hKey,
LPCSTR lpFile,
DWORD dwFlags
);
WINADVAPI
LONG
APIENTRY
RegRestoreKeyW (
HKEY hKey,
LPCWSTR lpFile,
DWORD dwFlags
);
#ifdef UNICODE
#define RegRestoreKey RegRestoreKeyW
#else
#define RegRestoreKey RegRestoreKeyA
#endif // !UNICODE
WINADVAPI
LONG
APIENTRY
RegSaveKeyA (
HKEY hKey,
LPCSTR lpFile,
LPSECURITY_ATTRIBUTES lpSecurityAttributes
);
WINADVAPI
LONG
APIENTRY
RegSaveKeyW (
HKEY hKey,
LPCWSTR lpFile,
LPSECURITY_ATTRIBUTES lpSecurityAttributes
);
#ifdef UNICODE
#define RegSaveKey RegSaveKeyW
#else
#define RegSaveKey RegSaveKeyA
#endif // !UNICODE
WINADVAPI
LONG
APIENTRY
RegSetKeySecurity (
HKEY hKey,
SECURITY_INFORMATION SecurityInformation,
PSECURITY_DESCRIPTOR pSecurityDescriptor
);
WINADVAPI
LONG
APIENTRY
RegSetValueA (
HKEY hKey,
LPCSTR lpSubKey,
DWORD dwType,
LPCSTR lpData,
DWORD cbData
);
WINADVAPI
LONG
APIENTRY
RegSetValueW (
HKEY hKey,
LPCWSTR lpSubKey,
DWORD dwType,
LPCWSTR lpData,
DWORD cbData
);
#ifdef UNICODE
#define RegSetValue RegSetValueW
#else
#define RegSetValue RegSetValueA
#endif // !UNICODE
WINADVAPI
LONG
APIENTRY
RegSetValueExA (
HKEY hKey,
LPCSTR lpValueName,
DWORD Reserved,
DWORD dwType,
CONST BYTE* lpData,
DWORD cbData
);
WINADVAPI
LONG
APIENTRY
RegSetValueExW (
HKEY hKey,
LPCWSTR lpValueName,
DWORD Reserved,
DWORD dwType,
CONST BYTE* lpData,
DWORD cbData
);
#ifdef UNICODE
#define RegSetValueEx RegSetValueExW
#else
#define RegSetValueEx RegSetValueExA
#endif // !UNICODE
WINADVAPI
LONG
APIENTRY
RegUnLoadKeyA (
HKEY hKey,
LPCSTR lpSubKey
);
WINADVAPI
LONG
APIENTRY
RegUnLoadKeyW (
HKEY hKey,
LPCWSTR lpSubKey
);
#ifdef UNICODE
#define RegUnLoadKey RegUnLoadKeyW
#else
#define RegUnLoadKey RegUnLoadKeyA
#endif // !UNICODE
//
// Remoteable System Shutdown APIs
//
WINADVAPI
BOOL
APIENTRY
InitiateSystemShutdownA(
LPSTR lpMachineName,
LPSTR lpMessage,
DWORD dwTimeout,
BOOL bForceAppsClosed,
BOOL bRebootAfterShutdown
);
WINADVAPI
BOOL
APIENTRY
InitiateSystemShutdownW(
LPWSTR lpMachineName,
LPWSTR lpMessage,
DWORD dwTimeout,
BOOL bForceAppsClosed,
BOOL bRebootAfterShutdown
);
#ifdef UNICODE
#define InitiateSystemShutdown InitiateSystemShutdownW
#else
#define InitiateSystemShutdown InitiateSystemShutdownA
#endif // !UNICODE
WINADVAPI
BOOL
APIENTRY
AbortSystemShutdownA(
LPSTR lpMachineName
);
WINADVAPI
BOOL
APIENTRY
AbortSystemShutdownW(
LPWSTR lpMachineName
);
#ifdef UNICODE
#define AbortSystemShutdown AbortSystemShutdownW
#else
#define AbortSystemShutdown AbortSystemShutdownA
#endif // !UNICODE
#ifdef __cplusplus
}
#endif
#endif // _WINREG_