Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
49ffaddf
Commit
49ffaddf
authored
Jul 31, 2019
by
Chip Davis
Committed by
Alexandre Julliard
Aug 01, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Forward power request functions to ntdll.
Signed-off-by:
Chip Davis
<
cdavis@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ca2b7012
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
11 deletions
+47
-11
powermgnt.c
dlls/kernel32/powermgnt.c
+42
-11
winnt.h
include/winnt.h
+5
-0
No files found.
dlls/kernel32/powermgnt.c
View file @
49ffaddf
...
...
@@ -19,10 +19,15 @@
#include <stdarg.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
#include "winbase.h"
#include "winternl.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
powermgnt
);
...
...
@@ -113,10 +118,36 @@ EXECUTION_STATE WINAPI SetThreadExecutionState(EXECUTION_STATE flags)
*/
HANDLE
WINAPI
PowerCreateRequest
(
REASON_CONTEXT
*
context
)
{
FIXME
(
"(%p): stub
\n
"
,
context
);
COUNTED_REASON_CONTEXT
nt_context
;
HANDLE
handle
;
NTSTATUS
status
;
WCHAR
module_name
[
MAX_PATH
];
TRACE
(
"(%p)
\n
"
,
context
);
nt_context
.
Version
=
context
->
Version
;
nt_context
.
Flags
=
context
->
Flags
;
if
(
context
->
Flags
&
POWER_REQUEST_CONTEXT_SIMPLE_STRING
)
RtlInitUnicodeString
(
&
nt_context
.
u
.
SimpleString
,
context
->
Reason
.
SimpleReasonString
);
else
if
(
context
->
Flags
&
POWER_REQUEST_CONTEXT_DETAILED_STRING
)
{
int
i
;
GetModuleFileNameW
(
context
->
Reason
.
Detailed
.
LocalizedReasonModule
,
module_name
,
ARRAY_SIZE
(
module_name
)
);
RtlInitUnicodeString
(
&
nt_context
.
u
.
s
.
ResourceFileName
,
module_name
);
nt_context
.
u
.
s
.
ResourceReasonId
=
context
->
Reason
.
Detailed
.
LocalizedReasonId
;
nt_context
.
u
.
s
.
StringCount
=
context
->
Reason
.
Detailed
.
ReasonStringCount
;
nt_context
.
u
.
s
.
ReasonStrings
=
heap_alloc
(
nt_context
.
u
.
s
.
StringCount
*
sizeof
(
UNICODE_STRING
)
);
for
(
i
=
0
;
i
<
nt_context
.
u
.
s
.
StringCount
;
i
++
)
RtlInitUnicodeString
(
&
nt_context
.
u
.
s
.
ReasonStrings
[
i
],
context
->
Reason
.
Detailed
.
ReasonStrings
[
i
]
);
}
SetLastError
(
ERROR_CALL_NOT_IMPLEMENTED
);
return
INVALID_HANDLE_VALUE
;
status
=
NtCreatePowerRequest
(
&
handle
,
&
nt_context
);
if
(
nt_context
.
Flags
&
POWER_REQUEST_CONTEXT_DETAILED_STRING
)
heap_free
(
nt_context
.
u
.
s
.
ReasonStrings
);
if
(
status
)
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
return
status
==
STATUS_SUCCESS
?
handle
:
INVALID_HANDLE_VALUE
;
}
/***********************************************************************
...
...
@@ -124,10 +155,10 @@ HANDLE WINAPI PowerCreateRequest(REASON_CONTEXT *context)
*/
BOOL
WINAPI
PowerSetRequest
(
HANDLE
request
,
POWER_REQUEST_TYPE
type
)
{
FIXME
(
"(%p, %u): stub
\n
"
,
request
,
type
);
SetLastError
(
ERROR_CALL_NOT_IMPLEMENTED
);
return
FALSE
;
NTSTATUS
status
=
NtSetPowerRequest
(
request
,
type
);
if
(
status
)
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
return
status
==
STATUS_SUCCESS
;
}
/***********************************************************************
...
...
@@ -135,8 +166,8 @@ BOOL WINAPI PowerSetRequest(HANDLE request, POWER_REQUEST_TYPE type)
*/
BOOL
WINAPI
PowerClearRequest
(
HANDLE
request
,
POWER_REQUEST_TYPE
type
)
{
FIXME
(
"(%p, %u): stub
\n
"
,
request
,
type
);
SetLastError
(
ERROR_CALL_NOT_IMPLEMENTED
);
return
FALSE
;
NTSTATUS
status
=
NtClearPowerRequest
(
request
,
type
);
if
(
status
)
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
return
status
==
STATUS_SUCCESS
;
}
include/winnt.h
View file @
49ffaddf
...
...
@@ -5585,6 +5585,11 @@ typedef enum _POWER_REQUEST_TYPE
PowerRequestAwayModeRequired
}
POWER_REQUEST_TYPE
,
*
PPOWER_REQUEST_TYPE
;
#define POWER_REQUEST_CONTEXT_VERSION 0
#define POWER_REQUEST_CONTEXT_SIMPLE_STRING 0x00000001
#define POWER_REQUEST_CONTEXT_DETAILED_STRING 0x00000002
typedef
union
_FILE_SEGMENT_ELEMENT
{
PVOID64
Buffer
;
ULONGLONG
Alignment
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment