Adding a Custom File Type Filter
You can add a custom file type to the File Filters collection by creating a custom file type filter and configuring steps to identify the file type.
- Research the file format. Many file formats are documented publicly on the Internet. Understanding and using the characteristics that are specific to the file type you want to build a filter for will result in more accurate file identification.
- Gather multiple samples of the file type you want to filter. Ensure the samples are from different sources, represent various versions, and created on assorted operating systems.
- You must have hex editor software that enables you to view the bytes in any file in hexadecimal format.
- Identify a few bytes common to all the sample files. If you use a filter that has too many bytes specified, some files of that type will not be recognized as such. If you use too few bytes, then some files that are not of that type will erroneously be recognized as files of that type.
- In the Control Panel pane under the Modules section, select Device Explorer.
- In the navigation bar, select Explorer > Manage Custom File Types.
The Manage Custom File Types dialog opens.
- Click Add.
The New Custom File Type dialog opens.
- Enter a name in the Name field.
The name will be displayed in the File Type Filtering dialog.
You must create at least one step to detect the file type. The steps you configure will run in the order they are placed in the Steps to detect the file type section. If all steps succeed then the file is determined to be of the type you want to filter. If one step fails the file type is determined not to be of that type.
For example, a common step sequence is:
- Search for particular bytes at the beginning of the file.
- Move to an offset from the beginning of the file and read in a variable. Then move the current position by the offset in that variable, and then check for end of file.
- Move to an offset from the beginning of the file and read in a variable. Move the current position by the offset in that variable, and then search for specific bytes.
- Search for bytes at the beginning of the file. Read in a variable. Move to a given offset. Read in another variable. Move to a position of beginning of file plus the value in Variable 1, then check for specific bytes. Move to the end of file position minus the value in Variable 2, then check for specific bytes.
Search for Bytes
Provide a byte string unique to the file type you want to detect:
Read a Variable
Create a variable that reads an integer:
Change Current Position
Move the current position used in previous steps:
End of File
Check if the current position is the end of the file:
This step succeeds if the current pointer position is the end of the file. This step does not change the current position. If the current position is not the end of the file when this step is performed, the file is determined not to be of the custom file type and no further steps are performed.
The new custom file type is added and appears:
- Within the Custom File Types list of the Manage Custom File Types dialog.
- Under the Custom node in the File Type Filtering dialog when configuring permissions.
After Completing This Task
Now you can:
- Use the newly created custom file type by navigating to the file filtering dialog, expanding the Custom section, and selecting the custom file type they created, then selecting Import / Export within the permission.
- Edit the custom file type filter by selecting it in the Manage Custom File Types dialog and clicking Edit.
- Remove the custom file type filter by selecting it in the Manage Custom File Types dialog and clicking Remove.
- Manage Custom File Types Dialog
- New Custom File Type dialog
- Edit Custom File Type Dialog
- Search for Bytes Dialog
- Read a Variable dialog
- Change Current Position Dialog
- Check End of File Dialog