No navigation frame on the left?  Click here.

NetGroupEnum (NT 95)

NetGroupEnum(), with a twist -- it is just about the simplest sample that is able to run on both Windows NT and 9x (on Windows 9x, requires rlocal32.dll and radmin32.dll; read this for details).

Points to ponder:

Just about every declaration is present in NT and 95 incarnations. For functions this is because those which accept or return strings have a different argument list; for structures, because the strings are declared as vanilla char* for ANSI on 95, and as wchar_t* for Unicode on NT.

Most functions have different names, as far as GetProcAddress() is concerned. Again, this is due to the ANSIness of 95: Functions that accept or return strings have an "A" appended to their names. Note that NetApiBufferFree() is not such a function; consequently, there is only one declaration for it, which gets used for both cases.

Overall, this is a real mess, sprinkled with if ( isNT ) conditionals and Unicode/ANSI conversions. But, it works.

nge.cpp, 5 KB