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

📄 jwawinreg.pas

📁 比较全面的win32api开发包
💻 PAS
📖 第 1 页 / 共 5 页
字号:
{$EXTERNALSYM RegRestoreKeyA}
function RegRestoreKeyW(hKey: HKEY; lpFile: LPCWSTR; dwFlags: DWORD): LONG; stdcall;
{$EXTERNALSYM RegRestoreKeyW}

{$IFDEF UNICODE}
function RegRestoreKey(hKey: HKEY; lpFile: LPCWSTR; dwFlags: DWORD): LONG; stdcall;
{$EXTERNALSYM RegRestoreKey}
{$ELSE}
function RegRestoreKey(hKey: HKEY; lpFile: LPCSTR; dwFlags: DWORD): LONG; stdcall;
{$EXTERNALSYM RegRestoreKey}
{$ENDIF}

function RegSaveKeyA(hKey: HKEY; lpFile: LPCSTR;
  lpSecurityAttributes: LPSECURITY_ATTRIBUTES): LONG; stdcall;
{$EXTERNALSYM RegSaveKeyA}
function RegSaveKeyW(hKey: HKEY; lpFile: LPCWSTR;
  lpSecurityAttributes: LPSECURITY_ATTRIBUTES): LONG; stdcall;
{$EXTERNALSYM RegSaveKeyW}

{$IFDEF UNICODE}
function RegSaveKey(hKey: HKEY; lpFile: LPCWSTR;
  lpSecurityAttributes: LPSECURITY_ATTRIBUTES): LONG; stdcall;
{$EXTERNALSYM RegSaveKey}
{$ELSE}
function RegSaveKey(hKey: HKEY; lpFile: LPCSTR;
  lpSecurityAttributes: LPSECURITY_ATTRIBUTES): LONG; stdcall;
{$EXTERNALSYM RegSaveKey}
{$ENDIF}

function RegSetKeySecurity(hKey: HKEY; SecurityInformation: SECURITY_INFORMATION;
  pSecurityDescriptor: PSECURITY_DESCRIPTOR): LONG; stdcall;
{$EXTERNALSYM RegSetKeySecurity}

function RegSetValueA(hKey: HKEY; lpSubKey: LPCSTR; dwType: DWORD;
  lpData: LPCSTR; cbData: DWORD): LONG; stdcall;
{$EXTERNALSYM RegSetValueA}
function RegSetValueW(hKey: HKEY; lpSubKey: LPCWSTR; dwType: DWORD;
  lpData: LPCWSTR; cbData: DWORD): LONG; stdcall;
{$EXTERNALSYM RegSetValueW}

{$IFDEF UNICODE}
function RegSetValue(hKey: HKEY; lpSubKey: LPCWSTR; dwType: DWORD;
  lpData: LPCWSTR; cbData: DWORD): LONG; stdcall;
{$EXTERNALSYM RegSetValue}
{$ELSE}
function RegSetValue(hKey: HKEY; lpSubKey: LPCSTR; dwType: DWORD;
  lpData: LPCSTR; cbData: DWORD): LONG; stdcall;
{$EXTERNALSYM RegSetValue}
{$ENDIF}

function RegSetValueExA(hKey: HKEY; lpValueName: LPCSTR; Reserved: DWORD;
  dwType: DWORD; lpData: LPBYTE; cbData: DWORD): LONG; stdcall;
{$EXTERNALSYM RegSetValueExA}
function RegSetValueExW(hKey: HKEY; lpValueName: LPCWSTR; Reserved: DWORD;
  dwType: DWORD; lpData: LPBYTE; cbData: DWORD): LONG; stdcall;
{$EXTERNALSYM RegSetValueExW}

{$IFDEF UNICODE}
function RegSetValueEx(hKey: HKEY; lpValueName: LPCWSTR; Reserved: DWORD;
  dwType: DWORD; lpData: LPBYTE; cbData: DWORD): LONG; stdcall;
{$EXTERNALSYM RegSetValueEx}
{$ELSE}
function RegSetValueEx(hKey: HKEY; lpValueName: LPCSTR; Reserved: DWORD;
  dwType: DWORD; lpData: LPBYTE; cbData: DWORD): LONG; stdcall;
{$EXTERNALSYM RegSetValueEx}
{$ENDIF}

function RegUnLoadKeyA(hKey: HKEY; lpSubKey: LPCSTR): LONG; stdcall;
{$EXTERNALSYM RegUnLoadKeyA}
function RegUnLoadKeyW(hKey: HKEY; lpSubKey: LPCWSTR): LONG; stdcall;
{$EXTERNALSYM RegUnLoadKeyW}

{$IFDEF UNICODE}
function RegUnLoadKey(hKey: HKEY; lpSubKey: LPCWSTR): LONG; stdcall;
{$EXTERNALSYM RegUnLoadKey}
{$ELSE}
function RegUnLoadKey(hKey: HKEY; lpSubKey: LPCSTR): LONG; stdcall;
{$EXTERNALSYM RegUnLoadKey}
{$ENDIF}

//
// Remoteable System Shutdown APIs
//

function InitiateSystemShutdownA(lpMachineName: LPSTR; lpMessage: LPSTR;
  dwTimeout: DWORD; bForceAppsClosed, bRebootAfterShutdown: BOOL): BOOL; stdcall;
{$EXTERNALSYM InitiateSystemShutdownA}
function InitiateSystemShutdownW(lpMachineName: LPWSTR; lpMessage: LPWSTR;
  dwTimeout: DWORD; bForceAppsClosed, bRebootAfterShutdown: BOOL): BOOL; stdcall;
{$EXTERNALSYM InitiateSystemShutdownW}

{$IFDEF UNICODE}
function InitiateSystemShutdown(lpMachineName: LPWSTR; lpMessage: LPWSTR;
  dwTimeout: DWORD; bForceAppsClosed, bRebootAfterShutdown: BOOL): BOOL; stdcall;
{$EXTERNALSYM InitiateSystemShutdown}
{$ELSE}
function InitiateSystemShutdown(lpMachineName: LPSTR; lpMessage: LPSTR;
  dwTimeout: DWORD; bForceAppsClosed, bRebootAfterShutdown: BOOL): BOOL; stdcall;
{$EXTERNALSYM InitiateSystemShutdown}
{$ENDIF}

function AbortSystemShutdownA(lpMachineName: LPSTR): BOOL; stdcall;
{$EXTERNALSYM AbortSystemShutdownA}
function AbortSystemShutdownW(lpMachineName: LPWSTR): BOOL; stdcall;
{$EXTERNALSYM AbortSystemShutdownW}

{$IFDEF UNICODE}
function AbortSystemShutdown(lpMachineName: LPWSTR): BOOL; stdcall;
{$EXTERNALSYM AbortSystemShutdown}
{$ELSE}
function AbortSystemShutdown(lpMachineName: LPSTR): BOOL; stdcall;
{$EXTERNALSYM AbortSystemShutdown}
{$ENDIF}

//
// defines for InitiateSystemShutdownEx reason codes
//

const
  REASON_SWINSTALL    = SHTDN_REASON_MAJOR_SOFTWARE or SHTDN_REASON_MINOR_INSTALLATION;
  {$EXTERNALSYM REASON_SWINSTALL}
  REASON_HWINSTALL    = SHTDN_REASON_MAJOR_HARDWARE or SHTDN_REASON_MINOR_INSTALLATION;
  {$EXTERNALSYM REASON_HWINSTALL}
  REASON_SERVICEHANG  = SHTDN_REASON_MAJOR_SOFTWARE or SHTDN_REASON_MINOR_HUNG;
  {$EXTERNALSYM REASON_SERVICEHANG}
  REASON_UNSTABLE     = SHTDN_REASON_MAJOR_SYSTEM or SHTDN_REASON_MINOR_UNSTABLE;
  {$EXTERNALSYM REASON_UNSTABLE}
  REASON_SWHWRECONF   = SHTDN_REASON_MAJOR_SOFTWARE or SHTDN_REASON_MINOR_RECONFIG;
  {$EXTERNALSYM REASON_SWHWRECONF}
  REASON_OTHER        = SHTDN_REASON_MAJOR_OTHER or SHTDN_REASON_MINOR_OTHER;
  {$EXTERNALSYM REASON_OTHER}
  REASON_UNKNOWN      = SHTDN_REASON_UNKNOWN;
  {$EXTERNALSYM REASON_UNKNOWN}
  REASON_LEGACY_API   = SHTDN_REASON_LEGACY_API;
  {$EXTERNALSYM REASON_LEGACY_API}
  REASON_PLANNED_FLAG = SHTDN_REASON_FLAG_PLANNED;
  {$EXTERNALSYM REASON_PLANNED_FLAG}

