zer0
发表于 2013-7-5 16:42:39
强烈支持楼主ing……
xlax3013
发表于 2013-7-5 16:55:06
我喜欢强烈支持楼主ing……
欲望的轮回
发表于 2013-7-5 21:07:39
强烈支持楼主ing……
★远处的灯火
发表于 2013-7-5 22:31:22
我只是路过打酱油的。
key_nothing
发表于 2013-7-5 23:40:44
真是难得给力的帖子啊。
992300520
发表于 2013-7-6 00:19:38
真是难得给力的帖子啊。
Skyline
发表于 2013-7-6 00:21:27
强烈支持!!!!!!!!!
992300520
发表于 2013-7-6 00:44:37
楼主加油,鱼C加油!我们都看好你哦!
Kanon
发表于 2013-7-6 01:32:03
激动人心,无法言表!
duanhaitao
发表于 2013-7-6 10:40:13
真是难得给力的帖子啊。
偏爱。
发表于 2013-7-6 11:49:01
我是VIP,我骄傲!
潮籍霏凡
发表于 2013-7-6 12:03:35
楼主加油,鱼C加油!我们都看好你哦!
黑色飞马
发表于 2013-7-6 14:13:29
淡定,淡定,淡定……
玄冰磨剑
发表于 2013-7-6 23:36:57
给力,期待下一个教程。
汇编新手
发表于 2013-7-7 09:23:05
真是难得给力的帖子啊。
啊一
发表于 2013-7-8 20:07:42
能看看代码吗?
aa339410794
发表于 2013-7-11 00:54:34
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; by 小甲鱼, http://www.fishc.com
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; 功能:读取硬盘引导扇区并保存于boot.ini文件中
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.386
.model flat,stdcall
option casemap:none
include windows.inc
include comdlg32.inc
include user32.inc
include kernel32.inc
includelib comdlg32.lib
includelib user32.lib
includelib kernel32.lib
.data
szFileNamedb'\\.\\physicaldrive0', 0 ; 硬盘设备名
.data?
szBuffer db512 dup (?)
@hFile dd?
@dwBytesRead dd?
@szLogFile dbMAX_PATH dup (?)
.const
szNewFile db'boot.ini', 0
szErrOpenFile db'无法打开硬盘文件!', 0
szErrCreateFile db'无法创建boot.ini文件!', 0
szSuccess db'成功读取硬盘引导区并写入boot.ini文件!', 0
szCaption db'鱼C工作室', 0
.code
start:
invoke CreateFile, ; 打开或创建文件
addr szFileName, ; 文件的名字
GENERIC_READ, ; 允许读访问
FILE_SHARE_READ, ; 允许对文件进行共享访问
0, ; 指向一个SECURITY_ATTRIBUTES结构的指针
OPEN_EXISTING, ; 文件必须存在
FILE_ATTRIBUTE_NORMAL, ; 默认属性
0
.if eax == INVALID_HANDLE_VALUE ; 打开文件错误
invoke MessageBox,
NULL,
addr szErrOpenFile,
addr szCaption,
MB_OK
jmp exit
.endif
mov @hFile, eax ; 返回文件句柄,这时候硬盘被看成是一个文件的哦~
invoke ReadFile, ; 从文件中读取数据
@hFile, ; 文件句柄
addr szBuffer, ; 用于保存读入数据的缓冲区
sizeof szBuffer, ; 需要读入的字符数
addr @dwBytesRead, ; 实际读入的字节数
0
invoke CloseHandle, @hFile ; 小甲鱼温馨提醒:记得文件打开后要擦屁股->关闭文件,否则造成内存泄漏
invoke lstrcpy, ; 拷贝字符串
addr @szLogFile,
addr szNewFile
invoke CreateFile, ; 创建boot.ini文件
addr @szLogFile,
GENERIC_WRITE,
FILE_SHARE_READ,
0,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
0
.if eax != INVALID_HANDLE_VALUE
mov @hFile, eax
invoke WriteFile, ; 将数据写入boot.ini文件
@hFile,
addr szBuffer,
sizeof szBuffer,
addr @dwBytesRead,
0
invoke CloseHandle, @hFile; 擦屁股
invoke wsprintf, ; 这个事实上常用的函数,如果有问题的鱼油可以在论坛搜索下,有篇文章中小甲鱼已经做好了详细的解释给大家。
addr szBuffer,
addr szSuccess
invoke MessageBox,
NULL,
addr szBuffer,
addr szCaption,
MB_OK
.else
invoke MessageBox,
NULL,
addr szErrCreateFile,
addr szCaption,
MB_OK
.endif
exit:
invoke ExitProcess, NULL
end start
竹林小溪
发表于 2013-7-11 02:05:52
强烈支持楼主ing……好贵啊,就不买了
bigfatcat
发表于 2013-7-22 21:23:22
这个很早就有了吧?
大娱乐家_╮
发表于 2013-7-24 19:29:11
太生气了,无法HOLD啦