From: Peter Lustig <peter.lustig.7db@gmail.com>
To: grub-devel@gnu.org
Subject: Re: New command to check NT's hibernation state
Date: Thu, 22 Dec 2011 23:32:04 -0500 [thread overview]
Message-ID: <4EF40444.5060303@gmail.com> (raw)
In-Reply-To: <mailman.235.1324573308.26580.grub-devel@gnu.org>
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
<http://www.msuiche.net/pres/PacSec07-slides-0.4.pdf>) 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.
next parent reply other threads:[~2011-12-23 4:32 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.235.1324573308.26580.grub-devel@gnu.org>
2011-12-23 4:32 ` Peter Lustig [this message]
2012-08-12 4:23 ` New command to check NT's hibernation state Peter Lustig
2013-01-28 18:11 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-11-04 1:55 Peter Lustig
[not found] <mailman.171.1324141254.27913.grub-devel@gnu.org>
2011-12-18 3:16 ` Peter Lustig
2011-12-22 12:10 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-11-04 0:48 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-11-04 13:13 ` Andrey Borzenkov
2013-11-04 13:24 ` Vladimir 'φ-coder/phcoder' Serbinenko
[not found] <mailman.213.1324054906.20674.grub-devel@gnu.org>
2011-12-17 5:41 ` Peter Lustig
2011-12-17 11:39 ` Vladimir 'φ-coder/phcoder' Serbinenko
[not found] <mailman.207.1322931671.23776.grub-devel@gnu.org>
2011-12-10 6:03 ` Peter Lustig
2011-12-16 15:25 ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-12-16 15:30 ` Vladimir 'φ-coder/phcoder' Serbinenko
-- strict thread matches above, loose matches on Subject: below --
2011-12-03 4:57 Peter Lustig
2011-12-03 10:41 ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-12-02 5:16 Peter Lustig
2011-12-02 6:05 ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-11-27 23:49 Peter Lustig
2011-11-28 1:03 ` Vladimir 'φ-coder/phcoder' Serbinenko
2011-11-28 13:27 ` Vladimir 'φ-coder/phcoder' Serbinenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EF40444.5060303@gmail.com \
--to=peter.lustig.7db@gmail.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).