C# 클래스 Abstractions.WindowsApi.pInvokes

파일 보기 프로젝트 열기: MutonUfoAI/pgina 1 사용 예제들

공개 메소드들

메소드 설명
CloseHandle ( IntPtr handle ) : bool
CreateUserProfileDir ( IntPtr hToken, string username ) : string

calls API CreateProfile an empty string on error a null string on already exists a string on success

DeleteProfile ( System.Security.Principal.SecurityIdentifier sid ) : bool
DisconnectNetworkDrive ( string remoteUNC ) : System.Boolean

disconnecting an UNC share

DomainMember ( string domain ) : bool

query if the domain is part of a domain tree in which the local computer is a member of

GetCredentials ( string caption, string message ) : NetworkCredential
GetFreeShareSpace ( string share ) : long[]

Retrieves information about the amount of space that is available on a disk volume, which is the total amount of space, the total amount of free space, and the total amount of free space available to the user that is associated with the calling thread. based on http://msdn.microsoft.com/en-us/library/windows/desktop/aa364937(v=vs.85).aspx

GetInteractiveUserList ( ) : List
GetMachineDomainMembership ( ) : string

get local machine domain membership as NETBIOS name

GetMachineDomainMembershipEX ( ) : string

get local machine domain membership as DNS name

GetOrSetUserProfileDir ( string username, string domain, string password ) : string

get or create user profile directory only if the ProfileList regkey is not of SID.bak (Abstractions.User.FixProfileList) an empty or null string means error

GetRegistryLocation ( structenums location ) : RegistryKey

get RegistryKey from structenums.RegistryLocation

GetSessionContext ( ) : List>.Dictionary

returns a Dictionary of SessionID Keys and a List of usernames based on context in which a program is running. a program running as administrator will add administrator to the list

GetSessionContext ( int sessionID ) : List

return username based on context in which a program is running. a program running as administrator will add administrator to the list session ID -1 retuns all sessions instead of a specific one

GetSessionContextParser ( int sessionID, Dictionary contextALL ) : List

return username based on context in which a program is running. a program running as administrator will add administrator to the list session ID -1 retuns all sessions instead of a specific one

GetSessionId ( ) : int
GetUserDomain ( int sessionId ) : string
GetUserName ( int sessionId ) : string
GetUserProfileDir ( IntPtr hToken ) : string

returns userprofile based on GetUserProfileDirectory only if the ProfileList regkey is not of SID.bak (Abstractions.User.FixProfileList) empty string means error

GetUserProfilePath ( IntPtr hToken ) : string

returns userprofile based on SHGetFolderPath only if the profile realy exists and the ProfileList regkey is not of SID.bak (Abstractions.User.FixProfileList) empty string means error

GetUserToken ( string username, string domain, string password ) : IntPtr

Create a handle to the user token make sure to close the handle!!!

IsSessionLoggedOFF ( int session ) : bool
LastError ( ) : string

returns GetLastWin32Error as string

LastError ( int error ) : string

returns GetLastWin32Error as string

LogoffSession ( int sessionId ) : bool
MapNetworkDrive ( string remoteUNC, string username, string password ) : Boolean

connect to a remote computer based on http://social.msdn.microsoft.com/Forums/et-EE/netfxbcl/thread/58159e0e-aa45-4d46-a128-596c3d23ff5c

MapNetworkDrive ( string remoteUNC, string username, string password, bool promptUser ) : Boolean

connect to a remote computer based on http://social.msdn.microsoft.com/Forums/et-EE/netfxbcl/thread/58159e0e-aa45-4d46-a128-596c3d23ff5c

MapNetworkDrive ( string unc, string drive, string user, string password ) : int

Map a network drive.

RegistryCloseKey ( UIntPtr hKey ) : Boolean
RegistryCopyKey ( UIntPtr hKey_src, string SubKey, UIntPtr hKey_dst ) : Boolean
RegistryCreateKey ( structenums RootKey, string SubKey ) : UIntPtr
RegistryDeleteTree ( structenums RootKey, string SubKey ) : Boolean
RegistryLoad ( structenums where, string name, string file ) : Boolean

load a regfile at hklm or hku

RegistryOpenKey ( structenums RootKey, string SubKey ) : UIntPtr
RegistryUnLoad ( structenums where, string name ) : Boolean

unload regfile from regkey

SendMessageToUser ( int sessionID, string title, string message ) : Boolean

send a messagebox to a session

SetPreshutdownTimeout ( SafeHandle handle, structenums &myServiceStatus ) : bool
SetServiceStopped ( IntPtr handle, structenums &myServiceStatus ) : bool
ShutdownPending ( IntPtr handle, structenums &myServiceStatus, TimeSpan wait ) : bool
StartProcessInSession ( int sessionId, string cmdLine ) : Process
StartProcessInSessionWait ( int sessionId, string cmdLine ) : bool
StartProcessWithToken ( IntPtr token, string cmdLine ) : Process
StartUserProcessInSession ( int sessionId, string cmdLine ) : bool
StartUserProcessInSessionWait ( int sessionId, string cmdLine ) : bool
UserADD ( string username, string password, string comment ) : Boolean

add user to the local system based on http://social.msdn.microsoft.com/forums/en-us/csharpgeneral/thread/B70B79D9-971F-4D6F-8462-97FC126DE0AD

UserChangePassword ( string domainname, string username, string oldpassword, string newpassword ) : string
UserDel ( string username ) : Boolean

delete a local user based on http://social.msdn.microsoft.com/forums/en-us/csharpgeneral/thread/B70B79D9-971F-4D6F-8462-97FC126DE0AD

UserExists ( string username ) : Boolean

return true if a local user exists

UserExists ( string username, string domain ) : Boolean

return true if a local user exists

UserGet ( string username, string domain, structenums &userinfo4 ) : Boolean

returns local user settings as a ref of an USER_INFO_4 struct based on http://social.msdn.microsoft.com/forums/en-us/csharpgeneral/thread/B70B79D9-971F-4D6F-8462-97FC126DE0AD

UserGet ( string username, structenums &userinfo4 ) : Boolean

returns local user settings as a ref of an USER_INFO_4 struct based on http://social.msdn.microsoft.com/forums/en-us/csharpgeneral/thread/B70B79D9-971F-4D6F-8462-97FC126DE0AD

UserMod ( string username, structenums userInfo4 ) : Boolean

modify local user settings based on a USER_INFO_4 struct based on http://social.msdn.microsoft.com/forums/en-us/csharpgeneral/thread/B70B79D9-971F-4D6F-8462-97FC126DE0AD

ValidateCredentials ( string username, string password ) : bool

Attempts to validate the user's credentials for a local account using a pInvoke to LogonUser.

ValidateCredentials ( string username, string domain, string password ) : bool

Attempts to validate the user's credentials using a pInvoke to LogonUser.

ValidateUser ( string username, string domain, string password ) : bool

Attempts to validate the user's credentials using a pInvoke to LogonUser but ignores password change response.

VersionsInfo ( ) : structenums.OSVERSIONINFOW

get the real windows version http://www.codeproject.com/Articles/678606/Part-Overcoming-Windows-s-deprecation-of-GetVe

WTSQueryUserToken ( int sessionId ) : IntPtr
WTSRegister ( IntPtr handle ) : bool
WTSUnRegister ( IntPtr handle ) : bool

비공개 메소드들

메소드 설명
GetDomainInfo ( string domain ) : pInvokes.SafeNativeMethods.DOMAIN_CONTROLLER_INFO
LogonUser ( string username, string domain, string password ) : int
RegistryLoadSetPrivilege ( ) : Boolean

메소드 상세

CloseHandle() 공개 정적인 메소드

public static CloseHandle ( IntPtr handle ) : bool
handle System.IntPtr
리턴 bool

CreateUserProfileDir() 공개 정적인 메소드

calls API CreateProfile an empty string on error a null string on already exists a string on success
public static CreateUserProfileDir ( IntPtr hToken, string username ) : string
hToken System.IntPtr
username string
리턴 string

DeleteProfile() 공개 정적인 메소드

public static DeleteProfile ( System.Security.Principal.SecurityIdentifier sid ) : bool
sid System.Security.Principal.SecurityIdentifier
리턴 bool

DisconnectNetworkDrive() 공개 정적인 메소드

disconnecting an UNC share
public static DisconnectNetworkDrive ( string remoteUNC ) : System.Boolean
remoteUNC string
리턴 System.Boolean

DomainMember() 공개 정적인 메소드

query if the domain is part of a domain tree in which the local computer is a member of
public static DomainMember ( string domain ) : bool
domain string
리턴 bool

GetCredentials() 공개 정적인 메소드

public static GetCredentials ( string caption, string message ) : NetworkCredential
caption string
message string
리턴 System.Net.NetworkCredential

GetFreeShareSpace() 공개 정적인 메소드

Retrieves information about the amount of space that is available on a disk volume, which is the total amount of space, the total amount of free space, and the total amount of free space available to the user that is associated with the calling thread. based on http://msdn.microsoft.com/en-us/library/windows/desktop/aa364937(v=vs.85).aspx
public static GetFreeShareSpace ( string share ) : long[]
share string
리턴 long[]

GetInteractiveUserList() 공개 정적인 메소드

public static GetInteractiveUserList ( ) : List
리턴 List

GetMachineDomainMembership() 공개 정적인 메소드

get local machine domain membership as NETBIOS name
public static GetMachineDomainMembership ( ) : string
리턴 string

GetMachineDomainMembershipEX() 공개 정적인 메소드

get local machine domain membership as DNS name
public static GetMachineDomainMembershipEX ( ) : string
리턴 string

GetOrSetUserProfileDir() 공개 정적인 메소드

get or create user profile directory only if the ProfileList regkey is not of SID.bak (Abstractions.User.FixProfileList) an empty or null string means error
public static GetOrSetUserProfileDir ( string username, string domain, string password ) : string
username string
domain string
password string
리턴 string

GetRegistryLocation() 공개 정적인 메소드

get RegistryKey from structenums.RegistryLocation
public static GetRegistryLocation ( structenums location ) : RegistryKey
location structenums
리턴 Microsoft.Win32.RegistryKey

GetSessionContext() 공개 정적인 메소드

returns a Dictionary of SessionID Keys and a List of usernames based on context in which a program is running. a program running as administrator will add administrator to the list
public static GetSessionContext ( ) : List>.Dictionary
리턴 List>.Dictionary

GetSessionContext() 공개 정적인 메소드

return username based on context in which a program is running. a program running as administrator will add administrator to the list session ID -1 retuns all sessions instead of a specific one
public static GetSessionContext ( int sessionID ) : List
sessionID int the seesion ID or -1 for all sessions
리턴 List

GetSessionContextParser() 공개 정적인 메소드

return username based on context in which a program is running. a program running as administrator will add administrator to the list session ID -1 retuns all sessions instead of a specific one
public static GetSessionContextParser ( int sessionID, Dictionary contextALL ) : List
sessionID int the seesion ID or -1 for all sessions
contextALL Dictionary a GetSessionContext() Directory
리턴 List

GetSessionId() 공개 정적인 메소드

public static GetSessionId ( ) : int
리턴 int

GetUserDomain() 공개 정적인 메소드

public static GetUserDomain ( int sessionId ) : string
sessionId int
리턴 string

GetUserName() 공개 정적인 메소드

public static GetUserName ( int sessionId ) : string
sessionId int
리턴 string

GetUserProfileDir() 공개 정적인 메소드

returns userprofile based on GetUserProfileDirectory only if the ProfileList regkey is not of SID.bak (Abstractions.User.FixProfileList) empty string means error
public static GetUserProfileDir ( IntPtr hToken ) : string
hToken IntPtr
리턴 string

GetUserProfilePath() 공개 정적인 메소드

returns userprofile based on SHGetFolderPath only if the profile realy exists and the ProfileList regkey is not of SID.bak (Abstractions.User.FixProfileList) empty string means error
public static GetUserProfilePath ( IntPtr hToken ) : string
hToken IntPtr
리턴 string

GetUserToken() 공개 정적인 메소드

Create a handle to the user token make sure to close the handle!!!
public static GetUserToken ( string username, string domain, string password ) : IntPtr
username string
domain string
password string
리턴 IntPtr

IsSessionLoggedOFF() 공개 정적인 메소드

public static IsSessionLoggedOFF ( int session ) : bool
session int
리턴 bool

LastError() 공개 정적인 메소드

returns GetLastWin32Error as string
public static LastError ( ) : string
리턴 string

LastError() 공개 정적인 메소드

returns GetLastWin32Error as string
public static LastError ( int error ) : string
error int
리턴 string

LogoffSession() 공개 정적인 메소드

public static LogoffSession ( int sessionId ) : bool
sessionId int
리턴 bool

MapNetworkDrive() 공개 정적인 메소드

connect to a remote computer based on http://social.msdn.microsoft.com/Forums/et-EE/netfxbcl/thread/58159e0e-aa45-4d46-a128-596c3d23ff5c
public static MapNetworkDrive ( string remoteUNC, string username, string password ) : Boolean
remoteUNC string
username string better use the domainname\username format
password string
리턴 Boolean

MapNetworkDrive() 공개 정적인 메소드

connect to a remote computer based on http://social.msdn.microsoft.com/Forums/et-EE/netfxbcl/thread/58159e0e-aa45-4d46-a128-596c3d23ff5c
public static MapNetworkDrive ( string remoteUNC, string username, string password, bool promptUser ) : Boolean
remoteUNC string
username string better use the domainname\username format
password string
promptUser bool true to for a promt, if needed
리턴 Boolean

MapNetworkDrive() 공개 정적인 메소드

Map a network drive.
public static MapNetworkDrive ( string unc, string drive, string user, string password ) : int
unc string The full UNC path.
drive string The drive letter (e.g. "Z:", "X:", etc.)
user string The username, null if you want the current user.
password string The password, null to use the default password.
리턴 int

RegistryCloseKey() 공개 정적인 메소드

public static RegistryCloseKey ( UIntPtr hKey ) : Boolean
hKey UIntPtr
리턴 Boolean

RegistryCopyKey() 공개 정적인 메소드

public static RegistryCopyKey ( UIntPtr hKey_src, string SubKey, UIntPtr hKey_dst ) : Boolean
hKey_src UIntPtr
SubKey string
hKey_dst UIntPtr
리턴 Boolean

RegistryCreateKey() 공개 정적인 메소드

public static RegistryCreateKey ( structenums RootKey, string SubKey ) : UIntPtr
RootKey structenums
SubKey string
리턴 UIntPtr

RegistryDeleteTree() 공개 정적인 메소드

public static RegistryDeleteTree ( structenums RootKey, string SubKey ) : Boolean
RootKey structenums
SubKey string
리턴 Boolean

RegistryLoad() 공개 정적인 메소드

load a regfile at hklm or hku
public static RegistryLoad ( structenums where, string name, string file ) : Boolean
where structenums hklm or hku
name string The name of the key to be created under hKey. This subkey is where the registration information from the file will be loaded
file string
리턴 Boolean

RegistryOpenKey() 공개 정적인 메소드

public static RegistryOpenKey ( structenums RootKey, string SubKey ) : UIntPtr
RootKey structenums
SubKey string
리턴 UIntPtr

RegistryUnLoad() 공개 정적인 메소드

unload regfile from regkey
public static RegistryUnLoad ( structenums where, string name ) : Boolean
where structenums hklm or hku
name string
리턴 Boolean

SendMessageToUser() 공개 정적인 메소드

send a messagebox to a session
public static SendMessageToUser ( int sessionID, string title, string message ) : Boolean
sessionID int
title string
message string
리턴 Boolean

SetPreshutdownTimeout() 공개 정적인 메소드

public static SetPreshutdownTimeout ( SafeHandle handle, structenums &myServiceStatus ) : bool
handle SafeHandle
myServiceStatus structenums
리턴 bool

SetServiceStopped() 공개 정적인 메소드

public static SetServiceStopped ( IntPtr handle, structenums &myServiceStatus ) : bool
handle IntPtr
myServiceStatus structenums
리턴 bool

ShutdownPending() 공개 정적인 메소드

public static ShutdownPending ( IntPtr handle, structenums &myServiceStatus, TimeSpan wait ) : bool
handle IntPtr
myServiceStatus structenums
wait TimeSpan
리턴 bool

StartProcessInSession() 공개 정적인 메소드

public static StartProcessInSession ( int sessionId, string cmdLine ) : Process
sessionId int
cmdLine string
리턴 System.Diagnostics.Process

StartProcessInSessionWait() 공개 정적인 메소드

public static StartProcessInSessionWait ( int sessionId, string cmdLine ) : bool
sessionId int
cmdLine string
리턴 bool

StartProcessWithToken() 공개 정적인 메소드

public static StartProcessWithToken ( IntPtr token, string cmdLine ) : Process
token IntPtr
cmdLine string
리턴 System.Diagnostics.Process

StartUserProcessInSession() 공개 정적인 메소드

public static StartUserProcessInSession ( int sessionId, string cmdLine ) : bool
sessionId int
cmdLine string
리턴 bool

StartUserProcessInSessionWait() 공개 정적인 메소드

public static StartUserProcessInSessionWait ( int sessionId, string cmdLine ) : bool
sessionId int
cmdLine string
리턴 bool

UserADD() 공개 정적인 메소드

add user to the local system based on http://social.msdn.microsoft.com/forums/en-us/csharpgeneral/thread/B70B79D9-971F-4D6F-8462-97FC126DE0AD
public static UserADD ( string username, string password, string comment ) : Boolean
username string
password string
comment string
리턴 Boolean

UserChangePassword() 공개 정적인 메소드

public static UserChangePassword ( string domainname, string username, string oldpassword, string newpassword ) : string
domainname string
username string
oldpassword string
newpassword string
리턴 string

UserDel() 공개 정적인 메소드

delete a local user based on http://social.msdn.microsoft.com/forums/en-us/csharpgeneral/thread/B70B79D9-971F-4D6F-8462-97FC126DE0AD
public static UserDel ( string username ) : Boolean
username string
리턴 Boolean

UserExists() 공개 정적인 메소드

return true if a local user exists
public static UserExists ( string username ) : Boolean
username string
리턴 Boolean

UserExists() 공개 정적인 메소드

return true if a local user exists
public static UserExists ( string username, string domain ) : Boolean
username string
domain string
리턴 Boolean

UserGet() 공개 정적인 메소드

returns local user settings as a ref of an USER_INFO_4 struct based on http://social.msdn.microsoft.com/forums/en-us/csharpgeneral/thread/B70B79D9-971F-4D6F-8462-97FC126DE0AD
public static UserGet ( string username, string domain, structenums &userinfo4 ) : Boolean
username string
domain string
userinfo4 structenums a ref of an USER_INFO_4 struct
리턴 Boolean

UserGet() 공개 정적인 메소드

returns local user settings as a ref of an USER_INFO_4 struct based on http://social.msdn.microsoft.com/forums/en-us/csharpgeneral/thread/B70B79D9-971F-4D6F-8462-97FC126DE0AD
public static UserGet ( string username, structenums &userinfo4 ) : Boolean
username string
userinfo4 structenums a ref of an USER_INFO_4 struct
리턴 Boolean

UserMod() 공개 정적인 메소드

modify local user settings based on a USER_INFO_4 struct based on http://social.msdn.microsoft.com/forums/en-us/csharpgeneral/thread/B70B79D9-971F-4D6F-8462-97FC126DE0AD
public static UserMod ( string username, structenums userInfo4 ) : Boolean
username string
userInfo4 structenums
리턴 Boolean

ValidateCredentials() 공개 정적인 메소드

Attempts to validate the user's credentials for a local account using a pInvoke to LogonUser.
public static ValidateCredentials ( string username, string password ) : bool
username string The username
password string The password
리턴 bool

ValidateCredentials() 공개 정적인 메소드

Attempts to validate the user's credentials using a pInvoke to LogonUser.
public static ValidateCredentials ( string username, string domain, string password ) : bool
username string The username
domain string The domain
password string The password
리턴 bool

ValidateUser() 공개 정적인 메소드

Attempts to validate the user's credentials using a pInvoke to LogonUser but ignores password change response.
public static ValidateUser ( string username, string domain, string password ) : bool
username string The username
domain string The domain
password string The password
리턴 bool

VersionsInfo() 공개 정적인 메소드

get the real windows version http://www.codeproject.com/Articles/678606/Part-Overcoming-Windows-s-deprecation-of-GetVe
public static VersionsInfo ( ) : structenums.OSVERSIONINFOW
리턴 structenums.OSVERSIONINFOW

WTSQueryUserToken() 공개 정적인 메소드

public static WTSQueryUserToken ( int sessionId ) : IntPtr
sessionId int
리턴 IntPtr

WTSRegister() 공개 정적인 메소드

public static WTSRegister ( IntPtr handle ) : bool
handle IntPtr
리턴 bool

WTSUnRegister() 공개 정적인 메소드

public static WTSUnRegister ( IntPtr handle ) : bool
handle IntPtr
리턴 bool