Shutdown functions

I know that this post is a bit delayed from the day that the revision has been made, but I am currently on vacation right now. My latest code commit has been on the advapi32 library by adding the InitiateSystemShutdownA/W, InitiateSystemShutdownExA/W, and InitiateShutdownA/W functions. This was mostly done so I could add more functionality to the shutdown utility, although I do admit that it will still be quite a while before this can be done in ReactOS since apparently some shutdown functions were missing. At the moment, the InitiateSystemShutdown* functions does very little, and InitiateShutdownA/W doesn't do anything at all. Something that I should have noticed at the time is that the current Windows target for ReactOS is up to version XP/2003 (aka. NT 3.1 to 5.x), and I ended up adding the beginnings of InitiateShutdownA/W which is found in Windows Vista or later. Luckily the person who submitted my changes to the trunk made sure that the function was not exported in the spec file, so that no program would accidentally mistake the version of NT if it found the functions (I'm not personally sure if this would exactly happen, but since no program is written the same way, it's better to be on the safe side just in case.

When adding the functions of InitiateSystemShutdownExA/W to the DLL, I realized right away that the skeleton functions were already there and had to delete what I had just added. Always check for existing functions before adding anything new, even if you don't think that it's there. And something else that I did was made it so that if a user used the InitiateSystemShutdownA/W functions, it would redirect the function to InitiateSystemShutdownExA/W with a hard-coded reason code flag of "Other (Planned)". The reason that I used those flags (SHTDN_REASON_MAJOR_OTHER | SHTDN_REASON_MINOR_OTHER | SHTDN_REASON_FLAG_PLANNED) was over the assumption that the programmer wants a simpler version of the function and does not care about the reason code. If they wanted to give a reason for the shutdown they would use InitiateSystemShutdownExA/W instead. Finally, I redirected InitiateSystemShutdownA/W to InitiateSystemShutdownExA/W so that it would simplify the code and to help prevent code duplication. I even redirected InitiateSystemShutdownExA to InitiateSystemShutdownExW by first converting all the characters to unicode characters. I even did this to InitiateShutdownA as well.

My next step would be to work more on the shutdown utility. I am extending it to conform to the Vista/2008 version of Windows, so it will take a while to get it up to speed. I know that the target platform is XP/2003, but since the changes are of functionality and not of the Windows API, I don't see any problems at the moment.

I hope that you have a nice day, and be safe in your journeys, wherever they may be.

Comments