//
// MAX Shutdown TimeOut == 10 Years in seconds
//

  MAX_SHUTDOWN_TIMEOUT = (10*365*24*60*60);
  {$EXTERNALSYM MAX_SHUTDOWN_TIMEOUT}

function InitiateSystemShutdownExA(lpMachineName: LPSTR; lpMessage: LPSTR;
  dwTimeout: DWORD; bForceAppsClosed, bRebootAfterShutdown: BOOL; dwReason: DWORD): BOOL; stdcall;
{$EXTERNALSYM InitiateSystemShutdownExA}
function InitiateSystemShutdownExW(lpMachineName: LPWSTR; lpMessage: LPWSTR;
  dwTimeout: DWORD; bForceAppsClosed, bRebootAfterShutdown: BOOL; dwReason: DWORD): BOOL; stdcall;
{$EXTERNALSYM InitiateSystemShutdownExW}

{$IFDEF UNICODE}
function InitiateSystemShutdownEx(lpMachineName: LPWSTR; lpMessage: LPWSTR;
  dwTimeout: DWORD; bForceAppsClosed, bRebootAfterShutdown: BOOL; dwReason: DWORD): BOOL; stdcall;
{$EXTERNALSYM InitiateSystemShutdownEx}
{$ELSE}
function InitiateSystemShutdownEx(lpMachineName: LPSTR; lpMessage: LPSTR;
  dwTimeout: DWORD; bForceAppsClosed, bRebootAfterShutdown: BOOL; dwReason: DWORD): BOOL; stdcall;
{$EXTERNALSYM InitiateSystemShutdownEx}
{$ENDIF}

function RegSaveKeyExA(hKey: HKEY; lpFile: LPCSTR;
  lpSecurityAttributes: LPSECURITY_ATTRIBUTES; Flags: DWORD): LONG; stdcall;
{$EXTERNALSYM RegSaveKeyExA}
function RegSaveKeyExW(hKey: HKEY; lpFile: LPCWSTR;
  lpSecurityAttributes: LPSECURITY_ATTRIBUTES; Flags: DWORD): LONG; stdcall;
{$EXTERNALSYM RegSaveKeyExW}

{$IFDEF UNICODE}
function RegSaveKeyEx(hKey: HKEY; lpFile: LPCWSTR;
  lpSecurityAttributes: LPSECURITY_ATTRIBUTES; Flags: DWORD): LONG; stdcall;
{$EXTERNALSYM RegSaveKeyEx}
{$ELSE}
function RegSaveKeyEx(hKey: HKEY; lpFile: LPCSTR;
  lpSecurityAttributes: LPSECURITY_ATTRIBUTES; Flags: DWORD): LONG; stdcall;
{$EXTERNALSYM RegSaveKeyEx}
{$ENDIF}

function Wow64Win32ApiEntry(dwFuncNumber, dwFlag, dwRes: DWORD): LONG; stdcall;
{$EXTERNALSYM Wow64Win32ApiEntry}

implementation

const
  advapi32 = 'advapi32.dll';


{$IFDEF DYNAMIC_LINK}
var
  _RegCloseKey: Pointer;

function RegCloseKey;
begin
  GetProcedureAddress(_RegCloseKey, advapi32, 'RegCloseKey');
  asm
    mov esp, ebp
    pop ebp
    jmp [_RegCloseKey]
  end;
end;
{$ELSE}
function RegCloseKey; external advapi32 name 'RegCloseKey';
{$ENDIF DYNAMIC_LINK}

{$IFDEF DYNAMIC_LINK}
var
  _RegOverridePredefKey: Pointer;

function RegOverridePredefKey;
begin
  GetProcedureAddress(_RegOverridePredefKey, advapi32, 'RegOverridePredefKey');
  asm
    mov esp, ebp
    pop ebp
    jmp [_RegOverridePredefKey]
  end;
end;
{$ELSE}
function RegOverridePredefKey; external advapi32 name 'RegOverridePredefKey';
{$ENDIF DYNAMIC_LINK}

{$IFDEF DYNAMIC_LINK}
var
  _RegOpenUserClassesRoot: Pointer;

function RegOpenUserClassesRoot;
begin
  GetProcedureAddress(_RegOpenUserClassesRoot, advapi32, 'RegOpenUserClassesRoot');
  asm
    mov esp, ebp
    pop ebp
    jmp [_RegOpenUserClassesRoot]
  end;
end;
{$ELSE}
function RegOpenUserClassesRoot; external advapi32 name 'RegOpenUserClassesRoot';
{$ENDIF DYNAMIC_LINK}

{$IFDEF DYNAMIC_LINK}
var
  _RegOpenCurrentUser: Pointer;

function RegOpenCurrentUser;
begin
  GetProcedureAddress(_RegOpenCurrentUser, advapi32, 'RegOpenCurrentUser');
  asm
    mov esp, ebp
    pop ebp
    jmp [_RegOpenCurrentUser]
  end;
end;
{$ELSE}
function RegOpenCurrentUser; external advapi32 name 'RegOpenCurrentUser';
{$ENDIF DYNAMIC_LINK}

{$IFDEF DYNAMIC_LINK}
var
  _RegDisablePredefinedCache: Pointer;

function RegDisablePredefinedCache;
begin
  GetProcedureAddress(_RegDisablePredefinedCache, advapi32, 'RegDisablePredefinedCache');
  asm
    mov esp, ebp
    pop ebp
    jmp [_RegDisablePredefinedCache]
  end;
end;
{$ELSE}
function RegDisablePredefinedCache; external advapi32 name 'RegDisablePredefinedCache';
{$ENDIF DYNAMIC_LINK}

{$IFDEF DYNAMIC_LINK}
var
  _RegConnectRegistryA: Pointer;

function RegConnectRegistryA;
begin
  GetProcedureAddress(_RegConnectRegistryA, advapi32, 'RegConnectRegistryA');
  asm
    mov esp, ebp
    pop ebp
    jmp [_RegConnectRegistryA]
  end;
end;
{$ELSE}
function RegConnectRegistryA; external advapi32 name 'RegConnectRegistryA';
{$ENDIF DYNAMIC_LINK}

{$IFDEF DYNAMIC_LINK}
var
  _RegConnectRegistryW: Pointer;

function RegConnectRegistryW;
begin
  GetProcedureAddress(_RegConnectRegistryW, advapi32, 'RegConnectRegistryW');
  asm
    mov esp, ebp
    pop ebp
    jmp [_RegConnectRegistryW]
  end;
end;
{$ELSE}
function RegConnectRegistryW; external advapi32 name 'RegConnectRegistryW';
{$ENDIF DYNAMIC_LINK}
{$IFDEF UNICODE}

{$IFDEF DYNAMIC_LINK}
var
  _RegConnectRegistry: Pointer;

function RegConnectRegistry;
begin
  GetProcedureAddress(_RegConnectRegistry, advapi32, 'RegConnectRegistryW');
  asm
    mov esp, ebp
    pop ebp
    jmp [_RegConnectRegistry]
  end;
end;
{$ELSE}
function RegConnectRegistry; external advapi32 name 'RegConnectRegistryW';
{$ENDIF DYNAMIC_LINK}
{$ELSE}

{$IFDEF DYNAMIC_LINK}
var
  _RegConnectRegistry: Pointer;

function RegConnectRegistry;
begin
  GetProcedureAddress(_RegConnectRegistry, advapi32, 'RegConnectRegistryA');
  asm
    mov esp, ebp
    pop ebp
    jmp [_RegConnectRegistry]
  end;
end;
{$ELSE}
function RegConnectRegistry; external advapi32 name 'RegConnectRegistryA';
{$ENDIF DYNAMIC_LINK}
{$ENDIF}

{$IFDEF DYNAMIC_LINK}
var
  _RegCreateKeyA: Pointer;

function RegCreateKeyA;
begin
  GetProcedureAddress(_RegCreateKeyA, advapi32, 'RegCreateKeyA');
  asm
    mov esp, ebp
    pop ebp
    jmp [_RegCreateKeyA]
  end;
end;
{$ELSE}
function RegCreateKeyA; external advapi32 name 'RegCreateKeyA';
{$ENDIF DYNAMIC_LINK}

{$IFDEF DYNAMIC_LINK}
var
  _RegCreateKeyW: Pointer;

function RegCreateKeyW;
begin
  GetProcedureAddress(_RegCreateKeyW, advapi32, 'RegCreateKeyW');
  asm
    mov esp, ebp
    pop ebp
    jmp [_RegCreateKeyW]
  end;
