⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ftkernelapi.pas

📁 使用delphi语言
💻 PAS
📖 第 1 页 / 共 4 页
字号:
//////////////////////////////////////////////////////////////////////////
//打开Torrent文件获取信息的函数列表
//Torrent file interface

//判断是不是自己定义的加密的Torrent文件
//Return boolean, tell us is a cipher torrent file
function FTK_Torrent_IsCipherTorrent(lpszFileName: LPCTSTR): boolean; stdcall; external FTKernelAPI_Library;

//执行从文件中读取数据并初始化对象操作
//Open a torrent file handle
function FTK_Torrent_Open(lpszFileName: LPCTSTR; nCodePage: UINT = CP_ACP; lpszDesKey: LPCTSTR = nil; bValidEOF: Boolean = True; bValidSort: Boolean = True): HTorrentFile; stdcall; external FTKernelAPI_Library;

//执行从文件中读取数据并初始化对象操作, 如果失败, 返回错误信息
//Open a torrent file handle, if failed, return error information
function FTK_Torrent_SafeOpen(lpszFileName: LPCTSTR; nCodePage: UINT = CP_ACP; lpszDesKey: LPCTSTR = nil; bValidEOF: Boolean = True; bValidSort: Boolean = True; pErrInfo: PErrorInfo = nil): HTorrentFile; stdcall; external FTKernelAPI_Library;

//判断是不是自己定义的加密的Torrent数据流对象
//Return boolean, tell us is a cipher torrent binary data
function FTK_Torrent_IsCipherTorrentObj(pData: PByte; nLength: Integer): Boolean; stdcall; external FTKernelAPI_Library;

//执行从Torrent binary object中读取数据并初始化对象操作
//Open a torrent binary object
function FTK_Torrent_OpenObj(pData: PByte; nLength: Integer; nCodePage: UINT = CP_ACP; lpszDesKey: LPCTSTR = nil; bValidEOF: Boolean = True; bValidSort: Boolean = True; pErrInfo: PErrorInfo = nil): HTorrentFile; stdcall; external FTKernelAPI_Library;

//关闭当前打开的Torrent文件
//Close Torrent file handle
procedure FTK_Torrent_Close(hTorrentFile: HTorrentFile); stdcall; external FTKernelAPI_Library;

//判断是目录还是文件
//Return boolean, tell us is only a single file in torrent
function FTK_Torrent_IsFile(hTorrentFile: HTorrentFile): boolean; stdcall; external FTKernelAPI_Library;

//获取 Torrent 名称
//Get the name of torrent file
function FTK_Torrent_GetTorrentName(hTorrentFile: HTorrentFile): LPCTSTR; stdcall; external FTKernelAPI_Library;

//获取torrent中的文件的个数(至少一个)
//Get total number of files
function FTK_Torrent_GetFilesCount(hTorrentFile: HTorrentFile): Integer; stdcall; external FTKernelAPI_Library;

//获取torrent中的文件列表(至少一个)
//Get a pointer to file list
procedure FTK_Torrent_GetFiles(hTorrentFile: HTorrentFile; pFileInfo: ArrayFileInfo); stdcall; external FTKernelAPI_Library;

//获取torrent中的文件列表中的某个文件的信息
//Get a pointer to a file of file list
procedure FTK_Torrent_GetFileInfo(hTorrentFile: HTorrentFile; nIndex: Integer; pFileInfo: PFileInfoX); stdcall; external FTKernelAPI_Library;

//获取Info的Hash值, 内部使用
//Get the binary info hash of torrent file
function FTK_Torrent_GetInfoHash(hTorrentFile: HTorrentFile): PByte; stdcall; external FTKernelAPI_Library;

//获取info的Hash值, 十六进制
//Get the hex encoding info hash of torrent file
function FTK_Torrent_GetHexInfoHash(hTorrentFile: HTorrentFile): LPCTSTR; stdcall; external FTKernelAPI_Library;

//获取 main annouce url
//Get mainb announce url
function FTK_Torrent_GetMainAnnounce(hTorrentFile: HTorrentFile): LPCTSTR; stdcall; external FTKernelAPI_Library;

//获取 Announce 分组的个数
//Get the number of all announce list
function FTK_Torrent_GetAnnouncesCount(hTorrentFile: HTorrentFile): Integer; stdcall; external FTKernelAPI_Library;

//获取指定的 Announce 分组包含的Announce的个数
//Get the size of a announce list
function FTK_Torrent_GetAnnounceSize(hTorrentFile: HTorrentFile; nGroupIndex: Integer): Integer; stdcall; external FTKernelAPI_Library;

//获取指定的 Announce 分组中指定位置的Announce
//Get a annoucne of a announce list
function FTK_Torrent_GetAnnouncesVal(hTorrentFile: HTorrentFile; nGroupIndex: Integer; nIndex: Integer): LPCTSTR; stdcall; external FTKernelAPI_Library;

//获取 注释
//Get the comments
function FTK_Torrent_GetComments(hTorrentFile: HTorrentFile): LPCTSTR; stdcall; external FTKernelAPI_Library;

//获取 Torrent 创建时间
//Get the creation time of torrent file
function FTK_Torrent_GetCreateTime(hTorrentFile: HTorrentFile): TDateTime; stdcall; external FTKernelAPI_Library;

//获取piece块的大小
//Get the size of piece
function FTK_Torrent_GetPieceSize(hTorrentFile: HTorrentFile): DWord; stdcall; external FTKernelAPI_Library;

//获取文件的大小
//Get the total file size to transfer
function FTK_Torrent_GetFileSize(hTorrentFile: HTorrentFile): QWORD; stdcall; external FTKernelAPI_Library;

//Piece块的个数
//Get the total number of piece
function FTK_Torrent_GetPieceCount(hTorrentFile: HTorrentFile): DWord; stdcall; external FTKernelAPI_Library;

//获取Piece Hash 的列表
//Get a pointer to piece hash list
function FTK_Torrent_GetPieceHashList(hTorrentFile: HTorrentFile): PByte; stdcall; external FTKernelAPI_Library;

//释放PieceHash列表
//Release piece hash memory
procedure FTK_Torrent_FreePieceHashList(hTorrentFile: HTorrentFile); stdcall; external FTKernelAPI_Library;

//获取Torrent文件的语言编码
//Get language code page of torrent file
function FTK_Torrent_GetLanCodePage(hTorrentFile: HTorrentFile): UINT; stdcall; external FTKernelAPI_Library;

//////////////////////////////////////////////////////////////////////////
//制作Torrent文件的函数列表
//Create torrent file interface

//打开一个制作torrent文件的句柄
//Open a making torrent handle
function FTK_MT_Open(): HMakeTorrent; stdcall; external FTKernelAPI_Library;

//关闭打开的制作Torrent文件的句柄
//Close a making torrent handle
procedure FTK_MT_Close(hMakeTorrent: HMakeTorrent); stdcall; external FTKernelAPI_Library;

//执行生成对象的操作
//Start to making torrent file
function FTK_MT_MakeTorrent(hMakeTorrent: HMakeTorrent): boolean; stdcall; external FTKernelAPI_Library;

//停止Torrent文件制作
//Stop making torrent file
procedure FTK_MT_StopMake(hMakeTorrent: HMakeTorrent); stdcall; external FTKernelAPI_Library;

//获取制作文件的进度
//Get progress of making torrent file
function FTK_MT_GetMTProgress(hMakeTorrent: HMakeTorrent): Double; stdcall; external FTKernelAPI_Library;

//另存为Torrent文件
//Save as a torrent file
function FTK_MT_SaveAsTorrentFile(hMakeTorrent: HMakeTorrent; lpszFileName: LPCTSTR; lpszDesKey: LPCTSTR = nil): boolean; stdcall; external FTKernelAPI_Library;

//设置 annouce url
//Set a main announce url
procedure FTK_MT_SetAnnounceUrl(hMakeTorrent: HMakeTorrent; lpszValue: LPCTSTR); stdcall; external FTKernelAPI_Library;

//添加额外的Announce 列表
//Add a announce list
procedure FTK_MT_AddAnnounceList(hMakeTorrent: HMakeTorrent; Announces: array of LPCTSTR; nCount: Integer); stdcall; external FTKernelAPI_Library;

//添加额外的Announce 列表, example: announce1;announce2;announce3;
//Add a announce list, example: announce1;announce2;announce3;
procedure FTK_MT_AddAnnounceList2(hMakeTorrent: HMakeTorrent; lpszAnnounces: LPCTSTR); stdcall; external FTKernelAPI_Library;

//清空额外的Announce 列表
//Clear all announce list
procedure FTK_MT_ClearAnnounceList(hMakeTorrent: HMakeTorrent); stdcall; external FTKernelAPI_Library;

//设置 注释
//Set comments
procedure FTK_MT_SetComments(hMakeTorrent: HMakeTorrent; lpszValue: LPCTSTR); stdcall; external FTKernelAPI_Library;

//设置piece块的大小
//Set piece size to making torrent file
procedure FTK_MT_SetPieceSize(hMakeTorrent: HMakeTorrent; dwPieceSize: DWord); stdcall; external FTKernelAPI_Library;

//设置torrent中的文件
//Set the sourece file to making torrent file
procedure FTK_MT_SetFile(hMakeTorrent: HMakeTorrent; lpszFileName: LPCTSTR); stdcall; external FTKernelAPI_Library;

//设置torrent中的文件目录(多个文件)
//Set the source path to making torrent file
procedure FTK_MT_SetPath(hMakeTorrent: HMakeTorrent; lpszPathName: LPCTSTR); stdcall; external FTKernelAPI_Library;

//设置Torrent文件的语言代码(只对文件名称, 注释等有效)
//Set language code of torrent file
procedure FTK_MT_SetLangCodePage(hMakeTorrent: HMakeTorrent; nCodePage: UINT = CP_ACP); stdcall; external FTKernelAPI_Library;

//////////////////////////////////////////////////////////////////////////
//Disk cache Settings

//Set Disk cache size
//设置磁盘缓存的大小
procedure FTK_Disk_SetCache(nMinCacheSize: UINT; nMaxCacheSize: UINT; nPhyMemorySize: UINT); stdcall; external FTKernelAPI_Library;

//////////////////////////////////////////////////////////////////////////
//Windows environment related interfaces

//Get local machine ip address(get the first ip or best ip if there are more than one NICs)
//获取本机的IP地址(在有多个的情况下,选择第一个,或者按照一定算法选择最合适的一个)
function FTK_Win_GetLocalIP(bPrivateIP: PInteger): PChar; stdcall; external FTKernelAPI_Library;

//Open Windows ICS/ICF(Windows XP/Windows 2003)
//打开操作系统的网络连接防火墙和网络连接共享(Windows XP/Windows 2003)
function FTK_Win_OpenWinXPICSF(nPort: Short; bOpenFirewall: PInteger; bPortMapping: PInteger; nProtocol: Byte = WCXT_TCP_PORT; lpszIP: LPCTSTR = nil; lpszAppName: LPCTSTR = nil): Boolean; stdcall; external FTKernelAPI_Library;

//Open UPnP port mapping(Win9x/WinME/Win2000/WinXP/Win2003)
//执行对于支持UPnP协议的Router进行自动的端口映射配置(内网处于Router后的机器必用)
function FTK_Win_AddUPnPPortMapping(nPort: Short; nProtocol: Byte = WCXT_TCP_PORT; lpszIP: LPCTSTR = nil): Boolean; stdcall; external FTKernelAPI_Library;

//Patch Windows XP SP2 tcpip.sys file for best TCP/IP performance
//对于Windows XP SP2 的tcpip.sys打补丁,破解连接数的限制,提高网络性能
function FTK_Win_PacthSP2TCPIPLimitFile(nLimit: Integer = 10): Integer; stdcall; external FTKernelAPI_Library;

//////////////////////////////////////////////////////////////////////////
//流媒体相关的一些辅助函数
//MEDIA related functions

//获取ASF/WMV 编码的流媒体文件的'码率'
//Get ASF/WMV encoding file's Bitrate
function FTK_Media_GetAsfBitrate(lpszAsfFileName: LPCTSTR): Integer; stdcall; external FTKernelAPI_Library;

//获取RM/RMVB 编码的流媒体文件的'码率'
//Get RM/RMVB encoding file's Bitrate
function FTK_Media_GetRMBitrate(lpszRMFileName: LPCTSTR): Integer; stdcall; external FTKernelAPI_Library;

//////////////////////////////////////////////////////////////////////////

 //验证链接的合法性
 //Verify the 'ftk://****' link URL
