Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

reading an application's manifest file?

Is there an easy way to read an application's already embedded manifest file?

I was thinking along the lines of an alternate data stream?

like image 740
Brian R. Bondy Avatar asked Jan 07 '09 15:01

Brian R. Bondy


People also ask

How do I open an application manifest file?

How to Open MANIFEST Files. You can open and view MANIFEST files using Windows, Mac, or the Linux operating system. Because the file is typically in a plain text format, you can open and edit it with any text editing program. If you use Windows, you can open and edit MANIFEST files with Notepad or WordPad.

What is an application manifest file?

Every app project must have an AndroidManifest. xml file (with precisely that name) at the root of the project source set. The manifest file describes essential information about your app to the Android build tools, the Android operating system, and Google Play.

How do I find the manifest file?

The following screen snapshot demonstrates viewing the manifest file. This was easily brought up in NetBeans by simply using File --> Open File and selecting jdiff. jar to have it displayed as shown in the next screen snapshot. Other Java IDEs provide similarly easy-to-use viewing of manifest files within a JAR.

What is a manifest file C++?

A manifest is an XML document that uniquely identifies an assembly. It contains information used for binding and activation, such as COM classes, interfaces, and type libraries. A manifest can be an external XML file or a resource embedded inside an application or an assembly.


1 Answers

Windows manifest files are Win32 resources. In other words, they're embedded towards the end of the EXE or DLL. You can use LoadLibraryEx, FindResource, LoadResource and LockResource to load the embedded resource.

Here's a simple example that extracts its own manifest...

BOOL CALLBACK EnumResourceNameCallback(HMODULE hModule, LPCTSTR lpType,     LPWSTR lpName, LONG_PTR lParam) {     HRSRC hResInfo = FindResource(hModule, lpName, lpType);     DWORD cbResource = SizeofResource(hModule, hResInfo);      HGLOBAL hResData = LoadResource(hModule, hResInfo);     const BYTE *pResource = (const BYTE *)LockResource(hResData);      TCHAR filename[MAX_PATH];     if (IS_INTRESOURCE(lpName))         _stprintf_s(filename, _T("#%d.manifest"), lpName);     else         _stprintf_s(filename, _T("%s.manifest"), lpName);      FILE *f = _tfopen(filename, _T("wb"));     fwrite(pResource, cbResource, 1, f);     fclose(f);      UnlockResource(hResData);     FreeResource(hResData);      return TRUE;   // Keep going }  int _tmain(int argc, _TCHAR* argv[]) {     const TCHAR *pszFileName = argv[0];      HMODULE hModule = LoadLibraryEx(pszFileName, NULL, LOAD_LIBRARY_AS_DATAFILE);     EnumResourceNames(hModule, RT_MANIFEST, EnumResourceNameCallback, NULL);     FreeLibrary(hModule);     return 0; } 

Alternatively, you can use MT.EXE from the Windows SDK:

>mt -inputresource:dll_with_manifest.dll;#1 -out:extracted.manifest 
like image 142
Roger Lipscombe Avatar answered Sep 17 '22 15:09

Roger Lipscombe