C

How to Hide a Process

Fadıl

Processes can be hidden in both Windows (from the Ctrl+alt+delete menu) and Linux (from ps and top).
In windows:
Programs listed as services are not shown up.
Example Borland c code:

//--------------HiddenApp.cpp--------------
#include 
#pragma hdrstop

USERES("HiddenApp.res");
USEFORM("Unit1.cpp",Form1);

typedef DWORD (WINAPI *TRegisterServiceProcess)(DWORD,DWORD);
bool registered=false;

//-----------------------------------------------------------------------
void __fastcall reg(bool which) //true=register, false=unregister
{
  HMODULE hmod;
  TRegisterServiceProcess pReg;
  hmod = LoadLibrary("kernel32.dll");

  if (!hmod) return;
  (FARPROC)pReg = (FARPROC)::GetProcAddress(hmod,"RegisterServiceProcess");
  if (!pReg) {FreeLibrary(hmod); return;}
  else 
  {
    if (which)
      pReg(0,1); //unregister our process  
    else
      pReg(0,0);
  }
  registered = true;
  FreeLibrary(hmod);
}
//-----------------------------------------------------------------------
WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR,int)
{  
  try
  {
    reg(true);
    Application->Initialize();
    Application->CreateForm(__classid(TForm1), &Form1;);
    Application->Run();
  }
  catch (Exception &exception;)
  {
    Application->ShowException(&exception;);
  }

  if (registered) reg(false);
  return 0;
}
//--------------eof--------------------------------------------------------

Example delphi code:

7 Common Mistakes That C Programmers Often Make

Fadıl

I have had the opportunity to teach C among young developers, and I have noticed that certain errors are repeated in almost every one of them. It is mainly about mistakes that, once you notice, you do not commit them again because they are easy to remember. However, without a developer is not aware of them, it can cause many problems in the efficiency of the application and in the quality of the developer software. That is why I have decided to compile the 7 most frequent mistakes of the C programmers.