[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: Thu, 22 Dec 2011 23:32:04 -0500
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20111220 Thunderbird/9.0

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.

reply via email to

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