private LINKINFO Read_LinkInfo(BinaryReader br) { LINKINFO info = new LINKINFO(); uint info_pos = (uint)br.BaseStream.Position; info.linkInfoSize = br.ReadUInt32(); info.linkInfoHeaderSize = br.ReadUInt32(); uint value = br.ReadUInt32(); info.volumeIDAndLocalBasePath = Get_Boolean(value); value >>= 1; info.commonNetworkRelativeLinkAndPathSuffix = Get_Boolean(value); info.volumeIDOffset = br.ReadUInt32(); info.localBasePathOffset = br.ReadUInt32(); info.commonNetworkRelativeLinkOffset = br.ReadUInt32(); info.commonPathSuffixOffset = br.ReadUInt32(); if (info.linkInfoHeaderSize >= 0x24) { info.localBasePathOffsetUnicode = br.ReadUInt32(); info.commonPathSuffixOffsetUnicode = br.ReadUInt32(); } if (info.volumeIDAndLocalBasePath) { // Volume ID uint volumeID_pos = info_pos + info.volumeIDOffset; br.BaseStream.Position = volumeID_pos; info.volumeID = new VOLUMEID(); info.volumeID.volumeIDSize = br.ReadUInt32(); info.volumeID.driveType = (DRIVE_TYPE)br.ReadUInt32(); info.volumeID.driveSerialNumber = br.ReadUInt32(); info.volumeID.volumeLabelOffset = br.ReadUInt32(); if (info.volumeID.volumeLabelOffset != 0x14) { info.volumeID.data = Get_String(br, false, volumeID_pos + info.volumeID.volumeLabelOffset); } else { info.volumeID.volumeLabelOffsetUnicode = br.ReadUInt32(); info.volumeID.data = Get_String(br, true, volumeID_pos + info.volumeID.volumeLabelOffsetUnicode); } // Local Base Path info.localBasePath = Get_String(br, false, info_pos + info.localBasePathOffset); } if (info.commonNetworkRelativeLinkAndPathSuffix) { // Common Network Relative Link uint cnrl_pos = info_pos + info.commonNetworkRelativeLinkOffset; info.cnrl = new COMMON_NETWORK_RELATIVE_LINK(); info.cnrl.cnrl_size = br.ReadUInt32(); uint flags = br.ReadUInt32(); info.cnrl.validDevice = Get_Boolean(flags); flags >>= 1; info.cnrl.validNetType = Get_Boolean(flags); info.cnrl.netNameOffset = br.ReadUInt32(); info.cnrl.deviceNameOffset = br.ReadUInt32(); uint networkprovider = br.ReadUInt32(); if (info.cnrl.validNetType) { info.cnrl.networkProviderType = (PROVIDER_TYPE)networkprovider; } if (info.cnrl.netNameOffset > 0x14) { info.cnrl.netNameOffsetUnicode = br.ReadUInt32(); info.cnrl.deviceNameOffsetUnicode = br.ReadUInt32(); } info.cnrl.netName = Get_String(br, false, cnrl_pos + info.cnrl.netNameOffset); if (info.cnrl.validDevice) { info.cnrl.deviceName = Get_String(br, false, cnrl_pos + info.cnrl.deviceNameOffset); } if (info.cnrl.netNameOffset > 0x14) { info.cnrl.netNameUnicode = Get_String(br, true, cnrl_pos + info.cnrl.netNameOffsetUnicode); info.cnrl.deviceNameUnicode = Get_String(br, true, cnrl_pos + info.cnrl.deviceNameOffsetUnicode); } } info.commonPathSuffix = Get_String(br, false, info_pos + info.commonPathSuffixOffset); if (info.linkInfoHeaderSize >= 0x24 && info.volumeIDAndLocalBasePath) { info.localBasePathUnicode = Get_String(br, true, info_pos + info.localBasePathOffsetUnicode); } if (info.linkInfoHeaderSize >= 0x24) { info.commonPathSuffixUnicode = Get_String(br, true, info_pos + info.commonPathSuffixOffsetUnicode); } return(info); }
private LINKINFO Read_LinkInfo(BinaryReader br) { LINKINFO info = new LINKINFO(); uint info_pos = (uint)br.BaseStream.Position; info.linkInfoSize = br.ReadUInt32(); info.linkInfoHeaderSize = br.ReadUInt32(); uint value = br.ReadUInt32(); info.volumeIDAndLocalBasePath = Get_Boolean(value); value >>= 1; info.commonNetworkRelativeLinkAndPathSuffix = Get_Boolean(value); info.volumeIDOffset = br.ReadUInt32(); info.localBasePathOffset = br.ReadUInt32(); info.commonNetworkRelativeLinkOffset = br.ReadUInt32(); info.commonPathSuffixOffset = br.ReadUInt32(); if (info.linkInfoHeaderSize >= 0x24) { info.localBasePathOffsetUnicode = br.ReadUInt32(); info.commonPathSuffixOffsetUnicode = br.ReadUInt32(); } if (info.volumeIDAndLocalBasePath) { // Volume ID uint volumeID_pos = info_pos + info.volumeIDOffset; br.BaseStream.Position = volumeID_pos; info.volumeID = new VOLUMEID(); info.volumeID.volumeIDSize = br.ReadUInt32(); info.volumeID.driveType = (DRIVE_TYPE)br.ReadUInt32(); info.volumeID.driveSerialNumber = br.ReadUInt32(); info.volumeID.volumeLabelOffset = br.ReadUInt32(); if (info.volumeID.volumeLabelOffset != 0x14) info.volumeID.data = Get_String(br, false, volumeID_pos + info.volumeID.volumeLabelOffset); else { info.volumeID.volumeLabelOffsetUnicode = br.ReadUInt32(); info.volumeID.data = Get_String(br, true, volumeID_pos + info.volumeID.volumeLabelOffsetUnicode); } // Local Base Path info.localBasePath = Get_String(br, false, info_pos + info.localBasePathOffset); } if (info.commonNetworkRelativeLinkAndPathSuffix) { // Common Network Relative Link uint cnrl_pos = info_pos + info.commonNetworkRelativeLinkOffset; info.cnrl = new COMMON_NETWORK_RELATIVE_LINK(); info.cnrl.cnrl_size = br.ReadUInt32(); uint flags = br.ReadUInt32(); info.cnrl.validDevice = Get_Boolean(flags); flags >>= 1; info.cnrl.validNetType = Get_Boolean(flags); info.cnrl.netNameOffset = br.ReadUInt32(); info.cnrl.deviceNameOffset = br.ReadUInt32(); uint networkprovider = br.ReadUInt32(); if (info.cnrl.validNetType) info.cnrl.networkProviderType = (PROVIDER_TYPE)networkprovider; if (info.cnrl.netNameOffset > 0x14) { info.cnrl.netNameOffsetUnicode = br.ReadUInt32(); info.cnrl.deviceNameOffsetUnicode = br.ReadUInt32(); } info.cnrl.netName = Get_String(br, false, cnrl_pos + info.cnrl.netNameOffset); if (info.cnrl.validDevice) info.cnrl.deviceName = Get_String(br, false, cnrl_pos + info.cnrl.deviceNameOffset); if (info.cnrl.netNameOffset > 0x14) { info.cnrl.netNameUnicode = Get_String(br, true, cnrl_pos + info.cnrl.netNameOffsetUnicode); info.cnrl.deviceNameUnicode = Get_String(br, true, cnrl_pos + info.cnrl.deviceNameOffsetUnicode); } } info.commonPathSuffix = Get_String(br, false, info_pos + info.commonPathSuffixOffset); if (info.linkInfoHeaderSize >= 0x24 && info.volumeIDAndLocalBasePath) info.localBasePathUnicode = Get_String(br, true, info_pos + info.localBasePathOffsetUnicode); if (info.linkInfoHeaderSize >= 0x24) info.commonPathSuffixUnicode = Get_String(br, true, info_pos + info.commonPathSuffixOffsetUnicode); return info; }