Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Enumerating Servers on Win9x

Enumerating Servers on Win9x

Scheduled Pinned Locked Moved Visual Basic
csharpsysadminjson
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mikasa
    wrote on last edited by
    #1

    Ok, I understand that the NetServerEnum API functions do not work on a Win9x machine. In VB6, I had code to enumerate Servers on a Windows9x machine, however, porting it to VB.NET seems impossible. I have it working...somewhat. However, it only enumerates the Top-Level Node everytime! If someone could please shed some light on what I am doing wrong I would greatly appreciate it! This was all guess-work on my part even though I understand Marshalling a little bit. Here's what I have so far: 'Declarations 'API Declarations Private Declare Auto Function GlobalAlloc Lib "kernel32" (ByVal wFlags As Integer, ByVal dwBytes As Integer) As Integer Private Declare Auto Function GlobalFree Lib "kernel32" (ByVal hMem As Integer) As Integer 'API Declarations for Win9x Private Declare Ansi Function WNetOpenEnum Lib "mpr.dll" Alias "WNetOpenEnumA" (ByVal dwScope As Integer, ByVal dwType As Integer, ByVal dwUsage As Integer, ByRef lpNetResource As IntPtr, ByRef lphEnum As Integer) As Integer Private Declare Ansi Function WNetEnumResource Lib "mpr.dll" Alias "WNetEnumResourceA" (ByVal hEnum As Integer, ByRef lpcCount As Integer, ByVal lpBuffer As Integer, ByRef lpBufferSize As Integer) As Integer Private Declare Ansi Function WNetCloseEnum Lib "mpr.dll" (ByVal hEnum As Integer) As Integer 'Structures _ Private Structure NETRESOURCE Dim Scope As Integer Dim Type As Integer Dim DisplayType As Integer Dim Usage As Integer Dim LocalName As IntPtr Dim RemoteName As IntPtr Dim Comment As IntPtr Dim Provider As IntPtr End Structure 'Constants for WNetEnum Private Enum ResourceScopes resConnected = &H1 'All currently connected resources (the dwUsage parameter is ignored) resGlobalNet = &H2 'All resources on the network. resRemembered = &H3 'All remembered (persistent) connections (dwUsage is ignored) resRecent = &H4 resContext = &H5 End Enum Private Enum ResourceTypes resAny = &H0 'All resources (this value cannot be combined with RESOURCETYPE_DISK or RESOURCETYPE_PRINT). resDisk = &H1 'All disk resources. resPrinter = &H2 'All print resources. resReserved = &H8 resUnknown = &HFFFF End Enum Private Enum ResourceUseages 'Ignored if the ResourceScope is not 'resGlobalNet' resAll = ((&H1) Or (&H2)) resConnectable = &H1 resC

    M 1 Reply Last reply
    0
    • M mikasa

      Ok, I understand that the NetServerEnum API functions do not work on a Win9x machine. In VB6, I had code to enumerate Servers on a Windows9x machine, however, porting it to VB.NET seems impossible. I have it working...somewhat. However, it only enumerates the Top-Level Node everytime! If someone could please shed some light on what I am doing wrong I would greatly appreciate it! This was all guess-work on my part even though I understand Marshalling a little bit. Here's what I have so far: 'Declarations 'API Declarations Private Declare Auto Function GlobalAlloc Lib "kernel32" (ByVal wFlags As Integer, ByVal dwBytes As Integer) As Integer Private Declare Auto Function GlobalFree Lib "kernel32" (ByVal hMem As Integer) As Integer 'API Declarations for Win9x Private Declare Ansi Function WNetOpenEnum Lib "mpr.dll" Alias "WNetOpenEnumA" (ByVal dwScope As Integer, ByVal dwType As Integer, ByVal dwUsage As Integer, ByRef lpNetResource As IntPtr, ByRef lphEnum As Integer) As Integer Private Declare Ansi Function WNetEnumResource Lib "mpr.dll" Alias "WNetEnumResourceA" (ByVal hEnum As Integer, ByRef lpcCount As Integer, ByVal lpBuffer As Integer, ByRef lpBufferSize As Integer) As Integer Private Declare Ansi Function WNetCloseEnum Lib "mpr.dll" (ByVal hEnum As Integer) As Integer 'Structures _ Private Structure NETRESOURCE Dim Scope As Integer Dim Type As Integer Dim DisplayType As Integer Dim Usage As Integer Dim LocalName As IntPtr Dim RemoteName As IntPtr Dim Comment As IntPtr Dim Provider As IntPtr End Structure 'Constants for WNetEnum Private Enum ResourceScopes resConnected = &H1 'All currently connected resources (the dwUsage parameter is ignored) resGlobalNet = &H2 'All resources on the network. resRemembered = &H3 'All remembered (persistent) connections (dwUsage is ignored) resRecent = &H4 resContext = &H5 End Enum Private Enum ResourceTypes resAny = &H0 'All resources (this value cannot be combined with RESOURCETYPE_DISK or RESOURCETYPE_PRINT). resDisk = &H1 'All disk resources. resPrinter = &H2 'All print resources. resReserved = &H8 resUnknown = &HFFFF End Enum Private Enum ResourceUseages 'Ignored if the ResourceScope is not 'resGlobalNet' resAll = ((&H1) Or (&H2)) resConnectable = &H1 resC

      M Offline
      M Offline
      mikasa
      wrote on last edited by
      #2

      Nevermind, I figured this out!

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups