Remember to make your own backup of posts before submitting.
struct som_art_lnk //DEBUGGER{ char magic[4]; char guid[16]; DWORD idlist:1,path:1; char _unspecified[52]; ///idlist data goes here if present WORD idlist_sz;};static bool som_art_shortcut(wchar_t lnk[MAX_PATH]){ FILE *f = _wfopen(lnk,L"rb"); if(!f) return false; enum{ sizeof_buf=4096 }; //union union { char buf[sizeof_buf]; wchar_t wbuf[sizeof_buf/2]; }; int sz = fread(buf,1,4096,f); fclose(f); char *eof = buf+sz; //source (code is pretty iffy) //https://www.codeproject.com/Articles/24001/Workaround-for-IShellLink-GetPath //sites this source (its code doesn't get very far) //https://ithreats.files.wordpress.com/2009/05/lnk_the_windows_shortcut_file_format.pdf auto &l = *(som_art_lnk*)buf; //for some reason BMP->TXR links have path set to 0??? //if(sz<sizeof(l)||!l.path) return false; if(sz<sizeof(l)) return false; int a = l.idlist?l.idlist_sz:-6; if(buf+a+78>eof) return false; if(l.idlist) //TESTING { //don't know why the codeproject source didn't just do this! return SHGetPathFromIDList((PCIDLIST_ABSOLUTE)(buf+78),lnk); } else assert(0); return false;////NOTE: ALL OF THE BELOW CODE IS DISABLED//// /*this reproduces the codeproject site's code //what I got was a string to "C:\Users\" even //though my path was ANSI DWORD &b = (DWORD&)buf[78+4+a]; if((void*)&b>eof-4) return false; DWORD &c = (DWORD&)buf[78+a+b]; if((void*)&c>eof-4) return false; char *str = buf+78+a+b+c; char *e = str; while(e<eof&&*e) e++; if(str==e||e==eof||e-str>MAX_PATH-1) return false; for(int i=0;str<=e;i++) wbuf[i] = *str++; if(!GetLongPathNameW(wbuf,lnk,MAX_PATH)) wcscpy(lnk,wbuf); return true;*/}
Page created in 0.266 seconds with 276 queries.