Avatar of sneeuw
sneeuwFlag for Belgium

asked on 

How do I see : Win2000, Administrator

Hi guys,

Using Borland cpp Builder 4.x

- How do I ask the system whether it is WinNT 4 or Win2000
(While we're at it : How do I see Millenium ?)

- How do I know if the user is logged in as administrator or normal user ??

Thanks,
sneeuw
C++

Avatar of undefined
Last Comment
sneeuw
ASKER CERTIFIED SOLUTION
Avatar of nietod
nietod

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of nietod
nietod

If I had to guess, windows 2000 will return 5 for the major version number, as opposed to 4 for NT 4.
Avatar of sneeuw
sneeuw
Flag of Belgium image

ASKER

So 5 ??
Problem is that I cannot test, so I was hoping I would hear the answer here ;-)

Same goes for the other question !?

How do I see if the user is logged on as Administrator or not ??
Avatar of nietod
nietod

I can't tell you for sure, but very likely 5.  It will be greater than 4, that you can be sure of.

I didn't see the other question.   (Technically you are allowed only one question per EE question, this is stated in the rules, it is to prevent certain types of problems, like what to do when an expert answers only some questions.)  This really isn't my area of expertise.  You can use GetUserName() to get the name of the user currently logged in. I don't know if that can be used to recognize the addministrator or not.  Most likely you really don't care about that though.  Most likely you want to know the access rights of the current user, right?
Avatar of sneeuw
sneeuw
Flag of Belgium image

ASKER

Answer accepted
Avatar of sneeuw
sneeuw
Flag of Belgium image

ASKER

OK Nietod,

I'll ask the question again.

I use IOCTL commands to talk to device drivers but I've heard that this functionality is only available when you're logged on as Administrator under Win2000.
That's why I need to check to be able to offer an alternative for IOCTL (If at all possible).

So I GUESS I need the access rights but I'm hoping an expert can tell me all I need to know to be able to do it right under all circumstances.

Thanks,
Anyway

sneeuw
Avatar of nietod
nietod

That is really out of my area of expertise.  But you probably don't care about the user's access rights in this case, but the programm's access rights.  Most protected OS's allow certain programs to be installed to work at higher leverls of access than the the user's level.  This is necessary because the user is often orevented from performing many dangerious operations, but these still need to be done at time--with care--so it is possible to have a program run with high access level under a low access level user.  (But the programm's access level needs to be set high by a user that has the high access level.  i.e. a low level user can't use this approach to break security.)
Avatar of nietod
nietod

You might look at AdjustTokenPriviledges() in the help.  This will get you into the NT security area of the help system.  Look at the related topics and it might help.

Do you know that DeviceoIOControl is used differently under NT and window 9x?
Avatar of sneeuw
sneeuw
Flag of Belgium image

ASKER

Yes,

Under Win9x I have a working layer based on Aspi but now wanted to create something based on SPTI as well because I run into Aspi-under-NT problems sometimes.

However, I heard that this SPTI technology is not allowed under Win2000 when you're not logged on as administrator.  I need to find somebody to test it for me but in the mean time wanted to gather all needed info pro-activily

In case you were wondering where I use this.  Check out my Hobby project (I'm not a proffesional programmer) :
www.ping.be/vcd/isobuster.html

Have fun,
Peter
C++
C++

C++ is an intermediate-level general-purpose programming language, not to be confused with C or C#. It was developed as a set of extensions to the C programming language to improve type-safety and add support for automatic resource management, object-orientation, generic programming, and exception handling, among other features.

58K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo