NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public NextPVR Support Windows v
« Previous 1 … 79 80 81 82 83 … 101 Next »
NPVR v5 no longer prevents shutdown with a remote

 
  • 0 Vote(s) - 0 Average
NPVR v5 no longer prevents shutdown with a remote
stwarr
Offline

Junior Member

UK
Posts: 8
Threads: 0
Joined: Jun 2020
#11
2020-07-02, 08:33 AM
As per the original post, I am talking about preventing the PC from entering sleep if triggered by (eg) a MCE remote. My usecase is HTPC running a 10 foot interface, with NextPVR server running on the same machine.

Ideally I’d like the same behaviour as WMC:

on & recording -> (power button) -> away mode -> (recording ends) -> sleep

If NextPVR cannot do this, is there any way of polling the server to determine the tuner status to allow an external app to achieve this?
Graham
Offline

Posting Freak

UK
Posts: 4,058
Threads: 102
Joined: Dec 2005
#12
2020-07-02, 11:24 AM
(2020-07-02, 08:33 AM)stwarr Wrote: ...  is there any way of polling the server to determine the tuner status to allow an external app to achieve this?

Does this do what you want ... https://github.com/sub3/NextPVR/wiki/nscripthelper
stwarr
Offline

Junior Member

UK
Posts: 8
Threads: 0
Joined: Jun 2020
#13
2020-07-02, 04:49 PM (This post was last modified: 2020-07-02, 04:50 PM by stwarr.)
A quick peek into NPVRTray.exe using ildasm.exe looks like the code defines a custom WndProc(), along with all the necessary power control enum values including WM_POWERBROADCAST, PBT_APMQUERYSTANDBY/PBT_APMQUERYSUSPEND, BROADCAST_QUERY_DENY, etc. but doesn't actually use them. Is this code that could be shared at all?



Code:
.method family hidebysig virtual instance void
        WndProc(valuetype [System.Windows.Forms]System.Windows.Forms.Message& m) cil managed
{
  // Code size      61 (0x3d)
  .maxstack  8
  IL_0000:  ldarg.0
  IL_0001:  ldfld      bool NPVRTray.Form1::shutdownBlocked
  IL_0006:  brfalse.s  IL_0028
  IL_0008:  ldarg.1
  IL_0009:  call      instance int32 [System.Windows.Forms]System.Windows.Forms.Message::get_Msg()
  IL_000e:  ldc.i4.s  17
  IL_0010:  beq.s      IL_001c
  IL_0012:  ldarg.1
  IL_0013:  call      instance int32 [System.Windows.Forms]System.Windows.Forms.Message::get_Msg()
  IL_0018:  ldc.i4.s  22
  IL_001a:  bne.un.s  IL_0028
  IL_001c:  ldarg.1
  IL_001d:  ldsfld    native int [mscorlib]System.IntPtr::Zero
  IL_0022:  call      instance void [System.Windows.Forms]System.Windows.Forms.Message::set_Result(native int)
  IL_0027:  ret
  IL_0028:  ldarg.1
  IL_0029:  call      instance int32 [System.Windows.Forms]System.Windows.Forms.Message::get_Msg()
  IL_002e:  ldc.i4    0x218
  IL_0033:  pop
  IL_0034:  pop
  IL_0035:  ldarg.0
  IL_0036:  ldarg.1
  IL_0037:  call      instance void [System.Windows.Forms]System.Windows.Forms.Form::WndProc(valuetype [System.Windows.Forms]System.Windows.Forms.Message&)
  IL_003c:  ret
} // end of method Form1::WndProc
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,661
Threads: 767
Joined: Nov 2003
#14
2020-07-02, 05:25 PM
(2020-07-02, 04:49 PM)stwarr Wrote: A quick peek into NPVRTray.exe using ildasm.exe looks like the code defines a custom WndProc(), along with all the necessary power control enum values including WM_POWERBROADCAST, PBT_APMQUERYSTANDBY/PBT_APMQUERYSUSPEND, BROADCAST_QUERY_DENY, etc. but doesn't actually use them.
What version of windows are you running?

Those events can no longer be used to block standby in newer versions of Windows. Instead the try uses the following to block standby:

SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_AWAYMODE_REQUIRED);

If you're using some old version of Windows, maybe it's rejecting this call.
stwarr
Offline

Junior Member

UK
Posts: 8
Threads: 0
Joined: Jun 2020
#15
2020-07-02, 09:19 PM (This post was last modified: 2020-07-02, 09:27 PM by stwarr.)
Windows 10, build 2005, with all the latest updates
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,661
Threads: 767
Joined: Nov 2003
#16
2020-07-02, 09:37 PM
What date/time is your NextPVRTray.exe?
stwarr
Offline

Junior Member

UK
Posts: 8
Threads: 0
Joined: Jun 2020
#17
2020-07-02, 09:39 PM
According to the MSDN docs, SetThreadExecutionState() is only applicable to preventing sleep due to the idle timeout, it does not prevent a user initiated sleep command. I’m certainly not an expert, but the evidence shows (as shown by other PVRs being able to create powercfg entries) that the ability to prevent user initiated sleep commands requests still exists in windows 10, and must be based on some other mechanism. I’m only aware of the WM_POWERBROADCAST messages (and nothing in the MSDN docs suggests these are deprecated in windows 10), but maybe I’ll try and find some time to play around with this.
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 52,835
Threads: 954
Joined: May 2006
#18
2020-07-02, 09:48 PM
The trap app is not blocking forced sleep or shutdown from the Start Menu on Win 10 2005 for me either. I didn't try on previous versions of Windows.

Martin
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,661
Threads: 767
Joined: Nov 2003
#19
2020-07-02, 10:02 PM
Let me know if this helps.

There was a attempted bug fix in the last release, which I think I got the logic reversed (related to running NextPVRTray.exe on another machine).


Attached Files
.zip   NPVRTray.zip (Size: 14.94 KB / Downloads: 8)
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 52,835
Threads: 954
Joined: May 2006
#20
2020-07-02, 10:09 PM
That works for me.

Martin
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (3): « Previous 1 2 3 Next »


Possibly Related Threads…
Thread Author Replies Views Last Post
  NPVR Windows recordings folder cleanup.... Colincam 21 2,856 2025-04-16, 07:38 PM
Last Post: mvallevand
  NextPVR - Access from Remote Location - Port Forwarding? TomasCremin 2 365 2025-04-13, 08:39 PM
Last Post: boringgit
  NextPVR client no longer works Rich A 13 614 2025-03-30, 10:04 PM
Last Post: mvallevand
  Freezing/Buffering on Windows 11 (NPVR app only) nextpvrnoob 64 7,639 2025-02-21, 07:52 PM
Last Post: mvallevand
  EPG No Longer Working - zap2xml SamM 11 1,481 2025-02-13, 11:00 PM
Last Post: SamM
  NPVR No Longer Acessible From LAN 4zm4r3d02 2 275 2025-01-26, 04:35 PM
Last Post: 4zm4r3d02
  NPVR NOT in system tray now RichU 4 387 2025-01-05, 10:20 PM
Last Post: RichU
  Which OS is "best" for NPVR? boringgit 3 518 2024-11-29, 09:48 PM
Last Post: boringgit
  Short skip no longer on OSD, timebar oversensitive. smiffypr 26 1,420 2024-11-14, 08:24 PM
Last Post: mvallevand
  Issues with TV Guide in NPVR client Bobins 9 757 2024-11-08, 11:02 AM
Last Post: Bobins

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode