is that possible from a C++ app?
thank you. -Greg 11 2181
"hazz" <ha**@sonic.net> wrote in message
news:Ob**************@TK2MSFTNGP12.phx.gbl... is that possible from a C++ app? thank you.
It is not all that clear what you want to do. Which thread are you talking
about?
Both dialects of C++ (managed and unmanaged) have no trouble calling
functions of the Win32 API. In particular, calling GetUserName() and
LookupAccountName() might take you where you want to go.
Regards,
Will
Thank you for responding Will. Sorry for not offering more detail.
I have the following .NET C# code using .NET System.Security.Principal;
m_iIdnt = new System.Security.Principal.GenericIdentity(t.UserNa me,"custom
authentication");
m_iPrincipal = new
System.Security.Principal.GenericPrincipal(m_iIdnt ,roles);
System.Threading.Thread.CurrentPrincipal=m_iPrinci pal;
What I would like to do is access the Identity from what happened above, but
from a C++ app rather than the following .NET app;
IPrincipal currentPrincipal = Thread.CurrentPrincipal;
IIdentity currentIdentity = currentPrincipal.Identity;
string authtype = currentIdentity.AuthenticationType;
if (currentIdentity.IsAuthenticated) .........
thank you,
Greg
"William DePalo [MVP VC++]" <wi***********@mvps.org> wrote in message
news:Oh**************@TK2MSFTNGP11.phx.gbl... "hazz" <ha**@sonic.net> wrote in message news:Ob**************@TK2MSFTNGP12.phx.gbl... is that possible from a C++ app? thank you.
It is not all that clear what you want to do. Which thread are you talking about?
Both dialects of C++ (managed and unmanaged) have no trouble calling functions of the Win32 API. In particular, calling GetUserName() and LookupAccountName() might take you where you want to go.
Regards, Will
The FCL classes are only usable in a managed C++ application, native C++
cannot use managed classes.
Willy.
"hazz" <ha**@sonic.net> wrote in message
news:OD**************@TK2MSFTNGP12.phx.gbl... Thank you for responding Will. Sorry for not offering more detail.
I have the following .NET C# code using .NET System.Security.Principal;
m_iIdnt = new System.Security.Principal.GenericIdentity(t.UserNa me,"custom authentication"); m_iPrincipal = new System.Security.Principal.GenericPrincipal(m_iIdnt ,roles); System.Threading.Thread.CurrentPrincipal=m_iPrinci pal;
What I would like to do is access the Identity from what happened above, but from a C++ app rather than the following .NET app;
IPrincipal currentPrincipal = Thread.CurrentPrincipal; IIdentity currentIdentity = currentPrincipal.Identity; string authtype = currentIdentity.AuthenticationType; if (currentIdentity.IsAuthenticated) .........
thank you, Greg
"William DePalo [MVP VC++]" <wi***********@mvps.org> wrote in message news:Oh**************@TK2MSFTNGP11.phx.gbl... "hazz" <ha**@sonic.net> wrote in message news:Ob**************@TK2MSFTNGP12.phx.gbl... > is that possible from a C++ app? > thank you.
It is not all that clear what you want to do. Which thread are you talking about?
Both dialects of C++ (managed and unmanaged) have no trouble calling functions of the Win32 API. In particular, calling GetUserName() and LookupAccountName() might take you where you want to go.
Regards, Will
The FCL classes are only usable in a managed C++ application, native C++
cannot use managed classes.
Willy.
"hazz" <ha**@sonic.net> wrote in message
news:OD**************@TK2MSFTNGP12.phx.gbl... Thank you for responding Will. Sorry for not offering more detail.
I have the following .NET C# code using .NET System.Security.Principal;
m_iIdnt = new System.Security.Principal.GenericIdentity(t.UserNa me,"custom authentication"); m_iPrincipal = new System.Security.Principal.GenericPrincipal(m_iIdnt ,roles); System.Threading.Thread.CurrentPrincipal=m_iPrinci pal;
What I would like to do is access the Identity from what happened above, but from a C++ app rather than the following .NET app;
IPrincipal currentPrincipal = Thread.CurrentPrincipal; IIdentity currentIdentity = currentPrincipal.Identity; string authtype = currentIdentity.AuthenticationType; if (currentIdentity.IsAuthenticated) .........
thank you, Greg
"William DePalo [MVP VC++]" <wi***********@mvps.org> wrote in message news:Oh**************@TK2MSFTNGP11.phx.gbl... "hazz" <ha**@sonic.net> wrote in message news:Ob**************@TK2MSFTNGP12.phx.gbl... > is that possible from a C++ app? > thank you.
It is not all that clear what you want to do. Which thread are you talking about?
Both dialects of C++ (managed and unmanaged) have no trouble calling functions of the Win32 API. In particular, calling GetUserName() and LookupAccountName() might take you where you want to go.
Regards, Will
I understand. But is there an interop possibility?
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:eD**************@TK2MSFTNGP09.phx.gbl... The FCL classes are only usable in a managed C++ application, native C++ cannot use managed classes.
Willy.
"hazz" <ha**@sonic.net> wrote in message news:OD**************@TK2MSFTNGP12.phx.gbl... Thank you for responding Will. Sorry for not offering more detail.
I have the following .NET C# code using .NET System.Security.Principal;
m_iIdnt = new System.Security.Principal.GenericIdentity(t.UserNa me,"custom authentication"); m_iPrincipal = new System.Security.Principal.GenericPrincipal(m_iIdnt ,roles); System.Threading.Thread.CurrentPrincipal=m_iPrinci pal;
What I would like to do is access the Identity from what happened above, but from a C++ app rather than the following .NET app;
IPrincipal currentPrincipal = Thread.CurrentPrincipal; IIdentity currentIdentity = currentPrincipal.Identity; string authtype = currentIdentity.AuthenticationType; if (currentIdentity.IsAuthenticated) .........
thank you, Greg
"William DePalo [MVP VC++]" <wi***********@mvps.org> wrote in message news:Oh**************@TK2MSFTNGP11.phx.gbl... "hazz" <ha**@sonic.net> wrote in message news:Ob**************@TK2MSFTNGP12.phx.gbl... > is that possible from a C++ app? > thank you.
It is not all that clear what you want to do. Which thread are you talking about?
Both dialects of C++ (managed and unmanaged) have no trouble calling functions of the Win32 API. In particular, calling GetUserName() and LookupAccountName() might take you where you want to go.
Regards, Will
I understand. But is there an interop possibility?
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:eD**************@TK2MSFTNGP09.phx.gbl... The FCL classes are only usable in a managed C++ application, native C++ cannot use managed classes.
Willy.
"hazz" <ha**@sonic.net> wrote in message news:OD**************@TK2MSFTNGP12.phx.gbl... Thank you for responding Will. Sorry for not offering more detail.
I have the following .NET C# code using .NET System.Security.Principal;
m_iIdnt = new System.Security.Principal.GenericIdentity(t.UserNa me,"custom authentication"); m_iPrincipal = new System.Security.Principal.GenericPrincipal(m_iIdnt ,roles); System.Threading.Thread.CurrentPrincipal=m_iPrinci pal;
What I would like to do is access the Identity from what happened above, but from a C++ app rather than the following .NET app;
IPrincipal currentPrincipal = Thread.CurrentPrincipal; IIdentity currentIdentity = currentPrincipal.Identity; string authtype = currentIdentity.AuthenticationType; if (currentIdentity.IsAuthenticated) .........
thank you, Greg
"William DePalo [MVP VC++]" <wi***********@mvps.org> wrote in message news:Oh**************@TK2MSFTNGP11.phx.gbl... "hazz" <ha**@sonic.net> wrote in message news:Ob**************@TK2MSFTNGP12.phx.gbl... > is that possible from a C++ app? > thank you.
It is not all that clear what you want to do. Which thread are you talking about?
Both dialects of C++ (managed and unmanaged) have no trouble calling functions of the Win32 API. In particular, calling GetUserName() and LookupAccountName() might take you where you want to go.
Regards, Will
Sure, you can expose your C# class as COM object and use COM interop,
question is why would you do that when simply calling the Win32 API's gives
you the same information.
Willy.
"hazz" <ha**@sonic.net> wrote in message
news:Ou**************@TK2MSFTNGP09.phx.gbl... I understand. But is there an interop possibility?
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message news:eD**************@TK2MSFTNGP09.phx.gbl... The FCL classes are only usable in a managed C++ application, native C++ cannot use managed classes.
Willy.
"hazz" <ha**@sonic.net> wrote in message news:OD**************@TK2MSFTNGP12.phx.gbl... > Thank you for responding Will. Sorry for not offering more detail. > > I have the following .NET C# code using .NET System.Security.Principal; > > m_iIdnt = new > System.Security.Principal.GenericIdentity(t.UserNa me,"custom > authentication"); > m_iPrincipal = new > System.Security.Principal.GenericPrincipal(m_iIdnt ,roles); > System.Threading.Thread.CurrentPrincipal=m_iPrinci pal; > > What I would like to do is access the Identity from what happened > above, > but > from a C++ app rather than the following .NET app; > > IPrincipal currentPrincipal = Thread.CurrentPrincipal; > IIdentity currentIdentity = currentPrincipal.Identity; > string authtype = currentIdentity.AuthenticationType; > if (currentIdentity.IsAuthenticated) ......... > > thank you, > Greg > > "William DePalo [MVP VC++]" <wi***********@mvps.org> wrote in message > news:Oh**************@TK2MSFTNGP11.phx.gbl... >> "hazz" <ha**@sonic.net> wrote in message >> news:Ob**************@TK2MSFTNGP12.phx.gbl... >> > is that possible from a C++ app? >> > thank you. >> >> It is not all that clear what you want to do. Which thread are you >> talking >> about? >> >> Both dialects of C++ (managed and unmanaged) have no trouble calling >> functions of the Win32 API. In particular, calling GetUserName() and >> LookupAccountName() might take you where you want to go. >> >> Regards, >> Will >> >> > >
Sure, you can expose your C# class as COM object and use COM interop,
question is why would you do that when simply calling the Win32 API's gives
you the same information.
Willy.
"hazz" <ha**@sonic.net> wrote in message
news:Ou**************@TK2MSFTNGP09.phx.gbl... I understand. But is there an interop possibility?
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message news:eD**************@TK2MSFTNGP09.phx.gbl... The FCL classes are only usable in a managed C++ application, native C++ cannot use managed classes.
Willy.
"hazz" <ha**@sonic.net> wrote in message news:OD**************@TK2MSFTNGP12.phx.gbl... > Thank you for responding Will. Sorry for not offering more detail. > > I have the following .NET C# code using .NET System.Security.Principal; > > m_iIdnt = new > System.Security.Principal.GenericIdentity(t.UserNa me,"custom > authentication"); > m_iPrincipal = new > System.Security.Principal.GenericPrincipal(m_iIdnt ,roles); > System.Threading.Thread.CurrentPrincipal=m_iPrinci pal; > > What I would like to do is access the Identity from what happened > above, > but > from a C++ app rather than the following .NET app; > > IPrincipal currentPrincipal = Thread.CurrentPrincipal; > IIdentity currentIdentity = currentPrincipal.Identity; > string authtype = currentIdentity.AuthenticationType; > if (currentIdentity.IsAuthenticated) ......... > > thank you, > Greg > > "William DePalo [MVP VC++]" <wi***********@mvps.org> wrote in message > news:Oh**************@TK2MSFTNGP11.phx.gbl... >> "hazz" <ha**@sonic.net> wrote in message >> news:Ob**************@TK2MSFTNGP12.phx.gbl... >> > is that possible from a C++ app? >> > thank you. >> >> It is not all that clear what you want to do. Which thread are you >> talking >> about? >> >> Both dialects of C++ (managed and unmanaged) have no trouble calling >> functions of the Win32 API. In particular, calling GetUserName() and >> LookupAccountName() might take you where you want to go. >> >> Regards, >> Will >> >> > >
Thanks Willy for helping me out here. One more outrageous question. Can I
access the .NET runtime thread using Win32 API's. (which contains the
Principal and Identity that I want) thx. -greg the newbie
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:uV*************@TK2MSFTNGP12.phx.gbl... Sure, you can expose your C# class as COM object and use COM interop, question is why would you do that when simply calling the Win32 API's
gives you the same information.
Willy.
"hazz" <ha**@sonic.net> wrote in message news:Ou**************@TK2MSFTNGP09.phx.gbl...I understand. But is there an interop possibility?
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message news:eD**************@TK2MSFTNGP09.phx.gbl... The FCL classes are only usable in a managed C++ application, native
C++ cannot use managed classes.
Willy.
"hazz" <ha**@sonic.net> wrote in message news:OD**************@TK2MSFTNGP12.phx.gbl... > Thank you for responding Will. Sorry for not offering more detail. > > I have the following .NET C# code using .NET
System.Security.Principal; > > m_iIdnt = new > System.Security.Principal.GenericIdentity(t.UserNa me,"custom > authentication"); > m_iPrincipal = new > System.Security.Principal.GenericPrincipal(m_iIdnt ,roles); > System.Threading.Thread.CurrentPrincipal=m_iPrinci pal; > > What I would like to do is access the Identity from what happened > above, > but > from a C++ app rather than the following .NET app; > > IPrincipal currentPrincipal = Thread.CurrentPrincipal; > IIdentity currentIdentity = currentPrincipal.Identity; > string authtype = currentIdentity.AuthenticationType; > if (currentIdentity.IsAuthenticated) ......... > > thank you, > Greg > > "William DePalo [MVP VC++]" <wi***********@mvps.org> wrote in message > news:Oh**************@TK2MSFTNGP11.phx.gbl... >> "hazz" <ha**@sonic.net> wrote in message >> news:Ob**************@TK2MSFTNGP12.phx.gbl... >> > is that possible from a C++ app? >> > thank you. >> >> It is not all that clear what you want to do. Which thread are you >> talking >> about? >> >> Both dialects of C++ (managed and unmanaged) have no trouble calling >> functions of the Win32 API. In particular, calling GetUserName() and >> LookupAccountName() might take you where you want to go. >> >> Regards, >> Will >> >> > >
"hazz" <ha**@sonic.net> wrote in message
news:uS****************@tk2msftngp13.phx.gbl... Thanks Willy for helping me out here. One more outrageous question. Can I access the .NET runtime thread using Win32 API's. (which contains the Principal and Identity that I want) thx. -greg the newbie
<note>
I am not passing on your design strategy, simply answering the question that
you asked.
</note>
You can mix unmanaged C++ and Managed Extensions fro C++ (soon to be called
C++/CLI) in the same module. So one option is to have functions free
functions in an unmanaged module call on member functions in an MC++ class
which call on the requisite functions in your C# class. This works best when
you think in terms of interfaces. Don't think of sharing managed types with
unmanaged code.
Regards,
Will
The light bulb is beginning to flicker.
.... and I acknowledge there are larger design issues here, even if I don't
understand them yet.
I am still looking for keywords and keynote concepts in the answers to my
questions.
I realize I am not asking the right questions yet.
Is CLI common language interface?
Thanks Will.
"William DePalo [MVP VC++]" <wi***********@mvps.org> wrote in message
news:uJ**************@TK2MSFTNGP09.phx.gbl... "hazz" <ha**@sonic.net> wrote in message news:uS****************@tk2msftngp13.phx.gbl... Thanks Willy for helping me out here. One more outrageous question. Can
I access the .NET runtime thread using Win32 API's. (which contains the Principal and Identity that I want) thx. -greg the newbie <note> I am not passing on your design strategy, simply answering the question
that you asked. </note>
You can mix unmanaged C++ and Managed Extensions fro C++ (soon to be
called C++/CLI) in the same module. So one option is to have functions free functions in an unmanaged module call on member functions in an MC++ class which call on the requisite functions in your C# class. This works best
when you think in terms of interfaces. Don't think of sharing managed types
with unmanaged code.
Regards, Will
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Robert Phillips |
last post by:
I periodically get an ApplicationException "access is denied" in the
WindowsIdentity._GetCurrentToken() method. Reflector shows the
_GetCurrentToken() method as
private static extern IntPtr...
|
by: Mats-Lennart Hansson |
last post by:
Hi,
I want to get the name of the owner of a thread. I have a component that can
be called from many different components so I want to trace which user that
owns the thread. Is this possible in...
|
by: hazz |
last post by:
is that possible from a C++ app?
thank you. -Greg
|
by: David B. Bitton |
last post by:
For some odd reason, despite the fact that I assign my own custom IPrincipal
to the HttpContext.User property in an HttpApplication.AuthenticateRequest
event handler inside of an IHttpModule,...
|
by: Stan |
last post by:
I start a new thread to run a long database query and show the progress bar
Thread DbThread = new Thread(new ThreadStart(dr.GetDataFromDb));
DbThread.Start()
Response.Redirect ("WaitPage.aspx")...
|
by: Jody Gelowitz |
last post by:
We are having an issue in that when trying to read a file that is on Server2
from Server1 (through our ASP.NET project), we receive the error:
Access to the path "\\Server2\MyShare\MyFile.tif" is...
|
by: Eric |
last post by:
Hello,
I have a web app that uploads files to a file server (different box than the
web server). The application uses NT integrated authentication, but no users
should have permissions to the...
|
by: Shailesh Gajare |
last post by:
Hi All,
I have creating an ASP.Net application with two web servers. I am
uploading a file which is being uploaded on one of the server, I want to
copy the uploaded file on the other server at the...
|
by: Ed Sutton |
last post by:
Is there a FileSecurity method that can determine if the current
WindowsIdentity has write access to a file?
I can get the current windows identity and use FileSecurity to return
the ...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |