1,387 views

Restrict access to process

The following code is really simple. It restricts access to the current process. In this way no other process can open the process handle and for example terminate this process.
uses
  JwaWindows,
  JwsclSecureObjects,
  JwsclDescriptor,
  JwsclToken,
  JwsclTypes,
  JwsclAcl,
  JwsclKnownSid;
var
  SD : TJwSecurityDescriptor;
  hProcess : TJwProcessHandle;
begin
  JwInitWellKnownSIDs;
  hProcess := OpenProcess(READ_CONTROL or WRITE_DAC, false, GetCurrentProcessId());
  if hProcess <> 0 [...]

5,858 views

CreateProcess in full glory

CreateProcess is a little tricky to use. Thus I write the full example code here so you don’t have to worry.
uses SysUtils, JwaWindows, JwsclStrings;
procedure StartApp(const App, Parameters, CurDir : TJwString);
var
  StartupInfo: {$IFDEF UNICODE}TStartupInfoW{$ELSE}TStartupInfoA{$ENDIF};
  ProcInfo : TProcessInformation;
  pEnv : Pointer;
  pCurDir,
  pCmdLine : TJwPChar;
begin
  ZeroMemory(@StartupInfo, sizeof(StartupInfo));
  StartupInfo.cb          := SizeOf(StartupInfo);
  StartupInfo.lpDesktop   [...]

1,334 views

How to get the threads of a process?

Yesterday, I described how to get the process of a window. Today I show you how to obtain the threads of a process.
There are two ways to retrieve all the threads of a foreign process.

Use the Tool Help Library. There is also a sample about enumerating threads. So I am not going to to show [...]

3,845 views

It is impossible to use SetThreadDesktop and the VCL at the same time because a thread can only show windows on one desktop at a time. However VCL is not written for the use with multiple threads, so there is no way to show Delphi forms of same process on two different desktops. SetThreadDesktop [...]

988 views

How to get the process of a window?

This answer is very easy – just use GetWindowThreadProcessId
JWA declares it as followed:
function GetWindowThreadProcessId(hWnd: HWND; lpdwProcessId: LPDWORD): DWORD; stdcall;
The function returns an identifier (not a handle) and also may set lpdwProcessId to the identifier (again not a handle!) if it is not nil. Be aware that identifiers aren’t handles, so you must not close them [...]

689 views

The people from Microsoft decided that the user has to be in full control over the computer. So there is no assured way to make a program user resistant. She can always use TerminateProcess to forcibly kill the process.

556 views

The case of the unexplained…

As you maybe already have noted, I use the ProcessExplorer of Mark Russinovich a lot. It is a very powerful tool, that can help you finding out what’s going on in your Windows system…

Processes

Threads

Properties

Handles

Kernel

Bluescreens (WinDbg)

and many more

If you are interested in getting an introduction into the great application, you should watch this video. Mark presents [...]

Paypal donation (EUR)

Amount:
Website(Optional):

Archives

 

March 2010
M T W T F S S
« Feb    
1234567
891011121314
15161718192021
22232425262728
293031