CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    Join Date
    May 2013
    Posts
    10

    Re: InitiateSystemShutdownEx hangs system

    I haven't been able to get on that lab system but will be able to around noon today. On the other system that is a spitting image of that one the 32 bit machine is having no problems. Hopefully I can get the problem diagnosed later and report back.

  2. #17
    Join Date
    May 2013
    Posts
    10

    Re: InitiateSystemShutdownEx hangs system

    So I was finally able to get on the system this morning and get to testing. The additional log code provided no help. Using the remote debugger I stepped through the code the adjust prvlidges worked and it hits the InitiateSystemShutdownEx and it returns with no error and the system begins to start the shutdown but hangs. A coworker suggested trying as admin as that is what the developer test system is running under yet that had no affect on the actual system machine still hangs on shutdown. The developer system is running Windows 7 Ultimate 32bit while the production machines are running Windows 7 Professional 32 bit. There is also a hardware difference, the production systems are using an intel mb with a core i5 and 8gb of ram (don't ask I have no clue why they would put that much ram on a 32 bit system), while the developer system uses an asus board a core 2 duo and 4gb of ram. I am not sure what else to try now.

  3. #18
    Join Date
    May 2013
    Posts
    10

    Re: InitiateSystemShutdownEx hangs system

    Playing around a little more with a .net app I wrote to kill any processes and then shutdown the system shutsdown. I was able to then test the origional app without the other things running and it shuts down so going to add code to the project to shut down any running application.

    This is wrong, I didnt realize the machine had been booted into with the selective startup turned on.
    Last edited by farpetrad; May 15th, 2013 at 03:46 PM.

  4. #19
    Join Date
    May 2013
    Posts
    10

    Re: InitiateSystemShutdownEx hangs system

    So I tested after killing all of our applications and the system still hangs. It also hangs if using the shutdown button and trying the command line shutdown -s -t 10 it also hangs. I am starting to think there is a process that is hanging and not responding. I was able to get a list of services still running after the call to InitiateSystemShutdown and also got a list during a selective start on shutdown so am comparing them now and will try to kill anything thats left running and is a non system service.
    Last edited by farpetrad; May 15th, 2013 at 04:12 PM.

  5. #20
    Join Date
    May 2013
    Posts
    10

    Re: InitiateSystemShutdownEx hangs system

    I was able to track this down to one of our apps. If I don't let it start I can shut the system down, however once it starts windows will not shut down. I started debugging and noticed this app never got the wm_close I sent to it through EnumWindows so I changed to sending WM_USER+10 and sure enough the app got it so I then sent a wm_close in response to getting the WM_USER. I verified the OnCLose method got called and saw the app exit (legacy mfc app), however I still can't shut down the computer still hanging. I then noticed I got an error on WaitForSingleObject when waiting on the process. Error code was 5 and formatted to access denied. Now I gave my process the se_debug_name privelege before opening the process to shutdown. Is this because the process ended and did not signal? Should I post the close message in response to the user message or call ExitProcess? Sorry for any typos posting from my phone.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured