Пример #1
0
        public void Test_determineFormat_cmd()
        {
            //cmd.exe should always be 32 bit.
            var format = PortableExecutable.determineFormat("C:\\Windows\\System32\\cmd.exe");

            Assert.AreEqual(PEFormat.PE32, format);
        }
Пример #2
0
        public void Test_determineFormat_executable64()
        {
            if (!Environment.Is64BitOperatingSystem)
            {
                Assert.Inconclusive("Probably there will not be an 64 bit executables on a 32 bit operating system,"
                                    + " so we cannot test a 64 bit executable.");
                return;
            }

            //explorer.exe should be 64 bit on a 64 bit OS.
            var format = PortableExecutable.determineFormat("C:\\Windows\\explorer.exe");

            Assert.AreEqual(PEFormat.PE64, format);
        }
Пример #3
0
        public void Test_determineFormat_NullEmptyWhitespace()
        {
            //null
            var format = PortableExecutable.determineFormat(null);

            Assert.AreNotEqual(PEFormat.PE32, format);
            Assert.AreNotEqual(PEFormat.PE64, format);
            //empty
            format = PortableExecutable.determineFormat("");
            Assert.AreNotEqual(PEFormat.PE32, format);
            Assert.AreNotEqual(PEFormat.PE64, format);
            //whitespace
            format = PortableExecutable.determineFormat("   \t   \r\n  \r  \n   \v  ");
            Assert.AreNotEqual(PEFormat.PE32, format);
            Assert.AreNotEqual(PEFormat.PE64, format);
        }