[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New command to check NT's hibernation state

From: Peter Lustig
Subject: Re: New command to check NT's hibernation state
Date: Sun, 12 Aug 2012 00:23:47 -0400
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0

On 12/22/2011 11:32 PM, Peter Lustig wrote:
On 12/22/2011 13:10, Vladimir 'phcoder' Serbinenko wrote:
On 18.12.2011 04:16, Peter Lustig wrote:
> /* Return SUCCESS if magic indicates file is active; else return FAILURE */
>      if (!grub_strncasecmp ("hibr", hibr_file_magic, magic_size))
What's the reason to use strncasecmp? Does the case changes? Usually
memcmp is the right way to check the signature. This also avoids the
need of memset and trailing zero byte.
It can be either {'h', 'i', 'b', 'r'} (for Windows XP) or {'H', 'I', 'B', 'R'} (for Windows Vista/7). Technically I should only be checking for these two values, but it is unlikely that the magic would have mixed case. The only other values I know (from <>) that it can assume are {'w', 'a', 'k', 'e'}, {'l', 'i', 'n', 'k'}, and {'\0', '\0', '\0', '\0'}. Using strncasecmp() seemed like a simple way to approach the problem.
Sorry to bump this thread. Do you know if there are any plans to include the 'nthibr' module in a future release of GRUB. I looked and didn't see any references to it in the Bazaar trunk.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]