end;
{$ELSE}
function RegCreateKeyW; external advapi32 name 'RegCreateKeyW';
{$ENDIF DYNAMIC_LINK}
{$IFDEF UNICODE}

{$IFDEF DYNAMIC_LINK}
var
  _RegCreateKey: Pointer;

function RegCreateKey;
begin
  GetProcedureAddress(_RegCreateKey, advapi32, 'RegCreateKeyW');
  asm
    mov esp, ebp
    pop ebp
    jmp [_RegCreateKey]
  end;
end;
{$ELSE}
function RegCreateKey; external advapi32 name 'RegCreateKeyW';
{$ENDIF DYNAMIC_LINK}
{$ELSE}

{$IFDEF DYNAMIC_LINK}
var
  _RegCreateKey: Pointer;

function RegCreateKey;
begin
  GetProcedureAddress(_RegCreateKey, advapi32, 'RegCreateKeyA');
  asm
    mov esp, ebp
    pop ebp
    jmp [_RegCreateKey]
  end;
end;
{$ELSE}
function RegCreateKey; external advapi32 name 'RegCreateKeyA';
{$ENDIF DYNAMIC_LINK}
{$ENDIF}

{$IFDEF DYNAMIC_LINK}
var
  _RegCreateKeyExA: Pointer;

function RegCreateKeyExA;
begin
  GetProcedureAddress(_RegCreateKeyExA, advapi32, 'RegCreateKeyExA');
  asm
    mov esp, ebp
    pop ebp
    jmp [_RegCreateKeyExA]
  end;
end;
{$ELSE}
function RegCreateKeyExA; external advapi32 name 'RegCreateKeyExA';
{$ENDIF DYNAMIC_LINK}

{$IFDEF DYNAMIC_LINK}
var
  _RegCreateKeyExW: Pointer;

function RegCreateKeyExW;
begin
  GetProcedureAddress(_RegCreateKeyExW, advapi32, 'RegCreateKeyExW');
  asm
    mov esp, ebp
    pop ebp
    jmp [_RegCreateKeyExW]
  end;
end;
{$ELSE}
function RegCreateKeyExW; external advapi32 name 'RegCreateKeyExW';
{$ENDIF DYNAMIC_LINK}
{$IFDEF UNICODE}

{$IFDEF DYNAMIC_LINK}
var
  _RegCreateKeyEx: Pointer;

function RegCreateKeyEx;
begin
  GetProcedureAddress(_RegCreateKeyEx, advapi32, 'RegCreateKeyExW');
  asm
    mov esp, ebp
    pop ebp
    jmp [_RegCreateKeyEx]
  end;
end;
{$ELSE}
function RegCreateKeyEx; external advapi32 name 'RegCreateKeyExW';
{$ENDIF DYNAMIC_LINK}
{$ELSE}

{$IFDEF DYNAMIC_LINK}
var
  _RegCreateKeyEx: Pointer;

function RegCreateKeyEx;
begin
  GetProcedureAddress(_RegCreateKeyEx, advapi32, 'RegCreateKeyExA');
  asm
    mov esp, ebp
    pop ebp
    jmp [_RegCreateKeyEx]
  end;
end;
{$ELSE}
function RegCreateKeyEx; external advapi32 name 'RegCreateKeyExA';
{$ENDIF DYNAMIC_LINK}
{$ENDIF}

{$IFDEF DYNAMIC_LINK}
var
  _RegDeleteKeyA: Pointer;

function RegDeleteKeyA;
begin
  GetProcedureAddress(_RegDeleteKeyA, advapi32, 'RegDeleteKeyA');
  asm
    mov esp, ebp
    pop ebp
    jmp [_RegDeleteKeyA]
  end;
end;
{$ELSE}
function RegDeleteKeyA; external advapi32 name 'RegDeleteKeyA';
{$ENDIF DYNAMIC_LINK}

{$IFDEF DYNAMIC_LINK}
var
  _RegDeleteKeyW: Pointer;

function RegDeleteKeyW;
begin
  GetProcedureAddress(_RegDeleteKeyW, advapi32, 'RegDeleteKeyW');
  asm
    mov esp, ebp
    pop ebp
    jmp [_RegDeleteKeyW]
  end;
end;
{$ELSE}

⌨️ 快捷键说明

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