开发者

Windows shortcut (.lnk .url) parser for shortcut URL's

I've been using this solution to parse a windows shortcut and determine what the shortcut points to. However, it only works for local files and network shares. Windows shortcuts can also point to URLs. The solution I've been us开发者_JAVA技巧ing does not parse URL shortcuts correctly. Any idea why or how to fix it?

For me, it throws an ArrayIndexOutOfBoundsException at this line:

int file_location_info_flag = link[file_start + file_location_info_flag_offset_offset];

I've been testing with a shortcut named "C:\googleshort.url" that points to http://www.google.com/. Clicking on the shortcut works just fine and brings up google, but the java parser fails.


If you open the .url file in a text editor it has the following content:

[InternetShortcut]
URL=http://stackoverflow.com/questions/4974151/windows-shortcut-lnk-url-parser-for-shortcut-urls

Should be easy enough to parse.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