winedump: Print the network share name in .lnk files. (try 2)
Hans Leidekker
hans at codeweavers.com
Fri May 14 09:46:06 CDT 2010
With better validation of the offsets as suggested by Eric Pouech.
---
tools/winedump/lnk.c | 29 ++++++++++++++++++++++++++---
1 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/tools/winedump/lnk.c b/tools/winedump/lnk.c
index 98892c9..680e2de 100644
--- a/tools/winedump/lnk.c
+++ b/tools/winedump/lnk.c
@@ -118,6 +118,15 @@ typedef struct _LOCAL_VOLUME_INFO
DWORD dwVolLabelOfs;
} LOCAL_VOLUME_INFO;
+typedef struct _NETWORK_VOLUME_INFO
+{
+ DWORD dwSize;
+ DWORD dwUnkown1;
+ DWORD dwShareNameOfs;
+ DWORD dwReserved;
+ DWORD dwUnknown2;
+} NETWORK_VOLUME_INFO;
+
typedef struct
{
DWORD cbSize;
@@ -232,9 +241,10 @@ static int dump_location(void)
printf("Header size = %d\n", loc->dwHeaderSize);
printf("Flags = %08x\n", loc->dwFlags);
- /* dump out information about the volume the link points to */
- printf("Volume ofs = %08x ", loc->dwVolTableOfs);
- if (loc->dwVolTableOfs && (loc->dwVolTableOfs<loc->dwTotalSize))
+ /* dump information about the local volume the link points to */
+ printf("Local volume ofs = %08x ", loc->dwVolTableOfs);
+ if (loc->dwVolTableOfs &&
+ loc->dwVolTableOfs + sizeof(LOCAL_VOLUME_INFO) < loc->dwTotalSize)
{
const LOCAL_VOLUME_INFO *vol = (const LOCAL_VOLUME_INFO *)&p[loc->dwVolTableOfs];
@@ -245,6 +255,19 @@ static int dump_location(void)
}
printf("\n");
+ /* dump information about the network volume the link points to */
+ printf("Network volume ofs = %08x ", loc->dwNetworkVolTableOfs);
+ if (loc->dwNetworkVolTableOfs &&
+ loc->dwNetworkVolTableOfs + sizeof(NETWORK_VOLUME_INFO) < loc->dwTotalSize)
+ {
+ const NETWORK_VOLUME_INFO *vol = (const NETWORK_VOLUME_INFO *)&p[loc->dwNetworkVolTableOfs];
+
+ printf("size %d name %d ", vol->dwSize, vol->dwShareNameOfs);
+ if(vol->dwShareNameOfs)
+ printf("(\"%s\")", &p[loc->dwNetworkVolTableOfs + vol->dwShareNameOfs]);
+ }
+ printf("\n");
+
/* dump out the path the link points to */
printf("LocalPath ofs = %08x ", loc->dwLocalPathOfs);
if( loc->dwLocalPathOfs && (loc->dwLocalPathOfs < loc->dwTotalSize) )
--
1.7.0.4
More information about the wine-patches
mailing list