⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cfgmgr32.pas

📁 East make Tray Icon in delphi
💻 PAS
📖 第 1 页 / 共 5 页
字号:
{******************************************************************}
{                                                                  }
{       Borland Delphi Runtime Library                             }
{       Config Manager API interface unit                          }
{                                                                  }
{ Portions created by Microsoft are                                }
{ Copyright (c) Microsoft Corporation.  All rights reserved.       }
{                                                                  }
{ The original file is: cfgmgr32.h, released August 2001.          }
{ The original Pascal code is: CfgMgr32.pas, released 5 Nov 2004.  }
{ The initial developer of the Pascal code is Robert Marquardt     }
{ (robert_marquardt att gmx dott de)                               }
{                                                                  }
{ Portions created by Robert Marquardt are                         }
{ Copyright (C) 2004 Robert Marquardt.                             }
{                                                                  }
{ Contributor(s):                                                  }
{                                                                  }
{ Obtained through:                                                }
{ Joint Endeavour of Delphi Innovators (Project JEDI)              }
{                                                                  }
{ You may retrieve the latest version of this file at the Project  }
{ JEDI home page, located at http://delphi-jedi.org                }
{                                                                  }
{ The contents of this file are used with permission, subject to   }
{ the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/MPL-1.1.html                          }
{                                                                  }
{ Software distributed under the License is distributed on an      }
{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or   }
{ implied. See the License for the specific language governing     }
{ rights and limitations under the License.                        }
{                                                                  }
{******************************************************************}

unit CfgMgr32;

{$I windowsversion.inc}

interface

uses
  Windows,
  Cfg, WinConvTypes, SetupApi;

{$WEAKPACKAGEUNIT ON}

// (rom) this is the switch to change between static and dynamic linking.
// (rom) it is enabled by default here.
// (rom) To disable simply change the '$' to a '.'.
{$DEFINE CFGMGR32_LINKONREQUEST}

{$HPPEMIT '#include "cfgmgr32.h"'}

//--------------------------------------------------------------
// General size definitions
//--------------------------------------------------------------

const
  MAX_DEVICE_ID_LEN     = 200;
  {$EXTERNALSYM MAX_DEVICE_ID_LEN}
  MAX_DEVNODE_ID_LEN    = MAX_DEVICE_ID_LEN;
  {$EXTERNALSYM MAX_DEVNODE_ID_LEN}

  MAX_GUID_STRING_LEN   = 39;          // 38 chars + terminator null
  {$EXTERNALSYM MAX_GUID_STRING_LEN}
  MAX_CLASS_NAME_LEN    = 32;
  {$EXTERNALSYM MAX_CLASS_NAME_LEN}
  MAX_PROFILE_LEN       = 80;
  {$EXTERNALSYM MAX_PROFILE_LEN}

  MAX_CONFIG_VALUE      = 9999;
  {$EXTERNALSYM MAX_CONFIG_VALUE}
  MAX_INSTANCE_VALUE    = 9999;
  {$EXTERNALSYM MAX_INSTANCE_VALUE}

  MAX_MEM_REGISTERS     = 9;     // Win95 compatibility--not applicable to 32-bit ConfigMgr
  {$EXTERNALSYM MAX_MEM_REGISTERS}
  MAX_IO_PORTS          = 20;    // Win95 compatibility--not applicable to 32-bit ConfigMgr
  {$EXTERNALSYM MAX_IO_PORTS}
  MAX_IRQS              = 7;     // Win95 compatibility--not applicable to 32-bit ConfigMgr
  {$EXTERNALSYM MAX_IRQS}
  MAX_DMA_CHANNELS      = 7;     // Win95 compatibility--not applicable to 32-bit ConfigMgr
  {$EXTERNALSYM MAX_DMA_CHANNELS}

  DWORD_MAX             = $FFFFFFFF;
  {$EXTERNALSYM DWORD_MAX}
  DWORDLONG_MAX         = $FFFFFFFFFFFFFFFF;
  {$EXTERNALSYM DWORDLONG_MAX}

  CONFIGMG_VERSION      = $0400;
  {$EXTERNALSYM CONFIGMG_VERSION}

type
  PDWORDLONG = ^DWORDLONG;
  {$EXTERNALSYM PDWORDLONG}
  DWORDLONG = Int64; // (rom) no unsigned Int64 available in Delphi
  {$EXTERNALSYM DWORDLONG}

//--------------------------------------------------------------
// Data types
//--------------------------------------------------------------

  //
  // Standardized Return Value data type
  //
  RETURN_TYPE = DWORD;
  {$EXTERNALSYM RETURN_TYPE}
  CONFIGRET = RETURN_TYPE;
  {$EXTERNALSYM CONFIGRET}

  //
  // Device Instance Handle data type
  //
  PDEVNODE = ^DEVNODE;
  {$EXTERNALSYM PDEVNODE}
  DEVNODE = DWORD;
  {$EXTERNALSYM DEVNODE}
  PDEVINST = ^DEVINST;
  {$EXTERNALSYM PDEVINST}
  DEVINST = DWORD;
  {$EXTERNALSYM DEVINST}

  //
  // Device Instance Identifier data type
  // The device instance ID specifies the registry path, relative to the
  // Enum key , for a device instance.  For example:  \Root\*PNP0500\0000.
  //
  DEVNODEID_A = PAnsiChar; // Device ID ANSI name.
  {$EXTERNALSYM DEVNODEID_A}
  DEVNODEID_W = PWideChar; // Device ID Unicode name.
  {$EXTERNALSYM DEVNODEID_W}
  DEVINSTID_A = PAnsiChar; // Device ID ANSI name.
  {$EXTERNALSYM DEVINSTID_A}
  DEVINSTID_W = PWideChar; // Device ID Unicode name.
  {$EXTERNALSYM DEVINSTID_W}
  {$IFDEF UNICODE}
  DEVNODEID = DEVNODEID_W;
  DEVINSTID = DEVINSTID_W;
  {$ELSE}
  DEVNODEID = DEVNODEID_A;
  DEVINSTID = DEVINSTID_A;
  {$ENDIF UNICODE}
  {$EXTERNALSYM DEVNODEID}
  {$EXTERNALSYM DEVINSTID}

  //
  // Logical Configuration Handle data type
  //
  LOG_CONF = DWORD_PTR;
  {$EXTERNALSYM LOG_CONF}
  PLOG_CONF = ^LOG_CONF;
  {$EXTERNALSYM PLOG_CONF}

  //
  // Resource Descriptor Handle data type
  //
  RES_DES = DWORD_PTR;
  {$EXTERNALSYM RES_DES}
  PRES_DES = ^RES_DES;
  {$EXTERNALSYM PRES_DES}

  //
  // Resource ID data type (may take any of the ResType_* values)
  //
  RESOURCEID = ULONG;
  {$EXTERNALSYM RESOURCEID}
  PRESOURCEID = ^RESOURCEID;
  {$EXTERNALSYM PRESOURCEID}

  //
  // Priority data type (may take any of the LCPRI_* values)
  //
  PRIORITY = ULONG;
  {$EXTERNALSYM PRIORITY}
  PPRIORITY = ^PRIORITY;
  {$EXTERNALSYM PPRIORITY}

  //
  // Range List Handle data type
  //
  RANGE_LIST = DWORD_PTR;
  {$EXTERNALSYM RANGE_LIST}
  PRANGE_LIST = ^RANGE_LIST;
  {$EXTERNALSYM PRANGE_LIST}

  //
  // Range Element Handle data type
  //
  RANGE_ELEMENT = DWORD_PTR;
  {$EXTERNALSYM RANGE_ELEMENT}
  PRANGE_ELEMENT = ^RANGE_ELEMENT;
  {$EXTERNALSYM PRANGE_ELEMENT}

  //
  // Machine Handle data type
  //
  HMACHINE = THandle;
  {$EXTERNALSYM HMACHINE}
  PHMACHINE = ^HMACHINE;
  {$EXTERNALSYM PHMACHINE}

  //
  // Conflict List data types
  //
  CONFLICT_LIST = ULONG_PTR;
  {$EXTERNALSYM CONFLICT_LIST}
  PCONFLICT_LIST = ^CONFLICT_LIST;
  {$EXTERNALSYM PCONFLICT_LIST}

  PCONFLICT_DETAILS_A = ^CONFLICT_DETAILS_A;
  {$EXTERNALSYM PCONFLICT_DETAILS_A}
  CONFLICT_DETAILS_A = packed record
    CD_ulSize: ULONG;                   // size of structure, ie: sizeof(CONFLICT_DETAILS)
    CD_ulMask: ULONG;                   // indicates what information is required/valid
    CD_dnDevInst: DEVINST;              // filled with DevInst of conflicting device if CM_CDMASK_DEVINST set
    CD_rdResDes: RES_DES;               // filled with a ResDes of conflict if CM_CDMASK_RESDES set
    CD_ulFlags: ULONG;                  // various flags regarding conflict
    CD_szDescription: array [0..MAX_PATH-1] of Char;  // description of conflicting device
  end;
  {$EXTERNALSYM CONFLICT_DETAILS_A}

  PCONFLICT_DETAILS_W = ^CONFLICT_DETAILS_W;
  {$EXTERNALSYM PCONFLICT_DETAILS_W}
  CONFLICT_DETAILS_W = packed record
    CD_ulSize: ULONG;                   // size of structure, ie: sizeof(CONFLICT_DETAILS)
    CD_ulMask: ULONG;                   // indicates what information is required/valid
    CD_dnDevInst: DEVINST;              // filled with DevInst of conflicting device if CM_CDMASK_DEVINST set
    CD_rdResDes: RES_DES;               // filled with a ResDes of conflict if CM_CDMASK_RESDES set
    CD_ulFlags: ULONG;                  // various flags regarding conflict
    CD_szDescription: array [0..MAX_PATH-1] of WideChar;  // description of conflicting device
  end;
  {$EXTERNALSYM CONFLICT_DETAILS_W}

  {$IFDEF UNICODE}
  CONFLICT_DETAILS = CONFLICT_DETAILS_W;
  PCONFLICT_DETAILS = PCONFLICT_DETAILS_W;
  {$ELSE}
  CONFLICT_DETAILS = CONFLICT_DETAILS_A;
  PCONFLICT_DETAILS = PCONFLICT_DETAILS_A;
  {$ENDIF UNICODE}
  {$EXTERNALSYM CONFLICT_DETAILS}
  {$EXTERNALSYM PCONFLICT_DETAILS}

const
  CM_CDMASK_DEVINST      = $00000001;   // mask to retrieve CD_dnDevInst attribute for conflict
  {$EXTERNALSYM CM_CDMASK_DEVINST}
  CM_CDMASK_RESDES       = $00000002;   // mask to retrieve CD_rdResDes attribute for conflict
  {$EXTERNALSYM CM_CDMASK_RESDES}
  CM_CDMASK_FLAGS        = $00000004;   // mask to retrieve CD_ulFlags attribute for conflict
  {$EXTERNALSYM CM_CDMASK_FLAGS}
  CM_CDMASK_DESCRIPTION  = $00000008;   // mask to retrieve CD_szDescription attribute for conflict
  {$EXTERNALSYM CM_CDMASK_DESCRIPTION}
  CM_CDMASK_VALID        = $0000000F;   // valid bits
  {$EXTERNALSYM CM_CDMASK_VALID}

  CM_CDFLAGS_DRIVER      = $00000001;   // CD_ulFlags: CD_szDescription reports back legacy driver name
  {$EXTERNALSYM CM_CDFLAGS_DRIVER}
  CM_CDFLAGS_ROOT_OWNED  = $00000002;   // CD_ulFlags: Root owned device
  {$EXTERNALSYM CM_CDFLAGS_ROOT_OWNED}
  CM_CDFLAGS_RESERVED    = $00000004;   // CD_ulFlags: Specified range is not available for use
  {$EXTERNALSYM CM_CDFLAGS_RESERVED}

type
  REGDISPOSITION = ^ULONG;
  {$EXTERNALSYM REGDISPOSITION}

//--------------------------------------------------------------
// Memory resource
//--------------------------------------------------------------

const
  //
  // Define the attribute flags for memory ranges.  Each bit flag is
  // identified by a constant bitmask.  Following the bitmask definition,
  // are the two possible values.
  //
  mMD_MemoryType              = $1; // Bitmask, whether memory is writable
  {$EXTERNALSYM mMD_MemoryType}
  fMD_MemoryType              = mMD_MemoryType; // compatibility
  {$EXTERNALSYM fMD_MemoryType}
  fMD_ROM                     = $0; // Memory range is read-only
  {$EXTERNALSYM fMD_ROM}
  fMD_RAM                     = $1; // Memory range may be written to
  {$EXTERNALSYM fMD_RAM}

  mMD_32_24                   = $2; // Bitmask, memory is 24 or 32-bit
  {$EXTERNALSYM mMD_32_24}
  fMD_32_24                   = mMD_32_24; // compatibility
  {$EXTERNALSYM fMD_32_24}
  fMD_24                      = $0; // Memory range is 24-bit
  {$EXTERNALSYM fMD_24}
  fMD_32                      = $2; // Memory range is 32-bit
  {$EXTERNALSYM fMD_32}

  mMD_Prefetchable            = $4; // Bitmask,whether memory prefetchable
  {$EXTERNALSYM mMD_Prefetchable}
  fMD_Prefetchable            = mMD_Prefetchable; // compatibility
  {$EXTERNALSYM fMD_Prefetchable}
  fMD_Pref                    = mMD_Prefetchable; // compatibility
  {$EXTERNALSYM fMD_Pref}
  fMD_PrefetchDisallowed      = $0; // Memory range is not prefetchable
  {$EXTERNALSYM fMD_PrefetchDisallowed}
  fMD_PrefetchAllowed         = $4; // Memory range is prefetchable
  {$EXTERNALSYM fMD_PrefetchAllowed}

  mMD_Readable                = $8; // Bitmask,whether memory is readable
  {$EXTERNALSYM mMD_Readable}
  fMD_Readable                = mMD_Readable; // compatibility
  {$EXTERNALSYM fMD_Readable}
  fMD_ReadAllowed             = $0; // Memory range is readable
  {$EXTERNALSYM fMD_ReadAllowed}
  fMD_ReadDisallowed          = $8; // Memory range is write-only
  {$EXTERNALSYM fMD_ReadDisallowed}

  mMD_CombinedWrite           = $10; // Bitmask,supports write-behind
  {$EXTERNALSYM mMD_CombinedWrite}
  fMD_CombinedWrite           = mMD_CombinedWrite; // compatibility
  {$EXTERNALSYM fMD_CombinedWrite}
  fMD_CombinedWriteDisallowed = $0;  // no combined-write caching
  {$EXTERNALSYM fMD_CombinedWriteDisallowed}
  fMD_CombinedWriteAllowed    = $10; // supports combined-write caching
  {$EXTERNALSYM fMD_CombinedWriteAllowed}

  mMD_Cacheable               = $20; // Bitmask,whether memory is cacheable
  {$EXTERNALSYM mMD_Cacheable}
  fMD_NonCacheable            = $0;  // Memory range is non-cacheable
  {$EXTERNALSYM fMD_NonCacheable}
  fMD_Cacheable               = $20; // Memory range is cacheable
  {$EXTERNALSYM fMD_Cacheable}

type

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -