Beispiel #1
0
 /// <summary>
 /// Crack one or more names on the domain controller.
 /// </summary>
 /// <param name="flags">Flags for the cracking.</param>
 /// <param name="format_offered">Format of the names.</param>
 /// <param name="format_desired">Desired format of the names.</param>
 /// <param name="names">The list of names to crack.</param>
 /// <returns>The cracked names.</returns>
 public IReadOnlyList <DirectoryServiceNameResult> CrackNames(
     DirectoryServiceNameFlags flags,
     DirectoryServiceNameFormat format_offered,
     DirectoryServiceNameFormat format_desired,
     IEnumerable <string> names)
 {
     return(CrackNames(flags, format_offered, format_desired, names, true).Result);
 }
Beispiel #2
0
 /// <summary>
 /// Crack a name on the domain controller.
 /// </summary>
 /// <param name="flags">Flags for the cracking.</param>
 /// <param name="format_offered">Format of the name.</param>
 /// <param name="format_desired">Desired format of the name.</param>
 /// <param name="name">The name to crack.</param>
 /// <returns>The cracked name.</returns>
 public DirectoryServiceNameResult CrackName(
     DirectoryServiceNameFlags flags,
     DirectoryServiceNameFormat format_offered,
     DirectoryServiceNameFormat format_desired,
     string name
     )
 {
     return(CrackName(flags, format_offered,
                      format_desired, name, true).Result);
 }
Beispiel #3
0
 public static extern Win32Error DsCrackNames(
     SafeDirectoryServiceHandle hDS,
     DirectoryServiceNameFlags flags,
     DirectoryServiceNameFormat formatOffered,
     DirectoryServiceNameFormat formatDesired,
     int cNames,
     [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr)]
     string[] rpNames,
     out IntPtr ppResult // PDS_NAME_RESULTW *
     );
Beispiel #4
0
 /// <summary>
 /// Crack a name on the domain controller.
 /// </summary>
 /// <param name="flags">Flags for the cracking.</param>
 /// <param name="format_offered">Format of the name.</param>
 /// <param name="format_desired">Desired format of the name.</param>
 /// <param name="name">The name to crack.</param>
 /// <param name="throw_on_error">True to throw on error.</param>
 /// <returns>The cracked name.</returns>
 public NtResult <DirectoryServiceNameResult> CrackName(
     DirectoryServiceNameFlags flags,
     DirectoryServiceNameFormat format_offered,
     DirectoryServiceNameFormat format_desired,
     string name,
     bool throw_on_error
     )
 {
     return(CrackNames(flags, format_offered,
                       format_desired, new string[] { name },
                       throw_on_error).Map(l => l.First()));
 }
Beispiel #5
0
 /// <summary>
 /// Crack one or more names on the domain controller.
 /// </summary>
 /// <param name="flags">Flags for the cracking.</param>
 /// <param name="format_offered">Format of the names.</param>
 /// <param name="format_desired">Desired format of the names.</param>
 /// <param name="names">The list of names to crack.</param>
 /// <param name="throw_on_error">True to throw on error.</param>
 /// <returns>The cracked names.</returns>
 public NtResult <IReadOnlyList <DirectoryServiceNameResult> > CrackNames(
     DirectoryServiceNameFlags flags,
     DirectoryServiceNameFormat format_offered,
     DirectoryServiceNameFormat format_desired,
     IEnumerable <string> names,
     bool throw_on_error)
 {
     string[] names_arr = names.ToArray();
     if (names_arr.Length == 0)
     {
         return(new List <DirectoryServiceNameResult>().AsReadOnly().CreateResult <IReadOnlyList <DirectoryServiceNameResult> >());
     }
     return(DirectoryServiceNativeMethods.DsCrackNames(_handle, flags, format_offered,
                                                       format_desired, names_arr.Length, names_arr, out IntPtr results).CreateWin32Result(throw_on_error,
                                                                                                                                          () => GetNameResults(results)));
 }