Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ASK9292

macrumors newbie
Original poster
Mar 2, 2021
2
0
Hello everyone,

Sometimes you need to get the md5 amount of the mini soft when running the software when you attach this mini soft as a plugin. For the windows solution, I have this code:

Code:
LPTSTR strDLLPath1 = new TCHAR[_MAX_PATH]; ::GetModuleFileName((HINSTANCE)&__ImageBase, strDLLPath1, _MAX_PATH); 
ss << “{\n “sum_artifact”: “” << md5.digestFile(strDLLPath1) << “”\n}”;

Is there a similar mac (means GetModuleFileName() - <= 10.9 ) for all macOS versions or do ypu haveexample on c++ via BundleID?
If you have any ideas, it would be nice to hear them…project on c++
 

casperes1996

macrumors 604
Jan 26, 2014
7,593
5,764
Horsens, Denmark
I feel like there's a lot of context lacking here. Can we go a bit bigger picture to what it is you're working with and what you're trying to do - Don't even know what this MiniSoft stuff is
If all you need is an md5 sum you can always just exec md5sum and take a pipe output from that
1614714327819.png

Alternatively, Apple's CryptoKit has an Insecure.MD5 digest available. It's exposed to Swift and Objective-C but I'm sure you can work out the calling convention and use it in C++ - may even be a shim for it already.
I would also imagine there's already something in the STL for it honestly, but haven't checked
 

ASK9292

macrumors newbie
Original poster
Mar 2, 2021
2
0
I feel like there's a lot of context lacking here. Can we go a bit bigger picture to what it is you're working with and what you're trying to do - Don't even know what this MiniSoft stuff is
If all you need is an md5 sum you can always just exec md5sum and take a pipe output from that
View attachment 1737658
Alternatively, Apple's CryptoKit has Insecure.MD5 digest was available. It's exposed to Swift and Objective-C but I'm sure you can work out the calling convention and use it in C++ - may even be a shim for it already.
I would also imagine there's already something in the STL for it honestly but haven't checked

as you can see from the picture I'm trying to find the path to the plugin that runs on the host to calculate its md5 sum. I raised the documentation on the mac and there is a so-called:

CFBundleRef mainBundle = CFBundleGetMainBundle();
CFDictionaryRef cf = CFBundleGetInfoDictionary(mainBundle);
CFURLRef cf2 = CFBundleCopyExecutableURL(mainBundle);
CFStringRef cf4 = CFBundleGetIdentifier(mainBundle);

But I got path Host Application, but I need to path plugin...
 

Attachments

  • untitled (5).png
    untitled (5).png
    76.4 KB · Views: 145
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.