0

Is there any way so that i can get extension of a given file.

if suppose there is a file "abc.txt" but after renaming the file name is "abc.exe" now the extension is .exe is there any way that i can get the original extension of a file in which it was created.

I looked for GetFileInformationByHandle but that was not much of help

2
  • 2
    Files do not have extensions, only a file's name might have one. Commented Dec 6, 2014 at 8:49
  • 1
    You may have a look at the source code of the 'file' command. Even though it is Unix stuff, it could give you insights. Commented Dec 6, 2014 at 8:57

1 Answer 1

2

is there any way that i can get the original extension of a file in which it was created

No, not without any operating system add-ons or a simple backup of the file .

Sign up to request clarification or add additional context in comments.

2 Comments

I want to block all .exe files from getting download\email attachment .I am able to do that with WFP driver. but what if someone changes .exe to .pdf then i wont be able to block as i'am blocking by matching .exe with the packet i'am receiving.
@ajit: You might like to read this en.wikipedia.org/wiki/.exe to learn how to detect a *.exe file from inspecting a file's content.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.