Click to See Complete Forum and Search --> : Cashe pasword


sahilkhan
June 13th, 2001, 05:32 AM
Can u tell api function for retriving windows cache passwords

Iouri
June 13th, 2001, 07:03 AM
'module


Declare Function WNetEnumCachedPasswords Lib "mpr.dll" (byval s as string, byval i as Integer, byval b as Byte, byval proc as Long, byval l as Long) as Long
Type PASSWORD_CACHE_ENTRY
cbEntry as Integer
cbResource as Integer
cbPassword as Integer
iEntry as Byte
nType as Byte
abResource(1 to 1024) as Byte
End Type

public Function callback(X as PASSWORD_CACHE_ENTRY, byval lSomething as Long) as Integer

Dim nLoop as Integer
Dim cString as string
Dim ccomputer
Dim Resource as string
Dim ResType as string
Dim Password as string
ResType = X.nType

for nLoop = 1 to X.cbResource

If X.abResource(nLoop) <> 0 then
cString = cString & Chr(X.abResource(nLoop))
else
cString = cString & " "
End If

next

Resource = cString
cString = ""

for nLoop = X.cbResource + 1 to (X.cbResource + X.cbPassword)

If X.abResource(nLoop) <> 0 then
cString = cString & Chr(X.abResource(nLoop))
else
cString = cString & " "
End If

next

Password = cString

cString = ""
'for only the dialup passwords activate next line
'If X.nType <> 6 then GoTo 66
Form1.List1.AddItem " R: " & Resource & " P: " & Password
66
callback = true
End Function

public Sub GetPasswords()

Dim nLoop as Integer
Dim cString as string
Dim lLong as Long
Dim bByte as Byte
bByte = &HFF
nLoop = 0
lLong = 0
cString = ""
Call WNetEnumCachedPasswords(cString, nLoop, bByte, AddressOf callback, lLong)
End Sub


'call from the form
form has Command1 button and List1

private Sub Command1_Click()
Call GetPasswords
End Sub




Iouri Boutchkine
iouri@hotsheet.com

sahilkhan
June 17th, 2001, 04:56 AM
Thank you very much for telling pssword retrival from cashe Its working fine for win95 annd 98but nor on NT :( Can U tell me Th Reson ?
Any wayy I have one Question for u If u dont mind from where u get all info about API well I was Trying o understand this code but useless i could nt understand but it is working fine for 95 and 98

Cimperiali
June 18th, 2001, 04:33 AM
...Under Iouri answer, or he will not be informed you post something for his reply. Simply go to Ioury answer, and post your post as a reply to it (up-left corner: a button with "reply to this message").

Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.

sahilkhan
June 19th, 2001, 01:39 AM
Thank you very much for telling pssword retrival from cashe Its working fine for win95 annd 98but nor on NT :( Can U tell me Th Reson ?
Any wayy I have one Question for u If u dont mind from where u get all info about API well I was Trying o understand this code but useless i could nt understand but it is working fine for 95 and 98