EldoS | Feel safer!

Software components for data protection, secure storage and transfer

how du I use void AddNetworkMountingPoint with AuthenticationID in C#

Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.
Posted: 11/28/2008 08:20:32
by Rene Pape (Standard support level)
Joined: 09/09/2008
Posts: 6


I'm having great trouble using the void AddNetworkMountingPoint(String MountingPoint, string NetworkShareName, bool LocalLink, LUID AuthenticationID );

My main problem is the AuthenticationID argument.
Using Lutz Roeders Reflector program I've discovered that the AuthenticationID argument is of the type _LUID which is declared as a internal struct

[StructLayout(LayoutKind.Sequential, Size=8), NativeCppClass, DebugInfoInPDB, MiscellaneousBits(0x41)]
internal struct _LUID

So what I would like is if you could supply me with example C# code that calls AddNetworkMountingPoint(String MountingPoint, string NetworkShareName, bool LocalLink, LUID AuthenticationID );
Posted: 11/28/2008 08:56:05
by Volodymyr Zinin (Team)


We're sorry. In the current version of the .NET library the functions with LUID don't work. We'll fix it in the nearest build.
Posted: 11/28/2008 15:37:59
by Vladimir Cherniga (Team)

We have solved the problem, the new build will available soon. Thanks for your help.
Posted: 12/01/2008 01:28:56
by Rene Pape (Standard support level)
Joined: 09/09/2008
Posts: 6

Hi Vladimir

Cool you've already fixed the problem.

Could you supply me with example C# code for the methodcall and an approximate date for release of the new build.

I have a customer waiting for the fix!

- Rune
Posted: 12/01/2008 08:46:27
by Vladimir Cherniga (Team)

we just add custom version of the LUID structure into the CallbackFS namespace.
The prototype looks like
public struct LUID {
   public UInt32 LowPart;
   public Int32 HighPart;

What type of example do you request ? How to retrieves the LUID from system using C# and use it with AddNetworkMountingPoint api ?
Posted: 12/02/2008 02:35:17
by Rene Pape (Standard support level)
Joined: 09/09/2008
Posts: 6

I can't seem to find a LUID value in the .NET framework.

The best I can find is the Token property on the System.Security.Principal.WindowsIdentity object.
The description of the Token property is

Gets the Windows account token for the user.

But the Token type is a IntPtr object which I can not seem to map directly to the expected LUID type.

So yes I would like to see an example of how you would get the LUID for the current session and use it with the AddNetworkMountingPoint method.
Posted: 12/02/2008 03:56:20
by Vladimir Cherniga (Team)

Account Token handle is not such thing that we neeed. In order to obtain LUID, you should use unmanaged win32 api - LookupPrivilegeValue.
Declare its prototype in your C# code as follow:

[DllImport("advapi32.dll", SetLastError=true, CharSet=CharSet.Auto)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool LookupPrivilegeValue(string lpSystemName, string lpName,   out LUID lpLuid);
Posted: 12/03/2008 07:19:51
by Rene Pape (Standard support level)
Joined: 09/09/2008
Posts: 6

Hi Vladimir

After looking into some MS documentation on the LookupPrivilegeValue I've got a new question for you :-)

[URL=http://msdn.microsoft.com/en-us/library/aa379180(VS.85).aspx]LookupPrivilegeValue Function[/URL]
[URL=http://msdn.microsoft.com/en-us/library/bb530716(VS.85).aspx]Privilege Constants[/URL]

I'm not used to call the unmanaged parts of Windows so please bear with me.

To me it looks like the value assigned to the lpLuid parameter of LookupPrivilegeValue method is depended upon which priviledge to look up.
The lpName specifices the priviledge to look up, and can take on quite a lot of values. I've tried a few of them, and the LUID ended up with different values for the different priviledges.

So for which priviledge do you want me to look up the LUID value?

For the lpSystemName parameter I've just used null which indicates the priviledge should be found on the local system. Is this correct?
Posted: 12/03/2008 07:56:03
by Volodymyr Zinin (Team)


Some information about LUID exists in the CallbackFS documentation. Please see the topic "Mounting Points and Authentication IDs" there.
Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages



Topic viewed 3871 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!