本人用WIN98DDK写了WIN98下在磁盘加密程序,要源码的请告知,有谁知道WinNT/2000下在磁盘加密程序(50分)

  • 主题发起人 主题发起人 boaosun
  • 开始时间 开始时间

[blue]TO:boaosun
兄弟,能给我一份源代码吗?

E-MAIL:dream40@etang.com[/blue]
 
请把源代码发给我一份:zhangwei5020@sohu.com。谢谢!
或者你也可以把它上传到:delphi.mychangshu.com
 
请把源代码也发一份给我吧:csh88888@21cn.com
 
这是用Win98DDK写的模拟DOS格式化磁盘和读写磁道缝隙的源代码,在DDK下编译通过!
使用磁盘扇区缝隙加密可对付KingCopy等强拷软件!
//=========================C++Builer调用Vxd代码==============================
char Format6[]={ 0x50,0x00,0x01,0x02,
0x50,0x00,0x02,0x02,
0x50,0x00,0x03,0x02,
0x50,0x00,0x04,0x02,
0x50,0x00,0x05,0x02,
0x50,0x00,0x06,0x02,
0x50,0x00,0x07,0x02,
0x50,0x00,0x08,0x02,
0x50,0x00,0x09,0x02,
0x50,0x00,0x0a,0x02,
0x50,0x00,0x0b,0x02,
0x50,0x00,0x0c,0x02,
0x50,0x00,0x0d,0x02,
0x50,0x00,0x0e,0x02,
0x50,0x00,0x0f,0x02,
0x50,0x00,0x10,0x02,
0x50,0x00,0x11,0x02,
0x50,0x00,0x12,0x03 };

void __fastcall TFormLock::SpbLockClick(TObject *Sender)
//功能:加密盘制作
{ int i,result;
HANDLE hDevice;
DWORD cb;
char *Buff0,*Buff1;
MYREGISTERS regs={100,100,100};

hDevice=CreateFile("////.//vxdint.vxd",0,0,0,CREATE_NEW,FILE_FLAG_DELETE_ON_CLOSE,0);
if(hDevice==INVALID_HANDLE_VALUE)
{ MessageBox(NULL,"Cannot open driver!","提示",MB_OK); return; }
Buff0=(char *)malloc(2048+1);
Buff1=(char *)malloc(2048+1);

//特殊格式化扇区
regs.reg_EBX=0x0212; //设置磁盘基数表
DeviceIoControl(hDevice,1,&regs,sizeof(regs),NULL,0,&cb,0);
for (i=0;i<3;i++) //格式化三次第50h磁道
{ regs.reg_EAX=0x0512;
regs.reg_EBX=(DWORD)Format6;
regs.reg_ECX=0x5001; //CH=磁道号 CL=起始扇号区
regs.reg_EDX=0; //DH=磁头号 DL=驱动器号
result=DeviceIoControl(hDevice,5,&regs,sizeof(regs),NULL,0,&cb,0);
result=result && !(regs.reg_Flags & 1);
if (result==true) break;
}

//读入特殊扇区
regs.reg_EBX=0x0312; //设置磁盘基数表
DeviceIoControl(hDevice,1,&regs,sizeof(regs),NULL,0,&cb,0);
memset(Buff0,'1',2048);
for (i=0;i<2;i++)
{ regs.reg_EAX=0x0201;
regs.reg_EBX=(DWORD)Buff0;
regs.reg_ECX=0x5012; //CH=磁道号 CL=起始扇号区
regs.reg_EDX=0; //DH=磁头号 DL=驱动器号
DeviceIoControl(hDevice,2,&regs,sizeof(regs),NULL,0,&cb,0);
}

//将特殊扇区内容写入第1扇区
regs.reg_EBX=0x0212; //设置磁盘基数表
DeviceIoControl(hDevice,1,&regs,sizeof(regs),NULL,0,&cb,0);
memset(Buff1,'/0',2048);
for (i=512;i<1024;i++) Buff1[i-512]=Buff0; //写磁盘缝隙信息
for (i=0;i<3;i++)
{ regs.reg_EAX=0x0302; //AH=0x03写扇区 AL=读取扇区总数
regs.reg_EBX=(DWORD)Buff1; //指定缓冲区
regs.reg_ECX=0x5001;
regs.reg_EDX=0;
regs.reg_ESI=0x0;
regs.reg_EDI=0x0;
if (CallIntX(VWIN32_DIOC_DOS_INT13,regs)==true) break;
}
//重新读入第1扇区
regs.reg_EBX=0x0212; //设置磁盘基数表
DeviceIoControl(hDevice,1,&regs,sizeof(regs),NULL,0,&cb,0);
memset(Buff1,'4',2048);
for (i=0;i<10;i++)
{ regs.reg_EAX=0x0201;
regs.reg_EBX=(DWORD)Buff1;
regs.reg_ECX=0x5001; //CH=磁道号 CL=起始扇号区
regs.reg_EDX=0; //DH=磁头号 DL=驱动器号
result=DeviceIoControl(hDevice,2,&regs,sizeof(regs),NULL,0,&cb,0);
result=result && !(regs.reg_Flags & 1);
if (result==true) break;
}

if (result==true && strncmp(Buff0+512,Buff1,0x120)==0)
ShowMessage("加密盘制作成功!");
else ShowMessage("加密盘制作失败!");

//设置磁盘基数表
regs.reg_EBX=0x0212;
DeviceIoControl(hDevice,1,&regs,sizeof(regs),NULL,0,&cb,0);
CloseHandle(hDevice);//关闭虚拟设备
free(Buff0); free(Buff1);
}


//=========================VxdInt.VXD驱动程序源代码========================
.386p
include vmm.inc
include vwin32.inc
include v86mmgr.inc

VxDName TEXTEQU <VXDINT>
ControlName TEXTEQU <VXDINT_Control>
VxDMajorVersion TEXTEQU <1>
VxDMinorVersion TEXTEQU <0>

VxD_STATIC_DATA_SEG
VxD_STATIC_DATA_ENDS

VXD_LOCKED_CODE_SEG
;----------------------------------------------------------------------------
; Remember: The name of the vxd MUST be uppercase else it won't work/unload
;----------------------------------------------------------------------------
DECLARE_VIRTUAL_DEVICE %VxDName,%VxDMajorVersion,%VxDMinorVersion, %ControlName,UNDEFINED_DEVICE_ID,UNDEFINED_INIT_ORDER

Begin_control_dispatch %VxDName
Control_Dispatch W32_DEVICEIOCONTROL, OnDeviceIoControl
End_control_dispatch %VxDName

VXD_LOCKED_CODE_ENDS

VXD_PAGEABLE_DATA_SEG
Buff db 1024 dup(10)
Handle dd ?
AllocSize dd ?
Buffer db 76 dup(10)
VXD_PAGEABLE_DATA_ENDS

VXD_PAGEABLE_CODE_SEG
BeginProc OnDeviceIoControl
assume esi:ptr DIOCParams
;修改磁盘基数表
.if [esi].dwIoControlCode==1
Push_Client_State
VMMCall Begin_Nest_V86_Exec
assume ebp:ptr Client_Word_Reg_Struc
mov [ebp].Client_ax,351eh
mov eax,21h
VMMCall Exec_Int

mov ebx,[ebp].Client_ebx
mov edi,[esi].lpvInBuffer
mov ah,[edi+1]
mov al,[edi]
mov es:[ebx+3],ah
mov es:[ebx+4],al

VMMCall End_Nest_Exec
Pop_Client_State
.endif
;读入磁盘扇区
.if [esi].dwIoControlCode==2
;-------------------------------
; Allocate V86 memory
;-------------------------------
VMMCall Get_Sys_VM_Handle
mov Handle,ebx
assume ebx:ptr cb_s
mov ebp,[ebx+CB_Client_Pointer]
mov ecx,sizeof Buff
stc
push esi
mov esi,OFFSET32 Buff
push es
pop fs
VxDCall V86MMGR_Allocate_Buffer
pop esi
jc Exit
mov AllocSize,ecx
;-------------------------------
; Control Int 13h
;-------------------------------
Push_Client_State
VMMCall Begin_Nest_V86_Exec
assume ebp:ptr Client_Byte_Reg_Struc
mov cx,3
Beg0: push cx
mov [ebp].Client_ah,00h
mov [ebp].Client_dl,00h
mov eax,13h
VMMCall Exec_Int

