Posto koristim Win98SE ne znam da li ovo radi na Win2000 ili WinXp.
Da li je iko voljan probati?
Evo kod :
'U modul:
Code:
Option Explicit
Public 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
'The Type declaration used by WNetEnumCachedPasswords
Type PASSWORD_CACHE_ENTRY
cbEntry As Integer 'size of this returned structure in bytes
cbResource As Integer 'size of the resource string, in bytes
cbPassword As Integer 'size of the password string, in bytes
iEntry As Byte 'entry position in PWL file
nType As Byte 'type of entry
abResource(1 To 1024) As Byte 'buffer to hold resource string, followed by password string
'should this be bigger?
End Type
'The main routines
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
'cString = "Type: " & X.nType
'1 = domains?
'4 = mail/mapi clients?
'6 = RAS entries?
'19 = iexplorer entries?
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 = cString & " Pwd: "
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 = ""
'Form1.List1.AddItem ResType
Form1.List1.AddItem " " & Resource & " PASSWORD: " & Password
callback = True
End Function
Option Explicit
Public 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
'The Type declaration used by WNetEnumCachedPasswords
Type PASSWORD_CACHE_ENTRY
cbEntry As Integer 'size of this returned structure in bytes
cbResource As Integer 'size of the resource string, in bytes
cbPassword As Integer 'size of the password string, in bytes
iEntry As Byte 'entry position in PWL file
nType As Byte 'type of entry
abResource(1 To 1024) As Byte 'buffer to hold resource string, followed by password string
'should this be bigger?
End Type
'The main routines
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
'cString = "Type: " & X.nType
'1 = domains?
'4 = mail/mapi clients?
'6 = RAS entries?
'19 = iexplorer entries?
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 = cString & " Pwd: "
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 = ""
'Form1.List1.AddItem ResType
Form1.List1.AddItem " " & Resource & " PASSWORD: " & Password
callback = True
End Function
'U formu (stavite kontrolu ListBox i command buton1 i ne mjenjajte im naziv):
Code:
Option Explicit
Public Sub GetPasswords()
Dim nLoop As Integer
Dim cString As String
Dim lLong As Long
Dim bByte As Byte
Dim test As String
bByte = &HFF
nLoop = 0
lLong = 0
cString = ""
test = WNetEnumCachedPasswords(cString, nLoop, bByte, AddressOf callback, lLong)
End Sub
Private Sub Command1_Click()
GetPasswords
End Sub
Option Explicit
Public Sub GetPasswords()
Dim nLoop As Integer
Dim cString As String
Dim lLong As Long
Dim bByte As Byte
Dim test As String
bByte = &HFF
nLoop = 0
lLong = 0
cString = ""
test = WNetEnumCachedPasswords(cString, nLoop, bByte, AddressOf callback, lLong)
End Sub
Private Sub Command1_Click()
GetPasswords
End Sub
'Sad bi trebali da dobijete rezultate u list box kontroli.
[Shadowed: ubaceni [code] tagovi.]
[Ovu poruku je menjao Shadowed dana 11.04.2005. u 22:38 GMT+1]