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

📄 ufstool.asm

📁 这可是一个重量级工具
💻 ASM
📖 第 1 页 / 共 5 页
字号:
				mov	dword ptr [edi+4],0D20254h
				invoke	WriteThenRead,7,1,20,1
				lea	esi,FTInBuf
				movzx	eax,byte ptr [esi]
				cmp	al,3Eh
				jz		@F
				lea	edi,FTOutBuf
				mov	byte ptr [edi],54h
				invoke	WriteThenRead,1,3,10,1
				lea	esi,FTInBuf
				xor	eax,eax
				mov	ah,[esi]
				mov	al,[esi+1]
				invoke	CalcActCode,eax,eax,FreiaActSeed,13,addr FTInBuf,0
				lea	esi,dword_40D8DC
				lea	edi,FTOutBuf
				mov	dword ptr [edi],80DA54Eh
				add	edi,4
				mov	ecx,8
				mov	i,0BAh
				.Repeat
					movzx	eax,byte ptr [esi]
					add	i,eax
					mov	[edi],al
					inc	esi
					inc	edi
					dec	ecx
				.Until (ecx == 0)
				xor	eax,eax
				sub	eax,i
				mov	[edi],al
				invoke	WriteThenRead,13,1,20,1
				lea	edi,FTOutBuf
				mov	dword ptr [edi],1F1D1D4Ch
				mov	dword ptr [edi+4],980D02h
				invoke	WriteThenRead,7,1,20,1
				lea	esi,FTInBuf
				movzx	eax,byte ptr [esi]
				cmp	al,3Eh
				jnz	Connected
			@@:
				mov	dword ptr [edi],787F31h
				invoke	WriteThenRead,3,10,100,1
				lea	edi,FTOutBuf
				invoke	FT_GetModemStatus,ftHandle,edi	
				or	eax,eax
				jnz	Connected
				mov	eax,[edi]
				and	eax,80h
				.if (eax != 80h)
					lea	edi,FTOutBuf
					mov	byte ptr [edi],58h
					invoke	WriteThenRead,1,10,100,0
					jmp	Connected
				.endif
				invoke	SendDlgItemMessage,hWindow,IDC_LST_Info,LB_ADDSTRING,NULL,addr szHwkFound
				mov	byte ptr [edi],58h
				invoke	WriteThenRead,1,2,50h,0	
				lea	edi,FTOutBuf
				mov	byte ptr [edi],36h
				invoke	WriteThenRead,1,1,200h,0
				dec	eax
				jnz	Connected
				lea	esi,FTInBuf
				cmp	byte ptr [esi],54h
				jnz	Connected
				mov	byte ptr [edi],30h
				invoke	WriteThenRead,1,1,10,0
				dec	eax
				jnz	Connected
				lea	esi,FTInBuf
				cmp	byte ptr [esi],54h
				jnz	Connected
				mov	byte ptr [edi],32h
				invoke	WriteThenRead,1,1,200h,0
				dec	eax
				jnz	Connected
				lea	esi,FTInBuf
				cmp	byte ptr [esi],0A5h
				jnz	Connected
				mov	dword ptr [edi],1010336h
				invoke	WriteThenRead,4,5,300h,0
				cmp	eax,5
				jnz	Connected
				lea	esi,FTInBuf
				cmp	byte ptr [esi],54h
				jnz	Connected
				cmp	byte ptr [esi+3],0A5h
				jnz	Connected
				cmp	byte ptr [esi+4],54h
				jnz	Connected
				movzx	eax,word ptr [esi+1]
				mov	HWK_Number ,eax
				mov	dword ptr [edi],2031136h
				mov	word ptr [edi+4],1000h
				invoke	WriteThenRead,6,19,500h,0
				cmp	eax,13h
				jnz	Connected
				lea	esi,FTInBuf
				cmp	byte ptr [esi],54h
				jnz	Connected
				cmp	byte ptr [esi+11h],0A5h
				jnz	Connected
				cmp	byte ptr [esi+12h],54h
				jnz	Connected
				lea	esi,FTInBuf
				inc	esi
				lea	edi,HID 
				mov	ecx,10h
				cld
				rep movsb
				lea	edi,FTOutBuf
				mov	byte ptr [edi],31h
				invoke	WriteThenRead,1,1,10,0
				lea	esi,FTInBuf
				mov	byte ptr [edi],39h
				invoke	WriteThenRead,1,10,100,0
				mov	byte ptr [edi],58h
				invoke	WriteThenRead,1,1,20,0
				lea	esi,HID 
				mov	edx,[esi+0Ch]
				bswap	edx
				mov	ecx,[esi+8]
				bswap	ecx
				mov	ebx,[esi+4]
				bswap	ebx
				mov	eax,[esi]
				bswap	eax
				invoke	wsprintf,addr TempString ,addr szHid,eax,ebx,ecx,edx
				invoke	SendDlgItemMessage,hWindow,IDC_LST_Info,LB_ADDSTRING,NULL,addr TempString 
				invoke	wsprintf,addr TempString ,addr szHwk,HWK_Number 
				invoke	SendDlgItemMessage,hWindow,IDC_LST_Info,LB_ADDSTRING,NULL,addr TempString 
			Connected:
				invoke	SetDlgItemText,hWindow,IDC_BTN_Connect,addr szDisconnect
			.endif
		.elseif (eax == IDC_BTN_Backup)
			mov	eax,ftHandle
			or		eax,eax
			jz		@F
			invoke MessageBox,hWindow,addr szReadFirmware,addr AppName,MB_ICONINFORMATION or MB_OK
		@@:	
		.elseif (eax == IDC_BTN_Restore)
			mov	RestoreOrFix,0
			mov	eax,ftHandle
			.if (eax)
				mov	OFNA.lStructSize,SIZEOF OPENFILENAMEA
				push	hWindow
				pop	OFNA.hwndOwner
				push	hInstance
				pop	OFNA.hInstance
				mov	OFNA.lpstrFilter,offset szBinFiles
				mov	OFNA.nFilterIndex,0
				mov	OFNA.lpstrFile,offset FileName
				mov	OFNA.lpstrDefExt,offset szBinFileExt
				mov	OFNA.nMaxFile,104h
				mov	OFNA.Flags,OFN_LONGNAMES or OFN_EXPLORER or OFN_FILEMUSTEXIST or OFN_PATHMUSTEXIST or OFN_HIDEREADONLY
				invoke	GetOpenFileName,addr OFNA
				.if eax == 1
					invoke	CreateFile,addr FileName,GENERIC_READ,FILE_SHARE_READ or FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_ARCHIVE,NULL
					.if eax != -1
						mov	hFile,eax
						xor	eax,eax
						mov	ecx,2000h
						mov	edi,offset FirmWareBuffer
						rep 	stosb
						mov	ecx,80h
						mov	edi,offset EE93c46Buffer
						rep 	stosb
						dec	eax
						mov	ecx,200h
						mov	edi,offset EEPROMBuffer
						rep 	stosb
						invoke	ReadFile,hFile,addr FirmWareBuffer,2280h,addr NumberOfBytesRead,NULL
						invoke	CloseHandle,hFile
						invoke	DialogBoxParam,hInstance,addr ProgressDlg,hWindow,addr ProgressDlgFunc,addr FlashingFunc
						.if eax == 1
							invoke	SendDlgItemMessage,hWindow,IDC_LST_Info,LB_ADDSTRING,NULL,addr szUpdateSuccesfull
							invoke	SendDlgItemMessage,hWindow,IDC_LST_Info,LB_ADDSTRING,NULL,addr szChangSNWarning
							invoke	SendDlgItemMessage,hWindow,IDC_LST_Info,LB_ADDSTRING,NULL,addr szPressRefresh
							jmp	Init
						.else
							invoke	SendDlgItemMessage,hWindow,IDC_LST_Info,LB_ADDSTRING,NULL,addr szUpdateFail
						.endif
					.else
						invoke	MessageBox,hWindow,addr szErrOpenFile,szError,MB_ICONERROR or MB_OK
					.endif
				.endif
			.endif
		.elseif (eax == IDC_BTN_Fix)	;3F4h
			pusha
			mov	RestoreOrFix,1
			mov	eax,ftHandle
			.if (eax)
				invoke	SendDlgItemMessage,hWindow,IDC_CBO_Firmware,CB_GETCURSEL,NULL,NULL 
				.if (!eax)
					mov	dword ptr dword_40D51B,0E637DD09h
					lea	esi,FirmWare2_5Data
				.else
					mov	dword ptr dword_40D51B,0B16C8E48h
					lea	esi,FirmWare2_6Data	
				.endif
				lea	edi,FirmWareBuffer
				mov	ecx,2280h
				cld
				rep 	movsb
				invoke	GetDlgItemText,hWindow,IDC_EDT_SN,addr TempString ,1Eh 
				invoke	lstrlen,addr TempString 
				cmp	eax,8
				jb		@F
				lea	edi,TempString 
				mov	dword ptr [edi+7],0
			@@:
				lea	eax,TempString 
				call 	Str2Int 
				and	eax,7FFFFFh
				mov	Box_SN,eax
				mov	ecx,0FDE8h
				cdq
				idiv	ecx
				mov	SN_Extension,eax
				mov	EEProm_SN,edx
				invoke	wsprintf,addr FTDeviceStrSN,szFmt1,Box_SN
				invoke	SetDlgItemText,hWindow,IDC_EDT_SN,addr FTDeviceStrSN 
				invoke	CheckBoxType,Box_SN
				cmp	eax,-1
				jnz	@F
				invoke	MessageBox,hWindow,addr szBlackListSN2,szWarning,MB_ICONWARNING or MB_OKCANCEL
				.if (eax != IDCANCEL)
				@@:
					mov	[edi+6],ax
					shr	eax,10h
					mov	[edi+8],al
					invoke	GetTickCount
					xor	al,ah
					and	al,7Fh
					mov	[edi+16h],al
					mov	byte ptr [edi+15h],3Eh
					lea	edi,SHABuffer1
					mov	dword ptr [edi],1A992E25h
					xor	[edi],ebx
					mov	dword ptr [edi+4],0AA761E09h
					mov	eax,EEProm_SN
					mov	[edi+8],eax
					mov	eax,Box_SN
					shr	eax,10h
					mov	[edi+0Ah],al
					mov	byte ptr [edi+0Bh],0C6h
					mov	ebx,FuseBits
					or		ebx,ebx
					jnz	@F
					mov	ebx,0C82ECCh
				@@:
					mov	[edi+0Ch],ebx
					mov	byte ptr [edi+0Fh],5Ah
					mov	byte ptr [edi+10h],62h
					mov	byte ptr [edi+11h],0CFh
					mov	eax,EEProm_SN
					mov	[edi+12h],ah
					mov	[edi+13h],al
					lea	esi,SHABuffer2
					mov	eax,EEProm_SN
					mov	[esi+8],ah
					mov	[esi+9],al
					mov	byte ptr [esi+0Bh],0A5h
					mov	eax,[edi]
					mov	[esi],eax
					mov	eax,[edi+8]
					mov	[esi+4],eax
					call	GetTickCount
					xor	al,ah
					and	al,7Fh
					mov	[esi+0Ah],al
					lea	eax,SHABuffer2
					push	eax
					push	0Ch
					add	eax,0Ch
					push	eax
					call	SHA1_EnCode
					lea	esi,SHABuffer2
					lea	edi,FTInBuf
					mov	ecx,20h
					cld
					rep 	movsb
					lea	esi,byte_40805F
					lea	edi,FTInBuf
					movzx	ebx,byte ptr [edi+0Ah]
					add	esi,ebx
					xor	ecx,ecx
				@@:
					mov	al,[ecx+esi]
					xor	[ecx+edi],al
					inc	ecx
					cmp	ecx,20h
					jb		@B
					mov	[edi+0Ah],bl
					lea	edi,EEPROMBuffer
					mov	eax,EEProm_SN
					mov	[edi+2],ah
					mov	[edi+3],al
					mov	eax,SN_Extension
					mov	[edi+148h],ah
					mov	[edi+149h],al
					add	edi,1E0h
					xor	ecx,ecx
				@@:
					lea	esi,byte_40819F
					movzx	ebx,byte ptr [ecx+esi]
					lea	esi,FTInBuf
					add	esi,ebx
					mov	al,[esi]
					mov	[ecx+edi],al
					inc	ecx
					cmp	ecx,20h
					jb		@B
					lea	eax,SHABuffer1
					push	eax
					push	14h
					add	eax,14h
					push	eax
					call	SHA1_EnCode
					lea	eax,SHABuffer1
					push	eax
					push	28h
					add	eax,28h
					push	eax
					call	SHA2_EnCode
					mov	ecx,14h
					lea	esi,SHABuffer1
					add	esi,28h
					lea	edi,EEPROMBuffer
					add	edi,1C0h
					cld
					rep 	movsb
					mov	ecx,0Ch
					lea	esi,SHABuffer1
					add	esi,14h
					lea	edi,EEPROMBuffer
					add	edi,1D4h
					cld
					rep 	movsb
					lea	eax,dword_40D504
					push	eax
					push	2Ch
					add	eax,2Ch
					push	eax
					call	SHA2_EnCode
					lea	esi,dword_40D504
					lea	edi,FTInBuf
					mov	ecx,40h
					cld
					rep 	movsb
					lea	esi,byte_40805F
					lea	edi,FTInBuf
					movzx	ebx,byte ptr [edi+16h]
					add	esi,ebx
					xor	ecx,ecx
				@@:
					mov	al,[ecx+esi]
					xor	[ecx+edi],al
					inc	ecx
					cmp	ecx,40h
					jb		@B
					mov	[edi+16h],bl
					lea	edi,FirmWareBuffer
					add	edi,17C0h
					xor	ecx,ecx
				@@:
					lea	esi,byte_40815F
					movzx	ebx,byte ptr [ecx+esi]
					lea	esi,FTInBuf
					add	esi,ebx
					mov	al,[esi]
					mov	[ecx+edi],al
					inc	ecx
					cmp	ecx,40h
					jb		@B
					invoke	CalcActCode,Box_SN,Box_SN,NokiaActSeed,5,addr FTInBuf,1
					lea	esi,dword_40D8DC
					lea	edi,EEPROMBuffer+38h
					mov	ecx,8
					cld
					rep movsb
					invoke	CalcActCode,Box_SN,Box_SN,EricssonActSeed,1,addr FTInBuf,1
					lea	esi,dword_40D8DC
					lea	edi,EEPROMBuffer+18h
					mov	ecx,8
					cld
					rep movsb
					invoke	CalcActCode,Box_SN,Box_SN,SamsungActSeed,12,addr FTInBuf,1
					lea	esi,dword_40D8DC
					lea	edi,EEPROMBuffer+70h
					mov	ecx,8
					cld
					rep movsb
					invoke	CalcActCode,Box_SN,Box_SN,FreiaActSeed,13,addr FTInBuf,0
					lea	esi,dword_40D8DC
					lea	edi,EEPROMBuffer+78h
					mov	ecx,8
					cld
					rep movsb
					invoke	CalcActCode,Box_SN,Box_SN,MotorolaActSeed,6,addr FTInBuf,1
					lea	esi,dword_40D8DC
					lea	edi,EEPROMBuffer+40h
					mov	ecx,8
					cld
					rep movsb
					lea	eax,EEPROMBuffer
					invoke	DialogBoxParam,hInstance,addr ProgressDlg,hWindow,addr ProgressDlgFunc,addr FlashingFunc
					.if eax == 1
						invoke	SendDlgItemMessage,hWindow,IDC_LST_Info,LB_ADDSTRING,NULL,addr szUpdateSuccesfull
						invoke	SendDlgItemMessage,hWindow,IDC_LST_Info,LB_ADDSTRING,NULL,addr szChangSNWarning
						invoke	SendDlgItemMessage,hWindow,IDC_LST_Info,LB_ADDSTRING,NULL,addr szPressRefresh
						jmp	Init

⌨️ 快捷键说明

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