Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » Symlink/Shortcut support
Re: Symlink/Shortcut support [message #24939 is a reply to message #24938] Fri, 05 February 2010 10:25 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13980
Registered: November 2005
Ultimate Member
Please check my altered version:

String GetSymLinkPath(const char *linkpath)
{
#ifdef PLATFORM_WIN32
	String path;
	HRESULT hres;
	IShellLink* psl;
	IPersistFile* ppf;
	CoInitialize(NULL);
	hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink,
	                        (PVOID *) &psl);
	if(SUCCEEDED(hres)) {
		hres = psl->QueryInterface(IID_IPersistFile, (PVOID *) &ppf);
		if(SUCCEEDED(hres)) {
			hres = ppf->Load(ToSystemCharsetW(linkPath), STGM_READ);
			if(SUCCEEDED(hres)) {
				char fileW[_MAX_PATH] = {0};
				psl->GetPath(fileW, _MAX_PATH, NULL, 0); 
				path = FromSystemCharset(fileW);
			}
			ppf->Release();
		}
		psl->Release();
	}
	CoUninitialize();
	return path;
#else
	char buff[_MAX_PATH + 1];
	bool ret;
	int len = readlink(linkPath, buff, _MAX_PATH);
	if(len > 0 && len < _MAX_PATH)
		return String(buff, len);
	return Null;
#endif
}



(now in U++, thanks).
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: T* Detach() for ArrayMap
Next Topic: XmlParser patch
Goto Forum:
  


Current Time: Sun May 19 14:30:24 CEST 2024

Total time taken to generate the page: 0.00904 seconds