push edi
mov edi,[esi].lpvInBuffer
mov dx,[edi+4]
mov [ebp].Client_dx,dx
mov cx,[edi+8]
mov [ebp].Client_cx,cx
mov ax,[edi+12]
mov [ebp].Client_ax,ax

pop edi ;置es:bx
mov ebx,edi
mov [ebp].Client_bx,bx
shr ebx,16
mov [ebp].Client_es,bx
mov eax,13h
VMMCall Exec_Int

push edi
mov edi,[esi].lpvInBuffer ;返回标志位
mov ax,[ebp].Client_flags
mov [edi+24],ax
pop edi

pop cx
jnc End0
jz End0
dec cx
jnz Beg0
End0:
VMMCall End_Nest_Exec
Pop_Client_State
;-------------------------------
; free V86 memory
;-------------------------------
mov ecx,AllocSize
stc
mov ebx,Handle
push esi
mov esi,OFFSET32 Buff
push es
pop fs
VxDCall V86MMGR_Free_Buffer
pop esi
;-------------------------------
; Send data
;-------------------------------
mov edx,esi
assume edx:ptr DIOCParams
mov eax,[edx].lpvInBuffer
mov edi,[eax]
mov esi,OFFSET32 Buff
mov ecx,1024
rep movsb
.endif
;特殊格式化磁盘
.if [esi].dwIoControlCode==5
;-------------------------------
; Receive format info data
;-------------------------------
push esi
mov edx,esi
assume edx:ptr DIOCParams
mov edi,[edx].lpvInBuffer
mov esi,[edi]
mov edi,OFFSET32 Buffer
mov ecx,sizeof Buffer
rep movsb
pop esi
;-------------------------------
; Allocate V86 memory
;-------------------------------
VMMCall Get_Sys_VM_Handle
mov Handle,ebx
assume ebx:ptr cb_s
mov ebp,[ebx+CB_Client_Pointer]
mov ecx,sizeof Buffer
stc
push esi
mov esi,OFFSET32 Buffer
push es
pop fs
VxDCall V86MMGR_Allocate_Buffer
pop esi
jc Exit
mov AllocSize,ecx
;-------------------------------
; Control Int 13h
;-------------------------------
Push_Client_State
VMMCall Begin_Nest_V86_Exec
assume ebp:ptr Client_Byte_Reg_Struc
mov cx,3
Beg1: push cx
mov [ebp].Client_ah,00h
mov [ebp].Client_dl,00h
mov eax,13h
VMMCall Exec_Int

push edi
mov edi,[esi].lpvInBuffer
mov dx,[edi+4]
mov [ebp].Client_dx,dx
mov cx,[edi+8]
mov [ebp].Client_cx,cx
mov ax,[edi+12]
mov [ebp].Client_ax,ax

pop edi
mov ebx,edi
mov [ebp].Client_bx,bx
shr ebx,16
mov [ebp].Client_es,bx
mov eax,13h
VMMCall Exec_Int

push edi
mov edi,[esi].lpvInBuffer ;返回标志位
mov ax,[ebp].Client_flags
mov [edi+24],ax
pop edi

pop cx
jnc End1
jz End1
dec cx
jnz Beg1
End1:
VMMCall End_Nest_Exec
Pop_Client_State
;-------------------------------
; free V86 memory
;-------------------------------
mov ecx,AllocSize
stc
mov ebx,Handle
push esi
mov esi,OFFSET32 Buffer
push es
pop fs
VxDCall V86MMGR_Free_Buffer
pop esi
.endif
Exit:
xor eax,eax
ret
EndProc OnDeviceIoControl

VXD_PAGEABLE_CODE_ENDS
END


 
继续关注!
 
我做过Win2000/NT下磁盘加密程序,我把源码 EMail给你,收到后记得给分啊!
 
接受答案了.
 
to : wgc
能将Win2000/NT下磁盘加密程序源码,EMail给我一份吗?我急需。先谢了。

mailto:xhmeng@21cn.com
 

Similar threads

后退
顶部