~ubuntu-branches/ubuntu/dapper/fpc/dapper

« back to all changes in this revision

Viewing changes to packages/extra/winunits/jwapowrprof.pas

  • Committer: Bazaar Package Importer
  • Author(s): Carlos Laviola
  • Date: 2005-05-30 11:59:10 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050530115910-x5pbzm4qqta4i94h
Tags: 2.0.0-2
debian/fp-compiler.postinst.in: forgot to reapply the patch that
correctly creates the slave link to pc(1).  (Closes: #310907)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{******************************************************************************}
 
2
{                                                                              }
 
3
{ Power Policy Applicator interface Unit for Object Pascal                     }
 
4
{                                                                              }
 
5
{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
 
6
{ Corporation. All Rights Reserved.                                            }
 
7
{                                                                              }
 
8
{ The original file is: powrprof.h, released June 2000. The original Pascal    }
 
9
{ code is: PowrProf.pas, released August 2001. The initial developer of the    }
 
10
{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
 
11
{                                                                              }
 
12
{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
 
13
{ Marcel van Brakel. All Rights Reserved.                                      }
 
14
{                                                                              }
 
15
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
 
16
{                                                                              }
 
17
{ You may retrieve the latest version of this file at the Project JEDI         }
 
18
{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
 
19
{                                                                              }
 
20
{ The contents of this file are used with permission, subject to the Mozilla   }
 
21
{ Public License Version 1.1 (the "License"); you may not use this file except }
 
22
{ in compliance with the License. You may obtain a copy of the License at      }
 
23
{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
 
24
{                                                                              }
 
25
{ Software distributed under the License is distributed on an "AS IS" basis,   }
 
26
{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
 
27
{ the specific language governing rights and limitations under the License.    }
 
28
{                                                                              }
 
29
{ Alternatively, the contents of this file may be used under the terms of the  }
 
30
{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
 
31
{ provisions of the LGPL License are applicable instead of those above.        }
 
32
{ If you wish to allow use of your version of this file only under the terms   }
 
33
{ of the LGPL License and not to allow others to use your version of this file }
 
34
{ under the MPL, indicate your decision by deleting  the provisions above and  }
 
35
{ replace  them with the notice and other provisions required by the LGPL      }
 
36
{ License.  If you do not delete the provisions above, a recipient may use     }
 
37
{ your version of this file under either the MPL or the LGPL License.          }
 
38
{                                                                              }
 
39
{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
 
40
{                                                                              }
 
41
{******************************************************************************}
 
42
 
 
43
// $Id: jwapowrprof.pas,v 1.1 2005/04/04 07:56:10 marco Exp $
 
44
 
 
45
unit JwaPowrProf;
 
46
 
 
47
{$WEAKPACKAGEUNIT}
 
48
 
 
49
{$HPPEMIT ''}
 
50
{$HPPEMIT '#include "powrprof.h"'}
 
51
{$HPPEMIT ''}
 
52
 
 
53
{$I jediapilib.inc}
 
54
 
 
55
interface
 
56
 
 
57
uses
 
58
  JwaWinNT, JwaWinType;
 
59
 
 
60
// Registry storage structures for the GLOBAL_POWER_POLICY data. There are two
 
61
// structures, GLOBAL_MACHINE_POWER_POLICY and GLOBAL_USER_POWER_POLICY. the
 
62
// GLOBAL_MACHINE_POWER_POLICY stores per machine data for which there is no UI.
 
63
// GLOBAL_USER_POWER_POLICY stores the per user data.
 
64
 
 
65
type
 
66
  PGLOBAL_MACHINE_POWER_POLICY = ^GLOBAL_MACHINE_POWER_POLICY;
 
67
  {$EXTERNALSYM PGLOBAL_MACHINE_POWER_POLICY}
 
68
  _GLOBAL_MACHINE_POWER_POLICY = record
 
69
    Revision: ULONG;
 
70
    LidOpenWakeAc: SYSTEM_POWER_STATE;
 
71
    LidOpenWakeDc: SYSTEM_POWER_STATE;
 
72
    BroadcastCapacityResolution: ULONG;
 
73
  end;
 
74
  {$EXTERNALSYM _GLOBAL_MACHINE_POWER_POLICY}
 
75
  GLOBAL_MACHINE_POWER_POLICY = _GLOBAL_MACHINE_POWER_POLICY;
 
76
  {$EXTERNALSYM GLOBAL_MACHINE_POWER_POLICY}
 
77
  TGlobalMachinePowerPolicy = GLOBAL_MACHINE_POWER_POLICY;
 
78
  PGlobalMachinePowerPolicy = PGLOBAL_MACHINE_POWER_POLICY;
 
79
 
 
80
  PGLOBAL_USER_POWER_POLICY = ^GLOBAL_USER_POWER_POLICY;
 
81
  {$EXTERNALSYM PGLOBAL_USER_POWER_POLICY}
 
82
  _GLOBAL_USER_POWER_POLICY = record
 
83
    Revision: ULONG;
 
84
    PowerButtonAc: POWER_ACTION_POLICY;
 
85
    PowerButtonDc: POWER_ACTION_POLICY;
 
86
    SleepButtonAc: POWER_ACTION_POLICY;
 
87
    SleepButtonDc: POWER_ACTION_POLICY;
 
88
    LidCloseAc: POWER_ACTION_POLICY;
 
89
    LidCloseDc: POWER_ACTION_POLICY;
 
90
    DischargePolicy: array [0..NUM_DISCHARGE_POLICIES - 1] of SYSTEM_POWER_LEVEL;
 
91
    GlobalFlags: ULONG;
 
92
  end;
 
93
  {$EXTERNALSYM _GLOBAL_USER_POWER_POLICY}
 
94
  GLOBAL_USER_POWER_POLICY = _GLOBAL_USER_POWER_POLICY;
 
95
  {$EXTERNALSYM GLOBAL_USER_POWER_POLICY}
 
96
  TGlobalUserPowerPolicy = GLOBAL_USER_POWER_POLICY;
 
97
  PGlobalUserPowerPolicy = PGLOBAL_USER_POWER_POLICY;
 
98
 
 
99
// Structure to manage global power policies at the user level. This structure
 
100
// contains data which is common across all power policy profiles.
 
101
 
 
102
  PGLOBAL_POWER_POLICY = ^GLOBAL_POWER_POLICY;
 
103
  {$EXTERNALSYM PGLOBAL_POWER_POLICY}
 
104
  _GLOBAL_POWER_POLICY = record
 
105
    user: GLOBAL_USER_POWER_POLICY;
 
106
    mach: GLOBAL_MACHINE_POWER_POLICY;
 
107
  end;
 
108
  {$EXTERNALSYM _GLOBAL_POWER_POLICY}
 
109
  GLOBAL_POWER_POLICY = _GLOBAL_POWER_POLICY;
 
110
  {$EXTERNALSYM GLOBAL_POWER_POLICY}
 
111
  TGlobalPowerPolicy = GLOBAL_POWER_POLICY;
 
112
  PGlobalPowerPolicy = PGLOBAL_POWER_POLICY;
 
113
 
 
114
// Registry storage structures for the POWER_POLICY data. There are three
 
115
// structures, MACHINE_POWER_POLICY, MACHINE_PROCESSOR_POWER_POLICY and USER_POWER_POLICY. the
 
116
// MACHINE_POWER_POLICY stores per machine data for which there is no UI.
 
117
// USER_POWER_POLICY stores the per user data.
 
118
 
 
119
  PMACHINE_POWER_POLICY = ^MACHINE_POWER_POLICY;
 
120
  {$EXTERNALSYM PMACHINE_POWER_POLICY}
 
121
  _MACHINE_POWER_POLICY = record
 
122
    Revision: ULONG; // 1
 
123
    // meaning of power action "sleep"
 
124
    MinSleepAc: SYSTEM_POWER_STATE;
 
125
    MinSleepDc: SYSTEM_POWER_STATE;
 
126
    ReducedLatencySleepAc: SYSTEM_POWER_STATE;
 
127
    ReducedLatencySleepDc: SYSTEM_POWER_STATE;
 
128
    // parameters for dozing
 
129
    DozeTimeoutAc: ULONG;
 
130
    DozeTimeoutDc: ULONG;
 
131
    DozeS4TimeoutAc: ULONG;
 
132
    DozeS4TimeoutDc: ULONG;
 
133
    // processor policies
 
134
    MinThrottleAc: UCHAR;
 
135
    MinThrottleDc: UCHAR;
 
136
    pad1: array [0..1] of UCHAR;
 
137
    OverThrottledAc: POWER_ACTION_POLICY;
 
138
    OverThrottledDc: POWER_ACTION_POLICY;
 
139
  end;
 
140
  {$EXTERNALSYM _MACHINE_POWER_POLICY}
 
141
  MACHINE_POWER_POLICY = _MACHINE_POWER_POLICY;
 
142
  {$EXTERNALSYM MACHINE_POWER_POLICY}
 
143
  TMachinePowerPolicy = MACHINE_POWER_POLICY;
 
144
  PMachinePowerPolicy = PMACHINE_POWER_POLICY;
 
145
 
 
146
  PMACHINE_PROCESSOR_POWER_POLICY = ^MACHINE_PROCESSOR_POWER_POLICY;
 
147
  {$EXTERNALSYM PMACHINE_PROCESSOR_POWER_POLICY}
 
148
  _MACHINE_PROCESSOR_POWER_POLICY = record
 
149
    Revision: ULONG; // 1
 
150
    ProcessorPolicyAc: PROCESSOR_POWER_POLICY;
 
151
    ProcessorPolicyDc: PROCESSOR_POWER_POLICY;
 
152
  end;
 
153
  {$EXTERNALSYM _MACHINE_PROCESSOR_POWER_POLICY}
 
154
  MACHINE_PROCESSOR_POWER_POLICY = _MACHINE_PROCESSOR_POWER_POLICY;
 
155
  {$EXTERNALSYM MACHINE_PROCESSOR_POWER_POLICY}
 
156
  TMachineProcessorPowerPolicy = MACHINE_PROCESSOR_POWER_POLICY;
 
157
  PMachineProcessorPowerPolicy = PMACHINE_PROCESSOR_POWER_POLICY;
 
158
 
 
159
  PUSER_POWER_POLICY = ^USER_POWER_POLICY;
 
160
  {$EXTERNALSYM PUSER_POWER_POLICY}
 
161
  _USER_POWER_POLICY = record
 
162
    Revision: ULONG; // 1
 
163
    // "system idle" detection
 
164
    IdleAc: POWER_ACTION_POLICY;
 
165
    IdleDc: POWER_ACTION_POLICY;
 
166
    IdleTimeoutAc: ULONG;
 
167
    IdleTimeoutDc: ULONG;
 
168
    IdleSensitivityAc: UCHAR;
 
169
    IdleSensitivityDc: UCHAR;
 
170
    // Throttling Policy
 
171
    ThrottlePolicyAc: UCHAR;
 
172
    ThrottlePolicyDc: UCHAR;
 
173
    // meaning of power action "sleep"
 
174
    MaxSleepAc: SYSTEM_POWER_STATE;
 
175
    MaxSleepDc: SYSTEM_POWER_STATE;
 
176
    // For future use
 
177
    Reserved: array [0..1] of ULONG;
 
178
    // video policies
 
179
    VideoTimeoutAc: ULONG;
 
180
    VideoTimeoutDc: ULONG;
 
181
    // hard disk policies
 
182
    SpindownTimeoutAc: ULONG;
 
183
    SpindownTimeoutDc: ULONG;
 
184
    // processor policies
 
185
    OptimizeForPowerAc: ByteBool;
 
186
    OptimizeForPowerDc: ByteBool;
 
187
    FanThrottleToleranceAc: UCHAR;
 
188
    FanThrottleToleranceDc: UCHAR;
 
189
    ForcedThrottleAc: UCHAR;
 
190
    ForcedThrottleDc: UCHAR;
 
191
  end;
 
192
  {$EXTERNALSYM _USER_POWER_POLICY}
 
193
  USER_POWER_POLICY = _USER_POWER_POLICY;
 
194
  {$EXTERNALSYM USER_POWER_POLICY}
 
195
  TUserPowerPolicy = USER_POWER_POLICY;
 
196
  PUserPowerPolicy = PUSER_POWER_POLICY;
 
197
 
 
198
// Structure to manage power policies at the user level. This structure
 
199
// contains data which is unique across power policy profiles.
 
200
 
 
201
  PPOWER_POLICY = ^POWER_POLICY;
 
202
  {$EXTERNALSYM PPOWER_POLICY}
 
203
  _POWER_POLICY = record
 
204
    user: USER_POWER_POLICY;
 
205
    mach: MACHINE_POWER_POLICY;
 
206
  end;
 
207
  {$EXTERNALSYM _POWER_POLICY}
 
208
  POWER_POLICY = _POWER_POLICY;
 
209
  {$EXTERNALSYM POWER_POLICY}
 
210
  TPowerPolicy = POWER_POLICY;
 
211
  PPowerPolicy = PPOWER_POLICY;
 
212
 
 
213
// Constants for GlobalFlags
 
214
 
 
215
const
 
216
  EnableSysTrayBatteryMeter = $01;
 
217
  {$EXTERNALSYM EnableSysTrayBatteryMeter}
 
218
  EnableMultiBatteryDisplay = $02;
 
219
  {$EXTERNALSYM EnableMultiBatteryDisplay}
 
220
  EnablePasswordLogon       = $04;
 
221
  {$EXTERNALSYM EnablePasswordLogon}
 
222
  EnableWakeOnRing          = $08;
 
223
  {$EXTERNALSYM EnableWakeOnRing}
 
224
  EnableVideoDimDisplay     = $10;
 
225
  {$EXTERNALSYM EnableVideoDimDisplay}
 
226
 
 
227
// This constant is passed as a uiID to WritePwrScheme.
 
228
 
 
229
  NEWSCHEME = UINT(-1);
 
230
  {$EXTERNALSYM NEWSCHEME}
 
231
 
 
232
// Prototype for EnumPwrSchemes callback proceedures.
 
233
 
 
234
type
 
235
  PWRSCHEMESENUMPROC = function(uiIndex: UINT; dwName: DWORD; sName: LPTSTR; dwDesc: DWORD; sDesc: LPTSTR; pp: PPOWER_POLICY; lParam: LPARAM): ByteBool; stdcall;
 
236
  {$EXTERNALSYM PWRSCHEMESENUMPROC}
 
237
  PFNNTINITIATEPWRACTION = function(pPowerAction: POWER_ACTION; SystemPowerState: SYSTEM_POWER_STATE; u: ULONG; b: ByteBool): ByteBool; stdcall;
 
238
  {$EXTERNALSYM PFNNTINITIATEPWRACTION}
 
239
 
 
240
// Public function prototypes
 
241
 
 
242
function GetPwrDiskSpindownRange(var RangeMax, RangeMin: UINT): ByteBool; stdcall;
 
243
{$EXTERNALSYM GetPwrDiskSpindownRange}
 
244
function EnumPwrSchemes(lpfnPwrSchemesEnumProc: PWRSCHEMESENUMPROC; lParam: LPARAM): ByteBool; stdcall;
 
245
{$EXTERNALSYM EnumPwrSchemes}
 
246
function ReadGlobalPwrPolicy(var pGlobalPowerPolicy: GLOBAL_POWER_POLICY): ByteBool; stdcall;
 
247
{$EXTERNALSYM ReadGlobalPwrPolicy}
 
248
function ReadPwrScheme(uiID: UINT; var pPowerPolicy: POWER_POLICY): ByteBool; stdcall;
 
249
{$EXTERNALSYM ReadPwrScheme}
 
250
function WritePwrScheme(puiID: PUINT; lpszName, lpszDescription: LPTSTR; const pPowerPolicy: POWER_POLICY): ByteBool; stdcall;
 
251
{$EXTERNALSYM WritePwrScheme}
 
252
function WriteGlobalPwrPolicy(const pGlobalPowerPolicy: GLOBAL_POWER_POLICY): ByteBool; stdcall;
 
253
{$EXTERNALSYM WriteGlobalPwrPolicy}
 
254
function DeletePwrScheme(uiIndex: UINT): ByteBool; stdcall;
 
255
{$EXTERNALSYM DeletePwrScheme}
 
256
function GetActivePwrScheme(var puiID: UINT): ByteBool; stdcall;
 
257
{$EXTERNALSYM GetActivePwrScheme}
 
258
function SetActivePwrScheme(uiID: UINT; pGlobalPowerPolicy: PGLOBAL_POWER_POLICY; pPowerPolicy: PPOWER_POLICY): ByteBool; stdcall;
 
259
{$EXTERNALSYM SetActivePwrScheme}
 
260
function GetPwrCapabilities(var lpSystemPowerCapabilities: SYSTEM_POWER_CAPABILITIES): ByteBool; stdcall;
 
261
{$EXTERNALSYM GetPwrCapabilities}
 
262
function IsPwrSuspendAllowed: ByteBool; stdcall;
 
263
{$EXTERNALSYM IsPwrSuspendAllowed}
 
264
function IsPwrHibernateAllowed: ByteBool; stdcall;
 
265
{$EXTERNALSYM IsPwrHibernateAllowed}
 
266
function IsPwrShutdownAllowed: ByteBool; stdcall;
 
267
{$EXTERNALSYM IsPwrShutdownAllowed}
 
268
function IsAdminOverrideActive(pAdministratorPowerPolicy: PADMINISTRATOR_POWER_POLICY): ByteBool; stdcall;
 
269
{$EXTERNALSYM IsAdminOverrideActive}
 
270
function SetSuspendState(Hibernate, ForceCritical, DisableWakeEvent: ByteBool): ByteBool; stdcall;
 
271
{$EXTERNALSYM SetSuspendState}
 
272
function GetCurrentPowerPolicies(pGlobalPowerPolicy: PGLOBAL_POWER_POLICY; pPowerPolicy: PPOWER_POLICY): ByteBool; stdcall;
 
273
{$EXTERNALSYM GetCurrentPowerPolicies}
 
274
function CanUserWritePwrScheme: ByteBool; stdcall;
 
275
{$EXTERNALSYM CanUserWritePwrScheme}
 
276
function ReadProcessorPwrScheme(uiID: UINT; var pMachineProcessorPowerPolicy: MACHINE_PROCESSOR_POWER_POLICY): ByteBool; stdcall;
 
277
{$EXTERNALSYM ReadProcessorPwrScheme}
 
278
function WriteProcessorPwrScheme(uiID: UINT; const pMachineProcessorPowerPolicy: MACHINE_PROCESSOR_POWER_POLICY): ByteBool; stdcall;
 
279
{$EXTERNALSYM WriteProcessorPwrScheme}
 
280
function ValidatePowerPolicies(GlobalPolicy: PGLOBAL_POWER_POLICY; Policy: PPOWER_POLICY): ByteBool; stdcall;
 
281
{$EXTERNALSYM ValidatePowerPolicies}
 
282
 
 
283
function CallNtPowerInformation(InformationLeveL: POWER_INFORMATION_LEVEL; lpInputBuffer: PVOID; nInputBufferSize: ULONG; lpOutputBuffer: PVOID; nOutputBufferSize: ULONG): NTSTATUS; stdcall;
 
284
{$EXTERNALSYM CallNtPowerInformation}
 
285
 
 
286
implementation
 
287
 
 
288
const
 
289
  powrproflib = 'powrprof.dll';
 
290
 
 
291
{$IFDEF DYNAMIC_LINK}
 
292
 
 
293
var
 
294
  _GetPwrDiskSpindownRange: Pointer;
 
295
 
 
296
function GetPwrDiskSpindownRange;
 
297
begin
 
298
  GetProcedureAddress(_GetPwrDiskSpindownRange, powrproflib, 'GetPwrDiskSpindownRange');
 
299
  asm
 
300
        MOV     ESP, EBP
 
301
        POP     EBP
 
302
        JMP     [_GetPwrDiskSpindownRange]
 
303
  end;
 
304
end;
 
305
 
 
306
var
 
307
  _EnumPwrSchemes: Pointer;
 
308
 
 
309
function EnumPwrSchemes;
 
310
begin
 
311
  GetProcedureAddress(_EnumPwrSchemes, powrproflib, 'EnumPwrSchemes');
 
312
  asm
 
313
        MOV     ESP, EBP
 
314
        POP     EBP
 
315
        JMP     [_EnumPwrSchemes]
 
316
  end;
 
317
end;
 
318
 
 
319
var
 
320
  _ReadGlobalPwrPolicy: Pointer;
 
321
 
 
322
function ReadGlobalPwrPolicy;
 
323
begin
 
324
  GetProcedureAddress(_ReadGlobalPwrPolicy, powrproflib, 'ReadGlobalPwrPolicy');
 
325
  asm
 
326
        MOV     ESP, EBP
 
327
        POP     EBP
 
328
        JMP     [_ReadGlobalPwrPolicy]
 
329
  end;
 
330
end;
 
331
 
 
332
var
 
333
  _ReadPwrScheme: Pointer;
 
334
 
 
335
function ReadPwrScheme;
 
336
begin
 
337
  GetProcedureAddress(_ReadPwrScheme, powrproflib, 'ReadPwrScheme');
 
338
  asm
 
339
        MOV     ESP, EBP
 
340
        POP     EBP
 
341
        JMP     [_ReadPwrScheme]
 
342
  end;
 
343
end;
 
344
 
 
345
var
 
346
  _WritePwrScheme: Pointer;
 
347
 
 
348
function WritePwrScheme;
 
349
begin
 
350
  GetProcedureAddress(_WritePwrScheme, powrproflib, 'WritePwrScheme');
 
351
  asm
 
352
        MOV     ESP, EBP
 
353
        POP     EBP
 
354
        JMP     [_WritePwrScheme]
 
355
  end;
 
356
end;
 
357
 
 
358
var
 
359
  _WriteGlobalPwrPolicy: Pointer;
 
360
 
 
361
function WriteGlobalPwrPolicy;
 
362
begin
 
363
  GetProcedureAddress(_WriteGlobalPwrPolicy, powrproflib, 'WriteGlobalPwrPolicy');
 
364
  asm
 
365
        MOV     ESP, EBP
 
366
        POP     EBP
 
367
        JMP     [_WriteGlobalPwrPolicy]
 
368
  end;
 
369
end;
 
370
 
 
371
var
 
372
  _DeletePwrScheme: Pointer;
 
373
 
 
374
function DeletePwrScheme;
 
375
begin
 
376
  GetProcedureAddress(_DeletePwrScheme, powrproflib, 'DeletePwrScheme');
 
377
  asm
 
378
        MOV     ESP, EBP
 
379
        POP     EBP
 
380
        JMP     [_DeletePwrScheme]
 
381
  end;
 
382
end;
 
383
 
 
384
var
 
385
  _GetActivePwrScheme: Pointer;
 
386
 
 
387
function GetActivePwrScheme;
 
388
begin
 
389
  GetProcedureAddress(_GetActivePwrScheme, powrproflib, 'GetActivePwrScheme');
 
390
  asm
 
391
        MOV     ESP, EBP
 
392
        POP     EBP
 
393
        JMP     [_GetActivePwrScheme]
 
394
  end;
 
395
end;
 
396
 
 
397
var
 
398
  _SetActivePwrScheme: Pointer;
 
399
 
 
400
function SetActivePwrScheme;
 
401
begin
 
402
  GetProcedureAddress(_SetActivePwrScheme, powrproflib, 'SetActivePwrScheme');
 
403
  asm
 
404
        MOV     ESP, EBP
 
405
        POP     EBP
 
406
        JMP     [_SetActivePwrScheme]
 
407
  end;
 
408
end;
 
409
 
 
410
var
 
411
  _GetPwrCapabilities: Pointer;
 
412
 
 
413
function GetPwrCapabilities;
 
414
begin
 
415
  GetProcedureAddress(_GetPwrCapabilities, powrproflib, 'GetPwrCapabilities');
 
416
  asm
 
417
        MOV     ESP, EBP
 
418
        POP     EBP
 
419
        JMP     [_GetPwrCapabilities]
 
420
  end;
 
421
end;
 
422
 
 
423
var
 
424
  _IsPwrSuspendAllowed: Pointer;
 
425
 
 
426
function IsPwrSuspendAllowed;
 
427
begin
 
428
  GetProcedureAddress(_IsPwrSuspendAllowed, powrproflib, 'IsPwrSuspendAllowed');
 
429
  asm
 
430
        MOV     ESP, EBP
 
431
        POP     EBP
 
432
        JMP     [_IsPwrSuspendAllowed]
 
433
  end;
 
434
end;
 
435
 
 
436
var
 
437
  _IsPwrHibernateAllowed: Pointer;
 
438
 
 
439
function IsPwrHibernateAllowed;
 
440
begin
 
441
  GetProcedureAddress(_IsPwrHibernateAllowed, powrproflib, 'IsPwrHibernateAllowed');
 
442
  asm
 
443
        MOV     ESP, EBP
 
444
        POP     EBP
 
445
        JMP     [_IsPwrHibernateAllowed]
 
446
  end;
 
447
end;
 
448
 
 
449
var
 
450
  _IsPwrShutdownAllowed: Pointer;
 
451
 
 
452
function IsPwrShutdownAllowed;
 
453
begin
 
454
  GetProcedureAddress(_IsPwrShutdownAllowed, powrproflib, 'IsPwrShutdownAllowed');
 
455
  asm
 
456
        MOV     ESP, EBP
 
457
        POP     EBP
 
458
        JMP     [_IsPwrShutdownAllowed]
 
459
  end;
 
460
end;
 
461
 
 
462
var
 
463
  _IsAdminOverrideActive: Pointer;
 
464
 
 
465
function IsAdminOverrideActive;
 
466
begin
 
467
  GetProcedureAddress(_IsAdminOverrideActive, powrproflib, 'IsAdminOverrideActive');
 
468
  asm
 
469
        MOV     ESP, EBP
 
470
        POP     EBP
 
471
        JMP     [_IsAdminOverrideActive]
 
472
  end;
 
473
end;
 
474
 
 
475
var
 
476
  _SetSuspendState: Pointer;
 
477
 
 
478
function SetSuspendState;
 
479
begin
 
480
  GetProcedureAddress(_SetSuspendState, powrproflib, 'SetSuspendState');
 
481
  asm
 
482
        MOV     ESP, EBP
 
483
        POP     EBP
 
484
        JMP     [_SetSuspendState]
 
485
  end;
 
486
end;
 
487
 
 
488
var
 
489
  _GetCurrentPowerPolicies: Pointer;
 
490
 
 
491
function GetCurrentPowerPolicies;
 
492
begin
 
493
  GetProcedureAddress(_GetCurrentPowerPolicies, powrproflib, 'GetCurrentPowerPolicies');
 
494
  asm
 
495
        MOV     ESP, EBP
 
496
        POP     EBP
 
497
        JMP     [_GetCurrentPowerPolicies]
 
498
  end;
 
499
end;
 
500
 
 
501
var
 
502
  _CanUserWritePwrScheme: Pointer;
 
503
 
 
504
function CanUserWritePwrScheme;
 
505
begin
 
506
  GetProcedureAddress(_CanUserWritePwrScheme, powrproflib, 'CanUserWritePwrScheme');
 
507
  asm
 
508
        MOV     ESP, EBP
 
509
        POP     EBP
 
510
        JMP     [_CanUserWritePwrScheme]
 
511
  end;
 
512
end;
 
513
 
 
514
var
 
515
  _ReadProcessorPwrScheme: Pointer;
 
516
 
 
517
function ReadProcessorPwrScheme;
 
518
begin
 
519
  GetProcedureAddress(_ReadProcessorPwrScheme, powrproflib, 'ReadProcessorPwrScheme');
 
520
  asm
 
521
        MOV     ESP, EBP
 
522
        POP     EBP
 
523
        JMP     [_ReadProcessorPwrScheme]
 
524
  end;
 
525
end;
 
526
 
 
527
var
 
528
  _WriteProcessorPwrScheme: Pointer;
 
529
 
 
530
function WriteProcessorPwrScheme;
 
531
begin
 
532
  GetProcedureAddress(_WriteProcessorPwrScheme, powrproflib, 'WriteProcessorPwrScheme');
 
533
  asm
 
534
        MOV     ESP, EBP
 
535
        POP     EBP
 
536
        JMP     [_WriteProcessorPwrScheme]
 
537
  end;
 
538
end;
 
539
 
 
540
var
 
541
  _ValidatePowerPolicies: Pointer;
 
542
 
 
543
function ValidatePowerPolicies;
 
544
begin
 
545
  GetProcedureAddress(_ValidatePowerPolicies, powrproflib, 'ValidatePowerPolicies');
 
546
  asm
 
547
        MOV     ESP, EBP
 
548
        POP     EBP
 
549
        JMP     [_ValidatePowerPolicies]
 
550
  end;
 
551
end;
 
552
 
 
553
var
 
554
  _CallNtPowerInformation: Pointer;
 
555
 
 
556
function CallNtPowerInformation;
 
557
begin
 
558
  GetProcedureAddress(_CallNtPowerInformation, powrproflib, 'CallNtPowerInformation');
 
559
  asm
 
560
        MOV     ESP, EBP
 
561
        POP     EBP
 
562
        JMP     [_CallNtPowerInformation]
 
563
  end;
 
564
end;
 
565
 
 
566
{$ELSE}
 
567
 
 
568
function GetPwrDiskSpindownRange; external powrproflib name 'GetPwrDiskSpindownRange';
 
569
function EnumPwrSchemes; external powrproflib name 'EnumPwrSchemes';
 
570
function ReadGlobalPwrPolicy; external powrproflib name 'ReadGlobalPwrPolicy';
 
571
function ReadPwrScheme; external powrproflib name 'ReadPwrScheme';
 
572
function WritePwrScheme; external powrproflib name 'WritePwrScheme';
 
573
function WriteGlobalPwrPolicy; external powrproflib name 'WriteGlobalPwrPolicy';
 
574
function DeletePwrScheme; external powrproflib name 'DeletePwrScheme';
 
575
function GetActivePwrScheme; external powrproflib name 'GetActivePwrScheme';
 
576
function SetActivePwrScheme; external powrproflib name 'SetActivePwrScheme';
 
577
function GetPwrCapabilities; external powrproflib name 'GetPwrCapabilities';
 
578
function IsPwrSuspendAllowed; external powrproflib name 'IsPwrSuspendAllowed';
 
579
function IsPwrHibernateAllowed; external powrproflib name 'IsPwrHibernateAllowed';
 
580
function IsPwrShutdownAllowed; external powrproflib name 'IsPwrShutdownAllowed';
 
581
function IsAdminOverrideActive; external powrproflib name 'IsAdminOverrideActive';
 
582
function SetSuspendState; external powrproflib name 'SetSuspendState';
 
583
function GetCurrentPowerPolicies; external powrproflib name 'GetCurrentPowerPolicies';
 
584
function CanUserWritePwrScheme; external powrproflib name 'CanUserWritePwrScheme';
 
585
function ReadProcessorPwrScheme; external powrproflib name 'ReadProcessorPwrScheme';
 
586
function WriteProcessorPwrScheme; external powrproflib name 'WriteProcessorPwrScheme';
 
587
function ValidatePowerPolicies; external powrproflib name 'ValidatePowerPolicies';
 
588
function CallNtPowerInformation; external powrproflib name 'CallNtPowerInformation';
 
589
 
 
590
{$ENDIF DYNAMIC_LINK}
 
591
 
 
592
end.