mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-23 11:41:53 +08:00
* feat: v2.1.0 核心重构与功能增强
## 架构重构
- 全局变量消除,迁移至 Config/State 对象
- SMB 插件融合(smb/smb2/smbghost/smbinfo)
- 服务探测重构,实现 Nmap 风格 fallback 机制
- 输出系统重构,TXT 实时刷盘 + 双写机制
- i18n 框架升级至 go-i18n
## 性能优化
- 正则表达式预编译
- 内存优化 map[string]struct{}
- 并发指纹匹配
- SOCKS5 连接复用
- 滑动窗口调度 + 自适应线程池
## 新功能
- Web 管理界面
- 多格式 POC 适配(xray/afrog)
- 增强指纹库(3139条)
- Favicon hash 指纹识别
- 插件选择性编译(Build Tags)
- fscan-lab 靶场环境
- 默认端口扩展(62→133)
## 构建系统
- 添加 no_local tag 支持排除本地插件
- 多版本构建:fscan/fscan-nolocal/fscan-web
- CI 添加 snapshot 模式支持仅测试构建
## Bug 修复
- 修复 120+ 个问题,包括 RDP panic、批量扫描漏报、
JSON 输出格式、Redis 检测、Context 超时等
## 测试增强
- 单元测试覆盖率 74-100%
- 并发安全测试
- 集成测试(Web/端口/服务/SSH/ICMP)
* fix(ci): 移除 PR 对 Project 自动化的触发
* fix: Elasticsearch未授权检测优先于爆破 (#554)
* fix: 修复RDP爆破高误报率问题 (#555)
- 移除 screen.go 中错误的认证结果覆盖逻辑
- 启用 NLA 协议的 ErrorCode 字段检测
- 添加 PubKeyAuth 验证确保认证真正成功
- 修复 io.go 中错误被静默忽略的问题
- 修复 socket.go/io.go 中可能导致 panic 的代码
- 修复 screen.go 中文件句柄泄漏和 log.Panic
* fix: 修复-user/-pwd凭据参数不生效的问题
问题原因:
- Parse()解析凭据后更新globalConfig
- 但BuildConfigFromFlags()创建新Config时使用默认字典
- 导致解析的UserPassPairs等凭据信息被丢弃
修复内容:
1. initialize.go: 将Parse解析的凭据结果应用到新Config
2. credential.go: 单用户密码对时创建UserPassPairs
3. rdp.go: 单凭据测试时跳过指纹识别,减少连接次数
* feat: RDP使用NLA仅验证模式,避免挤掉已登录用户
- 添加ErrNLAAuthSuccess标志用于NLA验证成功信号
- tpkt层支持nlaAuthOnly模式,验证成功后不建立完整会话
- x224层正确传播NLA验证结果
- rdpCrack改用NlaAuth进行凭据验证
* fix: 修复进度条在Windows终端满屏重复输出的问题
- 添加终端宽度检测,动态调整进度条长度
- 使用空格覆盖清除旧内容,避免残留
- 简化进度条格式,确保不超过终端宽度
* feat: 优化日志颜色方案,区分漏洞和普通信息
- 新增 LogVuln 级别(红色),用于漏洞和重要发现
- 密码爆破成功、未授权访问、POC漏洞等改用红色显示
- 普通信息(扫描统计等)改为白色
- Web指纹保持绿色
* refactor: 精简化输出,移除冗余启动信息
- 移除showParseSummary开局配置输出
- 移除LogPluginInfo/LogPluginInfoWithPort插件信息输出
- 移除alive_scanner冗余统计输出
- 移除port_scan_start扫描开始提示
- 移除handleUDPPorts SNMP死代码
- 移除相关i18n条目
* chore: 版本号更新为2.1.1
* fix: 降级依赖版本以保持Go 1.20兼容性
* feat(ldap): 添加NTLM Hash认证支持 (#433)
* chore: 清理无用的 replace 指令
* fix(ping): 修复 TTL expired 导致主机误判为存活的问题
在 ExecCommandPing 中增加错误关键词检测,当 ping 输出包含
TTL expired、Destination unreachable 等错误信息时,不再将
目标主机标记为存活。
Fixes #454
* fix(proxy): 修复透明代理导致输出全端口的问题
在代理初始化时主动探测代理行为,通过连接 RFC 5737 保留的
测试地址来检测是否存在"全回显"问题。如果探测到代理不可靠,
则在端口扫描时跳过所有端口,避免误报。
- 新增 proxyReliable 标志位标记代理可靠性
- 新增 ProbeProxyBehavior 函数探测代理行为
- 端口扫描前检查代理可靠性并输出警告
Fixes #495
* refactor: 移动debug模块到common/debug子包
* fix(web): 修复-u模式下Web插件未执行的问题
* fix: 优化输出格式和颜色显示
- 网段统计格式改为 10.253.0.0/16 网段存活: 26
- WebTitle基础信息改为白色,指纹识别单独绿色输出
- 移除重复的端口数量输出
* fix: URL解析自动补全协议头
-uf 文件中 192.168.1.1:8080 自动转为 http://192.168.1.1:8080
* fix: 修复-u/-uf模式下URLs丢失导致0目标扫描的问题
Parse阶段将URLs设置到全局状态,但Initialize随后创建新状态
并覆盖了全局状态,导致URLs数据丢失。现在在创建新状态前
先保存并迁移Parse阶段设置的URLs和HostPorts数据。
* fix: 智能检测HTTP/HTTPS协议并优化URL显示
- 修复-u/-uf模式URLs丢失导致0目标扫描问题
- detectProtocol改为主动TLS握手检测,不依赖服务名
- WebTitle输出显示完整协议(http/https)
- 隐藏标准端口(80/443)使输出更简洁
* refactor: 精简parsers包,统一配置构建入口
- 删除冗余的中间层(XXXInput、XXXParser类)
- 新增 config_builder.go 统一配置构建
- parsers包从3000+行精简至~540行
- 保留核心函数:ParseIP、ParsePort、文件读取、凭据解析
* test: 扩展parsers单元测试覆盖边缘情况
- 新增内网简写解析测试(192/172/10)
- 新增完整IP范围和无效CIDR测试
- 新增Windows行尾(CRLF)处理测试
- 新增凭据和哈希文件解析测试
- 新增端口解析边缘情况测试
- 测试覆盖率达到94.2%
* refactor: 优化控制台输出格式
- 去掉时间戳,保留[*][+]前缀
- Web输出合并WebTitle和WebFinger为一行
- 有指纹显示绿色[+],无指纹显示白色[*]
- 格式: code:xxx len:xxx title:xxx server:xxx [指纹]
- 服务探测格式: [Product:xxx ||Version:xxx] Banner:(xxx)
- 字段对齐,输出更清爽
* feat: 添加凭据测试未发现弱密码的提示
- credential_tester.go: 失败时设置 Type=ResultTypeCredential
- scanner.go: 根据结果类型在 error 级别输出'未发现弱密码'提示
- 新增 i18n 翻译 brute_no_weak_pass
使用 -log all 或 -log error 可看到此提示
* refactor(logging): 重构日志级别为层级过滤设计
- LogLevel 从 string 改为 int 类型,支持层级比较
- 层级设计:Debug(0) < Base(1) < Info(2) < Success(3) < Vuln(4) < Error(5)
- 设置一个级别后,显示该级别及以上的日志
- Error 级别始终显示,不会被配置过滤掉
- 保留向后兼容别名(LevelAll, LevelInfoSuccess 等)
- 更新测试以匹配新的层级过滤行为
* style(logging): Error级别日志改为黄色显示
* style(findnet): NetInfo输出改为每行一个IP
* refactor(ms17010): 优化错误提示,明确指出SMBv1不支持等情况
* fix(credential): 修复凭据测试结果不一致的问题
问题原因:
1. 未知错误类型不重试,导致服务端限流时跳过正确密码
2. SSH 错误分类不够准确,某些临时错误未被识别
修复内容:
1. 未知错误改为可重试(可能是临时问题)
2. 增加 SSH 特有的网络错误识别(handshake failed, disconnect 等)
* fix(portfinger): 修复SMB2服务指纹识别和NetInfo输出问题
- 添加SMB2ProgNeg探针支持现代Windows的SMB2协议
- 修复Go regexp对高位字节的UTF-8兼容问题,使用Latin-1转换
- 修复探针失败后连接重建逻辑
- 修复vendor_product字段名不匹配问题
- 修复NetInfo多行输出被其他日志打断的问题
* fix(config): 从默认端口移除9100,避免触发打印机打印 (#517)
* feat(proxy): 增强代理端口扫描的深度验证机制
- 新增4阶段深度验证:Banner读取→探测发送→响应等待→最终判定
- 新增SOCKS5错误码和代理错误文本检测
- 优化ProbeProxyBehavior探测逻辑,发送数据验证连接可达性
- 解决透明代理/全回显代理导致的假阳性问题
* fix(proxy): 修复代理深度验证的若干问题
- detector.go: 修复 AutoConfigureProxy 覆盖探测结果的问题
只有未探测过时才设置默认 proxyReliable 值
- port_scan.go: 改进深度验证机制
- 使用带 Host header 的 HTTP GET 请求替代 OPTIONS
- 延长响应等待超时至 2s 以适配慢速服务器
- 正确重置连接 deadline 避免影响后续操作
* refactor: 统一 common 包文件命名风格
Flag.go -> flag.go
* refactor(proxy): 删除自定义 contains() 函数,改用标准库
- 用 strings.Contains() 替代手写的 contains()
- 删除过时的注释
* fix(parsers): 修复带横杠域名被误识别为IP范围的问题
如 111-555.sss.com 这类域名因包含 - 被错误解析为 IP 范围,
添加 looksLikeIPRange() 检查,只有 - 前是有效 IP 才走范围解析
* fix(proxy): 修复代理模式下服务识别错误和端口漏扫问题
- port_scan.go: 验证通过后重建干净连接,避免HTTP GET探测污染服务识别
- port_scan.go: 优化验证策略,用轻量CRLF探测替代HTTP GET,超时从2.2s降至0.6s
- manager.go: 修正ProbeProxyBehavior判断逻辑,超时应视为代理正常转发
* fix(pool): 移除线程池预分配,优化大规模扫描内存占用
WithPreAlloc(true) 会预先创建所有 worker goroutine,
在大规模扫描(如 25域名×65535端口)时可能导致内存问题
* refactor(logging): 统一日志前缀,删除废弃的 LogBase
- 删除 LogBase 函数,所有调用迁移到 LogInfo/LogError
- 新增 PrefixDebug ([.]) 前缀,所有日志级别现在都有前缀
- 修复日志输出缩进不一致的问题
- 删除未使用的 PrefixDefault 常量
* perf(icmp): 实现自适应等待算法优化存活检测性能
- 新增 waitAdaptive 函数,监控响应增量实现智能提前结束
- 算法保守原则:最小等待1s + 连续500ms无新响应才提前结束
- 添加100ms检查间隔避免CPU空转
- 保留原有最大等待时间(3s/6s)作为兜底
- 添加完整单元测试覆盖各种场景
优化效果:
- 全部响应:~100ms (原3s)
- 无响应:~1s (原3s)
- 部分响应后稳定:~1.5s (原3s)
* perf(scan): 实现启发式优化提升扫描体验
1. 端口优先级排序:高价值端口(80,443,22,3389等)优先扫描
- 用户能更快看到有意义的结果
- 不影响端口喷洒策略
2. TCP 补充探测:ICMP 响应率<10%时自动启用
- 对未响应主机用 TCP 80/443/22/445 补充探测
- 解决防火墙过滤 ICMP 导致漏检的问题
* refactor(grdp): 精简RDP库,删除认证检测不需要的代码
- 删除 VNC 协议支持 (protocol/rfb, client/rfb.go)
- 删除完整客户端框架 (client/)
- 删除 RemoteApp 等插件 (plugin/)
- 删除 RLE 图形解压 (core/rle.go)
- 删除绘图指令处理 (pdu/orders.go, pdu/gdi.go)
- 精简 screen.go,移除截图和完整会话功能
- 移除未使用的 RGB 转换函数
grdp 代码从 13,044 行精简至 7,581 行,削减 42%
* refactor(common): 删除死代码,优化代码风格
- 删除未使用的 joinStrings/joinInts 函数
- 删除未使用的 memStats 字段和 getMemoryInfo 方法
- 简化 parsePasswords 中的循环为 append(...) 形式
* refactor(services): 统一数据库插件的DBWrapper
4个数据库插件(MySQL、PostgreSQL、MSSQL、Oracle)都有相同的sql.DB包装代码,
合并为通用的SQLDBWrapper,减少重复。
* refactor(core,grdp): 删除未使用的死代码
- 移除 BaseScanStrategy.LogPluginInfoWithPort 方法(无调用者)
- 移除 mcs.go 中被注释的旧 connect 函数实现
* refactor: 删除 deadcode 检测出的未使用函数
- proxy/detector.go: 删除 IsSOCKS5Standard, IsProxyInitialized
- findnet.go: 删除 NetworkInfo.OneLine, TreeFormat 方法
- port_scan.go: 删除 estimateScanTime 函数
- web_scanner.go: 删除 GetFingerprints 函数
- 清理相关测试代码
* refactor: 删除更多未使用的死代码
- parse.go: 删除 RemoveDuplicate 函数及其测试
- parsers.go: 删除 excludeHosts, removeDuplicates 别名函数
- 更新测试使用真正的函数名
* fix(test): 修复 TestParseIP_InvalidIPRange 测试用例
- 删除不合理的测试用例(无效IP被当作普通主机名处理是设计行为)
- 修复测试逻辑,只在真正通过时输出"正确"
* fix(scan): 移除域名预解析,保留原始域名进行扫描
域名预解析会将域名转换为IP,导致虚拟主机场景下HTTP访问失败
(Host头变成IP而非域名,无法正确路由)
* fix(scan): 修复 -hf 参数无法单独使用的问题
* fix(proxy): 修复透明代理环境下 SOCKS5 代理全端口误报问题
问题:在透明代理(TUN模式)环境下使用 SOCKS5 代理扫描时,
会出现全端口开放的误报,因为代理可靠性检测被透明代理污染。
修复方案(参考 fscanx):
1. 将探针从 CRLF 改为 HTTP GET,更有效检测真实连接状态
2. 删除 "uncertain" 状态,无响应一律判定为端口关闭
3. 调整超时时间以适应代理链路延迟
Fixes #524
* feat(telnet): 新增 telnetd RCE 命令执行验证,修复未授权访问日志级别
* fix: 修复 i18n.Tr vet 报错、Unicode 测试用例,移除过期域名
- 移除 i18n.Tr 中错误的 fmt.Sprintf fallback,消除 go vet 误报
- 修复 match_engine_test Unicode 测试用例与 Latin-1 转换逻辑不匹配
- README 移除过期的 fscan.club 域名
- 添加 .gitattributes 统一换行符为 LF
* refactor: 统一控制台输出风格,使用统一的日志函数
手动合并 PR #558 的改动,适配重构后的代码路径
* fix(ci): 修复版本注入和CI触发配置
- goreleaser ldflags 指向正确的包路径 common.version/commit/date
- version 改为 var 支持 ldflags 注入,banner 显示 commit 和构建日期
- test-build 触发分支增加 dev-* 通配
* fix(ci): 修复 Windows 产物 .exe.exe 双后缀问题
* feat(ci): 扩展构建架构支持 MIPS/ARM/FreeBSD/Solaris
761 lines
22 KiB
Go
761 lines
22 KiB
Go
package pdu
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/hex"
|
|
"errors"
|
|
"fmt"
|
|
"io"
|
|
|
|
"github.com/shadow1ng/fscan/mylib/grdp/glog"
|
|
|
|
"github.com/lunixbochs/struc"
|
|
"github.com/shadow1ng/fscan/mylib/grdp/core"
|
|
"github.com/shadow1ng/fscan/mylib/grdp/protocol/t125/gcc"
|
|
)
|
|
|
|
type CapsType uint16
|
|
|
|
const (
|
|
CAPSTYPE_GENERAL CapsType = 0x0001
|
|
CAPSTYPE_BITMAP = 0x0002
|
|
CAPSTYPE_ORDER = 0x0003
|
|
CAPSTYPE_BITMAPCACHE = 0x0004
|
|
CAPSTYPE_CONTROL = 0x0005
|
|
CAPSTYPE_ACTIVATION = 0x0007
|
|
CAPSTYPE_POINTER = 0x0008
|
|
CAPSTYPE_SHARE = 0x0009
|
|
CAPSTYPE_COLORCACHE = 0x000A
|
|
CAPSTYPE_SOUND = 0x000C
|
|
CAPSTYPE_INPUT = 0x000D
|
|
CAPSTYPE_FONT = 0x000E
|
|
CAPSTYPE_BRUSH = 0x000F
|
|
CAPSTYPE_GLYPHCACHE = 0x0010
|
|
CAPSTYPE_OFFSCREENCACHE = 0x0011
|
|
CAPSTYPE_BITMAPCACHE_HOSTSUPPORT = 0x0012
|
|
CAPSTYPE_BITMAPCACHE_REV2 = 0x0013
|
|
CAPSTYPE_VIRTUALCHANNEL = 0x0014
|
|
CAPSTYPE_DRAWNINEGRIDCACHE = 0x0015
|
|
CAPSTYPE_DRAWGDIPLUS = 0x0016
|
|
CAPSTYPE_RAIL = 0x0017
|
|
CAPSTYPE_WINDOW = 0x0018
|
|
CAPSETTYPE_COMPDESK = 0x0019
|
|
CAPSETTYPE_MULTIFRAGMENTUPDATE = 0x001A
|
|
CAPSETTYPE_LARGE_POINTER = 0x001B
|
|
CAPSETTYPE_SURFACE_COMMANDS = 0x001C
|
|
CAPSETTYPE_BITMAP_CODECS = 0x001D
|
|
CAPSSETTYPE_FRAME_ACKNOWLEDGE = 0x001E
|
|
)
|
|
|
|
func (c CapsType) String() string {
|
|
switch c {
|
|
case CAPSTYPE_GENERAL:
|
|
return "CAPSTYPE_GENERAL"
|
|
case CAPSTYPE_BITMAP:
|
|
return "CAPSTYPE_BITMAP"
|
|
case CAPSTYPE_ORDER:
|
|
return "CAPSTYPE_ORDER"
|
|
case CAPSTYPE_BITMAPCACHE:
|
|
return "CAPSTYPE_BITMAPCACHE"
|
|
case CAPSTYPE_CONTROL:
|
|
return "CAPSTYPE_CONTROL"
|
|
case CAPSTYPE_ACTIVATION:
|
|
return "CAPSTYPE_ACTIVATION"
|
|
case CAPSTYPE_POINTER:
|
|
return "CAPSTYPE_POINTER"
|
|
case CAPSTYPE_SHARE:
|
|
return "CAPSTYPE_SHARE"
|
|
case CAPSTYPE_COLORCACHE:
|
|
return "CAPSTYPE_COLORCACHE"
|
|
case CAPSTYPE_SOUND:
|
|
return "CAPSTYPE_SOUND"
|
|
case CAPSTYPE_INPUT:
|
|
return "CAPSTYPE_INPUT"
|
|
case CAPSTYPE_FONT:
|
|
return "CAPSTYPE_FONT"
|
|
case CAPSTYPE_BRUSH:
|
|
return "CAPSTYPE_BRUSH"
|
|
case CAPSTYPE_GLYPHCACHE:
|
|
return "CAPSTYPE_GLYPHCACHE"
|
|
case CAPSTYPE_OFFSCREENCACHE:
|
|
return "CAPSTYPE_OFFSCREENCACHE"
|
|
case CAPSTYPE_BITMAPCACHE_HOSTSUPPORT:
|
|
return "CAPSTYPE_BITMAPCACHE_HOSTSUPPORT"
|
|
case CAPSTYPE_BITMAPCACHE_REV2:
|
|
return "CAPSTYPE_BITMAPCACHE_REV2"
|
|
case CAPSTYPE_VIRTUALCHANNEL:
|
|
return "CAPSTYPE_VIRTUALCHANNEL"
|
|
case CAPSTYPE_DRAWNINEGRIDCACHE:
|
|
return "CAPSTYPE_DRAWNINEGRIDCACHE"
|
|
case CAPSTYPE_DRAWGDIPLUS:
|
|
return "CAPSTYPE_DRAWGDIPLUS"
|
|
case CAPSTYPE_RAIL:
|
|
return "CAPSTYPE_RAIL"
|
|
case CAPSTYPE_WINDOW:
|
|
return "CAPSTYPE_WINDOW"
|
|
case CAPSETTYPE_COMPDESK:
|
|
return "CAPSETTYPE_COMPDESK"
|
|
case CAPSETTYPE_MULTIFRAGMENTUPDATE:
|
|
return "CAPSETTYPE_MULTIFRAGMENTUPDATE"
|
|
case CAPSETTYPE_LARGE_POINTER:
|
|
return "CAPSETTYPE_LARGE_POINTER"
|
|
case CAPSETTYPE_SURFACE_COMMANDS:
|
|
return "CAPSETTYPE_SURFACE_COMMANDS"
|
|
case CAPSETTYPE_BITMAP_CODECS:
|
|
return "CAPSETTYPE_BITMAP_CODECS"
|
|
case CAPSSETTYPE_FRAME_ACKNOWLEDGE:
|
|
return "CAPSSETTYPE_FRAME_ACKNOWLEDGE"
|
|
}
|
|
|
|
return "Unknown"
|
|
}
|
|
|
|
type MajorType uint16
|
|
|
|
const (
|
|
OSMAJORTYPE_UNSPECIFIED MajorType = 0x0000
|
|
OSMAJORTYPE_WINDOWS = 0x0001
|
|
OSMAJORTYPE_OS2 = 0x0002
|
|
OSMAJORTYPE_MACINTOSH = 0x0003
|
|
OSMAJORTYPE_UNIX = 0x0004
|
|
OSMAJORTYPE_IOS = 0x0005
|
|
OSMAJORTYPE_OSX = 0x0006
|
|
OSMAJORTYPE_ANDROID = 0x0007
|
|
)
|
|
|
|
type MinorType uint16
|
|
|
|
const (
|
|
OSMINORTYPE_UNSPECIFIED MinorType = 0x0000
|
|
OSMINORTYPE_WINDOWS_31X = 0x0001
|
|
OSMINORTYPE_WINDOWS_95 = 0x0002
|
|
OSMINORTYPE_WINDOWS_NT = 0x0003
|
|
OSMINORTYPE_OS2_V21 = 0x0004
|
|
OSMINORTYPE_POWER_PC = 0x0005
|
|
OSMINORTYPE_MACINTOSH = 0x0006
|
|
OSMINORTYPE_NATIVE_XSERVER = 0x0007
|
|
OSMINORTYPE_PSEUDO_XSERVER = 0x0008
|
|
OSMINORTYPE_WINDOWS_RT = 0x0009
|
|
)
|
|
|
|
const (
|
|
FASTPATH_OUTPUT_SUPPORTED uint16 = 0x0001
|
|
NO_BITMAP_COMPRESSION_HDR = 0x0400
|
|
LONG_CREDENTIALS_SUPPORTED = 0x0004
|
|
AUTORECONNECT_SUPPORTED = 0x0008
|
|
ENC_SALTED_CHECKSUM = 0x0010
|
|
)
|
|
|
|
type OrderFlag uint16
|
|
|
|
const (
|
|
NEGOTIATEORDERSUPPORT OrderFlag = 0x0002
|
|
ZEROBOUNDSDELTASSUPPORT = 0x0008
|
|
COLORINDEXSUPPORT = 0x0020
|
|
SOLIDPATTERNBRUSHONLY = 0x0040
|
|
ORDERFLAGS_EXTRA_FLAGS = 0x0080
|
|
)
|
|
|
|
/**
|
|
* @see http://msdn.microsoft.com/en-us/library/cc240556.aspx
|
|
*/
|
|
type Order uint8
|
|
|
|
const (
|
|
TS_NEG_DSTBLT_INDEX Order = 0x00
|
|
TS_NEG_PATBLT_INDEX = 0x01
|
|
TS_NEG_SCRBLT_INDEX = 0x02
|
|
TS_NEG_MEMBLT_INDEX = 0x03
|
|
TS_NEG_MEM3BLT_INDEX = 0x04
|
|
TS_NEG_DRAWNINEGRID_INDEX = 0x07
|
|
TS_NEG_LINETO_INDEX = 0x08
|
|
TS_NEG_MULTI_DRAWNINEGRID_INDEX = 0x09
|
|
TS_NEG_SAVEBITMAP_INDEX = 0x0B
|
|
TS_NEG_MULTIDSTBLT_INDEX = 0x0F
|
|
TS_NEG_MULTIPATBLT_INDEX = 0x10
|
|
TS_NEG_MULTISCRBLT_INDEX = 0x11
|
|
TS_NEG_MULTIOPAQUERECT_INDEX = 0x12
|
|
TS_NEG_FAST_INDEX_INDEX = 0x13
|
|
TS_NEG_POLYGON_SC_INDEX = 0x14
|
|
TS_NEG_POLYGON_CB_INDEX = 0x15
|
|
TS_NEG_POLYLINE_INDEX = 0x16
|
|
TS_NEG_FAST_GLYPH_INDEX = 0x18
|
|
TS_NEG_ELLIPSE_SC_INDEX = 0x19
|
|
TS_NEG_ELLIPSE_CB_INDEX = 0x1A
|
|
TS_NEG_GLYPH_INDEX_INDEX = 0x1B
|
|
)
|
|
|
|
type OrderEx uint16
|
|
|
|
const (
|
|
ORDERFLAGS_EX_CACHE_BITMAP_REV3_SUPPORT OrderEx = 0x0002
|
|
ORDERFLAGS_EX_ALTSEC_FRAME_MARKER_SUPPORT = 0x0004
|
|
)
|
|
|
|
/**
|
|
* @see http://msdn.microsoft.com/en-us/library/cc240563.aspx
|
|
*/
|
|
|
|
const (
|
|
INPUT_FLAG_SCANCODES uint16 = 0x0001
|
|
INPUT_FLAG_MOUSEX = 0x0004
|
|
INPUT_FLAG_FASTPATH_INPUT = 0x0008
|
|
INPUT_FLAG_UNICODE = 0x0010
|
|
INPUT_FLAG_FASTPATH_INPUT2 = 0x0020
|
|
INPUT_FLAG_UNUSED1 = 0x0040
|
|
INPUT_FLAG_UNUSED2 = 0x0080
|
|
INPUT_FLAG_MOUSE_HWHEEL = 0x0100
|
|
)
|
|
|
|
/**
|
|
* @see http://msdn.microsoft.com/en-us/library/cc240564.aspx
|
|
*/
|
|
type BrushSupport uint32
|
|
|
|
const (
|
|
BRUSH_DEFAULT BrushSupport = 0x00000000
|
|
BRUSH_COLOR_8x8 = 0x00000001
|
|
BRUSH_COLOR_FULL = 0x00000002
|
|
)
|
|
|
|
/**
|
|
* @see http://msdn.microsoft.com/en-us/library/cc240565.aspx
|
|
*/
|
|
type GlyphSupport uint16
|
|
|
|
const (
|
|
GLYPH_SUPPORT_NONE GlyphSupport = 0x0000
|
|
GLYPH_SUPPORT_PARTIAL = 0x0001
|
|
GLYPH_SUPPORT_FULL = 0x0002
|
|
GLYPH_SUPPORT_ENCODE = 0x0003
|
|
)
|
|
|
|
/**
|
|
* @see http://msdn.microsoft.com/en-us/library/cc240550.aspx
|
|
*/
|
|
type OffscreenSupportLevel uint32
|
|
|
|
const (
|
|
OSL_FALSE OffscreenSupportLevel = 0x00000000
|
|
OSL_TRUE = 0x00000001
|
|
)
|
|
|
|
/**
|
|
* @see http://msdn.microsoft.com/en-us/library/cc240551.aspx
|
|
*/
|
|
type VirtualChannelCompressionFlag uint32
|
|
|
|
const (
|
|
VCCAPS_NO_COMPR VirtualChannelCompressionFlag = 0x00000000
|
|
VCCAPS_COMPR_SC = 0x00000001
|
|
VCCAPS_COMPR_CS_8K = 0x00000002
|
|
)
|
|
|
|
type SoundFlag uint16
|
|
|
|
const (
|
|
SOUND_NONE SoundFlag = 0x0000
|
|
SOUND_BEEPS_FLAG = 0x0001
|
|
)
|
|
|
|
type RailsupportLevel uint32
|
|
|
|
const (
|
|
RAIL_LEVEL_SUPPORTED = 0x00000001
|
|
RAIL_LEVEL_DOCKED_LANGBAR_SUPPORTED = 0x00000002
|
|
RAIL_LEVEL_SHELL_INTEGRATION_SUPPORTED = 0x00000004
|
|
RAIL_LEVEL_LANGUAGE_IME_SYNC_SUPPORTED = 0x00000008
|
|
RAIL_LEVEL_SERVER_TO_CLIENT_IME_SYNC_SUPPORTED = 0x00000010
|
|
RAIL_LEVEL_HIDE_MINIMIZED_APPS_SUPPORTED = 0x00000020
|
|
RAIL_LEVEL_WINDOW_CLOAKING_SUPPORTED = 0x00000040
|
|
RAIL_LEVEL_HANDSHAKE_EX_SUPPORTED = 0x00000080
|
|
)
|
|
|
|
const (
|
|
INPUT_EVENT_SYNC = 0x0000
|
|
INPUT_EVENT_UNUSED = 0x0002
|
|
INPUT_EVENT_SCANCODE = 0x0004
|
|
INPUT_EVENT_UNICODE = 0x0005
|
|
INPUT_EVENT_MOUSE = 0x8001
|
|
INPUT_EVENT_MOUSEX = 0x8002
|
|
)
|
|
|
|
const (
|
|
PTRFLAGS_HWHEEL = 0x0400
|
|
PTRFLAGS_WHEEL = 0x0200
|
|
PTRFLAGS_WHEEL_NEGATIVE = 0x0100
|
|
WheelRotationMask = 0x01FF
|
|
PTRFLAGS_MOVE = 0x0800
|
|
PTRFLAGS_DOWN = 0x8000
|
|
PTRFLAGS_BUTTON1 = 0x1000
|
|
PTRFLAGS_BUTTON2 = 0x2000
|
|
PTRFLAGS_BUTTON3 = 0x4000
|
|
)
|
|
|
|
const (
|
|
KBDFLAGS_EXTENDED = 0x0100
|
|
KBDFLAGS_DOWN = 0x4000
|
|
KBDFLAGS_RELEASE = 0x8000
|
|
)
|
|
|
|
type SurfaceCmdFlags uint32
|
|
|
|
const (
|
|
SURFCMDS_SET_SURFACE_BITS = 0x00000002
|
|
SURFCMDS_FRAME_MARKER = 0x00000010
|
|
SURFCMDS_STREAM_SURFACE_BITS = 0x00000040
|
|
)
|
|
|
|
type Capability interface {
|
|
Type() CapsType
|
|
}
|
|
|
|
type GeneralCapability struct {
|
|
// 010018000100030000020000000015040000000000000000
|
|
OSMajorType MajorType `struc:"little"`
|
|
OSMinorType MinorType `struc:"little"`
|
|
ProtocolVersion uint16 `struc:"little"`
|
|
Pad2octetsA uint16 `struc:"little"`
|
|
GeneralCompressionTypes uint16 `struc:"little"`
|
|
ExtraFlags uint16 `struc:"little"`
|
|
UpdateCapabilityFlag uint16 `struc:"little"`
|
|
RemoteUnshareFlag uint16 `struc:"little"`
|
|
GeneralCompressionLevel uint16 `struc:"little"`
|
|
RefreshRectSupport uint8 `struc:"little"`
|
|
SuppressOutputSupport uint8 `struc:"little"`
|
|
}
|
|
|
|
func (*GeneralCapability) Type() CapsType {
|
|
return CAPSTYPE_GENERAL
|
|
}
|
|
|
|
type BitmapCapability struct {
|
|
// 02001c00180001000100010000052003000000000100000001000000
|
|
PreferredBitsPerPixel gcc.HighColor `struc:"little"`
|
|
Receive1BitPerPixel uint16 `struc:"little"`
|
|
Receive4BitsPerPixel uint16 `struc:"little"`
|
|
Receive8BitsPerPixel uint16 `struc:"little"`
|
|
DesktopWidth uint16 `struc:"little"`
|
|
DesktopHeight uint16 `struc:"little"`
|
|
Pad2octets uint16 `struc:"little"`
|
|
DesktopResizeFlag uint16 `struc:"little"`
|
|
BitmapCompressionFlag uint16 `struc:"little"`
|
|
HighColorFlags uint8 `struc:"little"`
|
|
DrawingFlags uint8 `struc:"little"`
|
|
MultipleRectangleSupport uint16 `struc:"little"`
|
|
Pad2octetsB uint16 `struc:"little"`
|
|
}
|
|
|
|
func (*BitmapCapability) Type() CapsType {
|
|
return CAPSTYPE_BITMAP
|
|
}
|
|
|
|
type BitmapCacheCapability struct {
|
|
// 04002800000000000000000000000000000000000000000000000000000000000000000000000000
|
|
Pad1 uint32 `struc:"little"`
|
|
Pad2 uint32 `struc:"little"`
|
|
Pad3 uint32 `struc:"little"`
|
|
Pad4 uint32 `struc:"little"`
|
|
Pad5 uint32 `struc:"little"`
|
|
Pad6 uint32 `struc:"little"`
|
|
Cache0Entries uint16 `struc:"little"`
|
|
Cache0MaximumCellSize uint16 `struc:"little"`
|
|
Cache1Entries uint16 `struc:"little"`
|
|
Cache1MaximumCellSize uint16 `struc:"little"`
|
|
Cache2Entries uint16 `struc:"little"`
|
|
Cache2MaximumCellSize uint16 `struc:"little"`
|
|
}
|
|
|
|
func (*BitmapCacheCapability) Type() CapsType {
|
|
return CAPSTYPE_BITMAPCACHE
|
|
}
|
|
|
|
type OrderCapability struct {
|
|
// 030058000000000000000000000000000000000000000000010014000000010000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000008403000000000000000000
|
|
TerminalDescriptor [16]byte
|
|
Pad4octetsA uint32 `struc:"little"`
|
|
DesktopSaveXGranularity uint16 `struc:"little"`
|
|
DesktopSaveYGranularity uint16 `struc:"little"`
|
|
Pad2octetsA uint16 `struc:"little"`
|
|
MaximumOrderLevel uint16 `struc:"little"`
|
|
NumberFonts uint16 `struc:"little"`
|
|
OrderFlags OrderFlag `struc:"little"`
|
|
OrderSupport [32]byte
|
|
TextFlags uint16 `struc:"little"`
|
|
OrderSupportExFlags uint16 `struc:"little"`
|
|
Pad4octetsB uint32 `struc:"little"`
|
|
DesktopSaveSize uint32 `struc:"little"`
|
|
Pad2octetsC uint16 `struc:"little"`
|
|
Pad2octetsD uint16 `struc:"little"`
|
|
TextANSICodePage uint16 `struc:"little"`
|
|
Pad2octetsE uint16 `struc:"little"`
|
|
}
|
|
|
|
func (*OrderCapability) Type() CapsType {
|
|
return CAPSTYPE_ORDER
|
|
}
|
|
|
|
type PointerCapability struct {
|
|
ColorPointerFlag uint16 `struc:"little"`
|
|
ColorPointerCacheSize uint16 `struc:"little"`
|
|
// old version of rdp doesn't support ...
|
|
PointerCacheSize uint16 `struc:"little"` // only server need
|
|
}
|
|
|
|
func (*PointerCapability) Type() CapsType {
|
|
return CAPSTYPE_POINTER
|
|
}
|
|
|
|
type InputCapability struct {
|
|
// 0d005c001500000009040000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000
|
|
Flags uint16 `struc:"little"`
|
|
Pad2octetsA uint16 `struc:"little"`
|
|
// same value as gcc.ClientCoreSettings.kbdLayout
|
|
KeyboardLayout gcc.KeyboardLayout `struc:"little"`
|
|
// same value as gcc.ClientCoreSettings.keyboardType
|
|
KeyboardType uint32 `struc:"little"`
|
|
// same value as gcc.ClientCoreSettings.keyboardSubType
|
|
KeyboardSubType uint32 `struc:"little"`
|
|
// same value as gcc.ClientCoreSettings.keyboardFnKeys
|
|
KeyboardFunctionKey uint32 `struc:"little"`
|
|
// same value as gcc.ClientCoreSettingrrs.imeFileName
|
|
ImeFileName [64]byte
|
|
//need add 0c000000 in the end
|
|
}
|
|
|
|
func (*InputCapability) Type() CapsType {
|
|
return CAPSTYPE_INPUT
|
|
}
|
|
|
|
type BrushCapability struct {
|
|
// 0f00080000000000
|
|
SupportLevel BrushSupport `struc:"little"`
|
|
}
|
|
|
|
func (*BrushCapability) Type() CapsType {
|
|
return CAPSTYPE_BRUSH
|
|
}
|
|
|
|
type cacheEntry struct {
|
|
Entries uint16 `struc:"little"`
|
|
MaximumCellSize uint16 `struc:"little"`
|
|
}
|
|
|
|
type GlyphCapability struct {
|
|
// 10003400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
GlyphCache [10]cacheEntry `struc:"little"`
|
|
FragCache uint32 `struc:"little"`
|
|
SupportLevel GlyphSupport `struc:"little"`
|
|
Pad2octets uint16 `struc:"little"`
|
|
}
|
|
|
|
func (*GlyphCapability) Type() CapsType {
|
|
return CAPSTYPE_GLYPHCACHE
|
|
}
|
|
|
|
type OffscreenBitmapCacheCapability struct {
|
|
// 11000c000000000000000000
|
|
SupportLevel OffscreenSupportLevel `struc:"little"`
|
|
CacheSize uint16 `struc:"little"`
|
|
CacheEntries uint16 `struc:"little"`
|
|
}
|
|
|
|
func (*OffscreenBitmapCacheCapability) Type() CapsType {
|
|
return CAPSTYPE_OFFSCREENCACHE
|
|
}
|
|
|
|
type BitmapCache2Capability struct {
|
|
BitmapCachePersist uint16 `struc:"little"`
|
|
Pad2octets uint8 `struc:"little"`
|
|
CachesNum uint8 `struc:"little"`
|
|
BmpC0Cells uint32 `struc:"little"`
|
|
BmpC1Cells uint32 `struc:"little"`
|
|
BmpC2Cells uint32 `struc:"little"`
|
|
BmpC3Cells uint32 `struc:"little"`
|
|
BmpC4Cells uint32 `struc:"little"`
|
|
Pad2octets1 [12]byte `struc:"little"`
|
|
}
|
|
|
|
func (*BitmapCache2Capability) Type() CapsType {
|
|
return CAPSTYPE_BITMAPCACHE_REV2
|
|
}
|
|
|
|
type VirtualChannelCapability struct {
|
|
// 14000c000000000000000000
|
|
Flags VirtualChannelCompressionFlag `struc:"little"`
|
|
VCChunkSize uint32 `struc:"little"` // optional
|
|
}
|
|
|
|
func (*VirtualChannelCapability) Type() CapsType {
|
|
return CAPSTYPE_VIRTUALCHANNEL
|
|
}
|
|
|
|
type SoundCapability struct {
|
|
// 0c00080000000000
|
|
Flags SoundFlag `struc:"little"`
|
|
Pad2octets uint16 `struc:"little"`
|
|
}
|
|
|
|
func (*SoundCapability) Type() CapsType {
|
|
return CAPSTYPE_SOUND
|
|
}
|
|
|
|
type ControlCapability struct {
|
|
ControlFlags uint16 `struc:"little"`
|
|
RemoteDetachFlag uint16 `struc:"little"`
|
|
ControlInterest uint16 `struc:"little"`
|
|
DetachInterest uint16 `struc:"little"`
|
|
}
|
|
|
|
func (*ControlCapability) Type() CapsType {
|
|
return CAPSTYPE_CONTROL
|
|
}
|
|
|
|
type WindowActivationCapability struct {
|
|
HelpKeyFlag uint16 `struc:"little"`
|
|
HelpKeyIndexFlag uint16 `struc:"little"`
|
|
HelpExtendedKeyFlag uint16 `struc:"little"`
|
|
WindowManagerKeyFlag uint16 `struc:"little"`
|
|
}
|
|
|
|
func (*WindowActivationCapability) Type() CapsType {
|
|
return CAPSTYPE_ACTIVATION
|
|
}
|
|
|
|
type FontCapability struct {
|
|
SupportFlags uint16 `struc:"little"`
|
|
Pad2octets uint16 `struc:"little"`
|
|
}
|
|
|
|
func (*FontCapability) Type() CapsType {
|
|
return CAPSTYPE_FONT
|
|
}
|
|
|
|
type ColorCacheCapability struct {
|
|
CacheSize uint16 `struc:"little"`
|
|
Pad2octets uint16 `struc:"little"`
|
|
}
|
|
|
|
func (*ColorCacheCapability) Type() CapsType {
|
|
return CAPSTYPE_COLORCACHE
|
|
}
|
|
|
|
type ShareCapability struct {
|
|
NodeId uint16 `struc:"little"`
|
|
Pad2octets uint16 `struc:"little"`
|
|
}
|
|
|
|
func (*ShareCapability) Type() CapsType {
|
|
return CAPSTYPE_SHARE
|
|
}
|
|
|
|
type MultiFragmentUpdate struct {
|
|
// 1a00080000000000
|
|
MaxRequestSize uint32 `struc:"little"`
|
|
}
|
|
|
|
func (*MultiFragmentUpdate) Type() CapsType {
|
|
return CAPSETTYPE_MULTIFRAGMENTUPDATE
|
|
}
|
|
|
|
// see https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpegdi/52635737-d144-4f47-9c88-b48ceaf3efb4
|
|
|
|
type DrawGDIPlusCapability struct {
|
|
SupportLevel uint32
|
|
GdipVersion uint32
|
|
CacheLevel uint32
|
|
GdipCacheEntries [10]byte
|
|
GdipCacheChunkSize [8]byte
|
|
GdipImageCacheProperties [6]byte
|
|
}
|
|
|
|
func (*DrawGDIPlusCapability) Type() CapsType {
|
|
return CAPSTYPE_DRAWGDIPLUS
|
|
}
|
|
|
|
// see https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpbcgr/86507fed-a0ee-4242-b802-237534a8f65e
|
|
type BitmapCodec struct {
|
|
GUID [16]byte
|
|
ID uint8
|
|
PropertiesLength uint16 `struc:"little,sizeof=Properties"`
|
|
Properties []byte
|
|
}
|
|
|
|
// see https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpbcgr/408b1878-9f6e-4106-8329-1af42219ba6a
|
|
type BitmapCodecS struct {
|
|
Count uint8 `struc:"sizeof=Array"`
|
|
Array []BitmapCodec
|
|
}
|
|
|
|
// see https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpbcgr/17e80f50-d163-49de-a23b-fd6456aa472f
|
|
type BitmapCodecsCapability struct {
|
|
SupportedBitmapCodecs BitmapCodecS // A variable-length field containing a TS_BITMAPCODECS structure (section 2.2.7.2.10.1).
|
|
}
|
|
|
|
func (*BitmapCodecsCapability) Type() CapsType {
|
|
return CAPSETTYPE_BITMAP_CODECS
|
|
}
|
|
|
|
// see https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpbcgr/fc05c385-46c3-42cb-9ed2-c475a3990e0b
|
|
type BitmapCacheHostSupportCapability struct {
|
|
CacheVersion uint8
|
|
Pad1 uint8
|
|
Pad2 uint16
|
|
}
|
|
|
|
func (*BitmapCacheHostSupportCapability) Type() CapsType {
|
|
return CAPSTYPE_BITMAPCACHE_HOSTSUPPORT
|
|
}
|
|
|
|
// see https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpbcgr/41323437-c753-460e-8108-495a6fdd68a8
|
|
type LargePointerCapability struct {
|
|
SupportFlags uint16 `struc:"little"`
|
|
}
|
|
|
|
func (*LargePointerCapability) Type() CapsType {
|
|
return CAPSETTYPE_LARGE_POINTER
|
|
}
|
|
|
|
// see https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rdperp/36a25e21-25e1-4954-aae8-09aaf6715c79
|
|
type RemoteProgramsCapability struct {
|
|
RailSupportLevel uint32 `struc:"little"`
|
|
}
|
|
|
|
func (*RemoteProgramsCapability) Type() CapsType {
|
|
return CAPSTYPE_RAIL
|
|
}
|
|
|
|
// see https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rdperp/82ec7a69-f7e3-4294-830d-666178b35d15
|
|
type WindowListCapability struct {
|
|
WndSupportLevel uint32 `struc:"little"`
|
|
NumIconCaches uint8
|
|
NumIconCacheEntries uint16 `struc:"little"`
|
|
}
|
|
|
|
func (*WindowListCapability) Type() CapsType {
|
|
return CAPSTYPE_WINDOW
|
|
}
|
|
|
|
// see https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpbcgr/9132002f-f133-4a0f-ba2f-2dc48f1e7f93
|
|
type DesktopCompositionCapability struct {
|
|
CompDeskSupportLevel uint16 `struc:"little"`
|
|
}
|
|
|
|
func (*DesktopCompositionCapability) Type() CapsType {
|
|
return CAPSETTYPE_COMPDESK
|
|
}
|
|
|
|
// see https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpbcgr/aa953018-c0a8-4761-bb12-86586c2cd56a
|
|
type SurfaceCommandsCapability struct {
|
|
CmdFlags uint32 `struc:"little"`
|
|
Reserved uint32 `struc:"little"`
|
|
}
|
|
|
|
func (*SurfaceCommandsCapability) Type() CapsType {
|
|
return CAPSETTYPE_SURFACE_COMMANDS
|
|
}
|
|
|
|
type FrameAcknowledgeCapability struct {
|
|
FrameCount uint32 `struc:"little"`
|
|
}
|
|
|
|
func (*FrameAcknowledgeCapability) Type() CapsType {
|
|
return CAPSSETTYPE_FRAME_ACKNOWLEDGE
|
|
}
|
|
|
|
type DrawNineGridCapability struct {
|
|
SupportLevel uint32 `struc:"little"`
|
|
CacheSize uint16 `struc:"little"`
|
|
CacheEntries uint16 `struc:"little"`
|
|
}
|
|
|
|
func (*DrawNineGridCapability) Type() CapsType {
|
|
return CAPSTYPE_DRAWNINEGRIDCACHE
|
|
}
|
|
|
|
func readCapability(r io.Reader) (Capability, error) {
|
|
capType, err := core.ReadUint16LE(r)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
capLen, err := core.ReadUint16LE(r)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
if int(capLen)-4 <= 0 {
|
|
return nil, errors.New(fmt.Sprintf("Capability length expected %d", capLen))
|
|
}
|
|
|
|
capBytes, err := core.ReadBytes(int(capLen)-4, r)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
capReader := bytes.NewReader(capBytes)
|
|
var c Capability
|
|
glog.Debugf("Capability type 0x%04x", capType)
|
|
switch CapsType(capType) {
|
|
case CAPSTYPE_GENERAL:
|
|
c = &GeneralCapability{}
|
|
case CAPSTYPE_BITMAP:
|
|
c = &BitmapCapability{}
|
|
case CAPSTYPE_ORDER:
|
|
c = &OrderCapability{}
|
|
case CAPSTYPE_BITMAPCACHE:
|
|
c = &BitmapCacheCapability{}
|
|
case CAPSTYPE_POINTER:
|
|
c = &PointerCapability{}
|
|
case CAPSTYPE_INPUT:
|
|
c = &InputCapability{}
|
|
case CAPSTYPE_BRUSH:
|
|
c = &BrushCapability{}
|
|
case CAPSTYPE_GLYPHCACHE:
|
|
c = &GlyphCapability{}
|
|
case CAPSTYPE_OFFSCREENCACHE:
|
|
c = &OffscreenBitmapCacheCapability{}
|
|
case CAPSTYPE_VIRTUALCHANNEL:
|
|
c = &VirtualChannelCapability{}
|
|
case CAPSTYPE_SOUND:
|
|
c = &SoundCapability{}
|
|
case CAPSTYPE_CONTROL:
|
|
c = &ControlCapability{}
|
|
case CAPSTYPE_ACTIVATION:
|
|
c = &WindowActivationCapability{}
|
|
case CAPSTYPE_FONT:
|
|
c = &FontCapability{}
|
|
case CAPSTYPE_COLORCACHE:
|
|
c = &ColorCacheCapability{}
|
|
case CAPSTYPE_SHARE:
|
|
c = &ShareCapability{}
|
|
case CAPSETTYPE_MULTIFRAGMENTUPDATE:
|
|
c = &MultiFragmentUpdate{}
|
|
case CAPSTYPE_DRAWGDIPLUS:
|
|
c = &DrawGDIPlusCapability{}
|
|
case CAPSETTYPE_BITMAP_CODECS:
|
|
c = &BitmapCodecsCapability{}
|
|
case CAPSTYPE_BITMAPCACHE_HOSTSUPPORT:
|
|
c = &BitmapCacheHostSupportCapability{}
|
|
case CAPSETTYPE_LARGE_POINTER:
|
|
c = &LargePointerCapability{}
|
|
case CAPSTYPE_RAIL:
|
|
c = &RemoteProgramsCapability{}
|
|
case CAPSTYPE_WINDOW:
|
|
c = &WindowListCapability{}
|
|
case CAPSETTYPE_COMPDESK:
|
|
c = &DesktopCompositionCapability{}
|
|
case CAPSETTYPE_SURFACE_COMMANDS:
|
|
c = &SurfaceCommandsCapability{}
|
|
case CAPSSETTYPE_FRAME_ACKNOWLEDGE:
|
|
c = &FrameAcknowledgeCapability{}
|
|
default:
|
|
err := errors.New(fmt.Sprintf("unsupported Capability type 0x%04x", capType))
|
|
glog.Error(err)
|
|
return nil, err
|
|
}
|
|
if err := struc.Unpack(capReader, c); err != nil {
|
|
glog.Error("Capability unpack error", err, fmt.Sprintf("0x%04x", capType), hex.EncodeToString(capBytes))
|
|
return nil, err
|
|
}
|
|
glog.Debugf("Capability<%s>: %+v", c.Type(), c)
|
|
return c, nil
|
|
}
|