Vault7: CIA Hacking Tools Revealed
Navigation: » Directory » Knowledge Base » Tech Topics and Techniques Knowledge Base » Windows » Windows Code Snippets » File Typing
Text File Typing - Determing Encoding (MISCTextFileTyper_ENC)
SECRET//NOFORN
Miscellaneous Module
Stash Repository: Miscellaneous Library
Module Name: MISCTextFileTyper_ENC (ENC = Encoding)
Module Description: Determines the encoding of a text file. All supported encodings are supplied in the TextEncoding Enum.This module does not determine whether or not the file is a text file. It only attempts to determine the encoding of the file based on BOMs (byte order marks) and defaults to ASCII.
Usage:
TextEncoding GetTextEncoding(WCHAR *wcFileName);
wcFileName: The text file to analyze.
Returns a value from the TextEncoding enum described in module return codes
PSP/OS Issues: No known issues.
('excerpt' missing)
Sharing Level: Unilateral
Technique Origin: In-house
Notes:
- Only examines the BOM of the file
- Defaults to ANSI
- Only supports encodings listed
Module Specific Structures: N/A
Module Return Codes:
static enum TextEncoding : int
{
UnkownEncoding = -1,
ANSI = 0,
Unicode,
UTF8,
UnicodeBigEndian
};
Example Code:
MISCTextFileTyper_ENC tFileTyper;
TextEncoding teEncoding = tFileTyper.GetTextEncoding(L"C:\\Test.txt");
SECRET//NOFORN