This article describes how to add to a Win32 API, C++ application, the ability to browse for executables (.exe) files, and to determine whether they are .NET ones, and if so, to analyze their classes and display a list of them, without having .NET installed on the machine running it.
|
#ifndef _PEPARSER_H_
#define _PEPARSER_H_
#include <iostream>
#include <windows.h>
#include <winnt.h>
#include <Dbghelp.h>
#include <list>
using namespace std;
struct StreamHeader
{
int offset;
int size;
string name;
};
struct TypeDef
{
int iFlag;
int iTypeName;
int iTypeNameSpace;
int iExtends;
int iFieldList;
int iMethodList;
};
class CPEParser
{
void GetStreamHeaders(char *ui8BaseAddress, int &ui16Length, list<StreamHeader> &lStreamHeader, int streams);
StreamHeader* GetMetaData(list<StreamHeader> &lStreamHeader, string str);
string ReadString(char *pStart);
public:
list<string> GetDotNetClassName(string filePathName);
};
#endif //_PEPARSER_H_
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Michael Haephrati is a music composer, an inventor and an expert specializes in software development and information security, who has built a unique perspective which combines technology and the end user experience. He is the author of a
the book Learning C++ , which teaches C++ 20, and was published in August 2022.
He is the CEO of
Secured Globe, Inc., and also active at
Stack Overflow.
Read our
Corporate blog or read my
Personal blog.