Solved

Short Q on Computer names

Posted on 2000-04-03
3
180 Views
Last Modified: 2010-04-02
Hi!

Is NetBIOS functions the easiest way to
get a list of all the Computer Names in the Windows Network?
Is there no "smart" functions like file-functions but for networks?

Thanks!
0
Comment
Question by:Scattan
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 20 total points
ID: 2681228
If you're using NT, 'NetServerEnum()' will do the job (http://msdn.microsoft.com/library/psdk/network/ntlmapi2_1vl9.htm). On all other MS 'platforms', use 'WNetEnumResource()' (http://msdn.microsoft.com/library/psdk/network/networks_03ad.htm)
0
 

Author Comment

by:Scattan
ID: 2682899
Thank you!

It's a really good function, but I just get the first letter in each computer I find. You'll get some more points if you can help me in solving that.
I guess I need to allocate some more memory somehow to get the whole string, but I don't really see where. The helpfile tells me that if I use MAX_PREFERRED_LENGTH, (-1), "the function will allocate the amount of memory needed for the data."

What do I do wrong?

(I have followed the sample-code in the link you gave me, it's a bit different from my helpfile, I don't know which one that is the oldest. For example in my helpfile it sais that I should include lmserver.h, but that doesn't work, it works with lm.h, which I found in your helpfile)

Thanks!
0
 

Author Comment

by:Scattan
ID: 2683055
OK, now I gave myself a lesson in Unicode handling, so I know now what I did wrong.

Thanks for the tip!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now