Index: base/applications/shutdown/misc.c =================================================================== --- base/applications/shutdown/misc.c (revision 72972) +++ base/applications/shutdown/misc.c (working copy) @@ -9,6 +9,7 @@ #include "precomp.h" #include +#include const DWORD defaultReason = SHTDN_REASON_MAJOR_OTHER | SHTDN_REASON_MINOR_OTHER; @@ -54,38 +55,19 @@ { DWORD finalLength = 0; size_t strLength = 0; - DWORD osVersion = 0; - DWORD osMajorVersion = 0; - DWORD osMinorVersion = 0; /* An empty string is always valid. */ if (!comment || *comment == 0) return TRUE; - /* Grab the version of the current Operating System. */ - osVersion = GetVersion(); - - osMajorVersion = (DWORD)(LOBYTE(LOWORD(osVersion))); - osMinorVersion = (DWORD)(HIBYTE(LOWORD(osVersion))); - /* * Check to make sure that the proper length is being used * based upon the version of Windows currently being used. */ - if (osMajorVersion == 5) /* Windows XP/2003 */ - { - if ((osMinorVersion == 1) || (osMinorVersion == 2)) - { - finalLength = 127; - } - } - else if (osMajorVersion == 6) /* Windows Vista/7/2008 */ - { - if ((osMinorVersion == 0) || (osMinorVersion == 1)) - { - finalLength = 512; - } - } + if (IsWindowsVistaOrGreater()) + finalLength = 512; + else + finalLength = 127; /* Grab the length of the comment string. */ strLength = wcslen(comment); @@ -95,7 +77,7 @@ * it fits with the current version of Windows, * and return TRUE or FALSE accordingly. */ - return (strLength <= finalLength); + return ((strLength <= finalLength) ? TRUE : FALSE); } /*