RE: [aus-dotnet] DllImport


    [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
    • From: Bill McCarthy
    • Subject: RE: [aus-dotnet] DllImport
    • Date: Sun, 29 Jan 2006 19:46:28 -0800

    Actually looks like you can use a DirectoryContext to logon as such (or at
    least return the Domain)
    
    
    > -----Original Message-----
    > From: peter@xxxxxxxxxxx [mailto:peter@xxxxxxxxxxx] On Behalf 
    > Of Nick Wienholt
    > Sent: Monday, January 30, 2006 2:18 PM
    > To: dotnet@xxxxxxxxxxx
    > Subject: RE: [aus-dotnet] DllImport
    > 
    > > Is this how you access unmanaged code?
    > 
    >  
    > 
    > Yes
    > 
    >  
    > 
    > > Is that the right name for it? code outside of .net is not 
    > managed by the framework right?)
    > 
    >  
    > 
    > Yes
    > 
    >  
    > 
    > > I would have thought the framework would have had somekind 
    > of wrapper for OS level stuff. I mean it has it for accessing 
    > files and memory streams etc, why not AD?
    > 
    >  
    > 
    > The full Win32 API is huge compared to the .NET Framework - 
    > it will take a lot of versions of the Framework before the 
    > majority of Win32 is covered.  There is a new namespace - 
    > System.DirectoryServices.ActiveDirectory - that covers AD, 
    > but I don't think it offers login services.
    > 
    >  
    > 
    > Nick Wienholt, C# MVP
    > 
    >  
    > 
    > Maximizing .NET Performance
    > 
    > http://www.apress.com/book/bookDisplay.html?bID=217
    > 
    >  
    > 
    > A Programmer's Introduction to C# 2.0, Third Edition
    > 
    > http://www.apress.com/book/bookDisplay.html?bID=454
    > 
    >  
    > 
    > Sydney Deep .NET User Group 
    > 
    > www.sdnug.org
    > 
    >  
    > 
    > www.dotnetperformance.com
    > 
    >  
    > 
    > ________________________________
    > 
    > From: peter@xxxxxxxxxxx [mailto:peter@xxxxxxxxxxx] On Behalf 
    > Of Stephen Price
    > Sent: Monday, 30 January 2006 1:50 PM
    > To: dotnet@xxxxxxxxxxx
    > Subject: [aus-dotnet] DllImport
    > 
    >  
    > 
    > I'm looking at some code to do with impersonation and a 
    > nagging question popped up (its done it before so here i am 
    > asking why).
    > 
    >  
    > 
    > Why do you use DllImport? I understand what it does... ie 
    > allows you to use methods in a dll, but what i don't quite 
    > get is why is this not part of some .net namespace? Is this 
    > how you access unmanaged code? (Is that the right name for 
    > it? code outside of .net is not managed by the framework 
    > right?) I would have thought the framework would have had 
    > somekind of wrapper for OS level stuff. I mean it has it for 
    > accessing files and memory streams etc, why not AD?
    > 
    >  
    > 
    > Seeking illumination. :)
    > 
    >  
    > 
    > Cheers,
    > 
    >  
    > 
    > Stephen
    > 
    >  
    > 
    >  
    > 
    > http://support.microsoft.com/default.aspx?scid=KB;en-us;q306158
    > 
    >  
    > 
    > [DllImport("advapi32.dll")]
    > public static extern int LogonUserA(String lpszUserName,
    > String lpszDomain,
    > String lpszPassword,
    > int dwLogonType,
    > int dwLogonProvider,
    > ref IntPtr phToken);
    > [DllImport("advapi32.dll", CharSet=CharSet.Auto, SetLastError=true)]
    > public static extern int DuplicateToken(IntPtr hToken,
    > int impersonationLevel,
    > ref IntPtr hNewToken);
    > 
    > 
    
    _________________
    You are a part of the Ausralian "dotnet" mailing list. To unsubscribe send "unsubscribe dotnet" or to re-subscribe send "subscribe dotnet" in the body of the email to: imailsrv@xxxxxxxxxxx 
    List Managed by www.stanski.com and Proudly Sponsored by www.ico.com.au
    
    
    



    (Click here for more information on the aus-dotnet mailling list)