function FTK_Link_Verify(lpszLinkURL: PChar): Boolean; stdcall; external FTKernelAPI_Library;

//生成下载的链接
//Get the 'ftk://****' link URL
function FTK_Link_GetLink(lpszHexHash: PChar; lpszFileName: PChar; qwFileSize: QWORD; dwPieceSize: DWORD; lpszOutURL: PChar; nOutLength: Integer): Boolean; stdcall; external FTKernelAPI_Library;

//生成下载的链接(从指定的Torrent文件中)
//Get the 'ftk://****' link URL by TORRENT file
function FTK_Link_GetLink2(lpszTorrentFileName: PChar; lpszOutURL: PChar; nOutLength: Integer; lpszDesKey: PChar; nCodePage: UINT = CP_ACP; bValidEof: Boolean = TRUE; bValidSort: Boolean = TRUE): Boolean; stdcall; external FTKernelAPI_Library;

//从链接中获取制定的信息
//Get information item from LINK URL
function FTK_Link_ParseLink(lpszLinkURL: PChar; lpszOutHexHash: PChar; lpszOutFileName: PChar; var qwFileSize: QWORD; var dwPieceSize: DWORD): Boolean; stdcall; external FTKernelAPI_Library;

//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//内网穿透相关的API接口
//APIs of NAT's UDP tunnel

//预先设置是否需要输出日志,以及输出日志的级别( -1, 不输出日志 )
//Pre-initialize to set whether to write logfile( -1, not output logfile )
procedure FTK_UDPT_PreInitLog(nLogLevel: Integer = -1); stdcall; external FTKernelAPI_Library;

//预先设置远程呼叫的回掉函数
//Pre-initialize remote call callback function
procedure FTK_UDPT_PreInitPeerCallCB(pfn: FTK_UPDT_PEERCALL_CALLBACK); stdcall; external FTKernelAPI_Library;

//初始化UDP穿透的环境(返回FALSE表示失败), 动态加载穿透需要的辅助动态库
//Initialize UDP tunnel context( return false, if failed)
function FTK_UDPT_Init(lpszFTKUDPxAPIDllFile: PChar; lpszFTKTCPxAPIDllFile: PChar; pTCPHostIP: PChar; nTCPHostPort: Short): Boolean; stdcall; external FTKernelAPI_Library;

//释放UDP穿透的环境
//Release UDP tunnel context
procedure FTK_UDPT_Release(); stdcall; external FTKernelAPI_Library;

//设置穿透服务器的地址和端口
//Set tunnel server ip and port
procedure FTK_UDPT_SetTunnelInfo(lpszTunnelIP: PChar; nTunnelPort: Short); stdcall; external FTKernelAPI_Library;

//连接登陆服务器
//Build conntection to LOGIN server
function FTK_UDPT_Connect(lpszLoginIP: PChar; nLoginPort: Short): Boolean; stdcall; external FTKernelAPI_Library;

//与登陆服务器断开连接
//Disconnect to LOGIN server
procedure FTK_UDPT_Disconnect(); stdcall; external FTKernelAPI_Library;

//是否登陆成功
//LOGIN is OK?
function FTK_UDPT_IsLoginOK(): Boolean; stdcall; external FTKernelAPI_Library;

//获取自己本机的IP地址
//Get the IP address of myself
function FTK_UDPT_GetRealIP(): PChar; stdcall; external FTKernelAPI_Library;

//获取自己的NAT类型
//Get the type of NAT
function FTK_UDPT_GetNatType(): Integer; stdcall; external FTKernelAPI_Library;

//获取当前UDP登陆服务器总的在线人数
//Get the total online user count
function FTK_UDPT_GetUserCount(): Integer; stdcall; external FTKernelAPI_Library;

//驱动内网穿透工作的事件函数(一般在主程序中的计时器中驱动)
//UDP tunnel context event driver
procedure FTK_UDPT_DoEvents(); stdcall; external FTKernelAPI_Library;

//呼叫远程的内网用户
//Call remote USER
procedure FTK_UDPT_RemoteCallPeer(pUserID: PByte; pInfoHash: PByte); stdcall; external FTKernelAPI_Library;

//////////////////////////////////////////////////////////////////////////


implementation

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -