mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Wrap the windows API to set thread execution state
This commit is contained in:
parent
8972f56290
commit
f2c5a14fab
@ -985,6 +985,14 @@ wait_named_pipe(PyObject *self, PyObject *args) {
|
|||||||
Py_RETURN_TRUE;
|
Py_RETURN_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
|
set_thread_execution_state(PyObject *self, PyObject *args) {
|
||||||
|
unsigned long new_state;
|
||||||
|
if (!PyArg_ParseTuple(args, "k", new_state)) return NULL;
|
||||||
|
if (SetThreadExecutionState(new_state) == NULL) return PyErr_SetFromWindowsErr(0);
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
// Icon loading {{{
|
// Icon loading {{{
|
||||||
#pragma pack( push )
|
#pragma pack( push )
|
||||||
#pragma pack( 2 )
|
#pragma pack( 2 )
|
||||||
@ -1137,6 +1145,7 @@ static PyMethodDef winutil_methods[] = {
|
|||||||
M(parse_cmdline, METH_VARARGS),
|
M(parse_cmdline, METH_VARARGS),
|
||||||
M(write_file, METH_VARARGS),
|
M(write_file, METH_VARARGS),
|
||||||
M(wait_named_pipe, METH_VARARGS),
|
M(wait_named_pipe, METH_VARARGS),
|
||||||
|
M(set_thread_execution_state, METH_VARARGS),
|
||||||
M(known_folder_path, METH_VARARGS),
|
M(known_folder_path, METH_VARARGS),
|
||||||
M(get_computer_name, METH_VARARGS),
|
M(get_computer_name, METH_VARARGS),
|
||||||
|
|
||||||
@ -1465,6 +1474,12 @@ exec_module(PyObject *m) {
|
|||||||
A(ComputerNamePhysicalDnsFullyQualified);
|
A(ComputerNamePhysicalDnsFullyQualified);
|
||||||
A(ComputerNamePhysicalDnsHostname);
|
A(ComputerNamePhysicalDnsHostname);
|
||||||
A(ComputerNamePhysicalNetBIOS);
|
A(ComputerNamePhysicalNetBIOS);
|
||||||
|
|
||||||
|
A(ES_AWAYMODE_REQUIRED);
|
||||||
|
A(ES_CONTINUOUS);
|
||||||
|
A(ES_DISPLAY_REQUIRED);
|
||||||
|
A(ES_SYSTEM_REQUIRED);
|
||||||
|
A(ES_USER_PRESENT);
|
||||||
#undef A
|
#undef A
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user