Desktop Functions: Smart Device Functions:
|
Search Results for "SID" in [All]misc1: Comments
Great idea. I would also be interested in a category on PInvoke how-tos. for example I'm still trying to figure out how to unmarshal an array of delegates on the unmanaged side - feel free to chime in if you happen to know that The marshalling restrictions are one problem, as well as which DLL is actually used. From the CF side, we usually do the dumb downed one to work on both desktop and device. Is it possible to add our own modules to the left side? I didn't see a way to do it. Mainly, it is missing a lot of Windows CE (Smart Device) dll's. In particular, I was looking for toolhelp.dll. There is a few differences between this and the same functions/structures that are in kernel32.dll. So, could you please add this so I can share all my new knowledge with the rest of the world. Thanks. You definately need to get the site working in non-IE browsers. And you may want to consider removing the fading page transitions. I don't know about other people but I personally find them irritating. -- Adrian Ritchie (http://www.gringod.com) user32
static extern bool AllowSetForegroundWindow(int dwProcessId);
Shared Function AllowSetForegroundWindow(ByVal dwProcessId As Integer) As Boolean This assumes that the AnimateWindow function is declared inside class User32 5: ClipCursor
/// <param name="right">Right most side.</param>
/// <param name="bottom">Bottom most side.</param> Inside a Windows Form:
//Optional int ProcessID;
//Optional Win32.GetWindowThreadProcessId(GetForegroundWindow(),out ProcessID)
//Optional if( ProcessID == wordProcess.Id ) return ApplicationState.Focused; Consider System.Windows.Forms.Screen.
Private Const UOI_USER_SID = 4
private const int UOI_USER_SID = 4; 11: GetWindow
static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
// When you don't want the ProcessId, use this overload and pass IntPtr.Zero for the second parameter
static extern uint GetWindowThreadProcessId(IntPtr hWnd, IntPtr ProcessId);
Private Shared Function GetWindowThreadProcessId(ByVal hwnd As IntPtr, _
ByRef lpdwProcessId As IntPtr) As UInteger
''' <param name="lpdwProcessId">A pointer to a variable that receives the process identifier. If this parameter is not NULL, GetWindowThreadProcessId copies the identifier of the process to the variable; otherwise, it does not. </param>
Private Declare Auto Function GetWindowThreadProcessId Lib "user32.dll" (ByVal hwnd As IntPtr, _
ByRef lpdwProcessId As Integer) As Integer We can use this API to get ProcessID from Window's Title by combining this function with EnumWindows.
GetWindowThreadProcessId(lngAccessHwnd, lngPid)
Public Declare Auto Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As IntPtr, ByRef lpdwProcessId As IntPtr) As IntPtr
Dim iProcessID As IntPtr
GetWindowThreadProcessId(hOwner, iProcessID)
oResult = Process.GetProcessById(iProcessID.ToInt32)
IntPtr pID = GetWindowThreadProcessId(GetForegroundWindow(), IntPtr.Zero); GetWindowThreadProcessId returns the id of the thread that created the target window. To get the process id of a window, use the first c# signature above, and:
int processID = 0;
int threadID = GetWindowThreadProcessId(hWnd, out processID);
static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
// When you don't want the ProcessId, use this overload and pass IntPtr.Zero for the second parameter
static extern uint GetWindowThreadProcessId(IntPtr hWnd, IntPtr ProcessId);
Private Shared Function GetWindowThreadProcessId(ByVal hwnd As IntPtr, _
ByRef lpdwProcessId As Integer) As Integer
''' <param name="lpdwProcessId">A pointer to a variable that receives the process identifier. If this parameter is not NULL, GetWindowThreadProcessId copies the identifier of the process to the variable; otherwise, it does not. </param>
Private Declare Auto Function GetWindowThreadProcessId Lib "user32.dll" (ByVal hwnd As IntPtr, _
ByRef lpdwProcessId As Integer) As Integer We can use this API to get ProcessID from Window's Title by combining this function with EnumWindows.
GetWindowThreadProcessId(lngAccessHwnd, lngPid)
Public Declare Auto Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As IntPtr, ByRef lpdwProcessId As IntPtr) As IntPtr
Dim iProcessID As IntPtr
GetWindowThreadProcessId(hOwner, iProcessID)
oResult = Process.GetProcessById(iProcessID.ToInt32)
IntPtr pID = GetWindowThreadProcessId(GetForegroundWindow(), IntPtr.Zero); GetWindowThreadProcessId returns the id of the thread that created the target window. To get the process id of a window, use the first c# signature above, and:
int processID = 0;
int threadID = GetWindowThreadProcessId(hWnd, out processID); 14: IsHungAppWindow 15: LoadImage
/// <param name="resId">Name of the resource icon that should be loaded.
public static Icon GetIconFromExe(string path = null, string resId = "#32512", int size = 32) {
IntPtr ptr = LoadImage(h, resId, 1, size, size, 0); 16: MessageBeep With the enum beepType you get intellisense when you type "beep." and you can then select the kind of beep you want. For dylan.NET, use the fields containing the integer values inside the WinSnd class of dnu.dll at http://dylandotnetapps.codeplex.com/ 17: MonitorFromRect Consider System.Windows.Forms.Screen class and its FromRectangle. Consider System.Windows.Forms.Screen. 18: MONITORINFO
/// The rest of the area in rcMonitor contains system windows such as the task bar and side bars.
/// By convention, the right and bottom edges of the rectangle are normally considered exclusive.
/// In other words, the pixel whose coordinates are ( right, bottom ) lies immediately outside of the the rectangle. 19: MONITORINFOEX
/// The rest of the area in rcMonitor contains system windows such as the task bar and side bars.
/// By convention, the right and bottom edges of the rectangle are normally considered exclusive.
/// In other words, the pixel whose coordinates are ( right, bottom ) lies immediately outside of the the rectangle. 20: MoveWindow
/// <param name="X">C++ ( X [in]. Type: int )<br />Specifies the new position of the left side of the window.</param>
''' <param name="X">Specifies the new position of the left side of the window.</param> 21: SB_GETTEXT
Int32 processId
private static extern int GetWindowThreadProcessId(
out Int32 lpdwProcessId
StatusBar.GetWindowThreadProcessId(this._handle, out pid); 22: ScreenToClient
/** this takes the POINT, which is using screen coords (0,0 in top left screen) and converts them into coords inside specified window (0,0 from top left of hWnd) **/ 23: SendInput
[testing.windows]::SetForegroundWindow( @( Get-Process notepad |? { $_.id -in @( get-wmiobject win32_process -filter "name='notepad.exe'" |% { if ( $_.getowner().user -eq $env:username ) { $_.processid } } ) } )[0].MainWindowHandle)
/// calling the AllowSetForegroundWindow function. The process specified by dwProcessId loses the ability to set     uint foreThread = GetWindowThreadProcessId(GetForegroundWindow(), IntPtr.Zero); 25: SetWindowPos
/// <param name="X">C++ ( X [in]. Type: int )<br />The new position of the left side of the window, in client coordinates.</param>
/// hwnd and window manager operations are only effective inside a session and cross-session attempts to manipulate 26: TCITEM
uint ProcessID;
GetWindowThreadProcessId((IntPtr)handle, out ProcessID);
ProcessAccessFlags.VMWrite | ProcessAccessFlags.QueryInformation, false, ProcessID);
static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
static extern IntPtr OpenProcess(ProcessAccessFlags dwDesiredAccess, [MarshalAs(UnmanagedType.Bool)] bool bInheritHandle, uint dwProcessId); 27: TrackMouseEvent
TRACKMOUSEEVENT tme; // Define it on the outside so you dont recreate it each time the mouse enters setupapi28: SetupCopyOEMInf If the specified INF file already exists a further check is performed to determine if the specified INF file contains a CatalogFile= entry in its Version section. If it does, the INF files's \Inf primary filename with a ".CAT" extension is used to determine if the catalog is already installed. If there is a catalog installed, but it isn't the same as the catalog associated with the source INF, this is not considered to be a match and enumerations continue. It is possible to have multiple identical INF files with unique catalogs contained in \Inf directory. If an existing match is not found, the INF and CAT files are installed under a new and unique name. OEM INFs that don't specify a CatalogFile= entry are considered invalid with respect to digital signature verification. On the VB side i could not get a valid result passing nulls to the optional parameters, but passing initialized structures seems to work fine. fbwflibConsidering the parameters of this function are boolean values you can marshal them as such: mpr
/// degradation taken into consideration. fltlib32: FilterLoad Consider using RtlAdjustPrivilege() to adjust privileges, much easier than getting AdjustTokenPrivileges() to work iphlpapi
if ($services[$j].ProcessId -eq $y[$i].owningPid) { rapi34: CeCreateProcess
public int dwProcessID; ole3235: CLSIDFromProgID
static extern Guid CLSIDFromProgIDEx(string lpszProgID);
Friend Shared Function CLSIDFromProgIDEx(ByVal lpszProgID As String) As Guid
static extern Guid CLSIDFromProgIDEx(string lpszProgID);
Friend Shared Function CLSIDFromProgIDEx(ByVal lpszProgID As String) As Guid 37: CLSIDFromString
static extern Guid CLSIDFromString(string lpsz);
static extern int CLSIDFromString(string lpsz, out Guid guid); 38: CoCreateInstance
[In, MarshalAs(UnmanagedType.LPStruct)] Guid rclsid,
Guid CLSID_ShellDesktop = new Guid("00021400-0000-0000-C000-000000000046");
Type shellDesktopType = Type.GetTypeFromCLSID(CLSID_ShellDesktop, true); If you just want to create an instance on a specific server, you can pass the server name into GetTypeFromCLSID:
Guid CLSID_ShellDesktop = new Guid("00021400-0000-0000-C000-000000000046");
Type shellDesktopType = Type.GetTypeFromCLSID(CLSID_ShellDesktop, "REMOTESERVER", true);
[In, MarshalAs(UnmanagedType.LPStruct)] Guid rclsid,
Guid CLSID_ShellDesktop = new Guid("00021400-0000-0000-C000-000000000046");
Type shellDesktopType = Type.GetTypeFromCLSID(CLSID_ShellDesktop, true); // (Guid, serverName, throwOnError) 40: CoGetClassObject
[In, MarshalAs(UnmanagedType.LPStruct)] Guid rclsid,
(<[In](), MarshalAs(UnmanagedType.LPStruct)> ByVal rclsid As Guid, _
pclsid, [MarshalAs(UnmanagedType.IUnknown)] object pUnkOuter, uint dwClsCtx, 42: CoGetPSClsid
[MarshalAs(UnmanagedType.LPStruct)] Guid rclsid,
static extern int CreateClassMoniker([In] ref Guid rclsid,
Guid ptrClsId = new Guid();
pPersistStream.GetClassID(ref ptrClsId);
string strStreamGUID = ptrClsId.ToString().ToUpper(); 47: OleCreate
int cPages, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 6)] Guid[] lpPageClsID,
ByVal pPageClsID As Int32, _
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 6)] Guid[] lpPageClsID,
UInt32 cPages, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 6)] Guid[] lpPageClsID,
ByVal pPageClsID As Int32, _ 49: OleGetClipboard The original signature requires a definition for the COM version of IDataObject, as defined in objidl.h. The lack of this definition implies that the [System.Windows.Forms.IDataObject] interface can be used, but this interface, although COM-visible, is not the same as the COM one and results in a [System.InvalidCastException].
static extern int OleRegGetUserType([In] ref Guid clsid, uint dwFormOfType,
static extern int OleRegGetUserType([In] ref Guid clsid, uint dwFormOfType, out IntPtr pszBuff);
Guid clsid = new Guid(0x3e6b91f5, 0xbc86, 0x40b8, 0x80, 0xc9, 0x41, 0xb3, 0x4b, 0x4e, 0x8f, 0x11);
int nResult = OleRegGetUserType(ref clsid, (uint)USERCLASSTYPE.USERCLASSTYPE_FULL, out pszBuf); 51: ProgIDFromCLSID
static extern int ProgIDFromCLSID([In] ref Guid clsid,
static extern string ProgIDFromCLSID([In()]ref Guid clsid);
static extern int ProgIDFromCLSID([In()]ref Guid clsid, [MarshalAs(UnmanagedType.LPWStr)]out string lplpszProgID);
int result = ProgIDFromCLSID(ref g, out progId);
static extern string ProgIDFromCLSID([In()]ref Guid clsid);
string progId = ProgIDFromCLSID(ref g); 52: ReadClassStg 53: ReadClassStm 54: StringFromCLSID 55: WriteClassStg 56: WriteClassStm winmmThe winmm dll may not execute properly on 64-bit systems. Consequently, the StructLayout must be Sequential, with CharSet = Ansi, and Pack = 4. This particular type has some special layout considerations (the c union keyword) which typically means developers would use the explicit layout. However, the explicit layout breaks down on 64-bit systems for any type with an IntPtr in the type. Consequently, the C# types have been redesigned to use Sequential layout so that they will automatically adjust to 64-bit systems. This means private fields with public properties which perform the gunky work of making it look like there is a union. The winmm dll may not execute properly on 64-bit systems. Consequently, the StructLayout must be Sequential, with CharSet = Ansi, and Pack = 4. This particular type has some special layout considerations (the c union keyword) which typically means developers would use the explicit layout. However, the explicit layout breaks down on 64-bit systems for any type with an IntPtr in the type. Consequently, the C# types have been redesigned to use Sequential layout so that they will automatically adjust to 64-bit systems. This means private fields with public properties which perform the gunky work of making it look like there is a union. ntdsapi59: DsCrackNames
// domain object resides in. Thus DS_NAME_RESULT_ITEM?.pDomain
// This is the string representation of a SID. Invalid for formatDesired.
// See sddl.h for SID binary <--> text conversion routines.
DS_SID_OR_SID_HISTORY_NAME = 11, wtsapi32
Console.WriteLine ("Process ID: " & strucProcessInfo.ProcessID) Cut off search results after 60. Please refine your search. |