Signed-off-by: Chip Davis cdavis@codeweavers.com --- dlls/ntdll/nt.c | 10 +++++----- dlls/ntdll/ntdll_misc.h | 1 + dlls/ntdll/server.c | 1 + 3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c index a9985fbc224..c1b0816a35e 100644 --- a/dlls/ntdll/nt.c +++ b/dlls/ntdll/nt.c @@ -3062,14 +3062,14 @@ NTSTATUS WINAPI NtInitiatePowerAction( */ NTSTATUS WINAPI NtSetThreadExecutionState( EXECUTION_STATE new_state, EXECUTION_STATE *old_state ) { - static EXECUTION_STATE current = - ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED | ES_USER_PRESENT; - *old_state = current; + struct ntdll_thread_data *thread_data = ntdll_get_thread_data(); + + *old_state = thread_data->exec_state;
WARN( "(0x%x, %p): stub, harmless.\n", new_state, old_state );
- if (!(current & ES_CONTINUOUS) || (new_state & ES_CONTINUOUS)) - current = new_state; + if (new_state & ES_CONTINUOUS) + thread_data->exec_state = new_state; return STATUS_SUCCESS; }
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h index 4556e1e5ce3..30080a47e53 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h @@ -245,6 +245,7 @@ struct ntdll_thread_data int wait_fd[2]; /* fd for sleeping server requests */ BOOL wow64_redir; /* Wow64 filesystem redirection flag */ pthread_t pthread_id; /* pthread thread id */ + EXECUTION_STATE exec_state; /* current thread power execution state */ };
C_ASSERT( sizeof(struct ntdll_thread_data) <= sizeof(((TEB *)0)->GdiTebBatch) ); diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c index 33ba95c00cc..385f5af6ebb 100644 --- a/dlls/ntdll/server.c +++ b/dlls/ntdll/server.c @@ -1525,6 +1525,7 @@ size_t server_init_thread( void *entry_point, BOOL *suspend )
is_wow64 = !is_win64 && (server_cpus & ((1 << CPU_x86_64) | (1 << CPU_ARM64))) != 0; ntdll_get_thread_data()->wow64_redir = is_wow64; + ntdll_get_thread_data()->exec_state = ES_CONTINUOUS;
switch (ret) {