Desktop Functions: Smart Device Functions:
|
Search Results for "system" in [All]netapi32
System.Net.Sockets.AddressFamily.InterNetwork, 2: DsGetDcName
System.Windows.Forms.MessageBox.Show ( msg); System.DirectoryServices.ActiveDirectory.Domain.GetCurrentDomain() 3: DsGetDcNext
using HANDLE = System.IntPtr;
using DWORD = System.UInt32;
iReturn = DsGetDcOpen("domain1.mydomains.com", 1, "MYADSITE", (System.IntPtr)null, null, 0, out pDcContext); 4: DsGetDcOpen
using DWORD = System.UInt32;
using ULONG = System.UInt64;
iReturn = DsGetDcOpen("domain1.mydomains.com", 0, null, (System.IntPtr)null, null, 0, out pDcContext);
iReturn = DsGetDcOpen("domain1.mydomains.com", 1, "MYADSITE", (System.IntPtr)null, null, 0, out pDcContext);
internal static extern System.Int32 DsGetDcSiteCoverage(
out System.Int64 EntryCount,
Policies = new string[9, 2] { { "System", "" }, { "Logon", "" }, { "Object Access", "" }, { "Privilige Use", "" }, { "Detailed Tracking", "" }, { "Policy Change", "" }, { "Account Management", "" }, { "Directory Service Access", "" }, { "Account Logon", "" } };
LSA_UNICODE_STRING aSystemName = new LSA_UNICODE_STRING();
aSystemName.SetTo(this.ResourceName);
uint aOpenPolicyResult = LsaOpenPolicy(ref aSystemName, ref aObjectAttributes, aAccess, out aPolicyHandle); 7: NetDfsAdd 8: NetDfsEnum
/// The NetDfsEnum function enumerates all the Distributed File System (Dfs) links in the named Dfs root. The function returns information about the Dfs links based on information specified by the Level parameter.
/// <param name="Buffer">[out] Pointer to the address of a buffer that receives the requested information structures. The format of this data depends on the value of the Level parameter. This buffer is allocated by the system and must be freed using the NetApiBufferFree function. </param>
/// <returns>If the function succeeds, the return value is NERR_Success. If no more entries are available to be enumerated, the return value is ERROR_NO_MORE_ITEMS. If the function fails, the return value is a system error code</returns> 10: NetDfsRemove
/// The NetDfsRemove function removes a target from a Distributed File System (Dfs) link. If the specified target is the last associated with the Dfs link, then the NetDfsRemove function also removes the link.
/// <returns>If the function succeeds, the return value is NERR_Success. If the function fails, the return value is a system error code</returns>
''' The NetDfsRemove function removes a target from a Distributed File System (Dfs) link. If the specified target is the last associated with the Dfs link, then the NetDfsRemove function also removes the link.
''' <returns>If the function succeeds, the return value is NERR_Success. If the function fails, the return value is a system error code</returns> 11: NetDfsSetInfo
/// The NetDfsSetInfo function sets or modifies the information associated with a Distributed File System (Dfs) link in the named Dfs root, or with the Dfs root itself. The function can set information relevant to a specific root, root target, link, or link target.
System.DirectoryServices.ActiveDirectory.Domain.GetComputerDomain();
Imports System.Runtime.InteropServices 13: NetJoinDomain If the function fails, the return value can be one of the following error codes or one of the system error codes. Here's some sample code that can do this using System.DirectoryServices
string computerName = SystemInformation.ComputerName;
using System;
using System.Text;
using System.Runtime.InteropServices;
string SystemName, 15: NetLocalGroupDel
string SystemName,
string SystemName,
''' Windows NT: No special group membership is required to execute the NetMessageBufferSend function on a LAN Manager or a Windows NT system.
using System;
using System.Runtime.InteropServices;
System.IntPtr UsrBuf = System.IntPtr.Zero;
System.IntPtr item = System.IntPtr.Zero;
if (item != System.IntPtr.Zero)
// Free buffer (allocated by system)
if (UsrBuf != System.IntPtr.Zero)
public System.IntPtr usri1_name;
public System.IntPtr usri1_comment;
public System.IntPtr usri1_full_name;
public System.IntPtr grp_name;
public System.IntPtr grp_comment;
public System.IntPtr usri2_name;
public System.IntPtr usri2_comment;
int Level, int ResumeHandle, int EntriesRequested, int prefMaxLength, out int entriesRead, out System.IntPtr Buffer);
[DllImport("netapi32.dll", CharSet=CharSet.Auto, SetLastError=true)] private static extern int NetApiBufferFree (System.IntPtr pBuffer);
System.IntPtr x = System.IntPtr.Zero;
if (x != System.IntPtr.Zero)
if (x != System.IntPtr.Zero)
if (x != System.IntPtr.Zero)
if (x != System.IntPtr.Zero)
if (x != System.IntPtr.Zero)
if (x != System.IntPtr.Zero) 20: NetRemoteTOD using System; using System.IO; using System.Windows.Forms; using System.Runtime.InteropServices;
if ( pintError > 0 ) { throw new System.ComponentModel.Win32Exception ( pintError ); } using System; using System.Runtime.InteropServices;
using System.DirectoryServices.ActiveDirectory; 22: netserverenum
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Security;
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]
throw new System.ComponentModel.Win32Exception(ret);
throw new System.ComponentModel.Win32Exception(ret);
namespace System.Runtime.InteropServices
using System;
using System.Runtime.InteropServices;
using System.Collections ;
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.U4)]
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.U4)] public UInt32 sv101_version_major;
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.U4)] public UInt32 sv101_version_minor;
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.U4)] public UInt32 sv101_type;
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)] public string sv101_comment;
//Cast the pointer to a ulong so this addition will work on 32-bit or 64-bit systems. The System.Data.Sql.SqlDataSourceEnumerator class is an alternative to this API, for enumerating SQL Servers on a network. 23: NetServerGetInfo
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]
level = int.Parse(System.Text.RegularExpressions.Regex.Replace(typeof(T).Name, @"[^\d]", ""));
throw new System.ComponentModel.Win32Exception(ret); 24: NetSessionEnum
''' This buffer is allocated by the system and must be freed using the NetApiBufferFree function. Note that you must free the buffer even if the function fails with ERROR_MORE_DATA. 25: NetShareEnum
' Clean up buffer allocated by system
If System.String.Compare(shi2.shi2_path, "c:\deletemeplease" True) = 0 Then
private void button1_Click(object sender, System.EventArgs e)
//Remember, 64-bit systems have 64-bit pointers. Using ToInt32 will cause an ArithmeticOverview exception.
Imports System
Imports System.Runtime.InteropServices
Imports System.text
' Clean up buffer allocated by system 26: NetShareGetInfo
Imports System
Imports System.Runtime.InteropServices
using System;
using System.Collections;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
Imports System.Management 27: NetStatisticsGet
System.Console.WriteLine(aRebootTime); 28: NetUseAdd
using BOOL = System.Boolean;
using DWORD = System.UInt32;
using LPWSTR = System.String;
using NET_API_STATUS = System.UInt32; using System.Runtime.InteropServices; using BOOL = System.Boolean; using DWORD = System.UInt32; using LPWSTR = System.String; using NET_API_STATUS = System.UInt32; 29: NetUseEnum
// previous line has been causing "arithmetic operation resulted in an overflow" exception on x86 systems for me. Fixed with the .Add method. 30: NetUserAdd
Return New System.ComponentModel.Win32Exception(RetVal).Message 31: NetUserEnum
// Passing -1 as prefmaxlen makes the system allocate the buffer. using System.DirectoryServices; //System.DirectoryServices 32: NetUserGetInfo
//throw new System.ApplicationException("Could not get user's Full Name."); Imports System.Runtime.InteropServices Imports System.Runtime.InteropServices.UnmanagedType Imports System.Runtime.InteropServices.Marshal Imports System.Runtime.InteropServices.StructLayoutAttribute I added the Sample code for x64 systems because when I ran it, I kept getting an arithmetic overflow error. I tried forcing PowerShell to compile it for x86, but then I would get an invalid image error. Converting all the "int" to "Int64" seems to do the trick.
using System;
using System.Runtime.InteropServices;
using System.Collections;
using System.Net.Sockets; Sample PowerShell Code for x64 systems
using System;
using System.Runtime.InteropServices;
using System.Collections; 34: NetValidateName
using System;
using System.Runtime.InteropServices;
using System;
using System.Runtime.InteropServices;
using System;
using System.Runtime.InteropServices; 35: NetWkstaUserEnum Shared Function NetWkstaUserEnum(ByVal servername As String, ByVal level As Integer, <System.Runtime.InteropServices.Out()> ByRef bufptr As IntPtr, ByVal prefmaxlen As Integer, <System.Runtime.InteropServices.Out()> ByRef entriesread As Integer, <System.Runtime.InteropServices.Out()> ByRef totalentries As Integer, ByRef resume_handle As Integer) As Integer WMI can do this sort of thing (the System.Management namespace in .Net 2.0) If you want to find the user logged in to the workstation, consider instead a WMI query ("select UserName from Win32_ComputerSystem"), which has certain advantages (runs faster, less ambigious results, doesn't require Interop if using .Net 2.0 System.Management namespace, etc.)
Console.WriteLine("A system error has occurred : " + nStatus);
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]
System.Windows.Forms.MessageBox.Show(domain); shlwapi
/// <exception cref="System.IO.FileNotFoundException">Unknown files extension</exception>
''' <exception cref="System.IO.FileNotFoundException">Unknown files extension</exception> 38: ColorHLSToRGB
using System;
using System.Drawing;
using System.Runtime.InteropServices;
static public System.Drawing.Color HLSToColor(int H,int L,int S)
// Convert Hue, Luminance, and Saturation values to System.Drawing.Color structure.
// ColorHLSToRGB returns a Win32 RGB value (0x00BBGGRR). To convert to System.Drawing.Color 39: ColorRGBToHLS
using System;
using System.Drawing;
using System.Runtime.InteropServices;
//Convert System.Drawing.Color structure to HLS.
static public void ColorToHLS(System.Drawing.Color C,ref int H,ref int L,ref int S) 40: IPreviewHandler [System.Runtime.InteropServices.ComImport] You can use this interface to leverage previewers already installed on a system to display a document preview in a Windows Forms app. 41: IsOS
/// Equivalent to PlatformID.Win32Windows. Note that none of those systems
/// systems.
/// GetSystemMetrics(SM_REMOTESESSION).
/// successors. Equivalent to GetSystemMetrics(SM_MEDIACENTER). 42: PathAddBackslash
static extern IntPtr PathAddBackslash([MarshalAs(UnmanagedType.LPTStr)]System.Text.StringBuilder lpszPath);
Public Function PathAddBackslash(<MarshalAs(UnmanagedType.LPTStr)>lpszPath As System.Text.StringBuilder) As IntPtr 43: PathAppend
Public Function PathAppend(<MarshalAs(UnmanagedType.LPTStr)>pszPath As System.Text.StringBuilder, _ 44: PathBuildRoot
static extern string PathBuildRoot([MarshalAs(UnmanagedType.LPTStr)]szRoot As System.Text.StringBuilder,
Public Function PathBuildRoot(<MarshalAs(UnmanagedType.LPTStr)>szRoot As System.Text.StringBuilder, _ 45: PathCombine
Declare Unicode Function PathCombine Lib "shlwapi.dll" Alias "PathCombineW" (<MarshalAs(UnmanagedType.LPTStr)> PathOut As System.Text.StringBuilder, <MarshalAs(UnmanagedType.LPTStr)> PathIn As String, <MarshalAs(UnmanagedType.LPTStr)> More As String) As IntPtr 46: PathCompactPath
<MarshalAs(UnmanagedType.LPTStr)> pszOut As System.Text.StringBuilder,
using System;
using System.Runtime.InteropServices;
using System.Text; System.Windows.Forms.TextRenderer.MeasureText(String, Font, Size, TextFormatFlags.ModifyString | TextFormatFlags.PathEllipsis);
<MarshalAs(UnmanagedType.LPTStr)> pszOut As System.Text.StringBuilder,
using System;
using System.Runtime.InteropServices;
using System.Text; System.Windows.Forms.TextRenderer.MeasureText(String, Font, Size, TextFormatFlags.ModifyString | TextFormatFlags.PathEllipsis);
ByVal path As System.Text.StringBuilder, _
ByRef pathLength As System.UInt32, _
Dim myResult As String = (new System.Uri(myUri)).LocalPath 'returns "C:\Temp\foo.txt"
Private Sub pathFromUrlButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pathFromUrlButton.Click
Dim sz As System.UInt32
Dim sb As System.Text.StringBuilder
sb = New System.Text.StringBuilder(INTERNET_MAX_URL_LENGTH) 49: PathFileExists
/// Determines whether a path to a file system object such as a file or directory is valid.
''' Determines whether a path to a file system object such as a file or directory is valid. 50: PathGetArgs
static extern System.Text.StringBuilder PathGetArgs([MarshalAs(UnmanagedType.LPTStr)]string pszPath);
Public Function PathGetArgs(<MarshalAs(UnmanagedType.LPTStr)>pszPath As String) As <MarshalAs(UnmanagedType.LPTStr)> System.Text.StringBuilder
Dim args As New System.Text.StringBuilder(255)
System.Diagnostics.Debug.WriteLine(args.ToString()) 51: PathIsDirectory bool System.IO.Directory.Exists(string path) http://msdn.microsoft.com/en-us/library/system.io.directory.exists%28v=vs.110%29.aspx 52: PathQuoteSpaces
static extern bool PathQuoteSpaces([MarshalAs(UnmanagedType.LPTStr)]System.Text.StringBuilder lpsz);
Public Function PathQuoteSpaces(<MarshalAs(UnmanagedType.LPTStr)>lpsz As System.Text.StringBuilder) As <MarshalAs(UnmanagedType.Bool)> Boolean
public static string GetRelativePath(FileSystemInfo path1, FileSystemInfo path2) {
Func<FileSystemInfo, string> getFullName = delegate(FileSystemInfo path) { 54: PathRemoveArgs
static extern void PathRemoveArgs([MarshalAs(UnmanagedType.LPTStr)]System.Text.StringBuilder lpszPath);
Public sub PathRemoveArgs(<MarshalAs(UnmanagedType.LPTStr)>lpszPath As System.Text.StringBuilder)
static extern IntPtr PathRemoveBackslash([MarshalAs(UnmanagedType.LPTStr)]System.Text.StringBuilder lpszPath);
Public Function PathRemoveBackslash(<MarshalAs(UnmanagedType.LPTStr)>lpszPath As System.Text.StringBuilder) As IntPtr
static extern void PathRemoveExtension([MarshalAs(UnmanagedType.LPTStr)]System.Text.StringBuilder pszFile);
Public Sub PathRemoveExtension(<MarshalAs(UnmanagedType.LPTStr)>pszFile As System.Text.StringBuilder)
Dim strFile As New system.Text.StringBuilder(255)
System.Diagnostics.Debug.WriteLine(strFile.ToString())
static extern bool PathRenameExtension([MarshalAs(UnmanagedType.LPTStr)]System.Text.StringBuilder lpszPath,
Public Function PathRenameExtension(<MarshalAs(UnmanagedType.LPTStr)>lpszPath As System.Text.StringBuilder, _ 58: PathStripPath
Public Sub PathStripPath(<MarshalAs(UnmanagedType.LPTStr)>pszPath As System.Text.StringBuilder)
Dim strFile As New system.Text.StringBuilder(255)
System.Diagnostics.Debug.WriteLine(strFile.ToString())
<MarshalAs(UnmanagedType.LPTStr)>lpszPath As System.Text.StringBuilder, _
Dim sb As New System.Text.StringBuilder(1024)
static extern void PathUnQuoteSpaces([MarshalAs(UnmanagedType.LPTStr)]System.Text.StringBuilder lpsz);
Public Sub PathUnQuoteSpaces(<MarshalAs(UnmanagedType.LPTStr)>lpsz As System.Text.StringBuilder) Cut off search results after 60. Please refine your search. |