From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1TztAv-0000Nf-QW for mharc-grub-devel@gnu.org; Mon, 28 Jan 2013 13:11:21 -0500 Received: from eggs.gnu.org ([208.118.235.92]:60456) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TztAn-0000GB-Sn for grub-devel@gnu.org; Mon, 28 Jan 2013 13:11:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TztAh-0001iz-KS for grub-devel@gnu.org; Mon, 28 Jan 2013 13:11:13 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:38637) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TztAh-0001id-Ek for grub-devel@gnu.org; Mon, 28 Jan 2013 13:11:07 -0500 Received: by mail-wi0-f172.google.com with SMTP id o1so1683281wic.11 for ; Mon, 28 Jan 2013 10:11:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:x-enigmail-version:content-type; bh=q4i/1urCrxPDVpYAdQFKDPhVcaYC7kBGHU5RzwliJ7o=; b=bxBbCniZfGisCfeyqzq/+i0murSsPEIgZ2CCoEqwmkARMTXhgHGFwuWIwEaYGau+EM 5HDNwdG9j9GE5TZy22wtSaV+5Hpeywkf62maq8x5CEwZpuTx5WGrxsCUGiZ8LnPfMHeg XzSX6U7Gt4Y31W4NU+tp+NUnl6QOh6HDkVVvHb1V+2gHYEJHS22PPNLtK1AyMS03uJAv PvI6VWUe15zKrfkCUI6G3qtVJoISkHd08z9vurF6VapmFBa4nmAPKf7GdE9tGW4gpi7F KYUWOlZpZ3kA0TFCKulXnnlOiamKaFqCzcxI4S4dHJzkeRK2twisz4VEK5QLzdh2V52+ 26mg== X-Received: by 10.180.81.39 with SMTP id w7mr11520903wix.15.1359396666152; Mon, 28 Jan 2013 10:11:06 -0800 (PST) Received: from debian.x201.phnet ([217.193.148.98]) by mx.google.com with ESMTPS id fx5sm4513931wib.11.2013.01.28.10.11.04 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 28 Jan 2013 10:11:05 -0800 (PST) Message-ID: <5106BF37.70906@gmail.com> Date: Mon, 28 Jan 2013 19:11:03 +0100 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.11) Gecko/20121122 Icedove/10.0.11 MIME-Version: 1.0 To: The development of GNU GRUB , Peter Lustig Subject: Re: New command to check NT's hibernation state References: <4EF40444.5060303@gmail.com> In-Reply-To: <4EF40444.5060303@gmail.com> X-Enigmail-Version: 1.4.1 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enigF9EBEE036168CFE000195539" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.212.172 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2013 18:11:20 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigF9EBEE036168CFE000195539 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 23.12.2011 05:32, 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 mixe= d > 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. >=20 strncasecmp isn't for comparing te binary strings. In GRUB it's fairly simplistic but this is conceptually wrong. Conceptually h=C3=ADbr and HIB= R would match even if GRUB currently doesn't do this kind of handling. > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel >=20 --=20 Regards Vladimir '=CF=86-coder/phcoder' Serbinenko --------------enigF9EBEE036168CFE000195539 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iF4EAREKAAYFAlEGvzcACgkQNak7dOguQglGkAEAi7W98/Jv9/6IrbsqvYkScixk qhPVUS5AlwmpbKuTLm0A/1o9qc0yqUVarsE0i+M+UEECHQkzfMEF8zdt/5Slluz7 =EGKs -----END PGP SIGNATURE----- --------------enigF9EBEE036168CFE000195539--