elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Introducción a la Factorización De Semiprimos (RSA)


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  Listar los recursos compartidos de un equipo remoto!!
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] 2 Ir Abajo Respuesta Imprimir
Autor Tema: Listar los recursos compartidos de un equipo remoto!!  (Leído 7,711 veces)
Hole_System

Desconectado Desconectado

Mensajes: 239


Ver Perfil
Listar los recursos compartidos de un equipo remoto!!
« en: 18 Enero 2009, 22:32 pm »

Como puedo establecieno una session nula enumerar los recursos compartidos del mismo....

Slu2


En línea

By Pitoniso.
Karcrack


Desconectado Desconectado

Mensajes: 2.416


Se siente observado ¬¬'


Ver Perfil
Re: Listar los recursos compartidos de un equipo remoto!!
« Respuesta #1 en: 18 Enero 2009, 23:54 pm »

Estas hablando de NetBios verdad?

Este ejemplo no es del todo funcional, pero creo que te ayudara a orientarte >:D:
Código:
http://foro.elhacker.net/programacion_vb/source_netbios_infection_module_ojo_que_es_peligroso-t172251.0.html

Podrias usar APIs, pero para empezar esta bien que te ayudes con el Shell ;D

Saludos :)


En línea

Hole_System

Desconectado Desconectado

Mensajes: 239


Ver Perfil
Re: Listar los recursos compartidos de un equipo remoto!!
« Respuesta #2 en: 20 Enero 2009, 00:01 am »

Estas hablando de NetBios verdad?

Este ejemplo no es del todo funcional, pero creo que te ayudara a orientarte >:D:
Código:
http://foro.elhacker.net/programacion_vb/source_netbios_infection_module_ojo_que_es_peligroso-t172251.0.html

Podrias usar APIs, pero para empezar esta bien que te ayudes con el Shell ;D

Saludos :)

El problema es que este codigo no me dice cuales son los recursos compartido del equipo remoto, el trae el codigo implicito para copiarlo en C$...

Thx

Con el Net View se que se puede hacer pero quisiera saber como hacerlo con APIS!!
En línea

By Pitoniso.
Karcrack


Desconectado Desconectado

Mensajes: 2.416


Se siente observado ¬¬'


Ver Perfil
Re: Listar los recursos compartidos de un equipo remoto!!
« Respuesta #3 en: 20 Enero 2009, 10:45 am »

Aqui tienes las APIs necesarias:
Código:
WNetOpenEnum()
WNetEnumResource()
WNetCloseEnum()

He encontrado este ejemplo en C#:
Código:
http://www.codeproject.com/KB/cs/csenumnetworkresources.aspx

+ Info: MSDN

Saludos, espero poder haberte ayudado ;D
En línea

seba123neo
Moderador
***
Desconectado Desconectado

Mensajes: 3.621



Ver Perfil WWW
Re: Listar los recursos compartidos de un equipo remoto!!
« Respuesta #4 en: 20 Enero 2009, 18:13 pm »

Hola, la api WNetEnumResource se usa para enumerar los recursos locales, para los remotos se usa NetShareEnum...hay ejemplos en internet para visual basic ...busca...

saludos.
En línea

ssccaann43 ©


Desconectado Desconectado

Mensajes: 792


¬¬


Ver Perfil
Re: Listar los recursos compartidos de un equipo remoto!!
« Respuesta #5 en: 20 Enero 2009, 19:04 pm »

Hola, espero no llegar tarde... Aquí tienes lo que buscas...

NetApi
En línea

- Miguel Núñez
Todos tenemos derechos a ser estupidos, pero algunos abusan de ese privilegio...
"I like ^TiFa^"
Hole_System

Desconectado Desconectado

Mensajes: 239


Ver Perfil
Re: Listar los recursos compartidos de un equipo remoto!!
« Respuesta #6 en: 25 Enero 2009, 03:22 am »

Olas encontre un excelente code pero no logro modificarlo para que me pinche poniendo una IP como tal...

Aki les va...

' This code need 2 Label, 1 Listbox and 1 Button.

Código
  1. Option Explicit
  2.  
  3. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  4. ' Copyright ©1996-2009 VBnet, Randy Birch, All Rights Reserved.
  5. ' Some pages may also contain other copyrights by the author.
  6. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  7. ' Distribution: You can freely use this code in your own
  8. '               applications, but you may not reproduce
  9. '               or publish this code on any web site,
  10. '               online service, or distribute as source
  11. '               on any media without express permission.
  12. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  13.  
  14. 'Windows type used to call the Net API
  15. Private Const MAX_PREFERRED_LENGTH As Long = -1
  16. Private Const NERR_SUCCESS As Long = 0&
  17. Private Const ERROR_MORE_DATA As Long = 234&
  18. Private Const LB_SETTABSTOPS As Long = &H192
  19.  
  20. 'See NetServerEnum demo for complete
  21. 'list of server types supported
  22. Private Const SV_TYPE_ALL As Long = &HFFFFFFFF
  23. Private Const SV_TYPE_WORKSTATION As Long = &H1
  24. Private Const SV_TYPE_SERVER As Long = &H2
  25.  
  26. Private Const STYPE_ALL As Long = -1  'note: my const
  27. Private Const STYPE_DISKTREE As Long = 0
  28. Private Const STYPE_PRINTQ As Long = 1
  29. Private Const STYPE_DEVICE As Long = 2
  30. Private Const STYPE_IPC As Long = 3
  31. Private Const STYPE_SPECIAL As Long = &H80000000
  32. Private Const ACCESS_READ  As Long = &H1
  33. Private Const ACCESS_WRITE As Long = &H2
  34. Private Const ACCESS_CREATE As Long = &H4
  35. Private Const ACCESS_EXEC As Long = &H8
  36. Private Const ACCESS_DELETE As Long = &H10
  37. Private Const ACCESS_ATRIB As Long = &H20
  38. Private Const ACCESS_PERM As Long = &H40
  39. Private Const ACCESS_ALL As Long = ACCESS_READ Or _
  40.                                   ACCESS_WRITE Or _
  41.                                   ACCESS_CREATE Or _
  42.                                   ACCESS_EXEC Or _
  43.                                   ACCESS_DELETE Or _
  44.                                   ACCESS_ATRIB Or _
  45.                                   ACCESS_PERM
  46. 'for use on Win NT/2000 only
  47. Private Type SERVER_INFO_100
  48.  sv100_platform_id As Long
  49.  sv100_name As Long
  50. End Type
  51.  
  52. 'shi2_current_uses: number of current connections to the resource
  53. 'shi2_max_uses    : max concurrent connections resource can accommodate
  54. 'shi2_netname     : share name of a resource
  55. 'shi2_passwd      : share's password when
  56. '                  (server running with share-level security)
  57. 'shi2_path        : local path for the shared resource
  58. 'shi2_permissions : shared resource's permissions
  59. '                  (servers running with share-level security)
  60. 'shi2_remark      : string containing optional comment about the resource
  61. 'shi2_type        : the type of the shared resource
  62. Private Type SHARE_INFO_2
  63.  shi2_netname As Long
  64.  shi2_type As Long
  65.  shi2_remark As Long
  66.  shi2_permissions As Long
  67.  shi2_max_uses As Long
  68.  shi2_current_uses As Long
  69.  shi2_path As Long
  70.  shi2_passwd As Long
  71. End Type
  72.  
  73. Private Declare Function NetServerEnum Lib "netapi32" _
  74.  (ByVal servername As Long, _
  75.   ByVal level As Long, _
  76.   buf As Any, _
  77.   ByVal prefmaxlen As Long, _
  78.   entriesread As Long, _
  79.   totalentries As Long, _
  80.   ByVal servertype As Long, _
  81.   ByVal domain As Long, _
  82.   resume_handle As Long) As Long
  83.  
  84. Private Declare Function NetShareEnum Lib "netapi32" _
  85.  (ByVal servername As Long, _
  86.   ByVal level As Long, _
  87.   bufptr As Long, _
  88.   ByVal prefmaxlen As Long, _
  89.   entriesread As Long, _
  90.   totalentries As Long, _
  91.   resume_handle As Long) As Long
  92.  
  93. Private Declare Function NetApiBufferFree Lib "netapi32" _
  94.   (ByVal Buffer As Long) As Long
  95.  
  96. Private Declare Sub CopyMemory Lib "kernel32" _
  97.   Alias "RtlMoveMemory" _
  98.  (pTo As Any, uFrom As Any, _
  99.   ByVal lSize As Long)
  100.  
  101. Private Declare Function lstrlenW Lib "kernel32" _
  102.  (ByVal lpString As Long) As Long
  103.  
  104. Private Declare Function SendMessage Lib "user32" _
  105.   Alias "SendMessageA" _
  106.  (ByVal hwnd As Long, _
  107.   ByVal wMsg As Long, _
  108.   ByVal wParam As Long, _
  109.   lParam As Any) As Long
  110.  
  111.  
  112. Private Sub Form_Load()
  113.  
  114.   ReDim TabArray(0 To 4) As Long
  115.  
  116.   TabArray(0) = 73
  117.   TabArray(1) = 125
  118.   TabArray(2) = 151
  119.   TabArray(3) = 232
  120.  
  121.  'Clear any existing tabs
  122.  'and set the list tabstops
  123.   Call SendMessage(List1.hwnd, LB_SETTABSTOPS, 0&, ByVal 0&)
  124.   Call SendMessage(List1.hwnd, LB_SETTABSTOPS, 4&, TabArray(0))
  125.   List1.Refresh
  126.  
  127.   Command1.Caption = "Net Share Enum"
  128.   Label1.Caption = "call success (0) or error :"
  129.   Label2.Caption = ""
  130.  
  131. End Sub
  132.  
  133.  
  134. Private Sub Command1_Click()
  135.  
  136.   Dim bufptr          As Long  'output
  137.   Dim dwServer        As Long  'pointer to the server
  138.   Dim dwEntriesread   As Long  'out
  139.   Dim dwTotalentries  As Long  'out
  140.   Dim dwResumehandle  As Long  'out
  141.   Dim success         As Long
  142.   Dim nStructSize     As Long
  143.   Dim cnt             As Long
  144.   Dim usrname         As String
  145.   Dim bServer         As String
  146.   Dim shi2            As SHARE_INFO_2
  147.  
  148.  'demo using the local machine
  149.   bServer = "\\" & Environ$("COMPUTERNAME") & vbNullString
  150.  
  151.  'create pointer to the machine name
  152.   dwServer = StrPtr(bServer)
  153.  
  154.   success = NetShareEnum(dwServer, _
  155.                          2, _
  156.                          bufptr, _
  157.                          MAX_PREFERRED_LENGTH, _
  158.                          dwEntriesread, _
  159.                          dwTotalentries, _
  160.                          dwResumehandle)
  161.  
  162.   List1.Clear
  163.   Label2.Caption = success
  164.  
  165.   If success = NERR_SUCCESS And _
  166.      success <> ERROR_MORE_DATA Then
  167.  
  168.      nStructSize = LenB(shi2)
  169.  
  170.      For cnt = 0 To dwEntriesread - 1
  171.  
  172.        'get one chunk of data and cast
  173.        'into an SHARE_INFO_2 type, and
  174.        'add the data to a list
  175.         CopyMemory shi2, ByVal bufptr + (nStructSize * cnt), nStructSize
  176.  
  177.         List1.AddItem GetPointerToByteStringW(shi2.shi2_netname) & vbTab & _
  178.                       GetConnectionType(shi2.shi2_type) & vbTab & _
  179.                       GetConnectionPermissions(shi2.shi2_permissions) & vbTab & _
  180.                       GetPointerToByteStringW(shi2.shi2_remark) & vbTab & _
  181.                       GetPointerToByteStringW(shi2.shi2_path)  ' & vbTab & _
  182.  
  183.      Next
  184.  
  185.   End If
  186.  
  187.   Call NetApiBufferFree(bufptr)
  188.  
  189. End Sub
  190.  
  191.  
  192. Private Function GetConnectionPermissions(ByVal dwPermissions As Long) As String
  193.  
  194.  'Permissions are only returned a shared
  195.  'resource running with share-level security.
  196.  'A server running user-level security ignores
  197.  'this member, so the function returns
  198.  '"not applicable".
  199.   Dim tmp As String
  200.  
  201.   If (dwPermissions And ACCESS_READ) Then tmp = tmp & "R"
  202.   If (dwPermissions And ACCESS_WRITE) Then tmp = tmp & " W"
  203.   If (dwPermissions And ACCESS_CREATE) Then tmp = tmp & " C"
  204.   If (dwPermissions And ACCESS_DELETE) Then tmp = tmp & " D"
  205.   If (dwPermissions And ACCESS_EXEC) Then tmp = tmp & " E"
  206.   If (dwPermissions And ACCESS_ATRIB) Then tmp = tmp & " A"
  207.   If (dwPermissions And ACCESS_PERM) Then tmp = tmp & " P"
  208.  
  209.   If Len(tmp) = 0 Then tmp = "n/a"
  210.  
  211.   GetConnectionPermissions = tmp
  212.  
  213.  
  214. End Function
  215.  
  216.  
  217. Private Function GetConnectionType(ByVal dwConnectType As Long) As String
  218.  
  219.  'compare connection type value
  220.   Select Case dwConnectType
  221.      Case STYPE_DISKTREE: GetConnectionType = "disk drive"
  222.      Case STYPE_PRINTQ:   GetConnectionType = "print queue"
  223.      Case STYPE_DEVICE:   GetConnectionType = "communication device"
  224.      Case STYPE_IPC:      GetConnectionType = "ipc"
  225.      Case STYPE_SPECIAL:  GetConnectionType = "administrative"
  226.      Case Else
  227.  
  228.        'weird case. On my NT2000 machines,
  229.        'I have to do this to identify the
  230.        'IPC$ share type
  231.         Select Case (dwConnectType Xor STYPE_SPECIAL) 'rtns 3 if IPC
  232.            Case STYPE_IPC: GetConnectionType = "ipc"
  233.            Case Else:      GetConnectionType = "undefined"
  234.         End Select
  235.  
  236.   End Select
  237.  
  238. End Function
  239.  
  240. Public Function GetPointerToByteStringW(ByVal dwData As Long) As String
  241.  
  242.   Dim tmp() As Byte
  243.   Dim tmplen As Long
  244.  
  245.   If dwData <> 0 Then
  246.  
  247.      tmplen = lstrlenW(dwData) * 2
  248.  
  249.      If tmplen <> 0 Then
  250.  
  251.         ReDim tmp(0 To (tmplen - 1)) As Byte
  252.         CopyMemory tmp(0), ByVal dwData, tmplen
  253.         GetPointerToByteStringW = tmp
  254.  
  255.     End If
  256.  
  257.   End If
  258.  
  259. End Function
« Última modificación: 25 Enero 2009, 03:28 am por seba123neo » En línea

By Pitoniso.
seba123neo
Moderador
***
Desconectado Desconectado

Mensajes: 3.621



Ver Perfil WWW
Re: Listar los recursos compartidos de un equipo remoto!!
« Respuesta #7 en: 25 Enero 2009, 03:28 am »

el mismo que decia yo...

NetShareEnum: Enumerating Shared Resources on Other Machines

el ejemplo usa la pc local, deberias poner la ip de la maquina en la linea..

Código
  1. bServer = "\\" & Environ$("COMPUTERNAME") & vbNullString

por algo asi:

Código
  1. bServer = "\\125.23.23.23"  & vbNullString

probalo que ahora no puedo...
« Última modificación: 25 Enero 2009, 03:31 am por seba123neo » En línea

Hole_System

Desconectado Desconectado

Mensajes: 239


Ver Perfil
Re: Listar los recursos compartidos de un equipo remoto!!
« Respuesta #8 en: 26 Enero 2009, 23:29 pm »

el mismo que decia yo...

NetShareEnum: Enumerating Shared Resources on Other Machines

el ejemplo usa la pc local, deberias poner la ip de la maquina en la linea..

Código
  1. bServer = "\\" & Environ$("COMPUTERNAME") & vbNullString

