Article View: borland.public.cppbuilder.nativeapi
Article #10826Re: Check if the user is logged as admin...
From: Ed Mulroy [TeamB]
Date: Wed, 17 Mar 2004 16:12
Date: Wed, 17 Mar 2004 16:12
27 lines
2131 bytes
2131 bytes
I am just guessing with this but think you could first determine if the machine is an NT class machine (Win95/98/ME don't have much in the way of security) and if so call GetUserName to get the string containing the user's name and then LookupAccountName to get the Security Descriptor, SID, in which you can then check to see if he is part of the Administrator group. You'd probably need to LoadLibrary or GetModuleHandle for ADVAPI32.DLL and init a function pointer with a call to GetProcAddress for the LookupAccountNameA (or W) function so that the function isn't implicitly linked by the program. Otherwise people running on Win95/98/ME would get an function not found error from the Windows' program loader when the program starts since they most likely do not provide that function. . Ed > Vladimir Stefanovic wrote in message > news:40586203@newsgroups.borland.com... > > How can I check if the user is logged with > administartor rights or as Administrator? > > I need this because it seems that the function > SQLConfigDataSource() for managing ODBC > connections from code cannot create ODBC > if the user is not logged as administrator...
Technical Details
Message-ID:
<405878f5$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!in.100proofnews.com!in.100proofnews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<40586203@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,91576aaf7b7d46ad X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-03-17 08:28:16 PST From: "Ed Mulroy [TeamB]" <dont_email_me@bitbuc.ket> Newsgroups: borland.public.cppbuilder.nativeapi References: <40586203@newsgroups.borland.com> Subject: Re: Check if the user is logged as admin... Date: Wed, 17 Mar 2004 11:12:23 -0500 Lines: 29 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 24.74.175.102 Message-ID: <405878f5$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1079539957 24.74.175.102 (17 Mar 2004 08:12:37 -0800) X-Authenticated-User: edmulroy Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!in.100proofnews.com!in.100proofnews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail