im trying to figure out how to change this code from vb to asm... i run into a problem when i try to call the addr function , the dll loads no problem


"EOptions String"="6YiKVQXOg5M.hfINNdY-"
"Yahoo! User ID"="xillwillx"

declare "ycrwin32.dll" as YCRYPTO
text1.text is the username/yahoo id
text2.text will be the eoptions/encrypted password

Public Sub Grab(RegistryKey As String, RegistryInformation As String, Grab As Integer)
Dim WSHShell, RegTemp
Set WSHShell = CreateObject("WScript.Shell")
If Grab = 1 Then
RegTemp = WSHShell.RegRead(RegistryKey)
Text1.Text = RegTemp
End If
End Sub

Public Sub Grab1(RegistryKey As String, RegistryInformation As String, Grab1 As Integer)
Dim WSHShell, RegTemp
Set WSHShell = CreateObject("WScript.Shell")
If Grab1 = 1 Then
RegTemp = WSHShell.RegRead(RegistryKey)
Text2.Text = RegTemp
End If
End Sub

Private Sub Command2_Click()
Dim ycc As New YCrypto
Call ycc.Init(1, 1, Text1.Text)
Text3.Text = ycc.Decrypt(Text2.Text)
End Sub
Private Sub Command1_Click()
On Error GoTo error
Call Grab("HKEY_CURRENT_USER\Software\Yahoo\pager\Yahoo! User ID")
Posted on 2003-12-05 16:56:51 by illwill
this is the two ways i tried to do it



.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
include \masm32\include\masm32.inc
includelib \masm32\lib\masm32.lib
.data
TheDLL db "C:\Program Files\Yahoo!\Messenger\ycrwin32.dll",0
TheFunction db "Init",0
UserName db "xillwillx",0
EncPass db "6YiKVQXOg5M.hfINNdY-",0
.data?
TheFuncAddr dd ? ; the address of the TheFunction
hLib dd ?
PasswordSend byte 255 dup (?)
.code
start:
push OFFSET TheDLL
call LoadLibrary ;/// Load the dll into our process
push OFFSET TheFunction
push eax
call GetProcAddress ;/// Get address of init function
push 1
push 1
push OFFSET TheFuncAddr
push OFFSET UserName ;/// Encrypted pass from registry
push OFFSET EncPass ;/// user from registry
call eax ;/// Call init function (returned from GetProcAddress)
invoke lstrcat, addr PasswordSend,eax ;add password to to the passwordsend buffer
invoke MessageBox,0,addr TheFunction,PasswordSend,0
invoke ExitProcess,0
end start
------------------------------------------------------------------------------------------------------------
or

.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
include \masm32\include\masm32.inc
includelib \masm32\lib\masm32.lib
.data
TheDLL BYTE "C:\Program Files\Yahoo!\Messenger\ycrwin32.dll",0
TheFunction BYTE "Init",0
UserName BYTE "xillwillx",0
EncPass BYTE "6YiKVQXOg5M.hfINNdY-",0
.data?
TheFuncAddr dd ? ; the address of the TheFunction
hLib dd ?
PasswordSend byte 255 dup (?)
.code
start:
invoke LoadLibrary,offset TheDLL ;/// Load the DLL(ycrwin32.dll) into our process
.if eax==NULL
invoke MessageBox,0,addr TheDLL,0,0 ; error if we cant load the dll
.else
mov hLib,eax ; pointer to the dll
invoke GetProcAddress,hLib,addr TheFunction ;/// push the function 'Init'
.if eax==NULL
invoke MessageBox,0,addr TheFunction,0,0 ; the function failed ****heres the problem
.else
mov TheFuncAddr,eax
push 1
push 1
push OFFSET UserName
call [TheFuncAddr]
invoke MessageBox,0,addr TheFunction,eax,0
.endif
invoke FreeLibrary,hLib
.endif
invoke ExitProcess,0
end start
Posted on 2003-12-05 16:58:06 by illwill
im not sure if its like an active x dll and you have to use COM to call its function
Posted on 2003-12-05 20:55:51 by illwill
Hi,

this sample create a WSH object just to read some registry data.
In ASM you can call registry functions directly :) . Use RegOpenKey, RegQueryValue,...
Posted on 2003-12-06 01:31:35 by japheth
yea i know the registry part of it ... im trying to use the info i get and push it to the dll like the vb code does

this is easy to get reg info


.data
szKey db "Software\Yahoo\pager\",0
szValue db "Yahoo! User ID",0
szValue1 db "EOptions String",0
KeySize DWORD 255
KeySize1 DWORD 255

.data?
hReg dd ?
szKeyData db 256 dup(?)
szKeyData1 db 256 dup(?)
.code
start:
invoke RegOpenKeyEx, HKEY_CURRENT_USER,addr szKey,0,KEY_READ,addr hReg
invoke RegQueryValueEx,hReg,addr szValue,0,0,addr szKeyData, addr KeySize ;the username is in szKeyData
invoke RegQueryValueEx,hReg,addr szValue1,0,0,addr szKeyData1, addr KeySize1 ;the password is in szKeyData
invoke RegCloseKey , hReg
invoke MessageBox,0,addr szKeyData1,addr szKeyData,0
invoke ExitProcess,0
end start
Posted on 2003-12-06 09:24:16 by illwill
Just took a quick look at the DLL using exescope, it's not really a dll per se, it's a COM object as alluded to in a previous post. If you take a look at the export table for this so called dll, you will be able to confirm this yourself.
Posted on 2003-12-06 21:48:19 by Homer
ahh evilhomer just the person i was waiting for to reply :alright:
i know ernie or someone show how to use com in asm.. is it worthwhile to persue it for this app or is it gonna be a real pain in the balls to get it working?
Posted on 2003-12-07 00:04:27 by illwill
still trying to figure this out

i seen a program called COMView which generated



;--- Generated .INC file by COMView
;--- typelib name=YCRWIN32Lib
;--- documentation=YCRWin32 1.0 Type Library
;--- GUID={390CE9E4-C4A0-11D4-8A92-0090271D4F88}
;--- Version 1.0, LCID 0

;--- prototypes too complex for MASM may exist
;--- if such ones reside in a vtable they will be replaced by dummies
;--- search for occurances of ';+++' to have a closer look at these

sTLBID_YCRWIN32Lib textequ <GUID {0390CE9E4h,0C4A0h,011D4h,{08Ah,092h,000h,090h,027h,01Dh,04Fh,088h}}>
_MajorVer_YCRWIN32Lib equ 1
_MinorVer_YCRWIN32Lib equ 0

;--- IYCrypto, Type=INTERFACE, GUID={390CE9F1-C4A0-11D4-8A92-0090271D4F88}

ifndef IYCryptoVtbl
BEGIN_INTERFACE IYCrypto, IUnknown
STDMETHOD Init , :SDWORD,:SDWORD,:BSTR
STDMETHOD Encrypt , :BSTR,:ptr BSTR
STDMETHOD Decrypt , :BSTR,:ptr BSTR
STDMETHOD Encrypt_MD5 , :BSTR,:ptr BSTR
END_INTERFACE
endif

sIID_IYCrypto textequ <IID {0390CE9F1h,0C4A0h,011D4h,{08Ah,092h,000h,090h,027h,01Dh,04Fh,088h}}>

;--- YCrypto, Type=COCLASS, GUID={390CE9F2-C4A0-11D4-8A92-0090271D4F88}

sCLSID_YCrypto textequ <GUID {0390CE9F2h,0C4A0h,011D4h,{08Ah,092h,000h,090h,027h,01Dh,04Fh,088h}}>

;--- end of type library ---



how an i use this to call the INIT function from the DLL .. ive been trying this for a month and still cant figure ouyt .. i was using a vb.dll i made to do this automatically but i want this to be pure assembly and not some VB dll added as a resource... can anyone help?:stupid:
Posted on 2004-01-13 19:46:20 by illwill
heres the dll file
Posted on 2004-01-13 19:57:02 by illwill