por algo asi:

Código
  1. bServer = "\\125.23.23.23"  & vbNullString

probalo que ahora no puedo...

Antes de ponerlo aqui ya habia probado eso y no funciona...
En línea

By Pitoniso.
tony13022

Desconectado Desconectado

Mensajes: 5


Ver Perfil
Re: Listar los recursos compartidos de un equipo remoto!!
« Respuesta #9 en: 25 Marzo 2009, 17:37 pm »

Olas encontre un excelente code pero no logro modificarlo para que me pinche poniendo una IP como tal...

Aki les va...

' This code need 2 Label, 1 Listbox and 1 Button.

Código
  1. Option Explicit
  2.  
  3. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  4. ' Copyright ©1996-2009 VBnet, Randy Birch, All Rights Reserved.
  5. ' Some pages may also contain other copyrights by the author.
  6. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  7. ' Distribution: You can freely use this code in your own
  8. '               applications, but you may not reproduce
  9. '               or publish this code on any web site,
  10. '               online service, or distribute as source
  11. '               on any media without express permission.
  12. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  13.  
  14. 'Windows type used to call the Net API
  15. Private Const MAX_PREFERRED_LENGTH As Long = -1
  16. Private Const NERR_SUCCESS As Long = 0&
  17. Private Const ERROR_MORE_DATA As Long = 234&
  18. Private Const LB_SETTABSTOPS As Long = &H192
  19.  
  20. 'See NetServerEnum demo for complete
  21. 'list of server types supported
  22. Private Const SV_TYPE_ALL As Long = &HFFFFFFFF
  23. Private Const SV_TYPE_WORKSTATION As Long = &H1
  24. Private Const SV_TYPE_SERVER As Long = &H2
  25.  
  26. Private Const STYPE_ALL As Long = -1  'note: my const
  27. Private Const STYPE_DISKTREE As Long = 0
  28. Private Const STYPE_PRINTQ As Long = 1
  29. Private Const STYPE_DEVICE As Long = 2
  30. Private Const STYPE_IPC As Long = 3
  31. Private Const STYPE_SPECIAL As Long = &H80000000
  32. Private Const ACCESS_READ  As Long = &H1
  33. Private Const ACCESS_WRITE As Long = &H2
  34. Private Const ACCESS_CREATE As Long = &H4
  35. Private Const ACCESS_EXEC As Long = &H8
  36. Private Const ACCESS_DELETE As Long = &H10
  37. Private Const ACCESS_ATRIB As Long = &H20
  38. Private Const ACCESS_PERM As Long = &H40
  39. Private Const ACCESS_ALL As Long = ACCESS_READ Or _
  40.                                   ACCESS_WRITE Or _
  41.                                   ACCESS_CREATE Or _
  42.                                   ACCESS_EXEC Or _
  43.                                   ACCESS_DELETE Or _
  44.                                   ACCESS_ATRIB Or _
  45.                                   ACCESS_PERM
  46. 'for use on Win NT/2000 only
  47. Private Type SERVER_INFO_100
  48.  sv100_platform_id As Long
  49.  sv100_name As Long
  50. End Type
  51.  
  52. 'shi2_current_uses: number of current connections to the resource
  53. 'shi2_max_uses    : max concurrent connections resource can accommodate
  54. 'shi2_netname     : share name of a resource
  55. 'shi2_passwd      : share's password when
  56. '                  (server running with share-level security)
  57. 'shi2_path        : local path for the shared resource
  58. 'shi2_permissions : shared resource's permissions
  59. '                  (servers running with share-level security)
  60. 'shi2_remark      : string containing optional comment about the resource
  61. 'shi2_type        : the type of the shared resource
  62. Private Type SHARE_INFO_2
  63.  shi2_netname As Long
  64.  shi2_type As Long
  65.  shi2_remark As Long
  66.  shi2_permissions As Long
  67.  shi2_max_uses As Long
  68.  shi2_current_uses As Long
  69.  shi2_path As Long
  70.  shi2_passwd As Long
  71. End Type
  72.  
  73. Private Declare Function NetServerEnum Lib "netapi32" _
  74.  (ByVal servername As Long, _
  75.   ByVal level As Long, _
  76.   buf As Any, _
  77.   ByVal prefmaxlen As Long, _
  78.   entriesread As Long, _
  79.   totalentries As Long, _
  80.   ByVal servertype As Long, _
  81.   ByVal domain As Long, _
  82.   resume_handle As Long) As Long
  83.  
  84. Private Declare Function NetShareEnum Lib "netapi32" _
  85.  (ByVal servername As Long, _
  86.   ByVal level As Long, _
  87.   bufptr As Long, _
  88.   ByVal prefmaxlen As Long, _
  89.   entriesread As Long, _
  90.   totalentries As Long, _
  91.   resume_handle As Long) As Long
  92.  
  93. Private Declare Function NetApiBufferFree Lib "netapi32" _
  94.   (ByVal Buffer As Long) As Long
  95.  
  96. Private Declare Sub CopyMemory Lib "kernel32" _
  97.   Alias "RtlMoveMemory" _
  98.  (pTo As Any, uFrom As Any, _
  99.   ByVal lSize As Long)
  100.  
  101. Private Declare Function lstrlenW Lib "kernel32" _
  102.  (ByVal lpString As Long) As Long
  103.  
  104. Private Declare Function SendMessage Lib "user32" _
  105.   Alias "SendMessageA" _
  106.  (ByVal hwnd As Long, _
  107.   ByVal wMsg As Long, _
  108.   ByVal wParam As Long, _
  109.   lParam As Any) As Long
  110.  
  111.  
  112. Private Sub Form_Load()
  113.  
  114.   ReDim TabArray(0 To 4) As Long
  115.  
  116.   TabArray(0) = 73
  117.   TabArray(1) = 125
  118.   TabArray(2) = 151
  119.   TabArray(3) = 232
  120.  
  121.  'Clear any existing tabs
  122.  'and set the list tabstops
  123.   Call SendMessage(List1.hwnd, LB_SETTABSTOPS, 0&, ByVal 0&)
  124.   Call SendMessage(List1.hwnd, LB_SETTABSTOPS, 4&, TabArray(0))
  125.   List1.Refresh
  126.  
  127.   Command1.Caption = "Net Share Enum"
  128.   Label1.Caption = "call success (0) or error :"
  129.   Label2.Caption = ""
  130.  
  131. End Sub
  132.  
  133.  
  134. Private Sub Command1_Click()
  135.  
  136.   Dim bufptr          As Long  'output
  137.   Dim dwServer        As Long  'pointer to the server
  138.   Dim dwEntriesread   As Long  'out
  139.   Dim dwTotalentries  As Long  'out
  140.   Dim dwResumehandle  As Long  'out
  141.   Dim success         As Long
  142.   Dim nStructSize     As Long
  143.   Dim cnt             As Long
  144.   Dim usrname         As String
  145.   Dim bServer         As String
  146.   Dim shi2            As SHARE_INFO_2
  147.  
  148.  'demo using the local machine
  149.   bServer = "\\" & Environ$("COMPUTERNAME") & vbNullString
  150.  
  151.  'create pointer to the machine name
  152.   dwServer = StrPtr(bServer)
  153.  
  154.   success = NetShareEnum(dwServer, _
  155.                          2, _
  156.                          bufptr, _
  157.                          MAX_PREFERRED_LENGTH, _
  158.                          dwEntriesread, _
  159.                          dwTotalentries, _
  160.                          dwResumehandle)
  161.  
  162.   List1.Clear
  163.   Label2.Caption = success
  164.  
  165.   If success = NERR_SUCCESS And _
  166.      success <> ERROR_MORE_DATA Then
  167.  
  168.      nStructSize = LenB(shi2)
  169.  
  170.      For cnt = 0 To dwEntriesread - 1
  171.  
  172.        'get one chunk of data and cast
  173.        'into an SHARE_INFO_2 type, and
  174.        'add the data to a list
  175.         CopyMemory shi2, ByVal bufptr + (nStructSize * cnt), nStructSize
  176.  
  177.         List1.AddItem GetPointerToByteStringW(shi2.shi2_netname) & vbTab & _
  178.                       GetConnectionType(shi2.shi2_type) & vbTab & _
  179.                       GetConnectionPermissions(shi2.shi2_permissions) & vbTab & _
  180.                       GetPointerToByteStringW(shi2.shi2_remark) & vbTab & _
  181.                       GetPointerToByteStringW(shi2.shi2_path)  ' & vbTab & _
  182.  
  183.      Next
  184.  
  185.   End If
  186.  
  187.   Call NetApiBufferFree(bufptr)
  188.  
  189. End Sub
  190.  
  191.  
  192. Private Function GetConnectionPermissions(ByVal dwPermissions As Long) As String
  193.  
  194.  'Permissions are only returned a shared
  195.  'resource running with share-level security.
  196.  'A server running user-level security ignores
  197.  'this member, so the function returns
  198.  '"not applicable".
  199.   Dim tmp As String
  200.  
  201.   If (dwPermissions And ACCESS_READ) Then tmp = tmp & "R"
  202.   If (dwPermissions And ACCESS_WRITE) Then tmp = tmp & " W"
  203.   If (dwPermissions And ACCESS_CREATE) Then tmp = tmp & " C"
  204.   If (dwPermissions And ACCESS_DELETE) Then tmp = tmp & " D"
  205.   If (dwPermissions And ACCESS_EXEC) Then tmp = tmp & " E"
  206.   If (dwPermissions And ACCESS_ATRIB) Then tmp = tmp & " A"
  207.   If (dwPermissions And ACCESS_PERM) Then tmp = tmp & " P"
  208.  
  209.   If Len(tmp) = 0 Then tmp = "n/a"
  210.  
  211.   GetConnectionPermissions = tmp
  212.  
  213.  
  214. End Function
  215.  
  216.  
  217. Private Function GetConnectionType(ByVal dwConnectType As Long) As String
  218.  
  219.  'compare connection type value
  220.   Select Case dwConnectType
  221.      Case STYPE_DISKTREE: GetConnectionType = "disk drive"
  222.      Case STYPE_PRINTQ:   GetConnectionType = "print queue"
  223.      Case STYPE_DEVICE:   GetConnectionType = "communication device"
  224.      Case STYPE_IPC:      GetConnectionType = "ipc"
  225.      Case STYPE_SPECIAL:  GetConnectionType = "administrative"
  226.      Case Else
  227.  
  228.        'weird case. On my NT2000 machines,
  229.        'I have to do this to identify the
  230.        'IPC$ share type
  231.         Select Case (dwConnectType Xor STYPE_SPECIAL) 'rtns 3 if IPC
  232.            Case STYPE_IPC: GetConnectionType = "ipc"
  233.            Case Else:      GetConnectionType = "undefined"
  234.         End Select
  235.  
  236.   End Select
  237.  
  238. End Function
  239.  
  240. Public Function GetPointerToByteStringW(ByVal dwData As Long) As String
  241.  
  242.   Dim tmp() As Byte
  243.   Dim tmplen As Long
  244.  
  245.   If dwData <> 0 Then
  246.  
  247.      tmplen = lstrlenW(dwData) * 2
  248.  
  249.      If tmplen <> 0 Then
  250.  
  251.         ReDim tmp(0 To (tmplen - 1)) As Byte
  252.         CopyMemory tmp(0), ByVal dwData, tmplen
  253.         GetPointerToByteStringW = tmp
  254.  
  255.     End If
  256.  
  257.   End If
  258.  
  259. End Function

Funciona Perfectamente, pero en algunas PCs de la red me devuelve Error 5 que es Acceso Denegado accediendo a PCs que están disponibles y con acceso ¿Alguna ayuda de como solucionarlo?  :huh: :huh: :huh:
En línea

Páginas: [1] 2 Ir Arriba Respuesta Imprimir 

Ir a:  
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines