[Monday, January 24, 2005 8:25 AM]

I've been anxious to move from WISE to SetupBuilder for quite some time. I
removed one of the remaining barriers to doing so by porting some WISE script
code to Clarion.

I am making this code available to anyone here that would like it. The
download contains the Clarion source project, DLL, and an SB5 script to test
it with. The compiled script is in the UserGroupsTest directory, so you can
test it without recompiling the script, or the Clarion project. If you modify
the SB5 script, you will have to change the Support File path to
InstallFunc.dll to reflect its location on your system.

Download: ftp.lanbytes.net/pub/sb5/install.func.zip

MemberOfGroup( *cstring ), long, pascal

InstallFunc.dll exports the function above. Its cstring parameter is the name
of a Windows user group for which you wish to determine membership of the
current user. MemberOfGroup() performs case insensitive match of incoming
user group name with local groups to which the user belongs. It returns True
(1) for a match, False (0) for no match, and (-1) if an error occurs. This
makes determining if the user is in an arbitrary group trivial from SB5.

GetOSVersion(), long, pascal

This may be in SB5 now, but I need to determine the specific Windows platform
under which an install is being performed. GetOSVersion() returns a numeric
constant representing one of the following as defined in InstallFunc.inc.
Some of you may find a use for this in your own work outside of SB5. If you
haven't seen this done before, you may be surprised at how easy it is.

WIN_WINDOWS_95
WIN_WINDOWS_98
WIN_WINDOWS_ME
WIN_WINDOWS_NT4
WIN_WINDOWS_2K
WIN_WINDOWS_XP
WIN_WINDOWS_NET_03

Caveats: MemberOfGroup() is NT4/2K/XP centric. I no longer maintain a 9x/ME
box for testing, and am generally not impressed by the large numbers of those
OS installations that survive. It may work, though.

This implementation only handles local groups. That is, those on the local
machine. I don't currently have a need for global group membership
information, but it would be easy to add.

While the 9x/ME thing makes everyday use of this impractical for many,
there's less than 500 lines of code to the whole thing, and it contains work
that some folks may find interesting. Something that was particularly fun for
me was dealing with the Unicode strings required of the Netapi. It turns out
to be quite straightforward for this bit of work.

My humble thanks to the Hillbilly that helped me with the crucial bit of
pointer manipulation that slipped by me. May it rain pizza on his porch every
day. :}

Enjoy!

--
Best regards,

Mark